Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java74
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java10
-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/messages.properties2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java10
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java14
6 files changed, 78 insertions, 36 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
index 71137806a..68ef0c503 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
@@ -244,8 +244,6 @@ public class BugzillaClient {
throw new CoreException(new Status(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN,
"XMLRPC user could not login")); //$NON-NLS-1$
}
- int i = 9;
- i++;
} catch (XmlRpcException e) {
throw new CoreException(new Status(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN,
"XMLRPC is not installed")); //$NON-NLS-1$
@@ -1167,6 +1165,46 @@ public class BugzillaClient {
public RepositoryResponse postTaskData(TaskData taskData, IProgressMonitor monitor) throws IOException,
CoreException {
+ try {
+ return postTaskDataInternal(taskData, monitor);
+ } catch (CoreException e) {
+ TaskAttribute qaContact = taskData.getRoot().getAttribute(BugzillaAttribute.QA_CONTACT.getKey());
+ if (qaContact != null) {
+ String qaContactValue = qaContact.getValue();
+ String message = e.getMessage();
+ if ("An unknown repository error has occurred: Bugzilla/Bug.pm line".equals(message) //$NON-NLS-1$
+ && qaContactValue != null && !qaContactValue.equals("")) { //$NON-NLS-1$
+ if (e.getStatus() instanceof RepositoryStatus) {
+ RepositoryStatus repositoryStatus = (RepositoryStatus) e.getStatus();
+ RepositoryStatus status = RepositoryStatus.createHtmlStatus(
+ repositoryStatus.getRepositoryUrl(), IStatus.INFO, BugzillaCorePlugin.ID_PLUGIN,
+ RepositoryStatus.ERROR_REPOSITORY,
+ "Error may result when QAContact field not enabled.", //$NON-NLS-1$
+ repositoryStatus.getHtmlMessage());
+ throw new CoreException(status);
+ }
+ }
+ }
+ try {
+ if (e.getStatus().getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) {
+ return postTaskDataInternal(taskData, monitor);
+ } else if (e.getStatus().getCode() == IBugzillaConstants.REPOSITORY_STATUS_SUSPICIOUS_ACTION) {
+ taskData.getRoot().removeAttribute(BugzillaAttribute.TOKEN.getKey());
+ return postTaskDataInternal(taskData, monitor);
+ } else {
+ throw e;
+ }
+ } catch (CoreException e1) {
+ if (e.getStatus().getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) {
+ throw e;
+ }
+ }
+ }
+ return null;
+ }
+
+ public RepositoryResponse postTaskDataInternal(TaskData taskData, IProgressMonitor monitor) throws IOException,
+ CoreException {
NameValuePair[] formData = null;
monitor = Policy.monitorFor(monitor);
BugzillaRepositoryResponse response;
@@ -1201,25 +1239,8 @@ public class BugzillaClient {
response = parsePostResponse(taskData.getTaskId(), input);
return response;
} catch (CoreException e) {
- TaskAttribute qaContact = taskData.getRoot().getAttribute(BugzillaAttribute.QA_CONTACT.getKey());
- if (qaContact != null) {
- String qaContactValue = qaContact.getValue();
- String message = e.getMessage();
- if ("An unknown repository error has occurred: Bugzilla/Bug.pm line".equals(message) //$NON-NLS-1$
- && qaContactValue != null && !qaContactValue.equals("")) { //$NON-NLS-1$
- if (e.getStatus() instanceof RepositoryStatus) {
- RepositoryStatus repositoryStatus = (RepositoryStatus) e.getStatus();
- RepositoryStatus status = RepositoryStatus.createHtmlStatus(
- repositoryStatus.getRepositoryUrl(), IStatus.INFO, BugzillaCorePlugin.ID_PLUGIN,
- RepositoryStatus.ERROR_REPOSITORY,
- "Error may result when QAContact field not enabled.", //$NON-NLS-1$
- repositoryStatus.getHtmlMessage());
- throw new CoreException(status);
- }
- }
- }
-
throw e;
+
} finally {
if (input != null) {
input.close();
@@ -1790,7 +1811,7 @@ public class BugzillaClient {
RepositoryStatus.ERROR_INTERNAL,
"Unable to retrieve new task id from: " + title)); //$NON-NLS-1$
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
- RepositoryStatus.ERROR_INTERNAL, "Unable to retrieve new task.")); //$NON-NLS-1$
+ RepositoryStatus.ERROR_INTERNAL, Messages.BugzillaClient_Unable_to_retrieve_new_task));
}
}
@@ -1801,8 +1822,15 @@ public class BugzillaClient {
found = title.indexOf(value) != -1;
if (found) {
loggedIn = false;
- throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
- RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), title));
+ if (hasAuthenticationCredentials()) {
+ throw new CoreException(new BugzillaStatus(IStatus.ERROR,
+ BugzillaCorePlugin.ID_PLUGIN, RepositoryStatus.ERROR_REPOSITORY_LOGIN,
+ repositoryUrl.toString(), title));
+ } else {
+ throw new CoreException(new BugzillaStatus(IStatus.ERROR,
+ BugzillaCorePlugin.ID_PLUGIN, RepositoryStatus.ERROR_REPOSITORY_LOGIN,
+ repositoryUrl.toString(), Messages.BugzillaClient_anonymous_user_not_allowed));
+ }
}
}
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 f704f70a6..db9a8eca2 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
@@ -384,15 +384,7 @@ public class BugzillaTaskDataHandler extends AbstractTaskDataHandler {
try {
return client.postTaskData(taskData, monitor);
} catch (CoreException e) {
- // TODO: Move retry handling into client
- if (e.getStatus().getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) {
- return client.postTaskData(taskData, monitor);
- } else if (e.getStatus().getCode() == IBugzillaConstants.REPOSITORY_STATUS_SUSPICIOUS_ACTION) {
- taskData.getRoot().removeAttribute(BugzillaAttribute.TOKEN.getKey());
- return client.postTaskData(taskData, monitor);
- } else {
- throw e;
- }
+ throw e;
}
} catch (IOException e) {
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
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 ed311a5e6..2444ed807 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
@@ -205,10 +205,14 @@ public class Messages extends NLS {
public static String BugzillaAttachmentMapper_URL;
+ public static String BugzillaClient_anonymous_user_not_allowed;
+
public static String BugzillaClient_could_not_post_form_null_returned;
public static String BugzillaClient_description_required_when_submitting_attachments;
+ public static String BugzillaClient_Unable_to_retrieve_new_task;
+
public static String BugzillaOperation_Accept_to_ASSIGNED;
public static String BugzillaOperation_confirmed;
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 da3c8c71e..600dfc7ff 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
@@ -100,8 +100,10 @@ BugzillaAttachmentMapper_Size=Size in Bytes:
BugzillaAttachmentMapper_Token=Token:
BugzillaAttachmentMapper_URL=URL:
+BugzillaClient_anonymous_user_not_allowed=Anonymous user not allowed for this operation.
BugzillaClient_could_not_post_form_null_returned=Could not post form, client returned null method.
BugzillaClient_description_required_when_submitting_attachments=A description is required when submitting attachments.
+BugzillaClient_Unable_to_retrieve_new_task=Unable to retrieve new task.
BugzillaOperation_Accept_to_ASSIGNED=Accept (change status to ASSIGNED)
BugzillaOperation_confirmed=confirm
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java
index e8a7fe8f3..34ea27c12 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java
@@ -462,8 +462,10 @@ public class BugzillaRepositorySettingsPage extends AbstractRepositorySettingsPa
AuthenticationCredentials proxyAuth = repository.getCredentials(AuthenticationType.PROXY);
boolean changed = repository.getCharacterEncoding() != getCharacterEncoding();
changed = changed || repository.getSavePassword(AuthenticationType.REPOSITORY) != getSavePassword();
- changed = changed || repositoryAuth.getUserName().compareTo(getUserName()) != 0;
- changed = changed || repositoryAuth.getPassword().compareTo(getPassword()) != 0;
+ if (repositoryAuth != null) {
+ changed = changed || repositoryAuth.getUserName().compareTo(getUserName()) != 0;
+ changed = changed || repositoryAuth.getPassword().compareTo(getPassword()) != 0;
+ }
changed = changed
|| Boolean.parseBoolean(repository.getProperty(IBugzillaConstants.BUGZILLA_USE_XMLRPC)) != useXMLRPCstatusTransitions.getSelection();
changed = changed
@@ -509,10 +511,10 @@ public class BugzillaRepositorySettingsPage extends AbstractRepositorySettingsPa
*/
private boolean equals(String s1, String s2) {
if (s1 == null) {
- s1 = "";
+ s1 = ""; //$NON-NLS-1$
}
if (s2 == null) {
- s2 = "";
+ s2 = ""; //$NON-NLS-1$
}
return s1.equals(s2);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java
index dfd98b7cd..42e673fe9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java
@@ -1229,6 +1229,20 @@ public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISe
if (TasksUiUtil.openEditRepositoryWizard(getTaskRepository()) == Window.OK) {
submitEnabled = true;
doSubmit();
+ } else {
+ String message;
+ if (status.getMessage().length() > 0) {
+ message = Messages.AbstractTaskEditorPage_Submit_failed_ + status.getMessage();
+ } else {
+ message = Messages.AbstractTaskEditorPage_Submit_failed;
+ }
+ message = message.replaceAll("\n", " ");
+ getTaskEditor().setMessage(message, IMessageProvider.ERROR, new HyperlinkAdapter() {
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Submit_failed, status);
+ }
+ });
}
} else {
String message;

Back to the top