Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 205708 Details for
Bug 347557
[Edit] NPE when saving a file in a compare editor (always)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fixing NPE with tests
patch_347557_reopen1.txt (text/plain), 4.24 KB, created by
Malgorzata Janczarska
on 2011-10-21 07:05:46 EDT
(
hide
)
Description:
Fixing NPE with tests
Filename:
MIME Type:
Creator:
Malgorzata Janczarska
Created:
2011-10-21 07:05:46 EDT
Size:
4.24 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java >index fb839b4..afa44be 100644 >--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java >+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java >@@ -248,10 +248,10 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison > */ > public String getName() { > // Return the name of the file element as held in the compare input >- if (input.getLeft().equals(fileElement)) { >+ if (input.getLeft() != null && input.getLeft().equals(fileElement)) { > return input.getLeft().getName(); > } >- if (input.getRight().equals(fileElement)) { >+ if (input.getRight() != null && input.getRight().equals(fileElement)) { > return input.getRight().getName(); > } > // Fallback call returning name of the main non-null element of the input >@@ -289,14 +289,15 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison > > ContentMergeViewer cmv = (ContentMergeViewer) e.getSource(); > >- if (input.getLeft().equals(fileElement)) { >+ if (input.getLeft() != null && input.getLeft().equals(fileElement)) { > if (changed && cmv.internalIsLeftDirty()) > setDirty(changed); > else if (!changed && !cmv.internalIsLeftDirty()) { > setDirty(changed); > } > } >- if (input.getRight().equals(fileElement)) { >+ if (input.getRight() != null >+ && input.getRight().equals(fileElement)) { > if (changed && cmv.internalIsRightDirty()) > setDirty(changed); > else if (!changed && !cmv.internalIsRightDirty()) { >diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java >index f8d1add..bd53f5b 100644 >--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java >+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java >@@ -272,4 +272,56 @@ public class SaveableCompareEditorInputTest extends TeamTest { > * handled, see javadoc to SaveableCompareEditorInput. > */ > } >+ >+ public void testDirtyFlagOnLocalResourceTypedElementAndEmptyRight() >+ throws CoreException, InvocationTargetException, >+ InterruptedException, IllegalArgumentException, SecurityException, >+ IllegalAccessException, NoSuchFieldException, >+ NoSuchMethodException, IOException { >+ >+ // Create left element by SaveableCompareEditorInput to be properly >+ // saved, see javadoc to SaveableCompareEditorInput >+ LocalResourceTypedElement el1 = (LocalResourceTypedElement) SaveableCompareEditorInput >+ .createFileElement(file1); >+ ITypedElement el2 = null; >+ >+ CompareConfiguration conf = new CompareConfiguration(); >+ conf.setLeftEditable(true); >+ TestSaveableEditorInput compareEditorInput = new TestSaveableEditorInput( >+ el1, el2, conf); >+ >+ compareEditorInput.prepareCompareInput(null); >+ >+ verifyDirtyStateChanges(compareEditorInput); >+ >+ // check whether file was saved >+ >+ assertTrue(compareContent(new ByteArrayInputStream( >+ (fileContents1 + appendFileContents).getBytes()), >+ file1.getContents())); >+ } >+ >+ public void testDirtyFlagOnCustomTypedElementAndEmptyRight() >+ throws CoreException, InvocationTargetException, >+ InterruptedException, IllegalArgumentException, SecurityException, >+ IllegalAccessException, NoSuchFieldException, >+ NoSuchMethodException, IOException { >+ >+ ITypedElement el1 = new TestFileElement(file1); >+ ITypedElement el2 = null; >+ >+ CompareConfiguration conf = new CompareConfiguration(); >+ conf.setLeftEditable(true); >+ TestSaveableEditorInput compareEditorInput = new TestSaveableEditorInput( >+ el1, el2, conf); >+ >+ compareEditorInput.prepareCompareInput(null); >+ >+ verifyDirtyStateChanges(compareEditorInput); >+ >+ /* >+ * not checking if changes were saved because in this case saving is not >+ * handled, see javadoc to SaveableCompareEditorInput. >+ */ >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 347557
:
201902
|
201906
|
204202
|
204452
|
204457
|
204502
|
204754
|
204957
|
205359
|
205361
|
205407
| 205708