You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ss...@apache.org on 2017/08/04 14:13:54 UTC
svn commit: r1804124 - in
/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics: fonts/
image/codec/png/ image/codec/tiff/ image/codec/util/ image/loader/
image/loader/cache/ image/loader/impl/ image/loader/impl/imageio/
image/loader/pipeline...
Author: ssteiner
Date: Fri Aug 4 14:13:54 2017
New Revision: 1804124
URL: http://svn.apache.org/viewvc?rev=1804124&view=rev
Log:
Use foreach loops
Modified:
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/fonts/Glyphs.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/util/SimpleRenderedImage.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/ImageManager.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/cache/ImageCache.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/CompositeImageLoader.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageIOUtil.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageLoaderImageIO.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/pipeline/ImageProviderPipeline.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/pipeline/PipelineFactory.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/writer/ImageWriterRegistry.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/java2d/color/ColorWithAlternatives.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/java2d/color/profile/NamedColorProfile.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSDictionary.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSGenerator.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSProcSets.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSState.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/DSCParser.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/EventRecorder.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/ResourceTracker.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/events/AbstractResourcesDSCComment.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/ClasspathResource.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/io/ASCII85OutputStream.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/io/RunLengthEncodeOutputStream.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/Metadata.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/XMPStructure.java
xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/schemas/DublinCoreAdapter.java
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/fonts/Glyphs.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/fonts/Glyphs.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/fonts/Glyphs.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/fonts/Glyphs.java Fri Aug 4 14:13:54 2017
@@ -680,8 +680,8 @@ public final class Glyphs {
String[] arr = new String[lines.size() * 2];
int pos = 0;
StringBuffer buf = new StringBuffer();
- for (int i = 0, c = lines.size(); i < c; i++) {
- String line = (String)lines.get(i);
+ for (Object line1 : lines) {
+ String line = (String) line1;
int semicolon = line.indexOf(';');
if (semicolon <= 0) {
continue;
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java Fri Aug 4 14:13:54 2017
@@ -601,9 +601,8 @@ public class PNGImageEncoder extends Ima
ChunkStream cs = new ChunkStream("sBIT");
try {
int[] significantBits = param.getSignificantBits();
- int len = significantBits.length;
- for (int i = 0; i < len; i++) {
- cs.writeByte(significantBits[i]);
+ for (int significantBit : significantBits) {
+ cs.writeByte(significantBit);
}
cs.writeToStream(dataOutput);
} finally {
@@ -682,8 +681,8 @@ public class PNGImageEncoder extends Ima
ChunkStream cs = new ChunkStream("hIST");
try {
int[] hist = param.getPaletteHistogram();
- for (int i = 0; i < hist.length; i++) {
- cs.writeShort(hist[i]);
+ for (int aHist : hist) {
+ cs.writeShort(aHist);
}
cs.writeToStream(dataOutput);
@@ -702,8 +701,8 @@ public class PNGImageEncoder extends Ima
if (param instanceof PNGEncodeParam.Palette) {
byte[] t =
((PNGEncodeParam.Palette)param).getPaletteTransparency();
- for (int i = 0; i < t.length; i++) {
- cs.writeByte(t[i]);
+ for (byte aT : t) {
+ cs.writeByte(aT);
}
} else if (param instanceof PNGEncodeParam.Gray) {
int t = ((PNGEncodeParam.Gray)param).getTransparentGray();
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java Fri Aug 4 14:13:54 2017
@@ -382,15 +382,11 @@ public class TIFFImageEncoder extends Im
// Add extra fields specified via the encoding parameters.
TIFFField[] extraFields = encodeParam.getExtraFields();
List extantTags = new ArrayList(fields.size());
- Iterator fieldIter = fields.iterator();
- while (fieldIter.hasNext()) {
- TIFFField fld = (TIFFField)fieldIter.next();
+ for (TIFFField fld : fields) {
extantTags.add(fld.getTag());
}
- int numExtraFields = extraFields.length;
- for (int i = 0; i < numExtraFields; i++) {
- TIFFField fld = extraFields[i];
+ for (TIFFField fld : extraFields) {
Integer tagValue = fld.getTag();
if (!extantTags.contains(tagValue)) {
fields.add(fld);
@@ -1003,10 +999,9 @@ public class TIFFImageEncoder extends Im
int dirSize = 2 + numEntries * 12 + 4;
// Loop over fields adding the size of all values > 4 bytes.
- Iterator iter = fields.iterator();
- while (iter.hasNext()) {
+ for (Object field1 : fields) {
// Get the field.
- TIFFField field = (TIFFField)iter.next();
+ TIFFField field = (TIFFField) field1;
// Determine the size of the field value.
int valueSize = field.getCount() * SIZE_OF_TYPE[field.getType()];
@@ -1048,11 +1043,10 @@ public class TIFFImageEncoder extends Im
// Write number of fields in the IFD
writeUnsignedShort(numEntries);
- Iterator iter = fields.iterator();
- while (iter.hasNext()) {
+ for (Object field1 : fields) {
// 12 byte field entry TIFFField
- TIFFField field = (TIFFField)iter.next();
+ TIFFField field = (TIFFField) field1;
// byte 0-1 Tag that identifies a field
int tag = field.getTag();
@@ -1086,8 +1080,8 @@ public class TIFFImageEncoder extends Im
writeLong(nextIFDOffset);
// Write the tag values that did not fit into 4 bytes
- for (int i = 0; i < tooBig.size(); i++) {
- writeValues((TIFFField)tooBig.get(i));
+ for (Object aTooBig : tooBig) {
+ writeValues((TIFFField) aTooBig);
}
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java Fri Aug 4 14:13:54 2017
@@ -170,8 +170,8 @@ public class TIFFLZWDecoder {
*/
public void writeString(byte[] string) {
- for (int i = 0; i < string.length; i++) {
- uncompData[dstIndex++] = string[i];
+ for (byte aString : string) {
+ uncompData[dstIndex++] = aString;
}
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/util/SimpleRenderedImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/util/SimpleRenderedImage.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/util/SimpleRenderedImage.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/codec/util/SimpleRenderedImage.java Fri Aug 4 14:13:54 2017
@@ -273,9 +273,9 @@ public abstract class SimpleRenderedImag
prefix = prefix.toLowerCase(Locale.getDefault());
List names = new ArrayList();
- for (int i = 0; i < propertyNames.length; i++) {
- if (propertyNames[i].startsWith(prefix)) {
- names.add(propertyNames[i]);
+ for (String propertyName : propertyNames) {
+ if (propertyName.startsWith(prefix)) {
+ names.add(propertyName);
}
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/ImageManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/ImageManager.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/ImageManager.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/ImageManager.java Fri Aug 4 14:13:54 2017
@@ -348,9 +348,8 @@ public class ImageManager {
ImageInfo info = image.getInfo();
Image img = null;
- int count = flavors.length;
- for (int i = 0; i < count; i++) {
- if (image.getFlavor().equals(flavors[i])) {
+ for (ImageFlavor flavor : flavors) {
+ if (image.getFlavor().equals(flavor)) {
//Shortcut (the image is already in one of the requested formats)
return image;
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/cache/ImageCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/cache/ImageCache.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/cache/ImageCache.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/cache/ImageCache.java Fri Aug 4 14:13:54 2017
@@ -23,7 +23,6 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -293,9 +292,8 @@ public class ImageCache {
private void doInvalidURIHouseKeeping() {
final Set currentEntries = new HashSet(this.invalidURIs.keySet());
- final Iterator iter = currentEntries.iterator();
- while (iter.hasNext()) {
- final String key = (String) iter.next();
+ for (Object currentEntry : currentEntries) {
+ final String key = (String) currentEntry;
removeInvalidURIIfExpired(key);
}
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/CompositeImageLoader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/CompositeImageLoader.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/CompositeImageLoader.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/CompositeImageLoader.java Fri Aug 4 14:13:54 2017
@@ -78,8 +78,7 @@ public class CompositeImageLoader extend
public Image loadImage(ImageInfo info, Map hints, ImageSessionContext session)
throws ImageException, IOException {
ImageException firstException = null;
- for (int i = 0, c = this.loaders.length; i < c; i++) {
- ImageLoader loader = this.loaders[i];
+ for (ImageLoader loader : this.loaders) {
try {
Image img = loader.loadImage(info, hints, session);
if (img != null && firstException != null) {
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageIOUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageIOUtil.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageIOUtil.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageIOUtil.java Fri Aug 4 14:13:54 2017
@@ -104,9 +104,9 @@ public final class ImageIOUtil {
*/
public static void dumpMetadataToSystemOut(IIOMetadata iiometa) {
String[] metanames = iiometa.getMetadataFormatNames();
- for (int j = 0; j < metanames.length; j++) {
- System.out.println("--->" + metanames[j]);
- dumpNodeToSystemOut(iiometa.getAsTree(metanames[j]));
+ for (String metaname : metanames) {
+ System.out.println("--->" + metaname);
+ dumpNodeToSystemOut(iiometa.getAsTree(metaname));
}
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageLoaderImageIO.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageLoaderImageIO.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageLoaderImageIO.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageLoaderImageIO.java Fri Aug 4 14:13:54 2017
@@ -300,8 +300,7 @@ public class ImageLoaderImageIO extends
private ICC_Profile tryToExctractICCProfile(IIOMetadata iiometa) {
ICC_Profile iccProf = null;
String[] supportedFormats = iiometa.getMetadataFormatNames();
- for (int i = 0; i < supportedFormats.length; i++) {
- String format = supportedFormats[i];
+ for (String format : supportedFormats) {
Element root = (Element) iiometa.getAsTree(format);
if (PNG_METADATA_NODE.equals(format)) {
iccProf = this
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/pipeline/ImageProviderPipeline.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/pipeline/ImageProviderPipeline.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/pipeline/ImageProviderPipeline.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/pipeline/ImageProviderPipeline.java Fri Aug 4 14:13:54 2017
@@ -23,7 +23,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -292,9 +291,8 @@ public class ImageProviderPipeline {
registry.getAdditionalPenalty(loader.getClass().getName()));
}
}
- Iterator iter = converters.iterator();
- while (iter.hasNext()) {
- ImageConverter converter = (ImageConverter)iter.next();
+ for (Object converter1 : converters) {
+ ImageConverter converter = (ImageConverter) converter1;
penalty = penalty.add(converter.getConversionPenalty());
if (registry != null) {
penalty = penalty.add(
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/pipeline/PipelineFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/pipeline/PipelineFactory.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/pipeline/PipelineFactory.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/pipeline/PipelineFactory.java Fri Aug 4 14:13:54 2017
@@ -23,7 +23,6 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -74,9 +73,8 @@ public class PipelineFactory {
//Rebuild edge directory
DefaultEdgeDirectory dir = new DefaultEdgeDirectory();
- Iterator iter = converters.iterator();
- while (iter.hasNext()) {
- ImageConverter converter = (ImageConverter)iter.next();
+ for (Object converter1 : converters) {
+ ImageConverter converter = (ImageConverter) converter1;
Penalty penalty = Penalty.toPenalty(converter.getConversionPenalty());
penalty = penalty.add(
registry.getAdditionalPenalty(converter.getClass().getName()));
@@ -177,13 +175,12 @@ public class PipelineFactory {
if (loaderFactories != null) {
//Find best pipeline -> best loader
- for (int i = 0, ci = loaderFactories.length; i < ci; i++) {
- ImageLoaderFactory loaderFactory = loaderFactories[i];
+ for (ImageLoaderFactory loaderFactory : loaderFactories) {
ImageFlavor[] flavors = loaderFactory.getSupportedFlavors(originalMime);
- for (int j = 0, cj = flavors.length; j < cj; j++) {
- ImageProviderPipeline pipeline = findPipeline(dir, flavors[j], destination);
+ for (ImageFlavor flavor : flavors) {
+ ImageProviderPipeline pipeline = findPipeline(dir, flavor, destination);
if (pipeline != null) {
- ImageLoader loader = loaderFactory.newImageLoader(flavors[j]);
+ ImageLoader loader = loaderFactory.newImageLoader(flavor);
pipeline.setImageLoader(loader);
candidates.add(pipeline);
}
@@ -235,9 +232,8 @@ public class PipelineFactory {
prev = pred;
}
ImageProviderPipeline pipeline = new ImageProviderPipeline(manager.getCache(), null);
- Iterator iter = stops.iterator();
- while (iter.hasNext()) {
- ImageConversionEdge edge = (ImageConversionEdge)iter.next();
+ for (Object stop : stops) {
+ ImageConversionEdge edge = (ImageConversionEdge) stop;
pipeline.addConverter(edge.getImageConverter());
}
return pipeline;
@@ -254,10 +250,9 @@ public class PipelineFactory {
public ImageProviderPipeline[] determineCandidatePipelines(ImageInfo imageInfo,
ImageFlavor[] flavors) {
List candidates = new java.util.ArrayList();
- int count = flavors.length;
- for (int i = 0; i < count; i++) {
+ for (ImageFlavor flavor : flavors) {
//Find the best pipeline for each flavor
- ImageProviderPipeline pipeline = newImageConverterPipeline(imageInfo, flavors[i]);
+ ImageProviderPipeline pipeline = newImageConverterPipeline(imageInfo, flavor);
if (pipeline == null) {
continue; //No suitable pipeline found for flavor
}
@@ -280,10 +275,9 @@ public class PipelineFactory {
public ImageProviderPipeline[] determineCandidatePipelines(Image sourceImage,
ImageFlavor[] flavors) {
List candidates = new java.util.ArrayList();
- int count = flavors.length;
- for (int i = 0; i < count; i++) {
+ for (ImageFlavor flavor : flavors) {
//Find the best pipeline for each flavor
- ImageProviderPipeline pipeline = newImageConverterPipeline(sourceImage, flavors[i]);
+ ImageProviderPipeline pipeline = newImageConverterPipeline(sourceImage, flavor);
if (pipeline != null) {
candidates.add(pipeline);
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java Fri Aug 4 14:13:54 2017
@@ -19,9 +19,11 @@
package org.apache.xmlgraphics.image.loader.spi;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -187,23 +189,19 @@ public class ImageImplRegistry {
return;
}
String[] mimes = loaderFactory.getSupportedMIMETypes();
- for (int i = 0, ci = mimes.length; i < ci; i++) {
- String mime = mimes[i];
-
+ for (String mime : mimes) {
synchronized (loaders) {
- Map flavorMap = (Map)loaders.get(mime);
+ Map flavorMap = (Map) loaders.get(mime);
if (flavorMap == null) {
- flavorMap = new java.util.HashMap();
+ flavorMap = new HashMap();
loaders.put(mime, flavorMap);
}
ImageFlavor[] flavors = loaderFactory.getSupportedFlavors(mime);
- for (int j = 0, cj = flavors.length; j < cj; j++) {
- ImageFlavor flavor = flavors[j];
-
- List factoryList = (List)flavorMap.get(flavor);
+ for (ImageFlavor flavor : flavors) {
+ List factoryList = (List) flavorMap.get(flavor);
if (factoryList == null) {
- factoryList = new java.util.ArrayList();
+ factoryList = new ArrayList();
flavorMap.put(flavor, factoryList);
}
factoryList.add(loaderFactory);
@@ -332,9 +330,8 @@ public class ImageImplRegistry {
if (checkFlavor.isCompatible(flavor)) {
List factoryList = (List)e.getValue();
if (factoryList != null && factoryList.size() > 0) {
- Iterator factoryIter = factoryList.iterator();
- while (factoryIter.hasNext()) {
- ImageLoaderFactory factory = (ImageLoaderFactory)factoryIter.next();
+ for (Object aFactoryList : factoryList) {
+ ImageLoaderFactory factory = (ImageLoaderFactory) aFactoryList;
if (factory.isSupported(imageInfo)) {
matches.add(factory);
}
@@ -387,9 +384,8 @@ public class ImageImplRegistry {
Map flavorMap = (Map)loaders.get(mime);
if (flavorMap != null) {
Set factories = new java.util.HashSet();
- Iterator iter = flavorMap.values().iterator();
- while (iter.hasNext()) {
- List factoryList = (List)iter.next();
+ for (Object o : flavorMap.values()) {
+ List factoryList = (List) o;
factories.addAll(factoryList);
}
int factoryCount = factories.size();
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java Fri Aug 4 14:13:54 2017
@@ -32,7 +32,6 @@ import java.awt.image.RenderedImage;
import java.awt.image.SampleModel;
import java.awt.image.WritableRaster;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -460,9 +459,8 @@ public abstract class AbstractRed implem
if (ret != null) {
return ret;
}
- Iterator i = srcs.iterator();
- while (i.hasNext()) {
- RenderedImage ri = (RenderedImage)i.next();
+ for (Object src : srcs) {
+ RenderedImage ri = (RenderedImage) src;
ret = ri.getProperty(name);
if (ret != null) {
return ret;
@@ -476,9 +474,8 @@ public abstract class AbstractRed implem
String[] ret = new String[keys.size()];
keys.toArray(ret);
- Iterator iter = srcs.iterator();
- while (iter.hasNext()) {
- RenderedImage ri = (RenderedImage)iter.next();
+ for (Object src : srcs) {
+ RenderedImage ri = (RenderedImage) src;
String[] srcProps = ri.getPropertyNames();
if (srcProps.length != 0) {
String[] tmp = new String[ret.length + srcProps.length];
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/writer/ImageWriterRegistry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/writer/ImageWriterRegistry.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/writer/ImageWriterRegistry.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/writer/ImageWriterRegistry.java Fri Aug 4 14:13:54 2017
@@ -166,9 +166,7 @@ public final class ImageWriterRegistry {
if (entries == null) {
return null;
}
- Iterator<ImageWriter> iter = entries.iterator();
- while (iter.hasNext()) {
- ImageWriter writer = iter.next();
+ for (ImageWriter writer : entries) {
if (writer.isFunctional()) {
return writer;
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/java2d/color/ColorWithAlternatives.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/java2d/color/ColorWithAlternatives.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/java2d/color/ColorWithAlternatives.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/java2d/color/ColorWithAlternatives.java Fri Aug 4 14:13:54 2017
@@ -201,9 +201,9 @@ public class ColorWithAlternatives exten
*/
public Color getFirstAlternativeOfType(int colorSpaceType) {
if (hasAlternativeColors()) {
- for (int i = 0, c = this.alternativeColors.length; i < c; i++) {
- if (this.alternativeColors[i].getColorSpace().getType() == colorSpaceType) {
- return this.alternativeColors[i];
+ for (Color alternativeColor : this.alternativeColors) {
+ if (alternativeColor.getColorSpace().getType() == colorSpaceType) {
+ return alternativeColor;
}
}
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/java2d/color/profile/NamedColorProfile.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/java2d/color/profile/NamedColorProfile.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/java2d/color/profile/NamedColorProfile.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/java2d/color/profile/NamedColorProfile.java Fri Aug 4 14:13:54 2017
@@ -73,9 +73,9 @@ public class NamedColorProfile {
*/
public NamedColorSpace getNamedColor(String name) {
if (this.namedColors != null) {
- for (int i = 0, c = this.namedColors.length; i < c; i++) {
- if (this.namedColors[i].getColorName().equals(name)) {
- return this.namedColors[i];
+ for (NamedColorSpace namedColor : this.namedColors) {
+ if (namedColor.getColorName().equals(name)) {
+ return namedColor;
}
}
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSDictionary.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSDictionary.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSDictionary.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSDictionary.java Fri Aug 4 14:13:54 2017
@@ -19,7 +19,7 @@
package org.apache.xmlgraphics.ps;
-import java.util.Iterator;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
@@ -196,9 +196,9 @@ public class PSDictionary extends java.u
}
Token valueToken = nextToken(str, keyToken.endIndex + 1);
String[] braces = null;
- for (int i = 0; i < BRACES.length; i++) {
- if (valueToken.value.startsWith(BRACES[i][OPENING])) {
- braces = BRACES[i];
+ for (String[] brace : BRACES) {
+ if (valueToken.value.startsWith(brace[OPENING])) {
+ braces = brace;
break;
}
}
@@ -276,8 +276,7 @@ public class PSDictionary extends java.u
/** {@inheritDoc} */
public int hashCode() {
int hashCode = 7;
- for (Iterator it = values().iterator(); it.hasNext();) {
- Object value = it.next();
+ for (Object value : values()) {
hashCode += value.hashCode();
}
return hashCode;
@@ -289,15 +288,14 @@ public class PSDictionary extends java.u
return "";
}
StringBuffer sb = new StringBuffer("<<\n");
- for (Iterator it = super.keySet().iterator(); it.hasNext();) {
- String key = (String) it.next();
+ for (Object o : super.keySet()) {
+ String key = (String) o;
sb.append(" " + key + " ");
Object obj = super.get(key);
- if (obj instanceof java.util.ArrayList) {
- List array = (List)obj;
+ if (obj instanceof ArrayList) {
+ List array = (List) obj;
StringBuilder str = new StringBuilder("[");
- for (int i = 0; i < array.size(); i++) {
- Object element = array.get(i);
+ for (Object element : array) {
str.append(element + " ");
}
String str2 = str.toString().trim();
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSGenerator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSGenerator.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSGenerator.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSGenerator.java Fri Aug 4 14:13:54 2017
@@ -680,8 +680,7 @@ public class PSGenerator implements PSCo
ColorWithAlternatives colExt = (ColorWithAlternatives)color;
//Alternative colors have priority
Color[] alt = colExt.getAlternativeColors();
- for (int i = 0, c = alt.length; i < c; i++) {
- Color col = alt[i];
+ for (Color col : alt) {
established = establishColorFromColor(codeBuffer, col);
if (established) {
break;
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSProcSets.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSProcSets.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSProcSets.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSProcSets.java Fri Aug 4 14:13:54 2017
@@ -21,7 +21,6 @@ package org.apache.xmlgraphics.ps;
import java.io.IOException;
import java.util.Collections;
-import java.util.Iterator;
import java.util.Map;
/**
@@ -99,9 +98,8 @@ public final class PSProcSets {
gen.writeln("/bd{bind def}bind def");
gen.writeln("/ld{load def}bd");
- Iterator iter = STANDARD_MACROS.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next();
+ for (Object o : STANDARD_MACROS.entrySet()) {
+ Map.Entry entry = (Map.Entry) o;
gen.writeln("/" + entry.getValue() + "/" + entry.getKey() + " ld");
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSState.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSState.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSState.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/PSState.java Fri Aug 4 14:13:54 2017
@@ -221,8 +221,8 @@ public class PSState implements Serializ
* @exception IOException In case of an I/O problem
*/
public void reestablish(PSGenerator gen) throws IOException {
- for (int i = 0, len = transformConcatList.size(); i < len; i++) {
- gen.concatMatrix((AffineTransform)transformConcatList.get(i));
+ for (Object aTransformConcatList : transformConcatList) {
+ gen.concatMatrix((AffineTransform) aTransformConcatList);
}
gen.useLineCap(linecap);
gen.useLineWidth(linewidth);
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/DSCParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/DSCParser.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/DSCParser.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/DSCParser.java Fri Aug 4 14:13:54 2017
@@ -23,7 +23,6 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
-import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
@@ -250,9 +249,8 @@ public class DSCParser implements DSCPar
this.filterListener.processEvent(this.currentEvent, this);
}
if (this.listeners != null) {
- Iterator iter = this.listeners.iterator();
- while (iter.hasNext()) {
- ((DSCListener)iter.next()).processEvent(this.currentEvent, this);
+ for (Object listener : this.listeners) {
+ ((DSCListener) listener).processEvent(this.currentEvent, this);
}
}
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/EventRecorder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/EventRecorder.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/EventRecorder.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/EventRecorder.java Fri Aug 4 14:13:54 2017
@@ -20,7 +20,6 @@
package org.apache.xmlgraphics.ps.dsc;
import java.io.IOException;
-import java.util.Iterator;
import java.util.List;
import org.apache.xmlgraphics.ps.dsc.events.DSCComment;
@@ -38,15 +37,13 @@ public class EventRecorder implements DS
* @throws IOException In case of an I/O error
*/
public void replay(DSCHandler handler) throws IOException {
- Iterator iter = events.iterator();
- while (iter.hasNext()) {
- Object obj = iter.next();
+ for (Object obj : events) {
if (obj instanceof PSLine) {
- handler.line(((PSLine)obj).getLine());
+ handler.line(((PSLine) obj).getLine());
} else if (obj instanceof PSComment) {
- handler.comment(((PSComment)obj).getComment());
+ handler.comment(((PSComment) obj).getComment());
} else if (obj instanceof DSCComment) {
- handler.handleDSCComment((DSCComment)obj);
+ handler.handleDSCComment((DSCComment) obj);
} else {
throw new IllegalStateException("Unsupported class type");
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/ResourceTracker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/ResourceTracker.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/ResourceTracker.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/ResourceTracker.java Fri Aug 4 14:13:54 2017
@@ -22,7 +22,6 @@ package org.apache.xmlgraphics.ps.dsc;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -145,9 +144,8 @@ public class ResourceTracker {
*/
public void notifyResourceUsageOnPage(Collection resources) {
preparePageResources();
- Iterator iter = resources.iterator();
- while (iter.hasNext()) {
- PSResource res = (PSResource)iter.next();
+ for (Object resource : resources) {
+ PSResource res = (PSResource) resource;
notifyResourceUsageOnPage(res);
}
}
@@ -198,9 +196,8 @@ public class ResourceTracker {
*/
public void writeDocumentResources(PSGenerator gen) throws IOException {
if (usedResources != null) {
- Iterator iter = usedResources.iterator();
- while (iter.hasNext()) {
- PSResource res = (PSResource)iter.next();
+ for (Object usedResource : usedResources) {
+ PSResource res = (PSResource) usedResource;
if (documentSuppliedResources == null
|| !documentSuppliedResources.contains(res)) {
registerNeededResource(res);
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/events/AbstractResourcesDSCComment.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/events/AbstractResourcesDSCComment.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/events/AbstractResourcesDSCComment.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/ps/dsc/events/AbstractResourcesDSCComment.java Fri Aug 4 14:13:54 2017
@@ -149,14 +149,13 @@ public abstract class AbstractResourcesD
StringBuffer sb = new StringBuffer();
sb.append("%%").append(getName()).append(": ");
boolean first = true;
- Iterator i = resources.iterator();
- while (i.hasNext()) {
+ for (Object resource : resources) {
if (!first) {
gen.writeln(sb.toString());
sb.setLength(0);
sb.append("%%+ ");
}
- PSResource res = (PSResource)i.next();
+ PSResource res = (PSResource) resource;
sb.append(res.getResourceSpecification());
first = false;
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/ClasspathResource.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/ClasspathResource.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/ClasspathResource.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/ClasspathResource.java Fri Aug 4 14:13:54 2017
@@ -25,7 +25,6 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -113,9 +112,8 @@ public final class ClasspathResource {
Enumeration e;
try {
- Iterator it = getClassLoadersForResources().iterator();
- while (it.hasNext()) {
- ClassLoader classLoader = (ClassLoader) it.next();
+ for (Object o1 : getClassLoadersForResources()) {
+ ClassLoader classLoader = (ClassLoader) o1;
e = classLoader.getResources(MANIFEST_PATH);
@@ -124,11 +122,8 @@ public final class ClasspathResource {
try {
final Manifest manifest = new Manifest(u.openStream());
final Map entries = manifest.getEntries();
- final Iterator entrysetiterator = entries.entrySet()
- .iterator();
- while (entrysetiterator.hasNext()) {
- final Map.Entry entry = (Map.Entry) entrysetiterator
- .next();
+ for (Object o : entries.entrySet()) {
+ final Map.Entry entry = (Map.Entry) o;
final String name = (String) entry.getKey();
final Attributes attributes = (Attributes) entry
.getValue();
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/io/ASCII85OutputStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/io/ASCII85OutputStream.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/io/ASCII85OutputStream.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/io/ASCII85OutputStream.java Fri Aug 4 14:13:54 2017
@@ -153,10 +153,10 @@ public class ASCII85OutputStream extends
};
if (DEBUG) {
- for (int i = 0; i < ret.length; i++) {
- if (ret[i] < 33 || ret[i] > 117) {
+ for (byte aRet : ret) {
+ if (aRet < 33 || aRet > 117) {
System.out.println("Illegal char value "
- + Integer.valueOf(ret[i]));
+ + (int) aRet);
}
}
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/io/RunLengthEncodeOutputStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/io/RunLengthEncodeOutputStream.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/io/RunLengthEncodeOutputStream.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/io/RunLengthEncodeOutputStream.java Fri Aug 4 14:13:54 2017
@@ -140,8 +140,8 @@ public class RunLengthEncodeOutputStream
public void write(byte[] b)
throws IOException {
- for (int i = 0; i < b.length; i++) {
- this.write(b[i]);
+ for (byte aB : b) {
+ this.write(aB);
}
}
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java Fri Aug 4 14:13:54 2017
@@ -70,9 +70,8 @@ public class CommonURIResolver implement
/** {@inheritDoc} */
public Source resolve(String href, String base) {
synchronized (uriResolvers) {
- Iterator it = uriResolvers.iterator();
- while (it.hasNext()) {
- final URIResolver currentResolver = (URIResolver) it.next();
+ for (Object uriResolver : uriResolvers) {
+ final URIResolver currentResolver = (URIResolver) uriResolver;
try {
final Source result = currentResolver.resolve(href, base);
if (result != null) {
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/Metadata.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/Metadata.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/Metadata.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/Metadata.java Fri Aug 4 14:13:54 2017
@@ -84,9 +84,8 @@ public class Metadata implements XMLizab
*/
public void mergeInto(Metadata target, List<Class> exclude) {
XMPSchemaRegistry registry = XMPSchemaRegistry.getInstance();
- Iterator iter = properties.values().iterator();
- while (iter.hasNext()) {
- XMPProperty prop = (XMPProperty)iter.next();
+ for (Object o : properties.values()) {
+ XMPProperty prop = (XMPProperty) o;
XMPSchema schema = registry.getSchema(prop.getNamespace());
if (!exclude.contains(schema.getClass())) {
MergeRuleSet rules = schema.getDefaultMergeRuleSet();
@@ -120,9 +119,8 @@ public class Metadata implements XMLizab
boolean first = true;
boolean empty = true;
- Iterator props = properties.values().iterator();
- while (props.hasNext()) {
- XMPProperty prop = (XMPProperty)props.next();
+ for (Object o : properties.values()) {
+ XMPProperty prop = (XMPProperty) o;
if (prop.getName().getNamespaceURI().equals(ns)) {
if (first) {
if (prefix == null) {
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/XMPStructure.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/XMPStructure.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/XMPStructure.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/XMPStructure.java Fri Aug 4 14:13:54 2017
@@ -88,11 +88,10 @@ public class XMPStructure extends XMPCom
atts.clear();
handler.startElement(XMPConstants.RDF_NAMESPACE, "RDF", "rdf:Description", atts);
- Iterator props = properties.values().iterator();
- while (props.hasNext()) {
- XMPProperty prop = (XMPProperty)props.next();
+ for (Object o : properties.values()) {
+ XMPProperty prop = (XMPProperty) o;
//if (prop.getName().getNamespaceURI().equals(ns)) {
- prop.toSAX(handler);
+ prop.toSAX(handler);
//}
}
handler.endElement(XMPConstants.RDF_NAMESPACE, "RDF", "rdf:Description");
Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/schemas/DublinCoreAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/schemas/DublinCoreAdapter.java?rev=1804124&r1=1804123&r2=1804124&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/schemas/DublinCoreAdapter.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/xmp/schemas/DublinCoreAdapter.java Fri Aug 4 14:13:54 2017
@@ -150,9 +150,9 @@ public class DublinCoreAdapter extends X
Date[] dates = getDates();
if (dates != null) {
Date latest = null;
- for (int i = 0, c = dates.length; i < c; i++) {
- if (latest == null || dates[i].getTime() > latest.getTime()) {
- latest = dates[i];
+ for (Date date : dates) {
+ if (latest == null || date.getTime() > latest.getTime()) {
+ latest = date;
}
}
return latest;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org