In POI 3.0.2-FINAL: After creating a drawing patriarch on a sheet, retrieving the patriarch via the "getDrawingPatriarch" method may cause a NullPointerException, due to an unset, unchecked rawData value in AbstractEscherHolderRecord. "convertRawBytesToEscherRecords()" Line 99: convertToEscherRecords(0, rawData.length, rawData); ^ |- Not checked for null, causes NPE To reproduce: 1. Create drawing patriarch HSSFPatriarch patr = sheet.createDrawingPatriarch(); 2. Use patriarch HSSFClientAnchor anchor = new HSSFClientAnchor(0,0, 600,245, (short)1,1, (short)1,2); anchor.setAnchorType(3); patr.createPicture(anchor, loadImage(LOGO_PATH, HSSFWorkbook.PICTURE_TYPE_JPEG)); 3. Try to re-use patriarch later HSSFPatriarch existingPatr = sheet.getDrawingPatriarch(); 4. Kaboom.
Easy to reproduce. As it turns out, step 2 is not required to get the NPE added disabled junit for this bug in svn r652561
Created attachment 24900 [details] patch to fix bug 44916 fixed the bug and enable the junit test
Thanks. Committed with some tweaks in r948880.