aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fop-core/src/main/java/org/apache/fop/afp/AFPResourceLevelDefaults.java10
-rw-r--r--fop-core/src/main/java/org/apache/fop/afp/DataStream.java7
-rw-r--r--fop-core/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrderContainer.java12
-rw-r--r--fop-core/src/main/java/org/apache/fop/afp/modca/GraphicsObject.java6
-rw-r--r--fop-core/src/main/java/org/apache/fop/afp/modca/MapCodedFont.java12
-rw-r--r--fop-core/src/main/java/org/apache/fop/afp/modca/MapPageSegment.java8
-rw-r--r--fop-core/src/main/java/org/apache/fop/afp/modca/ResourceGroup.java7
-rw-r--r--fop-core/src/main/java/org/apache/fop/fo/properties/CommonTextDecoration.java6
-rw-r--r--fop-core/src/main/java/org/apache/fop/fonts/apps/PFMReader.java10
-rw-r--r--fop-core/src/main/java/org/apache/fop/fonts/truetype/OpenFont.java10
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListObserver.java6
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/FlowLayoutManager.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java8
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java11
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java7
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java18
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/table/ColumnSetup.java11
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/table/RowPainter.java6
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java6
-rw-r--r--fop-core/src/main/java/org/apache/fop/pdf/PDFDocument.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/pdf/PDFEmbeddedFiles.java6
-rw-r--r--fop-core/src/main/java/org/apache/fop/pdf/PDFFactory.java6
-rw-r--r--fop-core/src/main/java/org/apache/fop/render/RendererContext.java6
-rw-r--r--fop-core/src/main/java/org/apache/fop/render/intermediate/IFSerializer.java17
-rw-r--r--fop-core/src/main/java/org/apache/fop/render/intermediate/extensions/ActionSet.java6
-rw-r--r--fop-core/src/main/java/org/apache/fop/render/java2d/Java2DRenderer.java17
-rw-r--r--fop-core/src/main/java/org/apache/fop/render/pcl/PCLPageDefinition.java11
-rw-r--r--fop-core/src/main/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java11
-rw-r--r--fop-core/src/main/java/org/apache/fop/render/ps/PSTextPainter.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/render/ps/ResourceHandler.java18
-rw-r--r--fop-core/src/main/java/org/apache/fop/render/xml/XMLRenderer.java50
-rw-r--r--fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListGenerator.java21
-rw-r--r--fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListMain.java41
-rw-r--r--fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListSerializer.java20
-rw-r--r--fop-core/src/test/java/org/apache/fop/layoutengine/ElementListCheck.java6
-rw-r--r--fop-core/src/test/java/org/apache/fop/memory/Stats.java6
-rw-r--r--fop-core/src/test/java/org/apache/fop/threading/FOPTestbed.java16
-rw-r--r--fop-events/src/main/java/org/apache/fop/events/DefaultEventBroadcaster.java6
-rw-r--r--fop-events/src/main/java/org/apache/fop/events/EventExceptionManager.java6
-rw-r--r--fop-events/src/main/java/org/apache/fop/events/model/EventMethodModel.java6
-rw-r--r--fop-events/src/main/java/org/apache/fop/tools/EventProducerCollectorTask.java4
-rw-r--r--fop-util/src/main/java/org/apache/fop/util/text/AdvancedMessageFormat.java20
46 files changed, 188 insertions, 307 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/afp/AFPResourceLevelDefaults.java b/fop-core/src/main/java/org/apache/fop/afp/AFPResourceLevelDefaults.java
index 39c72d8f5..f1df49b62 100644
--- a/fop-core/src/main/java/org/apache/fop/afp/AFPResourceLevelDefaults.java
+++ b/fop-core/src/main/java/org/apache/fop/afp/AFPResourceLevelDefaults.java
@@ -19,7 +19,6 @@
package org.apache.fop.afp;
-import java.util.Iterator;
import java.util.Map;
import org.apache.fop.afp.AFPResourceLevel.ResourceType;
@@ -99,11 +98,10 @@ public class AFPResourceLevelDefaults {
* @param other the other instance to get the defaults from
*/
public void mergeFrom(AFPResourceLevelDefaults other) {
- Iterator iter = other.defaultResourceLevels.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next();
- Byte type = (Byte)entry.getKey();
- AFPResourceLevel level = (AFPResourceLevel)entry.getValue();
+ for (Object o : other.defaultResourceLevels.entrySet()) {
+ Map.Entry entry = (Map.Entry) o;
+ Byte type = (Byte) entry.getKey();
+ AFPResourceLevel level = (AFPResourceLevel) entry.getValue();
this.defaultResourceLevels.put(type, level);
}
}
diff --git a/fop-core/src/main/java/org/apache/fop/afp/DataStream.java b/fop-core/src/main/java/org/apache/fop/afp/DataStream.java
index 5244d9212..d33673c0e 100644
--- a/fop-core/src/main/java/org/apache/fop/afp/DataStream.java
+++ b/fop-core/src/main/java/org/apache/fop/afp/DataStream.java
@@ -24,7 +24,6 @@ import java.awt.Point;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
-import java.util.Iterator;
import java.util.Map;
import org.apache.commons.logging.Log;
@@ -309,10 +308,8 @@ public class DataStream {
* a collection of AFP font attributes
*/
public void addFontsToCurrentPage(Map pageFonts) {
- Iterator iter = pageFonts.values().iterator();
- while (iter.hasNext()) {
- AFPFontAttributes afpFontAttributes = (AFPFontAttributes) iter
- .next();
+ for (Object o : pageFonts.values()) {
+ AFPFontAttributes afpFontAttributes = (AFPFontAttributes) o;
createFont(afpFontAttributes.getFontReference(), afpFontAttributes
.getFont(), afpFontAttributes.getPointSize());
}
diff --git a/fop-core/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrderContainer.java b/fop-core/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrderContainer.java
index 5bd05fd4b..b3fc8effe 100644
--- a/fop-core/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrderContainer.java
+++ b/fop-core/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrderContainer.java
@@ -22,7 +22,6 @@ package org.apache.fop.afp.goca;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
import org.apache.fop.afp.Completable;
@@ -122,20 +121,17 @@ implements StructuredData, Completable, Startable {
*/
public int getDataLength() {
int dataLen = 0;
- Iterator it = objects.iterator();
- while (it.hasNext()) {
- dataLen += ((StructuredData)it.next()).getDataLength();
+ for (Object object : objects) {
+ dataLen += ((StructuredData) object).getDataLength();
}
return dataLen;
}
/** {@inheritDoc} */
public void setComplete(boolean complete) {
- Iterator it = objects.iterator();
- while (it.hasNext()) {
- Object object = it.next();
+ for (Object object : objects) {
if (object instanceof Completable) {
- ((Completable)object).setComplete(true);
+ ((Completable) object).setComplete(true);
}
}
this.complete = true;
diff --git a/fop-core/src/main/java/org/apache/fop/afp/modca/GraphicsObject.java b/fop-core/src/main/java/org/apache/fop/afp/modca/GraphicsObject.java
index 434d4f838..d7da42cae 100644
--- a/fop-core/src/main/java/org/apache/fop/afp/modca/GraphicsObject.java
+++ b/fop-core/src/main/java/org/apache/fop/afp/modca/GraphicsObject.java
@@ -22,7 +22,6 @@ package org.apache.fop.afp.modca;
import java.awt.Color;
import java.io.IOException;
import java.io.OutputStream;
-import java.util.Iterator;
import java.util.List;
import org.apache.xmlgraphics.java2d.color.ColorConverter;
@@ -30,7 +29,6 @@ import org.apache.xmlgraphics.java2d.color.ColorUtil;
import org.apache.fop.afp.AFPDataObjectInfo;
import org.apache.fop.afp.AFPObjectAreaInfo;
-import org.apache.fop.afp.Completable;
import org.apache.fop.afp.Factory;
import org.apache.fop.afp.StructuredData;
import org.apache.fop.afp.fonts.CharacterSet;
@@ -383,9 +381,7 @@ public class GraphicsObject extends AbstractDataObject {
/** {@inheritDoc} */
@Override
public void setComplete(boolean complete) {
- Iterator<GraphicsData> it = objects.iterator();
- while (it.hasNext()) {
- Completable completedObject = it.next();
+ for (GraphicsData completedObject : objects) {
completedObject.setComplete(true);
}
super.setComplete(complete);
diff --git a/fop-core/src/main/java/org/apache/fop/afp/modca/MapCodedFont.java b/fop-core/src/main/java/org/apache/fop/afp/modca/MapCodedFont.java
index 38533652c..f42249314 100644
--- a/fop-core/src/main/java/org/apache/fop/afp/modca/MapCodedFont.java
+++ b/fop-core/src/main/java/org/apache/fop/afp/modca/MapCodedFont.java
@@ -23,7 +23,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
-import java.util.Iterator;
import java.util.List;
import org.apache.fop.afp.AFPConstants;
@@ -62,9 +61,8 @@ public class MapCodedFont extends AbstractStructuredObject {
copySF(startData, Type.MAP, Category.CODED_FONT);
baos.write(startData);
- Iterator iter = fontList.iterator();
- while (iter.hasNext()) {
- FontDefinition fd = (FontDefinition) iter.next();
+ for (Object aFontList : fontList) {
+ FontDefinition fd = (FontDefinition) aFontList;
// Start of repeating groups (occurs 1 to 254)
baos.write(0x00);
@@ -114,10 +112,10 @@ public class MapCodedFont extends AbstractStructuredObject {
baos.write(0x00);
baos.write(BinaryUtils.convert(fd.scale, 2)); // Height
- baos.write(new byte[] {0x00, 0x00}); // Width
+ baos.write(new byte[]{0x00, 0x00}); // Width
- baos.write(new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00});
+ baos.write(new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00});
baos.write(0x60);
diff --git a/fop-core/src/main/java/org/apache/fop/afp/modca/MapPageSegment.java b/fop-core/src/main/java/org/apache/fop/afp/modca/MapPageSegment.java
index 81d6f4724..85b68c01f 100644
--- a/fop-core/src/main/java/org/apache/fop/afp/modca/MapPageSegment.java
+++ b/fop-core/src/main/java/org/apache/fop/afp/modca/MapPageSegment.java
@@ -22,7 +22,6 @@ package org.apache.fop.afp.modca;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
-import java.util.Iterator;
import java.util.Set;
import org.apache.fop.afp.AFPConstants;
@@ -115,17 +114,16 @@ public class MapPageSegment extends AbstractAFPObject {
int pos = 13;
- Iterator iter = this.pageSegments.iterator();
- while (iter.hasNext()) {
+ for (Object pageSegment : this.pageSegments) {
pos += 4;
- String name = (String)iter.next();
+ String name = (String) pageSegment;
try {
byte[] nameBytes = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
System.arraycopy(nameBytes, 0, data, pos, nameBytes.length);
} catch (UnsupportedEncodingException usee) {
LOG.error("UnsupportedEncodingException translating the name "
- + name);
+ + name);
}
pos += 8;
}
diff --git a/fop-core/src/main/java/org/apache/fop/afp/modca/ResourceGroup.java b/fop-core/src/main/java/org/apache/fop/afp/modca/ResourceGroup.java
index 2218998a0..c301557c8 100644
--- a/fop-core/src/main/java/org/apache/fop/afp/modca/ResourceGroup.java
+++ b/fop-core/src/main/java/org/apache/fop/afp/modca/ResourceGroup.java
@@ -21,7 +21,6 @@ package org.apache.fop.afp.modca;
import java.io.IOException;
import java.io.OutputStream;
-import java.util.Iterator;
import java.util.Set;
import org.apache.fop.afp.Streamable;
@@ -83,11 +82,9 @@ public class ResourceGroup extends AbstractNamedAFPObject {
/** {@inheritDoc} */
public void writeContent(OutputStream os) throws IOException {
- Iterator it = resourceSet.iterator();
- while (it.hasNext()) {
- Object object = it.next();
+ for (Object object : resourceSet) {
if (object instanceof Streamable) {
- Streamable streamableObject = (Streamable)object;
+ Streamable streamableObject = (Streamable) object;
streamableObject.writeToStream(os);
}
}
diff --git a/fop-core/src/main/java/org/apache/fop/fo/properties/CommonTextDecoration.java b/fop-core/src/main/java/org/apache/fop/fo/properties/CommonTextDecoration.java
index 9ce22180e..751a4a711 100644
--- a/fop-core/src/main/java/org/apache/fop/fo/properties/CommonTextDecoration.java
+++ b/fop-core/src/main/java/org/apache/fop/fo/properties/CommonTextDecoration.java
@@ -20,7 +20,6 @@
package org.apache.fop.fo.properties;
import java.awt.Color;
-import java.util.Iterator;
import java.util.List;
import org.apache.fop.apps.FOUserAgent;
@@ -74,9 +73,8 @@ public class CommonTextDecoration {
Property textDecoProp = pList.getExplicit(Constants.PR_TEXT_DECORATION);
if (textDecoProp != null) {
List list = textDecoProp.getList();
- Iterator i = list.iterator();
- while (i.hasNext()) {
- Property prop = (Property)i.next();
+ for (Object aList : list) {
+ Property prop = (Property) aList;
int propEnum = prop.getEnum();
FOUserAgent ua = pList.getFObj() == null ? null : pList.getFObj().getUserAgent();
if (propEnum == Constants.EN_NONE) {
diff --git a/fop-core/src/main/java/org/apache/fop/fonts/apps/PFMReader.java b/fop-core/src/main/java/org/apache/fop/fonts/apps/PFMReader.java
index e45b4c2c4..d2e9b7cbd 100644
--- a/fop-core/src/main/java/org/apache/fop/fonts/apps/PFMReader.java
+++ b/fop-core/src/main/java/org/apache/fop/fonts/apps/PFMReader.java
@@ -21,7 +21,6 @@ package org.apache.fop.fonts.apps;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Iterator;
import java.util.Map;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -299,18 +298,15 @@ public class PFMReader extends AbstractFontReader {
// Get kerning
- Iterator iter = pfm.getKerning().keySet().iterator();
- while (iter.hasNext()) {
- Integer kpx1 = (Integer)iter.next();
+ for (Object kpx1 : pfm.getKerning().keySet()) {
el = doc.createElement("kerning");
el.setAttribute("kpx1", kpx1.toString());
root.appendChild(el);
Element el2 = null;
Map h2 = (Map) pfm.getKerning().get(kpx1);
- Iterator enum2 = h2.entrySet().iterator();
- while (enum2.hasNext()) {
- Map.Entry entry = (Map.Entry) enum2.next();
+ for (Object o : h2.entrySet()) {
+ Map.Entry entry = (Map.Entry) o;
Integer kpx2 = (Integer) entry.getKey();
el2 = doc.createElement("pair");
el2.setAttribute("kpx2", kpx2.toString());
diff --git a/fop-core/src/main/java/org/apache/fop/fonts/truetype/OpenFont.java b/fop-core/src/main/java/org/apache/fop/fonts/truetype/OpenFont.java
index cda3ce5ec..95e2e4cc0 100644
--- a/fop-core/src/main/java/org/apache/fop/fonts/truetype/OpenFont.java
+++ b/fop-core/src/main/java/org/apache/fop/fonts/truetype/OpenFont.java
@@ -1636,9 +1636,8 @@ public abstract class OpenFont {
Integer cidKey2 = unicodeToGlyph(unicodeKey2);
Integer kern = e.getValue();
- Iterator uniMap = mtxTab[cidKey2].getUnicodeIndex().listIterator();
- while (uniMap.hasNext()) {
- Integer unicodeKey = (Integer)uniMap.next();
+ for (Object o : mtxTab[cidKey2].getUnicodeIndex()) {
+ Integer unicodeKey = (Integer) o;
Integer[] ansiKeys = unicodeToWinAnsi(unicodeKey);
for (Integer ansiKey : ansiKeys) {
akpx.put(ansiKey, kern);
@@ -1647,9 +1646,8 @@ public abstract class OpenFont {
}
if (akpx.size() > 0) {
- Iterator uniMap = mtxTab[cidKey1].getUnicodeIndex().listIterator();
- while (uniMap.hasNext()) {
- Integer unicodeKey = (Integer)uniMap.next();
+ for (Object o : mtxTab[cidKey1].getUnicodeIndex()) {
+ Integer unicodeKey = (Integer) o;
Integer[] ansiKeys = unicodeToWinAnsi(unicodeKey);
for (Integer ansiKey : ansiKeys) {
ansiKerningTab.put(ansiKey, akpx);
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
index 3a73b233b..a1e888116 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
@@ -282,9 +282,8 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager im
if (newLMs == null || newLMs.size() == 0) {
return;
}
- ListIterator<LayoutManager> iter = newLMs.listIterator();
- while (iter.hasNext()) {
- addChildLM(iter.next());
+ for (LayoutManager newLM : (Iterable<LayoutManager>) newLMs) {
+ addChildLM(newLM);
}
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListObserver.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListObserver.java
index 17cdd1462..8108cda7e 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListObserver.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListObserver.java
@@ -19,7 +19,6 @@
package org.apache.fop.layoutmgr;
-import java.util.Iterator;
import java.util.List;
/**
@@ -67,9 +66,8 @@ public final class ElementListObserver {
if (category == null) {
throw new NullPointerException("category must not be null");
}
- Iterator i = activeObservers.iterator();
- while (i.hasNext()) {
- ((Observer)i.next()).observe(elementList, category, id);
+ for (Object activeObserver : activeObservers) {
+ ((Observer) activeObserver).observe(elementList, category, id);
}
}
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/FlowLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
index 99f6367a3..1ac70da82 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
@@ -349,9 +349,8 @@ public class FlowLayoutManager extends BlockStackingLayoutManager {
// "wrap" the Position stored in each element of returnedList
// and add elements to returnList
- ListIterator<KnuthElement> listIter = returnedList.listIterator();
- while (listIter.hasNext()) {
- returnedElement = listIter.next();
+ for (KnuthElement aReturnedList : returnedList) {
+ returnedElement = aReturnedList;
if (returnedElement.getLayoutManager() != this) {
returnedElement.setPosition(
new NonLeafPosition(this, returnedElement.getPosition()));
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java
index 8cc9db790..9c1315640 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java
@@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import org.apache.fop.area.Block;
import org.apache.fop.area.BodyRegion;
@@ -184,11 +183,10 @@ public class PageBreaker extends AbstractBreaker {
private boolean containsFootnotes(List contentList, LayoutContext context) {
boolean containsFootnotes = false;
if (contentList != null) {
- ListIterator contentListIterator = contentList.listIterator();
- while (contentListIterator.hasNext()) {
- ListElement element = (ListElement) contentListIterator.next();
+ for (Object aContentList : contentList) {
+ ListElement element = (ListElement) aContentList;
if (element instanceof KnuthBlockBox
- && ((KnuthBlockBox) element).hasAnchors()) {
+ && ((KnuthBlockBox) element).hasAnchors()) {
// element represents a line with footnote citations
containsFootnotes = true;
KnuthBlockBox box = (KnuthBlockBox) element;
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
index c5031cd0f..af1664981 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
@@ -22,7 +22,6 @@ package org.apache.fop.layoutmgr.inline;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
-import java.util.ListIterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -130,9 +129,8 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager
stackSize = 0;
List contentList = getNextKnuthElements(childLC, Constants.EN_START);
- ListIterator contentIter = contentList.listIterator();
- while (contentIter.hasNext()) {
- KnuthElement element = (KnuthElement) contentIter.next();
+ for (Object aContentList : contentList) {
+ KnuthElement element = (KnuthElement) aContentList;
if (element instanceof KnuthInlineBox) {
KnuthInlineBox box = (KnuthInlineBox) element;
// TODO handle alignment here?
@@ -245,9 +243,8 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager
if (newLMs == null || newLMs.size() == 0) {
return;
}
- ListIterator iter = newLMs.listIterator();
- while (iter.hasNext()) {
- LayoutManager lm = (LayoutManager) iter.next();
+ for (Object newLM : newLMs) {
+ LayoutManager lm = (LayoutManager) newLM;
addChildLM(lm);
}
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
index 0a0658b4d..df37b9902 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
@@ -22,7 +22,6 @@ package org.apache.fop.layoutmgr.inline;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.ListIterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -341,9 +340,7 @@ public class InlineLayoutManager extends InlineStackingLayoutManager {
if (curLM instanceof InlineLevelLayoutManager) {
context.clearKeepWithNextPending();
// "wrap" the Position stored in each element of returnedList
- ListIterator seqIter = returnedList.listIterator();
- while (seqIter.hasNext()) {
- KnuthSequence sequence = (KnuthSequence) seqIter.next();
+ for (KnuthSequence sequence : returnedList) {
sequence.wrapPositions(this);
}
int insertionStartIndex = 0;
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
index 5e3820a4b..5b9efa43e 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
@@ -377,11 +377,10 @@ public abstract class InlineStackingLayoutManager extends AbstractLayoutManager
// this is a new list
// "wrap" the Position stored in each element of returnedList
- ListIterator listIter = returnedList.listIterator();
- while (listIter.hasNext()) {
- returnedElement = (KnuthElement) listIter.next();
+ for (Object aReturnedList : returnedList) {
+ returnedElement = (KnuthElement) aReturnedList;
returnedElement.setPosition(
- notifyPos(new NonLeafPosition(this, returnedElement.getPosition())));
+ notifyPos(new NonLeafPosition(this, returnedElement.getPosition())));
returnList.add(returnedElement);
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
index 41f0cd5a4..40c7703ae 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
@@ -729,9 +729,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager
}
// loop over the KnuthSequences (and single KnuthElements) in returnedList
- ListIterator iter = inlineElements.listIterator();
- while (iter.hasNext()) {
- KnuthSequence sequence = (KnuthSequence) iter.next();
+ for (Object inlineElement : inlineElements) {
+ KnuthSequence sequence = (KnuthSequence) inlineElement;
// the sequence contains inline Knuth elements
if (sequence.isInlineSequence()) {
// look at the last element
@@ -745,9 +744,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager
// else this is the last paragraph
if (lastPar == null) {
lastPar = new Paragraph(this,
- textAlignment, textAlignmentLast,
- textIndent.getValue(this),
- lastLineEndIndent.getValue(this));
+ textAlignment, textAlignmentLast,
+ textIndent.getValue(this),
+ lastLineEndIndent.getValue(this));
lastPar.startSequence();
if (log.isTraceEnabled()) {
trace.append(" [");
@@ -765,7 +764,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
// finish last paragraph if it was closed with a linefeed
if (lastElement.isPenalty()
&& ((KnuthPenalty) lastElement).getPenalty()
- == -KnuthPenalty.INFINITE) {
+ == -KnuthPenalty.INFINITE) {
// a penalty item whose value is -inf
// represents a preserved linefeed,
// which forces a line break
@@ -938,10 +937,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager
if (!seq.isInlineSequence()) {
List<ListElement> targetList = new LinkedList<ListElement>();
- ListIterator listIter = seq.listIterator();
- while (listIter.hasNext()) {
+ for (Object aSeq : seq) {
ListElement tempElement;
- tempElement = (ListElement) listIter.next();
+ tempElement = (ListElement) aSeq;
LayoutManager lm = tempElement.getLayoutManager();
if (baselineOffset < 0 && lm != null && lm.hasLineAreaDescendant()) {
baselineOffset = lm.getBaselineOffset();
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
index 638460866..ab7d0c01a 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
@@ -1115,9 +1115,8 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
int oldIndex = -1;
int changeIndex;
PendingChange currChange;
- ListIterator changeListIterator = changeList.listIterator();
- while (changeListIterator.hasNext()) {
- currChange = (PendingChange) changeListIterator.next();
+ for (Object aChangeList : changeList) {
+ currChange = (PendingChange) aChangeList;
if (currChange.index == oldIndex) {
mappingsAdded++;
changeIndex = currChange.index + mappingsAdded - mappingsRemoved;
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
index 46a93b3f5..094caaf3d 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
@@ -563,9 +563,8 @@ public class ListItemLayoutManager extends SpacedBorderedPaddedBlockLayoutManage
List tempList = returnedList;
KnuthElement tempElement;
returnedList = new LinkedList();
- ListIterator listIter = tempList.listIterator();
- while (listIter.hasNext()) {
- tempElement = (KnuthElement)listIter.next();
+ for (Object aTempList : tempList) {
+ tempElement = (KnuthElement) aTempList;
tempElement.setPosition(new NonLeafPosition(this, tempElement.getPosition()));
returnedList.add(tempElement);
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/ColumnSetup.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
index 35e8c0c4f..1835d0547 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
@@ -21,7 +21,6 @@ package org.apache.fop.layoutmgr.table;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -68,9 +67,8 @@ public class ColumnSetup {
List rawCols = table.getColumns();
if (rawCols != null) {
int colnum = 1;
- ListIterator iter = rawCols.listIterator();
- while (iter.hasNext()) {
- TableColumn col = (TableColumn)iter.next();
+ for (Object rawCol : rawCols) {
+ TableColumn col = (TableColumn) rawCol;
if (col == null) {
continue;
}
@@ -86,9 +84,8 @@ public class ColumnSetup {
//Post-processing the list (looking for gaps)
//TODO The following block could possibly be removed
int pos = 1;
- ListIterator ppIter = columns.listIterator();
- while (ppIter.hasNext()) {
- TableColumn col = (TableColumn)ppIter.next();
+ for (Object column : columns) {
+ TableColumn col = (TableColumn) column;
if (col == null) {
assert false; //Gaps are filled earlier by fo.flow.table.Table.finalizeColumns()
//log.error("Found a gap in the table-columns at position " + pos);
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/RowPainter.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/RowPainter.java
index 85c016537..cbc19c1ec 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/RowPainter.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/RowPainter.java
@@ -21,7 +21,6 @@ package org.apache.fop.layoutmgr.table;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
@@ -166,10 +165,9 @@ class RowPainter {
firstRowOnPageIndex = firstRowIndex;
}
}
- Iterator partIter = tcpos.cellParts.iterator();
//Iterate over all grid units in the current step
- while (partIter.hasNext()) {
- CellPart cellPart = (CellPart)partIter.next();
+ for (Object cellPart1 : tcpos.cellParts) {
+ CellPart cellPart = (CellPart) cellPart1;
if (log.isDebugEnabled()) {
log.debug(">" + cellPart);
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
index 9458793c7..4940c66b2 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
@@ -21,7 +21,6 @@ package org.apache.fop.layoutmgr.table;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -272,9 +271,8 @@ public class TableLayoutManager extends SpacedBorderedPaddedBlockLayoutManager
contentKnuthElements = contentLM.getNextKnuthElements(childLC, alignment);
//Set index values on elements coming from the content LM
- Iterator iter = contentKnuthElements.iterator();
- while (iter.hasNext()) {
- ListElement el = (ListElement)iter.next();
+ for (Object contentKnuthElement : contentKnuthElements) {
+ ListElement el = (ListElement) contentKnuthElement;
notifyPos(el.getPosition());
}
log.debug(contentKnuthElements);
diff --git a/fop-core/src/main/java/org/apache/fop/pdf/PDFDocument.java b/fop-core/src/main/java/org/apache/fop/pdf/PDFDocument.java
index 59ff9c988..f5b886bc6 100644
--- a/fop-core/src/main/java/org/apache/fop/pdf/PDFDocument.java
+++ b/fop-core/src/main/java/org/apache/fop/pdf/PDFDocument.java
@@ -29,7 +29,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -742,9 +741,7 @@ public class PDFDocument {
*/
protected PDFGState findGState(PDFGState wanted, PDFGState current) {
PDFGState poss;
- Iterator<PDFGState> iter = this.gstates.iterator();
- while (iter.hasNext()) {
- PDFGState avail = iter.next();
+ for (PDFGState avail : this.gstates) {
poss = new PDFGState();
poss.addValues(current);
poss.addValues(avail);
diff --git a/fop-core/src/main/java/org/apache/fop/pdf/PDFEmbeddedFiles.java b/fop-core/src/main/java/org/apache/fop/pdf/PDFEmbeddedFiles.java
index c4979312e..d929f80d4 100644
--- a/fop-core/src/main/java/org/apache/fop/pdf/PDFEmbeddedFiles.java
+++ b/fop-core/src/main/java/org/apache/fop/pdf/PDFEmbeddedFiles.java
@@ -21,7 +21,6 @@ package org.apache.fop.pdf;
import java.io.IOException;
import java.io.OutputStream;
-import java.util.Iterator;
import java.util.Map;
import java.util.SortedMap;
@@ -54,9 +53,8 @@ public class PDFEmbeddedFiles extends PDFNameTreeNode {
map.put(key, value);
}
names.clear();
- Iterator iter = map.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next();
+ for (Object o : map.entrySet()) {
+ Map.Entry entry = (Map.Entry) o;
names.add(entry.getKey());
names.add(entry.getValue());
}
diff --git a/fop-core/src/main/java/org/apache/fop/pdf/PDFFactory.java b/fop-core/src/main/java/org/apache/fop/pdf/PDFFactory.java
index bdfb2a94d..09debe179 100644
--- a/fop-core/src/main/java/org/apache/fop/pdf/PDFFactory.java
+++ b/fop-core/src/main/java/org/apache/fop/pdf/PDFFactory.java
@@ -29,7 +29,6 @@ import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.BitSet;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
@@ -436,9 +435,8 @@ public class PDFFactory {
if (deep) {
dests = new PDFDests();
PDFArray kids = new PDFArray(dests);
- Iterator iter = destinationList.iterator();
- while (iter.hasNext()) {
- PDFDestination dest = (PDFDestination)iter.next();
+ for (Object aDestinationList : destinationList) {
+ PDFDestination dest = (PDFDestination) aDestinationList;
PDFNameTreeNode node = new PDFNameTreeNode();
getDocument().registerObject(node);
node.setLowerLimit(dest.getIDRef());
diff --git a/fop-core/src/main/java/org/apache/fop/render/RendererContext.java b/fop-core/src/main/java/org/apache/fop/render/RendererContext.java
index c7f13eefa..ba95297f1 100644
--- a/fop-core/src/main/java/org/apache/fop/render/RendererContext.java
+++ b/fop-core/src/main/java/org/apache/fop/render/RendererContext.java
@@ -20,7 +20,6 @@
package org.apache.fop.render;
//Java
-import java.util.Iterator;
import java.util.Map;
import org.apache.fop.apps.FOUserAgent;
@@ -117,9 +116,8 @@ public class RendererContext {
/** {@inheritDoc} **/
public String toString() {
StringBuffer stringBuffer = new StringBuffer("RendererContext{\n");
- Iterator it = props.keySet().iterator();
- while (it.hasNext()) {
- String key = (String)it.next();
+ for (Object o : props.keySet()) {
+ String key = (String) o;
Object value = props.get(key);
stringBuffer.append("\t" + key + "=" + value + "\n");
}
diff --git a/fop-core/src/main/java/org/apache/fop/render/intermediate/IFSerializer.java b/fop-core/src/main/java/org/apache/fop/render/intermediate/IFSerializer.java
index 91290c481..eb8c4bc2f 100644
--- a/fop-core/src/main/java/org/apache/fop/render/intermediate/IFSerializer.java
+++ b/fop-core/src/main/java/org/apache/fop/render/intermediate/IFSerializer.java
@@ -486,10 +486,9 @@ implements IFConstants, IFPainter, IFDocumentNavigationHandler {
private void addForeignAttributes(AttributesImpl atts) throws SAXException {
Map foreignAttributes = getContext().getForeignAttributes();
if (!foreignAttributes.isEmpty()) {
- Iterator iter = foreignAttributes.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next();
- addAttribute(atts, (QName)entry.getKey(), entry.getValue().toString());
+ for (Object o : foreignAttributes.entrySet()) {
+ Map.Entry entry = (Map.Entry) o;
+ addAttribute(atts, (QName) entry.getKey(), entry.getValue().toString());
}
}
}
@@ -857,9 +856,8 @@ implements IFConstants, IFPainter, IFDocumentNavigationHandler {
AttributesImpl atts = new AttributesImpl();
try {
handler.startElement(DocumentNavigationExtensionConstants.BOOKMARK_TREE, atts);
- Iterator iter = tree.getBookmarks().iterator();
- while (iter.hasNext()) {
- Bookmark b = (Bookmark)iter.next();
+ for (Object o : tree.getBookmarks()) {
+ Bookmark b = (Bookmark) o;
if (b.getAction() != null) {
serializeBookmark(b);
}
@@ -879,9 +877,8 @@ implements IFConstants, IFPainter, IFDocumentNavigationHandler {
XMLUtil.CDATA, bookmark.isShown() ? "show" : "hide");
handler.startElement(DocumentNavigationExtensionConstants.BOOKMARK, atts);
serializeXMLizable(bookmark.getAction());
- Iterator iter = bookmark.getChildBookmarks().iterator();
- while (iter.hasNext()) {
- Bookmark b = (Bookmark)iter.next();
+ for (Object o : bookmark.getChildBookmarks()) {
+ Bookmark b = (Bookmark) o;
if (b.getAction() != null) {
serializeBookmark(b);
}
diff --git a/fop-core/src/main/java/org/apache/fop/render/intermediate/extensions/ActionSet.java b/fop-core/src/main/java/org/apache/fop/render/intermediate/extensions/ActionSet.java
index 080a33a81..d460527be 100644
--- a/fop-core/src/main/java/org/apache/fop/render/intermediate/extensions/ActionSet.java
+++ b/fop-core/src/main/java/org/apache/fop/render/intermediate/extensions/ActionSet.java
@@ -19,7 +19,6 @@
package org.apache.fop.render.intermediate.extensions;
-import java.util.Iterator;
import java.util.Map;
/**
@@ -80,9 +79,8 @@ public class ActionSet {
}
private AbstractAction normalize(AbstractAction action) {
- Iterator iter = this.actionRegistry.values().iterator();
- while (iter.hasNext()) {
- AbstractAction a = (AbstractAction)iter.next();
+ for (Object o : this.actionRegistry.values()) {
+ AbstractAction a = (AbstractAction) o;
if (a.isSame(action)) {
return a;
}
diff --git a/fop-core/src/main/java/org/apache/fop/render/java2d/Java2DRenderer.java b/fop-core/src/main/java/org/apache/fop/render/java2d/Java2DRenderer.java
index 75957c396..b12d708ba 100644
--- a/fop-core/src/main/java/org/apache/fop/render/java2d/Java2DRenderer.java
+++ b/fop-core/src/main/java/org/apache/fop/render/java2d/Java2DRenderer.java
@@ -39,7 +39,6 @@ import java.awt.print.PrinterException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Stack;
@@ -63,7 +62,6 @@ import org.apache.fop.area.CTM;
import org.apache.fop.area.PageViewport;
import org.apache.fop.area.Trait;
import org.apache.fop.area.inline.Image;
-import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.Leader;
import org.apache.fop.area.inline.SpaceArea;
import org.apache.fop.area.inline.TextArea;
@@ -497,9 +495,8 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
protected void restoreStateStackAfterBreakOut(List breakOutList) {
log.debug("Block.FIXED --> restoring context after break-out");
- Iterator it = breakOutList.iterator();
- while (it.hasNext()) {
- Java2DGraphicsState s = (Java2DGraphicsState)it.next();
+ for (Object aBreakOutList : breakOutList) {
+ Java2DGraphicsState s = (Java2DGraphicsState) aBreakOutList;
stateStack.push(state);
this.state = s;
}
@@ -761,11 +758,9 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
float textCursor = 0;
- Iterator iter = text.getChildAreas().iterator();
- while (iter.hasNext()) {
- InlineArea child = (InlineArea)iter.next();
+ for (Object child : text.getChildAreas()) {
if (child instanceof WordArea) {
- WordArea word = (WordArea)child;
+ WordArea word = (WordArea) child;
String s = word.getWord();
int[] letterAdjust = word.getLetterAdjustArray();
GlyphVector gv = g2d.getFont().createGlyphVector(g2d.getFontRenderContext(), s);
@@ -788,12 +783,12 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
g2d.drawGlyphVector(gv, textCursor, 0);
textCursor += gv.getLogicalBounds().getWidth() + additionalWidth;
} else if (child instanceof SpaceArea) {
- SpaceArea space = (SpaceArea)child;
+ SpaceArea space = (SpaceArea) child;
String s = space.getSpace();
char sp = s.charAt(0);
int tws = (space.isAdjustable()
? text.getTextWordSpaceAdjust()
- + 2 * text.getTextLetterSpaceAdjust()
+ + 2 * text.getTextLetterSpaceAdjust()
: 0);
textCursor += (font.getCharWidth(sp) + tws) / 1000f;
diff --git a/fop-core/src/main/java/org/apache/fop/render/pcl/PCLPageDefinition.java b/fop-core/src/main/java/org/apache/fop/render/pcl/PCLPageDefinition.java
index 3e577cfa0..a07a1a503 100644
--- a/fop-core/src/main/java/org/apache/fop/render/pcl/PCLPageDefinition.java
+++ b/fop-core/src/main/java/org/apache/fop/render/pcl/PCLPageDefinition.java
@@ -21,7 +21,6 @@ package org.apache.fop.render.pcl;
import java.awt.Dimension;
import java.awt.Rectangle;
-import java.util.Iterator;
import java.util.List;
import org.apache.xmlgraphics.util.UnitConv;
@@ -104,9 +103,8 @@ public class PCLPageDefinition {
* @return the page definition or null if no match was found
*/
public static PCLPageDefinition getPageDefinition(long width, long height, int errorMargin) {
- Iterator iter = pageDefinitions.iterator();
- while (iter.hasNext()) {
- PCLPageDefinition def = (PCLPageDefinition)iter.next();
+ for (Object pageDefinition : pageDefinitions) {
+ PCLPageDefinition def = (PCLPageDefinition) pageDefinition;
if (def.matches(width, height, errorMargin)) {
return def;
}
@@ -120,9 +118,8 @@ public class PCLPageDefinition {
* @return the page definition or null if no match was found
*/
public static PCLPageDefinition getPageDefinition(String name) {
- Iterator iter = pageDefinitions.iterator();
- while (iter.hasNext()) {
- PCLPageDefinition def = (PCLPageDefinition)iter.next();
+ for (Object pageDefinition : pageDefinitions) {
+ PCLPageDefinition def = (PCLPageDefinition) pageDefinition;
if (def.getName().equalsIgnoreCase(name)) {
return def;
}
diff --git a/fop-core/src/main/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java b/fop-core/src/main/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java
index cb9f43fa9..8ffd817aa 100644
--- a/fop-core/src/main/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java
+++ b/fop-core/src/main/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java
@@ -22,7 +22,6 @@ package org.apache.fop.render.pdf;
import java.awt.Rectangle;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
-import java.util.Iterator;
import java.util.Map;
import org.apache.fop.pdf.PDFAction;
@@ -76,9 +75,8 @@ public class PDFDocumentNavigationHandler implements IFDocumentNavigationHandler
/** {@inheritDoc} */
public void renderBookmarkTree(BookmarkTree tree) throws IFException {
- Iterator iter = tree.getBookmarks().iterator();
- while (iter.hasNext()) {
- Bookmark b = (Bookmark)iter.next();
+ for (Object o : tree.getBookmarks()) {
+ Bookmark b = (Bookmark) o;
renderBookmark(b, null);
}
}
@@ -91,9 +89,8 @@ public class PDFDocumentNavigationHandler implements IFDocumentNavigationHandler
PDFReference actionRef = (action != null ? action.makeReference() : null);
PDFOutline pdfOutline = getPDFDoc().getFactory().makeOutline(parent,
bookmark.getTitle(), actionRef, bookmark.isShown());
- Iterator iter = bookmark.getChildBookmarks().iterator();
- while (iter.hasNext()) {
- Bookmark b = (Bookmark)iter.next();
+ for (Object o : bookmark.getChildBookmarks()) {
+ Bookmark b = (Bookmark) o;
renderBookmark(b, pdfOutline);
}
}
diff --git a/fop-core/src/main/java/org/apache/fop/render/ps/PSTextPainter.java b/fop-core/src/main/java/org/apache/fop/render/ps/PSTextPainter.java
index 189a6bd8f..eb726c940 100644
--- a/fop-core/src/main/java/org/apache/fop/render/ps/PSTextPainter.java
+++ b/fop-core/src/main/java/org/apache/fop/render/ps/PSTextPainter.java
@@ -358,9 +358,7 @@ public class PSTextPainter extends NativeTextPainter {
if (x || y) {
sb.append("\n[");
int idx = 0;
- Iterator<Point2D> iter = this.relativePositions.iterator();
- while (iter.hasNext()) {
- Point2D pt = iter.next();
+ for (Point2D pt : this.relativePositions) {
if (idx > 0) {
if (x) {
sb.append(format(gen, pt.getX()));
diff --git a/fop-core/src/main/java/org/apache/fop/render/ps/ResourceHandler.java b/fop-core/src/main/java/org/apache/fop/render/ps/ResourceHandler.java
index a12ae5a49..42eea5dfd 100644
--- a/fop-core/src/main/java/org/apache/fop/render/ps/ResourceHandler.java
+++ b/fop-core/src/main/java/org/apache/fop/render/ps/ResourceHandler.java
@@ -23,7 +23,6 @@ import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -117,10 +116,9 @@ public class ResourceHandler implements DSCParserConstants, PSSupportedFlavors {
if (formResources == null) {
return;
}
- Iterator iter = formResources.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next();
- PSResource res = (PSResource)entry.getValue();
+ for (Object o : formResources.entrySet()) {
+ Map.Entry entry = (Map.Entry) o;
+ PSResource res = (PSResource) entry.getValue();
long count = resTracker.getUsageCount(res);
if (count > 1) {
//Make global form
@@ -264,9 +262,8 @@ public class ResourceHandler implements DSCParserConstants, PSSupportedFlavors {
if (formResources == null) {
return;
}
- Iterator iter = formResources.values().iterator();
- while (iter.hasNext()) {
- PSImageFormResource form = (PSImageFormResource)iter.next();
+ for (Object o : formResources.values()) {
+ PSImageFormResource form = (PSImageFormResource) o;
resTracker.registerSuppliedResource(form);
}
}
@@ -275,9 +272,8 @@ public class ResourceHandler implements DSCParserConstants, PSSupportedFlavors {
if (formResources == null) {
return;
}
- Iterator iter = formResources.values().iterator();
- while (iter.hasNext()) {
- PSImageFormResource form = (PSImageFormResource)iter.next();
+ for (Object o : formResources.values()) {
+ PSImageFormResource form = (PSImageFormResource) o;
generateFormForImage(gen, form);
}
}
diff --git a/fop-core/src/main/java/org/apache/fop/render/xml/XMLRenderer.java b/fop-core/src/main/java/org/apache/fop/render/xml/XMLRenderer.java
index e1a123322..ffe16f2ca 100644
--- a/fop-core/src/main/java/org/apache/fop/render/xml/XMLRenderer.java
+++ b/fop-core/src/main/java/org/apache/fop/render/xml/XMLRenderer.java
@@ -192,9 +192,8 @@ public class XMLRenderer extends AbstractXMLRenderer {
protected void addTraitAttributes(Area area) {
Map traitMap = area.getTraits();
if (traitMap != null) {
- Iterator iter = traitMap.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry traitEntry = (Map.Entry) iter.next();
+ for (Object o : traitMap.entrySet()) {
+ Map.Entry traitEntry = (Map.Entry) o;
Object key = traitEntry.getKey();
String name = Trait.getTraitName(key);
Class clazz = Trait.getTraitClass(key);
@@ -203,15 +202,15 @@ public class XMLRenderer extends AbstractXMLRenderer {
}
Object value = traitEntry.getValue();
if (((Integer) key).intValue() == Trait.FONT) {
- FontTriplet triplet = (FontTriplet)value;
+ FontTriplet triplet = (FontTriplet) value;
addAttribute("font-name", triplet.getName());
addAttribute("font-style", triplet.getStyle());
addAttribute("font-weight", triplet.getWeight());
} else if (clazz.equals(InternalLink.class)) {
- InternalLink iLink = (InternalLink)value;
+ InternalLink iLink = (InternalLink) value;
addAttribute(name, iLink.xmlAttribute());
} else if (clazz.equals(Background.class)) {
- Background bkg = (Background)value;
+ Background bkg = (Background) value;
//TODO Remove the following line (makes changes in the test checks necessary)
addAttribute(name, bkg.toString());
if (bkg.getColor() != null) {
@@ -222,28 +221,28 @@ public class XMLRenderer extends AbstractXMLRenderer {
String repString;
int repeat = bkg.getRepeat();
switch (repeat) {
- case Constants.EN_REPEAT:
- repString = "repeat";
- break;
- case Constants.EN_REPEATX:
- repString = "repeat-x";
- break;
- case Constants.EN_REPEATY:
- repString = "repeat-y";
- break;
- case Constants.EN_NOREPEAT:
- repString = "no-repeat";
- break;
- default:
- throw new IllegalStateException(
- "Illegal value for repeat encountered: " + repeat);
+ case Constants.EN_REPEAT:
+ repString = "repeat";
+ break;
+ case Constants.EN_REPEATX:
+ repString = "repeat-x";
+ break;
+ case Constants.EN_REPEATY:
+ repString = "repeat-y";
+ break;
+ case Constants.EN_NOREPEAT:
+ repString = "no-repeat";
+ break;
+ default:
+ throw new IllegalStateException(
+ "Illegal value for repeat encountered: " + repeat);
}
addAttribute("bkg-repeat", repString);
addAttribute("bkg-horz-offset", bkg.getHoriz());
addAttribute("bkg-vert-offset", bkg.getVertical());
}
} else if (clazz.equals(Color.class)) {
- Color c = (Color)value;
+ Color c = (Color) value;
addAttribute(name, ColorUtil.colorToString(c));
} else if (((Integer) key).intValue() == Trait.START_INDENT
|| ((Integer) key).intValue() == Trait.END_INDENT) {
@@ -429,12 +428,11 @@ public class XMLRenderer extends AbstractXMLRenderer {
protected void handleExtensionAttachments(List attachments) {
if (attachments != null && attachments.size() > 0) {
startElement("extension-attachments");
- Iterator i = attachments.iterator();
- while (i.hasNext()) {
- ExtensionAttachment attachment = (ExtensionAttachment)i.next();
+ for (Object attachment1 : attachments) {
+ ExtensionAttachment attachment = (ExtensionAttachment) attachment1;
if (attachment instanceof XMLizable) {
try {
- ((XMLizable)attachment).toSAX(this.handler);
+ ((XMLizable) attachment).toSAX(this.handler);
} catch (SAXException e) {
log.error("Error while serializing Extension Attachment", e);
}
diff --git a/fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListGenerator.java b/fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListGenerator.java
index 0f3f737f7..dff956445 100644
--- a/fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListGenerator.java
+++ b/fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListGenerator.java
@@ -19,8 +19,8 @@
package org.apache.fop.tools.fontlist;
+import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -81,31 +81,30 @@ public class FontListGenerator {
SortedMap fontFamilies = new java.util.TreeMap();
//SortedMap<String/font-family, List<FontSpec>>
- Iterator iter = fontInfo.getFontTriplets().entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next();
- FontTriplet triplet = (FontTriplet)entry.getKey();
- String key = (String)entry.getValue();
+ for (Object o : fontInfo.getFontTriplets().entrySet()) {
+ Map.Entry entry = (Map.Entry) o;
+ FontTriplet triplet = (FontTriplet) entry.getKey();
+ String key = (String) entry.getValue();
FontSpec container;
if (keyBag.contains(key)) {
keyBag.remove(key);
- FontMetrics metrics = (FontMetrics)fonts.get(key);
+ FontMetrics metrics = (FontMetrics) fonts.get(key);
container = new FontSpec(key, metrics);
container.addFamilyNames(metrics.getFamilyNames());
keys.put(key, container);
- String firstFamilyName = (String)container.getFamilyNames().first();
- List containers = (List)fontFamilies.get(firstFamilyName);
+ String firstFamilyName = (String) container.getFamilyNames().first();
+ List containers = (List) fontFamilies.get(firstFamilyName);
if (containers == null) {
- containers = new java.util.ArrayList();
+ containers = new ArrayList();
fontFamilies.put(firstFamilyName, containers);
}
containers.add(container);
Collections.sort(containers);
} else {
- container = (FontSpec)keys.get(key);
+ container = (FontSpec) keys.get(key);
}
container.addTriplet(triplet);
}
diff --git a/fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListMain.java b/fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListMain.java
index dcc1f5785..adb5aa36e 100644
--- a/fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListMain.java
+++ b/fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListMain.java
@@ -177,9 +177,8 @@ public final class FontListMain {
sb.append(':');
sb.append('\n');
List list = (List)entry.getValue();
- Iterator fonts = list.iterator();
- while (fonts.hasNext()) {
- FontSpec f = (FontSpec)fonts.next();
+ for (Object aList : list) {
+ FontSpec f = (FontSpec) aList;
sb.append(" ");
sb.append(f.getKey());
sb.append(' ');
@@ -194,9 +193,8 @@ public final class FontListMain {
}
}
sb.append('\n');
- Iterator triplets = f.getTriplets().iterator();
- while (triplets.hasNext()) {
- FontTriplet triplet = (FontTriplet)triplets.next();
+ for (Object o : f.getTriplets()) {
+ FontTriplet triplet = (FontTriplet) o;
sb.append(" ");
sb.append(triplet.toString());
sb.append('\n');
@@ -211,24 +209,23 @@ public final class FontListMain {
throws TransformerConfigurationException, SAXException, IOException {
if (this.outputFile.isDirectory()) {
System.out.println("Creating one file for each family...");
- Iterator iter = fontFamilies.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next();
- String familyName = (String)entry.getKey();
+ for (Object o : fontFamilies.entrySet()) {
+ Map.Entry entry = (Map.Entry) o;
+ String familyName = (String) entry.getKey();
System.out.println("Creating output file for " + familyName + "...");
String filename;
- switch(this.mode) {
- case GENERATE_RENDERED:
- filename = familyName + ".pdf";
- break;
- case GENERATE_FO:
- filename = familyName + ".fo";
- break;
- case GENERATE_XML:
- filename = familyName + ".xml";
- break;
- default:
- throw new IllegalStateException("Unsupported mode");
+ switch (this.mode) {
+ case GENERATE_RENDERED:
+ filename = familyName + ".pdf";
+ break;
+ case GENERATE_FO:
+ filename = familyName + ".fo";
+ break;
+ case GENERATE_XML:
+ filename = familyName + ".xml";
+ break;
+ default:
+ throw new IllegalStateException("Unsupported mode");
}
File outFile = new File(this.outputFile, filename);
generateXML(fontFamilies, outFile, familyName);
diff --git a/fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListSerializer.java b/fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListSerializer.java
index 3b3d13245..931cf6c28 100644
--- a/fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListSerializer.java
+++ b/fop-core/src/main/java/org/apache/fop/tools/fontlist/FontListSerializer.java
@@ -20,7 +20,6 @@
package org.apache.fop.tools.fontlist;
import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
@@ -77,10 +76,9 @@ public class FontListSerializer {
AttributesImpl atts = new AttributesImpl();
handler.startElement(FONTS, atts);
- Iterator iter = fontFamilies.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next();
- String familyName = (String)entry.getKey();
+ for (Object o : fontFamilies.entrySet()) {
+ Map.Entry entry = (Map.Entry) o;
+ String familyName = (String) entry.getKey();
if (singleFamily != null && !singleFamily.equals(familyName)) {
continue;
}
@@ -90,7 +88,7 @@ public class FontListSerializer {
stripQuotes(familyName));
handler.startElement(FAMILY, atts);
- List containers = (List)entry.getValue();
+ List containers = (List) entry.getValue();
generateXMLForFontContainers(handler, containers);
handler.endElement(FAMILY);
}
@@ -108,9 +106,8 @@ public class FontListSerializer {
private void generateXMLForFontContainers(GenerationHelperContentHandler handler,
List containers) throws SAXException {
AttributesImpl atts = new AttributesImpl();
- Iterator fontIter = containers.iterator();
- while (fontIter.hasNext()) {
- FontSpec cont = (FontSpec)fontIter.next();
+ for (Object container : containers) {
+ FontSpec cont = (FontSpec) container;
atts.clear();
atts.addAttribute(null, KEY, KEY, CDATA, cont.getKey());
atts.addAttribute(null, TYPE, TYPE, CDATA,
@@ -126,9 +123,8 @@ public class FontListSerializer {
AttributesImpl atts = new AttributesImpl();
atts.clear();
handler.startElement(TRIPLETS, atts);
- Iterator iter = triplets.iterator();
- while (iter.hasNext()) {
- FontTriplet triplet = (FontTriplet)iter.next();
+ for (Object triplet1 : triplets) {
+ FontTriplet triplet = (FontTriplet) triplet1;
atts.clear();
atts.addAttribute(null, NAME, NAME, CDATA, triplet.getName());
atts.addAttribute(null, STYLE, STYLE, CDATA, triplet.getStyle());
diff --git a/fop-core/src/test/java/org/apache/fop/layoutengine/ElementListCheck.java b/fop-core/src/test/java/org/apache/fop/layoutengine/ElementListCheck.java
index 4ac29b4cd..eaaa99693 100644
--- a/fop-core/src/test/java/org/apache/fop/layoutengine/ElementListCheck.java
+++ b/fop-core/src/test/java/org/apache/fop/layoutengine/ElementListCheck.java
@@ -19,7 +19,6 @@
package org.apache.fop.layoutengine;
-import java.util.Iterator;
import java.util.List;
import org.w3c.dom.CDATASection;
@@ -230,9 +229,8 @@ public class ElementListCheck implements LayoutEngineCheck {
private ElementListCollector.ElementList findElementList(LayoutResult result) {
List candidates = new java.util.ArrayList();
- Iterator iter = result.getElementListCollector().getElementLists().iterator();
- while (iter.hasNext()) {
- ElementListCollector.ElementList el = (ElementListCollector.ElementList)iter.next();
+ for (Object o : result.getElementListCollector().getElementLists()) {
+ ElementListCollector.ElementList el = (ElementListCollector.ElementList) o;
if (el.getCategory().equals(category)) {
if (haveID() && this.id.equals(el.getID())) {
candidates.add(el);
diff --git a/fop-core/src/test/java/org/apache/fop/memory/Stats.java b/fop-core/src/test/java/org/apache/fop/memory/Stats.java
index 354952347..6c1ae3112 100644
--- a/fop-core/src/test/java/org/apache/fop/memory/Stats.java
+++ b/fop-core/src/test/java/org/apache/fop/memory/Stats.java
@@ -19,7 +19,6 @@
package org.apache.fop.memory;
-import java.util.Iterator;
import java.util.List;
class Stats {
@@ -83,9 +82,8 @@ class Stats {
sb.append("&chd=t:");
boolean first = true;
int maxY = 0;
- Iterator iter = samples.iterator();
- while (iter.hasNext()) {
- Sample sample = (Sample)iter.next();
+ for (Object sample1 : samples) {
+ Sample sample = (Sample) sample1;
if (first) {
first = false;
} else {
diff --git a/fop-core/src/test/java/org/apache/fop/threading/FOPTestbed.java b/fop-core/src/test/java/org/apache/fop/threading/FOPTestbed.java
index 7b03ada61..ec66080cd 100644
--- a/fop-core/src/test/java/org/apache/fop/threading/FOPTestbed.java
+++ b/fop-core/src/test/java/org/apache/fop/threading/FOPTestbed.java
@@ -23,7 +23,6 @@ import java.io.File;
import java.io.OutputStream;
import java.text.DecimalFormat;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import javax.xml.transform.Source;
@@ -101,9 +100,8 @@ public class FOPTestbed extends AbstractLogEnabled
}
//Start threads
- Iterator i = threadList.iterator();
- while (i.hasNext()) {
- ((Thread)i.next()).start();
+ for (Object aThreadList : threadList) {
+ ((Thread) aThreadList).start();
}
//Wait for threads to end
@@ -129,9 +127,8 @@ public class FOPTestbed extends AbstractLogEnabled
int failures = 0;
long bytesWritten = 0;
System.out.println("Report on " + count + " tasks:");
- Iterator iter = this.results.iterator();
- while (iter.hasNext()) {
- Result res = (Result)iter.next();
+ for (Object result : this.results) {
+ Result res = (Result) result;
if (res.failure != null) {
System.out.println("FAIL: " + (res.end - res.start) + " " + res.task);
System.out.println(" -> " + res.failure.getMessage());
@@ -158,9 +155,8 @@ public class FOPTestbed extends AbstractLogEnabled
public void run() {
try {
for (int r = 0; r < repeat; r++) {
- Iterator i = taskList.iterator();
- while (i.hasNext()) {
- TaskDef def = (TaskDef)i.next();
+ for (Object aTaskList : taskList) {
+ TaskDef def = (TaskDef) aTaskList;
final Task task = new Task(def, counter++, foprocessor);
ContainerUtil.enableLogging(task, getLogger());
task.execute();
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());
diff --git a/fop-util/src/main/java/org/apache/fop/util/text/AdvancedMessageFormat.java b/fop-util/src/main/java/org/apache/fop/util/text/AdvancedMessageFormat.java
index f8508e082..acb851553 100644
--- a/fop-util/src/main/java/org/apache/fop/util/text/AdvancedMessageFormat.java
+++ b/fop-util/src/main/java/org/apache/fop/util/text/AdvancedMessageFormat.java
@@ -355,9 +355,7 @@ public class AdvancedMessageFormat {
target.append(obj);
} else {
boolean handled = false;
- Iterator<ObjectFormatter> iter = OBJECT_FORMATTERS.iterator();
- while (iter.hasNext()) {
- ObjectFormatter formatter = iter.next();
+ for (ObjectFormatter formatter : OBJECT_FORMATTERS) {
if (formatter.supportsObject(obj)) {
formatter.format(target, obj);
handled = true;
@@ -437,9 +435,7 @@ public class AdvancedMessageFormat {
public void write(StringBuffer sb, Map<String, Object> params) {
if (hasSections) {
- Iterator<Part> iter = this.parts.iterator();
- while (iter.hasNext()) {
- Part part = iter.next();
+ for (Part part : this.parts) {
if (part.isGenerated(params)) {
part.write(sb, params);
break;
@@ -447,9 +443,7 @@ public class AdvancedMessageFormat {
}
} else {
if (isGenerated(params)) {
- Iterator<Part> iter = this.parts.iterator();
- while (iter.hasNext()) {
- Part part = iter.next();
+ for (Part part : this.parts) {
part.write(sb, params);
}
}
@@ -458,9 +452,7 @@ public class AdvancedMessageFormat {
public boolean isGenerated(Map<String, Object> params) {
if (hasSections) {
- Iterator<Part> iter = this.parts.iterator();
- while (iter.hasNext()) {
- Part part = iter.next();
+ for (Part part : this.parts) {
if (part.isGenerated(params)) {
return true;
}
@@ -468,9 +460,7 @@ public class AdvancedMessageFormat {
return false;
} else {
if (conditional) {
- Iterator<Part> iter = this.parts.iterator();
- while (iter.hasNext()) {
- Part part = iter.next();
+ for (Part part : this.parts) {
if (!part.isGenerated(params)) {
return false;
}