Updated bug reporter to use ProxyUtils class from com.nokia.cpp.utils.core plugin to retrieve proxy data.
--- a/core/com.nokia.carbide.bugreport/META-INF/MANIFEST.MF Thu Aug 13 12:52:54 2009 -0500
+++ b/core/com.nokia.carbide.bugreport/META-INF/MANIFEST.MF Thu Aug 13 13:42:02 2009 -0500
@@ -10,7 +10,8 @@
org.eclipse.core.runtime,
org.eclipse.ui.console,
org.eclipse.jface.text,
- org.eclipse.core.net
+ org.eclipse.core.net,
+ com.nokia.cpp.utils.core
Bundle-ActivationPolicy: lazy
Export-Package: com.nokia.carbide.internal.bugreport.export
Bundle-ClassPath: lib/commons-httpclient-3.1.jar,
--- a/core/com.nokia.carbide.bugreport/src/com/nokia/carbide/internal/bugreport/model/Communication.java Thu Aug 13 12:52:54 2009 -0500
+++ b/core/com.nokia.carbide.bugreport/src/com/nokia/carbide/internal/bugreport/model/Communication.java Thu Aug 13 13:42:02 2009 -0500
@@ -19,24 +19,24 @@
import java.io.File;
import java.io.FileNotFoundException;
+import java.net.URI;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
+
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
-import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.apache.commons.httpclient.methods.multipart.StringPart;
import org.eclipse.core.net.proxy.IProxyData;
-import org.eclipse.core.net.proxy.IProxyService;
import com.nokia.carbide.internal.bugreport.export.IProduct;
-import com.nokia.carbide.internal.bugreport.plugin.BugReporterPlugin;
import com.nokia.carbide.internal.bugreport.resources.Messages;
+import com.nokia.cpp.internal.api.utils.core.ProxyUtils;
/**
* This class provides only one static method for sending the
@@ -153,11 +153,14 @@
}
public static void setProxyData(HttpClient client, PostMethod postMethod) {
- IProxyService proxyService = BugReporterPlugin.getDefault().getProxyService();
- boolean proxiesEnabled = proxyService.isProxiesEnabled();
- if (!proxiesEnabled)
+ URI uri = getURI(postMethod);
+ if (uri == null) {
return;
- IProxyData proxyData = proxyService.getProxyData(IProxyData.HTTP_PROXY_TYPE);
+ }
+ IProxyData proxyData = ProxyUtils.getProxyData(uri);
+ if (proxyData == null) {
+ return;
+ }
String host = proxyData.getHost();
int port = proxyData.getPort();
client.getHostConfiguration().setProxy(host, port);
@@ -170,5 +173,14 @@
postMethod.setDoAuthentication(true);
}
}
-
+
+ private static URI getURI(PostMethod postMethod) {
+ try {
+ return new URI(postMethod.getURI().toString());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
}