You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2009/04/28 10:49:30 UTC

[jira] Moved: (JCRCL-2) InputStream - stream closed in unpack() method

     [ https://issues.apache.org/jira/browse/JCRCL-2?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting moved JCR-2079 to JCRCL-2:
----------------------------------------

          Component/s:     (was: jackrabbit-classloader)
          Description: 
Hi there :)

I'm currently working with jackrabbit classloader component, and I've
discovered a bug I suppose ...

In ExpandingArchiveClassPathEntry class there is a method that is used
to unpack a JAR file - unpack() - then it calls a method unpackFile()
when it founds a file in processed archive.  

When it calls content.setProperty("jcr:data", ins);

the stream is not available for further processing in unpack() method,
I've created a little patch:

{code}
ByteArrayOutputStream tmpStream = new ByteArrayOutputStream();
try {
        IOUtils.copy(ins, tmpStream); // from commons-io
} catch (IOException e) {
        throw new RepositoryException(e);
}

....

content.setProperty("jcr:data", new
ByteArrayInputStream(tmpStream.toByteArray()));
{code}

now it works perfectly :)

PS: I'm using 1.5 version of jackrabbit classloader

Best regards,
Lukasz Grabski

  was:
Hi there :)

I'm currently working with jackrabbit classloader component, and I've
discovered a bug I suppose ...

In ExpandingArchiveClassPathEntry class there is a method that is used
to unpack a JAR file - unpack() - then it calls a method unpackFile()
when it founds a file in processed archive.  

When it calls content.setProperty("jcr:data", ins);

the stream is not available for further processing in unpack() method,
I've created a little patch:

ByteArrayOutputStream tmpStream = new ByteArrayOutputStream();
try {
        IOUtils.copy(ins, tmpStream); // from commons-io
} catch (IOException e) {
        throw new RepositoryException(e);
}

....

content.setProperty("jcr:data", new
ByteArrayInputStream(tmpStream.toByteArray()));

now it works perfectly :)

PS: I'm using 1.5 version of jackrabbit classloader

Best regards,
Lukasz Grabski

    Affects Version/s:     (was: 1.5.0)
             Workflow: no-reopen-closed, patch-avail  (was: jira)
                  Key: JCRCL-2  (was: JCR-2079)
              Project: Jackrabbit JCR Classloader  (was: Jackrabbit Content Repository)

> InputStream - stream closed in unpack() method
> ----------------------------------------------
>
>                 Key: JCRCL-2
>                 URL: https://issues.apache.org/jira/browse/JCRCL-2
>             Project: Jackrabbit JCR Classloader
>          Issue Type: Bug
>            Reporter: Lukasz Grabski
>
> Hi there :)
> I'm currently working with jackrabbit classloader component, and I've
> discovered a bug I suppose ...
> In ExpandingArchiveClassPathEntry class there is a method that is used
> to unpack a JAR file - unpack() - then it calls a method unpackFile()
> when it founds a file in processed archive.  
> When it calls content.setProperty("jcr:data", ins);
> the stream is not available for further processing in unpack() method,
> I've created a little patch:
> {code}
> ByteArrayOutputStream tmpStream = new ByteArrayOutputStream();
> try {
>         IOUtils.copy(ins, tmpStream); // from commons-io
> } catch (IOException e) {
>         throw new RepositoryException(e);
> }
> ....
> content.setProperty("jcr:data", new
> ByteArrayInputStream(tmpStream.toByteArray()));
> {code}
> now it works perfectly :)
> PS: I'm using 1.5 version of jackrabbit classloader
> Best regards,
> Lukasz Grabski

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.