Bug 59671 - Exception while updating XLSX file
Summary: Exception while updating XLSX file
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-07 17:18 UTC by Badari
Modified: 2016-06-07 17:38 UTC (History)
0 users



Attachments
Simple xlsx file with a few columns (13.62 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2016-06-07 17:18 UTC, Badari
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Badari 2016-06-07 17:18:11 UTC
Created attachment 33923 [details]
Simple xlsx file with a few columns

Exception in thread "main" org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException: Rule M2.4 exception : this error should NEVER happen! Please raise a bug at https://bz.apache.org/bugzilla/enter_bug.cgi?product=POI and attach a file that triggers it, thanks!
  at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.getContentType(ContentTypeManager.java:343)
  at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.removeContentType(ContentTypeManager.java:256)
  at org.apache.poi.openxml4j.opc.OPCPackage.removePart(OPCPackage.java:943)
  at org.apache.poi.openxml4j.opc.PackagePart.getOutputStream(PackagePart.java:522)
  at org.apache.poi.xssf.usermodel.XSSFWorkbook.commit(XSSFWorkbook.java:1678)
  at org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:341)
  at org.apache.poi.POIXMLDocument.write(POIXMLDocument.java:206)
  at com.geni.common.ExcelUpdater.updateXLSX(ExcelUpdater.java:75)
  at UpdateXLSX.main(UpdateXLSX.java:16)
Comment 1 Badari 2016-06-07 17:22:01 UTC
The exception is raised when the method is called more than once

// Temp.xlsx is output file. Input file is always "EDIStatsTemplate.xlsx"

ExcelUpdater excelUpdater = new ExcelUpdater("Temp.xlsx");
int txns = 44;
excelUpdater.updateXLSX(new Object[] { "X12", "856", "4010", "LG", txns });
txns = 54;
excelUpdater.updateXLSX(new Object[] { "X12", "856", "4010", "LG", txns });
Comment 2 Badari 2016-06-07 17:38:39 UTC
Apologies. I closed the output file prematurely but tried to update. That caused the exception.