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 11960 - Need to be able to return two different messages from UserQuestionException
Summary: Need to be able to return two different messages from UserQuestionException
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: All Other
: P2 blocker (vote)
Assignee: rmatous
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-05-05 05:49 UTC by Sophie Deng
Modified: 2008-12-22 23:26 UTC (History)
2 users (show)

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 Sophie Deng 2001-05-05 05:49:05 UTC
My module is a filesystem module, it uses UserQuestionException to handle user 
confirmation in lock(). This exception should have two descriptions, one to 
confirm the action and the other to notify the exception when the lock()cannot 
be done. Currently there is no way to attach two different messages to the 
exception. A workaroud is to use the ErrorManger.annotate to add the second 
message as a localized message. However this rely on all the components which 
call lock() to implement the workaround. Instead of relying on the workaround, 
a proper API should be implemented. VCS module has the same problem.
Comment 1 Jan Chalupa 2001-05-06 08:11:15 UTC
Target milestone -> 3.3
Comment 2 Jesse Glick 2001-05-07 17:47:48 UTC
API changes are enhancements, too late for 3.2.
Comment 3 Jesse Glick 2001-05-09 10:35:06 UTC
Filed against 3.2 originally.
Comment 4 Jan Chalupa 2001-11-27 13:02:44 UTC
Target milestone -> 3.3.1.
Comment 5 Marek Grummich 2002-07-22 11:24:43 UTC
Set target milestone to TBD
Comment 6 Marek Grummich 2002-07-22 11:27:35 UTC
Set target milestone to TBD
Comment 7 rmatous 2002-07-23 13:10:37 UTC
I`m not sure If I understand correctly. Impl. of UserQuestionException
expects to redefine method confirm that fires IOException (so
IOException with arbitrary message can be fired). And if lock fails
then doesn`t need to be fired UserQuestionException at all (suffices
IOException) or new UserQuestionException with arbitrary message
again. I`m confused. Moreover UserQuestionException is used only in
VcsFileSystem and this usage seems to me that has sense. So, will be
closed as WONTFIX, but if anybody can make it clear, then don`t
hasitate do it and perhaps reopen.
Comment 8 Rochelle Raccah 2002-07-23 19:21:40 UTC
I'm writing non-VCS code and was given this workaround to do in my
data node to handle readonly files because of the need to checkout
challenge:
try
{
	getDataObject().setModified(modified);
}
// workaround for bugzilla bug 11960
catch (final UserQuestionException uqe)
{
	// This will popup the "do you want to check out" 
	// dialog for TW and a proper message for CVS
	SwingUtilities.invokeLater(new Runnable ()
	{
		public void run ()
		{
			String message = uqe.getLocalizedMessage();

			if (Util.checkForWarning(message))
			{
				try
				{
					uqe.confirmed();
				}
				catch (IOException ioe)
				{
					Util.showError(ioe);
				}
			}
		}
	});
}
// end workaround
catch (IOException e)
{
	throw new PropertyVetoException(e.getMessage(), event);
}
Comment 9 Rochelle Raccah 2003-07-09 00:35:55 UTC
Please address what should be done instead of the code sample
provided.
Comment 10 rmatous 2005-04-22 10:03:46 UTC
From my point of view:
1/ UserQuestionException shouldn't have been used in fs API at all
2/ there is no fs implementation (except VCSFileSystem) that throws this
exception (maybe should be changed - because its unpleasant to catch everywhere)
3/ there are actually 2 messages in UserQuestionException - first one is obvious
- second one is part of IOException fired from confirm method.
Comment 11 Rochelle Raccah 2005-04-29 02:56:07 UTC
As I asked before, how should my code be changed?