o:importFunctions' failure to find a function could be more explicit #164

Closed
VsevolodGolovanov opened this Issue Sep 15, 2015 · 1 comment

Projects

None yet

2 participants

@VsevolodGolovanov

OmniFaces 2.1.

Say, we're importing a correct existing class, but it has no specified function.

<o:importFunctions type="org.company.AnExistingClass" />
#{AnExistingClass.nonExistentFunction()}

This results in a not very telling exception:

Caused by: java.lang.NullPointerException
    at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1124) [rt.jar:1.7.0_80]
    at org.omnifaces.taghandler.ImportFunctions$1.resolveFunction(ImportFunctions.java:139) [omnifaces-2.1.jar:2.1]
    at com.sun.el.lang.FunctionMapperFactory.resolveFunction(FunctionMapperFactory.java:71) [javax.el-3.0.1-b05.jar:]
    at com.sun.el.lang.ExpressionBuilder.visit(ExpressionBuilder.java:272) [javax.el-3.0.1-b05.jar:]
    at com.sun.el.parser.SimpleNode.accept(SimpleNode.java:172) [javax.el-3.0.1-b05.jar:]

ImportFunctions$1.resolveFunction could've thrown a RuntimeException with a message like "The class AnExistingClass doesn't have the nonExistentFunction static method".

@BalusC BalusC closed this in 99900c8 Sep 15, 2015
@BalusC
Member
BalusC commented Sep 15, 2015

This was an oversight, those checks on user errors are usually over all place in OmniFaces. Thank you for reporting and making OmniFaces better!

Fix is available in today's latest 2.2 snapshot.

@BalusC BalusC added the enhancement label Oct 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment