Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-05-03 02:19:15 -0400
committerAlexander Kurtakov2017-05-03 02:19:15 -0400
commit22529fb353be7bd4ff8f74ca7715c8d1e6c2cfb5 (patch)
treeabf655bc9fb435b489b037c69e789957bcdb3ab3 /bundles
parent5117c5fdef9bf7bc69f5ee198688b2eba92286c1 (diff)
downloadeclipse.platform.team-22529fb353be7bd4ff8f74ca7715c8d1e6c2cfb5.tar.gz
eclipse.platform.team-22529fb353be7bd4ff8f74ca7715c8d1e6c2cfb5.tar.xz
eclipse.platform.team-22529fb353be7bd4ff8f74ca7715c8d1e6c2cfb5.zip
* Add missing @Override/@Deprecated. * Generify * Lambda Change-Id: I89c9dd0a44a53fa91bacb28ceeea98f92e4bee0b Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.core.net/.settings/org.eclipse.jdt.core.prefs39
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java30
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Policy.java11
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceInitializer.java3
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java3
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyChangeEvent.java7
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyData.java16
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java55
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java11
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/StringMatcher.java4
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/StringUtil.java6
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java5
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java9
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyProviderUtil.java30
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java22
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpProxyProvider.java22
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyService.java4
17 files changed, 168 insertions, 109 deletions
diff --git a/bundles/org.eclipse.core.net/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.net/.settings/org.eclipse.jdt.core.prefs
index 6390bb9e3..136104031 100644
--- a/bundles/org.eclipse.core.net/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.core.net/.settings/org.eclipse.jdt.core.prefs
@@ -7,6 +7,15 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
@@ -28,6 +37,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
@@ -35,6 +45,7 @@ org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
@@ -45,7 +56,9 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
@@ -54,28 +67,47 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=error
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=error
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
@@ -83,14 +115,17 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
org.eclipse.jdt.core.compiler.source=1.8
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java
index 1a5980987..91d9c29bc 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -45,7 +45,7 @@ public class Activator implements BundleActivator {
*/
private static Activator instance;
- private static ServiceTracker logTracker;
+ private static ServiceTracker<FrameworkLog, FrameworkLog> logTracker;
private static final String PROP_REGISTER_SERVICE = "org.eclipse.net.core.enableProxyService"; //$NON-NLS-1$
@@ -53,11 +53,11 @@ public class Activator implements BundleActivator {
private BundleContext bundleContext;
- private ServiceTracker instanceLocationTracker;
+ private ServiceTracker<?,?> instanceLocationTracker;
- private ServiceRegistration debugRegistration;
+ private ServiceRegistration<DebugOptionsListener> debugRegistration;
- private ServiceRegistration proxyService;
+ private ServiceRegistration<IProxyService> proxyService;
private PreferenceManager preferenceManger;
@@ -96,11 +96,10 @@ public class Activator implements BundleActivator {
*/
private void log(IStatus status) {
if (logTracker == null) {
- logTracker = new ServiceTracker(bundleContext, FrameworkLog.class
- .getName(), null);
+ logTracker = new ServiceTracker<>(bundleContext, FrameworkLog.class, null);
logTracker.open();
}
- FrameworkLog log = (FrameworkLog) logTracker.getService();
+ FrameworkLog log = logTracker.getService();
if (log != null) {
log.log(getLog(status));
} else {
@@ -115,7 +114,7 @@ public class Activator implements BundleActivator {
*/
private FrameworkLogEntry getLog(IStatus status) {
Throwable t = status.getException();
- ArrayList childlist = new ArrayList();
+ ArrayList<FrameworkLogEntry> childlist = new ArrayList<>();
int stackCode = t instanceof CoreException ? 1 : 0;
// ensure a substatus inside a CoreException is properly logged
@@ -133,8 +132,8 @@ public class Activator implements BundleActivator {
}
}
- FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null
- : childlist.toArray(new FrameworkLogEntry[childlist.size()]));
+ FrameworkLogEntry[] children = childlist.size() == 0 ? null
+ : childlist.toArray(new FrameworkLogEntry[childlist.size()]);
return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(),
status.getCode(), status.getMessage(), stackCode, t, children);
@@ -150,6 +149,7 @@ public class Activator implements BundleActivator {
return (instanceLocation != null && instanceLocation.isSet());
}
+ @Override
public void start(BundleContext context) throws Exception {
this.bundleContext = context;
this.preferenceManger = PreferenceManager.createConfigurationManager(ID);
@@ -160,11 +160,11 @@ public class Activator implements BundleActivator {
// ignore this. It should never happen as we have tested the above
// format.
}
- instanceLocationTracker = new ServiceTracker(context, filter, null);
+ instanceLocationTracker = new ServiceTracker<>(context, filter, null);
instanceLocationTracker.open();
// register debug options listener
- Hashtable properties = new Hashtable(2);
+ Hashtable<String, String> properties = new Hashtable<>(2);
properties.put(DebugOptions.LISTENER_SYMBOLICNAME, ID);
debugRegistration = context.registerService(DebugOptionsListener.class, Policy.DEBUG_OPTIONS_LISTENER, properties);
@@ -173,11 +173,11 @@ public class Activator implements BundleActivator {
ProxyManager proxyManager = (ProxyManager) ProxyManager
.getProxyManager();
proxyManager.initialize();
- proxyService = context.registerService(IProxyService.class
- .getName(), proxyManager, new Hashtable());
+ proxyService = context.registerService(IProxyService.class, proxyManager, new Hashtable<>());
}
}
+ @Override
public void stop(BundleContext context) throws Exception {
if (proxyService != null) {
proxyService.unregister();
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Policy.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Policy.java
index 244a8b5c7..4cbde3572 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Policy.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Policy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2014 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,7 +12,6 @@ package org.eclipse.core.internal.net;
import java.util.Date;
-import org.eclipse.osgi.service.debug.DebugOptions;
import org.eclipse.osgi.service.debug.DebugOptionsListener;
public class Policy {
@@ -22,11 +21,9 @@ public class Policy {
public static boolean DEBUG_SYSTEM_PROVIDERS = false;
- static final DebugOptionsListener DEBUG_OPTIONS_LISTENER = new DebugOptionsListener() {
- public void optionsChanged(DebugOptions options) {
- DEBUG = options.getBooleanOption(Activator.ID + "/debug", false); //$NON-NLS-1$
- DEBUG_SYSTEM_PROVIDERS = DEBUG && options.getBooleanOption(Activator.ID + "/systemproviders", false); //$NON-NLS-1$
- }
+ static final DebugOptionsListener DEBUG_OPTIONS_LISTENER = options -> {
+ DEBUG = options.getBooleanOption(Activator.ID + "/debug", false); //$NON-NLS-1$
+ DEBUG_SYSTEM_PROVIDERS = DEBUG && options.getBooleanOption(Activator.ID + "/systemproviders", false); //$NON-NLS-1$
};
/**
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceInitializer.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceInitializer.java
index a47dd5085..e29c7d158 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceInitializer.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,6 +28,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
super();
}
+ @Override
public void initializeDefaultPreferences() {
IEclipsePreferences node = DefaultScope.INSTANCE.getNode(Activator.ID);
node.put(ProxyManager.PREF_NON_PROXIED_HOSTS, DEFAULT_PREF_NON_PROXIED_HOSTS);
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java
index 76c9a4fa1..740be82d8 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,6 +23,7 @@ public class PreferenceModifyListener extends
// Nothing to do
}
+ @Override
public IEclipsePreferences preApply(IEclipsePreferences node) {
// the node does not need to be the root of the hierarchy
Preferences root = node.node("/"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyChangeEvent.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyChangeEvent.java
index 3f3584a50..510887168 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyChangeEvent.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyChangeEvent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,22 +30,27 @@ public class ProxyChangeEvent implements IProxyChangeEvent {
this.changeData = changedData;
}
+ @Override
public int getChangeType() {
return type;
}
+ @Override
public IProxyData[] getChangedProxyData() {
return changeData;
}
+ @Override
public String[] getNonProxiedHosts() {
return nonProxiedHosts;
}
+ @Override
public String[] getOldNonProxiedHosts() {
return oldHosts;
}
+ @Override
public IProxyData[] getOldProxyData() {
return oldData;
}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyData.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyData.java
index 91d91fd14..2a68e3b2c 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyData.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -36,22 +36,27 @@ public class ProxyData implements IProxyData {
this.type = type;
}
+ @Override
public String getHost() {
return host;
}
+ @Override
public String getPassword() {
return password;
}
+ @Override
public int getPort() {
return port;
}
+ @Override
public String getType() {
return type;
}
+ @Override
public String getUserId() {
return user;
}
@@ -60,29 +65,35 @@ public class ProxyData implements IProxyData {
this.type = type;
}
+ @Override
public void setHost(String host) {
if (host != null && host.length() == 0)
host = null;
this.host = host;
}
+ @Override
public void setPassword(String password) {
this.password = password;
}
+ @Override
public void setPort(int port) {
this.port = port;
}
+ @Override
public void setUserid(String userid) {
this.user = userid;
requiresAuthentication = userid != null;
}
+ @Override
public boolean isRequiresAuthentication() {
return requiresAuthentication;
}
+ @Override
public void disable() {
host = null;
port = -1;
@@ -107,6 +118,7 @@ public class ProxyData implements IProxyData {
this.dynamic = dynamic;
}
+ @Override
public String toString() {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("type: "); //$NON-NLS-1$
@@ -128,6 +140,7 @@ public class ProxyData implements IProxyData {
return stringBuffer.toString();
}
+ @Override
public int hashCode() {
final int prime = 31;
int result = 1;
@@ -143,6 +156,7 @@ public class ProxyData implements IProxyData {
return result;
}
+ @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java
index 35111a766..234a32907 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -49,7 +49,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
private PreferenceManager preferenceManager;
- ListenerList listeners = new ListenerList(ListenerList.IDENTITY);
+ ListenerList<IProxyChangeListener> listeners = new ListenerList<>(ListenerList.IDENTITY);
private String[] nonProxiedHosts;
private final ProxyType[] proxies = new ProxyType[] {
new ProxyType(IProxyData.HTTP_PROXY_TYPE),
@@ -79,28 +79,24 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
return proxyManager;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.net.IProxyManager#addProxyChangeListener(org.eclipse.core.net.IProxyChangeListener)
- */
+ @Override
public void addProxyChangeListener(IProxyChangeListener listener) {
listeners.add(listener);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.net.IProxyManager#removeProxyChangeListener(org.eclipse.core.net.IProxyChangeListener)
- */
+ @Override
public void removeProxyChangeListener(IProxyChangeListener listener) {
listeners.remove(listener);
}
private void fireChange(final IProxyChangeEvent event) {
- Object[] l = listeners.getListeners();
- for (int i = 0; i < l.length; i++) {
- final IProxyChangeListener listener = (IProxyChangeListener)l[i];
+ for (final IProxyChangeListener listener : listeners) {
SafeRunner.run(new ISafeRunnable() {
+ @Override
public void run() throws Exception {
listener.proxyInfoChanged(event);
}
+ @Override
public void handleException(Throwable exception) {
// Logged by SafeRunner
}
@@ -108,9 +104,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.core.net.IProxyManager#getNonProxiedHosts()
- */
+ @Override
public synchronized String[] getNonProxiedHosts() {
checkMigrated();
if (nonProxiedHosts == null) {
@@ -131,9 +125,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
return new String[0];
}
- /* (non-Javadoc)
- * @see org.eclipse.core.net.IProxyManager#setNonProxiedHosts(java.lang.String[])
- */
+ @Override
public void setNonProxiedHosts(String[] hosts) {
checkMigrated();
Assert.isNotNull(hosts);
@@ -161,6 +153,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
}
+ @Override
public IProxyData[] getProxyData() {
checkMigrated();
IProxyData[] result = new IProxyData[proxies.length];
@@ -178,6 +171,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
return new IProxyData[0];
}
+ @Override
public void setProxyData(IProxyData[] proxies) {
checkMigrated();
doSetProxyData(proxies);
@@ -194,7 +188,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
}
private IProxyData[] internalSetProxyData(IProxyData[] proxyDatas) {
- List result = new ArrayList();
+ List<IProxyData> result = new ArrayList<>();
for (int i = 0; i < proxyDatas.length; i++) {
IProxyData proxyData = proxyDatas[i];
ProxyType type = getType(proxyData);
@@ -202,7 +196,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
result.add(proxyData);
}
}
- return (IProxyData[]) result.toArray(new IProxyData[result.size()]);
+ return result.toArray(new IProxyData[result.size()]);
}
private ProxyType getType(IProxyData proxyData) {
@@ -215,9 +209,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.net.IProxyManager#isProxiesEnabled()
- */
+ @Override
public boolean isProxiesEnabled() {
checkMigrated();
return internalIsProxiesEnabled()
@@ -228,9 +220,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
return preferenceManager.getBoolean(PreferenceManager.ROOT, PREF_ENABLED);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.net.IProxyManager#setProxiesEnabled(boolean)
- */
+ @Override
public void setProxiesEnabled(boolean enabled) {
checkMigrated();
boolean current = internalIsProxiesEnabled();
@@ -276,6 +266,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
registerAuthenticator();
}
+ @Override
public IProxyData getProxyData(String type) {
checkMigrated();
return resolveType(internalGetProxyData(type, ProxyType.VERIFY_EQUAL));
@@ -291,6 +282,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
return null;
}
+ @Override
public IProxyData[] getProxyDataForHost(String host) {
checkMigrated();
if (!internalIsProxiesEnabled()) {
@@ -307,13 +299,13 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
if (isHostFiltered(uri))
return new IProxyData[0];
IProxyData[] data = getProxyData();
- List result = new ArrayList();
+ List<IProxyData> result = new ArrayList<>();
for (int i = 0; i < data.length; i++) {
IProxyData proxyData = data[i];
if (proxyData.getHost() != null)
result.add(proxyData);
}
- IProxyData ret[] = (IProxyData[]) result.toArray(new IProxyData[result.size()]);
+ IProxyData ret[] = result.toArray(new IProxyData[result.size()]);
return resolveType(ret);
}
@@ -339,9 +331,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.net.core.IProxyManager#getProxyDataForHost(java.lang.String, java.lang.String)
- */
+ @Override
public IProxyData getProxyDataForHost(String host, String type) {
checkMigrated();
if (!internalIsProxiesEnabled()) {
@@ -405,6 +395,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
configuration, proxies, isInitialize);
}
+ @Override
public void preferenceChange(PreferenceChangeEvent event) {
if (event.getKey().equals(PREF_ENABLED) || event.getKey().equals(PREF_OS)) {
checkMigrated();
@@ -413,15 +404,18 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
}
}
+ @Override
public boolean hasSystemProxies() {
return nativeProxyProvider != null;
}
+ @Override
public boolean isSystemProxiesEnabled() {
checkMigrated();
return preferenceManager.getBoolean(PreferenceManager.ROOT, PREF_OS);
}
+ @Override
public void setSystemProxiesEnabled(boolean enabled) {
checkMigrated();
boolean current = isSystemProxiesEnabled();
@@ -432,6 +426,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
preferenceManager.putBoolean(PreferenceManager.ROOT, PREF_OS, enabled);
}
+ @Override
public IProxyData[] select(URI uri) {
IProxyData data = getProxyDataForHost(uri.getHost(), uri.getScheme());
if (data != null) {
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java
index a0a701fe1..be57bbbdb 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -100,13 +100,13 @@ public class ProxyType implements INodeChangeListener, IPreferenceChangeListener
public static String[] convertPropertyStringToHosts(String property) {
String hosts[] = StringUtil.split(property, new String[] { "|" }); //$NON-NLS-1$
- ArrayList ret = new ArrayList();
+ ArrayList<String> ret = new ArrayList<>();
for (int i = 0; i < hosts.length; i++) {
if (hosts[i].length() != 0) {
ret.add(hosts[i]);
}
}
- return (String[]) ret.toArray(new String[0]);
+ return ret.toArray(new String[0]);
}
public ProxyType(String name) {
@@ -571,7 +571,7 @@ public class ProxyType implements INodeChangeListener, IPreferenceChangeListener
private synchronized boolean hasJavaNetProxyClass() {
try {
- Class proxyClass = Class.forName("java.net.Proxy"); //$NON-NLS-1$
+ Class<?> proxyClass = Class.forName("java.net.Proxy"); //$NON-NLS-1$
return proxyClass != null;
} catch (ClassNotFoundException e) {
// Ignore
@@ -579,16 +579,19 @@ public class ProxyType implements INodeChangeListener, IPreferenceChangeListener
return false;
}
+ @Override
public void added(NodeChangeEvent event) {
// Add a preference listener so we'll get changes to the fields of the node
if (event.getChild().name().equals(getName()))
((IEclipsePreferences)event.getChild()).addPreferenceChangeListener(this);
}
+ @Override
public void removed(NodeChangeEvent event) {
// Nothing to do
}
+ @Override
public void preferenceChange(PreferenceChangeEvent event) {
if (updatingPreferences)
return;
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/StringMatcher.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/StringMatcher.java
index 88b3b5eb8..cb9a46577 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/StringMatcher.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/StringMatcher.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -245,7 +245,7 @@ public class StringMatcher {
}
}
- Vector temp = new Vector();
+ Vector<String> temp = new Vector<>();
int pos = 0;
StringBuffer buf = new StringBuffer();
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/StringUtil.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/StringUtil.java
index 903f6ceed..2fab70d6a 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/StringUtil.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/StringUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,7 +24,7 @@ public class StringUtil {
* @return array of tokens
*/
public static String[] split(String value, String[] delimiters) {
- ArrayList result = new ArrayList();
+ ArrayList<String> result = new ArrayList<>();
int firstIndex = 0;
int separator = 0;
while (firstIndex != -1) {
@@ -48,7 +48,7 @@ public class StringUtil {
result.add(value);
}
}
- return (String[]) result.toArray(new String[0]);
+ return result.toArray(new String[0]);
}
/**
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java
index 1462d15dc..d42503517 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 compeople AG and others.
+ * Copyright (c) 2008, 2017 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -44,6 +44,7 @@ public class WindowsProxyProvider extends AbstractProxyProvider {
}
}
+ @Override
public IProxyData[] select(URI uri) {
IProxyData[] proxies = new IProxyData[0];
if (jWinHttpLoaded) {
@@ -57,6 +58,7 @@ public class WindowsProxyProvider extends AbstractProxyProvider {
return proxies;
}
+ @Override
protected IProxyData[] getProxyData() {
if (jWinHttpLoaded) {
return winHttpProxyProvider.getProxyData();
@@ -64,6 +66,7 @@ public class WindowsProxyProvider extends AbstractProxyProvider {
return new IProxyData[0];
}
+ @Override
protected String[] getNonProxiedHosts() {
if (jWinHttpLoaded) {
return winHttpProxyProvider.getNonProxiedHosts();
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java
index 1dd90b730..1f13abdb3 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/unix/UnixProxyProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Oakland Software Incorporated and others
+ * Copyright (c) 2008, 2017 Oakland Software Incorporated and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -50,6 +50,7 @@ public class UnixProxyProvider extends AbstractProxyProvider {
// Nothing to initialize
}
+ @Override
public IProxyData[] select(URI uri) {
String[] nonProxyHosts = getNonProxiedHosts();
if (nonProxyHosts != null) {
@@ -75,6 +76,7 @@ public class UnixProxyProvider extends AbstractProxyProvider {
return proxies;
}
+ @Override
public IProxyData[] getProxyData() {
String[] commonTypes = new String[] { IProxyData.HTTP_PROXY_TYPE,
IProxyData.SOCKS_PROXY_TYPE, IProxyData.HTTPS_PROXY_TYPE };
@@ -82,7 +84,7 @@ public class UnixProxyProvider extends AbstractProxyProvider {
}
private IProxyData[] getProxyForTypes(String[] types) {
- ArrayList allData = new ArrayList();
+ ArrayList<IProxyData> allData = new ArrayList<>();
for (int i = 0; i < types.length; i++) {
String type = types[i];
ProxyData pd = getSystemProxyInfo(type);
@@ -90,9 +92,10 @@ public class UnixProxyProvider extends AbstractProxyProvider {
allData.add(pd);
}
}
- return (IProxyData[]) allData.toArray(new IProxyData[0]);
+ return allData.toArray(new IProxyData[0]);
}
+ @Override
public String[] getNonProxiedHosts() {
String[] npHosts;
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyProviderUtil.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyProviderUtil.java
index f13dc5cc3..9f16a1d5b 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyProviderUtil.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/ProxyProviderUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 compeople AG and others.
+ * Copyright (c) 2008, 2017 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -56,8 +56,8 @@ public final class ProxyProviderUtil {
* @param protocolSpecificProxies
* a map from http schemes to the list of scheme specific proxies
*/
- public static void fillProxyLists(String proxyList, List universalProxies,
- Map protocolSpecificProxies) {
+ public static void fillProxyLists(String proxyList, List<IProxyData> universalProxies,
+ Map<String, List<IProxyData>> protocolSpecificProxies) {
StringTokenizer tokenizer = new StringTokenizer(proxyList, ";"); //$NON-NLS-1$
while (tokenizer.hasMoreTokens()) {
createProxy(tokenizer.nextToken(), universalProxies,
@@ -66,7 +66,7 @@ public final class ProxyProviderUtil {
}
private static void createProxy(final String proxyDefinition,
- List universalProxies, Map protocolSpecificProxies) {
+ List<IProxyData> universalProxies, Map<String, List<IProxyData>> protocolSpecificProxies) {
String protocol = null;
String host = null;
int port = 0;
@@ -127,11 +127,11 @@ public final class ProxyProviderUtil {
return PROXY_DEFAULT_PORT;
}
- private static void addProtocolSpecificProxy(Map protocolSpecificProxies,
+ private static void addProtocolSpecificProxy(Map<String, List<IProxyData>> protocolSpecificProxies,
String protocol, IProxyData proxy) {
- List list = (List) protocolSpecificProxies.get(protocol);
+ List<IProxyData> list = protocolSpecificProxies.get(protocol);
if (list == null) {
- list = new ArrayList();
+ list = new ArrayList<>();
protocolSpecificProxies.put(protocol, list);
}
@@ -164,7 +164,7 @@ public final class ProxyProviderUtil {
* Pac related helper methods below here.
*/
- private static final Map PROXY_TYPE_MAP;
+ private static final Map<String, String> PROXY_TYPE_MAP;
/*
* @see "http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html"
@@ -176,7 +176,7 @@ public final class ProxyProviderUtil {
static {
// mapping of pacProgram proxy type names to java proxy types:
- final Map temp = new HashMap();
+ final Map<String, String> temp = new HashMap<>();
temp.put(PAC_PROXY_TYPE_DIRECT, NO_PROXY);
temp.put(PAC_PROXY_TYPE_PROXY, IProxyData.HTTP_PROXY_TYPE);
temp.put(PAC_PROXY_TYPE_SOCKS, IProxyData.SOCKS_PROXY_TYPE);
@@ -187,12 +187,12 @@ public final class ProxyProviderUtil {
* @param pacFindProxyForUrlResult
* @return a list of IProxyData objects
*/
- public static List getProxies(String pacFindProxyForUrlResult) {
+ public static List<IProxyData> getProxies(String pacFindProxyForUrlResult) {
if (pacFindProxyForUrlResult == null
|| pacFindProxyForUrlResult.trim().length() == 0)
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
- final List result = new ArrayList();
+ final List<IProxyData> result = new ArrayList<>();
final StringTokenizer scanner = new StringTokenizer(
pacFindProxyForUrlResult, ";"); //$NON-NLS-1$
while (scanner.hasMoreTokens()) {
@@ -214,7 +214,7 @@ public final class ProxyProviderUtil {
pacProxy = "PROXY " + pacProxy; //$NON-NLS-1$
StringTokenizer scanner = new StringTokenizer(pacProxy);
String pacProxyType = scanner.nextToken();
- String proxyType = (String) PROXY_TYPE_MAP.get(pacProxyType);
+ String proxyType = PROXY_TYPE_MAP.get(pacProxyType);
if (proxyType == null || proxyType.equals(NO_PROXY))
return null;
@@ -234,9 +234,9 @@ public final class ProxyProviderUtil {
}
private static boolean startsWithProxyType(String pacProxy) {
- Iterator iter = PROXY_TYPE_MAP.keySet().iterator();
+ Iterator<String> iter = PROXY_TYPE_MAP.keySet().iterator();
while (iter.hasNext())
- if (pacProxy.startsWith((String) iter.next()))
+ if (pacProxy.startsWith(iter.next()))
return true;
return false;
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java
index b1e139f91..92c516b98 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 compeople AG and others.
+ * Copyright (c) 2008, 2017 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,8 +29,8 @@ import org.eclipse.core.net.proxy.IProxyData;
public class StaticProxyConfig {
private static final String[] KNOWN_TYPES = {"HTTP", "HTTPS", "FTP", "GOPHER"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- private List universalProxies = new ArrayList();
- private Map protocolSpecificProxies = new HashMap();
+ private List<IProxyData> universalProxies = new ArrayList<>();
+ private Map<String, List<IProxyData>> protocolSpecificProxies = new HashMap<>();
private ProxyBypass proxyBypass;
/**
@@ -51,21 +51,21 @@ public class StaticProxyConfig {
* @param uri
* @param proxies
*/
- public void select(URI uri, List proxies) {
+ public void select(URI uri, List<IProxyData> proxies) {
if (proxyBypass.bypassProxyFor(uri))
return;
if (!protocolSpecificProxies.isEmpty()) {
if (uri.getScheme() != null) {
- List protocolProxies = (List) protocolSpecificProxies.get(uri
+ List<IProxyData> protocolProxies = protocolSpecificProxies.get(uri
.getScheme().toUpperCase());
if (protocolProxies == null)
return;
proxies.addAll(protocolProxies);
} else {
- Iterator it = protocolSpecificProxies.values().iterator();
+ Iterator<List<IProxyData>> it = protocolSpecificProxies.values().iterator();
while (it.hasNext()) {
- List protocolProxies = (List) it.next();
+ List<IProxyData> protocolProxies = it.next();
if (protocolProxies == null)
return;
proxies.addAll(protocolProxies);
@@ -91,15 +91,15 @@ public class StaticProxyConfig {
IProxyData[] data = getUniversalProxiesData();
if (data.length > 0)
return data;
- List proxies = new ArrayList();
- Iterator it = protocolSpecificProxies.values().iterator();
+ List<IProxyData> proxies = new ArrayList<>();
+ Iterator<List<IProxyData>> it = protocolSpecificProxies.values().iterator();
while (it.hasNext()) {
- List protocolProxies = (List) it.next();
+ List<IProxyData> protocolProxies = it.next();
if (protocolProxies != null) {
proxies.addAll(protocolProxies);
}
}
- return (IProxyData[]) proxies.toArray(new IProxyData[0]);
+ return proxies.toArray(new IProxyData[0]);
}
private IProxyData[] getUniversalProxiesData() {
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpProxyProvider.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpProxyProvider.java
index fd263d417..06e547305 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpProxyProvider.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/WinHttpProxyProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 compeople AG and others.
+ * Copyright (c) 2008, 2017 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -156,7 +156,7 @@ public class WinHttpProxyProvider {
return EMPTY_PROXIES;
}
- List proxies = new ArrayList();
+ List<IProxyData> proxies = new ArrayList<>();
// Let�s find out if auto detect has changed.
if (newProxyConfig.autoDetectChanged(proxyConfig)) {
@@ -203,10 +203,10 @@ public class WinHttpProxyProvider {
return toArray(proxies);
}
- protected void pacSelect(int hHttpSession, URI uri, List proxies) {
+ protected void pacSelect(int hHttpSession, URI uri, List<IProxyData> proxies) {
if (!tryPac)
return;
- List pacProxies = pacSelect(hHttpSession, proxyConfig
+ List<IProxyData> pacProxies = pacSelect(hHttpSession, proxyConfig
.getAutoConfigUrl(), uri);
if (pacProxies == null)
tryPac = false;
@@ -215,7 +215,7 @@ public class WinHttpProxyProvider {
}
- protected void wpadSelect(int hHttpSession, URI uri, List proxies) {
+ protected void wpadSelect(int hHttpSession, URI uri, List<IProxyData> proxies) {
if (tryWpadGetUrl) {
tryWpadGetUrl = false;
AutoProxyHolder autoProxyHolder = new AutoProxyHolder();
@@ -232,7 +232,7 @@ public class WinHttpProxyProvider {
}
if (wpadAutoConfigUrl == null)
return;
- List wpadProxies = pacSelect(hHttpSession, wpadAutoConfigUrl, uri);
+ List<IProxyData> wpadProxies = pacSelect(hHttpSession, wpadAutoConfigUrl, uri);
if (wpadProxies == null)
wpadAutoConfigUrl = null;
else
@@ -247,14 +247,14 @@ public class WinHttpProxyProvider {
* @param uri
* @return a list of proxies (IProxyData) or null in case of an error.
*/
- protected List pacSelect(int hHttpSession, String configUrl, URI uri) {
+ protected List<IProxyData> pacSelect(int hHttpSession, String configUrl, URI uri) {
// Don�t ask for anything else than http or https since that is not
// supported by WinHttp pac file support:
// ERROR_WINHTTP_UNRECOGNIZED_SCHEME
if (!IProxyData.HTTP_PROXY_TYPE.equalsIgnoreCase(uri.getScheme())
&& !IProxyData.HTTPS_PROXY_TYPE.equalsIgnoreCase(uri
.getScheme()))
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
// Set up the autoproxy call.
WinHttpAutoProxyOptions autoProxyOptions = new WinHttpAutoProxyOptions();
autoProxyOptions
@@ -272,7 +272,7 @@ public class WinHttpProxyProvider {
}
ProxyBypass proxyBypass = new ProxyBypass(proxyInfo.getProxyBypass());
if (proxyBypass.bypassProxyFor(uri))
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
return ProxyProviderUtil.getProxies(proxyInfo.getProxy());
}
@@ -281,8 +281,8 @@ public class WinHttpProxyProvider {
this.logThrowable = throwable;
}
- private static IProxyData[] toArray(List proxies) {
- return (IProxyData[]) proxies.toArray(new IProxyData[proxies.size()]);
+ private static IProxyData[] toArray(List<IProxyData> proxies) {
+ return proxies.toArray(new IProxyData[proxies.size()]);
}
}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyService.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyService.java
index f2ee93b1a..a6d9ec4c2 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyService.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -137,6 +137,7 @@ public interface IProxyService {
* @return the list of known proxy types and their settings for the
* given host
*/
+ @Deprecated
IProxyData[] getProxyDataForHost(String host);
/**
@@ -187,6 +188,7 @@ public interface IProxyService {
* @see IProxyData#HTTPS_PROXY_TYPE
* @see IProxyData#SOCKS_PROXY_TYPE
*/
+ @Deprecated
IProxyData getProxyDataForHost(String host, String type);
/**

Back to the top