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 212255 - PropertyEnv should not log PropertyVetoException
Summary: PropertyEnv should not log PropertyVetoException
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Explorer (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Tomas Pavek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-09 16:51 UTC by Tomas Pavek
Modified: 2012-05-16 11:15 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
suggested patch (1.24 KB, patch)
2012-05-10 10:02 UTC, Tomas Pavek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Pavek 2012-05-09 16:51:36 UTC
Property editors can register themselves on PropertyEnv instance and throw PropertyVetoException to prevent property dialog from closing when something is not entered correctly by the user. As a result, the dialog is not closed and the user gets a warning message box.

To show the simple warning dialog box the PropertyEnv calls PropertyDialogManager.notify which calls Exceptions.printStackTrace which logs the exception with SEVERE log level which then comes to NbErrorManager log handler and by some magic the SEVERE level is changed to WARNING so the proper dialog is shown to the user in the end.

The main problem I have with this is in JDeveloper where logging an exception does not lead to showing a nice warning dialog, SEVERE exception is handled as an IDE error and is given to the user in the Feedback Tool to report a bug. So all property editors that use this mechanism are broken.

Note that the purpose of all this in the PropertyEnv context is just to show the simple message dialog. The PropertyVetoException is only a means by which the property editor tells PropertyEnv about the error message. The exception itself has no value and should not be logged. (Besides the warning dialog in NB it also gets printed to console and appears in the log file, which is really pointless.)

So can we please make PropertyEnv.setState to just show the message box with the warning message from the PropertyVetoException? Thanks.
Comment 1 Tomas Pavek 2012-05-10 10:02:07 UTC
Created attachment 119267 [details]
suggested patch

The fix is easy. If you agree with it, I can integrate it.
Comment 2 Jaroslav Tulach 2012-05-14 15:10:35 UTC
I am not sure if the new method will work well when there is no localized message. 

Instead of calling getLocalizedMessage() you should probably call Exceptions.findLocalizedMessage.

I'd prefer to keep current code when there is no localized message and use the new one when a special localized message is found. Feel free to go on.
Comment 3 Tomas Pavek 2012-05-15 09:22:29 UTC
Kept the original logging if there is no explicit message.
http://hg.netbeans.org/jet-main/rev/4399256694cd
Comment 4 Quality Engineering 2012-05-16 11:15:16 UTC
Integrated into 'main-golden', will be available in build *201205160400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/4399256694cd
User: Tomas Pavek <tpavek@netbeans.org>
Log: #212255: simply show dialog with message from PropertyVetoException (if there is any message)