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-slingfeature-maven-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new dd9ab65  Avoid class cast exception in mojos
dd9ab65 is described below

commit dd9ab65b2f986adcc410995a13170d2a2a1d416a
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Mon Oct 1 17:53:04 2018 +0200

    Avoid class cast exception in mojos
---
 src/main/java/org/apache/sling/feature/maven/ProjectHelper.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/main/java/org/apache/sling/feature/maven/ProjectHelper.java 
b/src/main/java/org/apache/sling/feature/maven/ProjectHelper.java
index 14495c4..dc76e78 100644
--- a/src/main/java/org/apache/sling/feature/maven/ProjectHelper.java
+++ b/src/main/java/org/apache/sling/feature/maven/ProjectHelper.java
@@ -77,8 +77,13 @@ public abstract class ProjectHelper {
         Map<String, Feature> result = null;
         try {
             result = (Map<String, Feature>) project.getContextValue(cacheKey);
+            if (!result.isEmpty() ) {
+                final Feature f = result.values().iterator().next();
+                f.getId();
+            }
         } catch ( final Exception e) {
             // if we get a class cast exception, we read again
+            result = null;
         }
         if ( result == null ) {
             final Integer size = (Integer)project.getContextValue(key);

Reply via email to