| Summary: | the owner name and created date of the attachment file of the localized Bugzilla are not displayed. | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Hiroyuki <hiroyuki.inaba> | ||||||
| Component: | Mylyn | Assignee: | Hiroyuki <hiroyuki.inaba> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | minor | ||||||||
| Priority: | P2 | CC: | robert.elves | ||||||
| Version: | dev | ||||||||
| Target Milestone: | 3.1 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
For instance, it is possible to correct it by adding the following processing.
private static final String ID_STRING_BEGIN = " (id="; //$NON-NLS-1$
private static final String ID_STRING_END = ")"; //$NON-NLS-1$
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);
}
}
}
// Additional codes
else {
int startIndex = commentText.indexOf(ID_STRING_BEGIN);
if (startIndex > 0) {
int endIndex = commentText.indexOf(ID_STRING_END, startIndex);
if (endIndex > 0) {
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);
}
}
}
}
}
}
The mistake was found in the code. A correct code is the following.
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);
}
}
}
}
The owner name and created date of the attachement file of the localized Bugzilla are not displayed. The owner name and created date are retrieve from the attached comment. The localized string was used by this processing. Therefore, the owner name and created date were not retrieved. I think the expectation of English string to be a mistake. Hiroyuki, would you be willing to create a patch and attach to this bug report? Created attachment 122679 [details]
bugzilla.core.patch
Patch applied, ip log updated. Created attachment 124505 [details]
updated patch
Marking resolved. |
The comment on appending is judged directly. Therefore, when the international resource is displayed, the comment cannot be correctly judged. org.eclipse.mylyn.bugzilla.core /src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java private static final String COMMENT_ATTACHMENT_STRING = Messages.SaxMultiBugReportContentHandler_CREATED_AN_ATTACHEMENT_ID; /** 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)) { SaxMultiBugReportContentHandler_CREATED_AN_ATTACHEMENT_ID=Created an attachment (id= If the resource was internationalized, "Created an attachment" is translated. CommentText.startsWith() always becomes False. It is necessary to judge by combining " (id =", figure and ")".