[JBoss Seam] - Re: NullPointer during Identity.hasPermission ?
by kariem
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
18 years, 2 months
[JBoss jBPM] - Problem instantiating a delegate class
by TMK
Hi,
I have a small processdefinition which calls a ActionHandler when entering a transition:
| <?xml version="1.0" encoding="UTF-8"?>
|
| <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="TransportProcessDef">
| <start-state name="start">
| <transition name="" to="state1">
| <action class="com.xxx.man.MyAction" name="Doing some complex things"></action>
| </transition>
| </start-state>
| <state name="state1">
| <transition name="toEnd1" to="end1"></transition>
| </state>
| <end-state name="end1"></end-state>
| </process-definition>
|
When I run the process, I get the following exception:
anonymous wrote : ERROR [org.jbpm.instantiation.Delegation] couldn't instantiate delegation class 'com.ptvag.jabba.tourmgmt.MyAction'
| java.lang.NullPointerException...
I don't understand this behaviour, because I can instantiate an object of the Class MyAction with a Classloader without any problem:
| Class clazz = c.loadClass("com.xxx.man.MyAction");
| MyAction a = (MyAction) clazz.newInstance();
| a.execute(null);
|
Can anybody help me with this problem? Thanks in advance!
Regards,
TMK
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128438#4128438
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128438
18 years, 2 months