mirror of https://github.com/apache/openjpa.git
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
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@598557 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5018dfaa88
commit
1946a9b036
|
@ -207,8 +207,13 @@ public class PersistenceProductDerivation
|
|||
@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 @@ public class PersistenceProductDerivation
|
|||
@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
|
||||
|
|
Loading…
Reference in New Issue