Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-10-10 06:43:54 +0000
committerAlexander Kurtakov2017-10-10 06:43:54 +0000
commit48f954851c5786c15397c6ebdd2f67adf2d804d3 (patch)
tree878e13575992e56fe62c85950f696aaabcff4757
parent0aa14c050b4201458ad17d51dd5370a3a7997a7d (diff)
downloadrt.equinox.p2-48f954851c5786c15397c6ebdd2f67adf2d804d3.tar.gz
rt.equinox.p2-48f954851c5786c15397c6ebdd2f67adf2d804d3.tar.xz
rt.equinox.p2-48f954851c5786c15397c6ebdd2f67adf2d804d3.zip
Bug 525796 - Move transport.ecf to Java 8
* Bump BREE. * Bump minor version. * Enable warnings for newer Java versions. * Add missing Override annotations. * Lambda conversion. * Remove redundant type arguments. * Add missing NON-NLS Change-Id: Ib09042c1913e41fc46e0f7b85e29942b1835f75a Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.transport.ecf/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.transport.ecf/.settings/org.eclipse.jdt.core.prefs28
-rw-r--r--bundles/org.eclipse.equinox.p2.transport.ecf/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.p2.transport.ecf/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/Activator.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/ECFTransportComponent.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/FileInfoReader.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/FileReader.java25
-rw-r--r--bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/RepositoryTransport.java31
9 files changed, 74 insertions, 38 deletions
diff --git a/bundles/org.eclipse.equinox.p2.transport.ecf/.classpath b/bundles/org.eclipse.equinox.p2.transport.ecf/.classpath
index 64c5e31b7..eca7bdba8 100644
--- a/bundles/org.eclipse.equinox.p2.transport.ecf/.classpath
+++ b/bundles/org.eclipse.equinox.p2.transport.ecf/.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.transport.ecf/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.transport.ecf/.settings/org.eclipse.jdt.core.prefs
index 215c0dd4a..14cf9825f 100644
--- a/bundles/org.eclipse.equinox.p2.transport.ecf/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.transport.ecf/.settings/org.eclipse.jdt.core.prefs
@@ -9,19 +9,24 @@ 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.nonnullisdefault=disabled
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.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.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
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=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -33,7 +38,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
@@ -51,7 +56,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=error
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
@@ -60,7 +65,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
@@ -68,6 +73,7 @@ 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.nullSpecInsufficientInfo=warning
@@ -75,6 +81,7 @@ 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.potentialNullSpecViolation=error
@@ -82,8 +89,8 @@ 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
@@ -92,12 +99,16 @@ 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=ignore
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
@@ -105,6 +116,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
@@ -117,7 +129,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.transport.ecf/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.transport.ecf/META-INF/MANIFEST.MF
index 71e3f586a..508599590 100644
--- a/bundles/org.eclipse.equinox.p2.transport.ecf/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.transport.ecf/META-INF/MANIFEST.MF
@@ -2,8 +2,8 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.transport.ecf
-Bundle-Version: 1.1.300.qualifier
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Version: 1.2.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.ecf;bundle-version="3.1.0",
org.eclipse.ecf.filetransfer;bundle-version="4.0.0",
org.eclipse.ecf.provider.filetransfer;bundle-version="3.1.0",
diff --git a/bundles/org.eclipse.equinox.p2.transport.ecf/pom.xml b/bundles/org.eclipse.equinox.p2.transport.ecf/pom.xml
index 67db0beb6..f3d6970e3 100644
--- a/bundles/org.eclipse.equinox.p2.transport.ecf/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.transport.ecf/pom.xml
@@ -9,6 +9,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.transport.ecf</artifactId>
- <version>1.1.300-SNAPSHOT</version>
+ <version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/Activator.java b/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/Activator.java
index 7043074cf..2bcb49cfa 100644
--- a/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 Cloudsmith Inc and others.
+ * Copyright (c) 2009, 2017 Cloudsmith Inc 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
@@ -42,11 +42,13 @@ public class Activator implements BundleActivator {
// The shared instance
private static Activator plugin;
+ @Override
public void start(BundleContext aContext) throws Exception {
Activator.context = aContext;
Activator.plugin = this;
}
+ @Override
public void stop(BundleContext aContext) throws Exception {
Activator.context = null;
Activator.plugin = null;
@@ -130,7 +132,7 @@ public class Activator implements BundleActivator {
*/
private synchronized ServiceTracker<IRetrieveFileTransferFactory, IRetrieveFileTransferFactory> getFileTransferServiceTracker() {
if (retrievalFactoryTracker == null) {
- retrievalFactoryTracker = new ServiceTracker<IRetrieveFileTransferFactory, IRetrieveFileTransferFactory>(Activator.getContext(), IRetrieveFileTransferFactory.class, null);
+ retrievalFactoryTracker = new ServiceTracker<>(Activator.getContext(), IRetrieveFileTransferFactory.class, null);
retrievalFactoryTracker.open();
startBundle("org.eclipse.ecf"); //$NON-NLS-1$
startBundle("org.eclipse.ecf.provider.filetransfer"); //$NON-NLS-1$
@@ -140,7 +142,7 @@ public class Activator implements BundleActivator {
private IFileTransferProtocolToFactoryMapper getProtocolToFactoryMapper() {
if (protocolToFactoryMapperTracker == null) {
- protocolToFactoryMapperTracker = new ServiceTracker<IFileTransferProtocolToFactoryMapper, IFileTransferProtocolToFactoryMapper>(context, IFileTransferProtocolToFactoryMapper.class, null);
+ protocolToFactoryMapperTracker = new ServiceTracker<>(context, IFileTransferProtocolToFactoryMapper.class, null);
protocolToFactoryMapperTracker.open();
}
return protocolToFactoryMapperTracker.getService();
diff --git a/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/ECFTransportComponent.java b/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/ECFTransportComponent.java
index e0c26e095..a0ea76800 100644
--- a/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/ECFTransportComponent.java
+++ b/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/ECFTransportComponent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 IBM Corporation and others.
+ * Copyright (c) 2011, 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
@@ -15,8 +15,9 @@ import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory;
public class ECFTransportComponent implements IAgentServiceFactory {
+ @Override
public Object createService(IProvisioningAgent agent) {
return new RepositoryTransport(agent);
}
-
+
}
diff --git a/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/FileInfoReader.java b/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/FileInfoReader.java
index 3ec01631a..8a45c5486 100644
--- a/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/FileInfoReader.java
+++ b/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/FileInfoReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015, IBM Corporation, and others.
+ * Copyright (c) 2009, 2017 IBM Corporation, and others.
* The code, documentation and other materials contained herein have been
* licensed under the Eclipse Public License - v 1.0 by the copyright holder
* listed above, as the Initial Contributor under such license. The text of
@@ -44,9 +44,7 @@ public class FileInfoReader extends Job implements IRemoteFileSystemListener {
private IRemoteFile[] remoteFiles;
private IRemoteFileSystemRequest browseRequest;
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
protected IStatus run(IProgressMonitor monitor) {
synchronized (barrier) {
while (barrier[0] == null) {
@@ -135,6 +133,7 @@ public class FileInfoReader extends Job implements IRemoteFileSystemListener {
return file.getInfo().getLastModified();
}
+ @Override
public void handleRemoteFileEvent(IRemoteFileSystemEvent event) {
exception = event.getException();
if (exception != null) {
diff --git a/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/FileReader.java b/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/FileReader.java
index bf813b4ce..4053be331 100644
--- a/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/FileReader.java
+++ b/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/FileReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2016 Cloudsmith Inc.
+ * Copyright (c) 2006, 2017 Cloudsmith 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
@@ -47,10 +47,12 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi
super(monitor, ticks);
}
+ @Override
public void setBlocked(IStatus reason) {
//do nothing
}
+ @Override
public void clearBlocked() {
//do nothing
}
@@ -67,7 +69,7 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi
}
static {
- Map<String, String> extraRequestHeaders = new HashMap<String, String>(1);
+ Map<String, String> extraRequestHeaders = new HashMap<>(1);
String userAgent = null;
String javaSpec = getProperty("java.runtime.version", "unknownJava"); //$NON-NLS-1$//$NON-NLS-2$
String javaVendor = getProperty("java.vendor", "unknownJavaVendor");//$NON-NLS-1$//$NON-NLS-2$
@@ -76,7 +78,7 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi
String language = getProperty("osgi.nl", "unknownLanguage");//$NON-NLS-1$//$NON-NLS-2$
String osVersion = getProperty("org.osgi.framework.os.version", "unknownOSVersion"); //$NON-NLS-1$ //$NON-NLS-2$
String p2Version = FrameworkUtil.getBundle(FileReader.class).getVersion().toString();
- userAgent = "p2/" + p2Version + " (Java " + javaSpec + ' ' + javaVendor + "; " + osName + ' ' + osVersion + ' ' + osgiArch + "; " + language + ") "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ userAgent = "p2/" + p2Version + " (Java " + javaSpec + ' ' + javaVendor + "; " + osName + ' ' + osVersion + ' ' + osgiArch + "; " + language + ") "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
String userAgentProvided = getProperty("p2.userAgent", null); //$NON-NLS-1$
if (userAgentProvided == null) {
String productId = getProperty("eclipse.product", "unknownProduct"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -87,7 +89,7 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi
userAgent += userAgentProvided;
}
extraRequestHeaders.put("User-Agent", userAgent); //$NON-NLS-1$
- options = new HashMap<String, Map<String, String>>(1);
+ options = new HashMap<>(1);
options.put(org.eclipse.ecf.filetransfer.IRetrieveFileTransferOptions.REQUEST_HEADERS, extraRequestHeaders);
}
@@ -145,6 +147,7 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi
setSystem(true);
}
+ @Override
public IStatus run(IProgressMonitor jobMonitor) {
while (!done && !jobMonitor.isCanceled()) {
try {
@@ -159,6 +162,7 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi
return Status.OK_STATUS;
}
+ @Override
protected void canceling() {
//wake up from sleep in run method
Thread t = getThread();
@@ -168,6 +172,7 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi
}
+ @Override
public synchronized void handleTransferEvent(IFileTransferEvent event) {
if (event instanceof IFileTransferConnectStartEvent) {
// keep the connect event to be able to cancel the transfer
@@ -278,44 +283,53 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi
sendRetrieveRequest(url, output, null, true, monitor);
return new InputStream() {
+ @Override
public int available() throws IOException {
checkException();
return input.available();
}
+ @Override
public void close() throws IOException {
hardClose(input);
checkException();
}
+ @Override
public void mark(int readlimit) {
input.mark(readlimit);
}
+ @Override
public boolean markSupported() {
return input.markSupported();
}
+ @Override
public int read() throws IOException {
checkException();
return input.read();
}
+ @Override
public int read(byte b[]) throws IOException {
checkException();
return input.read(b);
}
+ @Override
public int read(byte b[], int off, int len) throws IOException {
checkException();
return input.read(b, off, len);
}
+ @Override
public void reset() throws IOException {
checkException();
input.reset();
}
+ @Override
public long skip(long n) throws IOException {
checkException();
return input.skip(n);
@@ -348,6 +362,7 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi
readInto(uri, anOutputStream, -1, monitor);
}
+ @Override
public boolean belongsTo(Object family) {
return family == this;
}
@@ -532,10 +547,12 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi
startPosition = startPos;
}
+ @Override
public long getEndPosition() {
return -1;
}
+ @Override
public long getStartPosition() {
return startPosition;
}
diff --git a/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/RepositoryTransport.java b/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/RepositoryTransport.java
index 816bd7a2f..22c2a4bda 100644
--- a/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/RepositoryTransport.java
+++ b/bundles/org.eclipse.equinox.p2.transport.ecf/src/org/eclipse/equinox/internal/p2/transport/ecf/RepositoryTransport.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2016 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* The code, documentation and other materials contained herein have been
* licensed under the Eclipse Public License - v 1.0 by the copyright holder
* listed above, as the Initial Contributor under such license. The text of
@@ -14,7 +14,8 @@ package org.eclipse.equinox.internal.p2.transport.ecf;
import java.io.*;
import java.net.*;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.*;
import org.eclipse.ecf.core.identity.IDCreateException;
import org.eclipse.ecf.core.security.ConnectContextFactory;
@@ -26,7 +27,8 @@ import org.eclipse.equinox.internal.p2.repository.Messages;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
import org.eclipse.equinox.internal.provisional.p2.repository.IStateful;
-import org.eclipse.equinox.p2.core.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.core.UIServices.AuthenticationInfo;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.osgi.util.NLS;
@@ -65,6 +67,7 @@ public class RepositoryTransport extends Transport {
this.agent = agent;
}
+ @Override
public IStatus download(URI toDownload, OutputStream target, long startPos, IProgressMonitor monitor) {
boolean promptUser = false;
@@ -85,14 +88,12 @@ public class RepositoryTransport extends Transport {
eventBus = (IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME);
if (eventBus != null) {
final FileReader fileReader = reader;
- listener = new ProvisioningListener() {
- public void notify(EventObject event) {
- if (event instanceof DownloadPauseResumeEvent) {
- if (((DownloadPauseResumeEvent) event).getType() == DownloadPauseResumeEvent.TYPE_PAUSE)
- fileReader.pause();
- else if (((DownloadPauseResumeEvent) event).getType() == DownloadPauseResumeEvent.TYPE_RESUME)
- fileReader.resume();
- }
+ listener = event -> {
+ if (event instanceof DownloadPauseResumeEvent) {
+ if (((DownloadPauseResumeEvent) event).getType() == DownloadPauseResumeEvent.TYPE_PAUSE)
+ fileReader.pause();
+ else if (((DownloadPauseResumeEvent) event).getType() == DownloadPauseResumeEvent.TYPE_RESUME)
+ fileReader.resume();
}
};
eventBus.addListener(listener);
@@ -152,10 +153,12 @@ public class RepositoryTransport extends Transport {
return statusOn(target, status, null);
}
+ @Override
public IStatus download(URI toDownload, OutputStream target, IProgressMonitor monitor) {
return download(toDownload, target, -1, monitor);
}
+ @Override
public InputStream stream(URI toDownload, IProgressMonitor monitor) throws FileNotFoundException, CoreException, AuthenticationFailedException {
boolean promptUser = false;
@@ -216,6 +219,7 @@ public class RepositoryTransport extends Transport {
return status;
}
+ @Override
public long getLastModified(URI toDownload, IProgressMonitor monitor) throws CoreException, FileNotFoundException, AuthenticationFailedException {
boolean promptUser = false;
boolean useJREHttp = false;
@@ -276,7 +280,7 @@ public class RepositoryTransport extends Transport {
if (retry > 0) {
Integer retryCount = null;
if (socketExceptionRetry == null) {
- socketExceptionRetry = new HashMap<URI, Integer>();
+ socketExceptionRetry = new HashMap<>();
retryCount = Integer.valueOf(1);
} else {
Integer alreadyRetryCount = socketExceptionRetry.get(toDownload);
@@ -331,7 +335,8 @@ public class RepositoryTransport extends Transport {
return new DownloadStatus(IStatus.ERROR, Activator.ID, provisionCode, //
code == 0 ? NLS.bind(Messages.io_failedRead, toDownload) //
- : RepositoryStatus.codeToMessage(code, toDownload.toString()), t);
+ : RepositoryStatus.codeToMessage(code, toDownload.toString()),
+ t);
}
}

Back to the top