fixed some wrong nightly assumptions ... (Note to myself, don't rely on ant automatic file change detection, but run ant clean before ...)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1704999 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2015-09-24 05:51:38 +00:00
parent abfe427e72
commit bde96d1a9a
4 changed files with 15 additions and 16 deletions

View File

@ -43,7 +43,7 @@ public final class EscherBSERecord extends EscherRecord {
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 extends EscherRecord {
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 extends EscherRecord {
* 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 extends EscherRecord {
*/
public void setRemainingData(byte[] remainingData) {
if (remainingData == null) {
_remainingData = null;
_remainingData = new byte[0];
} else {
_remainingData = remainingData.clone();
}

View File

@ -30,14 +30,13 @@ public class EscherBitmapBlip extends EscherBlipRecord {
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 EscherBlipRecord {
}
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()

View File

@ -71,10 +71,9 @@ public class EscherBlipRecord extends EscherRecord { // TODO - instantiable supe
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() {

View File

@ -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();
}