Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362677 - Throwing VetoException("abc") when starting SwingApplication leads to NullPointerException
Summary: Throwing VetoException("abc") when starting SwingApplication leads to NullPoi...
Status: CLOSED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Scout (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Stephan Merkli CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-02 10:26 EDT by Michael Schaufelberger CLA
Modified: 2021-08-19 11:08 EDT (History)
2 users (show)

See Also:


Attachments
Patch that removes the unnecessary (and "fatal") statement on line 189 of ErrorHandler. (692 bytes, application/octet-stream)
2011-11-02 10:26 EDT, Michael Schaufelberger CLA
no flags Details

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