Bug 211350 - [ErrorHandling] Need better error handling in PerspectiveRegistry
Summary: [ErrorHandling] Need better error handling in PerspectiveRegistry
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M5   Edit
Assignee: Krzysztof Daniel CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2007-11-28 18:27 EST by Raji Akella CLA
Modified: 2008-12-19 06:53 EST (History)
3 users (show)

See Also:


Attachments
Part one of solution (5.10 KB, patch)
2008-12-17 07:45 EST, Krzysztof Daniel CLA
no flags Details | Diff
PatchToBeReleasedSoon (6.28 KB, patch)
2008-12-18 09:40 EST, Krzysztof Daniel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Raji Akella CLA 2007-11-28 18:27:29 EST
Build ID: 3.2.2


In org.eclipse.ui.workbench plugin / org.eclipse.ui.internal.registry.PerspectiveRegistry, the loadCustom method has three problems :

1) If the xmlString is empty, as is happening in our product, reader = null, and the call to XMLMementor.createReadRoot(reader) fails because the reader = null
2) If the first perspective is found, reader will be set up. If the second perspective is not found (such as because of the problem in 1), then reader will still have a value, but it will be referencing a closed stream.
3) There is no information logged to the error log that will help to identify any problem -- all that is displayed is a dialog message
Comment 1 Pavel Halas CLA 2008-03-12 08:55:20 EDT
(1) applies to PerspectiveRegistry.getCustomPersp(String) too.
Comment 2 Raji Akella CLA 2008-05-08 13:41:10 EDT
Is there a fix fr this in 3.4?
Comment 3 Tod Creasey CLA 2008-05-08 13:53:35 EDT
No there is not currently.
Comment 4 Krzysztof Daniel CLA 2008-12-16 10:15:24 EST
Raji, Pavel,

could you place here reproduction steps? I'd like to create a fix :-)
Comment 5 Pavel Halas CLA 2008-12-17 05:33:48 EST
The first point problem occurs by calling a code like this...

try {
        PerspectiveRegistry perspRegistry = (PerspectiveRegistry) PlatformUI.getWorkbench().getPerspectiveRegistry();
        perspRegistry.getCustomPersp("SomeNonexistingPerspective");
} catch (Exception e) {
        e.printStackTrace();
}


Internally causes calling this with reader == null...
XMLMemento memento = XMLMemento.createReadRoot(reader);

Hope this helps.
Comment 6 Krzysztof Daniel CLA 2008-12-17 07:45:47 EST
Created attachment 120686 [details]
Part one of solution

Kevin,

can I take this bug?

This patch addresses concern 1 & 2 in the bug description and comment 1.
Guys, is it what you expect?

Patch for concern 3 will be created soon.
Comment 7 Pavel Halas CLA 2008-12-17 08:38:24 EST
> Guys, is it what you expect?
> 
> Patch for concern 3 will be created soon.
> 

Seems fine to me. Thanks.
Comment 8 Raji Akella CLA 2008-12-17 09:39:26 EST
Christopher, thanks. Looks fine.
Comment 9 Krzysztof Daniel CLA 2008-12-18 09:40:29 EST
Created attachment 120833 [details]
PatchToBeReleasedSoon
Comment 10 Krzysztof Daniel CLA 2008-12-19 06:51:56 EST
I'm taking this bug :-)
Comment 11 Krzysztof Daniel CLA 2008-12-19 06:53:34 EST
Slightly modified patch released to HEAD.