diff options
author | mkersten | 2007-02-10 05:14:08 +0000 |
---|---|---|
committer | mkersten | 2007-02-10 05:14:08 +0000 |
commit | 92fe8cfe25f29d9d1e4fc20d277cfd64ccd974ea (patch) | |
tree | effe02a4dd88f8a712827a579f03599babf79341 /org.eclipse.mylyn.bugzilla.core | |
parent | 3ee272a24ffae8d7f061a43228926c30551af8ff (diff) | |
download | org.eclipse.mylyn.tasks-92fe8cfe25f29d9d1e4fc20d277cfd64ccd974ea.tar.gz org.eclipse.mylyn.tasks-92fe8cfe25f29d9d1e4fc20d277cfd64ccd974ea.tar.xz org.eclipse.mylyn.tasks-92fe8cfe25f29d9d1e4fc20d277cfd64ccd974ea.zip |
NEW - bug 149624: [api] AbstractRepositoryTask repositoryUrl and task id should not be derived from handleIdentifier
https://bugs.eclipse.org/bugs/show_bug.cgi?id=149624
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.core')
5 files changed, 5 insertions, 220 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentHandler.java index bb856c781..62be26e96 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentHandler.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentHandler.java @@ -112,216 +112,3 @@ public class BugzillaAttachmentHandler implements IAttachmentHandler { } } -// public InputStream getAttachmentInputStream(TaskRepository repository, -// String taskId) throws CoreException { -// try { -// BugzillaClient client = -// connector.getClientManager().getClient(repository); -// return client.getAttachmentInputStream(taskId); -// } catch (Exception e) { -// throw new CoreException(new Status(IStatus.ERROR, -// BugzillaCorePlugin.PLUGIN_ID, 0, -// "Download of attachment "+taskId+" from " + repository.getUrl() + " -// failed.", e)); -// } -// } - -// private boolean uploadAttachment(String repositoryUrl, String userName, -// String password, int bugReportID, -// String comment, String description, File sourceFile, String contentType, -// boolean isPatch, -// Proxy proxySettings) throws CoreException { -// -// // Note: The following debug code requires http commons-logging and -// // commons-logging-api jars -// // System.setProperty("org.apache.commons.logging.Log", -// // "org.apache.commons.logging.impl.SimpleLog"); -// // -// System.setProperty("org.apache.commons.logging.simplelog.showdatetime", -// // "true"); -// // -// System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", -// // "debug"); -// // -// System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", -// // "debug"); -// -// boolean uploadResult = true; -// -// // Protocol.registerProtocol("https", new Protocol("https", new -// // TrustAllSslProtocolSocketFactory(), 443)); -// HttpClient client = new HttpClient(); -// WebClientUtil.setupHttpClient(client, proxySettings, repositoryUrl, -// userName, password); -// PostMethod postMethod = new -// PostMethod(WebClientUtil.getRequestPath(repositoryUrl) -// + POST_ARGS_ATTACHMENT_UPLOAD); -// -// // My understanding is that this option causes the client to first check -// // with the server to see if it will in fact recieve the post before -// // actually sending the contents. -// postMethod.getParams().setBooleanParameter(HttpMethodParams.USE_EXPECT_CONTINUE, -// true); -// -// try { -// List<PartBase> parts = new ArrayList<PartBase>(); -// parts.add(new StringPart(ATTRIBUTE_ACTION, VALUE_ACTION_INSERT)); -// parts.add(new StringPart(ATTRIBUTE_BUGZILLA_LOGIN, userName)); -// parts.add(new StringPart(ATTRIBUTE_BUGZILLA_PASSWORD, password)); -// parts.add(new StringPart(ATTRIBUTE_BUGID, String.valueOf(bugReportID))); -// parts.add(new StringPart(ATTRIBUTE_DESCRIPTION, description)); -// parts.add(new StringPart(ATTRIBUTE_COMMENT, comment)); -// parts.add(new FilePart(ATTRIBUTE_DATA, sourceFile)); -// -// if (isPatch) { -// parts.add(new StringPart(ATTRIBUTE_ISPATCH, VALUE_ISPATCH)); -// } else { -// parts.add(new StringPart(ATTRIBUTE_CONTENTTYPEMETHOD, -// VALUE_CONTENTTYPEMETHOD_MANUAL)); -// parts.add(new StringPart(ATTRIBUTE_CONTENTTYPEENTRY, contentType)); -// } -// -// postMethod.setRequestEntity(new MultipartRequestEntity(parts.toArray(new -// Part[1]), postMethod.getParams())); -// postMethod.setDoAuthentication(true); -// client.getHttpConnectionManager().getParams().setConnectionTimeout(CONNECT_TIMEOUT); -// int status = client.executeMethod(postMethod); -// if (status == HttpStatus.SC_OK) { -// InputStreamReader reader = new -// InputStreamReader(postMethod.getResponseBodyAsStream(), postMethod -// .getResponseCharSet()); -// BufferedReader bufferedReader = new BufferedReader(reader); -// -// BugzillaClient.parseHtmlError(bufferedReader); -// -// } else { -// uploadResult = false; -// throw new CoreException(new Status(Status.OK, -// BugzillaCorePlugin.PLUGIN_ID, Status.ERROR, -// "Communication error occurred during upload. \n\n" + -// HttpStatus.getStatusText(status), null)); -// } -// -// } catch (LoginException e) { -// throw new CoreException(new Status(Status.OK, -// BugzillaCorePlugin.PLUGIN_ID, Status.ERROR, -// "Your login name or password is incorrect. Ensure proper repository -// configuration.", e)); -// } catch (UnrecognizedReponseException e) { -// if (e.getMessage().indexOf(CHANGES_SUBMITTED) > -1) { -// return true; -// } -// throw new CoreException(new Status(Status.OK, -// BugzillaCorePlugin.PLUGIN_ID, Status.INFO, -// "Response from server", e)); -// } catch (IOException e) { -// throw new CoreException(new Status(Status.OK, -// BugzillaCorePlugin.PLUGIN_ID, Status.ERROR, -// "Check repository credentials and connectivity.", e)); -// -// } catch (BugzillaException e) { -// String message = e.getMessage(); -// throw new CoreException(new Status(Status.OK, -// BugzillaCorePlugin.PLUGIN_ID, Status.ERROR, -// "Bugzilla could not post your bug. \n\n" + message, e)); -// } finally { -// postMethod.releaseConnection(); -// } -// -// return uploadResult; -// } - -// public boolean uploadAttachment(LocalAttachment attachment, String uname, -// String password, Proxy proxySettings) -// throws CoreException { -// -// File file = new File(attachment.getFilePath()); -// if (!file.exists() || file.length() <= 0) { -// return false; -// } -// -// uploadAttachment(attachment.getReport().getRepositoryUrl(), uname, -// password, Integer.parseInt(attachment -// .getReport().getId()), attachment.getComment(), -// attachment.getDescription(), file, attachment -// .getContentType(), attachment.isPatch(), proxySettings); -// } - -// public void downloadAttachment(TaskRepository repository, -// AbstractRepositoryTask task, -// RepositoryAttachment attachment, File file, Proxy proxySettings) throws -// CoreException { -// try { -// BugzillaClient client = -// BugzillaCorePlugin.getDefault().getConnector().getClientManager().getClient(repository); -// -// client.downloadAttachment(attachment.getId(), file, true); -// -// downloadAttachment(repository.getUrl(), repository.getUserName(), -// repository.getPassword(), proxySettings, -// repository.getCharacterEncoding(), attachment.getId(), file, true); -// } catch (Exception e) { -// throw new CoreException(new Status(IStatus.ERROR, -// BugzillaCorePlugin.PLUGIN_ID, 0, "could not download", e)); -// } -// } - -// private boolean downloadAttachment(String repositoryUrl, String userName, -// String password, Proxy proxySettings, -// String encoding, int id, File destinationFile, boolean overwrite) throws -// IOException, -// GeneralSecurityException { -// BufferedInputStream in = null; -// FileOutputStream outStream = null; -// try { -// String url = repositoryUrl + POST_ARGS_ATTACHMENT_DOWNLOAD + id; -// url = BugzillaClient.addCredentials(url, encoding, userName, password); -// URL downloadUrl = new URL(url); -// URLConnection connection = WebClientUtil.openUrlConnection(downloadUrl, -// proxySettings, false, null, null); -// if (connection != null) { -// InputStream input = connection.getInputStream(); -// outStream = new FileOutputStream(destinationFile); -// copyByteStream(input, outStream); -// return true; -// -// } -// } finally { -// try { -// if (in != null) -// in.close(); -// if (outStream != null) -// outStream.close(); -// } catch (IOException e) { -// BugzillaCorePlugin.log(new Status(IStatus.ERROR, -// BugzillaCorePlugin.PLUGIN_ID, IStatus.ERROR, -// "Problem closing the stream", e)); -// } -// } -// return false; -// } -// -// private void copyByteStream(InputStream in, OutputStream out) throws -// IOException { -// if (in != null && out != null) { -// BufferedInputStream inBuffered = new BufferedInputStream(in); -// -// int bufferSize = 1000; -// byte[] buffer = new byte[bufferSize]; -// -// int readCount; -// -// BufferedOutputStream fout = new BufferedOutputStream(out); -// -// while ((readCount = inBuffered.read(buffer)) != -1) { -// if (readCount < bufferSize) { -// fout.write(buffer, 0, readCount); -// } else { -// fout.write(buffer); -// } -// } -// fout.flush(); -// fout.close(); -// in.close(); -// } -// } 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 c2adeb3fa..b73b65761 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 @@ -438,8 +438,6 @@ public class BugzillaClient { GetMethod method = null; try { method = getConnect(repositoryUrl + IBugzillaConstants.URL_GET_SHOW_BUG_XML + id); - // System.err.println(method.getResponseCharSet()); - // System.err.println(method.getResponseBodyAsString()); RepositoryTaskData taskData = null; if (method.getResponseHeader("Content-Type") != null) { Header responseTypeHeader = method.getResponseHeader("Content-Type"); diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaQueryHit.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaQueryHit.java index c818b29d9..f8d7ece95 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaQueryHit.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaQueryHit.java @@ -38,7 +38,7 @@ public class BugzillaQueryHit extends AbstractQueryHit { @Override public String getUrl() { - Integer idInt = new Integer(id); + Integer idInt = new Integer(taskId); return BugzillaClient.getBugUrlWithoutLogin(repositoryUrl, idInt); } diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java index 79df1967f..117074596 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java @@ -190,7 +190,7 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector { for (AbstractQueryHit hit : collector.getHits()) { // String handle = AbstractRepositoryTask.getHandle(repository.getUrl(), hit.getId()); - ITask correspondingTask = taskList.getTask(repository.getUrl(), hit.getId()); + ITask correspondingTask = taskList.getTask(repository.getUrl(), hit.getTaskId()); if (correspondingTask != null && correspondingTask instanceof AbstractRepositoryTask) { AbstractRepositoryTask repositoryTask = (AbstractRepositoryTask) correspondingTask; // Hack to avoid re-syncing last task from previous diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTask.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTask.java index c0bc142de..72f106af0 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTask.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTask.java @@ -41,13 +41,13 @@ public class BugzillaTask extends AbstractRepositoryTask { } public BugzillaTask(BugzillaQueryHit hit, boolean newTask) { - this(hit.getRepositoryUrl(), hit.getId(), hit.getSummary(), newTask); + this(hit.getRepositoryUrl(), hit.getTaskId(), hit.getSummary(), newTask); setPriority(hit.getPriority()); initTaskUrl(taskId); } private void initTaskUrl(String taskId) { -// String id = RepositoryTaskHandleUtil.getTaskId(getHandleIdentifier()); +// String taskId = RepositoryTaskHandleUtil.getTaskId(getHandleIdentifier()); // String repositoryUrl = getRepositoryUrl(); try { String url = BugzillaClient.getBugUrlWithoutLogin(repositoryUrl, Integer.parseInt(taskId)); @@ -86,7 +86,7 @@ public class BugzillaTask extends AbstractRepositoryTask { @Override public String toString() { - return "bugzilla report id: " + getHandleIdentifier(); + return "bugzilla report taskId: " + getHandleIdentifier(); } // @Override |