Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 362677

Summary: Throwing VetoException("abc") when starting SwingApplication leads to NullPointerException
Product: z_Archived Reporter: Michael Schaufelberger <bsi.msa>
Component: ScoutAssignee: Stephan Merkli <stephan.merkli>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Andreas.Hoegger, stephan.merkli
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch that removes the unnecessary (and "fatal") statement on line 189 of ErrorHandler. none

Description Michael Schaufelberger CLA 2011-11-02 10:26:43 EDT
Created attachment 206334 [details]
Patch that removes the unnecessary (and "fatal") statement on line 189 of ErrorHandler.

If you throw a VetoException without a title during start up of an AbstractSwingApplication (e.g. to deny access to a user which tries to log in) the application will crash with a NullPointerException.

The NullPointerException occurs because in AbstractSwingApplication:200 (showLoadError) handler.getText() is null.

The reason why the text is null is because in ErrorHandler:189 it is set to null if the VetoException has no title. Actually at this point the text (m_text) is already set to ScoutTexts.get("Error") (see lines 99 to 102 at the beginning of the parse method) and will now become null.

Attached is a patch that removes the unnecessary (and "fatal") statement on line 189 of ErrorHandler.

It may also be reasonable to handle the "null" case in AbstractSwingApplication:200 - this is left up to you.
Comment 1 Andreas Hoegger CLA 2015-04-13 10:51:59 EDT
obsolete since swing got legacy.