Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2013-05-01 15:25:33 +0000
committerGerrit Code Review @ Eclipse.org2013-05-09 12:59:07 +0000
commit20e8aaf07ff15718cd47180630614e240b687a83 (patch)
tree66eac10b68a4c8ebcc1df83bf3e8e38036b3f822 /org.eclipse.mylyn.bugzilla.core
parentec1c6c9dfe7c3c63c0a55e0b278c57695772eef7 (diff)
downloadorg.eclipse.mylyn.tasks-20e8aaf07ff15718cd47180630614e240b687a83.tar.gz
org.eclipse.mylyn.tasks-20e8aaf07ff15718cd47180630614e240b687a83.tar.xz
org.eclipse.mylyn.tasks-20e8aaf07ff15718cd47180630614e240b687a83.zip
398239: Bugzilla should return RepositoryStatus (ERROR_INTERNAL) on
invalid taskID in getMultiTaskData Change-Id: Ia31e03314e1a43d3f22596f3dd7d8ff96d8c6ed2 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=398239
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.core')
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java6
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java26
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties1
5 files changed, 35 insertions, 2 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
index 9f22dae62..7a2513e65 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
@@ -228,6 +228,8 @@ public interface IBugzillaConstants {
public static final String ERROR_MSG_INVALID_BUG_ID = Messages.IBugzillaConstants_invalid_bug_id_requested_bug_id_does_not_exist;
+ public static final String ERROR_MSG_NOT_FOUND_BUG_ID = Messages.IBugzillaConstants_Bug_id_not_found;
+
public static final String ERROR_MSG_NO_DATA_RETRIEVED = Messages.IBugzillaConstants_NO_DATA_RETRIEVED_FOR_TASK;
public static final String INVALID_CREDENTIALS = Messages.IBugzillaConstants_invalid_repository_credentials;
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java
index 766f9dd51..0d4a71cfe 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java
@@ -275,6 +275,8 @@ public class Messages extends NLS {
public static String BugzillaTaskDataHandler_Submitting_task;
+ public static String IBugzillaConstants_Bug_id_not_found;
+
public static String BugzillaTaskDataHandler_updating_attachment;
public static String IBugzillaConstants_Bugzilla_login_information_or_repository_version_incorrect;
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java
index 0a5f0d6f9..0dfa28921 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java
@@ -57,8 +57,10 @@ public class MultiBugReportFactory extends AbstractReportFactory {
if (bugMap.size() == 1 && contentHandler.errorOccurred()) {
String errorResponse = contentHandler.getErrorMessage().toLowerCase(Locale.ENGLISH);
- if (errorResponse.equals(IBugzillaConstants.XML_ERROR_NOTFOUND)
- || errorResponse.equals(IBugzillaConstants.XML_ERROR_INVALIDBUGID)) {
+ if (errorResponse.equals(IBugzillaConstants.XML_ERROR_NOTFOUND)) {
+ throw new CoreException(new BugzillaStatus(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN,
+ RepositoryStatus.ERROR_REPOSITORY, "", IBugzillaConstants.ERROR_MSG_NOT_FOUND_BUG_ID)); //$NON-NLS-1$
+ } else if (errorResponse.equals(IBugzillaConstants.XML_ERROR_INVALIDBUGID)) {
throw new CoreException(new BugzillaStatus(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN,
RepositoryStatus.ERROR_REPOSITORY, "", IBugzillaConstants.ERROR_MSG_INVALID_BUG_ID)); //$NON-NLS-1$
} else if (errorResponse.equals(IBugzillaConstants.XML_ERROR_NOTPERMITTED)) {
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 6403a8524..2fa4a3ed9 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
@@ -88,6 +88,8 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
private final SimpleDateFormat simpleFormatter_deltaTS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //$NON-NLS-1$
+ private String bugIDValue;
+
public SaxMultiBugReportContentHandler(TaskAttributeMapper mapper, TaskDataCollector collector,
Map<String, TaskData> taskDataMap, List<BugzillaCustomField> customFields,
BugzillaRepositoryConnector connector) {
@@ -150,6 +152,7 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
taskComment = null;
longDescs = new ArrayList<TaskComment>();
token = null;
+ bugIDValue = null;
break;
case LONG_DESC:
String is_private = attributes.getValue("isprivate"); //$NON-NLS-1$
@@ -309,6 +312,7 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
}
switch (tag) {
case BUG_ID: {
+ bugIDValue = parsedText.trim();
repositoryTaskData = taskDataMap.get(parsedText.trim());
if (repositoryTaskData == null) {
errorMessage = parsedText + Messages.SaxMultiBugReportContentHandler_id_not_found;
@@ -545,8 +549,30 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
IBugzillaConstants.BUGZILLA_PARAM_USECLASSIFICATION, false);
break;
case ALIAS:
+ if (repositoryTaskData == null) {
+ repositoryTaskData = taskDataMap.get(parsedText.trim());
+ if (repositoryTaskData == null) {
+ errorMessage = parsedText + Messages.SaxMultiBugReportContentHandler_id_not_found;
+ bugParseErrorOccurred = true;
+ break;
+ } else {
+ errorMessage = null;
+ bugParseErrorOccurred = false;
+ }
+ }
BugzillaUtil.createAttributeWithKindDefaultIfUsed(parsedText, tag, repositoryTaskData,
IBugzillaConstants.BUGZILLA_PARAM_USEBUGALIASES, false);
+ TaskAttribute attr = repositoryTaskData.getRoot().getMappedAttribute(BugzillaAttribute.BUG_ID.getKey());
+ if (attr == null) {
+ attr = BugzillaTaskDataHandler.createAttribute(repositoryTaskData, BugzillaAttribute.BUG_ID);
+ }
+ attr.setValue(bugIDValue);
+
+ if (exporter != null) {
+ createAttrribute(exporter, BugzillaAttribute.EXPORTER_NAME);
+ } else {
+ createAttrribute("", BugzillaAttribute.EXPORTER_NAME); //$NON-NLS-1$
+ }
break;
case SEE_ALSO:
BugzillaUtil.createAttributeWithKindDefaultIfUsed(parsedText, tag, repositoryTaskData,
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties
index 2039c2821..31c9fafb7 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties
@@ -141,6 +141,7 @@ BugzillaTaskDataHandler_Receiving_tasks=Receiving tasks
BugzillaTaskDataHandler_Submitting_task=Submitting task
BugzillaTaskDataHandler_updating_attachment=Updating Attachment
+IBugzillaConstants_Bug_id_not_found=Bug id not found. The requested bug id does not exist.
IBugzillaConstants_Bugzilla_login_information_or_repository_version_incorrect=Bugzilla login information or repository version incorrect
IBugzillaConstants_invalid_bug_id_requested_bug_id_does_not_exist=Invalid bug id. The requested bug id does not exist.
IBugzillaConstants_invalid_repository_credentials=Invalid repository credentials.

Back to the top