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 - Unable to manually handle ExecutionException from all methods in ProgressUtils except showProgressDialogAndRunLater
Summary: Unable to manually handle ExecutionException from all methods in ProgressUtil...
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Progress (show other bugs)
Version: 8.0.2
Hardware: All All
: P3 normal (vote)
Assignee: Jan Peska
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-02 20:08 UTC by SirIntellegence
Modified: 2015-03-04 17:34 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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);
}