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 26419 - [Override Methods] SourceException is probably not annotated well
Summary: [Override Methods] SourceException is probably not annotated well
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 3.x
Hardware: All All
: P1 blocker (vote)
Assignee: issues@java
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2002-08-09 14:45 UTC by Jan Becicka
Modified: 2007-09-26 09:14 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch for release35 branch (1.52 KB, patch)
2003-04-14 16:18 UTC, Tomas Hurka
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Becicka 2002-08-09 14:45:59 UTC
Invoke Override Method tool.
Try to add the same method twice: "Unexpected
Exception" warning appears instead of "A method
named "..." is already present in the class"

SourceException is not probably annotated well?
Or is this bug a problem of ErrorManager?
Comment 1 Tomas Hurka 2002-08-13 18:42:59 UTC
Fixed in trunk. Severity was changed from EXCEPTION to USER.
Comment 2 Jan Becicka 2002-10-11 17:26:32 UTC
Verified
Comment 3 Jan Becicka 2003-04-10 08:22:37 UTC
Probably somehow related to issue 31254 and issue 30947.
Comment 4 Jan Becicka 2003-04-10 11:28:34 UTC
It is regression. Should be fixed for 3.5.
Comment 5 Tomas Hurka 2003-04-10 13:02:03 UTC
I guess Honza is right, this related to issue 31254 and issue 30947. No changes in the code in Java module, Exception is annotated with USER severity. 
See java/src/org/netbeans/modules/java/tools/OverridePanelBase.java
Version 1.13
Comment 6 Jesse Glick 2003-04-10 15:17:59 UTC
I am looking at it. Can reproduce in trunk.
Comment 7 Jesse Glick 2003-04-10 15:26:18 UTC
Relevant stack trace for example:

org.openide.src.SourceException: A method named "addComponentListener"
is already present in the class.
	at
org.netbeans.modules.java.tools.OverrideActionPanel.throwAddException(OverrideActionPanel.java:78)
	at
org.netbeans.modules.java.tools.OverrideActionPanel.overrideMethod(OverrideActionPanel.java:64)
[catch] at
org.netbeans.modules.java.tools.OverridePanelBase.overrideSelectedMethods(OverridePanelBase.java:292)

The bug is in OverrideActionPanel.throwAddException. It does not give
the exception a localized annotation. The detail message happens to
come from a bundle, but message == localizedMessage and there is no
ErrorManager-annotated localized message. So ErrorManager has no way
of knowing that there is a human-displayable message; it assumes that
there is none, and therefore displays a generic exception dialog
suited to unexpected exceptions.

Recommended code would be like:

private void throwAddException(MethodElement m) throws SourceException {
    SourceException e = new SourceException("Adding dupe: " +
m.getName().getName()); // NOI18N
    ErrorManager.getDefault().annotate(e,
NbBundle.getMessage(OverrideActionPanel.class, "FMT_METHOD_PRESENT",
m.getName().getName()));
    throw e;
}	
Comment 8 Tomas Hurka 2003-04-14 15:36:52 UTC
Fixed in trunk
Checking in OverrideActionPanel.java;
/cvs/java/src/org/netbeans/modules/java/tools/OverrideActionPanel.java,v  <--  OverrideActionPanel.java
new revision: 1.5; previous revision: 1.4
done
Comment 9 Tomas Zezula 2003-04-14 16:11:45 UTC
Reviewed the patch, it is OK to fix the issue and it does 
not affect any other functionality.
Comment 10 Tomas Hurka 2003-04-14 16:18:59 UTC
Created attachment 9922 [details]
Patch for release35 branch
Comment 11 Jan Becicka 2003-04-14 17:11:25 UTC
Fix verified on continuous build 20030414-1639
Comment 12 _ ttran 2003-04-18 09:49:58 UTC
approved for 3.5
Comment 13 Tomas Hurka 2003-04-18 12:36:50 UTC
Fixed in release35 branch.
Checking in OverrideActionPanel.java;
/cvs/java/src/org/netbeans/modules/java/tools/OverrideActionPanel.java,v  <--  OverrideActionPanel.java
new revision: 1.4.44.1; previous revision: 1.4
done
Comment 14 Jan Becicka 2003-05-05 11:07:33 UTC
VERIFIED