[
http://issues.ops4j.org/browse/PAXSB-33?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13474#action_13474
]
Charles Moulliard commented on PAXSB-33:
----------------------------------------
Hi
I would like to know if the class patched will also be included in pax Url Wrap
bundle (1.1.3) used by Apache Karaf/ServiceMix ?
Regards,
Charles
> avoid throwing exception from BndUtils.createInputStream Thread
> ---------------------------------------------------------------
>
> Key: PAXSB-33
> URL: http://issues.ops4j.org/browse/PAXSB-33
> Project: Pax Swissbox
> Issue Type: Improvement
> Components: bnd
> Affects Versions: 1.2.0
> Reporter: Freeman Fang
> Assignee: Freeman Fang
> Fix For: 1.3.0
>
> Attachments: PAXSB-33.patch
>
>
> the BndUtils.createInputStream method start a thread to generate a
> PipedInputStream, in this thread, it will throw RuntimeException like
> {code}
> new Thread()
> {
> public void run()
> {
> try
> {
> jar.write( pout );
> }
> catch( IOException e )
> {
> throw new RuntimeException( "Bundle cannot be generated",
> e );
> }
> {code}
> if something wrong when read/write stream
> But the exception thrown from the thread can't be caught and handled by a
> caller thread which invoke BndUtils.createInputStream method.
> Consider this scenario, if in my code use BndUtils.createInputStream to get a
> InputStream, and I close this InputStream very soon(for example I just check
> the jar manifest and found it's an installed bundle so I needn't read the
> bunlde jar completely), then the code jar.write(pout) in thread will throw
> exception like
> Exception in thread "Thread-30" java.lang.RuntimeException: Bundle cannot be
> generated
> at org.ops4j.pax.swissbox.bnd.BndUtils$1.run(BndUtils.java:171)
> Caused by: java.io.IOException: Pipe closed
> at
> java.io.PipedInputStream.checkStateForReceive(PipedInputStream.java:190)
> at java.io.PipedInputStream.receive(PipedInputStream.java:156)
> at java.io.PipedOutputStream.write(PipedOutputStream.java:129)
> at
> java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:161)
> at java.util.zip.ZipOutputStream.closeEntry(ZipOutputStream.java:184)
> at aQute.lib.osgi.Jar.writeResource(Jar.java:301)
> at aQute.lib.osgi.Jar.write(Jar.java:211)
> at org.ops4j.pax.swissbox.bnd.BndUtils$1.run(BndUtils.java:167)
> as the InputStream already get closed but the jar file is not EOF(end of
> file), and the exception thrown here can't be caught by my code, as it's
> thrown from another thread.
> In this case, although the exception is harmless, it's a little bit noisy.
> I suggest use LOG but not throw new RuntimeException( "Bundle cannot be
> generated", e ); to avoid the noisy useless exception
> Thoughts?
> Thanks
> Freeman
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.ops4j.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general