mirror of https://github.com/apache/poi.git
Removed erroneous coding for Ptg 0x1a (see bugzilla 40008)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@832975 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
809a2923c9
commit
560bfb7eb3
|
@ -49,14 +49,14 @@ public abstract class Ptg implements Cloneable {
|
||||||
* Extra data (beyond <tt>size</tt>) may be read if and <tt>ArrayPtg</tt>s are present.
|
* Extra data (beyond <tt>size</tt>) may be read if and <tt>ArrayPtg</tt>s are present.
|
||||||
*/
|
*/
|
||||||
public static Ptg[] readTokens(int size, LittleEndianInput in) {
|
public static Ptg[] readTokens(int size, LittleEndianInput in) {
|
||||||
List temp = new ArrayList(4 + size / 2);
|
List<Ptg> temp = new ArrayList<Ptg>(4 + size / 2);
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
List arrayPtgs = null;
|
List<Ptg> arrayPtgs = null;
|
||||||
while (pos < size) {
|
while (pos < size) {
|
||||||
Ptg ptg = Ptg.createPtg(in);
|
Ptg ptg = Ptg.createPtg(in);
|
||||||
if (ptg instanceof ArrayPtg) {
|
if (ptg instanceof ArrayPtg) {
|
||||||
if (arrayPtgs == null) {
|
if (arrayPtgs == null) {
|
||||||
arrayPtgs = new ArrayList(5);
|
arrayPtgs = new ArrayList<Ptg>(5);
|
||||||
}
|
}
|
||||||
arrayPtgs.add(ptg);
|
arrayPtgs.add(ptg);
|
||||||
pos += ArrayPtg.PLAIN_TOKEN_SIZE;
|
pos += ArrayPtg.PLAIN_TOKEN_SIZE;
|
||||||
|
@ -93,7 +93,6 @@ public abstract class Ptg implements Cloneable {
|
||||||
} else {
|
} else {
|
||||||
retval.setClass(CLASS_REF);
|
retval.setClass(CLASS_REF);
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,8 +152,7 @@ public abstract class Ptg implements Cloneable {
|
||||||
case MissingArgPtg.sid: return MissingArgPtg.instance; // 0x16
|
case MissingArgPtg.sid: return MissingArgPtg.instance; // 0x16
|
||||||
|
|
||||||
case StringPtg.sid: return new StringPtg(in); // 0x17
|
case StringPtg.sid: return new StringPtg(in); // 0x17
|
||||||
case AttrPtg.sid:
|
case AttrPtg.sid: return new AttrPtg(in); // 0x19
|
||||||
case 0x1a: return new AttrPtg(in); // 0x19
|
|
||||||
case ErrPtg.sid: return ErrPtg.read(in); // 0x1c
|
case ErrPtg.sid: return ErrPtg.read(in); // 0x1c
|
||||||
case BoolPtg.sid: return new BoolPtg(in); // 0x1d
|
case BoolPtg.sid: return new BoolPtg(in); // 0x1d
|
||||||
case IntPtg.sid: return new IntPtg(in); // 0x1e
|
case IntPtg.sid: return new IntPtg(in); // 0x1e
|
||||||
|
@ -184,7 +182,7 @@ public abstract class Ptg implements Cloneable {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static Ptg[] toPtgArray(List l) {
|
private static Ptg[] toPtgArray(List<Ptg> l) {
|
||||||
if (l.isEmpty()) {
|
if (l.isEmpty()) {
|
||||||
return EMPTY_PTG_ARRAY;
|
return EMPTY_PTG_ARRAY;
|
||||||
}
|
}
|
||||||
|
@ -232,7 +230,7 @@ public abstract class Ptg implements Cloneable {
|
||||||
|
|
||||||
LittleEndianByteArrayOutputStream out = new LittleEndianByteArrayOutputStream(array, offset);
|
LittleEndianByteArrayOutputStream out = new LittleEndianByteArrayOutputStream(array, offset);
|
||||||
|
|
||||||
List arrayPtgs = null;
|
List<Ptg> arrayPtgs = null;
|
||||||
|
|
||||||
for (int k = 0; k < nTokens; k++) {
|
for (int k = 0; k < nTokens; k++) {
|
||||||
Ptg ptg = ptgs[k];
|
Ptg ptg = ptgs[k];
|
||||||
|
@ -240,7 +238,7 @@ public abstract class Ptg implements Cloneable {
|
||||||
ptg.write(out);
|
ptg.write(out);
|
||||||
if (ptg instanceof ArrayPtg) {
|
if (ptg instanceof ArrayPtg) {
|
||||||
if (arrayPtgs == null) {
|
if (arrayPtgs == null) {
|
||||||
arrayPtgs = new ArrayList(5);
|
arrayPtgs = new ArrayList<Ptg>(5);
|
||||||
}
|
}
|
||||||
arrayPtgs.add(ptg);
|
arrayPtgs.add(ptg);
|
||||||
}
|
}
|
||||||
|
@ -259,11 +257,6 @@ public abstract class Ptg implements Cloneable {
|
||||||
*/
|
*/
|
||||||
public abstract int getSize();
|
public abstract int getSize();
|
||||||
|
|
||||||
/**
|
|
||||||
* //@return the encoded length of this Ptg, not including the initial Ptg type identifier byte.
|
|
||||||
*/
|
|
||||||
// public abstract int getDataSize();
|
|
||||||
|
|
||||||
public abstract void write(LittleEndianOutput out);
|
public abstract void write(LittleEndianOutput out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -348,5 +341,4 @@ public abstract class Ptg implements Cloneable {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue