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 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
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 ...)
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 !
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.
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.