This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 241444

Summary: ORG.NETBEANS.JARCLASSLOADER CLEARS THREAD'S INTERRUPTED STATE
Product: platform Reporter: mark.warner
Component: NetigsoAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: normal CC: tpavek
Priority: P2 Keywords: NO80
Version: 8.0   
Hardware: PC   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description mark.warner 2014-02-05 13:49:22 UTC
Problem Description:
--------------------
I'm trying to work on making one of our long running tasks cancellable. I have hit a problem with the netbeans classloader code.

If the current Thread is interrupted before (or while) JarClassLoader is used (in our case because we're using the bean Introspector on some classes) then it will no longer be interrupted when JarClassLoader has finished.

Error-Stack Obtained / Diagnostic Analysis:
-------------------------------------------
The cause would seem to be a catch( InterruptedException ) in org.netbeans.JarClassLoader which doesn't re-throw, and doesn't ensure Thread.currentThread().interrupt().

I found this one example, but I'm guessing there may be others in the netbeans classloader code.

The code base should be checked to ensure that InterruptedException is dealt with properly (i.e. at least call Thread.currentThread.interrupt() if not handling it.

http://www.ibm.com/developerworks/java/library/j-jtp05236/index.html
Comment 1 Jaroslav Tulach 2014-03-31 08:06:01 UTC
I see one method that deals with interrupts in JarClassLoader. Here is the attempt to propagate the state:

changeset:   http://hg.netbeans.org/ergonomics/rev/41bd41fea39e
tag:         tip
parent:      35b2705af4c1
user:        Jaroslav Tulach <jtulach@netbeans.org>
date:        Mon Mar 31 10:01:19 2014 +0200
summary:     #241444: Propagate interrupted state
Comment 2 Quality Engineering 2014-04-02 01:38:57 UTC
Integrated into 'main-silver', will be available in build *201404020001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/41bd41fea39e
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #241444: Propagate interrupted state