Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-09-04 15:12:16 +0000
committerAlexander Kurtakov2017-09-04 15:28:07 +0000
commit84c0010b4087047b6a2266bcda21d21dbcb595fd (patch)
tree146817a74995b6657fc165f7d9eccb26ad485783
parent61dd236707838aef30d2f849b4ffd4df3093717a (diff)
downloadrt.equinox.p2-84c0010b4087047b6a2266bcda21d21dbcb595fd.tar.gz
rt.equinox.p2-84c0010b4087047b6a2266bcda21d21dbcb595fd.tar.xz
rt.equinox.p2-84c0010b4087047b6a2266bcda21d21dbcb595fd.zip
Bug 521838 - Move discovery.compatibility to Java 8
* Bump BREE. * Bump minor version for the BREE change. * Enable more warnings. * Lambda conversions. * Remove duplicate type declarations. * Try-with-resources. * StandardCharsets usage. * Add missing Override annotations. Change-Id: Ic7b0dd0946fcae017212ed674509934d0bfcb6e9 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.discovery.compatibility/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.discovery.compatibility/.settings/org.eclipse.jdt.core.prefs25
-rw-r--r--bundles/org.eclipse.equinox.p2.discovery.compatibility/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.p2.discovery.compatibility/pom.xml4
-rw-r--r--bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/Activator.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/ConnectorDiscoveryExtensionReader.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/Directory.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DirectoryParser.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DiscoveryRegistryStrategy.java25
-rw-r--r--bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/RemoteBundleDiscoveryStrategy.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/SiteVerifier.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/CacheManager.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/DefaultSaxErrorHandler.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.discovery/META-INF/MANIFEST.MF2
15 files changed, 77 insertions, 61 deletions
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/.classpath b/bundles/org.eclipse.equinox.p2.discovery.compatibility/.classpath
index 64c5e31b7..eca7bdba8 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/.classpath
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/.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.5"/>
+ <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.p2.discovery.compatibility/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.discovery.compatibility/.settings/org.eclipse.jdt.core.prefs
index 2a689a7f3..6b05c7a68 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/.settings/org.eclipse.jdt.core.prefs
@@ -10,13 +10,16 @@ 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.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+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
@@ -33,7 +36,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -50,7 +53,7 @@ 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.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=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
@@ -59,7 +62,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
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
@@ -67,20 +70,22 @@ 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.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
@@ -95,6 +100,9 @@ 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
@@ -102,6 +110,7 @@ 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
@@ -114,7 +123,7 @@ 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.5
+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
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.discovery.compatibility/META-INF/MANIFEST.MF
index 2d139b642..a6b30519e 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/META-INF/MANIFEST.MF
@@ -2,9 +2,9 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.equinox.p2.discovery.compatibility;singleton:=true
-Bundle-Version: 1.0.200.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Vendor: %Bundle-Vendor
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.3.0",
org.eclipse.equinox.p2.core;bundle-version="2.0.0",
org.eclipse.equinox.p2.discovery;bundle-version="1.0.0",
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/pom.xml b/bundles/org.eclipse.equinox.p2.discovery.compatibility/pom.xml
index 933382fb7..a75078964 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012 Eclipse Foundation.
+ Copyright (c) 2012, 2017 Eclipse Foundation.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.discovery.compatibility</artifactId>
- <version>1.0.200-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/Activator.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/Activator.java
index 9afe76d32..f29c6fddc 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Sonatype, Inc.
+ * Copyright (c) 2010, 2017 Sonatype, Inc.
* 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,11 +24,13 @@ public class Activator extends Plugin {
public static final String ID = "org.eclipse.equinox.p2.discovery.compatibility"; //$NON-NLS-1$
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
+ @Override
public void stop(BundleContext context) throws Exception {
super.stop(context);
plugin = null;
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/ConnectorDiscoveryExtensionReader.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/ConnectorDiscoveryExtensionReader.java
index 403d2cd4b..04f293ec4 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/ConnectorDiscoveryExtensionReader.java
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/ConnectorDiscoveryExtensionReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Tasktop Technologies and others.
+ * Copyright (c) 2009, 2017 Tasktop Technologies 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
@@ -48,7 +48,7 @@ public class ConnectorDiscoveryExtensionReader {
public static final Tag[] DEFAULT_TAGS = new Tag[] {DOCUMENT, TASK, VCS};
- private Map<String, Tag> tagById = new HashMap<String, Tag>();
+ private Map<String, Tag> tagById = new HashMap<>();
public ConnectorDiscoveryExtensionReader() {
// constructor
@@ -76,7 +76,7 @@ public class ConnectorDiscoveryExtensionReader {
}
public Set<Tag> getTags() {
- return new HashSet<Tag>(tagById.values());
+ return new HashSet<>(tagById.values());
}
private Tag getTag(String id) {
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/Directory.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/Directory.java
index 0dcc98fe7..221712dd4 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/Directory.java
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/Directory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Tasktop Technologies and others.
+ * Copyright (c) 2009, 2017 Tasktop Technologies 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
@@ -62,7 +62,7 @@ public class Directory {
}
}
- private final List<Entry> entries = new ArrayList<Entry>();
+ private final List<Entry> entries = new ArrayList<>();
public List<Entry> getEntries() {
return entries;
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DirectoryParser.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DirectoryParser.java
index 98ec85241..cbf1454b8 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DirectoryParser.java
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DirectoryParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Tasktop Technologies and others.
+ * Copyright (c) 2009, 2017 Tasktop Technologies 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
@@ -67,6 +67,7 @@ public class DirectoryParser {
/**
* @throws SAXException - required by contract, not really thrown
*/
+ @Override
public void characters(char[] ch, int start, int length) throws SAXException {
// ignore
}
@@ -74,6 +75,7 @@ public class DirectoryParser {
/**
* @throws SAXException - required by contract, not really thrown
*/
+ @Override
public void endDocument() throws SAXException {
// ignore
}
@@ -81,6 +83,7 @@ public class DirectoryParser {
/**
* @throws SAXException - required by contract, not really thrown
*/
+ @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
// ignore
}
@@ -88,6 +91,7 @@ public class DirectoryParser {
/**
* @throws SAXException - required by contract, not really thrown
*/
+ @Override
public void endPrefixMapping(String prefix) throws SAXException {
// ignore
}
@@ -95,6 +99,7 @@ public class DirectoryParser {
/**
* @throws SAXException - required by contract, not really thrown
*/
+ @Override
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
// ignore
}
@@ -102,10 +107,12 @@ public class DirectoryParser {
/**
* @throws SAXException - required by contract, not really thrown
*/
+ @Override
public void processingInstruction(String target, String data) throws SAXException {
// ignore
}
+ @Override
public void setDocumentLocator(Locator locator) {
// ignore
}
@@ -113,6 +120,7 @@ public class DirectoryParser {
/**
* @throws SAXException - required by contract, not really thrown
*/
+ @Override
public void skippedEntity(String name) throws SAXException {
// ignore
}
@@ -120,10 +128,12 @@ public class DirectoryParser {
/**
* @throws SAXException - required by contract, not really thrown
*/
+ @Override
public void startDocument() throws SAXException {
// ignore
}
+ @Override
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
if ("directory".equals(localName)) { //$NON-NLS-1$
if (directory != null) {
@@ -149,6 +159,7 @@ public class DirectoryParser {
/**
* @throws SAXException - required by contract, not really thrown
*/
+ @Override
public void startPrefixMapping(String prefix, String uri) throws SAXException {
// ignore
}
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DiscoveryRegistryStrategy.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DiscoveryRegistryStrategy.java
index edea13a05..567127f94 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DiscoveryRegistryStrategy.java
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DiscoveryRegistryStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Tasktop Technologies and others.
+ * Copyright (c) 2009, 2017 Tasktop Technologies 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
@@ -27,11 +27,11 @@ import org.osgi.framework.Bundle;
*/
class DiscoveryRegistryStrategy extends RegistryStrategy {
- private final List<JarFile> jars = new ArrayList<JarFile>();
+ private final List<JarFile> jars = new ArrayList<>();
- private final Map<IContributor, File> contributorToJarFile = new HashMap<IContributor, File>();
+ private final Map<IContributor, File> contributorToJarFile = new HashMap<>();
- private final Map<IContributor, Entry> contributorToDirectoryEntry = new HashMap<IContributor, Entry>();
+ private final Map<IContributor, Entry> contributorToDirectoryEntry = new HashMap<>();
private final Object token;
@@ -58,11 +58,8 @@ class DiscoveryRegistryStrategy extends RegistryStrategy {
Bundle bundle = Platform.getBundle("org.eclipse.equinox.p2.discovery.compatibility"); //$NON-NLS-1$
IContributor contributor = new RegistryContributor(bundle.getSymbolicName(), bundle.getSymbolicName(), null, null);
- InputStream inputStream = bundle.getEntry("plugin.xml").openStream(); //$NON-NLS-1$
- try {
+ try (InputStream inputStream = bundle.getEntry("plugin.xml").openStream()) { //$NON-NLS-1$
registry.addContribution(inputStream, contributor, false, bundle.getSymbolicName(), null, token);
- } finally {
- inputStream.close();
}
} catch (IOException e) {
throw new IllegalStateException();
@@ -100,11 +97,8 @@ class DiscoveryRegistryStrategy extends RegistryStrategy {
ResourceBundle translationBundle = loadTranslationBundle(jarFile);
- InputStream inputStream = jarFile.getInputStream(pluginXmlEntry);
- try {
+ try (InputStream inputStream = jarFile.getInputStream(pluginXmlEntry)) {
registry.addContribution(inputStream, contributor, false, bundleFile.getPath(), translationBundle, token);
- } finally {
- inputStream.close();
}
}
@@ -113,12 +107,9 @@ class DiscoveryRegistryStrategy extends RegistryStrategy {
for (String bundleName : bundleNames) {
ZipEntry entry = jarFile.getEntry(bundleName);
if (entry != null) {
- InputStream inputStream = jarFile.getInputStream(entry);
- try {
+ try (InputStream inputStream = jarFile.getInputStream(entry)) {
PropertyResourceBundle resourceBundle = new PropertyResourceBundle(inputStream);
return resourceBundle;
- } finally {
- inputStream.close();
}
}
}
@@ -128,7 +119,7 @@ class DiscoveryRegistryStrategy extends RegistryStrategy {
private List<String> computeBundleNames(String baseName) {
String suffix = ".properties"; //$NON-NLS-1$
String name = baseName;
- List<String> bundleNames = new ArrayList<String>();
+ List<String> bundleNames = new ArrayList<>();
Locale locale = Locale.getDefault();
bundleNames.add(name + suffix);
if (locale.getLanguage() != null && locale.getLanguage().length() > 0) {
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/RemoteBundleDiscoveryStrategy.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/RemoteBundleDiscoveryStrategy.java
index 2c02cb01e..0a21f6332 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/RemoteBundleDiscoveryStrategy.java
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/RemoteBundleDiscoveryStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2013 Tasktop Technologies and others.
+ * Copyright (c) 2009, 2017 Tasktop Technologies 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
@@ -11,7 +11,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.discovery.compatibility;
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
import java.net.*;
import java.util.*;
import java.util.concurrent.*;
@@ -21,7 +22,6 @@ import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.discovery.*;
import org.eclipse.equinox.internal.p2.discovery.compatibility.Directory.Entry;
import org.eclipse.equinox.internal.p2.discovery.compatibility.util.TransportUtil;
-import org.eclipse.equinox.internal.p2.discovery.compatibility.util.TransportUtil.TextContentProcessor;
import org.eclipse.osgi.util.NLS;
/**
@@ -78,11 +78,9 @@ public class RemoteBundleDiscoveryStrategy extends BundleDiscoveryStrategy {
Directory directory;
try {
final Directory[] temp = new Directory[1];
- TransportUtil.readResource(new URI(directoryUrl), new TextContentProcessor() {
- public void process(Reader reader) throws IOException {
- DirectoryParser parser = new DirectoryParser();
- temp[0] = parser.parse(reader);
- }
+ TransportUtil.readResource(new URI(directoryUrl), reader -> {
+ DirectoryParser parser = new DirectoryParser();
+ temp[0] = parser.parse(reader);
}, new SubProgressMonitor(monitor, ticksTenPercent));
directory = temp[0];
if (directory == null) {
@@ -102,11 +100,11 @@ public class RemoteBundleDiscoveryStrategy extends BundleDiscoveryStrategy {
throw new CoreException(new Status(IStatus.ERROR, DiscoveryCore.ID_PLUGIN, Messages.RemoteBundleDiscoveryStrategy_empty_directory));
}
- Map<File, Directory.Entry> bundleFileToDirectoryEntry = new HashMap<File, Directory.Entry>();
+ Map<File, Directory.Entry> bundleFileToDirectoryEntry = new HashMap<>();
ExecutorService executorService = createExecutorService(directory.getEntries().size());
try {
- List<Future<DownloadBundleJob>> futures = new ArrayList<Future<DownloadBundleJob>>();
+ List<Future<DownloadBundleJob>> futures = new ArrayList<>();
// submit jobs
for (Directory.Entry entry : directory.getEntries()) {
futures.add(executorService.submit(new DownloadBundleJob(entry, monitor)));
@@ -188,6 +186,7 @@ public class RemoteBundleDiscoveryStrategy extends BundleDiscoveryStrategy {
this.monitor = monitor;
}
+ @Override
public DownloadBundleJob call() {
String bundleUrl = entry.getLocation();
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/SiteVerifier.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/SiteVerifier.java
index d4b1aaf34..bec5ffcd1 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/SiteVerifier.java
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/SiteVerifier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Tasktop Technologies and others.
+ * Copyright (c) 2009, 2017 Tasktop Technologies 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
@@ -43,7 +43,7 @@ public class SiteVerifier {
public void verifySiteAvailability(IProgressMonitor monitor) {
// NOTE: we don't put java.net.URLs in the map since it involves DNS activity when
// computing the hash code.
- Map<String, Collection<CatalogItem>> urlToDescriptors = new HashMap<String, Collection<CatalogItem>>();
+ Map<String, Collection<CatalogItem>> urlToDescriptors = new HashMap<>();
for (CatalogItem descriptor : catalog.getItems()) {
String url = descriptor.getSiteUrl();
@@ -55,7 +55,7 @@ public class SiteVerifier {
}
Collection<CatalogItem> collection = urlToDescriptors.get(url);
if (collection == null) {
- collection = new ArrayList<CatalogItem>();
+ collection = new ArrayList<>();
urlToDescriptors.put(url, collection);
}
collection.add(descriptor);
@@ -66,7 +66,7 @@ public class SiteVerifier {
if (!urlToDescriptors.isEmpty()) {
ExecutorService executorService = Executors.newFixedThreadPool(Math.min(urlToDescriptors.size(), 4));
try {
- List<Future<VerifyUpdateSiteJob>> futures = new ArrayList<Future<VerifyUpdateSiteJob>>(urlToDescriptors.size());
+ List<Future<VerifyUpdateSiteJob>> futures = new ArrayList<>(urlToDescriptors.size());
for (String url : urlToDescriptors.keySet()) {
futures.add(executorService.submit(new VerifyUpdateSiteJob(url)));
}
@@ -126,9 +126,10 @@ public class SiteVerifier {
this.url = url;
}
+ @Override
public VerifyUpdateSiteJob call() throws Exception {
URL baseUrl = new URL(url);
- List<URI> locations = new ArrayList<URI>();
+ List<URI> locations = new ArrayList<>();
for (String location : new String[] {"content.jar", "content.xml", "site.xml", "compositeContent.jar", "compositeContent.xml"}) { //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
locations.add(new URL(baseUrl, location).toURI());
}
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/CacheManager.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/CacheManager.java
index 95d7a25be..340bb208a 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/CacheManager.java
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/CacheManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 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
@@ -47,11 +47,13 @@ public class CacheManager {
super(stream);
}
+ @Override
public IStatus getStatus() {
return status;
}
+ @Override
public void setStatus(IStatus aStatus) {
status = aStatus;
}
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/DefaultSaxErrorHandler.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/DefaultSaxErrorHandler.java
index bb3499090..d5528c398 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/DefaultSaxErrorHandler.java
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/DefaultSaxErrorHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Tasktop Technologies and others.
+ * Copyright (c) 2009, 2017 Tasktop Technologies 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
@@ -20,14 +20,17 @@ import org.xml.sax.*;
*/
public class DefaultSaxErrorHandler implements ErrorHandler {
+ @Override
public void warning(SAXParseException exception) throws SAXException {
// ignore
}
+ @Override
public void fatalError(SAXParseException exception) throws SAXException {
throw exception;
}
+ @Override
public void error(SAXParseException exception) throws SAXException {
throw exception;
}
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java
index 61e16563e..fb68efdec 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/util/TransportUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2013 Tasktop Technologies and others.
+ * Copyright (c) 2009, 2017 Tasktop Technologies 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
@@ -13,6 +13,7 @@ package org.eclipse.equinox.internal.p2.discovery.compatibility.util;
import java.io.*;
import java.net.URI;
+import java.nio.charset.StandardCharsets;
import java.util.List;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.discovery.compatibility.Activator;
@@ -102,13 +103,10 @@ public class TransportUtil {
if (cacheFile == null) {
throw new CoreException(new Status(IStatus.ERROR, Activator.ID, Messages.TransportUtil_InternalError));
}
- InputStream in = new BufferedInputStream(new FileInputStream(cacheFile));
- try {
+ try (InputStream in = new BufferedInputStream(new FileInputStream(cacheFile))) {
// FIXME how can the charset be determined?
- BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); //$NON-NLS-1$
+ BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
processor.process(reader);
- } finally {
- in.close();
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.discovery/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.discovery/META-INF/MANIFEST.MF
index 7244bb63c..ffca70314 100644
--- a/bundles/org.eclipse.equinox.p2.ui.discovery/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.ui.discovery/META-INF/MANIFEST.MF
@@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.equinox.p2.discovery;bundle-version="[1.0.0,1.1.0)",
org.eclipse.ui.browser,
- org.eclipse.equinox.p2.discovery.compatibility;bundle-version="[1.0.0,1.1.0)";resolution:=optional,
+ org.eclipse.equinox.p2.discovery.compatibility;bundle-version="[1.0.0,1.2.0)";resolution:=optional,
org.eclipse.equinox.p2.core;bundle-version="[2.0.0,3.0.0)",
org.eclipse.equinox.p2.ui;bundle-version="2.0.0",
org.eclipse.equinox.p2.metadata;bundle-version="[2.0.0,3.0.0)",

Back to the top