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/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentHandler.java | |
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/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentHandler.java')
-rw-r--r-- | org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentHandler.java | 213 |
1 files changed, 0 insertions, 213 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(); -// } -// } |