Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2006-10-23 20:23:16 +0000
committerrelves2006-10-23 20:23:16 +0000
commit4fb0be620436a8dcdeaa7d0ed821d9d15674cfc5 (patch)
tree772358ca91cfb076fbd075ad4b1667136232f9d3 /org.eclipse.mylyn.bugzilla.core
parentc9c1dcf92db9fb45bf84ff36d71e35919c331424 (diff)
downloadorg.eclipse.mylyn.tasks-4fb0be620436a8dcdeaa7d0ed821d9d15674cfc5.tar.gz
org.eclipse.mylyn.tasks-4fb0be620436a8dcdeaa7d0ed821d9d15674cfc5.tar.xz
org.eclipse.mylyn.tasks-4fb0be620436a8dcdeaa7d0ed821d9d15674cfc5.zip
NEW - bug 161835: new bugzilla task wizard should remember last selection of project
https://bugs.eclipse.org/bugs/show_bug.cgi?id=161835
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.core')
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java18
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentHandler.java2
2 files changed, 14 insertions, 6 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 058f528ca..473db55d3 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
@@ -19,6 +19,8 @@ import java.net.HttpURLConnection;
import java.net.Proxy;
import java.net.URL;
import java.security.GeneralSecurityException;
+import java.util.Arrays;
+import java.util.List;
import java.util.zip.GZIPInputStream;
import javax.security.auth.login.LoginException;
@@ -38,13 +40,19 @@ import org.xml.sax.helpers.XMLReaderFactory;
public class AbstractReportFactory {
private static final String CONTENT_TYPE_TEXT_HTML = "text/html";
-
+
private static final String CONTENT_TYPE_APP_RDF_XML = "application/rdf+xml";
private static final String CONTENT_TYPE_APP_XML = "application/xml";
+
+ private static final String CONTENT_TYPE_APP_XCGI = "application/x-cgi";
private static final String CONTENT_TYPE_TEXT_XML = "text/xml";
+ private static final String[] VALID_CONFIG_CONTENT_TYPES = {CONTENT_TYPE_APP_RDF_XML, CONTENT_TYPE_APP_XML, CONTENT_TYPE_TEXT_XML};
+
+ private static final List<String> VALID_TYPES = Arrays.asList(VALID_CONFIG_CONTENT_TYPES);
+
public static final int RETURN_ALL_HITS = -1;
/** expects rdf returned from repository (ctype=rdf in url)
@@ -57,6 +65,7 @@ public class AbstractReportFactory {
connection = WebClientUtil.openUrlConnection(url, proxySettings, false);
int responseCode = connection.getResponseCode();
+
if (responseCode != HttpURLConnection.HTTP_OK) {
String msg;
if (responseCode == -1 || responseCode == HttpURLConnection.HTTP_FORBIDDEN)
@@ -93,10 +102,7 @@ public class AbstractReportFactory {
in = new BufferedReader(strReader);
}
- if (connection.getContentType().contains(CONTENT_TYPE_APP_RDF_XML)
- || connection.getContentType().contains(CONTENT_TYPE_APP_XML)
- || connection.getContentType().contains(CONTENT_TYPE_TEXT_XML)) {
-
+ if (VALID_TYPES.contains(connection.getContentType().toLowerCase())) {
try {
final XMLReader reader = XMLReaderFactory.createXMLReader();
reader.setContentHandler(contentHandler);
@@ -124,6 +130,8 @@ public class AbstractReportFactory {
}
} else if (connection.getContentType().contains(CONTENT_TYPE_TEXT_HTML)) {
BugzillaServerFacade.parseHtmlError(in);
+ } else if (connection.getContentType().toLowerCase().contains(CONTENT_TYPE_APP_XCGI)) {
+ // ignore
} else {
throw new IOException("Unrecognized content type: " + connection.getContentType());
}
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 6ac5fbaa3..64ebca24a 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
@@ -159,7 +159,7 @@ public class BugzillaAttachmentHandler implements IAttachmentHandler {
}
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) {

Back to the top