From 3afdb7a3ae04999bc84ffba2a1cbb5dc7e66ab45 Mon Sep 17 00:00:00 2001 From: relves Date: Wed, 12 Jul 2006 20:08:30 +0000 Subject: Progress on: 148205: Bugzilla connector polutting Eclipse log https://bugs.eclipse.org/bugs/show_bug.cgi?id=148205 --- .../internal/bugzilla/core/AbstractReportFactory.java | 10 +++++----- .../mylyn/internal/bugzilla/core/BugzillaPlugin.java | 3 ++- .../internal/bugzilla/core/BugzillaRepositoryUtil.java | 9 +++++---- .../mylyn/internal/bugzilla/core/IBugzillaConstants.java | 2 +- .../bugzilla/core/RepositoryConfigurationFactory.java | 2 +- .../internal/bugzilla/core/RepositoryReportFactory.java | 2 +- .../bugzilla/core/UnrecognizedReponseException.java | 3 +-- .../mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java | 4 +++- .../internal/bugzilla/ui/editor/ExistingBugEditor.java | 5 ++--- .../ui/search/RepositoryQueryResultsFactory.java | 3 ++- .../ui/tasklist/BugzillaRepositoryConnector.java | 16 +++++++++++----- .../internal/bugzilla/ui/wizard/BugzillaProductPage.java | 4 +++- 12 files changed, 37 insertions(+), 26 deletions(-) diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java index a27bd08a8..cb226e6a2 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java @@ -54,7 +54,7 @@ public class AbstractReportFactory { protected void collectResults(URL url, Proxy proxySettings, String characterEncoding, DefaultHandler contentHandler, boolean clean) throws IOException, LoginException, KeyManagementException, - NoSuchAlgorithmException { + NoSuchAlgorithmException, BugzillaException { URLConnection cntx = BugzillaPlugin.getUrlConnection(url, proxySettings); if (cntx == null || !(cntx instanceof HttpURLConnection)) { throw new IOException("Could not form URLConnection."); @@ -134,11 +134,11 @@ public class AbstractReportFactory { } } } else if (connection.getContentType().contains(CONTENT_TYPE_TEXT_HTML)) { - try { +// try { BugzillaRepositoryUtil.parseHtmlError(in); - } catch (BugzillaException e) { - throw new IOException(e.getMessage()); - } +// } catch (BugzillaException e) { +// throw new IOException(e.getMessage()); +// } } else { throw new IOException("Unrecognized content type: " + connection.getContentType()); } diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaPlugin.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaPlugin.java index 66b2774ca..65f53b2c5 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaPlugin.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaPlugin.java @@ -98,10 +98,11 @@ public class BugzillaPlugin extends Plugin { /** * Retrieves the latest repository configuration from the server + * @throws BugzillaException */ public static RepositoryConfiguration getRepositoryConfiguration(boolean forceRefresh, String repositoryUrl, Proxy proxySettings, String userName, String password, String encoding) throws IOException, - KeyManagementException, LoginException, NoSuchAlgorithmException { + KeyManagementException, LoginException, NoSuchAlgorithmException, BugzillaException { if (!cacheFileRead) { readRepositoryConfigurationFile(); cacheFileRead = true; diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryUtil.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryUtil.java index 4cece8d45..3c737d48d 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryUtil.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryUtil.java @@ -81,7 +81,7 @@ public class BugzillaRepositoryUtil { public static RepositoryTaskData getBug(String repositoryUrl, String userName, String password, Proxy proxySettings, String characterEncoding, int id) throws IOException, MalformedURLException, - LoginException, GeneralSecurityException { + LoginException, GeneralSecurityException, BugzillaException { RepositoryTaskData bugReport = new RepositoryTaskData(new BugzillaAttributeFactory(), BugzillaPlugin.REPOSITORY_KIND, repositoryUrl, ""+id); @@ -196,7 +196,7 @@ public class BugzillaRepositoryUtil { // MylarStatusHandler.log("Unrecognized Reponse: " + body, // BugzillaRepositoryUtil.class); - throw new UnrecognizedReponseException("Unrecognized Response From Server: " + body); + throw new UnrecognizedReponseException(body); } catch (ParseException e) { throw new IOException("Unable to parse result from repository:\n" + e.getMessage()); @@ -215,10 +215,11 @@ public class BugzillaRepositoryUtil { * @throws NoSuchAlgorithmException * @throws LoginException * @throws KeyManagementException + * @throws BugzillaException */ public static void setupNewBugAttributes(String repositoryUrl, Proxy proxySettings, String userName, String password, NewBugzillaReport newReport, String characterEncoding) throws IOException, - KeyManagementException, LoginException, NoSuchAlgorithmException { + KeyManagementException, LoginException, NoSuchAlgorithmException, BugzillaException { newReport.removeAllAttributes(); @@ -358,7 +359,7 @@ public class BugzillaRepositoryUtil { private static void updateBugAttributeOptions(String repositoryUrl, Proxy proxySettings, String userName, String password, RepositoryTaskData existingReport, String characterEncoding) throws IOException, - KeyManagementException, LoginException, NoSuchAlgorithmException { + KeyManagementException, LoginException, NoSuchAlgorithmException, BugzillaException { String product = existingReport.getAttributeValue(BugzillaReportElement.PRODUCT.getKeyString()); for (RepositoryTaskAttribute attribute : existingReport.getAttributes()) { BugzillaReportElement element = BugzillaReportElement.valueOf(attribute.getID().trim().toUpperCase()); 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 544075d26..1c786ab42 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 @@ -15,7 +15,7 @@ package org.eclipse.mylar.internal.bugzilla.core; */ public interface IBugzillaConstants { - static final String ERROR_MIDAIR_COLLISION = "A mid-air collision has occurred, please synchronize."; + static final String ERROR_MIDAIR_COLLISION = "A mid-air collision has occurred. Please synchronize by selecting Synchronize in the task's context menu."; // Error response from bugzilla server upon bug request static final String ERROR_INVALID_BUG_ID = "InvalidBugId"; diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfigurationFactory.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfigurationFactory.java index 0b953d9ec..ea9fb08e4 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfigurationFactory.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfigurationFactory.java @@ -34,7 +34,7 @@ public class RepositoryConfigurationFactory extends AbstractReportFactory { public RepositoryConfiguration getConfiguration(String repositoryUrl, Proxy proxySettings, String userName, String password, String encoding) throws IOException, KeyManagementException, LoginException, - NoSuchAlgorithmException { + NoSuchAlgorithmException, BugzillaException { String configUrlStr = repositoryUrl + CONFIG_RDF_URL; configUrlStr = BugzillaRepositoryUtil.addCredentials(configUrlStr, userName, password); URL url = new URL(configUrlStr); diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryReportFactory.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryReportFactory.java index fa757257a..44e91347b 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryReportFactory.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryReportFactory.java @@ -34,7 +34,7 @@ public class RepositoryReportFactory extends AbstractReportFactory { public void populateReport(RepositoryTaskData bugReport, String repositoryUrl, Proxy proxySettings, String userName, String password, String characterEncoding) throws LoginException, KeyManagementException, - NoSuchAlgorithmException, IOException { + NoSuchAlgorithmException, IOException, BugzillaException { SaxBugReportContentHandler contentHandler = new SaxBugReportContentHandler(bugzillaAttributeFactory, bugReport); diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/UnrecognizedReponseException.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/UnrecognizedReponseException.java index 8a1bd7f9a..a99baa931 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/UnrecognizedReponseException.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/UnrecognizedReponseException.java @@ -11,12 +11,11 @@ package org.eclipse.mylar.internal.bugzilla.core; -import java.io.IOException; /** * @author Rob Elves */ -public class UnrecognizedReponseException extends IOException { +public class UnrecognizedReponseException extends BugzillaException { private static final long serialVersionUID = 8419167415822022988L; public UnrecognizedReponseException(String message) { diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java index e7e723910..73f04da8d 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java @@ -23,6 +23,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.mylar.internal.bugzilla.core.BugzillaException; import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin; import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants; import org.eclipse.mylar.internal.bugzilla.core.RepositoryConfiguration; @@ -217,9 +218,10 @@ public class BugzillaUiPlugin extends AbstractUIPlugin { * @throws IOException * @throws NoSuchAlgorithmException * @throws KeyManagementException + * @throws BugzillaException */ public static void updateQueryOptions(TaskRepository repository, IProgressMonitor monitor) throws LoginException, - IOException, KeyManagementException, NoSuchAlgorithmException { + IOException, KeyManagementException, NoSuchAlgorithmException, BugzillaException { String repositoryUrl = repository.getUrl(); diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java index 39b3870a5..68b3b3f98 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java @@ -418,9 +418,8 @@ public class ExistingBugEditor extends AbstractRepositoryTaskEditor { close(); return; } else if (event.getJob().getResult().getCode() == Status.INFO) { - WebBrowserDialog.openAcceptAgreement(null, IBugzillaConstants.REPORT_SUBMIT_ERROR, event - .getJob().getResult().getException().getCause().getMessage(), event.getJob() - .getResult().getMessage()); + WebBrowserDialog.openAcceptAgreement(null, IBugzillaConstants.REPORT_SUBMIT_ERROR, + event.getJob().getResult().getMessage(), event.getJob().getResult().getException().getMessage()); submitButton.setEnabled(true); ExistingBugEditor.this.showBusy(false); } else if (event.getJob().getResult().getCode() == Status.ERROR) { diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/RepositoryQueryResultsFactory.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/RepositoryQueryResultsFactory.java index 9508e8916..a8702263b 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/RepositoryQueryResultsFactory.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/RepositoryQueryResultsFactory.java @@ -20,6 +20,7 @@ import java.security.NoSuchAlgorithmException; import javax.security.auth.login.LoginException; import org.eclipse.mylar.internal.bugzilla.core.AbstractReportFactory; +import org.eclipse.mylar.internal.bugzilla.core.BugzillaException; /** @@ -29,7 +30,7 @@ public class RepositoryQueryResultsFactory extends AbstractReportFactory { public void performQuery(String repositoryUrl, IBugzillaSearchResultCollector collector, String queryUrlString, Proxy proxySettings, int maxHits, String characterEncoding) throws LoginException, KeyManagementException, - NoSuchAlgorithmException, IOException { + NoSuchAlgorithmException, IOException, BugzillaException { SaxBugzillaQueryContentHandler contentHandler = new SaxBugzillaQueryContentHandler(repositoryUrl, diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryConnector.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryConnector.java index 21276905b..aa6d9b4af 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryConnector.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryConnector.java @@ -41,6 +41,7 @@ import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportSubmitForm; import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryUtil; import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants; import org.eclipse.mylar.internal.bugzilla.core.PossibleBugzillaFailureException; +import org.eclipse.mylar.internal.bugzilla.core.UnrecognizedReponseException; import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants.BugzillaServerVersion; import org.eclipse.mylar.internal.bugzilla.ui.BugzillaUiPlugin; import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaResultCollector; @@ -156,7 +157,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector { public IWizard getNewQueryWizard(TaskRepository repository, IStructuredSelection selection) { return new NewBugzillaQueryWizard(repository); } - + public void openEditQueryDialog(AbstractRepositoryQuery query) { if (!(query instanceof BugzillaRepositoryQuery)) { return; @@ -225,12 +226,18 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector { } catch (IOException e) { return new Status(Status.OK, BugzillaUiPlugin.PLUGIN_ID, Status.ERROR, "Check repository credentials and connectivity.", e); + } catch (UnrecognizedReponseException e) { + return new Status(Status.OK, BugzillaUiPlugin.PLUGIN_ID, Status.INFO, + "Unrecognized response from server", e); } catch (BugzillaException e) { - MylarStatusHandler.fail(e, "Failed to submit", false); + // MylarStatusHandler.fail(e, "Failed to submit", + // false); + String message = e.getMessage(); return new Status(Status.OK, BugzillaUiPlugin.PLUGIN_ID, Status.ERROR, - "Bugzilla could not post your bug. \n\n" + e.getCause().getMessage(), e); + "Bugzilla could not post your bug. \n\n" + message, e); } catch (PossibleBugzillaFailureException e) { - return new Status(Status.OK, BugzillaUiPlugin.PLUGIN_ID, Status.INFO, form.getError(), e); + return new Status(Status.OK, BugzillaUiPlugin.PLUGIN_ID, Status.INFO, + "Possible bugzilla failure", e); } } }; @@ -288,7 +295,6 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector { } } - @Override public boolean canCreateTaskFromKey() { return true; diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java index 0942ea47f..a9bd6c989 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaProductPage.java @@ -33,6 +33,7 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.mylar.internal.bugzilla.core.BugzillaException; import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin; import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportElement; import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryUtil; @@ -376,8 +377,9 @@ public class BugzillaProductPage extends WizardPage implements Listener { * @throws NoSuchAlgorithmException * @throws LoginException * @throws KeyManagementException + * @throws BugzillaException */ - public void saveDataToModel() throws KeyManagementException, LoginException, NoSuchAlgorithmException, IOException { + public void saveDataToModel() throws KeyManagementException, LoginException, NoSuchAlgorithmException, IOException, BugzillaException { NewBugzillaReport model = bugWizard.model; prevProduct = model.getProduct(); model.setProduct((listBox.getSelection())[0]); -- cgit v1.2.3