Bug 33263 fixed: Patch provided by Der-Johng Sun <derjohng2@yahoo.com>.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353627 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rainer Klute 2005-01-28 17:23:00 +00:00
parent 1e127a592f
commit 0c6aae8d13
1 changed files with 18 additions and 8 deletions

View File

@ -49,7 +49,7 @@ public class ListLevel
private short _reserved; private short _reserved;
private byte[] _grpprlPapx; private byte[] _grpprlPapx;
private byte[] _grpprlChpx; private byte[] _grpprlChpx;
private char[] _numberText; private char[] _numberText=null;
public ListLevel(int startAt, int numberFormatCode, int alignment, public ListLevel(int startAt, int numberFormatCode, int alignment,
byte[] numberProperties, byte[] entryProperties, byte[] numberProperties, byte[] entryProperties,
@ -112,6 +112,10 @@ public class ListLevel
offset += _cbGrpprlChpx; offset += _cbGrpprlChpx;
int numberTextLength = LittleEndian.getShort(buf, offset); int numberTextLength = LittleEndian.getShort(buf, offset);
/* sometimes numberTextLength<0 */
/* by derjohng */
if (numberTextLength>0)
{
_numberText = new char[numberTextLength]; _numberText = new char[numberTextLength];
offset += LittleEndian.SHORT_SIZE; offset += LittleEndian.SHORT_SIZE;
for (int x = 0; x < numberTextLength; x++) for (int x = 0; x < numberTextLength; x++)
@ -119,6 +123,7 @@ public class ListLevel
_numberText[x] = (char)LittleEndian.getShort(buf, offset); _numberText[x] = (char)LittleEndian.getShort(buf, offset);
offset += LittleEndian.SHORT_SIZE; offset += LittleEndian.SHORT_SIZE;
} }
}
} }
@ -229,8 +234,13 @@ public class ListLevel
return buf; return buf;
} }
public int getSizeInBytes() public int getSizeInBytes()
{
if (_numberText!=null)
{ {
return 28 + _cbGrpprlChpx + _cbGrpprlPapx + (_numberText.length * LittleEndian.SHORT_SIZE) + 2; return 28 + _cbGrpprlChpx + _cbGrpprlPapx + (_numberText.length * LittleEndian.SHORT_SIZE) + 2;
} else {
return 28 + _cbGrpprlChpx + _cbGrpprlPapx + 2;
}
} }
} }