geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r633229 - in /geronimo/server/branches/2.0/modules: geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/ geronimo-persistence-jpa10/src/main/java/org/apache/geronimo/persistence/ geronimo-persistence-jpa...
Date Mon, 03 Mar 2008 18:29:10 GMT
Author: djencks
Date: Mon Mar  3 10:29:09 2008
New Revision: 633229

URL: http://svn.apache.org/viewvc?rev=633229&view=rev
Log:
GERONIMO-3880 make managed class names always non-null

Modified:
    geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
    geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java
    geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10/src/test/java/org/apache/geronimo/persistence/PersistenceUnitGBeanTest.java

Modified: geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java?rev=633229&r1=633228&r2=633229&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
(original)
+++ geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
Mon Mar  3 10:29:09 2008
@@ -278,17 +278,17 @@
             gbeanData.setAttribute("excludeUnlistedClasses", persistenceUnit.getExcludeUnlistedClasses());
         }
 
-            String[] managedClassNameStrings = persistenceUnit.getClass1Array();
-            List<String> managedClassNames = (List<String>) gbeanData.getAttribute("managedClassNames");
-            for (String managedClassNameString : managedClassNameStrings) {
-                managedClassNames.add(managedClassNameString.trim());
-            }
-            List<String> jarFileUrls = (List<String>) gbeanData.getAttribute("jarFileUrls");
-            //add the specified locations in the ear
-            String[] jarFileUrlStrings = persistenceUnit.getJarFileArray();
-            for (String jarFileUrlString : jarFileUrlStrings) {
-                jarFileUrls.add(jarFileUrlString.trim());
-            }
+        String[] managedClassNameStrings = persistenceUnit.getClass1Array();
+        List<String> managedClassNames = (List<String>) gbeanData.getAttribute("managedClassNames");
+        for (String managedClassNameString : managedClassNameStrings) {
+            managedClassNames.add(managedClassNameString.trim());
+        }
+        List<String> jarFileUrls = (List<String>) gbeanData.getAttribute("jarFileUrls");
+        //add the specified locations in the ear
+        String[] jarFileUrlStrings = persistenceUnit.getJarFileArray();
+        for (String jarFileUrlString : jarFileUrlStrings) {
+            jarFileUrls.add(jarFileUrlString.trim());
+        }
 
         if (persistenceUnit.isSetProperties()) {
             Properties properties = (Properties) gbeanData.getAttribute("properties");

Modified: geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java?rev=633229&r1=633228&r2=633229&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java
(original)
+++ geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10/src/main/java/org/apache/geronimo/persistence/PersistenceUnitGBean.java
Mon Mar  3 10:29:09 2008
@@ -54,6 +54,7 @@
  */
 public class PersistenceUnitGBean implements GBeanLifecycle {
     private static final List<URL> NO_URLS = Collections.emptyList();
+    private static final List<String> NO_STRINGS = Collections.emptyList();
     private final String persistenceUnitRoot;
     private final PersistenceUnitInfoImpl persistenceUnitInfo;
     private final EntityManagerFactory entityManagerFactory;
@@ -84,7 +85,7 @@
             Collection<ExtendedEntityManagerRegistry > entityManagerRegistry,
             URL configurationBaseURL,
             ClassLoader classLoader) throws URISyntaxException, MalformedURLException, ResourceException
{
-        List<String> mappingFileNames = mappingFileNamesUntyped == null? new ArrayList<String>():
new ArrayList<String>(mappingFileNamesUntyped);
+        List<String> mappingFileNames = mappingFileNamesUntyped == null? NO_STRINGS:
new ArrayList<String>(mappingFileNamesUntyped);
         this.persistenceUnitRoot = persistenceUnitRoot;
         URI configurationBaseURI = new File(configurationBaseURL.getFile()).toURI();
         URL rootURL = configurationBaseURI.resolve(persistenceUnitRoot).normalize().toURL();
@@ -95,6 +96,12 @@
                 URL url = configurationBaseURI.resolve(urlString).normalize().toURL();
                 jarFileUrls.add(url);
             }
+        }
+        if (managedClassNames == null) {
+            managedClassNames = NO_STRINGS;
+        }
+        if (properties == null) {
+            properties = new Properties();
         }
         PersistenceUnitTransactionType persistenceUnitTransactionType = persistenceUnitTransactionTypeString
== null? PersistenceUnitTransactionType.JTA: PersistenceUnitTransactionType.valueOf(persistenceUnitTransactionTypeString);
 

Modified: geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10/src/test/java/org/apache/geronimo/persistence/PersistenceUnitGBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10/src/test/java/org/apache/geronimo/persistence/PersistenceUnitGBeanTest.java?rev=633229&r1=633228&r2=633229&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10/src/test/java/org/apache/geronimo/persistence/PersistenceUnitGBeanTest.java
(original)
+++ geronimo/server/branches/2.0/modules/geronimo-persistence-jpa10/src/test/java/org/apache/geronimo/persistence/PersistenceUnitGBeanTest.java
Mon Mar  3 10:29:09 2008
@@ -48,7 +48,10 @@
                 null,
                 new File("/foo/bar/Root").toURL(),
                 getClass().getClassLoader());
+        assertNotNull(gbean.getManagedClassNames());
+        assertNotNull(gbean.getProperties());
         assertNotNull(gbean.getJarFileUrls());
         assertNotNull(gbean.getPersistenceUnitRootUrl());
+        assertNotNull(gbean.getPersistenceProviderClassName());
     }
 }



Mime
View raw message