aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2016-09-16 12:50:43 +0000
committerSimon Steiner <ssteiner@apache.org>2016-09-16 12:50:43 +0000
commit812dc1b5f74377912befb8f0c5243d3992629160 (patch)
treef3eaf7e48e7299d35ed955b41c08af8d9589d6b9
parente5e89aa9e3799a2596f9f8e61c7f1edc5f95ab44 (diff)
downloadxmlgraphics-fop-812dc1b5f74377912befb8f0c5243d3992629160.tar.gz
xmlgraphics-fop-812dc1b5f74377912befb8f0c5243d3992629160.zip
FOP-2648: Code cleanup, use entryset
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1761026 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--fop-core/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/area/inline/WordArea.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionTable.java9
-rw-r--r--fop-core/src/main/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java9
-rw-r--r--fop-core/src/main/java/org/apache/fop/complexscripts/util/GlyphSequence.java13
-rw-r--r--fop-core/src/main/java/org/apache/fop/complexscripts/util/NumberConverter.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/fo/FOText.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/fonts/CustomFont.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/fonts/FontInfo.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java44
-rw-r--r--fop-core/src/main/java/org/apache/fop/fonts/type1/Type1FontLoader.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/WhitespaceManagementPenalty.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/pdf/PDFArray.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/pdf/PDFFilterList.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/pdf/PDFResources.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/render/ImageHandlerRegistry.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/render/intermediate/IFUtil.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFFontReader.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/util/ColorUtil.java2
-rw-r--r--fop-core/src/test/java/org/apache/fop/apps/AFPRendererConfBuilder.java4
-rw-r--r--fop-core/src/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java18
-rw-r--r--fop-core/src/test/java/org/apache/fop/fonts/CIDFullTestCase.java4
-rw-r--r--fop-core/src/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java2
25 files changed, 73 insertions, 93 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java b/fop-core/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java
index d9836f682..92fd8658c 100644
--- a/fop-core/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java
+++ b/fop-core/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java
@@ -140,7 +140,7 @@ public abstract class AbstractGraphicsCoord extends AbstractGraphicsDrawingOrder
sb.append('=');
sb.append(coords[i]);
}
- return getName() + "{" + sb.toString() + "}";
+ return getName() + "{" + sb + "}";
}
/**
diff --git a/fop-core/src/main/java/org/apache/fop/area/inline/WordArea.java b/fop-core/src/main/java/org/apache/fop/area/inline/WordArea.java
index 24cc9478c..a00d7112b 100644
--- a/fop-core/src/main/java/org/apache/fop/area/inline/WordArea.java
+++ b/fop-core/src/main/java/org/apache/fop/area/inline/WordArea.java
@@ -125,9 +125,7 @@ public class WordArea extends InlineArea {
if (this.levels != null) {
int n = end - start;
int[] levels = new int [ n ];
- for (int i = 0; i < n; i++) {
- levels[i] = this.levels [ start + i ];
- }
+ System.arraycopy(this.levels, start + 0, levels, 0, n);
return levels;
} else {
return null;
diff --git a/fop-core/src/main/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java b/fop-core/src/main/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java
index 4713f02cf..82a9f6afd 100644
--- a/fop-core/src/main/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java
+++ b/fop-core/src/main/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java
@@ -21,6 +21,7 @@ package org.apache.fop.complexscripts.fonts;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -340,9 +341,7 @@ public class GlyphPositioningTable extends GlyphTable {
public List getEntries() {
if (values != null) {
List entries = new ArrayList(values.length);
- for (Value value : values) {
- entries.add(value);
- }
+ Collections.addAll(entries, values);
return entries;
} else {
return null;
diff --git a/fop-core/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionTable.java b/fop-core/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionTable.java
index 26e3a35c7..9ca9ac328 100644
--- a/fop-core/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionTable.java
+++ b/fop-core/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionTable.java
@@ -20,6 +20,7 @@
package org.apache.fop.complexscripts.fonts;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -506,9 +507,7 @@ public class GlyphSubstitutionTable extends GlyphTable {
/** {@inheritDoc} */
public List getEntries() {
List entries = new ArrayList(gaa.length);
- for (int[] aGaa : gaa) {
- entries.add(aGaa);
- }
+ Collections.addAll(entries, gaa);
return entries;
}
/** {@inheritDoc} */
@@ -638,9 +637,7 @@ public class GlyphSubstitutionTable extends GlyphTable {
/** {@inheritDoc} */
public List getEntries() {
List entries = new ArrayList(ligatureSets.length);
- for (LigatureSet ligatureSet : ligatureSets) {
- entries.add(ligatureSet);
- }
+ Collections.addAll(entries, ligatureSets);
return entries;
}
/** {@inheritDoc} */
diff --git a/fop-core/src/main/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java b/fop-core/src/main/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java
index 9e7721121..93fd3e75c 100644
--- a/fop-core/src/main/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java
+++ b/fop-core/src/main/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java
@@ -21,6 +21,7 @@ package org.apache.fop.complexscripts.scripts;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -241,9 +242,7 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
};
static {
basicShapingFeatures = new HashSet<String>();
- for (String s : BASIC_SHAPING_FEATURE_STRINGS) {
- basicShapingFeatures.add(s);
- }
+ Collections.addAll(basicShapingFeatures, BASIC_SHAPING_FEATURE_STRINGS);
}
private boolean isBasicShapingUse(GlyphTable.UseSpec us) {
assert us != null;
@@ -265,9 +264,7 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
};
static {
presentationFeatures = new HashSet<String>();
- for (String s : PRESENTATION_FEATURE_STRINGS) {
- presentationFeatures.add(s);
- }
+ Collections.addAll(presentationFeatures, PRESENTATION_FEATURE_STRINGS);
}
private boolean isPresentationUse(GlyphTable.UseSpec us) {
assert us != null;
diff --git a/fop-core/src/main/java/org/apache/fop/complexscripts/util/GlyphSequence.java b/fop-core/src/main/java/org/apache/fop/complexscripts/util/GlyphSequence.java
index 72fc357f0..1c13a5efe 100644
--- a/fop-core/src/main/java/org/apache/fop/complexscripts/util/GlyphSequence.java
+++ b/fop-core/src/main/java/org/apache/fop/complexscripts/util/GlyphSequence.java
@@ -21,6 +21,7 @@ package org.apache.fop.complexscripts.util;
import java.nio.IntBuffer;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
// CSOFF: LineLengthCheck
@@ -459,19 +460,13 @@ public class GlyphSequence implements Cloneable {
if (na > 0) {
List gl = new ArrayList(na);
if (baa != null) {
- for (CharAssociation aBaa : baa) {
- gl.add(aBaa);
- }
+ Collections.addAll(gl, baa);
}
if (iaa != null) {
- for (CharAssociation anIaa : iaa) {
- gl.add(anIaa);
- }
+ Collections.addAll(gl, iaa);
}
if (laa != null) {
- for (CharAssociation aLaa : laa) {
- gl.add(aLaa);
- }
+ Collections.addAll(gl, laa);
}
return gl;
} else {
diff --git a/fop-core/src/main/java/org/apache/fop/complexscripts/util/NumberConverter.java b/fop-core/src/main/java/org/apache/fop/complexscripts/util/NumberConverter.java
index 6a21851fa..48f9af9e3 100644
--- a/fop-core/src/main/java/org/apache/fop/complexscripts/util/NumberConverter.java
+++ b/fop-core/src/main/java/org/apache/fop/complexscripts/util/NumberConverter.java
@@ -20,6 +20,7 @@
package org.apache.fop.complexscripts.util;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
// CSOFF: LineLengthCheck
@@ -478,9 +479,7 @@ public class NumberConverter {
*/
private static void appendScalars(List<Integer> scalars, Integer[] sa) {
- for (Integer s : sa) {
- scalars.add(s);
- }
+ Collections.addAll(scalars, sa);
}
private static String scalarsToString(List<Integer> scalars) {
diff --git a/fop-core/src/main/java/org/apache/fop/fo/FOText.java b/fop-core/src/main/java/org/apache/fop/fo/FOText.java
index 9f286d888..8b65e6891 100644
--- a/fop-core/src/main/java/org/apache/fop/fo/FOText.java
+++ b/fop-core/src/main/java/org/apache/fop/fo/FOText.java
@@ -801,9 +801,7 @@ public class FOText extends FONode implements CharSequence, TextFragment {
assert start <= end;
int n = end - start;
int[] bidiLevels = new int [ n ];
- for (int i = 0; i < n; i++) {
- bidiLevels[i] = this.bidiLevels [ start + i ];
- }
+ System.arraycopy(this.bidiLevels, start + 0, bidiLevels, 0, n);
return bidiLevels;
} else {
return null;
diff --git a/fop-core/src/main/java/org/apache/fop/fonts/CustomFont.java b/fop-core/src/main/java/org/apache/fop/fonts/CustomFont.java
index d19f2161f..ed9f1f039 100644
--- a/fop-core/src/main/java/org/apache/fop/fonts/CustomFont.java
+++ b/fop-core/src/main/java/org/apache/fop/fonts/CustomFont.java
@@ -530,9 +530,7 @@ public abstract class CustomFont extends Typeface
*/
public void setCMap(CMapSegment[] cmap) {
this.cmap.clear();
- for (CMapSegment c : cmap) {
- this.cmap.add(c);
- }
+ Collections.addAll(this.cmap, cmap);
}
/**
diff --git a/fop-core/src/main/java/org/apache/fop/fonts/FontInfo.java b/fop-core/src/main/java/org/apache/fop/fonts/FontInfo.java
index e54844829..7e44d56ae 100644
--- a/fop-core/src/main/java/org/apache/fop/fonts/FontInfo.java
+++ b/fop-core/src/main/java/org/apache/fop/fonts/FontInfo.java
@@ -428,7 +428,7 @@ public class FontInfo {
}
throw new IllegalStateException(
"fontLookup must return an array with at least one "
- + "FontTriplet on the last call. Lookup: " + sb.toString());
+ + "FontTriplet on the last call. Lookup: " + sb);
}
FontTriplet[] fontTriplets = new FontTriplet[matchedTriplets.size()];
diff --git a/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java b/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java
index d8e363e99..c28bca5fe 100644
--- a/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java
+++ b/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java
@@ -334,13 +334,14 @@ public class OTFSubSetFile extends OTFFile {
gidToSID = new LinkedHashMap<Integer, Integer>();
- for (int gid : subsetGlyphs.keySet()) {
+ for (Entry<Integer, Integer> subsetGlyph : subsetGlyphs.entrySet()) {
+ int gid = subsetGlyph.getKey();
int sid = cffReader.getSIDFromGID(charsetOffset, gid);
//Check whether the SID falls into the standard string set
if (sid < NUM_STANDARD_STRINGS) {
- gidToSID.put(subsetGlyphs.get(gid), sid);
+ gidToSID.put(subsetGlyph.getValue(), sid);
if (mbFont != null) {
- mbFont.mapUsedGlyphName(subsetGlyphs.get(gid),
+ mbFont.mapUsedGlyphName(subsetGlyph.getValue(),
CFFStandardString.getName(sid));
}
} else {
@@ -348,16 +349,16 @@ public class OTFSubSetFile extends OTFFile {
//index is 0 based, should use < not <=
if (index < cffReader.getStringIndex().getNumObjects()) {
if (mbFont != null) {
- mbFont.mapUsedGlyphName(subsetGlyphs.get(gid),
+ mbFont.mapUsedGlyphName(subsetGlyph.getValue(),
new String(cffReader.getStringIndex().getValue(index)));
}
- gidToSID.put(subsetGlyphs.get(gid), stringIndexData.size() + 391);
+ gidToSID.put(subsetGlyph.getValue(), stringIndexData.size() + 391);
stringIndexData.add(cffReader.getStringIndex().getValue(index));
} else {
if (mbFont != null) {
- mbFont.mapUsedGlyphName(subsetGlyphs.get(gid), ".notdef");
+ mbFont.mapUsedGlyphName(subsetGlyph.getValue(), ".notdef");
}
- gidToSID.put(subsetGlyphs.get(gid), index);
+ gidToSID.put(subsetGlyph.getValue(), index);
}
}
}
@@ -410,7 +411,8 @@ public class OTFSubSetFile extends OTFFile {
foundLocalUniques.add(new ArrayList<Integer>());
}
Map<Integer, Integer> gidHintMaskLengths = new HashMap<Integer, Integer>();
- for (int gid : subsetGlyphs.keySet()) {
+ for (Entry<Integer, Integer> subsetGlyph : subsetGlyphs.entrySet()) {
+ int gid = subsetGlyph.getKey();
int group = subsetGroups.get(gid);
localIndexSubr = cffReader.getFDFonts().get(group).getLocalSubrData();
localUniques = foundLocalUniques.get(uniqueGroups.indexOf(subsetGroups.get(gid)));
@@ -418,7 +420,7 @@ public class OTFSubSetFile extends OTFFile {
FDIndexReference newFDReference = new FDIndexReference(
uniqueGroups.indexOf(subsetGroups.get(gid)), subsetGroups.get(gid));
- subsetFDSelect.put(subsetGlyphs.get(gid), newFDReference);
+ subsetFDSelect.put(subsetGlyph.getValue(), newFDReference);
byte[] data = charStringsIndex.getValue(gid);
preScanForSubsetIndexSize(data);
gidHintMaskLengths.put(gid, type2Parser.getMaskLength());
@@ -439,13 +441,15 @@ public class OTFSubSetFile extends OTFFile {
for (Integer uniqueGroup : uniqueGroups) {
foundLocalUniquesB.add(new ArrayList<Integer>());
}
- for (Integer gid : subsetGlyphs.keySet()) {
+ for (Entry<Integer, Integer> subsetGlyph : subsetGlyphs.entrySet()) {
+ int gid = subsetGlyph.getKey();
+ int value = subsetGlyph.getValue();
int group = subsetGroups.get(gid);
localIndexSubr = cffReader.getFDFonts().get(group).getLocalSubrData();
- localUniques = foundLocalUniquesB.get(subsetFDSelect.get(subsetGlyphs.get(gid)).getNewFDIndex());
+ localUniques = foundLocalUniquesB.get(subsetFDSelect.get(value).getNewFDIndex());
byte[] data = charStringsIndex.getValue(gid);
- subsetLocalIndexSubr = fdSubrs.get(subsetFDSelect.get(subsetGlyphs.get(gid)).getNewFDIndex());
- subsetLocalSubrCount = foundLocalUniques.get(subsetFDSelect.get(subsetGlyphs.get(gid))
+ subsetLocalIndexSubr = fdSubrs.get(subsetFDSelect.get(value).getNewFDIndex());
+ subsetLocalSubrCount = foundLocalUniques.get(subsetFDSelect.get(value)
.getNewFDIndex()).size();
type2Parser = new Type2Parser();
type2Parser.setMaskLength(gidHintMaskLengths.get(gid));
@@ -457,15 +461,15 @@ public class OTFSubSetFile extends OTFFile {
protected void writeFDSelect() {
writeByte(0); //Format
- for (Integer gid : subsetFDSelect.keySet()) {
- writeByte(subsetFDSelect.get(gid).getNewFDIndex());
+ for (FDIndexReference e : subsetFDSelect.values()) {
+ writeByte(e.getNewFDIndex());
}
}
protected List<Integer> getUsedFDFonts() {
List<Integer> uniqueNewRefs = new ArrayList<Integer>();
- for (int gid : subsetFDSelect.keySet()) {
- int fdIndex = subsetFDSelect.get(gid).getOldFDIndex();
+ for (FDIndexReference e : subsetFDSelect.values()) {
+ int fdIndex = e.getOldFDIndex();
if (!uniqueNewRefs.contains(fdIndex)) {
uniqueNewRefs.add(fdIndex);
}
@@ -1023,11 +1027,11 @@ public class OTFSubSetFile extends OTFFile {
private void writeCharsetTable(boolean cidFont) throws IOException {
writeByte(0);
- for (int gid : gidToSID.keySet()) {
- if (cidFont && gid == 0) {
+ for (Entry<Integer, Integer> entry : gidToSID.entrySet()) {
+ if (cidFont && entry.getKey() == 0) {
continue;
}
- writeCard16((cidFont) ? gid : gidToSID.get(gid));
+ writeCard16((cidFont) ? entry.getKey() : entry.getValue());
}
}
diff --git a/fop-core/src/main/java/org/apache/fop/fonts/type1/Type1FontLoader.java b/fop-core/src/main/java/org/apache/fop/fonts/type1/Type1FontLoader.java
index d364462cc..f11585cfb 100644
--- a/fop-core/src/main/java/org/apache/fop/fonts/type1/Type1FontLoader.java
+++ b/fop-core/src/main/java/org/apache/fop/fonts/type1/Type1FontLoader.java
@@ -23,6 +23,7 @@ import java.awt.geom.RectangularShape;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -215,9 +216,7 @@ public class Type1FontLoader extends FontLoader {
private Set<String> toGlyphSet(String[] glyphNames) {
Set<String> glyphSet = new java.util.HashSet<String>();
- for (String name : glyphNames) {
- glyphSet.add(name);
- }
+ Collections.addAll(glyphSet, glyphNames);
return glyphSet;
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/WhitespaceManagementPenalty.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/WhitespaceManagementPenalty.java
index e34d24b9a..f8725e7ce 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/WhitespaceManagementPenalty.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/WhitespaceManagementPenalty.java
@@ -84,7 +84,7 @@ public class WhitespaceManagementPenalty extends KnuthPenalty {
String str = super.toString();
StringBuffer buffer = new StringBuffer(64);
buffer.append(" number of variants = " + variantList.size());
- return str + buffer.toString();
+ return str + buffer;
}
}
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 40c7703ae..8ee5d1e70 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
@@ -1326,7 +1326,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
}
}
if (log.isTraceEnabled()) {
- log.trace(" Word to hyphenate: " + sbChars.toString());
+ log.trace(" Word to hyphenate: " + sbChars);
}
// find hyphenation points
HyphContext hc = getHyphenContext(sbChars);
diff --git a/fop-core/src/main/java/org/apache/fop/pdf/PDFArray.java b/fop-core/src/main/java/org/apache/fop/pdf/PDFArray.java
index bfcc1c7e0..f0cb5197c 100644
--- a/fop-core/src/main/java/org/apache/fop/pdf/PDFArray.java
+++ b/fop-core/src/main/java/org/apache/fop/pdf/PDFArray.java
@@ -22,6 +22,7 @@ package org.apache.fop.pdf;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -119,9 +120,7 @@ public class PDFArray extends PDFObject {
/* generic creation of PDF object */
super(parent);
- for (Object value : values) {
- this.values.add(value);
- }
+ Collections.addAll(this.values, values);
}
/**
diff --git a/fop-core/src/main/java/org/apache/fop/pdf/PDFFilterList.java b/fop-core/src/main/java/org/apache/fop/pdf/PDFFilterList.java
index fbb7d57a6..d3f0f0ee3 100644
--- a/fop-core/src/main/java/org/apache/fop/pdf/PDFFilterList.java
+++ b/fop-core/src/main/java/org/apache/fop/pdf/PDFFilterList.java
@@ -278,9 +278,9 @@ public class PDFFilterList {
}
if (filterCount > 0) {
if (filterCount > 1) {
- return "/Filter [ " + sb.toString() + "]";
+ return "/Filter [ " + sb + "]";
} else {
- return "/Filter " + sb.toString();
+ return "/Filter " + sb;
}
} else {
return "";
diff --git a/fop-core/src/main/java/org/apache/fop/pdf/PDFResources.java b/fop-core/src/main/java/org/apache/fop/pdf/PDFResources.java
index 9ba9c7f8f..96d45a13a 100644
--- a/fop-core/src/main/java/org/apache/fop/pdf/PDFResources.java
+++ b/fop-core/src/main/java/org/apache/fop/pdf/PDFResources.java
@@ -308,8 +308,8 @@ public class PDFResources extends PDFDictionary {
if (!properties.isEmpty()) {
PDFDictionary dict = new PDFDictionary(this);
- for (String name : properties.keySet()) {
- dict.put(name, properties.get(name));
+ for (Map.Entry<String, PDFReference> stringPDFReferenceEntry : properties.entrySet()) {
+ dict.put(stringPDFReferenceEntry.getKey(), stringPDFReferenceEntry.getValue());
}
put("Properties", dict);
}
diff --git a/fop-core/src/main/java/org/apache/fop/render/ImageHandlerRegistry.java b/fop-core/src/main/java/org/apache/fop/render/ImageHandlerRegistry.java
index 2ef22739f..0a4b5e158 100644
--- a/fop-core/src/main/java/org/apache/fop/render/ImageHandlerRegistry.java
+++ b/fop-core/src/main/java/org/apache/fop/render/ImageHandlerRegistry.java
@@ -19,6 +19,7 @@
package org.apache.fop.render;
+import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
@@ -142,9 +143,7 @@ public class ImageHandlerRegistry {
for (ImageHandler handler : this.handlerList) {
if (handler.isCompatible(context, null)) {
ImageFlavor[] f = handler.getSupportedImageFlavors();
- for (ImageFlavor aF : f) {
- flavors.add(aF);
- }
+ Collections.addAll(flavors, f);
}
}
return flavors.toArray(new ImageFlavor[flavors.size()]);
diff --git a/fop-core/src/main/java/org/apache/fop/render/intermediate/IFUtil.java b/fop-core/src/main/java/org/apache/fop/render/intermediate/IFUtil.java
index b877abad5..a1e85afb1 100644
--- a/fop-core/src/main/java/org/apache/fop/render/intermediate/IFUtil.java
+++ b/fop-core/src/main/java/org/apache/fop/render/intermediate/IFUtil.java
@@ -375,9 +375,7 @@ public final class IFUtil {
int[] paSrc = dp [ i + offset ];
if (paSrc != null) {
int[] paDst = new int [ 4 ];
- for (int k = 0; k < 4; k++) {
- paDst [ k ] = paSrc [ k ];
- }
+ System.arraycopy(paSrc, 0, paDst, 0, 4);
dpNew [ i ] = paDst;
}
}
diff --git a/fop-core/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFFontReader.java b/fop-core/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFFontReader.java
index 6839bf948..142262ade 100644
--- a/fop-core/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFFontReader.java
+++ b/fop-core/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFFontReader.java
@@ -605,8 +605,8 @@ public class PCLTTFFontReader extends PCLFontReader {
private ByteArrayOutputStream updateOffsets(ByteArrayOutputStream baos, Map<Integer, byte[]> offsets)
throws IOException {
byte[] softFont = baos.toByteArray();
- for (int offset : offsets.keySet()) {
- PCLByteWriterUtil.updateDataAtLocation(softFont, offsets.get(offset), offset);
+ for (Entry<Integer, byte[]> integerEntry : offsets.entrySet()) {
+ PCLByteWriterUtil.updateDataAtLocation(softFont, integerEntry.getValue(), integerEntry.getKey());
}
baos = new ByteArrayOutputStream();
baos.write(softFont);
diff --git a/fop-core/src/main/java/org/apache/fop/util/ColorUtil.java b/fop-core/src/main/java/org/apache/fop/util/ColorUtil.java
index cf534c49f..1117b6e38 100644
--- a/fop-core/src/main/java/org/apache/fop/util/ColorUtil.java
+++ b/fop-core/src/main/java/org/apache/fop/util/ColorUtil.java
@@ -798,7 +798,7 @@ public final class ColorUtil {
}
}
sb.append(")");
- return functionName + sb.toString();
+ return functionName + sb;
}
private static String toCIELabFunctionCall(ColorWithAlternatives color) {
diff --git a/fop-core/src/test/java/org/apache/fop/apps/AFPRendererConfBuilder.java b/fop-core/src/test/java/org/apache/fop/apps/AFPRendererConfBuilder.java
index f108e4d44..580bb23d0 100644
--- a/fop-core/src/test/java/org/apache/fop/apps/AFPRendererConfBuilder.java
+++ b/fop-core/src/test/java/org/apache/fop/apps/AFPRendererConfBuilder.java
@@ -94,8 +94,8 @@ public final class AFPRendererConfBuilder extends RendererConfBuilder {
public AFPRendererConfBuilder setDefaultResourceLevels(Map<String, String> levels) {
Element e = createElement(DEFAULT_RESOURCE_LEVELS.getName());
- for (String key : levels.keySet()) {
- e.setAttribute(key, levels.get(key));
+ for (Map.Entry<String, String> stringStringEntry : levels.entrySet()) {
+ e.setAttribute(stringStringEntry.getKey(), stringStringEntry.getValue());
}
return this;
}
diff --git a/fop-core/src/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java b/fop-core/src/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java
index 411556138..c94b0bcb0 100644
--- a/fop-core/src/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java
+++ b/fop-core/src/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java
@@ -2804,11 +2804,11 @@ public class TTXFile {
}
}
GlyphCoverageTable[] gca = new GlyphCoverageTable [ mi + 1 ];
- for (String k : keys) {
- if (k.startsWith(prefix)) {
- int i = Integer.parseInt(k.substring(prefixLength));
+ for (Map.Entry<String, GlyphCoverageTable> stringGlyphCoverageTableEntry : coverages.entrySet()) {
+ if (stringGlyphCoverageTableEntry.getKey().startsWith(prefix)) {
+ int i = Integer.parseInt(stringGlyphCoverageTableEntry.getKey().substring(prefixLength));
if (i >= 0) {
- gca [ i ] = coverages.get(k);
+ gca [ i ] = stringGlyphCoverageTableEntry.getValue();
}
}
}
@@ -2915,11 +2915,11 @@ public class TTXFile {
}
private Map<GlyphTable.LookupSpec, List<String>> extractLookups() {
Map<GlyphTable.LookupSpec, List<String>> lookups = new LinkedHashMap<GlyphTable.LookupSpec, List<String>>();
- for (String st : scripts.keySet()) {
- Map<String, List<String>> lm = scripts.get(st);
+ for (Map.Entry<String, Map<String, List<String>>> stringMapEntry : scripts.entrySet()) {
+ Map<String, List<String>> lm = stringMapEntry.getValue();
if (lm != null) {
- for (String lt : lm.keySet()) {
- List<String> fids = lm.get(lt);
+ for (Map.Entry<String, List<String>> stringListEntry : lm.entrySet()) {
+ List<String> fids = stringListEntry.getValue();
if (fids != null) {
for (String fid : fids) {
if (fid != null) {
@@ -2929,7 +2929,7 @@ public class TTXFile {
String ft = (String) fa[0];
List<String> lids = (List<String>) fa[1];
if ((lids != null) && (lids.size() > 0)) {
- GlyphTable.LookupSpec ls = new GlyphTable.LookupSpec(st, lt, ft);
+ GlyphTable.LookupSpec ls = new GlyphTable.LookupSpec(stringMapEntry.getKey(), stringListEntry.getKey(), ft);
lookups.put(ls, lids);
}
}
diff --git a/fop-core/src/test/java/org/apache/fop/fonts/CIDFullTestCase.java b/fop-core/src/test/java/org/apache/fop/fonts/CIDFullTestCase.java
index 73ded6875..e73c29569 100644
--- a/fop-core/src/test/java/org/apache/fop/fonts/CIDFullTestCase.java
+++ b/fop-core/src/test/java/org/apache/fop/fonts/CIDFullTestCase.java
@@ -91,8 +91,8 @@ public class CIDFullTestCase {
@Test
public void testGetGlyphs() {
Map<Integer, Integer> fontGlyphs = cidFull.getGlyphs();
- for (Integer key : fontGlyphs.keySet()) {
- assertEquals(fontGlyphs.get(key), glyphs.get(key));
+ for (Map.Entry<Integer, Integer> integerIntegerEntry : fontGlyphs.entrySet()) {
+ assertEquals(integerIntegerEntry.getValue(), glyphs.get(integerIntegerEntry.getKey()));
}
assertTrue(fontGlyphs.size() == glyphs.size());
}
diff --git a/fop-core/src/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java b/fop-core/src/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java
index 1c609e30f..1f9275879 100644
--- a/fop-core/src/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java
+++ b/fop-core/src/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java
@@ -64,7 +64,7 @@ public class CrossReferenceTableTestCase extends CrossReferenceObjectTest {
.append("\n0000000000 65535 f \n");
for (Long objectReference : offsets) {
final String padding = "0000000000";
- String s = String.valueOf(objectReference).toString();
+ String s = String.valueOf(objectReference);
String loc = padding.substring(s.length()) + s;
expected.append(loc).append(" 00000 n \n");
}