fixed bug 53432

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1373110 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Evgeniy Berlog 2012-08-14 21:11:53 +00:00
parent 98f64db1c7
commit c3f9a6e682
2 changed files with 19 additions and 2 deletions

View File

@ -257,7 +257,9 @@ public abstract class AbstractEscherHolderRecord extends Record {
*/
public void decode()
{
byte[] rawData = getRawData();
convertToEscherRecords(0, rawData.length, rawData );
if (null == escherRecords || 0 == escherRecords.size()){
byte[] rawData = getRawData();
convertToEscherRecords(0, rawData.length, rawData );
}
}
}

View File

@ -2268,4 +2268,19 @@ if(1==2) {
HSSFSheet sh2 = wb.cloneSheet(0);
assertNotNull(sh2.getDrawingPatriarch());
}
public void test53432(){
Workbook wb = new HSSFWorkbook(); //or new HSSFWorkbook();
wb.addPicture(new byte[]{123,22}, Workbook.PICTURE_TYPE_JPEG);
assertEquals(wb.getAllPictures().size(), 1);
wb = new HSSFWorkbook();
wb = writeOutAndReadBack((HSSFWorkbook) wb);
assertEquals(wb.getAllPictures().size(), 0);
wb.addPicture(new byte[]{123,22}, Workbook.PICTURE_TYPE_JPEG);
assertEquals(wb.getAllPictures().size(), 1);
wb = writeOutAndReadBack((HSSFWorkbook) wb);
assertEquals(wb.getAllPictures().size(), 1);
}
}