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 247655

Summary: Unable to manually handle ExecutionException from all methods in ProgressUtils except showProgressDialogAndRunLater
Product: platform Reporter: SirIntellegence
Component: ProgressAssignee: Jan Peska <JPESKA>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.0.2   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description SirIntellegence 2014-10-02 20:08:25 UTC
When a swing worker is done, you can catch ExecutionException and some others to do custom logic like:
try{
    saveworker.get();
    // show message "file saved"
}
catch (ExecutionException ee){
    //show message "save failed"
}
catch (InterruptedException | CancellationException e){
    //canceled
}
As far as I know, you cannot do this with ProgressUtils unless you get a Future<T> from showProgressDialogAndRunLater, which I may not want.  It is possible to work around this issue by wrapping the contents of the running code in a try/catch everything block, placing the throwable in some variable, and then handling it after.
Comment 1 Ondrej Vrabec 2015-03-04 14:58:49 UTC
i am afraid that would be an incompatible change, though i understand your request and that in this case the API is not very friendly.
Comment 2 SirIntellegence 2015-03-04 17:32:40 UTC
You could have the default implementation just wrap the original with the annotations on it without throwing anything.
Comment 3 SirIntellegence 2015-03-04 17:34:22 UTC
Like:
public abstract Foo bar(Baz bazen);

public Foo newBar(Baz bazen) throws ExecutionException, CancellationException{
    return bar(bazen);
}