diff options
author | relves | 2009-02-03 04:48:42 +0000 |
---|---|---|
committer | relves | 2009-02-03 04:48:42 +0000 |
commit | 8be300e28b5ad7592c55079a2f6ea5f9c1e82af1 (patch) | |
tree | 8edbb4967e0819915ca13ae4b7cbf0e20a5cc3e6 /org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java | |
parent | 475a585f844d44694e277da4c38b210780f51d7c (diff) | |
download | org.eclipse.mylyn.tasks-8be300e28b5ad7592c55079a2f6ea5f9c1e82af1.tar.gz org.eclipse.mylyn.tasks-8be300e28b5ad7592c55079a2f6ea5f9c1e82af1.tar.xz org.eclipse.mylyn.tasks-8be300e28b5ad7592c55079a2f6ea5f9c1e82af1.zip |
NEW - bug 259434: [patch] the owner name and created date of the attachement file of the localized Bugzilla are not displayed.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=259434
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java')
-rw-r--r-- | org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java | 34 |
1 files changed, 26 insertions, 8 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 358e02396..d9fc17095 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 @@ -32,12 +32,15 @@ import org.xml.sax.helpers.DefaultHandler; * Parser for xml bugzilla reports. * * @author Rob Elves + * @author Hiroyuki Inaba (internationalization) */ public class SaxMultiBugReportContentHandler extends DefaultHandler { private static final String ATTRIBUTE_NAME = "name"; //$NON-NLS-1$ - private static final String COMMENT_ATTACHMENT_STRING = Messages.SaxMultiBugReportContentHandler_CREATED_AN_ATTACHEMENT_ID; + private static final String ID_STRING_BEGIN = " (id="; //$NON-NLS-1$ + + private static final String ID_STRING_END = ")"; //$NON-NLS-1$ private StringBuffer characters; @@ -574,15 +577,30 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler { /** determines attachment id from comment */ private void parseAttachment(TaskCommentMapper comment) { - String attachmentID = ""; //$NON-NLS-1$ String commentText = comment.getText(); - if (commentText.startsWith(COMMENT_ATTACHMENT_STRING)) { - int endIndex = commentText.indexOf(")"); //$NON-NLS-1$ - if (endIndex > 0 && endIndex < commentText.length()) { - attachmentID = commentText.substring(COMMENT_ATTACHMENT_STRING.length(), endIndex); - if (!attachmentID.equals("")) { //$NON-NLS-1$ - attachIdToComment.put(attachmentID, comment); + int firstDelimiter = commentText.indexOf("\n"); //$NON-NLS-1$ + if (firstDelimiter < 0) { + firstDelimiter = commentText.length(); + } + int startIndex = commentText.indexOf(ID_STRING_BEGIN); + if (startIndex > 0 && startIndex < firstDelimiter) { + int endIndex = commentText.indexOf(ID_STRING_END, startIndex); + if (endIndex > 0 && endIndex < firstDelimiter) { + startIndex += ID_STRING_BEGIN.length(); + int p = startIndex; + while (p < endIndex) { + char c = commentText.charAt(p); + if (c < '0' || c > '9') { + break; + } + p++; + } + if (p == endIndex) { + attachmentID = commentText.substring(startIndex, endIndex); + if (!attachmentID.equals("")) { //$NON-NLS-1$ + attachIdToComment.put(attachmentID, comment); + } } } } |