Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2009-08-24 22:49:39 +0000
committerrelves2009-08-24 22:49:39 +0000
commit78dbce79671d733021877a1acc944565acba6751 (patch)
tree04dad6eb7ea4bc2b2a4561bc14ccf130dfbe1f6b /org.eclipse.mylyn.bugzilla.core/src
parent59828de9c55fb896bedce78513ddefe2ab9a9127 (diff)
downloadorg.eclipse.mylyn.tasks-78dbce79671d733021877a1acc944565acba6751.tar.gz
org.eclipse.mylyn.tasks-78dbce79671d733021877a1acc944565acba6751.tar.xz
org.eclipse.mylyn.tasks-78dbce79671d733021877a1acc944565acba6751.zip
ASSIGNED - bug 268465: [patch] improve handling of invalid bug id error when tasks deleted from repository or invalid task in tasklist
https://bugs.eclipse.org/bugs/show_bug.cgi?id=268465
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.core/src')
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java5
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java3
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java17
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java22
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties4
6 files changed, 42 insertions, 13 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
index f9f8b1716..3db34adfc 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
@@ -300,6 +300,11 @@ public class BugzillaTaskDataHandler extends AbstractTaskDataHandler {
private final TaskDataCollector collector;
+ @Override
+ public void failed(String taskId, IStatus status) {
+ collector.failed(taskId, status);
+ }
+
public CollectorWrapper(TaskDataCollector collector, IProgressMonitor monitor2) {
this.collector = collector;
this.monitor2 = monitor2;
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 6f05b61d4..c2fa9a0b7 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_NO_DATA_RETRIEVED = Messages.IBugzillaConstants_NO_DATA_RETRIEVED_FOR_TASK;
+
public static final String INVALID_CREDENTIALS = Messages.IBugzillaConstants_invalid_repository_credentials;
public static final String SHOW_ACTIVITY = "/show_activity.cgi?id="; //$NON-NLS-1$
@@ -270,4 +272,5 @@ public interface IBugzillaConstants {
public static final String LAST_PRODUCT_SELECTION = "last.selection.product"; //$NON-NLS-1$
public static final String LAST_COMPONENT_SELECTION = "last.selection.component"; //$NON-NLS-1$
+
}
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 838bfc5a9..8b065b7a1 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
@@ -233,6 +233,8 @@ public class Messages extends NLS {
public static String IBugzillaConstants_New_Bugzilla_Report;
+ public static String IBugzillaConstants_NO_DATA_RETRIEVED_FOR_TASK;
+
public static String IBugzillaConstants_requested_operation_not_permitted;
public static String SaxMultiBugReportContentHandler_Bug_id_from_server_did_not_match_requested_id;
@@ -254,4 +256,6 @@ public class Messages extends NLS {
public static String BugzillaStatus_errorInternal;
public static String BugzillaStatus_errorRepository;
+
+ public static String MultiBugReportFactory_NO_DATA_AVAILABLE_FOR_TASK;
}
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 604d54f53..d5e6a9d11 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
@@ -19,7 +19,9 @@ import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.tasks.core.RepositoryStatus;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
@@ -42,17 +44,24 @@ public class MultiBugReportFactory extends AbstractReportFactory {
customFields);
collectResults(contentHandler, false);
- if (contentHandler.errorOccurred()) {
+ for (TaskData data : bugMap.values()) {
+ TaskAttribute attrCreation = data.getRoot().getAttribute(BugzillaAttribute.CREATION_TS.getKey());
+ if (attrCreation == null || attrCreation.getValue() == null || attrCreation.getValue().length() == 0) {
+ collector.failed(data.getTaskId(), new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
+ IBugzillaConstants.ERROR_MSG_NO_DATA_RETRIEVED));
+ }
+ }
+
+ 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)) {
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)) {
- BugzillaStatus status = new BugzillaStatus(IStatus.INFO, BugzillaCorePlugin.ID_PLUGIN,
+ throw new CoreException(new BugzillaStatus(IStatus.INFO, BugzillaCorePlugin.ID_PLUGIN,
RepositoryStatus.ERROR_REPOSITORY_LOGIN, mapper.getTaskRepository().getRepositoryUrl(),
- IBugzillaConstants.ERROR_MSG_OP_NOT_PERMITTED);
- throw new CoreException(status);
+ IBugzillaConstants.ERROR_MSG_OP_NOT_PERMITTED));
} else {
throw new CoreException(new BugzillaStatus(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN,
RepositoryStatus.ERROR_REPOSITORY, "", "Unexpected error occurred: " + errorResponse)); //$NON-NLS-1$ //$NON-NLS-2$
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 118a44097..800860a61 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
@@ -72,6 +72,8 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
private TaskAttribute attachmentAttribute;
+ private boolean bugParseErrorOccurred;
+
public SaxMultiBugReportContentHandler(TaskAttributeMapper mapper, TaskDataCollector collector,
Map<String, TaskData> taskDataMap, List<BugzillaCustomField> customFields) {
this.taskDataMap = taskDataMap;
@@ -116,6 +118,8 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
case BUG:
if (attributes != null && (attributes.getValue("error") != null)) { //$NON-NLS-1$
errorMessage = attributes.getValue("error"); //$NON-NLS-1$
+ bugParseErrorOccurred = true;
+ repositoryTaskData = null;
}
attachIdToComment = new HashMap<String, TaskCommentMapper>();
commentNum = 0;
@@ -279,13 +283,11 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
}
switch (tag) {
case BUG_ID: {
- try {
- repositoryTaskData = taskDataMap.get(parsedText.trim());
- if (repositoryTaskData == null) {
- errorMessage = parsedText + Messages.SaxMultiBugReportContentHandler_id_not_found;
- }
- } catch (Exception e) {
- errorMessage = Messages.SaxMultiBugReportContentHandler_Bug_id_from_server_did_not_match_requested_id;
+ repositoryTaskData = taskDataMap.get(parsedText.trim());
+ if (repositoryTaskData == null) {
+ errorMessage = parsedText + Messages.SaxMultiBugReportContentHandler_id_not_found;
+ bugParseErrorOccurred = true;
+ break;
}
TaskAttribute attr = repositoryTaskData.getRoot().getMappedAttribute(tag.getKey());
@@ -382,7 +384,10 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
break;
case BUG:
// Reached end of bug.
-
+ if (bugParseErrorOccurred) {
+ bugParseErrorOccurred = false;
+ break;
+ }
addDescriptionAndComments();
// Need to set LONGDESCLENGTH to number of comments + 1 for description
@@ -420,6 +425,7 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
if (attrCreation != null && !attrCreation.equals("")) { //$NON-NLS-1$
collector.accept(repositoryTaskData);
}
+ repositoryTaskData = null;
break;
case BLOCKED:
// handled similarly to DEPENDSON
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 57169585a..6135d62b1 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
@@ -117,6 +117,7 @@ IBugzillaConstants_invalid_bug_id_requested_bug_id_does_not_exist=Invalid bug id
IBugzillaConstants_invalid_repository_credentials=Invalid repository credentials.
IBugzillaConstants_Mylyn_Bugzilla_Connector=Mylyn Bugzilla Connector
IBugzillaConstants_New_Bugzilla_Report=New Bugzilla Report
+IBugzillaConstants_NO_DATA_RETRIEVED_FOR_TASK=No data avialable for task
IBugzillaConstants_requested_operation_not_permitted=The requested operation is not permitted.
SaxMultiBugReportContentHandler_Bug_id_from_server_did_not_match_requested_id=Bug id from server did not match requested id.
@@ -130,4 +131,5 @@ BugzillaStatus_repositoryCollision = Mid-air collision occurred while submitting
### repositoryUrl, class.simpleName, class.getMessage
BugzillaStatus_errorIo = I/O Error occurred while communicating with {0}.\n\n{1}: {2}
BugzillaStatus_errorInternal = An internal error has occurred: {0}
-BugzillaStatus_operationCancelled = {0} was canceled by the user. \ No newline at end of file
+BugzillaStatus_operationCancelled = {0} was canceled by the user.
+MultiBugReportFactory_NO_DATA_AVAILABLE_FOR_TASK=No data available for task

Back to the top