poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1704999 - in /poi/trunk/src/java/org/apache/poi/ddf: EscherBSERecord.java EscherBitmapBlip.java EscherBlipRecord.java EscherClientAnchorRecord.java
Date Thu, 24 Sep 2015 05:51:39 GMT
Author: kiwiwings
Date: Thu Sep 24 05:51:38 2015
New Revision: 1704999

URL: http://svn.apache.org/viewvc?rev=1704999&view=rev
Log:
fixed some wrong nightly assumptions ... (Note to myself, don't rely on ant automatic file
change detection, but run ant clean before ...)

Modified:
    poi/trunk/src/java/org/apache/poi/ddf/EscherBSERecord.java
    poi/trunk/src/java/org/apache/poi/ddf/EscherBitmapBlip.java
    poi/trunk/src/java/org/apache/poi/ddf/EscherBlipRecord.java
    poi/trunk/src/java/org/apache/poi/ddf/EscherClientAnchorRecord.java

Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherBSERecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherBSERecord.java?rev=1704999&r1=1704998&r2=1704999&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherBSERecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherBSERecord.java Thu Sep 24 05:51:38 2015
@@ -43,7 +43,7 @@ public final class EscherBSERecord exten
 
     private byte field_1_blipTypeWin32;
     private byte field_2_blipTypeMacOS;
-    private byte[] field_3_uid;  // 16 bytes
+    private final byte[] field_3_uid = new byte[16];
     private short field_4_tag;
     private int field_5_size;
     private int field_6_ref;
@@ -54,14 +54,13 @@ public final class EscherBSERecord exten
     private byte field_11_unused3;
     private EscherBlipRecord field_12_blipRecord;
 
-    private byte[] _remainingData;
+    private byte[] _remainingData = new byte[0];
 
     public int fillFields(byte[] data, int offset, EscherRecordFactory recordFactory) {
         int bytesRemaining = readHeader( data, offset );
         int pos = offset + 8;
         field_1_blipTypeWin32 = data[pos];
         field_2_blipTypeMacOS = data[pos + 1];
-        field_3_uid = new byte[16];
         System.arraycopy( data, pos + 2, field_3_uid, 0, 16 );
         field_4_tag = LittleEndian.getShort( data, pos + 18 );
         field_5_size = LittleEndian.getInt( data, pos + 20 );
@@ -183,9 +182,10 @@ public final class EscherBSERecord exten
      * 16 byte MD4 checksum.
      */
     public void setUid(byte[] uid) {
-        if (uid != null && uid.length == 16) {
-            System.arraycopy(uid, 0, field_3_uid, 0, field_3_uid.length);
-        };
+        if (uid == null || uid.length != 16) {
+            throw new IllegalArgumentException("uid must be byte[16]");
+        }
+        System.arraycopy(uid, 0, field_3_uid, 0, field_3_uid.length);
     }
 
     /**
@@ -308,7 +308,7 @@ public final class EscherBSERecord exten
      */
     public void setRemainingData(byte[] remainingData) {
         if (remainingData == null) {
-            _remainingData = null;
+            _remainingData = new byte[0];
         } else {
             _remainingData = remainingData.clone();
         }

Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherBitmapBlip.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherBitmapBlip.java?rev=1704999&r1=1704998&r2=1704999&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherBitmapBlip.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherBitmapBlip.java Thu Sep 24 05:51:38 2015
@@ -30,14 +30,13 @@ public class EscherBitmapBlip extends Es
 
     private static final int HEADER_SIZE = 8;
 
-    private byte[] field_1_UID;
+    private final byte[] field_1_UID = new byte[16];
     private byte field_2_marker = (byte) 0xFF;
 
     public int fillFields(byte[] data, int offset, EscherRecordFactory recordFactory) {
         int bytesAfterHeader = readHeader( data, offset );
         int pos = offset + HEADER_SIZE;
 
-        field_1_UID = new byte[16];
         System.arraycopy( data, pos, field_1_UID, 0, 16 ); pos += 16;
         field_2_marker = data[pos]; pos++;
 
@@ -75,9 +74,10 @@ public class EscherBitmapBlip extends Es
     }
 
     public void setUID( byte[] field_1_UID ) {
-        if (field_1_UID != null && field_1_UID.length == 16) {
-            System.arraycopy(field_1_UID, 0, this.field_1_UID , 0, 16);
+        if (field_1_UID == null || field_1_UID.length != 16) {
+            throw new IllegalArgumentException("field_1_UID must be byte[16]");
         }
+        System.arraycopy(field_1_UID, 0, this.field_1_UID , 0, 16);
     }
 
     public byte getMarker()

Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherBlipRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherBlipRecord.java?rev=1704999&r1=1704998&r2=1704999&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherBlipRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherBlipRecord.java Thu Sep 24 05:51:38 2015
@@ -71,10 +71,9 @@ public class EscherBlipRecord extends Es
 
     public void setPictureData(byte[] pictureData) {
         if (pictureData == null) {
-            field_pictureData = null;
-        } else {
-            field_pictureData = pictureData.clone();
+            throw new NullPointerException("picture data can't be null");
         }
+        field_pictureData = pictureData.clone();
     }
 
     public String toString() {

Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherClientAnchorRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherClientAnchorRecord.java?rev=1704999&r1=1704998&r2=1704999&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherClientAnchorRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherClientAnchorRecord.java Thu Sep 24 05:51:38
2015
@@ -52,7 +52,7 @@ public class EscherClientAnchorRecord
     private short field_7_dx2;
     private short field_8_row2;
     private short field_9_dy2;
-    private byte[] remainingData;
+    private byte[] remainingData = new byte[0];
     private boolean shortRecord = false;
 
     public int fillFields(byte[] data, int offset, EscherRecordFactory recordFactory) {
@@ -335,7 +335,7 @@ public class EscherClientAnchorRecord
      */
     public void setRemainingData( byte[] remainingData ) {
         if (remainingData == null) {
-            this.remainingData = null;
+            this.remainingData = new byte[0];
         } else {
             this.remainingData = remainingData.clone();
         }



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


Mime
View raw message