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 2016/12/22 14:55:14 UTC

[Bug 60512] New: Missing XSSFRelation.CUSTOM_PROPERTY generates POIXMLException on cloneSheet() method

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

            Bug ID: 60512
           Summary: Missing XSSFRelation.CUSTOM_PROPERTY generates
                    POIXMLException on cloneSheet() method
           Product: POI
           Version: 3.15-FINAL
          Hardware: PC
            Status: NEW
          Severity: regression
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: samsontesfay@tagetik.com
  Target Milestone: ---

The XSSFRelation doesn't have a relation of type Custom property. Hence while
cloning a sheet (XSSFSheet) containing a custom property relation type, it
generates an exception 

POIXMLException: Can't clone sheet - unknown relation type found:
http://schemas.openxmlformats.org/officeDocument/2006/relationships/customProperty

(XSSFWorkbook.java)

 private static void addRelation(RelationPart rp, POIXMLDocumentPart target) {
        PackageRelationship rel = rp.getRelationship();
        if (rel.getTargetMode() == TargetMode.EXTERNAL) {
            target.getPackagePart().addRelationship(
                rel.getTargetURI(), rel.getTargetMode(),
rel.getRelationshipType(), rel.getId());
        } else {        
            XSSFRelation xssfRel =
XSSFRelation.getInstance(rel.getRelationshipType());
            if (xssfRel == null) {
                // Don't copy all relations blindly, but only the ones we know
about
                throw new POIXMLException("Can't clone sheet - unknown relation
type found: "+rel.getRelationshipType());
            }
            target.addRelation(rel.getId(), xssfRel, rp.getDocumentPart());
        }
    }

You can find more infos here:
http://people.apache.org/~centic/poi_regression/reportsAll/

-- 
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 60512] Missing XSSFRelation.CUSTOM_PROPERTY generates POIXMLException on cloneSheet() method

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

Javen O'Neal <on...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |60742


Referenced Bugs:

https://bz.apache.org/bugzilla/show_bug.cgi?id=60742
[Bug 60742] Build fail on Windows (resolution patch)
-- 
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 60512] Missing XSSFRelation.CUSTOM_PROPERTY generates POIXMLException on cloneSheet() method

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

Lapo Cioni <la...@tagetik.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lapocioni@tagetik.com,
                   |                            |lucamartini@tagetik.com

-- 
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 60512] Missing XSSFRelation.CUSTOM_PROPERTY generates POIXMLException on cloneSheet() method

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

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

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

--- Comment #4 from Dominik Stadler <do...@gmx.at> ---
Applied via r1776606, thanks for the suggested patch.

-- 
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 60512] Missing XSSFRelation.CUSTOM_PROPERTY generates POIXMLException on cloneSheet() method

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

--- Comment #3 from samson <sa...@tagetik.com> ---
Created attachment 34570
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34570&action=edit
TestCloneSheetWithCustomProperty

Here I have attached a sample excel file which contains a custom property (i.e.
raises an exception when the contained sheet is to be cloned).

-- 
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 60512] Missing XSSFRelation.CUSTOM_PROPERTY generates POIXMLException on cloneSheet() method

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

Javen O'Neal <on...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #2 from Javen O'Neal <on...@apache.org> ---
Can you attch a sample workbook with a custom relation so that we can write a
unit test for this?
Code that adds a custom relation to a blank workbook works too.

-- 
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 60512] Missing XSSFRelation.CUSTOM_PROPERTY generates POIXMLException on cloneSheet() method

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

samson <sa...@tagetik.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from samson <sa...@tagetik.com> ---
A possible fix: add a new XSSFRelation (XSSFRelation.java)


    public static final XSSFRelation CUSTOM_PROPERTIES = new XSSFRelation(
               
"application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty",
           
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customProperty",
            "/xl/customProperty#.bin",
            null
        );

-- 
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