User: simone
Date: 01/01/04 01:16:16
Modified: src/main/org/jboss/ejb/plugins
EntityInstanceInterceptor.java
Log:
Fixed a NPE happening when activation throws exceptions.
Thanks to Scott M Stark ([EMAIL PROTECTED]).
Revision Changes Path
1.27 +33 -27
jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java
Index: EntityInstanceInterceptor.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- EntityInstanceInterceptor.java 2000/12/27 18:39:33 1.26
+++ EntityInstanceInterceptor.java 2001/01/04 09:16:16 1.27
@@ -45,7 +45,7 @@
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
-* @version $Revision: 1.26 $
+* @version $Revision: 1.27 $
*/
public class EntityInstanceInterceptor
extends AbstractInterceptor
@@ -209,40 +209,46 @@
throw e;
} finally
{
- // Logger.debug("Release instance for "+id);
- try
+ // Logger.debug("Release instance for "+id);
+
+ // ctx can be null if cache.get throws an Exception, for
+ // example when activating a bean.
+ if (ctx != null)
{
- mutex.acquire();
+ try
+ {
+ mutex.acquire();
- // unlock the context
- ctx.unlock();
+ // unlock the context
+ ctx.unlock();
- if (ctx.getId() == null)
- {
+ if (ctx.getId() == null)
+ {
- // Work only if no transaction was encapsulating
this remove()
- if (ctx.getTransaction() == null)
+ // Work only if no transaction was
encapsulating this remove()
+ if (ctx.getTransaction() == null)
+ {
+ // Here we arrive if the bean
has been removed and no
+ // transaction was associated
with the remove, or if
+ // the bean has been passivated
+
+ // Remove from cache
+ cache.remove(key);
+
+ // It has been removed -> send
to the pool
+
container.getInstancePool().free(ctx);
+ }
+ }
+ else
{
- // Here we arrive if the bean has been
removed and no
- // transaction was associated with the
remove, or if
- // the bean has been passivated
-
- // Remove from cache
- cache.remove(key);
-
- // It has been removed -> send to the
pool
- container.getInstancePool().free(ctx);
- }
+ // Yeah, do nothing
+ }
}
- else
+ catch (InterruptedException ignored) {}
+ finally
{
- // Yeah, do nothing
+ mutex.release();
}
- }
- catch (InterruptedException ignored) {}
- finally
- {
- mutex.release();
}
}
}
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
