If
in the conditional expression is removed then, it causedjava.lang.StringIndexOutOfBoundsException
to be thrown
Indeed, reproduced it. That's technically a bug in PrimeFaces' GraphicImageRenderer
. At line 70, it should have done a if(name != null && !name.isEmpty())
instead of alone name != null
before trying to get it as a resource.
I'm not sure if it's for them worth to fix it as it actually doesn't make sense to specify an empty name
and the workaround is relatively easy by conditionally rendering two images, one without the name and another with the name:
<p:graphicImage alt="#{row.prodName}" rendered="#{empty row.prodImage}" />
<p:graphicImage library="fileUpload" name="product_image/thumb/#{row.prodImage}" alt="#{row.prodName}" rendered="#{not empty row.prodImage}" />