https://issues.apache.org/bugzilla/show_bug.cgi?id=53613
Priority: P2
Bug ID: 53613
Assignee: [email protected]
Summary: org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeEx
ception: Rule M2.4 exception : this error should NEVER
happen
Severity: normal
Classification: Unclassified
Reporter: [email protected]
Hardware: PC
Status: NEW
Version: 3.8
Component: XSSF
Product: POI
Created attachment 29122
--> https://issues.apache.org/bugzilla/attachment.cgi?id=29122&action=edit
This is the spreadsheet that my program tries to open and close. The program
corrupts the spreadsheet when run.
I experience this exception being thrown:
org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException: Rule M2.4
exception : this error should NEVER happen, if so please send a mail to the
developers team, thanks !
This is example code that triggers the error. The statement wb.write(fileOut);
specifically seems to be the culprit.
package areacontrol;
public class AreaControl_3 {
public static void main(String[] args) {
String filename = "C:\\java\\values.xlsx";
try{
org.apache.poi.openxml4j.opc.OPCPackage opc =
org.apache.poi.openxml4j.opc.OPCPackage.open(filename);
org.apache.poi.xssf.usermodel.XSSFWorkbook wb =
new org.apache.poi.xssf.usermodel.XSSFWorkbook(opc);
opc.close();
java.io.FileOutputStream fileOut =
new java.io.FileOutputStream(filename);
wb.write(fileOut);
fileOut.close();
}catch(Exception e){
System.out.println(e);
}
}
}
This code does not generate the exception:
package areacontrol;
public class AreaControl_3_1 {
public static void main(String[] args) {
String filename = "C:\\java\\values.xlsx";
try{
java.io.FileInputStream fis =
new java.io.FileInputStream(filename);
org.apache.poi.xssf.usermodel.XSSFWorkbook wb =
new org.apache.poi.xssf.usermodel.XSSFWorkbook(fis);
fis.close();
java.io.FileOutputStream fileOut =
new java.io.FileOutputStream(filename);
wb.write(fileOut);
fileOut.close();
}catch(Exception e){
System.out.println(e);
}
}
}
I have attached the spreadsheet.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]