Bug 59793 - "Rule M2.4 exception : this error should NEVER happen!" error message is still being triggered even with POI v3.14
Summary: "Rule M2.4 exception : this error should NEVER happen!" error message is stil...
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 3.14-FINAL
Hardware: PC Windows NT
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-04 10:46 UTC by Lam
Modified: 2016-07-22 12:49 UTC (History)
1 user (show)



Attachments
This file contains the codes of the two class I run that triggers the Rule M2.4 exception (6.54 KB, text/plain)
2016-07-04 10:46 UTC, Lam
Details

Note You need to log in before you can comment on or make changes to this bug.
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.