You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:11:39 UTC
[sling-org-apache-sling-scripting-sightly-models-provider] 06/15:
SLING-4734 first try to instantiate model with request then with resource
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.sightly.models.provider-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-models-provider.git
commit 9d020af7a52130302ec887abe121fdc71b27f291
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Tue Sep 1 13:54:19 2015 +0000
SLING-4734 first try to instantiate model with request then with resource
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly/models-use-provider@1700549 13f79535-47bb-0310-9956-ffa450edef68
---
.../scripting/sightly/models/impl/ModelFactoryUseProvider.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/sling/scripting/sightly/models/impl/ModelFactoryUseProvider.java b/src/main/java/org/apache/sling/scripting/sightly/models/impl/ModelFactoryUseProvider.java
index 538aca4..07c495b 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/models/impl/ModelFactoryUseProvider.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/models/impl/ModelFactoryUseProvider.java
@@ -100,11 +100,11 @@ public class ModelFactoryUseProvider implements UseProvider {
// next use provider will be queried
return ProviderOutcome.failure();
}
- // try to instantiate class via Sling Models (first via resource, then via request)
- if (modelFactory.canCreateFromAdaptable(resource, cls)) {
- obj = modelFactory.createModel(resource, cls);
- } else if (modelFactory.canCreateFromAdaptable(request, cls)) {
+ // try to instantiate class via Sling Models (first via request, then via resource)
+ if (modelFactory.canCreateFromAdaptable(request, cls)) {
obj = modelFactory.createModel(request, cls);
+ } else if (modelFactory.canCreateFromAdaptable(resource, cls)) {
+ obj = modelFactory.createModel(resource, cls);
} else {
return ProviderOutcome.failure(new IllegalStateException("Could not adapt the given Sling Model from neither resource nor request: " + cls));
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.