Author: kwin
Date: Fri Jan 8 09:54:05 2016
New Revision: 1723672
URL: http://svn.apache.org/viewvc?rev=1723672&view=rev
Log:
SLING-5389 improve logging in case of errors
Modified:
sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
Modified:
sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java?rev=1723672&r1=1723671&r2=1723672&view=diff
==============================================================================
---
sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
(original)
+++
sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
Fri Jan 8 09:54:05 2016
@@ -185,12 +185,7 @@ public class ModelAdapterFactory impleme
public <AdapterType> AdapterType getAdapter(Object adaptable,
Class<AdapterType> type) {
Result<AdapterType> result = internalCreateModel(adaptable, type);
if (!result.wasSuccessfull()) {
- // treat post-construct and validation exceptions differently,
because they are sometimes used for flow-control or validation purposes
- if (result.getThrowable() instanceof PostConstructException ||
result.getThrowable() instanceof InvalidModelException) {
- log.debug("Could not adapt to model", result.getThrowable());
- } else {
- log.error("Could not adapt to model", result.getThrowable());
- }
+ log.warn("Could not adapt to model", result.getThrowable());
return null;
} else {
return result.getValue();
@@ -441,12 +436,7 @@ public class ModelAdapterFactory impleme
if (defaultInjectionResult.wasSuccessfull()) {
// log previous injection error, if there was any
if (lastInjectionException != null) {
- // treat post-construct and validation exceptions
differently, because they are sometimes used for flow-control or validation
purposes
- if (lastInjectionException instanceof
PostConstructException || lastInjectionException instanceof
InvalidModelException) {
- log.debug("Although falling back to default value
worked, injection into {} failed because of: " +
lastInjectionException.getMessage(), element.getAnnotatedElement(),
lastInjectionException);
- } else {
- log.warn("Although falling back to default value
worked, injection into {} failed because of: " +
lastInjectionException.getMessage(), element.getAnnotatedElement(),
lastInjectionException);
- }
+ log.debug("Although falling back to default value worked,
injection into {} failed because of: " + lastInjectionException.getMessage(),
element.getAnnotatedElement(), lastInjectionException);
}
wasInjectionSuccessful = defaultInjectionResult.getValue();
} else {