cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r645495 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ rt/databinding/aegis/src/test/java/org/apache/cxf/doclitbare/ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/
Date Mon, 07 Apr 2008 13:13:54 GMT
Author: dkulp
Date: Mon Apr  7 06:13:52 2008
New Revision: 645495

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

........
  r645294 | bimargulies | 2008-04-06 15:57:10 -0400 (Sun, 06 Apr 2008) | 2 lines
  
  Fix CXF-1504
........

Added:
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/doclitbare/
      - copied from r645294, incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/doclitbare/
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/doclitbare/Course.java
      - copied unchanged from r645294, incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/doclitbare/Course.java
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/doclitbare/DocLitBareTest.java
      - copied unchanged from r645294, incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/doclitbare/DocLitBareTest.java
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/doclitbare/Teacher.java
      - copied unchanged from r645294, incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/doclitbare/Teacher.java
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/doclitbare/University.java
      - copied unchanged from r645294, incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/doclitbare/University.java
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/doclitbare/UniversityImpl.java
      - copied unchanged from r645294, incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/doclitbare/UniversityImpl.java
Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java

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

Modified: incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java?rev=645495&r1=645494&r2=645495&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
Mon Apr  7 06:13:52 2008
@@ -541,7 +541,11 @@
 
     private String getNameWithPrefix(Element root, String nameNS, String localName) {
         if (!nameNS.equals(getSchemaType().getNamespaceURI())) {
-            String prefix = NamespaceHelper.getUniquePrefix((Element)root.getParent(), nameNS);
+            Element rootElement = (Element)root.getParent();
+            String prefix = null;
+            if (rootElement != null) { // can happen with doc/lit/bare
+                prefix = NamespaceHelper.getUniquePrefix(rootElement, nameNS);
+            }
 
             if (prefix == null || prefix.length() == 0) {
                 prefix = NamespaceHelper.getUniquePrefix(root, nameNS);

Modified: incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?rev=645495&r1=645494&r2=645495&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
Mon Apr  7 06:13:52 2008
@@ -109,9 +109,28 @@
         }
 
     }
+    
+    private static final class CachedClassOrNull {
+        private Class<?> cachedClass;
+
+        public CachedClassOrNull(Class<?> cachedClass) {
+            this.cachedClass = cachedClass;
+        }
+
+        public Class<?> getCachedClass() {
+            return cachedClass;
+        }
+
+        public void setCachedClass(Class<?> cachedClass) {
+            this.cachedClass = cachedClass;
+        }
+    }
 
     private static final Map<Set<Class<?>>, CachedContextAndSchemas> JAXBCONTEXT_CACHE

         = new CacheMap<Set<Class<?>>, CachedContextAndSchemas>();
+    
+    private static final Map<String, CachedClassOrNull> OBJECT_FACTORY_CACHE
+        = new CacheMap<String, CachedClassOrNull>();
 
     Class[] extraClass;
 
@@ -393,12 +412,24 @@
             if (!packages.containsKey(pkgName)) {
                 packages.put(pkgName, jcls.getResourceAsStream("jaxb.index"));
                 packageLoaders.put(pkgName, jcls.getClassLoader());
-                try {
-                    Class<?> ofactory = Class.forName(pkgName + "." + "ObjectFactory",
false, jcls
-                        .getClassLoader());
-                    objectFactories.add(ofactory);
-                } catch (ClassNotFoundException e) {
-                    // ignore
+                String objectFactoryClassName = pkgName + "." + "ObjectFactory";
+                Class<?> ofactory = null;
+                CachedClassOrNull cachedFactory = 
+                    OBJECT_FACTORY_CACHE.get(objectFactoryClassName);
+                if (cachedFactory != null) {
+                    ofactory = cachedFactory.getCachedClass();
+                }
+                if (ofactory == null) {
+                    try {
+                        ofactory = Class.forName(objectFactoryClassName, false, jcls
+                                                 .getClassLoader());
+                        objectFactories.add(ofactory);
+                        OBJECT_FACTORY_CACHE.put(objectFactoryClassName, 
+                                                 new CachedClassOrNull(ofactory));
+                    } catch (ClassNotFoundException e) {
+                        OBJECT_FACTORY_CACHE.put(objectFactoryClassName, 
+                                                 new CachedClassOrNull(null));
+                    }
                 }
             }
         }



Mime
View raw message