You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2010/11/09 07:06:25 UTC

svn commit: r1032856 - /openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java

Author: dblevins
Date: Tue Nov  9 06:06:25 2010
New Revision: 1032856

URL: http://svn.apache.org/viewvc?rev=1032856&view=rev
Log:
OPENEJB-1371: Double encoding of persistence-unit root-url leads to issues in paths with spaces

Modified:
    openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java

Modified: openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java?rev=1032856&r1=1032855&r2=1032856&view=diff
==============================================================================
--- openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java (original)
+++ openejb/branches/openejb-3.1.x/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java Tue Nov  9 06:06:25 2010
@@ -92,9 +92,15 @@ public class ReadDescriptors implements 
         if (persistenceUrls != null) {
             for (URL persistenceUrl : persistenceUrls) {
 
-                final String path = URLs.toFilePath(persistenceUrl);
-                String moduleName = path.replaceFirst("/?META-INF/.*persistence.xml$", "/");
+                File file = URLs.toFile(persistenceUrl);
+                final String path = file.getAbsolutePath();
 
+                if (file.getName().endsWith("persistence.xml")) {
+                    file = file.getParentFile().getParentFile();
+                }
+                String moduleName = file.getAbsolutePath();
+                
+                System.out.println("FOO moduleName = " + moduleName);
                 try {
                     Persistence persistence = JaxbPersistenceFactory.getPersistence(persistenceUrl);
                     PersistenceModule persistenceModule = new PersistenceModule(moduleName, persistence);