cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1053875 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
Date Thu, 30 Dec 2010 12:41:36 GMT
Author: sergeyb
Date: Thu Dec 30 12:41:35 2010
New Revision: 1053875

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

........
  r1053868 | sergeyb | 2010-12-30 12:22:34 +0000 (Thu, 30 Dec 2010) | 1 line
  
  [JAX-RS] Minor update to AbstractJAXBProvider to simplify the checks and minimise the noise
to do with the creation of package contexts
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Dec 30 12:41:35 2010
@@ -1 +1 @@
-/cxf/trunk:1041183,1041790,1041993,1042346,1042571,1042724,1042805,1042821,1043225,1043229,1043902,1043907,1043954,1044085,1044238-1044305,1045024,1048915,1048919,1048930,1049078,1049426,1049937,1050005,1050021,1050095,1050102,1050113,1050156,1050165,1050280,1051115,1051613,1051790,1051792,1052338,1052516,1052541,1052990,1052993-1052994,1052996-1052997,1053114,1053119,1053123,1053239,1053290,1053402,1053654,1053858
+/cxf/trunk:1041183,1041790,1041993,1042346,1042571,1042724,1042805,1042821,1043225,1043229,1043902,1043907,1043954,1044085,1044238-1044305,1045024,1048915,1048919,1048930,1049078,1049426,1049937,1050005,1050021,1050095,1050102,1050113,1050156,1050165,1050280,1051115,1051613,1051790,1051792,1052338,1052516,1052541,1052990,1052993-1052994,1052996-1052997,1053114,1053119,1053123,1053239,1053290,1053402,1053654,1053858,1053868

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

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java?rev=1053875&r1=1053874&r2=1053875&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
Thu Dec 30 12:41:35 2010
@@ -385,7 +385,7 @@ public abstract class AbstractJAXBProvid
             JAXBContext context = packageContexts.get(packageName);
             if (context == null) {
                 try {
-                    if (type.getClassLoader() != null) { 
+                    if (type.getClassLoader() != null && objectFactoryOrIndexAvailable(type))
{ 
                         context = JAXBContext.newInstance(packageName, type.getClassLoader(),
cProperties);
                         packageContexts.put(packageName, context);
                     }
@@ -406,24 +406,19 @@ public abstract class AbstractJAXBProvid
         }
         return type.getAnnotation(XmlRootElement.class) != null
             || JAXBElement.class.isAssignableFrom(type)
-            || objectFactoryForClass(type)
+            || objectFactoryOrIndexAvailable(type)
             || (type != genericType && objectFactoryForType(genericType))
-            || getAdapter(type, anns) != null
-            || type.getResource("jaxb.index") != null;
+            || getAdapter(type, anns) != null;
     
     }
     
-    protected boolean objectFactoryForClass(Class<?> type) {
-        try {
-            return type.getClassLoader().loadClass(PackageUtils.getPackageName(type) 
-                                        + ".ObjectFactory") != null;
-        } catch (Exception ex) {
-            return false;
-        }
+    protected boolean objectFactoryOrIndexAvailable(Class<?> type) {
+        return type.getResource("ObjectFactory.class") != null
+               || type.getResource("jaxb.index") != null; 
     }
     
     private boolean objectFactoryForType(Type genericType) {
-        return objectFactoryForClass(InjectionUtils.getActualType(genericType));
+        return objectFactoryOrIndexAvailable(InjectionUtils.getActualType(genericType));
     }
     
     protected Unmarshaller createUnmarshaller(Class<?> cls, Type genericType) 



Mime
View raw message