diff --git a/tasklist.ui/src/org/netbeans/modules/tasklist/impl/FileScanningWorker.java b/tasklist.ui/src/org/netbeans/modules/tasklist/impl/FileScanningWorker.java --- a/tasklist.ui/src/org/netbeans/modules/tasklist/impl/FileScanningWorker.java +++ b/tasklist.ui/src/org/netbeans/modules/tasklist/impl/FileScanningWorker.java @@ -64,7 +64,7 @@ * * @author S. Aubrecht */ -class FileScanningWorker implements Runnable { +public class FileScanningWorker implements Runnable { private TaskList taskList; private boolean isCancel = false; @@ -168,43 +168,48 @@ public void run() { synchronized( SLEEP_LOCK ) { while( true ) { + try { - if( killed ) { - return; - } - - Set scannersToNotify = null; - ScanItem item = new ScanItem(); - ScanMonitor monitor = ScanMonitor.getDefault(); - while( true ) { - monitor.waitEnabled(); - synchronized( SCAN_LOCK ) { - if( getNext( item ) ) { - if( !scan( item ) ) { + if( killed ) { + return; + } + + Set scannersToNotify = null; + ScanItem item = new ScanItem(); + ScanMonitor monitor = ScanMonitor.getDefault(); + while( true ) { + monitor.waitEnabled(); + synchronized( SCAN_LOCK ) { + if( getNext( item ) ) { + if( !scan( item ) ) { + isCancel = true; + } + } else { isCancel = true; } - } else { - isCancel = true; + if( isCancel ) { + scannersToNotify = new HashSet( preparedScanners ); + } } + if( isCancel ) { - scannersToNotify = new HashSet( preparedScanners ); + break; } } - if( isCancel ) { - break; + cleanUp( scannersToNotify ); + + try { + SLEEP_LOCK.wait(); + } catch( InterruptedException e ) { + //ignore } - } - - cleanUp( scannersToNotify ); - - try { - SLEEP_LOCK.wait(); - } catch( InterruptedException e ) { - //ignore + } catch (Exception e) { + Exceptions.printStackTrace(e); } } } + } private void wakeup() { @@ -253,7 +258,9 @@ //don't let uncaught exceptions break the thread synchronization Exceptions.printStackTrace( e ); } + if (newTasks != null) { scannedTasks.addAll( newTasks ); + } if( isCancel ) { return false;