openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mprud...@apache.org
Subject svn commit: r598557 - /openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
Date Tue, 27 Nov 2007 08:35:36 GMT
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



Mime
View raw message