[seam-commits] Seam SVN: r9472 - trunk/src/wicket/org/jboss/seam/wicket/ioc.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Fri Oct 31 13:51:25 EDT 2008
Author: pete.muir at jboss.org
Date: 2008-10-31 13:51:24 -0400 (Fri, 31 Oct 2008)
New Revision: 9472
Modified:
trunk/src/wicket/org/jboss/seam/wicket/ioc/BijectionInterceptor.java
trunk/src/wicket/org/jboss/seam/wicket/ioc/JavassistInstrumentor.java
Log:
JBSEAM-3594, support fix NPE, thanks to Clint Popetz
Modified: trunk/src/wicket/org/jboss/seam/wicket/ioc/BijectionInterceptor.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/ioc/BijectionInterceptor.java 2008-10-31 17:36:40 UTC (rev 9471)
+++ trunk/src/wicket/org/jboss/seam/wicket/ioc/BijectionInterceptor.java 2008-10-31 17:51:24 UTC (rev 9472)
@@ -37,7 +37,7 @@
InstrumentedComponent enclosingInstance = invocationContext.getInstrumentedComponent().getEnclosingInstance();
while (enclosingInstance != null)
{
- if (!enclosingInstance.getHandler().isReentrant())
+ if (enclosingInstance.getHandler() != null && !enclosingInstance.getHandler().isReentrant())
{
WicketComponent.getInstance(enclosingInstance.getClass()).inject(enclosingInstance);
enclosingInstance = enclosingInstance.getEnclosingInstance();
@@ -54,7 +54,7 @@
InstrumentedComponent enclosingInstance = invocationContext.getInstrumentedComponent().getEnclosingInstance();
while (enclosingInstance != null)
{
- if (!enclosingInstance.getHandler().isReentrant())
+ if (enclosingInstance.getHandler() != null && !enclosingInstance.getHandler().isReentrant())
{
WicketComponent.getInstance(enclosingInstance.getClass()).disinject(enclosingInstance);
enclosingInstance = enclosingInstance.getEnclosingInstance();
Modified: trunk/src/wicket/org/jboss/seam/wicket/ioc/JavassistInstrumentor.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/ioc/JavassistInstrumentor.java 2008-10-31 17:36:40 UTC (rev 9471)
+++ trunk/src/wicket/org/jboss/seam/wicket/ioc/JavassistInstrumentor.java 2008-10-31 17:51:24 UTC (rev 9472)
@@ -137,7 +137,7 @@
CtClass instrumentedComponent = classPool.get(InstrumentedComponent.class.getName());
implementation.addInterface(instrumentedComponent);
CtMethod getHandlerMethod = CtNewMethod.getter("getHandler", handlerField);
- CtMethod getEnclosingInstance = CtNewMethod.make("public " + InstrumentedComponent.class.getName() +" getEnclosingInstance() { return handler.getEnclosingInstance(this); }", implementation);
+ CtMethod getEnclosingInstance = CtNewMethod.make("public " + InstrumentedComponent.class.getName() +" getEnclosingInstance() { return handler == null ? null : handler.getEnclosingInstance(this); }", implementation);
implementation.addMethod(getEnclosingInstance);
implementation.addMethod(getHandlerMethod);
@@ -181,7 +181,8 @@
private static String createBody(CtClass clazz, CtMethod method, CtMethod newMethod) throws NotFoundException
{
- String src = "{" + createMethodObject(method) + "handler.beforeInvoke(this, method);" + createMethodDelegation(newMethod) + "return ($r) handler.afterInvoke(this, method, ($w) result);}";
+ String src = "{" + createMethodObject(method) + "if (this.handler != null) this.handler.beforeInvoke(this, method);" + createMethodDelegation(newMethod) + "if (this.handler != null) result = ($r) this.handler.afterInvoke(this, method, ($w) result); return ($r) result;}";
+
log.trace("Creating method " + clazz.getName() + "." + newMethod.getName() + "(" + newMethod.getSignature() + ")" + src);
return src;
}
@@ -203,7 +204,7 @@
private static String wrapInExceptionHandler(String src)
{
- return "try {" + src + "} catch (Exception e) { throw new RuntimeException(handler.handleException(this, method, e)); }";
+ return "try {" + src + "} catch (Exception e) { throw new RuntimeException(this.handler == null ? e : this.handler.handleException(this, method, e)); }";
}
private static String createParameterTypesArray(CtBehavior behavior) throws NotFoundException
More information about the seam-commits
mailing list