diff --git a/src/main/java/com/swisscom/aem/tools/impl/hops/Each.java b/src/main/java/com/swisscom/aem/tools/impl/hops/Each.java index 1cc9744..fa523f9 100644 --- a/src/main/java/com/swisscom/aem/tools/impl/hops/Each.java +++ b/src/main/java/com/swisscom/aem/tools/impl/hops/Each.java @@ -5,6 +5,7 @@ import com.swisscom.aem.tools.jcrhopper.config.HopConfig; import com.swisscom.aem.tools.jcrhopper.context.HopContext; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import java.lang.reflect.Array; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; @@ -37,8 +38,8 @@ public void run(Config config, Node node, HopContext context) throws RepositoryE runWith(config, ((Iterator) items).next(), index++, node, context); } } else if (items.getClass().isArray()) { - for (Object item : (Object[]) items) { - runWith(config, item, index++, node, context); + for (index = 0; index < Array.getLength(items); index++) { + runWith(config, Array.get(items, index), index, node, context); } } else { runWith(config, items, index, node, context);