Tsarevskiy Andrey created OPENJPA-2562:
------------------------------------------
Summary: DBDictionary doesn't look on whole hierarchy during
finding xml with error codes
Key: OPENJPA-2562
URL: https://issues.apache.org/jira/browse/OPENJPA-2562
Project: OpenJPA
Issue Type: Bug
Components: jdbc
Affects Versions: 2.3.0
Reporter: Tsarevskiy Andrey
We have custom SQLServerDictionary:
public class CustomSQLServerDictionary extends SQLServerDictionary {
...
}
Adding another class in that hierarchy:
public class Custom2SQLServerDictionary extends CustomSQLServerDictionary {
...
}
leads to broken sql codes. OpenJPA can't find sql codes from
SQLServerDictionary.
There is code in DBDictionary which looks just at one level of hierarchy:
String rsrc = "sql-error-state-codes.xml";
// We'll allow sub-classes to override the stream for custom err codes
//
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="UI_INHERITANCE_UNSAFE_GETRESOURCE")
InputStream stream = getClass().getResourceAsStream(rsrc);
String dictionaryClassName = getClass().getName();
if (stream == null) { // User supplied dictionary but no error codes xml
// use default
stream = DBDictionary.class.getResourceAsStream(rsrc);
dictionaryClassName = getClass().getSuperclass().getName();
}
It seems that instead of looking on getSuperclass it should look at whole
hierarchy.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)