You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2010/01/05 21:23:28 UTC
svn commit: r896199 - in /openwebbeans/trunk/webbeans-impl/src/main:
java/org/apache/webbeans/config/ java/org/apache/webbeans/conversation/
java/org/apache/webbeans/intercept/ resources/openwebbeans/
Author: gerdogdu
Date: Tue Jan 5 20:23:28 2010
New Revision: 896199
URL: http://svn.apache.org/viewvc?rev=896199&view=rev
Log:
[OWB-217] IllegalStateException must be thrown on Already Begin or End Conversations
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java?rev=896199&r1=896198&r2=896199&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java Tue Jan 5 20:23:28 2010
@@ -97,6 +97,7 @@
public final static String WARN_0004 = "WARN_0004"; // OpenWebBeans Container is already started.
public final static String WARN_0005 = "WARN_0005"; // OpenWebBeans Container is already stopped.
public final static String WARN_0006 = "WARN_0006"; // Conversation already started with cid : [{1}]
+ public final static String WARN_0007 = "WARN_0007"; // Conversation already ended with cid : [{1}]
public final static String ERROR_0001 = "ERROR_0001"; // Unable to inject resource for : [{1}]
public final static String ERROR_0002 = "ERROR_0002"; // Initialization of the WebBeans container has failed.
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java?rev=896199&r1=896198&r2=896199&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java Tue Jan 5 20:23:28 2010
@@ -31,7 +31,7 @@
private boolean isTransient = true;
- private long timeout;
+ private long timeout = 30 * 60 * 1000 ;
private String sessionId;
@@ -94,6 +94,11 @@
ConversationManager.getInstance().removeConversation(this);
}
+ else
+ {
+ logger.warn(OWBLogConst.WARN_0007, new Object[]{id});
+ throw new IllegalStateException();
+ }
}
public void setTransient(boolean value)
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java?rev=896199&r1=896198&r2=896199&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java Tue Jan 5 20:23:28 2010
@@ -157,56 +157,71 @@
@SuppressWarnings("unchecked")
public Object invoke(Object instance, Method method, Method proceed, Object[] arguments) throws Exception
{
- Object result = null;
-
+ Object result = null;
boolean interceptorRun = false;
- //Context of the bean
- Context webbeansContext = BeanManagerImpl.getManager().getContext(component.getScope());
-
- //Get bean instance from context
- Object webbeansInstance = webbeansContext.get((Contextual<Object>)this.component, (CreationalContext<Object>)this.creationalContext);
-
- //toString is supported but no other object method names!!!
- if ((!ClassUtil.isObjectMethod(method.getName()) || method.getName().equals("toString")) && InterceptorUtil.isWebBeansBusinessMethod(method))
+ try
{
- checkDecoratorStackForSameDecorator(method);
-
- //Gets component decorator stack
- List<Object> decorators = WebBeansDecoratorConfig.getDecoratorStack(component, webbeansInstance);
-
- // Run around invoke chain
- List<InterceptorData> stack = component.getInterceptorStack();
-
- List<InterceptorData> temp = new ArrayList<InterceptorData>(stack);
+ //Context of the bean
+ Context webbeansContext = BeanManagerImpl.getManager().getContext(component.getScope());
- //Filter both EJB and WebBeans interceptors
- filterCommonInterceptorStackList(temp, method);
+ //Get bean instance from context
+ Object webbeansInstance = webbeansContext.get((Contextual<Object>)this.component, (CreationalContext<Object>)this.creationalContext);
- //Call Around Invokes
- if (WebBeansUtil.isContainsInterceptorMethod(temp, InterceptorType.AROUND_INVOKE))
+ //toString is supported but no other object method names!!!
+ if ((!ClassUtil.isObjectMethod(method.getName()) || method.getName().equals("toString")) && InterceptorUtil.isWebBeansBusinessMethod(method))
+ {
+ checkDecoratorStackForSameDecorator(method);
+
+ //Gets component decorator stack
+ List<Object> decorators = WebBeansDecoratorConfig.getDecoratorStack(component, webbeansInstance);
+
+ // Run around invoke chain
+ List<InterceptorData> stack = component.getInterceptorStack();
+
+ List<InterceptorData> temp = new ArrayList<InterceptorData>(stack);
+
+ //Filter both EJB and WebBeans interceptors
+ filterCommonInterceptorStackList(temp, method);
+
+ //Call Around Invokes
+ if (WebBeansUtil.isContainsInterceptorMethod(temp, InterceptorType.AROUND_INVOKE))
+ {
+ result = callAroundInvokes(method, arguments, WebBeansUtil.getInterceptorMethods(temp, InterceptorType.AROUND_INVOKE));
+ interceptorRun = true;
+ }
+
+ //Call decarators
+ callDecorators(decorators, method, arguments);
+
+
+ }
+
+ if(interceptorRun)
{
- result = callAroundInvokes(method, arguments, WebBeansUtil.getInterceptorMethods(temp, InterceptorType.AROUND_INVOKE));
- interceptorRun = true;
+ return result;
}
- //Call decarators
- callDecorators(decorators, method, arguments);
-
-
- }
+ if (!method.isAccessible())
+ {
+ method.setAccessible(true);
+ }
- if(interceptorRun)
+ return method.invoke(webbeansInstance, arguments);
+
+ }catch(InvocationTargetException e)
{
- return result;
+ Throwable target = e.getTargetException();
+ if(Exception.class.isAssignableFrom(target.getClass()))
+ {
+ throw (Exception)target;
+ }
+ else
+ {
+ throw e;
+ }
}
- if (!method.isAccessible())
- {
- method.setAccessible(true);
- }
-
- return method.invoke(webbeansInstance, arguments);
}
private void checkDecoratorStackForSameDecorator(Method method)
Modified: openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties?rev=896199&r1=896198&r2=896199&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties Tue Jan 5 20:23:28 2010
@@ -17,13 +17,13 @@
#debug messages:
DEBUG_0000 = Some random debug text for use in testing.
DEBUG_0001 = Application is configured as JSP. Adding EL Resolver.
-DEBUG_0002 = Resolving systemId with :
-DEBUG_0003 = Resolving is successful with systemId :
-DEBUG_0004 = Resolving failed using default SAXResolver for systemId :
-DEBUG_0005 = Starting a new request :
-DEBUG_0006 = Destroying a request :
-DEBUG_0007 = Starting a session with session id :
-DEBUG_0008 = Destroying a session with session id :
+DEBUG_0002 = Resolving systemId with \:
+DEBUG_0003 = Resolving is successful with systemId \:
+DEBUG_0004 = Resolving failed using default SAXResolver for systemId \:
+DEBUG_0005 = Starting a new request \:
+DEBUG_0006 = Destroying a request \:
+DEBUG_0007 = Starting a session with session id \:
+DEBUG_0008 = Destroying a session with session id \:
DEBUG_0009 = PluginLoader startUp called.
DEBUG_0010 = PluginLoader is already started.
DEBUG_0011 = PluginLoader shutDown called.
@@ -32,22 +32,22 @@
#trace messages:
TRACE_0000 = Some random trace text for use in testing.
-TRACE_0001 = Notifying with event payload :
+TRACE_0001 = Notifying with event payload \:
#========= END OF UNTRANSLATED MESSAGES ===============================
#========= BEGIN TRANSLATING MESSAGES HERE ============================
#text bits... Check if translation required.
-TEXT_INTERCEPT_CLASS = Interceptor Class :
-TEXT_ANNO_CLASS = Annotated Decorator Class :
-TEXT_XML_CLASS = XML based Decorator Class :
+TEXT_INTERCEPT_CLASS = Interceptor Class \:
+TEXT_ANNO_CLASS = Annotated Decorator Class \:
+TEXT_XML_CLASS = XML based Decorator Class \:
TEXT_CONFIG_PROP = Config properties [
TEXT_CONFIG_NOT_FOUND = ] not found. Using default settings.
TEXT_CONFIG_FOUND = ] found at location :
TEXT_OVERRIDING = . Overriding default settings.
TEXT_MUSTSCOPE = Stereotypes must declare the same @Scope annotations for Managed Bean Implementation Class :
-TEXT_MB_IMPL = Managed Bean implementation class :
+TEXT_MB_IMPL = Managed Bean implementation class \:
TEXT_SAME_SCOPE = stereotypes must declare the same @Scope annotations.
@@ -63,7 +63,7 @@
INFO_0006 = OpenWebBeans Container is stopping.
INFO_0007 = OpenWebBeans Container has stopped.
INFO_0008 = OpenWebBeans Container is stopped for context path,
-INFO_0009 = Session is passivated. Session id : [{0}]
+INFO_0009 = Session is passivated. Session id \: [{0}]
INFO_0010 = Session is activated. Session id : [{0}]
INFO_0011 = Starting configuration of Web Beans {0}
INFO_0012 = Finished configuration of Web Beans {0}
@@ -103,11 +103,12 @@
#warning messages:
WARN_0000 = Some random warning text for use in testing.
WARN_0001 = No plugins to shutDown.
-WARN_0002 = Alternative XML content is wrong. Child of <alternatives> must be <class>,<stereotype> but found :
+WARN_0002 = Alternative XML content is wrong. Child of <alternatives> must be <class>,<stereotype> but found \:
WARN_0003 = Discovery service not found. Continue by using MetaDataDiscoveryStandard as a default.
WARN_0004 = OpenWebBeans Container is already started.
WARN_0005 = OpenWebBeans Container is already stopped.
WARN_0006 = Conversation already started with cid : [{0}]
+WARN_0007 = Conversation already ended with cid : [{0}]
#error messages:
@@ -144,16 +145,16 @@
EXCEPT_0002 = Wrong ended object.
EXCEPT_0003 = Specialized class [
EXCEPT_0004 = ] must extendanothre class.
-EXCEPT_XML = XML Specialization Error :
+EXCEPT_XML = XML Specialization Error \:
EXCEPT_0005 = More than one class specialized the same super class :
-EXCEPT_0006 = Got Exceptions while sending shutdown to the following plugins :
-EXCEPT_0007 = TransactionPhase not supported:
-EXCEPT_0008 = Exception is thrown while handling event object with type :
-EXCEPT_0009 = Unable to unbind object with name :
-EXCEPT_0010 = Unable to lookup object with name :
-EXCEPT_0011 = Could not find Decorator delegate attribute for decorator class :
+EXCEPT_0006 = Got Exceptions while sending shutdown to the following plugins \:
+EXCEPT_0007 = TransactionPhase not supported\:
+EXCEPT_0008 = Exception is thrown while handling event object with type \:
+EXCEPT_0009 = Unable to unbind object with name \:
+EXCEPT_0010 = Unable to lookup object with name \:
+EXCEPT_0011 = Could not find Decorator delegate attribute for decorator class \:
EXCEPT_0012 = All elements in the beans.xml file have to declare name space.
EXCEPT_0013 = Unable to read root element of the given input stream.
-EXCEPT_0014 = Multiple class with name :
+EXCEPT_0014 = Multiple class with name \:
#========= END OF TRANSLATED MESSAGES =================================