diff options
author | Simon Steiner <ssteiner@apache.org> | 2016-09-16 11:40:57 +0000 |
---|---|---|
committer | Simon Steiner <ssteiner@apache.org> | 2016-09-16 11:40:57 +0000 |
commit | e5e89aa9e3799a2596f9f8e61c7f1edc5f95ab44 (patch) | |
tree | 77fb335036ece87ee0091ef08cb4d0b9c29cc37e /fop-events | |
parent | 46b7e0614c3251dbb50ea97211d8d79af3dedade (diff) | |
download | xmlgraphics-fop-e5e89aa9e3799a2596f9f8e61c7f1edc5f95ab44.tar.gz xmlgraphics-fop-e5e89aa9e3799a2596f9f8e61c7f1edc5f95ab44.zip |
FOP-2648: Code cleanup, use foreach
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1761021 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'fop-events')
4 files changed, 7 insertions, 15 deletions
diff --git a/fop-events/src/main/java/org/apache/fop/events/DefaultEventBroadcaster.java b/fop-events/src/main/java/org/apache/fop/events/DefaultEventBroadcaster.java index 24499ea35..d4e03faea 100644 --- a/fop-events/src/main/java/org/apache/fop/events/DefaultEventBroadcaster.java +++ b/fop-events/src/main/java/org/apache/fop/events/DefaultEventBroadcaster.java @@ -23,7 +23,6 @@ import java.io.InputStream; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.MissingResourceException; @@ -161,10 +160,9 @@ public class DefaultEventBroadcaster implements EventBroadcaster { } Map params = new java.util.HashMap(); int i = 1; - Iterator iter = methodModel.getParameters().iterator(); - while (iter.hasNext()) { + for (Object o : methodModel.getParameters()) { EventMethodModel.Parameter param - = (EventMethodModel.Parameter)iter.next(); + = (EventMethodModel.Parameter) o; params.put(param.getName(), args[i]); i++; } diff --git a/fop-events/src/main/java/org/apache/fop/events/EventExceptionManager.java b/fop-events/src/main/java/org/apache/fop/events/EventExceptionManager.java index e9208fbc6..21351caff 100644 --- a/fop-events/src/main/java/org/apache/fop/events/EventExceptionManager.java +++ b/fop-events/src/main/java/org/apache/fop/events/EventExceptionManager.java @@ -64,11 +64,9 @@ public final class EventExceptionManager { String msg = EventFormatter.format(event); //Get original exception as cause if it is given as one of the parameters Throwable t = null; - Iterator<Object> iter = event.getParams().values().iterator(); - while (iter.hasNext()) { - Object o = iter.next(); + for (Object o : event.getParams().values()) { if (o instanceof Throwable) { - t = (Throwable)o; + t = (Throwable) o; break; } } diff --git a/fop-events/src/main/java/org/apache/fop/events/model/EventMethodModel.java b/fop-events/src/main/java/org/apache/fop/events/model/EventMethodModel.java index b9c62f8ab..7a0283db4 100644 --- a/fop-events/src/main/java/org/apache/fop/events/model/EventMethodModel.java +++ b/fop-events/src/main/java/org/apache/fop/events/model/EventMethodModel.java @@ -21,7 +21,6 @@ package org.apache.fop.events.model; import java.io.Serializable; import java.util.Collections; -import java.util.Iterator; import java.util.List; import org.xml.sax.ContentHandler; @@ -141,9 +140,8 @@ public class EventMethodModel implements Serializable, XMLizable { } String elName = "method"; handler.startElement("", elName, elName, atts); - Iterator iter = this.params.iterator(); - while (iter.hasNext()) { - ((XMLizable)iter.next()).toSAX(handler); + for (Object param : this.params) { + ((XMLizable) param).toSAX(handler); } handler.endElement("", elName, elName); } diff --git a/fop-events/src/main/java/org/apache/fop/tools/EventProducerCollectorTask.java b/fop-events/src/main/java/org/apache/fop/tools/EventProducerCollectorTask.java index f56eea2e4..8796280fd 100644 --- a/fop-events/src/main/java/org/apache/fop/tools/EventProducerCollectorTask.java +++ b/fop-events/src/main/java/org/apache/fop/tools/EventProducerCollectorTask.java @@ -201,9 +201,7 @@ public class EventProducerCollectorTask extends Task { protected long processFileSets(EventProducerCollector collector) throws IOException, EventConventionException, ClassNotFoundException { long lastModified = 0; - Iterator<FileSet> iter = filesets.iterator(); - while (iter.hasNext()) { - FileSet fs = (FileSet)iter.next(); + for (FileSet fs : filesets) { DirectoryScanner ds = fs.getDirectoryScanner(getProject()); String[] srcFiles = ds.getIncludedFiles(); File directory = fs.getDir(getProject()); |