You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by mp...@apache.org on 2007/11/27 09:35:36 UTC

svn commit: r598557 - /openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java

Author: mprudhom
Date: Tue Nov 27 00:35:35 2007
New Revision: 598557

URL: http://svn.apache.org/viewvc?rev=598557&view=rev
Log:
OPENJPA-9 not all configuration files are XML, so have getAnchorsInResource and getAnchorsInFile just return null if it isn't able to parse the specific configuration resources as XML

Modified:
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java?rev=598557&r1=598556&r2=598557&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java Tue Nov 27 00:35:35 2007
@@ -207,8 +207,13 @@
     @Override
     public List getAnchorsInFile(File file) throws IOException {
         ConfigurationParser parser = new ConfigurationParser(null);
-        parser.parse(file);
-        return getUnitNames(parser);
+        try {
+            parser.parse(file);
+            return getUnitNames(parser);
+        } catch (IOException e) {
+            // not all configuration files are XML; return null if unparsable
+            return null;
+        }
     }
 
     private List<String> getUnitNames(ConfigurationParser parser) {
@@ -222,8 +227,13 @@
     @Override
     public List getAnchorsInResource(String resource) throws Exception {
         ConfigurationParser parser = new ConfigurationParser(null);
-        parser.parse(resource);
-        return getUnitNames(parser);
+        try {
+            parser.parse(resource);
+            return getUnitNames(parser);
+        } catch (IOException e) {
+            // not all configuration files are XML; return null if unparsable
+            return null;
+        }
     }
 
     @Override