poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Burch <apa...@gagravarr.org>
Subject Re: Why OPCPackage cannot be extend?
Date Mon, 11 Nov 2013 23:07:33 GMT
On Wed, 30 Oct 2013, Angelo zerr wrote:
> So I have tried to extends OPCPackage by creating MyZipPackage (like you
> have done with your ZipPackage). But I cannot do that because of this code:
>
> -----------------------------------------------------
>
> OPCPackage(PackageAccess access) {
>  if (getClass() != ZipPackage.class) {
>    throw new IllegalArgumentException("PackageBase may not be subclassed");
>  }
>  init();
>  this.packageAccess = access;
> }

The OPC code all came from the OpenXML4J project, which merged into Apache 
POI a few years ago.

When we came to start adding OpenXML support to POI, we depended on then 
later collaborated with the OpenXML4J project for the low level OPC 
support. At some point after that, the OpenXML4J project decided to join 
with POI, and that code came over

For the specific answer on why that restriction is there, I can't answer, 
as it's based on a decision made before the code came to POI. My hunch is 
that there are some deep baked assumptions in other parts of the OPC code 
which could be broken if things weren't backed by a ZipPackage

Given that, there might well be a way we could allow you to pass in your 
already open zip file, without breaking the assumptions elsewhere in the 
code. Could you clarify what kind of object(s) you already have open?

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message