Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaxsun McCarthy Huggan2016-06-29 17:25:19 -0400
committerJaxsun McCarthy Huggan2016-06-29 18:26:21 -0400
commit64581dad7e5069b01e4673d94a33cbf3433fb9ba (patch)
tree855eaeb479ca25c5d995a17d7db436013fa757bb /org.eclipse.mylyn.tasks.core/src
parent9bae474b5ca41efbcdae3085e79441d0ab5660d2 (diff)
downloadorg.eclipse.mylyn.tasks-64581dad7e5069b01e4673d94a33cbf3433fb9ba.tar.gz
org.eclipse.mylyn.tasks-64581dad7e5069b01e4673d94a33cbf3433fb9ba.tar.xz
org.eclipse.mylyn.tasks-64581dad7e5069b01e4673d94a33cbf3433fb9ba.zip
497040: fix overzealous recording of task list xml orphans
Fixes an issue where all task list elements after the first encountered orphans would be recorded as orphans. This lead to duplication of task list elements on read/write round trips. Change-Id: I7176eb4fda0ede6459ec1d7cf2dd0c78adec1c98 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=497040
Diffstat (limited to 'org.eclipse.mylyn.tasks.core/src')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/SaxOrphanBuilder.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/SaxOrphanBuilder.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/SaxOrphanBuilder.java
index 5a9228f31..13dac579d 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/SaxOrphanBuilder.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/SaxOrphanBuilder.java
@@ -33,8 +33,11 @@ public class SaxOrphanBuilder {
private StringBuilder currentStringContent;
+ private final Element orphansElement;
+
public SaxOrphanBuilder() throws CoreException {
this.document = createDocument();
+ this.orphansElement = document.getDocumentElement();
}
private Document createDocument() throws CoreException {
@@ -79,11 +82,13 @@ public class SaxOrphanBuilder {
if (currentElement != null) {
appendTextNode();
Node parentNode = currentElement.getParentNode();
- if (parentNode instanceof Element) {
+ // do not set the current element to be the orphans element or all tasks will end up as orphans
+ if (parentNode instanceof Element && parentNode != orphansElement) {
currentElement = (Element) parentNode;
currentStringContent = new StringBuilder();
} else {
currentElement = null;
+ currentStringContent = null;
}
}
}

Back to the top