Author: norman.richards(a)jboss.com
Date: 2008-04-18 16:39:24 -0400 (Fri, 18 Apr 2008)
New Revision: 7982
Modified:
branches/Seam_2_0/src/main/org/jboss/seam/Component.java
Log:
JBSEAM-2908
Modified: branches/Seam_2_0/src/main/org/jboss/seam/Component.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/Component.java 2008-04-18 18:54:25 UTC (rev
7981)
+++ branches/Seam_2_0/src/main/org/jboss/seam/Component.java 2008-04-18 20:39:24 UTC (rev
7982)
@@ -1956,30 +1956,37 @@
}
}
- public Object newInstance()
- {
- if ( log.isDebugEnabled() ) log.debug("instantiating Seam component: " +
name);
-
- Object instance;
- try
- {
- instance = instantiate();
- }
- catch (Exception e)
- {
- throw new InstantiationException("Could not instantiate Seam component:
" + name, e);
- }
-
- if ( getScope()!=STATELESS )
- {
- getScope().getContext().set(name, instance); //put it in the context _before_
calling the create method
- callCreateMethod(instance);
- if ( Events.exists() )
Events.instance().raiseEvent("org.jboss.seam.postCreate." + name, instance);
- }
-
- return instance;
- }
-
+ public Object newInstance()
+ {
+ if (log.isDebugEnabled()) {
+ log.debug("instantiating Seam component: " + name);
+ }
+
+ Object instance;
+ try {
+ instance = instantiate();
+
+ if (getScope()!=STATELESS) {
+ //put it in the context _before_ calling the create method
+ getScope().getContext().set(name, instance);
+
+ callCreateMethod(instance);
+
+ if (Events.exists()) {
+ Events.instance().raiseEvent("org.jboss.seam.postCreate." +
name, instance);
+ }
+ }
+ } catch (Exception e) {
+ if (getScope()!=STATELESS) {
+ getScope().getContext().remove(name);
+ }
+ throw new InstantiationException("Could not instantiate Seam component:
" + name, e);
+ }
+
+
+ return instance;
+ }
+
private void callDefaultRemoveMethod(Object instance)
{
if ( hasDefaultRemoveMethod() )
Show replies by date