Apply patch from bug #51458 - Correct BitField wrapping when setting large values

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1141977 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2011-07-01 16:29:04 +00:00
parent e11c26c29b
commit ecd2511317
3 changed files with 11 additions and 1 deletions

View File

@ -34,6 +34,7 @@
<changes>
<release version="3.8-beta4" date="2011-??-??">
<action dev="poi-developers" type="fix">51458 - Correct BitField wrapping when setting large values</action>
<action dev="poi-developers" type="add">51460 - Improve HSSF performance when loading very long rows, by switching the CellValue array to an iterator</action>
<action dev="poi-developers" type="fix">51444 - Prevent corrupted output when saving files created by LibreOffice 3.3 </action>
<action dev="poi-developers" type="add">51422 - Support using RecalcIdRecord to trigger a full formula recalculation on load </action>

View File

@ -71,7 +71,7 @@ public class BitField
public int getValue(final int holder)
{
return getRawValue(holder) >> _shift_count;
return getRawValue(holder) >>> _shift_count;
}
/**

View File

@ -188,4 +188,13 @@ public final class TestBitField extends TestCase {
assertEquals(bf_single.clearShort(( short ) -1),
bf_single.setShortBoolean(( short ) -1, false));
}
public void testSetLargeValues() {
final BitField bf1 = new BitField(0xF), bf2 = new BitField(0xF0000000);
int a = 0;
a = bf1.setValue(a, 9);
a = bf2.setValue(a, 9);
assertEquals(9, bf1.getValue(a));
assertEquals(9, bf2.getValue(a));
}
}