bug 45000 - Fixed NPE in ListLevel when numberText is null
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@656757 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
193ac0db79
commit
42b0a779b5
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
<!-- Don't forget to update status.xml too! -->
|
<!-- Don't forget to update status.xml too! -->
|
||||||
<release version="3.1-beta2" date="2008-05-??">
|
<release version="3.1-beta2" date="2008-05-??">
|
||||||
|
<action dev="POI-DEVELOPERS" type="fix">45000 - Fixed NPE in ListLevel when numberText is null</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">44985 - Properly update TextSpecInfoAtom when the parent text is changed</action>
|
<action dev="POI-DEVELOPERS" type="fix">44985 - Properly update TextSpecInfoAtom when the parent text is changed</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">41187 - fixed HSSFSheet to properly read xls files without ROW records</action>
|
<action dev="POI-DEVELOPERS" type="fix">41187 - fixed HSSFSheet to properly read xls files without ROW records</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">44950 - fixed HSSFFormulaEvaluator.evaluateInCell() and Area3DEval.getValue() also added validation for number of elements in AreaEvals</action>
|
<action dev="POI-DEVELOPERS" type="fix">44950 - fixed HSSFFormulaEvaluator.evaluateInCell() and Area3DEval.getValue() also added validation for number of elements in AreaEvals</action>
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
<!-- Don't forget to update changes.xml too! -->
|
<!-- Don't forget to update changes.xml too! -->
|
||||||
<changes>
|
<changes>
|
||||||
<release version="3.1-beta2" date="2008-05-??">
|
<release version="3.1-beta2" date="2008-05-??">
|
||||||
|
<action dev="POI-DEVELOPERS" type="fix">45000 - Fixed NPE in ListLevel when numberText is null</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">44985 - Properly update TextSpecInfoAtom when the parent text is changed</action>
|
<action dev="POI-DEVELOPERS" type="fix">44985 - Properly update TextSpecInfoAtom when the parent text is changed</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">41187 - fixed HSSFSheet to properly read xls files without ROW records</action>
|
<action dev="POI-DEVELOPERS" type="fix">41187 - fixed HSSFSheet to properly read xls files without ROW records</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">44950 - fixed HSSFFormulaEvaluator.evaluateInCell() and Area3DEval.getValue() also added validation for number of elements in AreaEvals</action>
|
<action dev="POI-DEVELOPERS" type="fix">44950 - fixed HSSFFormulaEvaluator.evaluateInCell() and Area3DEval.getValue() also added validation for number of elements in AreaEvals</action>
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -16,22 +15,20 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.hwpf.model;
|
package org.apache.poi.hwpf.model;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.apache.poi.util.BitField;
|
import org.apache.poi.util.BitField;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
import org.apache.poi.hwpf.usermodel.CharacterProperties;
|
/**
|
||||||
import org.apache.poi.hwpf.usermodel.ParagraphProperties;
|
*
|
||||||
|
*/
|
||||||
import org.apache.poi.hwpf.sprm.ParagraphSprmCompressor;
|
public final class ListLevel
|
||||||
import org.apache.poi.hwpf.sprm.CharacterSprmCompressor;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class ListLevel
|
|
||||||
{
|
{
|
||||||
|
private static final int RGBXCH_NUMS_SIZE = 9;
|
||||||
|
|
||||||
private int _iStartAt;
|
private int _iStartAt;
|
||||||
private byte _nfc;
|
private byte _nfc;
|
||||||
private byte _info;
|
private byte _info;
|
||||||
@ -70,7 +67,7 @@ public class ListLevel
|
|||||||
_grpprlPapx = new byte[0];
|
_grpprlPapx = new byte[0];
|
||||||
_grpprlChpx = new byte[0];
|
_grpprlChpx = new byte[0];
|
||||||
_numberText = new char[0];
|
_numberText = new char[0];
|
||||||
_rgbxchNums = new byte[9];
|
_rgbxchNums = new byte[RGBXCH_NUMS_SIZE];
|
||||||
|
|
||||||
if (numbered)
|
if (numbered)
|
||||||
{
|
{
|
||||||
@ -90,11 +87,10 @@ public class ListLevel
|
|||||||
_nfc = buf[offset++];
|
_nfc = buf[offset++];
|
||||||
_info = buf[offset++];
|
_info = buf[offset++];
|
||||||
|
|
||||||
_rgbxchNums = new byte[9];
|
_rgbxchNums = new byte[RGBXCH_NUMS_SIZE];
|
||||||
for (int x = 0; x < 9; x++)
|
System.arraycopy(buf, offset, _rgbxchNums, 0, RGBXCH_NUMS_SIZE);
|
||||||
{
|
offset += RGBXCH_NUMS_SIZE;
|
||||||
_rgbxchNums[x] = buf[offset++];
|
|
||||||
}
|
|
||||||
_ixchFollow = buf[offset++];
|
_ixchFollow = buf[offset++];
|
||||||
_dxaSpace = LittleEndian.getInt(buf, offset);
|
_dxaSpace = LittleEndian.getInt(buf, offset);
|
||||||
offset += LittleEndian.INT_SIZE;
|
offset += LittleEndian.INT_SIZE;
|
||||||
@ -207,8 +203,8 @@ public class ListLevel
|
|||||||
offset += LittleEndian.INT_SIZE;
|
offset += LittleEndian.INT_SIZE;
|
||||||
buf[offset++] = _nfc;
|
buf[offset++] = _nfc;
|
||||||
buf[offset++] = _info;
|
buf[offset++] = _info;
|
||||||
System.arraycopy(_rgbxchNums, 0, buf, offset, _rgbxchNums.length);
|
System.arraycopy(_rgbxchNums, 0, buf, offset, RGBXCH_NUMS_SIZE);
|
||||||
offset += _rgbxchNums.length;
|
offset += RGBXCH_NUMS_SIZE;
|
||||||
buf[offset++] = _ixchFollow;
|
buf[offset++] = _ixchFollow;
|
||||||
LittleEndian.putInt(buf, offset, _dxaSpace);
|
LittleEndian.putInt(buf, offset, _dxaSpace);
|
||||||
offset += LittleEndian.INT_SIZE;
|
offset += LittleEndian.INT_SIZE;
|
||||||
@ -225,23 +221,33 @@ public class ListLevel
|
|||||||
System.arraycopy(_grpprlPapx, 0, buf, offset, _cbGrpprlPapx);
|
System.arraycopy(_grpprlPapx, 0, buf, offset, _cbGrpprlPapx);
|
||||||
offset += _cbGrpprlPapx;
|
offset += _cbGrpprlPapx;
|
||||||
|
|
||||||
LittleEndian.putShort(buf, offset, (short)_numberText.length);
|
if (_numberText == null) {
|
||||||
|
// TODO - write junit to test this flow
|
||||||
|
LittleEndian.putUShort(buf, offset, 0);
|
||||||
|
} else {
|
||||||
|
LittleEndian.putUShort(buf, offset, _numberText.length);
|
||||||
offset += LittleEndian.SHORT_SIZE;
|
offset += LittleEndian.SHORT_SIZE;
|
||||||
for (int x = 0; x < _numberText.length; x++)
|
for (int x = 0; x < _numberText.length; x++)
|
||||||
{
|
{
|
||||||
LittleEndian.putShort(buf, offset, (short)_numberText[x]);
|
LittleEndian.putUShort(buf, offset, _numberText[x]);
|
||||||
offset += LittleEndian.SHORT_SIZE;
|
offset += LittleEndian.SHORT_SIZE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
public int getSizeInBytes()
|
public int getSizeInBytes()
|
||||||
{
|
{
|
||||||
if (_numberText!=null)
|
int result =
|
||||||
{
|
6 // int byte byte
|
||||||
return 28 + _cbGrpprlChpx + _cbGrpprlPapx + (_numberText.length * LittleEndian.SHORT_SIZE) + 2;
|
+ RGBXCH_NUMS_SIZE
|
||||||
} else {
|
+ 13 // byte int int byte byte short
|
||||||
return 28 + _cbGrpprlChpx + _cbGrpprlPapx + 2;
|
+ _cbGrpprlChpx
|
||||||
|
+ _cbGrpprlPapx
|
||||||
|
+ 2; // numberText length
|
||||||
|
if (_numberText != null) {
|
||||||
|
result += _numberText.length * LittleEndian.SHORT_SIZE;
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user