https://bz.apache.org/bugzilla/show_bug.cgi?id=62629

            Bug ID: 62629
           Summary: Reaching a Rule M2.4 exception when trying to merge
                    two files
           Product: POI
           Version: 3.17-FINAL
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: lucas.ren...@aqm-online.com
  Target Milestone: ---

Created attachment 36093
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36093&action=edit
Stacktrace

Hello,

I have a piece of code that I use to merge one excel sheet into a target
Workbook. The code used is pretty much coming from the following resource:
www.coderanch.com/t/420958/open-source/Copying-sheet-excel-file-excel.

While merging, an error is thrown by POI ContentTypeManage at:

if (this.container != null && this.container.getPart(partName) != null) {
                        throw new OpenXML4JRuntimeException(
                                        "Rule M2.4 exception : this error
should NEVER happen! If you can provide the triggering file, then please raise
a bug at https://bz.apache.org/bugzilla/enter_bug.cgi?product=POI and attach
the file that triggers it, thanks!");
                }

I tried to downsize the excel files used in my case, and I end up with the
files attached:

- targetWorkbook.xlsm which will receive the copy of the sheet. This workbook
contains a button (no macro attached anymore) and a picture.
- sheetToMerge.xlsx which contains the data to be copied in the target
Workbook. This sheet at the time being contains only one picture.

Now, the code will work under any of the following conditions:

- Remove the button from the targetWorkbook
- Remove the image from the targetWorkbook
- Remove the image from the sheetToMerge

I have dug a bit in the code, and also checked the [Content_Types].xml files
for all these workbooks, with no luck till now.

I attach the stacktrace, the code, and 2 files triggering the error.

PS: I am aware of the bug 62522; but I have reduced the files and the test case
used to trigger the bug, and i believe that the premise of the bug opening was
wrong. This bug is not solved if, i/o a jpg and a jpeg, I have two jpg, or two
jpeg. Plus, the error is not triggered if the button is removed, but still we
have both jpg and jpeg.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to