You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2021/12/03 15:51:28 UTC

[GitHub] [sling-org-apache-sling-models-impl] kwin commented on a change in pull request #28: SLING-8079 throw PostConstructException for createModel in case

kwin commented on a change in pull request #28:
URL: https://github.com/apache/sling-org-apache-sling-models-impl/pull/28#discussion_r762049979



##########
File path: src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
##########
@@ -265,7 +265,11 @@ private void clearDisposalCallbackRegistryQueue() {
     public <AdapterType> AdapterType getAdapter(Object adaptable, Class<AdapterType> type) {
         Result<AdapterType> result = internalCreateModel(adaptable, type);
         if (!result.wasSuccessful()) {
-            log.warn("Could not adapt to model", result.getThrowable());
+            if (result == Result.POST_CONSTRUCT_PREVENTED_MODEL_CONSTRUCTION) {
+                log.warn("Could not adapt to model as PostConstruct method returned false"); // do no construct runtime exception in this case

Review comment:
       good point, lowered the level to debug in https://github.com/apache/sling-org-apache-sling-models-impl/pull/28/commits/e3afef7b4b175a01ebbf7f7c5bcf0b8607c541bc.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org