Minor logging / exception handling improvements

git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.0.0@569253 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Patrick Linskey 2007-08-24 05:27:43 +00:00
parent cfbc213134
commit 849f746573
2 changed files with 14 additions and 6 deletions

View File

@ -467,7 +467,8 @@ public class PCEnhancer {
} catch (OpenJPAException ke) { } catch (OpenJPAException ke) {
throw ke; throw ke;
} catch (Exception e) { } catch (Exception e) {
throw new GeneralException(e); throw new GeneralException(_loc.get("enhance-error",
_managedType.getType().getName(), e.getMessage()), e);
} }
} }
@ -2736,7 +2737,10 @@ public class PCEnhancer {
} catch (Throwable t) { } catch (Throwable t) {
// last-chance catch for bug #283 (which can happen // last-chance catch for bug #283 (which can happen
// in a variety of ClassLoading environments) // in a variety of ClassLoading environments)
_log.warn(_loc.get("enhance-uid-access", _meta), t); if (_log.isTraceEnabled())
_log.warn(_loc.get("enhance-uid-access", _meta), t);
else
_log.warn(_loc.get("enhance-uid-access", _meta));
} }
// if we couldn't access the serialVersionUID, we will have to // if we couldn't access the serialVersionUID, we will have to
@ -3672,10 +3676,13 @@ public class PCEnhancer {
* attribute name for the backing field <code>name</code>. * attribute name for the backing field <code>name</code>.
*/ */
private String fromBackingFieldName(String name) { private String fromBackingFieldName(String name) {
if (_meta.getAccessType() == ClassMetaData.ACCESS_PROPERTY // meta is null when doing persistence-aware enhancement
if (_meta != null
&& _meta.getAccessType() == ClassMetaData.ACCESS_PROPERTY
&& _fieldsToAttrs.containsKey(name)) && _fieldsToAttrs.containsKey(name))
name = (String) _fieldsToAttrs.get(name); return (String) _fieldsToAttrs.get(name);
return name; else
return name;
} }
/** /**

View File

@ -197,4 +197,5 @@ subclasser-fetch-group-override: The field {1} in type {0} is configured to be \
no-accessor: Could not find method called {0} in type {1}. no-accessor: Could not find method called {0} in type {1}.
unspecified-unenhanced-types: One or more of the types in {0} have relations \ unspecified-unenhanced-types: One or more of the types in {0} have relations \
to other unenhanced types that were not specified. These unspecified types \ to other unenhanced types that were not specified. These unspecified types \
are: {1} are: {1}
enhance-error: An error occurred while enhancing {0}. Exception message: {1}