Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-11-13 16:41:19 +0000
committerAlexander Kurtakov2018-11-13 16:41:19 +0000
commit132c7200cc044b74add3e7e7801a909758323636 (patch)
treeef9674c5a80c71237dbfac96abe736ece531bd9e
parent5b54f131855a262b56065972f55627bc1fb4176b (diff)
downloadrt.equinox.bundles-132c7200cc044b74add3e7e7801a909758323636.tar.gz
rt.equinox.bundles-132c7200cc044b74add3e7e7801a909758323636.tar.xz
rt.equinox.bundles-132c7200cc044b74add3e7e7801a909758323636.zip
Move o.e.equinox.security to Java 8
Generifications, warnings, etc. Change-Id: I797edbd8fc036bb582e8dd72dfabe8b3b076ecda
-rw-r--r--bundles/org.eclipse.equinox.security/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.security/.settings/org.eclipse.jdt.core.prefs81
-rw-r--r--bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.security/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/AuthPlugin.java26
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ConfigurationFactory.java4
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ConfigurationFederator.java12
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/SecureContext.java10
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/events/SecurityEventsManager.java29
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ext/loader/ExtLoginModuleLoader.java4
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/credentials/EquinoxPrivateCredential.java5
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/credentials/EquinoxPublicCredential.java6
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/CryptoData.java3
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/JavaEncryption.java45
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PasswordManagement.java6
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PasswordProviderSelector.java47
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PersistedPath.java3
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferences.java49
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesContainer.java18
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesMapper.java18
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesRoot.java12
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesWrapper.java30
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/InternalExchangeUtils.java13
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/PasswordProviderDescription.java10
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/ReEncrypter.java25
-rw-r--r--bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/security/auth/module/ExtensionLoginModule.java24
26 files changed, 283 insertions, 205 deletions
diff --git a/bundles/org.eclipse.equinox.security/.classpath b/bundles/org.eclipse.equinox.security/.classpath
index 2fbb7a23e..eca7bdba8 100644
--- a/bundles/org.eclipse.equinox.security/.classpath
+++ b/bundles/org.eclipse.equinox.security/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/bundles/org.eclipse.equinox.security/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.security/.settings/org.eclipse.jdt.core.prefs
index ef9c79c6c..18ea860e9 100644
--- a/bundles/org.eclipse.equinox.security/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.security/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,3 @@
-#Thu Mar 27 08:49:56 CDT 2008
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
@@ -8,29 +7,46 @@ 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.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+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
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
@@ -41,7 +57,10 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
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=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
@@ -49,34 +68,71 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-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=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+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=warning
+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=warning
+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=ignore
+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=warning
+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=warning
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
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=warning
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=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
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=enabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
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=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@@ -148,7 +204,12 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
diff --git a/bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF
index e44a38df6..fff17024a 100644
--- a/bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.security;singleton:=true
-Bundle-Version: 1.2.600.qualifier
+Bundle-Version: 1.3.0.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.equinox.internal.security.auth.AuthPlugin
@@ -37,7 +37,7 @@ Import-Package: javax.crypto,
org.osgi.framework;version="[1.4.0,2.0.0)",
org.osgi.service.prefs;version="[1.1.0,2.0.0)",
org.osgi.util.tracker;version="[1.3.3,2.0.0)"
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Eclipse-BuddyPolicy: registered
Automatic-Module-Name: org.eclipse.equinox.security
diff --git a/bundles/org.eclipse.equinox.security/pom.xml b/bundles/org.eclipse.equinox.security/pom.xml
index 6b717855b..7596027f9 100644
--- a/bundles/org.eclipse.equinox.security/pom.xml
+++ b/bundles/org.eclipse.equinox.security/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.security</artifactId>
- <version>1.2.600-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/AuthPlugin.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/AuthPlugin.java
index a380d3610..56c1a02e3 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/AuthPlugin.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/AuthPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -39,10 +39,10 @@ public class AuthPlugin implements BundleActivator {
private static AuthPlugin singleton;
private BundleContext bundleContext;
- private ServiceTracker debugTracker = null;
- private ServiceTracker configTracker = null;
- private ServiceTracker environmentTracker = null;
- private volatile ServiceTracker logTracker = null;
+ private ServiceTracker<?, DebugOptions> debugTracker = null;
+ private ServiceTracker<?, Location> configTracker = null;
+ private ServiceTracker<?, EnvironmentInfo> environmentTracker = null;
+ private volatile ServiceTracker<?, FrameworkLog> logTracker = null;
public static boolean DEBUG = false;
public static boolean DEBUG_LOGIN_FRAMEWORK = false;
@@ -59,6 +59,7 @@ public class AuthPlugin implements BundleActivator {
super();
}
+ @Override
public void start(BundleContext context) throws Exception {
bundleContext = context;
singleton = this;
@@ -71,6 +72,7 @@ public class AuthPlugin implements BundleActivator {
// time spend in the bundle activator).
}
+ @Override
public void stop(BundleContext context) throws Exception {
PasswordProviderSelector.stop();
@@ -113,10 +115,10 @@ public class AuthPlugin implements BundleActivator {
if (debugTracker == null) {
if (bundleContext == null)
return defaultValue;
- debugTracker = new ServiceTracker(bundleContext, DebugOptions.class.getName(), null);
+ debugTracker = new ServiceTracker<>(bundleContext, DebugOptions.class, null);
debugTracker.open();
}
- DebugOptions options = (DebugOptions) debugTracker.getService();
+ DebugOptions options = debugTracker.getService();
if (options == null)
return defaultValue;
String value = options.getOption(option);
@@ -133,10 +135,10 @@ public class AuthPlugin implements BundleActivator {
} catch (InvalidSyntaxException e) {
// should never happen
}
- configTracker = new ServiceTracker(bundleContext, filter, null);
+ configTracker = new ServiceTracker<>(bundleContext, filter, null);
configTracker.open();
}
- Location location = (Location) configTracker.getService();
+ Location location = configTracker.getService();
if (location == null)
return null;
return location.getURL();
@@ -146,10 +148,10 @@ public class AuthPlugin implements BundleActivator {
if (environmentTracker == null) {
if (bundleContext == null)
return null;
- environmentTracker = new ServiceTracker(bundleContext, EnvironmentInfo.class.getName(), null);
+ environmentTracker = new ServiceTracker<>(bundleContext, EnvironmentInfo.class, null);
environmentTracker.open();
}
- return (EnvironmentInfo) environmentTracker.getService();
+ return environmentTracker.getService();
}
/**
@@ -165,7 +167,7 @@ public class AuthPlugin implements BundleActivator {
*/
public void frameworkLogError(String msg, int severity, Throwable e) {
if ((logTracker == null) && (bundleContext != null)) {
- logTracker = new ServiceTracker(bundleContext, FrameworkLog.class.getName(), null);
+ logTracker = new ServiceTracker<>(bundleContext, FrameworkLog.class, null);
logTracker.open();
}
FrameworkLog log = (logTracker == null) ? null : (FrameworkLog) logTracker.getService();
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ConfigurationFactory.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ConfigurationFactory.java
index 550cd12a6..c57fcf5c5 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ConfigurationFactory.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ConfigurationFactory.java
@@ -43,7 +43,7 @@ public class ConfigurationFactory {
IExtensionPoint point = registry.getExtensionPoint(POINT_PROVIDER);
IExtension[] extensions = point.getExtensions();
- ArrayList returnValue = new ArrayList(extensions.length);
+ ArrayList<Configuration> returnValue = new ArrayList<>(extensions.length);
for (int i = 0; i < extensions.length; i++) {
IConfigurationElement[] elements = extensions[i].getConfigurationElements();
for (int j = 0; j < elements.length; j++) {
@@ -52,7 +52,7 @@ public class ConfigurationFactory {
returnValue.add(provider);
}
}
- return (Configuration[]) returnValue.toArray(new Configuration[] {});
+ return returnValue.toArray(new Configuration[] {});
}
private Configuration readProvider(IConfigurationElement element) {
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ConfigurationFederator.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ConfigurationFederator.java
index f8432e77e..1b649d8e6 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ConfigurationFederator.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ConfigurationFederator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -27,8 +27,8 @@ public class ConfigurationFederator extends Configuration {
// events
private Configuration[] federatedConfigs = null;
- private Hashtable configCache = new Hashtable(5);
- private Hashtable configToProviderMap = new Hashtable(5);
+ private Hashtable<String, AppConfigurationEntry[]> configCache = new Hashtable<>(5);
+ private Hashtable<String, String> configToProviderMap = new Hashtable<>(5);
final private Configuration defaultConfiguration;
@@ -36,8 +36,9 @@ public class ConfigurationFederator extends Configuration {
this.defaultConfiguration = defaultConfiguration;
}
+ @Override
public synchronized AppConfigurationEntry[] getAppConfigurationEntry(String name) {
- AppConfigurationEntry[] returnValue = (AppConfigurationEntry[]) configCache.get(name);
+ AppConfigurationEntry[] returnValue = configCache.get(name);
if (returnValue != null)
return returnValue;
@@ -54,7 +55,7 @@ public class ConfigurationFederator extends Configuration {
AppConfigurationEntry[] config = allConfigs[i].getAppConfigurationEntry(name);
if (config == null)
continue;
- String cachedProviderName = (String) configToProviderMap.get(name);
+ String cachedProviderName = configToProviderMap.get(name);
if (cachedProviderName != null && !cachedProviderName.equals(allConfigs[i].getClass().getName())) {
String message = NLS.bind(SecAuthMessages.duplicateJaasConfig1, name, cachedProviderName);
AuthPlugin.getDefault().logError(message, null);
@@ -78,6 +79,7 @@ public class ConfigurationFederator extends Configuration {
return returnValue;
}
+ @Override
public synchronized void refresh() {
for (int i = 0; i < federatedConfigs.length; i++)
federatedConfigs[i].refresh();
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/SecureContext.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/SecureContext.java
index e714bdf53..943ef25a6 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/SecureContext.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/SecureContext.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -20,8 +20,8 @@ import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import org.eclipse.equinox.internal.security.auth.events.SecurityEventsManager;
import org.eclipse.equinox.internal.security.auth.nls.SecAuthMessages;
-import org.eclipse.equinox.security.auth.ILoginContextListener;
import org.eclipse.equinox.security.auth.ILoginContext;
+import org.eclipse.equinox.security.auth.ILoginContextListener;
public class SecureContext implements ILoginContext {
@@ -45,6 +45,7 @@ public class SecureContext implements ILoginContext {
this.handler = handler;
}
+ @Override
public void login() throws LoginException {
LoginContext context = getLoginContext();
LoginException loginException = null;
@@ -64,6 +65,7 @@ public class SecureContext implements ILoginContext {
loggedIn = true;
}
+ @Override
public void logout() throws LoginException {
LoginContext context = getLoginContext();
Subject subject = getLoginContext().getSubject();
@@ -79,12 +81,14 @@ public class SecureContext implements ILoginContext {
loggedIn = false;
}
+ @Override
public Subject getSubject() throws LoginException {
if (!loggedIn)
login();
return getLoginContext().getSubject();
}
+ @Override
public LoginContext getLoginContext() throws LoginException {
if (loginContext != null)
return loginContext;
@@ -102,10 +106,12 @@ public class SecureContext implements ILoginContext {
return loginContext;
}
+ @Override
public void registerListener(ILoginContextListener listener) {
eventsManager.addListener(listener);
}
+ @Override
public void unregisterListener(ILoginContextListener listener) {
eventsManager.removeListener(listener);
}
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/events/SecurityEventsManager.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/events/SecurityEventsManager.java
index e9866a2c4..427481f4f 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/events/SecurityEventsManager.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/events/SecurityEventsManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.equinox.internal.security.auth.events;
-import java.util.Iterator;
import java.util.Vector;
import javax.security.auth.Subject;
import javax.security.auth.login.LoginException;
@@ -21,7 +20,7 @@ import org.eclipse.equinox.security.auth.ILoginContextListener;
public class SecurityEventsManager {
- private Vector listeners = new Vector(5);
+ private Vector<ILoginContextListener> listeners = new Vector<>(5);
synchronized public void addListener(ILoginContextListener listener) {
listeners.add(listener);
@@ -32,34 +31,26 @@ public class SecurityEventsManager {
}
public void notifyLoginBegin(Subject subject) {
- for (Iterator i = listeners.iterator(); i.hasNext();) {
- Object listener = i.next();
- if (listener instanceof ILoginContextListener)
- ((ILoginContextListener) listener).onLoginStart(subject);
+ for (ILoginContextListener listener : listeners) {
+ listener.onLoginStart(subject);
}
}
public void notifyLoginEnd(Subject subject, LoginException loginException) {
- for (Iterator i = listeners.iterator(); i.hasNext();) {
- Object listener = i.next();
- if (listener instanceof ILoginContextListener)
- ((ILoginContextListener) listener).onLoginFinish(subject, loginException);
+ for (ILoginContextListener listener : listeners) {
+ listener.onLoginFinish(subject, loginException);
}
}
public void notifyLogoutBegin(Subject subject) {
- for (Iterator i = listeners.iterator(); i.hasNext();) {
- Object listener = i.next();
- if (listener instanceof ILoginContextListener)
- ((ILoginContextListener) listener).onLogoutStart(subject);
+ for (ILoginContextListener listener : listeners) {
+ listener.onLogoutStart(subject);
}
}
public void notifyLogoutEnd(Subject subject, LoginException loginException) {
- for (Iterator i = listeners.iterator(); i.hasNext();) {
- Object listener = i.next();
- if (listener instanceof ILoginContextListener)
- ((ILoginContextListener) listener).onLogoutFinish(subject, loginException);
+ for (ILoginContextListener listener : listeners) {
+ listener.onLogoutFinish(subject, loginException);
}
}
}
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ext/loader/ExtLoginModuleLoader.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ext/loader/ExtLoginModuleLoader.java
index 23e467e2d..92cef92e1 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ext/loader/ExtLoginModuleLoader.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/auth/ext/loader/ExtLoginModuleLoader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -32,7 +32,7 @@ public class ExtLoginModuleLoader {
final private static String ELEM_MODULE = "loginModule"; //$NON-NLS-1$
final private static String ATTR_MODULE_CLASS = "class"; //$NON-NLS-1$
- public static LoginModule load(Map options) {
+ public static LoginModule load(Map<String, ?> options) {
IExtensionRegistry registry = RegistryFactory.getRegistry();
IExtensionPoint point = registry.getExtensionPoint(POINT_MODULE);
IExtension[] extensions = point.getExtensions();
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/credentials/EquinoxPrivateCredential.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/credentials/EquinoxPrivateCredential.java
index 4734df5e6..c5ff2e0c8 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/credentials/EquinoxPrivateCredential.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/credentials/EquinoxPrivateCredential.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -26,14 +26,17 @@ public class EquinoxPrivateCredential implements IPrivateCredential {
this.loginModuleID = loginModuleID;
}
+ @Override
public PBEKeySpec getPrivateKey() {
return key;
}
+ @Override
public String getProviderID() {
return loginModuleID;
}
+ @Override
public void clear() {
if (key != null)
key.clearPassword();
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/credentials/EquinoxPublicCredential.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/credentials/EquinoxPublicCredential.java
index 62462a852..a83c78e26 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/credentials/EquinoxPublicCredential.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/credentials/EquinoxPublicCredential.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -37,10 +37,12 @@ public class EquinoxPublicCredential implements IPublicCredential {
this.loginModuleID = loginModuleID;
}
+ @Override
public String getName() {
return name;
}
+ @Override
public Principal getPrimaryRole() {
if (primaryRole != null)
return primaryRole;
@@ -49,10 +51,12 @@ public class EquinoxPublicCredential implements IPublicCredential {
return null;
}
+ @Override
public Principal[] getRoles() {
return roles;
}
+ @Override
public String getProviderID() {
return loginModuleID;
}
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/CryptoData.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/CryptoData.java
index 11275dcc2..b8a87bc24 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/CryptoData.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/CryptoData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -74,6 +74,7 @@ public class CryptoData {
}
}
+ @Override
public String toString() {
StringBuffer encryptedText = (moduleID == null) ? new StringBuffer() : new StringBuffer(moduleID);
encryptedText.append(MODULE_ID_SEPARATOR);
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/JavaEncryption.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/JavaEncryption.java
index 333566f1f..d45a59dab 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/JavaEncryption.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/JavaEncryption.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2017 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,6 +16,7 @@ package org.eclipse.equinox.internal.security.storage;
import java.security.*;
import java.security.spec.InvalidKeySpecException;
import java.util.*;
+import java.util.Map.Entry;
import javax.crypto.*;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
@@ -53,7 +54,7 @@ public class JavaEncryption {
private boolean initialized = false;
- private HashMap availableCiphers;
+ private HashMap<String, String> availableCiphers;
public JavaEncryption() {
// placeholder
@@ -88,11 +89,7 @@ public class JavaEncryption {
if (callback == null)
internalInitialize();
else {
- callback.execute(new IStorageTask() {
- public void execute() throws StorageException {
- internalInitialize();
- }
- });
+ callback.execute(() -> internalInitialize());
}
} finally {
lock.release();
@@ -123,8 +120,8 @@ public class JavaEncryption {
throw new StorageException(StorageException.INTERNAL_ERROR, SecAuthMessages.noAlgorithms);
// use first available
- cipherAlgorithm = (String) availableCiphers.keySet().iterator().next();
- keyFactoryAlgorithm = (String) availableCiphers.get(cipherAlgorithm);
+ cipherAlgorithm = availableCiphers.keySet().iterator().next();
+ keyFactoryAlgorithm = availableCiphers.get(cipherAlgorithm);
String msg = NLS.bind(SecAuthMessages.usingAlgorithm, unavailableCipher, cipherAlgorithm);
AuthPlugin.getDefault().logMessage(msg);
@@ -223,16 +220,12 @@ public class JavaEncryption {
* Result: Map:
* <String>cipher -> <String>keyFactory
*/
- public HashMap detect() {
+ public HashMap<String, String> detect() {
IUICallbacks callback = CallbacksProvider.getDefault().getCallback();
if (callback == null)
return internalDetect();
- IStorageTask task = new IStorageTask() {
- public void execute() {
- internalDetect();
- }
- };
+ IStorageTask task = () -> internalDetect();
try {
callback.execute(task);
} catch (StorageException e) { // should not happen in this path
@@ -241,13 +234,12 @@ public class JavaEncryption {
return availableCiphers;
}
- public HashMap internalDetect() {
- Set ciphers = findProviders(CIPHER);
- Set keyFactories = findProviders(SECRET_KEY_FACTORY);
- availableCiphers = new HashMap(ciphers.size());
+ public HashMap<String, String> internalDetect() {
+ Set<String> ciphers = findProviders(CIPHER);
+ Set<String> keyFactories = findProviders(SECRET_KEY_FACTORY);
+ availableCiphers = new HashMap<>(ciphers.size());
- for (Iterator i = ciphers.iterator(); i.hasNext();) {
- String cipher = (String) i.next();
+ for (String cipher : ciphers) {
// check if there is a key factory with the same name
if (keyFactories.contains(cipher)) {
if (roundtrip(cipher, cipher)) {
@@ -255,8 +247,7 @@ public class JavaEncryption {
continue;
}
}
- for (Iterator j = keyFactories.iterator(); j.hasNext();) {
- String keyFactory = (String) j.next();
+ for (String keyFactory : keyFactories) {
if (roundtrip(cipher, keyFactory)) {
availableCiphers.put(cipher, keyFactory);
continue;
@@ -266,13 +257,13 @@ public class JavaEncryption {
return availableCiphers;
}
- private Set findProviders(String prefix) {
+ private Set<String> findProviders(String prefix) {
Provider[] providers = Security.getProviders();
- Set algorithms = new HashSet();
+ Set<String> algorithms = new HashSet<>();
int prefixLength = prefix.length();
for (int i = 0; i < providers.length; i++) {
- for (Iterator j = providers[i].entrySet().iterator(); j.hasNext();) {
- Map.Entry entry = (Map.Entry) j.next();
+ for (Iterator<Entry<Object, Object>> j = providers[i].entrySet().iterator(); j.hasNext();) {
+ Entry<Object, Object> entry = j.next();
Object key = entry.getKey();
if (key == null)
continue;
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PasswordManagement.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PasswordManagement.java
index 58d0a6a8c..ee3070d71 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PasswordManagement.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PasswordManagement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -103,7 +103,7 @@ public class PasswordManagement {
static public String[] getPasswordRecoveryQuestions(SecurePreferencesRoot root, String moduleID) {
// retrieve stored questions
- List questions = new ArrayList();
+ List<String> questions = new ArrayList<>();
SecurePreferences node = recoveryNode(root, moduleID);
for (int i = 0;; i++) {
String key = PASSWORD_RECOVERY_QUESTION + Integer.toString(i + 1);
@@ -119,7 +119,7 @@ public class PasswordManagement {
}
}
String[] result = new String[questions.size()];
- return (String[]) questions.toArray(result);
+ return questions.toArray(result);
}
static public String recoverPassword(String[] answers, SecurePreferencesRoot root, String moduleID) {
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PasswordProviderSelector.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PasswordProviderSelector.java
index a76676d81..0b6e9f97c 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PasswordProviderSelector.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PasswordProviderSelector.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2017 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -42,7 +42,7 @@ public class PasswordProviderSelector implements IRegistryEventListener {
final private static String HINTS_NAME = "hint";//$NON-NLS-1$
final private static String HINT_VALUE = "value";//$NON-NLS-1$
- private Map modules = new HashMap(5); // cache of modules found
+ private Map<String, PasswordProviderModuleExt> modules = new HashMap<>(5); // cache of modules found
public class ExtStorageModule {
public String moduleID;
@@ -50,9 +50,9 @@ public class PasswordProviderSelector implements IRegistryEventListener {
public int priority;
public String name;
public String description;
- public List hints;
+ public List<String> hints;
- public ExtStorageModule(String id, IConfigurationElement element, int priority, String name, String description, List hints) {
+ public ExtStorageModule(String id, IConfigurationElement element, int priority, String name, String description, List<String> hints) {
super();
this.element = element;
this.moduleID = id;
@@ -86,13 +86,13 @@ public class PasswordProviderSelector implements IRegistryEventListener {
// hides default constructor; use getInstance()
}
- public List findAvailableModules(String expectedID) {
+ public List<ExtStorageModule> findAvailableModules(String expectedID) {
IExtensionRegistry registry = RegistryFactory.getRegistry();
IExtensionPoint point = registry.getExtensionPoint(EXTENSION_POINT);
IExtension[] extensions = point.getExtensions();
- ArrayList allAvailableModules = new ArrayList(extensions.length);
+ ArrayList<ExtStorageModule> allAvailableModules = new ArrayList<>(extensions.length);
for (int i = 0; i < extensions.length; i++) {
String moduleID = extensions[i].getUniqueIdentifier();
@@ -122,10 +122,10 @@ public class PasswordProviderSelector implements IRegistryEventListener {
String description = element.getAttribute(MODULE_DESCRIPTION);
- List suppliedHints = null;
+ List<String> suppliedHints = null;
IConfigurationElement[] hints = element.getChildren(HINTS_NAME);
if (hints.length != 0) {
- suppliedHints = new ArrayList(hints.length);
+ suppliedHints = new ArrayList<>(hints.length);
for (int j = 0; j < hints.length; j++) {
String hint = hints[j].getAttribute(HINT_VALUE);
if (hint != null)
@@ -147,12 +147,10 @@ public class PasswordProviderSelector implements IRegistryEventListener {
allAvailableModules.add(new ExtStorageModule(moduleID, element, priority, name, description, suppliedHints));
}
- Collections.sort(allAvailableModules, new Comparator() {
- public int compare(Object o1, Object o2) {
- int p1 = ((ExtStorageModule) o1).priority;
- int p2 = ((ExtStorageModule) o2).priority;
- return p2 - p1;
- }
+ Collections.sort(allAvailableModules, (o1, o2) -> {
+ int p1 = o1.priority;
+ int p2 = o2.priority;
+ return p2 - p1;
});
return allAvailableModules;
@@ -163,14 +161,13 @@ public class PasswordProviderSelector implements IRegistryEventListener {
expectedID = expectedID.toLowerCase(); // ID is case-insensitive
synchronized (modules) {
if (modules.containsKey(expectedID))
- return (PasswordProviderModuleExt) modules.get(expectedID);
+ return modules.get(expectedID);
}
- List allAvailableModules = findAvailableModules(expectedID);
- HashSet disabledModules = getDisabledModules();
+ List<ExtStorageModule> allAvailableModules = findAvailableModules(expectedID);
+ HashSet<String> disabledModules = getDisabledModules();
- for (Iterator i = allAvailableModules.iterator(); i.hasNext();) {
- ExtStorageModule module = (ExtStorageModule) i.next();
+ for (ExtStorageModule module : allAvailableModules) {
if (expectedID == null && disabledModules != null && disabledModules.contains(module.moduleID))
continue;
@@ -214,18 +211,22 @@ public class PasswordProviderSelector implements IRegistryEventListener {
//////////////////////////////////////////////////////////////////////////////////////////////
// Synch local cache with the registry
+ @Override
public void added(IExtension[] extensions) {
clearCaches();
}
+ @Override
public void added(IExtensionPoint[] extensionPoints) {
clearCaches();
}
+ @Override
public void removed(IExtension[] extensions) {
clearCaches();
}
+ @Override
public void removed(IExtensionPoint[] extensionPoints) {
clearCaches();
}
@@ -250,14 +251,14 @@ public class PasswordProviderSelector implements IRegistryEventListener {
}
}
- protected HashSet getDisabledModules() {
+ protected HashSet<String> getDisabledModules() {
IScopeContext[] scopes = {ConfigurationScope.INSTANCE, DefaultScope.INSTANCE};
String defaultPreferenceValue = ""; //$NON-NLS-1$
IPreferencesService preferencesService = getPreferencesService();
String tmp = preferencesService.getString(AuthPlugin.PI_AUTH, IStorageConstants.DISABLED_PROVIDERS_KEY, defaultPreferenceValue, scopes);
if (tmp == null || tmp.length() == 0)
return null;
- HashSet disabledModules = new HashSet();
+ HashSet<String> disabledModules = new HashSet<>();
String[] disabledProviders = tmp.split(","); //$NON-NLS-1$
for (int i = 0; i < disabledProviders.length; i++) {
disabledModules.add(disabledProviders[i]);
@@ -267,12 +268,12 @@ public class PasswordProviderSelector implements IRegistryEventListener {
private IPreferencesService getPreferencesService() {
BundleContext context = AuthPlugin.getDefault().getBundleContext();
- ServiceReference reference = context.getServiceReference(IPreferencesService.class);
+ ServiceReference<IPreferencesService> reference = context.getServiceReference(IPreferencesService.class);
if (reference == null) {
throw new IllegalStateException("Failed to find service: " + IPreferencesService.class); //$NON-NLS-1$
}
try {
- return (IPreferencesService) context.getService(reference);
+ return context.getService(reference);
} finally {
context.ungetService(reference);
}
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PersistedPath.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PersistedPath.java
index c5c492d85..7d4336083 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PersistedPath.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/PersistedPath.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -39,6 +39,7 @@ public class PersistedPath {
return path;
}
+ @Override
public String toString() {
String result;
int pathLength = path == null ? 0 : path.length();
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferences.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferences.java
index 213443221..f31f259a5 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferences.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferences.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -54,12 +54,12 @@ public class SecurePreferences {
/**
* Child nodes; created lazily; might be null
*/
- protected Map children;
+ protected Map<String, SecurePreferences> children;
/**
* Values associated with this node; created lazily; might be null
*/
- private Map values;
+ private Map<String, String> values;
/**
* Cache root node to improve performance a bit
@@ -110,12 +110,12 @@ public class SecurePreferences {
checkRemoved();
if (values == null)
return EMPTY_STRING_ARRAY;
- Set keys = values.keySet();
+ Set<String> keys = values.keySet();
int size = keys.size();
String[] result = new String[size];
int pos = 0;
- for (Iterator i = keys.iterator(); i.hasNext();) {
- result[pos++] = (String) i.next();
+ for (String string : keys) {
+ result[pos++] = string;
}
return result;
}
@@ -124,12 +124,12 @@ public class SecurePreferences {
checkRemoved();
if (children == null)
return EMPTY_STRING_ARRAY;
- Set keys = children.keySet();
+ Set<String> keys = children.keySet();
int size = keys.size();
String[] result = new String[size];
int pos = 0;
- for (Iterator i = keys.iterator(); i.hasNext();) {
- result[pos++] = (String) i.next();
+ for (String string : keys) {
+ result[pos++] = string;
}
return result;
}
@@ -165,11 +165,11 @@ public class SecurePreferences {
synchronized private SecurePreferences getChild(String segment, boolean create) {
if (children == null) {
if (create)
- children = new HashMap(5);
+ children = new HashMap<>(5);
else
return null;
}
- SecurePreferences child = (SecurePreferences) children.get(segment);
+ SecurePreferences child = children.get(segment);
if (!create || (child != null))
return child;
child = new SecurePreferences(this, segment);
@@ -194,18 +194,16 @@ public class SecurePreferences {
thisNodePath = parentsPath + PATH_SEPARATOR + name;
if (values != null) {
- for (Iterator it = values.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- String key = (String) entry.getKey();
+ for (Entry<String, String> entry : values.entrySet()) {
+ String key = entry.getKey();
PersistedPath extenalTag = new PersistedPath(thisNodePath, key);
- properties.setProperty(extenalTag.toString(), (String) entry.getValue());
+ properties.setProperty(extenalTag.toString(), entry.getValue());
}
}
if (children != null) {
- for (Iterator i = children.entrySet().iterator(); i.hasNext();) {
- Map.Entry entry = (Map.Entry) i.next();
- SecurePreferences child = (SecurePreferences) entry.getValue();
+ for (Entry<String, SecurePreferences> entry : children.entrySet()) {
+ SecurePreferences child = entry.getValue();
child.flush(properties, thisNodePath);
}
}
@@ -300,14 +298,14 @@ public class SecurePreferences {
synchronized protected void internalPut(String key, String value) {
if (values == null)
- values = new HashMap(5);
+ values = new HashMap<>(5);
values.put(key, value);
}
protected String internalGet(String key) {
if (values == null)
return null;
- return (String) values.get(key);
+ return values.get(key);
}
protected void markModified() {
@@ -340,9 +338,8 @@ public class SecurePreferences {
removed = true;
if (children == null)
return;
- for (Iterator i = children.entrySet().iterator(); i.hasNext();) {
- Map.Entry entry = (Map.Entry) i.next();
- SecurePreferences child = (SecurePreferences) entry.getValue();
+ for (Entry<String, SecurePreferences> entry : children.entrySet()) {
+ SecurePreferences child = entry.getValue();
child.markRemoved();
}
}
@@ -379,10 +376,10 @@ public class SecurePreferences {
return true;
char[] chars = path.toCharArray();
boolean lastSlash = false;
- for (int i = 0; i < chars.length; i++) {
- if ((chars[i] <= 31) || (chars[i] >= 127))
+ for (char c : chars) {
+ if ((c <= 31) || (c >= 127))
return false;
- boolean isSlash = (chars[i] == IPath.SEPARATOR);
+ boolean isSlash = (c == IPath.SEPARATOR);
if (lastSlash && isSlash)
return false;
lastSlash = isSlash;
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesContainer.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesContainer.java
index ed0841ce1..b3ecd598e 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesContainer.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -64,24 +64,24 @@ import org.eclipse.equinox.security.storage.provider.IPreferencesContainer;
*/
public class SecurePreferencesContainer implements IPreferencesContainer {
- private Map wrappers = new HashMap(); // node -> SecurePreferencesWrapper
+ private Map<SecurePreferences, SecurePreferencesWrapper> wrappers = new HashMap<>(); // node -> SecurePreferencesWrapper
- final private Map options;
+ final private Map<Object, Object> options;
final private SecurePreferencesRoot root;
- public SecurePreferencesContainer(SecurePreferencesRoot root, Map options) {
+ public SecurePreferencesContainer(SecurePreferencesRoot root, Map<Object, Object> options) {
this.root = root;
if (options != null) { // make a copy to avoid problems if original is modified later
- this.options = new HashMap(options.size());
+ this.options = new HashMap<>(options.size());
this.options.putAll(options);
} else
- this.options = new HashMap(2);
+ this.options = new HashMap<>(2);
}
public ISecurePreferences wrapper(SecurePreferences node) {
synchronized (wrappers) {
if (wrappers.containsKey(node))
- return (ISecurePreferences) wrappers.get(node);
+ return wrappers.get(node);
SecurePreferencesWrapper newWrapper = new SecurePreferencesWrapper(node, this);
wrappers.put(node, newWrapper);
return newWrapper;
@@ -95,10 +95,12 @@ public class SecurePreferencesContainer implements IPreferencesContainer {
}
}
+ @Override
public URL getLocation() {
return root.getLocation();
}
+ @Override
public ISecurePreferences getPreferences() {
return wrapper(root);
}
@@ -110,12 +112,14 @@ public class SecurePreferencesContainer implements IPreferencesContainer {
//////////////////////////////////////////////////////////////////////////////////
// Handling of options
+ @Override
public boolean hasOption(Object key) {
synchronized (options) {
return options.containsKey(key);
}
}
+ @Override
public Object getOption(Object key) {
synchronized (options) {
return options.get(key);
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesMapper.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesMapper.java
index 101fbfec9..e286a7643 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesMapper.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesMapper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -45,7 +45,7 @@ public class SecurePreferencesMapper {
static private ISecurePreferences defaultPreferences = null;
- static private Map preferences = new HashMap(); // URL.toString() -> SecurePreferencesRoot
+ static private Map<String, SecurePreferencesRoot> preferences = new HashMap<>(); // URL.toString() -> SecurePreferencesRoot
final public static String USER_HOME = "user.home"; //$NON-NLS-1$
@@ -110,7 +110,7 @@ public class SecurePreferencesMapper {
String key = location.toString();
SecurePreferencesRoot root;
if (preferences.containsKey(key))
- root = (SecurePreferencesRoot) preferences.get(key);
+ root = preferences.get(key);
else {
root = new SecurePreferencesRoot(location);
preferences.put(key, root);
@@ -123,8 +123,7 @@ public class SecurePreferencesMapper {
static public void stop() {
synchronized (preferences) {
- for (Iterator i = preferences.values().iterator(); i.hasNext();) {
- SecurePreferencesRoot provider = (SecurePreferencesRoot) i.next();
+ for (SecurePreferencesRoot provider : preferences.values()) {
try {
provider.flush();
} catch (IOException e) {
@@ -139,8 +138,7 @@ public class SecurePreferencesMapper {
static public void clearPasswordCache() {
synchronized (preferences) {
- for (Iterator i = preferences.values().iterator(); i.hasNext();) {
- SecurePreferencesRoot provider = (SecurePreferencesRoot) i.next();
+ for (SecurePreferencesRoot provider : preferences.values()) {
provider.clearPasswordCache();
}
}
@@ -151,8 +149,8 @@ public class SecurePreferencesMapper {
if (root == null)
return;
synchronized (preferences) {
- for (Iterator i = preferences.values().iterator(); i.hasNext();) {
- SecurePreferencesRoot provider = (SecurePreferencesRoot) i.next();
+ for (Iterator<SecurePreferencesRoot> i = preferences.values().iterator(); i.hasNext();) {
+ SecurePreferencesRoot provider = i.next();
if (!root.equals(provider))
continue;
i.remove();
@@ -191,7 +189,7 @@ public class SecurePreferencesMapper {
if (buffer.length() == 0)
return options;
if (options == null)
- options = new HashMap(1);
+ options = new HashMap<>(1);
if (!options.containsKey(IProviderHints.DEFAULT_PASSWORD))
options.put(IProviderHints.DEFAULT_PASSWORD, new PBEKeySpec(buffer.toString().toCharArray()));
} catch (IOException e) {
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesRoot.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesRoot.java
index 94684204a..0ed54efdf 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesRoot.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesRoot.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -80,7 +80,7 @@ public class SecurePreferencesRoot extends SecurePreferences implements IStorage
private JavaEncryption cipher = new JavaEncryption();
- private Map passwordCache = new HashMap(5); // cached passwords: module ID -> PasswordExt
+ private Map<String, PasswordExt> passwordCache = new HashMap<>(5); // cached passwords: module ID -> PasswordExt
public SecurePreferencesRoot(URL location) throws IOException {
super(null, null);
@@ -96,6 +96,7 @@ public class SecurePreferencesRoot extends SecurePreferences implements IStorage
return cipher;
}
+ @Override
public boolean isModified() {
return modified;
}
@@ -142,8 +143,8 @@ public class SecurePreferencesRoot extends SecurePreferences implements IStorage
properties.remove(KEY_FACTORY_KEY);
}
- for (Iterator it = properties.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
+ for (Iterator<Entry<Object, Object>> it = properties.entrySet().iterator(); it.hasNext();) {
+ Entry<Object, Object> entry = it.next();
Object externalKey = entry.getKey();
Object value = entry.getValue();
if (!(externalKey instanceof String))
@@ -160,6 +161,7 @@ public class SecurePreferencesRoot extends SecurePreferences implements IStorage
}
}
+ @Override
synchronized public void flush() throws IOException {
if (location == null)
return;
@@ -245,7 +247,7 @@ public class SecurePreferencesRoot extends SecurePreferences implements IStorage
// Quick check first: it is cached?
synchronized (passwordCache) {
if (passwordCache.containsKey(key))
- return (PasswordExt) passwordCache.get(key);
+ return passwordCache.get(key);
}
// if this is (a headless run or JUnit) and prompt hint is not set up, set it to "false"
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesWrapper.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesWrapper.java
index 180a19b1c..555896f2d 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesWrapper.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/SecurePreferencesWrapper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -37,34 +37,42 @@ public class SecurePreferencesWrapper implements ISecurePreferences {
return container;
}
+ @Override
public String absolutePath() {
return node.absolutePath();
}
+ @Override
public String[] childrenNames() {
return node.childrenNames();
}
+ @Override
public void clear() {
node.clear();
}
+ @Override
public void flush() throws IOException {
node.flush();
}
+ @Override
public String[] keys() {
return node.keys();
}
+ @Override
public String name() {
return node.name();
}
+ @Override
public void remove(String key) {
node.remove(key);
}
+ @Override
public boolean equals(Object obj) {
if (obj == null)
return false;
@@ -74,6 +82,7 @@ public class SecurePreferencesWrapper implements ISecurePreferences {
return container.equals(other.container) && node.equals(other.node);
}
+ @Override
public int hashCode() {
String tmp = Integer.toString(container.hashCode()) + '|' + Integer.toString(node.hashCode());
return tmp.hashCode();
@@ -82,10 +91,12 @@ public class SecurePreferencesWrapper implements ISecurePreferences {
///////////////////////////////////////////////////////////////////////////
// Navigation
+ @Override
public ISecurePreferences node(String pathName) {
return container.wrapper(node.node(pathName));
}
+ @Override
public ISecurePreferences parent() {
SecurePreferences parent = node.parent();
if (parent == null)
@@ -93,10 +104,12 @@ public class SecurePreferencesWrapper implements ISecurePreferences {
return container.wrapper(node.parent());
}
+ @Override
public boolean nodeExists(String pathName) {
return node.nodeExists(pathName);
}
+ @Override
public void removeNode() {
container.removeWrapper(node);
node.removeNode();
@@ -105,62 +118,77 @@ public class SecurePreferencesWrapper implements ISecurePreferences {
////////////////////////////////////////////////////////////////////////////////////////
// puts() and gets()
+ @Override
public String get(String key, String def) throws StorageException {
return node.get(key, def, container);
}
+ @Override
public void put(String key, String value, boolean encrypt) throws StorageException {
node.put(key, value, encrypt, container);
}
+ @Override
public boolean getBoolean(String key, boolean def) throws StorageException {
return node.getBoolean(key, def, container);
}
+ @Override
public void putBoolean(String key, boolean value, boolean encrypt) throws StorageException {
node.putBoolean(key, value, encrypt, container);
}
+ @Override
public int getInt(String key, int def) throws StorageException {
return node.getInt(key, def, container);
}
+ @Override
public void putInt(String key, int value, boolean encrypt) throws StorageException {
node.putInt(key, value, encrypt, container);
}
+ @Override
public float getFloat(String key, float def) throws StorageException {
return node.getFloat(key, def, container);
}
+ @Override
public void putFloat(String key, float value, boolean encrypt) throws StorageException {
node.putFloat(key, value, encrypt, container);
}
+ @Override
public long getLong(String key, long def) throws StorageException {
return node.getLong(key, def, container);
}
+ @Override
public void putLong(String key, long value, boolean encrypt) throws StorageException {
node.putLong(key, value, encrypt, container);
}
+ @Override
public double getDouble(String key, double def) throws StorageException {
return node.getDouble(key, def, container);
}
+ @Override
public void putDouble(String key, double value, boolean encrypt) throws StorageException {
node.putDouble(key, value, encrypt, container);
}
+ @Override
public byte[] getByteArray(String key, byte[] def) throws StorageException {
return node.getByteArray(key, def, container);
}
+ @Override
public void putByteArray(String key, byte[] value, boolean encrypt) throws StorageException {
node.putByteArray(key, value, encrypt, container);
}
+ @Override
public boolean isEncrypted(String key) throws StorageException {
return node.isEncrypted(key);
}
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/InternalExchangeUtils.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/InternalExchangeUtils.java
index 892840561..087f7042d 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/InternalExchangeUtils.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/InternalExchangeUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -40,7 +40,7 @@ public class InternalExchangeUtils {
* the secure storage. Returns Map of pairs: supported cipher algorithm to
* a supported key factory algorithm.
*/
- static public Map ciphersDetectAvailable() {
+ static public Map<String, String> ciphersDetectAvailable() {
return new JavaEncryption().detect();
}
@@ -50,11 +50,10 @@ public class InternalExchangeUtils {
* might fail on instantiation and not be available for the actual use.
* @return available password providers as described in extensions
*/
- static public List passwordProvidersFind() {
- List availableModules = PasswordProviderSelector.getInstance().findAvailableModules(null);
- List result = new ArrayList(availableModules.size());
- for (Iterator i = availableModules.iterator(); i.hasNext();) {
- ExtStorageModule module = (ExtStorageModule) i.next();
+ static public List<PasswordProviderDescription> passwordProvidersFind() {
+ List<ExtStorageModule> availableModules = PasswordProviderSelector.getInstance().findAvailableModules(null);
+ List<PasswordProviderDescription> result = new ArrayList<>(availableModules.size());
+ for (ExtStorageModule module : availableModules) {
result.add(new PasswordProviderDescription(module.name, module.moduleID, module.priority, module.description, module.hints));
}
return result;
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/PasswordProviderDescription.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/PasswordProviderDescription.java
index 23b2d1286..47dda4f8c 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/PasswordProviderDescription.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/PasswordProviderDescription.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.equinox.internal.security.storage.friends;
-import java.util.Iterator;
import java.util.List;
/**
@@ -27,9 +26,9 @@ public class PasswordProviderDescription {
private String id;
private String name;
private String description;
- private List hints;
+ private List<String> hints;
- public PasswordProviderDescription(String name, String id, int priority, String description, List hints) {
+ public PasswordProviderDescription(String name, String id, int priority, String description, List<String> hints) {
this.id = id;
this.name = name;
this.priority = priority;
@@ -52,8 +51,7 @@ public class PasswordProviderDescription {
public boolean hasHint(String hint) {
if (hints == null)
return false;
- for (Iterator i = hints.iterator(); i.hasNext();) {
- String candidate = (String) i.next();
+ for (String candidate : hints) {
if (hint.equalsIgnoreCase(candidate))
return true;
}
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/ReEncrypter.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/ReEncrypter.java
index 37bf585f5..8648060b2 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/ReEncrypter.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/internal/security/storage/friends/ReEncrypter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -32,9 +32,9 @@ public class ReEncrypter {
private class TmpElement {
private String path; // absolute node path
- private Map values; // <String>key -> <String>value
+ private Map<String, String> values; // <String>key -> <String>value
- public TmpElement(String path, Map values) {
+ public TmpElement(String path, Map<String, String> values) {
this.path = path;
this.values = values;
}
@@ -43,7 +43,7 @@ public class ReEncrypter {
return path;
}
- public Map getValues() {
+ public Map<String, String> getValues() {
return values;
}
}
@@ -52,7 +52,7 @@ public class ReEncrypter {
final private String moduleID;
private boolean processedOK = true;
- private ArrayList elements = new ArrayList(); // List<TmpElement>
+ private ArrayList<TmpElement> elements = new ArrayList<>(); // List<TmpElement>
public ReEncrypter(ISecurePreferences prefs, String moduleID) {
this.moduleID = moduleID;
@@ -71,7 +71,7 @@ public class ReEncrypter {
private void decrypt(ISecurePreferences node) {
String[] keys = node.keys();
if (keys.length > 0) {
- Map map = new HashMap(keys.length); // could be less than that
+ Map<String, String> map = new HashMap<>(keys.length); // could be less than that
for (int i = 0; i < keys.length; i++) {
try {
if (!node.isEncrypted(keys[i]))
@@ -124,15 +124,14 @@ public class ReEncrypter {
SecurePreferencesContainer container = ((SecurePreferencesWrapper) root).getContainer();
Object originalProperty = container.getOption(IProviderHints.REQUIRED_MODULE_ID);
container.setOption(IProviderHints.REQUIRED_MODULE_ID, moduleID);
- for (Iterator i = elements.iterator(); i.hasNext();) {
- TmpElement element = (TmpElement) i.next();
+ for (TmpElement element : elements) {
ISecurePreferences node = root.node(element.getPath());
- Map values = element.getValues();
- for (Iterator it = values.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- String key = (String) entry.getKey();
+ Map<String, String> values = element.getValues();
+ for (Iterator<Entry<String, String>> it = values.entrySet().iterator(); it.hasNext();) {
+ Entry<String, String> entry = it.next();
+ String key = entry.getKey();
try {
- node.put(key, (String) entry.getValue(), true);
+ node.put(key, entry.getValue(), true);
} catch (StorageException e) {
// this value will not be re-coded
String msg = NLS.bind(SecAuthMessages.encryptingError, key, node.absolutePath());
diff --git a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/security/auth/module/ExtensionLoginModule.java b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/security/auth/module/ExtensionLoginModule.java
index 00d4b331b..e251c1ee8 100644
--- a/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/security/auth/module/ExtensionLoginModule.java
+++ b/bundles/org.eclipse.equinox.security/src/org/eclipse/equinox/security/auth/module/ExtensionLoginModule.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -48,38 +48,28 @@ final public class ExtensionLoginModule implements LoginModule {
// place holder
}
- /* (non-Javadoc)
- * @see javax.security.auth.spi.LoginModule#initialize(javax.security.auth.Subject, javax.security.auth.callback.CallbackHandler, java.util.Map, java.util.Map)
- */
- public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
+ @Override
+ public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
target = ExtLoginModuleLoader.load(options);
target.initialize(subject, callbackHandler, sharedState, options);
}
- /* (non-Javadoc)
- * @see javax.security.auth.spi.LoginModule#login()
- */
+ @Override
public boolean login() throws LoginException {
return target.login();
}
- /* (non-Javadoc)
- * @see javax.security.auth.spi.LoginModule#commit()
- */
+ @Override
public boolean commit() throws LoginException {
return target.commit();
}
- /* (non-Javadoc)
- * @see javax.security.auth.spi.LoginModule#abort()
- */
+ @Override
public boolean abort() throws LoginException {
return target.abort();
}
- /* (non-Javadoc)
- * @see javax.security.auth.spi.LoginModule#logout()
- */
+ @Override
public boolean logout() throws LoginException {
return target.logout();
}

Back to the top