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 2020/03/28 01:03:50 UTC

[Bug 64274] New: ExtractorFactory#createExtractor shall throw POIXMLException

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

            Bug ID: 64274
           Summary: ExtractorFactory#createExtractor shall throw
                    POIXMLException
           Product: POI
           Version: 4.1.x-dev
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POI Overall
          Assignee: dev@poi.apache.org
          Reporter: zhonghao@pku.org.cn
  Target Milestone: ---

When OOXML file is invalid,
org.apache.poi.ooxml.extractor.ExtractorFactory#createExtractor throws
IllegalArgumentException:

 public static POITextExtractor createExtractor(OPCPackage pkg) throws
IOException, OpenXML4JException, XmlException {
   ...
 if (core.size() != 1) {
      throw new IllegalArgumentException("Invalid OOXML Package received -
expected 1 core document, found " + core.size());
            }
 }

POI already implements POIXMLException for this type of problem. Other methods
all throw this exception:

org.apache.poi.ooxml.POIXMLDocumentPart.RelationPart#getPartFromOPCPackage

org.apache.poi.ooxml.POIXMLDocumentPart.RelationPart#getPartFromOPCPackage

org.apache.poi.xssf.eventusermodel.XSSFReader#XSSFReader

Please update the exception of createExtractor, so it is easier to catch this
type of problems.

-- 
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 64274] ExtractorFactory#createExtractor shall throw POIXMLException

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
                 OS|                            |All

-- 
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 64274] ExtractorFactory#createExtractor shall throw POIXMLException

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

Andreas Beeker <ki...@apache.org> changed:

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

--- Comment #1 from Andreas Beeker <ki...@apache.org> ---
I've reworked the Extractor API for POI 5.0 and the main entry point is now in
the main package (org.apache.poi.extractor.ExtractorFactory), which doesn't
know about POIXMLException. It only declares a IOException and - if I don't
missed something - this wraps all un-/checked exceptions.

So if the source exception is important to you, please inspect the exception
cause.

POIXMLException is anyway a runtime exception - probably because of laziness -
and we usually don't declare those.

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