Bug 59793

Summary: "Rule M2.4 exception : this error should NEVER happen!" error message is still being triggered even with POI v3.14
Product: POI Reporter: Lam <lamchiomeng78>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: critical CC: lamchiomeng78
Priority: P2    
Version: 3.14-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows NT   
Attachments: This file contains the codes of the two class I run that triggers the Rule M2.4 exception

Description Lam 2016-07-04 10:46:58 UTC
Created attachment 34004 [details]
This file contains the codes of the two class I run that triggers the Rule M2.4 exception

The error message Rule M2.4 exception : this error should NEVER happen! is still being triggered despite many duplicate reports. This time it's on POI v3.14.

Kindly run the codes as per attached.
Comment 1 Lam 2016-07-04 10:59:34 UTC
Comment on attachment 34004 [details]
This file contains the codes of the two class I run that triggers the Rule M2.4 exception

The excel file was created, but it's corrupted and cannot be opened by Excel
Comment 2 Andreas Beeker 2016-07-04 11:05:43 UTC
Can you try to close your FileOutputStream?

so instead of:
  workbook.write(new FileOutputStream("c:\\Test Data\\write.xlsx"));
  workbook.close();

do:
  FileOutputStream fos = new FileOutputStream("c:\\Test Data\\write.xlsx")
  workbook.write(fos);
  fos.close();
  workbook.close();

Of course this assumes, that your initial write.xlsx is valid ...

If this doesn't work, please attach the write.xlsx (if this is the failing file ...)
Comment 3 Lam 2016-07-04 12:09:19 UTC
Hi Andreas,

Thank you so much for your prompt reply. I have tried your method as per the following: 

It seems working now, except for the part in the If condition. I have replace the method you mentioned, and it's still giving me the RUle M2.4 exception. I suspect that it could be the closing of the FileOutputstream.

I'll test on it first, and will write again if I face any issues or need your advice.

Thanks again for all your help !
Comment 4 Dominik Stadler 2016-07-15 18:43:17 UTC
As far as I see the code loads a file "write.xlsx", without this the code likely will not be very useful, or? Can you attach it as well and describe how it was biult (by which application, version, ...)

Also please try some more to provide a real reproducer that actually compiles, your code still contains references to "login", which is commented out so a developer who would like to take a look will first need to make the code compilable/runnable, which is bad. Ideally you remove as many lines of code as possible, to make the code as small as possible. Also commented out code confuses, so remove this as well if possible.
Comment 5 Dominik Stadler 2016-07-22 12:49:33 UTC
Please reopen this bug if you can provide some more information here, currently there is not much we can do without the actual file that triggers this.