Wednesday, October 20, 2010

ADF Faces RC: Resolving "'BracketSuffix' returned null"

javax.el.PropertyNotFoundException: Target Unreachable, 'BracketSuffix' returned null
 at com.sun.el.parser.AstValue.getTarget(
 at com.sun.el.parser.AstValue.getType(
This is my story:
I have a string status attribute which is represented by a single character in the database but should be displayed in my pages as meaningful words as follows:
  • A -Active
  • P -Pending
  • U -Undefined
  • N -New
So I created a Constants class with a map attribute that holds the appropriate key-value pairs and defined this class as an application scoped managed bean.
I refer this in the page as follows:
<af:panelLabelAndMessage label="#{bindings.status.hints.label}"
  <af:outputText value="#{nisConstants.statusMap[bindings.status.inputValue]}" id="ot1"

And then I started encountering the error above. This is pretty hard to identify if you have a lot of expression in the page that has brackets, and I hope that the ADF Development team will improve on defining the error by including in the trace the expression that causes the problem.

Below is my analysis:
I easily avoided such error by initializing my status attribute to some default value like below:
    private String status = "N";



  1. Saved me a few hours. Thanks!!

  2. Just to add something over here. I was facing the same problem. In the case above, if inputValue is null then also this error would come so it implies that the key being passed should be a non null value.