mirror of https://github.com/apache/openjpa.git
OPENJPA-1535 Inconsistency in exceptions thrown from MetaDataRepository.resolve(). Patch contributed by Hiroki Tateno.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@916338 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ea49b4cc6a
commit
daae61a6f5
|
@ -631,14 +631,18 @@ public class MetaDataRepository implements PCRegistry.RegisterClassListener, Con
|
||||||
err &= resolveMapping(resolved.get(i));
|
err &= resolveMapping(resolved.get(i));
|
||||||
|
|
||||||
// throw errors encountered
|
// throw errors encountered
|
||||||
|
// OPENJPA-1535 Always throw a MetaDataException because callers
|
||||||
|
// of loadRegisteredClassMetaData expect only MetaDataException
|
||||||
|
// to be thrown.
|
||||||
if (err && !_errs.isEmpty()) {
|
if (err && !_errs.isEmpty()) {
|
||||||
RuntimeException re;
|
RuntimeException re;
|
||||||
if (_errs.size() == 1)
|
if ((_errs.size() == 1) && (_errs.get(0) instanceof MetaDataException)) {
|
||||||
re = _errs.get(0);
|
re = _errs.get(0);
|
||||||
else
|
} else {
|
||||||
re =
|
re = new MetaDataException(_loc.get("resolve-errs"))
|
||||||
new MetaDataException(_loc.get("resolve-errs")).setNestedThrowables((Throwable[]) _errs
|
.setNestedThrowables((Throwable[]) _errs
|
||||||
.toArray(new Exception[_errs.size()]));
|
.toArray(new Exception[_errs.size()]));
|
||||||
|
}
|
||||||
_errs.clear();
|
_errs.clear();
|
||||||
throw re;
|
throw re;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue