You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2018/08/16 10:32:44 UTC

[Bug 62629] New: Reaching a Rule M2.4 exception when trying to merge two files

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.renaud@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-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62629] Reaching a Rule M2.4 exception when trying to merge two files

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62629

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Scull.sarah@gmail.com

--- Comment #5 from Dominik Stadler <do...@gmx.at> ---
*** Bug 58917 has been marked as a duplicate of this bug. ***

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


[Bug 62629] Reaching a Rule M2.4 exception when trying to merge two files

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62629

--- Comment #2 from Lucas <lu...@aqm-online.com> ---
Created attachment 36095
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36095&action=edit
The sheet to merge to trigger error

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


[Bug 62629] Reaching a Rule M2.4 exception when trying to merge two files

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62629

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #4 from Dominik Stadler <do...@gmx.at> ---
The problem is in the two source files, one has default content-type for
extension "jpg", the other for "jpeg". 

It seems the application which produces these files is not creating fully
standard-conforming files.

one file:
<Default Extension="jpeg" ContentType="image/jpeg"/>

other file:
<Default Extension="jpg" ContentType="image/jpeg"/>

We now gracefully handle such situations with r1849814, but such files might
cause other issues in LibreOffice or Excel.

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


[Bug 62629] Reaching a Rule M2.4 exception when trying to merge two files

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62629

--- Comment #3 from Lucas <lu...@aqm-online.com> ---
Created attachment 36096
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36096&action=edit
The target workbook to trigger the error

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


[Bug 62629] Reaching a Rule M2.4 exception when trying to merge two files

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62629

--- Comment #1 from Lucas <lu...@aqm-online.com> ---
Created attachment 36094
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36094&action=edit
The java class used for merging the 2 workbook

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