Bug 190822 - [Edit] SaveableCompareEditorInput.prepareInput throws NPE when prepareCompareInput returns null
Summary: [Edit] SaveableCompareEditorInput.prepareInput throws NPE when prepareCompare...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 3.3   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.3.1   Edit
Assignee: Michael Valenta CLA
QA Contact:
URL:
Whiteboard: hasPatch
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-06-04 10:49 EDT by Christophe Cornu CLA
Modified: 2007-08-29 08:41 EDT (History)
2 users (show)

See Also:


Attachments
Null check (1.03 KB, patch)
2007-06-25 08:53 EDT, Tomasz Zarna CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Cornu CLA 2007-06-04 10:49:16 EDT
We have exceptional cases when the action is enabled on two different files with different states but the content is identical. We only find out about that inside our SaveableCompareInput.prepareCompareInput(IProgressMonitor) implementation. In such case we return null.

SaveableCompareInput.prepareInput dereferences the input to set the title without checking if it is null. Could you set the title only if it isn't null and javadoc prepareCompareInput can return null?

The super type CompareEditorInput.prepareInput specs null is valid:

	 * If <code>null</code> is returned no differences were found and no compare editor needs to be opened.

Today we worked around it by not calling super.prepareInput

Imaging showing the history of a file and comparing any historical state with a local file. We need a server operation to decide if the contents are identical. In the common case, the compare editor shows up immediately - rapid UI feedback - and performs the fetch and comparison in the background. In some accidental cases the compare editor was not needed and the Eclipse dialog prompts the user. This seems like a good pattern.

What do you think?
Comment 1 Michael Valenta CLA 2007-06-04 10:51:38 EDT
Adding the null check is trivial. We will do so for 3.3.1.
Comment 2 Tomasz Zarna CLA 2007-06-25 08:53:27 EDT
Created attachment 72346 [details]
Null check
Comment 3 Michael Valenta CLA 2007-06-25 09:56:51 EDT
Patch released to HEAD. I will release it to 3.3.1 once Europa ships.
Comment 4 Michael Valenta CLA 2007-07-09 11:56:15 EDT
Patch released to 3.3.1.
Comment 5 Krzysztof Michalski CLA 2007-08-29 06:20:34 EDT
Verified.
Comment 6 Szymon Brandys CLA 2007-08-29 08:41:56 EDT
VERIFIED in M20070822-0800 and M1.