This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git


The following commit(s) were added to refs/heads/master by this push:
     new 92c0a72  Added NPE check
     new 80b1dea  Merge pull request #18 from etugarev/issues/SLING-8858
92c0a72 is described below

commit 92c0a7289924f209332af675311c044338347b62
Author: Evgeny Tugarev <[email protected]>
AuthorDate: Fri Nov 22 23:42:12 2019 +0100

    Added NPE check
---
 .../java/org/apache/sling/models/impl/ModelAdapterFactory.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java 
b/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
index d06787e..5425832 100644
--- a/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
+++ b/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
@@ -369,10 +369,12 @@ public class ModelAdapterFactory implements 
AdapterFactory, Runnable, ModelFacto
             if (modelAnnotation.cache()) {
                 Map<Class<?>, SoftReference<Object>> adaptableCache = 
adapterCache.get(adaptable);
                 if (adaptableCache != null) {
-                    SoftReference<Object> SoftReference = 
adaptableCache.get(requestedType);
-                    ModelType cachedObject = (ModelType) SoftReference.get();
-                    if (cachedObject != null) {
-                        return new Result<>(cachedObject);
+                    SoftReference<Object> softReference = 
adaptableCache.get(requestedType);
+                    if (softReference != null) {
+                        ModelType cachedObject = (ModelType) 
softReference.get();
+                        if (cachedObject != null) {
+                            return new Result<>(cachedObject);
+                        }
                     }
                 }
             }

Reply via email to