You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2016/07/09 06:38:16 UTC

svn commit: r1751984 - in /poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model: FIBFieldHandler.java UnhandledDataStructure.java

Author: onealj
Date: Sat Jul  9 06:38:16 2016
New Revision: 1751984

URL: http://svn.apache.org/viewvc?rev=1751984&view=rev
Log:
remove Internal UnhandledDataStructure.copyOfRange because function is available in JDK 1.6+ and we no longer support JDK 1.5

Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/UnhandledDataStructure.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java?rev=1751984&r1=1751983&r2=1751984&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java Sat Jul  9 06:38:16 2016
@@ -283,24 +283,17 @@ public final class FIBFieldHandler
         {
             result.append( '\t' );
             result.append( leftPad( Integer.toString( x ), 8, ' ' ) );
-            result.append( leftPad(
-                    Integer.toString( 154 + x * LittleEndian.INT_SIZE * 2 ), 6,
-                    ' ' ) );
+            result.append( leftPad( Integer.toString( 154 + x * LittleEndian.INT_SIZE * 2 ), 6, ' ' ) );
             result.append( "   0x" );
-            result.append( leftPad(
-                    Integer.toHexString( 154 + x * LittleEndian.INT_SIZE * 2 ),
-                    4, '0' ) );
-            result.append( leftPad( Integer.toString( getFieldOffset( x ) ), 8,
-                    ' ' ) );
-            result.append( leftPad( Integer.toString( getFieldSize( x ) ), 8,
-                    ' ' ) );
+            result.append( leftPad( Integer.toHexString( 154 + x * LittleEndian.INT_SIZE * 2 ), 4, '0' ) );
+            result.append( leftPad( Integer.toString( getFieldOffset( x ) ), 8, ' ' ) );
+            result.append( leftPad( Integer.toString( getFieldSize( x ) ), 8, ' ' ) );
 
-            UnhandledDataStructure structure = _unknownMap.get( Integer
-                    .valueOf( x ) );
+            UnhandledDataStructure structure = _unknownMap.get( Integer.valueOf( x ) );
             if ( structure != null )
             {
                 result.append( " => Unknown structure of size " );
-                result.append( structure._buf.length );
+                result.append( structure.getBuf().length );
             }
             result.append( '\n' );
         }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/UnhandledDataStructure.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/UnhandledDataStructure.java?rev=1751984&r1=1751983&r2=1751984&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/UnhandledDataStructure.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/UnhandledDataStructure.java Sat Jul  9 06:38:16 2016
@@ -17,6 +17,8 @@
 
 package org.apache.poi.hwpf.model;
 
+import java.util.Arrays;
+
 import org.apache.poi.util.Internal;
 
 /**
@@ -27,7 +29,7 @@ import org.apache.poi.util.Internal;
 @Internal
 public final class UnhandledDataStructure
 {
-  byte[] _buf;
+  private final byte[] _buf;
 
   public UnhandledDataStructure(byte[] buf, int offset, int length)
   {
@@ -46,24 +48,11 @@ public final class UnhandledDataStructur
     }
     
     // Save that requested portion of the data 
-    _buf = copyOfRange(buf, offset, offsetEnd);
+    _buf = Arrays.copyOfRange(buf, offset, offsetEnd);
 
   }
 
-    /**
-     * YK: Arrays.copyOfRange is not in JDK 1.5
-     */
-    static byte[] copyOfRange(byte[] original, int from, int to) {
-        int newLength = to - from;
-        if (newLength < 0)
-            throw new IllegalArgumentException(from + " > " + to);
-        byte[] copy = new byte[newLength];
-        System.arraycopy(original, from, copy, 0,
-                Math.min(original.length - from, newLength));
-        return copy;
-    }
-
-  byte[] getBuf()
+  /*package*/ byte[] getBuf()
   {
     return _buf;
   }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org