cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1128229 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/
Date Fri, 27 May 2011 10:01:27 GMT
Author: ningjiang
Date: Fri May 27 10:01:26 2011
New Revision: 1128229

URL: http://svn.apache.org/viewvc?rev=1128229&view=rev
Log:
Merged revisions 1128202,1128206 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1128202 | ningjiang | 2011-05-27 16:56:31 +0800 (Fri, 27 May 2011) | 1 line
  
  CXF-3551 Log warning message when cxf find the @WebServices which is loaded by the other
classloader
........
  r1128206 | ningjiang | 2011-05-27 17:09:43 +0800 (Fri, 27 May 2011) | 1 line
  
  CXF-3551 Fixed some typo of the Messages.properties file
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties
    cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfoTest.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri May 27 10:01:26 2011
@@ -1 +1 @@
-/cxf/trunk:1128092
+/cxf/trunk:1128092,1128202-1128206

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java?rev=1128229&r1=1128228&r2=1128229&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
Fri May 27 10:01:26 2011
@@ -19,11 +19,13 @@
 
 package org.apache.cxf.jaxws.support;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.ResourceBundle;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.jws.WebService;
@@ -253,6 +255,18 @@ public class JaxWsImplementorInfo {
         }
         return null;
     }
+    
+    protected static boolean ifAnnotationLoadedByOtherClassLoader(Class<?> cls,
+        Class<? extends Annotation> annotationClass) {
+        for (Annotation an : cls.getAnnotations()) {
+            if (an.annotationType() != null 
+                && annotationClass.getName().equals(an.annotationType().getName()))
{
+                return true;
+            }
+        }
+        return false;
+        
+    }
     private void initialize() {
         Class<?> cls = implementorClass;
         while (cls != null) {
@@ -262,6 +276,13 @@ public class JaxWsImplementorInfo {
                 if (cls.isInterface()) {
                     cls = null;
                 }
+            } else {
+                // check if there are annotations has the same name with WebServices
+                if (ifAnnotationLoadedByOtherClassLoader(cls, WebService.class)) {
+                    LOG.log(Level.WARNING,
+                            "WEBSERVICE_ANNOTATIONS_IS_LOADED_BY_OTHER_CLASSLOADER",
+                            WebService.class.getName());
+                }
             }
             if (cls != null) {
                 cls = cls.getSuperclass();                
@@ -312,10 +333,22 @@ public class JaxWsImplementorInfo {
         WebServiceProvider ann = cls.getAnnotation(WebServiceProvider.class);
         if (null != ann) {
             return ann;
+        } else {
+            if (ifAnnotationLoadedByOtherClassLoader(cls, WebServiceProvider.class)) {
+                LOG.log(Level.WARNING, 
+                    "WEBSERVICE_ANNOTATIONS_IS_LOADED_BY_OTHER_CLASSLOADER",
+                    WebServiceProvider.class.getName());
+            }
         }
         for (Class<?> inf : cls.getInterfaces()) {
             if (null != inf.getAnnotation(WebServiceProvider.class)) {
                 return inf.getAnnotation(WebServiceProvider.class);
+            } else {
+                if (ifAnnotationLoadedByOtherClassLoader(cls, WebServiceProvider.class))
{
+                    LOG.log(Level.WARNING, 
+                            "WEBSERVICE_ANNOTATIONS_IS_LOADED_BY_OTHER_CLASSLOADER",
+                            WebServiceProvider.class.getName());
+                }
             }
         }
         return getWebServiceProviderAnnotation(cls.getSuperclass());

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties?rev=1128229&r1=1128228&r2=1128229&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties
Fri May 27 10:01:26 2011
@@ -32,3 +32,4 @@ INVALID_RESPONSE_WRAPPER = @ResponseWrap
 SERVICECLASS_MUST_BE_SET = serviceClass must be set to a valid service interface or class
 XMLSEEALSO_NULL_CLASS = A class listed in the XmlSeeAlso annotation of the service class
%s cannot be found on the classpath. Index: %d of XmlSeeAlso class list.
 WEBMETHOD_EXCLUDE_NOT_ALLOWED = The @javax.jws.WebMethod(exclude=true) cannot be used on
a service endpoint interface. Method: {0}
+WEBSERVICE_ANNOTATIONS_IS_LOADED_BY_OTHER_CLASSLOADER = The {0} annotation is loaded by other
classloader. Please check if there are multi version of jws jar in your class path.
\ No newline at end of file

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfoTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfoTest.java?rev=1128229&r1=1128228&r2=1128229&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfoTest.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfoTest.java
Fri May 27 10:01:26 2011
@@ -19,7 +19,11 @@
 
 package org.apache.cxf.jaxws.support;
 
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceProvider;
+
 import org.apache.cxf.calculator.CalculatorImpl;
+
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -30,4 +34,13 @@ public class JaxWsImplementorInfoTest ex
         JaxWsImplementorInfo info = new JaxWsImplementorInfo(CalculatorImpl.class);
         assertEquals("testutils/calculator.wsdl", info.getWsdlLocation());
     }
+    
+    @Test
+    public void testWebServiceAnnotation() throws Exception {
+        assertTrue(JaxWsImplementorInfo.
+                   ifAnnotationLoadedByOtherClassLoader(CalculatorImpl.class, WebService.class));
+        assertFalse(JaxWsImplementorInfo.
+                    ifAnnotationLoadedByOtherClassLoader(CalculatorImpl.class, WebServiceProvider.class));
+        
+    }
 }



Mime
View raw message