Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2012-01-12 18:14:38 +0000
committerFrank Becker2012-01-12 18:14:38 +0000
commitc8345e59018b2b81dd2fe990cbd90b5eddac3db7 (patch)
treeb0c9c9d4d6361686d847b859bdba43dfdd1c44d5
parent53dd145cc529445f0ba9e3ef3a59d241d840469e (diff)
downloadorg.eclipse.mylyn.tasks-c8345e59018b2b81dd2fe990cbd90b5eddac3db7.tar.gz
org.eclipse.mylyn.tasks-c8345e59018b2b81dd2fe990cbd90b5eddac3db7.tar.xz
org.eclipse.mylyn.tasks-c8345e59018b2b81dd2fe990cbd90b5eddac3db7.zip
ASSIGNED - bug 367861: fields marked as incoming on Eclipse.org that had
no changes https://bugs.eclipse.org/bugs/show_bug.cgi?id=367861
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java10
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaRepositoryConnectorStandaloneTest.java14
2 files changed, 24 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
index da763ea94..28f4b6323 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
@@ -86,6 +86,8 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
private final SimpleDateFormat simpleFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); //$NON-NLS-1$
+ private boolean testFirstEmptyTag;
+
public SaxMultiBugReportContentHandler(TaskAttributeMapper mapper, TaskDataCollector collector,
Map<String, TaskData> taskDataMap, List<BugzillaCustomField> customFields,
BugzillaRepositoryConnector connector) {
@@ -116,6 +118,7 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
characters = new StringBuffer();
+ testFirstEmptyTag = true;
BugzillaAttribute tag = BugzillaAttribute.UNKNOWN;
if (localName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
return;
@@ -244,6 +247,13 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
}
String parsedText = characters.toString();
+ characters = new StringBuffer();
+ if (parsedText.equals("") && testFirstEmptyTag) { //$NON-NLS-1$
+ // do not continue for empty tags
+ testFirstEmptyTag = false;
+ return;
+ }
+ testFirstEmptyTag = false;
if (localName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
TaskAttribute endAttribute = repositoryTaskData.getRoot().getAttribute(localName);
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaRepositoryConnectorStandaloneTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaRepositoryConnectorStandaloneTest.java
index 5201c75b5..c0e873687 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaRepositoryConnectorStandaloneTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaRepositoryConnectorStandaloneTest.java
@@ -497,4 +497,18 @@ public class BugzillaRepositoryConnectorStandaloneTest extends TestCase {
assertEquals(PriorityLevel.P3, mapping.getPriorityLevel());
}
}
+
+ public void testEmptyTags() throws Exception {
+ TaskData taskDataNew = BugzillaFixture.current().getTask("1", client);
+ List<String> list = taskDataNew.getRoot().getAttribute(BugzillaAttribute.RESOLUTION.getKey()).getValues();
+ assertEquals(0, list.size());
+ assertEquals("", taskDataNew.getRoot().getAttribute(BugzillaAttribute.RESOLUTION.getKey()).getValue());
+ assertEquals("", taskDataNew.getRoot().getAttribute(BugzillaAttribute.BUG_FILE_LOC.getKey()).getValue());
+ list = taskDataNew.getRoot().getAttribute(BugzillaAttribute.KEYWORDS.getKey()).getValues();
+ assertEquals(0, list.size());
+ assertEquals("", taskDataNew.getRoot().getAttribute(BugzillaAttribute.KEYWORDS.getKey()).getValue());
+ list = taskDataNew.getRoot().getAttribute(BugzillaAttribute.STATUS_WHITEBOARD.getKey()).getValues();
+ assertEquals(0, list.size());
+ assertEquals("", taskDataNew.getRoot().getAttribute(BugzillaAttribute.STATUS_WHITEBOARD.getKey()).getValue());
+ }
} \ No newline at end of file

Back to the top