Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2006-05-11 21:03:44 +0000
committerrelves2006-05-11 21:03:44 +0000
commit4ab7b1d08802cb2f2c88f9f8468460c14cdebc90 (patch)
tree114425324a40a58c5dbf74f17bf04ef1d2fcd77c /org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/search/SaxBugzillaQueryContentHandler.java
parentbb73c03e34b51f7a39ba505e390527e74bacee79 (diff)
downloadorg.eclipse.mylyn.tasks-4ab7b1d08802cb2f2c88f9f8468460c14cdebc90.tar.gz
org.eclipse.mylyn.tasks-4ab7b1d08802cb2f2c88f9f8468460c14cdebc90.tar.xz
org.eclipse.mylyn.tasks-4ab7b1d08802cb2f2c88f9f8468460c14cdebc90.zip
Progress on: 132291: support Red Hat Bugzilla, possibly via XMLRPC connector
https://bugs.eclipse.org/bugs/show_bug.cgi?id=132291
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/search/SaxBugzillaQueryContentHandler.java')
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/search/SaxBugzillaQueryContentHandler.java119
1 files changed, 48 insertions, 71 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/search/SaxBugzillaQueryContentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/search/SaxBugzillaQueryContentHandler.java
index 6163b2070..64ae5d658 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/search/SaxBugzillaQueryContentHandler.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/search/SaxBugzillaQueryContentHandler.java
@@ -21,7 +21,7 @@ import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/**
- * Parser for rdf bugzilla query results.
+ * Parser for RDF bugzilla query results.
*
* @author Rob Elves
*/
@@ -30,7 +30,7 @@ public class SaxBugzillaQueryContentHandler extends DefaultHandler {
private StringBuffer characters;
private IBugzillaSearchResultCollector collector;
-
+
private TaskRepository repository;
private BugzillaSearchHit hit;
@@ -39,22 +39,12 @@ public class SaxBugzillaQueryContentHandler extends DefaultHandler {
private int numCollected = 0;
- private String errorMessage = null;
-
public SaxBugzillaQueryContentHandler(TaskRepository rep, IBugzillaSearchResultCollector col, int maxHits) {
repository = rep;
collector = col;
this.maxHits = maxHits;
}
- public boolean errorOccurred() {
- return errorMessage != null;
- }
-
- public String getErrorMessage() {
- return errorMessage;
- }
-
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
characters.append(ch, start, length);
@@ -66,20 +56,18 @@ public class SaxBugzillaQueryContentHandler extends DefaultHandler {
BugzillaReportElement tag = BugzillaReportElement.UNKNOWN;
try {
tag = BugzillaReportElement.valueOf(localName.trim().toUpperCase());
+ switch (tag) {
+ case LI:
+ hit = new BugzillaSearchHit();
+ hit.setRepository(repository.getUrl());
+ break;
+ }
} catch (RuntimeException e) {
if (e instanceof IllegalArgumentException) {
- MylarStatusHandler.fail(e, "Mylar: Bugzilla xml query element not known: "
- + e.getMessage().trim(), false);
- errorMessage = "Mylar: Bugzilla xml query element not known: " + e.getMessage().trim();
+ // ignore unrecognized tags
+ return;
}
- return;
- }
- switch (tag) {
-
- case LI:
- hit = new BugzillaSearchHit();
- hit.setRepository(repository.getUrl());
- break;
+ throw e;
}
}
@@ -89,59 +77,48 @@ public class SaxBugzillaQueryContentHandler extends DefaultHandler {
BugzillaReportElement tag = BugzillaReportElement.UNKNOWN;
try {
tag = BugzillaReportElement.valueOf(localName.trim().toUpperCase());
- } catch (RuntimeException e) {
- if (e instanceof IllegalArgumentException) {
- MylarStatusHandler.fail(e, "Mylar: Bugzilla xml query element not known: "
- + e.getMessage().trim(), false);
- errorMessage = "Mylar: Bugzilla xml query element not known: " + e.getMessage().trim();
- }
- return;
- }
- switch (tag) {
- case ID:
- hit.setId(Integer.parseInt(characters.toString()));
- break;
- case BUG_SEVERITY:
- hit.setSeverity(characters.toString());
- break;
- case PRIORITY:
- hit.setPriority(characters.toString());
- break;
- case REP_PLATFORM:
- hit.setPlatform(characters.toString());
- break;
- case ASSIGNED_TO:
- hit.setOwner(characters.toString());
- break;
- case BUG_STATUS:
- hit.setState(characters.toString());
- break;
- case RESOLUTION:
- hit.setResolution(characters.toString());
- break;
- case SHORT_SHORT_DESC:
- hit.setDescription(characters.toString());
- break;
- case LI:
- try {
- if (numCollected < maxHits || maxHits == IBugzillaConstants.RETURN_ALL_HITS) {
- try {
+ switch (tag) {
+ case ID:
+ hit.setId(Integer.parseInt(characters.toString()));
+ break;
+ case BUG_SEVERITY:
+ hit.setSeverity(characters.toString());
+ break;
+ case PRIORITY:
+ hit.setPriority(characters.toString());
+ break;
+ case REP_PLATFORM:
+ hit.setPlatform(characters.toString());
+ break;
+ case ASSIGNED_TO:
+ hit.setOwner(characters.toString());
+ break;
+ case BUG_STATUS:
+ hit.setState(characters.toString());
+ break;
+ case RESOLUTION:
+ hit.setResolution(characters.toString());
+ break;
+ case SHORT_SHORT_DESC:
+ hit.setDescription(characters.toString());
+ break;
+ case LI:
+ try {
+ if (numCollected < maxHits || maxHits == IBugzillaConstants.RETURN_ALL_HITS) {
collector.accept(hit);
- } catch (RuntimeException e) {
- if (e instanceof IllegalArgumentException) {
- MylarStatusHandler.fail(e, "Mylar: Bugzilla xml query element not known: "
- + e.getMessage().trim(), false);
- errorMessage = "Mylar: Bugzilla xml query element not known: " + e.getMessage().trim();
- }
- return;
+ numCollected++;
}
- numCollected++;
+ } catch (CoreException e) {
+ MylarStatusHandler.fail(e, "Problem recording Bugzilla search hit information", false);
}
- } catch (CoreException e) {
- MylarStatusHandler.fail(e, "Problem recording Bugzilla search hit information", false);
}
+ } catch (RuntimeException e) {
+ if (e instanceof IllegalArgumentException) {
+ // ignore unrecognized tags
+ return;
+ }
+ throw e;
}
}
-
}

Back to the top