commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1478479 - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/common/ main/java/org/apache/commons/imaging/common/bytesource/ main/java/org/apache/commons/imaging/common/itu_t4/ main/java/org/apache/commons/imaging/f...
Date Thu, 02 May 2013 18:43:49 GMT
Author: ggregory
Date: Thu May  2 18:43:48 2013
New Revision: 1478479

URL: http://svn.apache.org/r1478479
Log:
Add final modifier.

Modified:
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFileParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldType.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
    commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFileParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFileParser.java?rev=1478479&r1=1478478&r2=1478479&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFileParser.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFileParser.java
Thu May  2 18:43:48 2013
@@ -48,15 +48,15 @@ public class BinaryFileParser {
         return debug;
     }
     
-    public void setDebug(boolean debug) {
+    public void setDebug(final boolean debug) {
         this.debug = debug;
     }
 
-    protected final byte[] toBytes(short value) {
+    protected final byte[] toBytes(final short value) {
         return ByteConversions.toBytes(value, byteOrder);
     }
 
-    protected final byte[] toBytes(short value, ByteOrder byteOrder) {
+    protected final byte[] toBytes(final short value, final ByteOrder byteOrder) {
         return ByteConversions.toBytes(value, byteOrder);
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java?rev=1478479&r1=1478478&r2=1478479&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
Thu May  2 18:43:48 2013
@@ -64,7 +64,7 @@ public class BinaryOutputStream extends 
     }
     
     @Override
-    public final void write(final byte bytes[], int offset, int length) throws IOException
{
+    public final void write(final byte bytes[], final int offset, final int length) throws
IOException {
         os.write(bytes, offset, length);
         count += length;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java?rev=1478479&r1=1478478&r2=1478479&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java
Thu May  2 18:43:48 2013
@@ -45,7 +45,7 @@ public abstract class ByteSource extends
 
     public abstract InputStream getInputStream() throws IOException;
 
-    public byte[] getBlock(int start, int length) throws IOException {
+    public byte[] getBlock(final int start, final int length) throws IOException {
         return getBlock(0xFFFFffffL & start, length);
     }
     

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java?rev=1478479&r1=1478478&r2=1478479&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
Thu May  2 18:43:48 2013
@@ -588,7 +588,7 @@ public class T4AndT6Compression {
                 if (inputStream != null) {
                     inputStream.close();
                 }
-            } catch (IOException ignore) {
+            } catch (final IOException ignore) {
             }
         }
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java?rev=1478479&r1=1478478&r2=1478479&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
Thu May  2 18:43:48 2013
@@ -280,7 +280,7 @@ public class IptcParser extends BinaryFi
                 try {
                     imageResourceBlockSignature = bis.read4Bytes(
                             "Image Resource Block missing identification string");
-                } catch (IOException ioEx) {
+                } catch (final IOException ioEx) {
                     break;
                 }
                 if (imageResourceBlockSignature != CONST_8BIM) {
@@ -310,7 +310,7 @@ public class IptcParser extends BinaryFi
                     try {
                         blockNameBytes = bis.readBytes(blockNameLength,
                                 "Invalid Image Resource Block name");
-                    } catch (IOException ioEx) {
+                    } catch (final IOException ioEx) {
                         if (strict) {
                             throw ioEx;
                         }
@@ -342,7 +342,7 @@ public class IptcParser extends BinaryFi
                 final byte[] blockData;
                 try {
                     blockData = bis.readBytes(blockSize, "Invalid Image Resource Block data");
-                } catch (IOException ioEx) {
+                } catch (final IOException ioEx) {
                     if (strict) {
                         throw ioEx;
                     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java?rev=1478479&r1=1478478&r2=1478479&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
Thu May  2 18:43:48 2013
@@ -347,12 +347,12 @@ public class PngWriter implements PngCon
     private static class TransparentPalette extends Palette {
         private final Palette palette;
         
-        TransparentPalette(Palette palette) {
+        TransparentPalette(final Palette palette) {
             this.palette = palette;
         }
         
         @Override
-        public int getEntry(int index) {
+        public int getEntry(final int index) {
             if (index == 0) {
                 return 0x00000000;
             } else {
@@ -366,11 +366,11 @@ public class PngWriter implements PngCon
         }
         
         @Override
-        public int getPaletteIndex(int rgb) throws ImageWriteException {
+        public int getPaletteIndex(final int rgb) throws ImageWriteException {
             if (rgb == 0x00000000) {
                 return 0;
             } else {
-                int index = palette.getPaletteIndex(rgb);
+                final int index = palette.getPaletteIndex(rgb);
                 if (index >= 0) {
                     return 1 + index;
                 } else {
@@ -526,7 +526,7 @@ public class PngWriter implements PngCon
 
             final int max_colors = hasAlpha ? 255 : 256;
 
-            PaletteFactory paletteFactory = new PaletteFactory();
+            final PaletteFactory paletteFactory = new PaletteFactory();
             palette = paletteFactory.makeQuantizedRgbPalette(src, max_colors);
             // Palette palette2 = new PaletteFactory().makePaletteSimple(src,
             // max_colors);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java?rev=1478479&r1=1478478&r2=1478479&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
Thu May  2 18:43:48 2013
@@ -181,7 +181,7 @@ public class TiffReader extends BinaryFi
                 final FieldType fieldType;
                 try {
                     fieldType = FieldType.getFieldType(type);
-                } catch (ImageReadException imageReadEx) {
+                } catch (final ImageReadException imageReadEx) {
                     // skip over unknown fields types, since we
                     // can't calculate their size without
                     // knowing their type
@@ -254,7 +254,7 @@ public class TiffReader extends BinaryFi
                 };
                 for (int i = 0; i < offsetFields.length; i++) {
                     final TagInfoLong offsetField = offsetFields[i];
-                    TiffField field = directory.findField(offsetField);
+                    final TiffField field = directory.findField(offsetField);
                     if (field != null) {
                         long subDirectoryOffset;
                         int subDirectoryType;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldType.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldType.java?rev=1478479&r1=1478478&r2=1478479&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldType.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldType.java
Thu May  2 18:43:48 2013
@@ -50,7 +50,7 @@ public abstract class FieldType {
         return elementSize;
     }
     
-    public static FieldType getFieldType(int type) throws ImageReadException {
+    public static FieldType getFieldType(final int type) throws ImageReadException {
         for (final FieldType fieldType : ANY) {
             if (fieldType.getType() == type) {
                 return fieldType;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java?rev=1478479&r1=1478478&r2=1478479&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
Thu May  2 18:43:48 2013
@@ -53,7 +53,7 @@ public class TiffImageWriterLossless ext
         this.exifBytes = exifBytes;
     }
 
-    private List<TiffElement> analyzeOldTiff(Map<Integer,TiffOutputField> frozenFields)
throws ImageWriteException,
+    private List<TiffElement> analyzeOldTiff(final Map<Integer,TiffOutputField>
frozenFields) throws ImageWriteException,
             IOException {
         try {
             final ByteSource byteSource = new ByteSourceArray(exifBytes);
@@ -150,7 +150,7 @@ public class TiffImageWriterLossless ext
         if (makerNoteField != null && makerNoteField.getSeperateValue() != null)
{
             frozenFields.put(EXIF_TAG_MAKER_NOTE.tag, makerNoteField);
         }
-        List<TiffElement> analysis = analyzeOldTiff(frozenFields);
+        final List<TiffElement> analysis = analyzeOldTiff(frozenFields);
         final int oldLength = exifBytes.length;
         if (analysis.size() < 1) {
             throw new ImageWriteException("Couldn't analyze old tiff data.");
@@ -165,7 +165,7 @@ public class TiffImageWriterLossless ext
             }
         }
         final Map<Long,TiffOutputField> frozenFieldOffsets = new HashMap<Long, TiffOutputField>();
-        for (Map.Entry<Integer,TiffOutputField> entry : frozenFields.entrySet()) {
+        for (final Map.Entry<Integer,TiffOutputField> entry : frozenFields.entrySet())
{
             final TiffOutputField frozenField = entry.getValue();
             if (frozenField.getSeperateValue().getOffset() != TiffOutputItem.UNDEFINED_VALUE)
{
                 frozenFieldOffsets.put(frozenField.getSeperateValue().getOffset(), frozenField);
@@ -177,7 +177,7 @@ public class TiffImageWriterLossless ext
         final List<TiffOutputItem> allOutputItems = outputSet
                 .getOutputItems(outputSummary);
         final List<TiffOutputItem> outputItems = new ArrayList<TiffOutputItem>();
-        for (TiffOutputItem outputItem : allOutputItems) {
+        for (final TiffOutputItem outputItem : allOutputItems) {
             if (!frozenFieldOffsets.containsKey(outputItem.getOffset())) {
                 outputItems.add(outputItem);
             }

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java?rev=1478479&r1=1478478&r2=1478479&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java
Thu May  2 18:43:48 2013
@@ -39,20 +39,20 @@ public class MicrosoftTagTest extends Ex
     private static final String title = "title";
 
     public void testWrite() throws Exception {
-        BufferedImage image = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
-        TiffOutputSet exifSet = new TiffOutputSet();
-        TiffOutputDirectory exif = exifSet.getOrCreateExifDirectory();
+        final BufferedImage image = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
+        final TiffOutputSet exifSet = new TiffOutputSet();
+        final TiffOutputDirectory exif = exifSet.getOrCreateExifDirectory();
         exif.add(MicrosoftTagConstants.EXIF_TAG_XPAUTHOR, author);
         exif.add(MicrosoftTagConstants.EXIF_TAG_XPCOMMENT, comment);
         exif.add(MicrosoftTagConstants.EXIF_TAG_XPSUBJECT, subject);
         exif.add(MicrosoftTagConstants.EXIF_TAG_XPTITLE, title);
-        Map<String,Object> params = new TreeMap<String,Object>();
+        final Map<String,Object> params = new TreeMap<String,Object>();
         params.put(TiffConstants.PARAM_KEY_EXIF, exifSet);
-        byte[] bytes = Imaging.writeImageToBytes(image, ImageFormat.IMAGE_FORMAT_TIFF, params);
+        final byte[] bytes = Imaging.writeImageToBytes(image, ImageFormat.IMAGE_FORMAT_TIFF,
params);
         checkFields(bytes);
     }
     
-    private TiffImageMetadata toTiffMetadata(IImageMetadata metadata) throws Exception {
+    private TiffImageMetadata toTiffMetadata(final IImageMetadata metadata) throws Exception
{
         if (metadata instanceof JpegImageMetadata) {
             return ((JpegImageMetadata)metadata).getExif();
         } else if (metadata instanceof TiffImageMetadata) {
@@ -63,22 +63,22 @@ public class MicrosoftTagTest extends Ex
     }
     
     public void testRewrite() throws Exception {
-        File imageWithExif = getImageWithExifData();
-        TiffImageMetadata metadata = toTiffMetadata(Imaging.getMetadata(imageWithExif));
-        ExifRewriter rewriter = new ExifRewriter();
-        TiffOutputSet outputSet = metadata.getOutputSet();
-        TiffOutputDirectory exif = outputSet.getOrCreateExifDirectory();
+        final File imageWithExif = getImageWithExifData();
+        final TiffImageMetadata metadata = toTiffMetadata(Imaging.getMetadata(imageWithExif));
+        final ExifRewriter rewriter = new ExifRewriter();
+        final TiffOutputSet outputSet = metadata.getOutputSet();
+        final TiffOutputDirectory exif = outputSet.getOrCreateExifDirectory();
         exif.add(MicrosoftTagConstants.EXIF_TAG_XPAUTHOR, author);
         exif.add(MicrosoftTagConstants.EXIF_TAG_XPCOMMENT, comment);
         exif.add(MicrosoftTagConstants.EXIF_TAG_XPSUBJECT, subject);
         exif.add(MicrosoftTagConstants.EXIF_TAG_XPTITLE, title);
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
         rewriter.updateExifMetadataLossy(imageWithExif, baos, outputSet);
         checkFields(baos.toByteArray());
     }
     
-    private void checkFields(byte[] file) throws Exception {
-        TiffImageMetadata metadata = toTiffMetadata(Imaging.getMetadata(file));
+    private void checkFields(final byte[] file) throws Exception {
+        final TiffImageMetadata metadata = toTiffMetadata(Imaging.getMetadata(file));
         assertEquals(author, metadata.getFieldValue(MicrosoftTagConstants.EXIF_TAG_XPAUTHOR));
         assertEquals(comment, metadata.getFieldValue(MicrosoftTagConstants.EXIF_TAG_XPCOMMENT));
         assertEquals(subject, metadata.getFieldValue(MicrosoftTagConstants.EXIF_TAG_XPSUBJECT));



Mime
View raw message