commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1295763 - in /commons/proper/sanselan/trunk: pom.xml src/main/java/org/apache/commons/sanselan/common/BinaryConstant.java src/main/java/org/apache/commons/sanselan/formats/jpeg/iptc/IptcParser.java
Date Thu, 01 Mar 2012 19:56:38 GMT
Author: damjan
Date: Thu Mar  1 19:56:38 2012
New Revision: 1295763

URL: http://svn.apache.org/viewvc?rev=1295763&view=rev
Log:
Don't use Java 6 features like Arrays.copyOfRange().
Use the animal-sniffer-maven-plugin to verify this during the test phase.


Modified:
    commons/proper/sanselan/trunk/pom.xml
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/BinaryConstant.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/iptc/IptcParser.java

Modified: commons/proper/sanselan/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/pom.xml?rev=1295763&r1=1295762&r2=1295763&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/pom.xml (original)
+++ commons/proper/sanselan/trunk/pom.xml Thu Mar  1 19:56:38 2012
@@ -95,6 +95,27 @@
           <argLine>-Xmx512m</argLine>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>animal-sniffer-maven-plugin</artifactId>
+        <version>1.7</version>
+        <configuration>
+          <signature>
+            <groupId>org.codehaus.mojo.signature</groupId>
+            <artifactId>java15</artifactId>
+            <version>1.0</version>
+          </signature>
+        </configuration>
+        <executions>
+          <execution>
+            <id>check-java-api</id>
+            <phase>test</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
 
   </build>

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/BinaryConstant.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/BinaryConstant.java?rev=1295763&r1=1295762&r2=1295763&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/BinaryConstant.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/BinaryConstant.java
Thu Mar  1 19:56:38 2012
@@ -48,6 +48,18 @@ public class BinaryConstant implements C
         return Arrays.equals(value, bytes);
     }
     
+    public boolean equals(byte[] bytes, int offset, int length) {
+        if (value.length != length) {
+            return false;
+        }
+        for (int i = 0; i < length; i++) {
+            if (value[i] != bytes[offset + i]) {
+                return false;
+            }
+        }
+        return true;
+    }
+    
     @Override
     public int hashCode() {
         return Arrays.hashCode(value);

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/iptc/IptcParser.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/iptc/IptcParser.java?rev=1295763&r1=1295762&r2=1295763&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/iptc/IptcParser.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/iptc/IptcParser.java
Thu Mar  1 19:56:38 2012
@@ -53,7 +53,7 @@ public class IptcParser extends BinaryFi
         if (index + CONST_8BIM.size() > segmentData.length)
             return false;
 
-        if (!CONST_8BIM.equals(Arrays.copyOfRange(segmentData, index, index + CONST_8BIM.size())))
+        if (!CONST_8BIM.equals(segmentData, index, CONST_8BIM.size()))
             return false;
 
         return true;



Mime
View raw message