Menu

#3 Null pointer exception when used in Netbeans IDE

open
nobody
None
5
2008-02-12
2008-02-12
No

If you attempt to use this package, a NullPointerException occurs in NetBeans 6.0 IDE when in Design Mode on a Visual Web Page.

The reason is the code that looks like:

String pluginClass = session.getServletContext().getInitParameter(Constants.SECURITY_EL_RESOLVER);

in method SecurityVariableResolver.getAttributeResolver.

In the IDE design mode, there is no HttpSession, so a NullPointerException is thrown on this line. I modified the code to read:

String pluginClass = null;
if (null != session) {
ServletContext servletContext = session.getServletContext();
if (null != servletContext) {
pluginClass = servletContext.getInitParameter(Constants.SECURITY_EL_RESOLVER);
}
}

and this package can now be used in this environment.

Discussion


Log in to post a comment.