Thank you, Shane. I was aware that it is a varargs param, but I did not know 
that it behaved differently for hasPermission(String, String) and 
hasPermission(String, String, null).

In both cases it should throw a NullPointer in this line:
for (int i = 0; i < arg.length; i++)

Apart from that, as I said I have stumbled into this solution after several 
iterations. The code I have had previously looked like this (adapted from the 
documentation)
public void deleteCustomer() {
  |     
Identity.instance().checkRestriction("#{s:hasPermission('customer','delete',null)}");
  | }
The null was added by me. Without the third parameter I get the following error
javax.el.ELException: Function 's:hasPermission' specifies 3 params, but 2 were 
declared
  |     at org.jboss.el.lang.ExpressionBuilder.visit(ExpressionBuilder.java:181)
  |     at org.jboss.el.parser.SimpleNode.accept(SimpleNode.java:129)
  |     at 
org.jboss.el.lang.ExpressionBuilder.prepare(ExpressionBuilder.java:138)
  |     at org.jboss.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:152)
  |     at 
org.jboss.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:195)
  |     at 
org.jboss.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:68)
  |     at 
org.jboss.seam.el.SeamExpressionFactory.createValueExpression(SeamExpressionFactory.java:98)
No way to specify only 2 parameters, and 3 parameters result in a null pointer. 
I cannot believe this is intended.


I have some questions now:
* is there a general contract for the different behavior on the hasPermission 
method without a 3rd parameter and null as the third parameter? (the null 
pointer is thrown, when I use the syntax with s:checkPermission)
  | * Is the last exception ok this way?
  | * Shouldn't there be a method without the third parameter?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128447#4128447

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128447
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to