diff options
author | Alexander Kurtakov | 2017-10-07 07:30:43 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-10-07 07:30:43 +0000 |
commit | 1e3d1d9f4b44ab85107c36f097b9019a0cbd0f45 (patch) | |
tree | 8c38d0b1b6d358507d19252f234ccd086cf5798c | |
parent | 00c74b1e3292ff23717af783bd80356a225f4142 (diff) | |
download | rt.equinox.p2-1e3d1d9f4b44ab85107c36f097b9019a0cbd0f45.tar.gz rt.equinox.p2-1e3d1d9f4b44ab85107c36f097b9019a0cbd0f45.tar.xz rt.equinox.p2-1e3d1d9f4b44ab85107c36f097b9019a0cbd0f45.zip |
Bug 525708 - Move jarsigner bundle to Java 8
* Bump BREE
* Bump minor version
* Enable warnings for new Java versions.
* Add missing Override annotations.
* Lambda conversion.
* Remove redundant type arguments.
* Try with resources.
Change-Id: I880fd0434fe83a610f3983bf12af9b5b60ab58e5
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
20 files changed, 213 insertions, 212 deletions
diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/.classpath b/bundles/org.eclipse.equinox.p2.jarprocessor/.classpath index a6d1c717d..030607499 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/.classpath +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/.classpath @@ -1,8 +1,8 @@ -<?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.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" output="bin_ant" path="src_ant"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="src" output="bin_ant" path="src_ant"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.jarprocessor/.settings/org.eclipse.jdt.core.prefs index 738825053..36d7d9599 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/.settings/org.eclipse.jdt.core.prefs @@ -9,18 +9,22 @@ 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 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 @@ -32,7 +36,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod= org.eclipse.jdt.core.compiler.problem.discouragedReference=error 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 @@ -49,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 @@ -58,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 @@ -66,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=ignore 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 @@ -88,12 +94,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=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 +112,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 +125,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.jarprocessor/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.jarprocessor/META-INF/MANIFEST.MF index c3b00c0f5..9281403fd 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/META-INF/MANIFEST.MF @@ -4,8 +4,8 @@ Bundle-SymbolicName: org.eclipse.equinox.p2.jarprocessor;singleton:=true Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-Localization: plugin -Bundle-Version: 1.0.500.qualifier -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Version: 1.1.0.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Main-Class: org.eclipse.equinox.internal.p2.jarprocessor.Main Export-Package: org.eclipse.equinox.internal.p2.jarprocessor;x-friends:="org.eclipse.equinox.p2.artifact.repository,org.eclipse.pde.build", org.eclipse.equinox.internal.p2.jarprocessor.unsigner;x-internal:=true, diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/pom.xml b/bundles/org.eclipse.equinox.p2.jarprocessor/pom.xml index 519aba82e..d77a03e7a 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/pom.xml +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/pom.xml @@ -9,6 +9,6 @@ </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.jarprocessor</artifactId> - <version>1.0.500-SNAPSHOT</version> + <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/CommandStep.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/CommandStep.java index fc0f19d95..ccb41dc61 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/CommandStep.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/CommandStep.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -62,6 +62,7 @@ public abstract class CommandStep implements IProcessStep { return options; } + @Override public boolean adjustInf(File input, Properties inf, List<Properties> containers) { //do nothing by default return false; diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/PackStep.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/PackStep.java index f0eabd95c..753400c30 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/PackStep.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/PackStep.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -58,6 +58,7 @@ public class PackStep extends CommandStep { exclusions = Utils.getPackExclusions(options); } + @Override public String recursionEffect(String entryName) { if (canPack() && entryName.endsWith(".jar") && !exclusions.contains(entryName)) { //$NON-NLS-1$ return entryName + Utils.PACKED_SUFFIX; @@ -65,10 +66,12 @@ public class PackStep extends CommandStep { return null; } + @Override public File preProcess(File input, File workingDirectory, List<Properties> containers) { return null; } + @Override public File postProcess(File input, File workingDirectory, List<Properties> containers) { if (canPack() && packCommand != null) { Properties inf = Utils.getEclipseInf(input, verbose); @@ -160,10 +163,12 @@ public class PackStep extends CommandStep { return ""; //$NON-NLS-1$ } + @Override public String getStepName() { return "Pack"; //$NON-NLS-1$ } + @Override public boolean adjustInf(File input, Properties inf, List<Properties> containers) { if (input == null || inf == null) return false; diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/PackUnpackStep.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/PackUnpackStep.java index ae5081414..2f04c6dea 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/PackUnpackStep.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/PackUnpackStep.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -31,6 +31,7 @@ public class PackUnpackStep extends PackStep { exclusions = Utils.getPackExclusions(options); } + @Override public String recursionEffect(String entryName) { if (canPack() && entryName.endsWith(".jar") && !exclusions.contains(entryName)) { //$NON-NLS-1$ return entryName; @@ -38,9 +39,7 @@ public class PackUnpackStep extends PackStep { return null; } - /* (non-Javadoc) - * @see org.eclipse.update.internal.jarprocessor.PackStep#postProcess(java.io.File, java.io.File, java.util.LinkedList) - */ + @Override public File postProcess(File input, File workingDirectory, List<Properties> containers) { if (canPack() && packCommand != null && input != null) { Properties inf = Utils.getEclipseInf(input, verbose); @@ -73,13 +72,12 @@ public class PackUnpackStep extends PackStep { return null; } - /* (non-Javadoc) - * @see org.eclipse.update.internal.jarprocessor.PackStep#preProcess(java.io.File, java.io.File, java.util.LinkedList) - */ + @Override public File preProcess(File input, File workingDirectory, List<Properties> containers) { return null; } + @Override public String getStepName() { return "Repack"; //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/SignCommandStep.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/SignCommandStep.java index 3b1792ac4..9f55f21bd 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/SignCommandStep.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/SignCommandStep.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -27,25 +27,19 @@ public class SignCommandStep extends CommandStep { exclusions = Utils.getSignExclusions(options); } - /* (non-Javadoc) - * @see org.eclipse.update.jarprocessor.IProcessStep#recursionEffect(java.lang.String) - */ + @Override public String recursionEffect(String entryName) { if (entryName.endsWith(extension) && !exclusions.contains(entryName)) return entryName; return null; } - /* (non-Javadoc) - * @see org.eclipse.update.jarprocessor.IProcessStep#preProcess(java.io.File, java.io.File) - */ + @Override public File preProcess(File input, File workingDirectory, List<Properties> containers) { return null; } - /* (non-Javadoc) - * @see org.eclipse.update.jarprocessor.IProcessStep#postProcess(java.io.File, java.io.File) - */ + @Override public File postProcess(File input, File workingDirectory, List<Properties> containers) { if (command != null && input != null && shouldSign(input, containers)) { try { @@ -92,6 +86,7 @@ public class SignCommandStep extends CommandStep { return true; } + @Override public String getStepName() { return "Sign"; //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/StreamProcessor.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/StreamProcessor.java index df1a236c4..ccc88f915 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/StreamProcessor.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/StreamProcessor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,6 +33,7 @@ public class StreamProcessor { new StreamProcessorJob(is, name, verbose).schedule(); } else { Thread job = new Thread(STREAM_PROCESSOR) { + @Override public void run() { StreamProcessor.run(is, name, verbose); } diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/StreamProcessorJob.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/StreamProcessorJob.java index db404fec4..2ec082b73 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/StreamProcessorJob.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/StreamProcessorJob.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. + * Copyright (c) 2009, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,6 +28,7 @@ public class StreamProcessorJob extends Job { this.verbose = verbose; } + @Override protected IStatus run(IProgressMonitor monitor) { StreamProcessor.run(inputStream, name, verbose); inputStream = null; diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/UnpackStep.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/UnpackStep.java index 87984ca18..3b9ec0139 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/UnpackStep.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/UnpackStep.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 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,10 +15,6 @@ import java.io.IOException; import java.util.List; import java.util.Properties; -/** - * @author aniefer - * - */ public class UnpackStep extends CommandStep { public static final String UNPACKER_PROPERTY = "org.eclipse.update.jarprocessor.Unpacker"; //$NON-NLS-1$ private static Boolean canUnpack = null; @@ -59,9 +55,7 @@ public class UnpackStep extends CommandStep { super(options, null, null, verbose); } - /* (non-Javadoc) - * @see org.eclipse.update.jarprocessor.IProcessStep#recursionEffect(java.lang.String) - */ + @Override public String recursionEffect(String entryName) { if (canUnpack() && entryName.endsWith(Utils.PACKED_SUFFIX)) { return entryName.substring(0, entryName.length() - Utils.PACKED_SUFFIX.length()); @@ -69,9 +63,7 @@ public class UnpackStep extends CommandStep { return null; } - /* (non-Javadoc) - * @see org.eclipse.update.jarprocessor.IProcessStep#preProcess(java.io.File, java.io.File) - */ + @Override public File preProcess(File input, File workingDirectory, List<Properties> containers) { if (canUnpack() && unpackCommand != null) { String name = input.getName(); @@ -104,13 +96,12 @@ public class UnpackStep extends CommandStep { return null; } - /* (non-Javadoc) - * @see org.eclipse.update.jarprocessor.IProcessStep#postProcess(java.io.File, java.io.File) - */ + @Override public File postProcess(File input, File workingDirectory, List<Properties> containers) { return null; } + @Override public String getStepName() { return "Unpack"; //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/Utils.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/Utils.java index f8eca6fb0..d8d671d31 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/Utils.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/Utils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -69,17 +69,9 @@ public class Utils { public static final String PACKED_SUFFIX = ".pack.gz"; //$NON-NLS-1$ public static final String JAR_SUFFIX = ".jar"; //$NON-NLS-1$ - public static final FileFilter JAR_FILTER = new FileFilter() { - public boolean accept(File pathname) { - return pathname.isFile() && pathname.getName().endsWith(".jar"); //$NON-NLS-1$ - } - }; + public static final FileFilter JAR_FILTER = pathname -> pathname.isFile() && pathname.getName().endsWith(".jar"); //$NON-NLS-1$ - public static final FileFilter PACK_GZ_FILTER = new FileFilter() { - public boolean accept(File pathname) { - return pathname.isFile() && pathname.getName().endsWith(JarProcessor.PACKED_SUFFIX); - } - }; + public static final FileFilter PACK_GZ_FILTER = pathname -> pathname.isFile() && pathname.getName().endsWith(JarProcessor.PACKED_SUFFIX); public static void close(Object stream) { if (stream != null) { @@ -194,7 +186,7 @@ public class Utils { String packExcludes = properties.getProperty(PACK_EXCLUDES); if (packExcludes != null) { String[] excludes = toStringArray(packExcludes, ","); //$NON-NLS-1$ - Set<String> packExclusions = new HashSet<String>(); + Set<String> packExclusions = new HashSet<>(); for (int i = 0; i < excludes.length; i++) { packExclusions.add(excludes[i]); } @@ -209,7 +201,7 @@ public class Utils { String signExcludes = properties.getProperty(SIGN_EXCLUDES); if (signExcludes != null) { String[] excludes = toStringArray(signExcludes, ","); //$NON-NLS-1$ - Set<String> signExclusions = new HashSet<String>(); + Set<String> signExclusions = new HashSet<>(); for (int i = 0; i < excludes.length; i++) { signExclusions.add(excludes[i]); } @@ -255,11 +247,11 @@ public class Utils { jar = new JarFile(jarFile, false); JarEntry mark = jar.getJarEntry(MARK_FILE_NAME); if (mark != null) { - InputStream in = jar.getInputStream(mark); - Properties props = new Properties(); - props.load(in); - in.close(); - return props; + try (InputStream in = jar.getInputStream(mark)) { + Properties props = new Properties(); + props.load(in); + return props; + } } return new Properties(); } catch (ZipException e) { @@ -306,7 +298,7 @@ public class Utils { public static void storeProperties(Properties props, OutputStream stream) { PrintStream printStream = new PrintStream(stream); printStream.print("#Processed using Jarprocessor\n"); //$NON-NLS-1$ - SortedMap<Object, Object> sorted = new TreeMap<Object, Object>(props); + SortedMap<Object, Object> sorted = new TreeMap<>(props); for (Iterator<Object> iter = sorted.keySet().iterator(); iter.hasNext();) { String key = (String) iter.next(); printStream.print(key); diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/ZipProcessor.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/ZipProcessor.java index 04e3db923..0b41efe81 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/ZipProcessor.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/ZipProcessor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -16,10 +16,6 @@ import java.util.zip.*; import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessor; import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessorExecutor; -/** - * @author aniefer@ca.ibm.com - * - */ public class ZipProcessor { private JarProcessorExecutor executor = null; @@ -55,145 +51,145 @@ public class ZipProcessor { public void processZip(File zipFile) throws ZipException, IOException { if (options.verbose) System.out.println("Processing " + zipFile.getPath()); //$NON-NLS-1$ - ZipFile zip = new ZipFile(zipFile); - initialize(zip); - - String extension = options.unpack ? "pack.gz" : ".jar"; //$NON-NLS-1$ //$NON-NLS-2$ - File tempDir = new File(getWorkingDirectory(), "temp_" + zipFile.getName()); //$NON-NLS-1$ - JarProcessor processor = new JarProcessor(); - processor.setVerbose(options.verbose); - processor.setProcessAll(options.processAll); - processor.setWorkingDirectory(tempDir.getCanonicalPath()); - if (options.unpack) { - executor.addPackUnpackStep(processor, properties, options); - } + try (ZipFile zip = new ZipFile(zipFile)) { + initialize(zip); + + String extension = options.unpack ? "pack.gz" : ".jar"; //$NON-NLS-1$ //$NON-NLS-2$ + File tempDir = new File(getWorkingDirectory(), "temp_" + zipFile.getName()); //$NON-NLS-1$ + JarProcessor processor = new JarProcessor(); + processor.setVerbose(options.verbose); + processor.setProcessAll(options.processAll); + processor.setWorkingDirectory(tempDir.getCanonicalPath()); + if (options.unpack) { + executor.addPackUnpackStep(processor, properties, options); + } - File outputFile = new File(getWorkingDirectory(), zipFile.getName() + ".temp"); //$NON-NLS-1$ - File parent = outputFile.getParentFile(); - if (!parent.exists()) - parent.mkdirs(); - ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(outputFile)); - Enumeration<? extends ZipEntry> entries = zip.entries(); - if (entries.hasMoreElements()) { - for (ZipEntry entry = entries.nextElement(); entry != null; entry = entries.hasMoreElements() ? (ZipEntry) entries.nextElement() : null) { - String name = entry.getName(); - - InputStream entryStream = zip.getInputStream(entry); - - boolean pack = options.pack && !packExclusions.contains(name); - boolean sign = options.signCommand != null && !signExclusions.contains(name); - boolean repack = repacking() && !packExclusions.contains(name); - - File extractedFile = null; - - if (entry.getName().endsWith(extension) && (pack || sign || repack || options.unpack)) { - extractedFile = new File(tempDir, name); - parent = extractedFile.getParentFile(); - if (!parent.exists()) - parent.mkdirs(); - if (options.verbose) - System.out.println("Extracting " + entry.getName()); //$NON-NLS-1$ - FileOutputStream extracted = new FileOutputStream(extractedFile); - Utils.transferStreams(entryStream, extracted, true); // this will close the stream - entryStream = null; - - boolean skip = Utils.shouldSkipJar(extractedFile, options.processAll, options.verbose); - if (skip) { - //skipping this file - entryStream = new FileInputStream(extractedFile); - if (options.verbose) - System.out.println(entry.getName() + " is not marked, skipping."); //$NON-NLS-1$ - } else { - if (options.unpack) { - File result = processor.processJar(extractedFile); - name = name.substring(0, name.length() - extractedFile.getName().length()) + result.getName(); - extractedFile = result; - } else { - if (repack || sign) { - processor.clearProcessSteps(); - if (repack) - executor.addPackUnpackStep(processor, properties, options); - if (sign) - executor.addSignStep(processor, properties, options); - extractedFile = processor.processJar(extractedFile); - } - if (pack) { - processor.clearProcessSteps(); - executor.addPackStep(processor, properties, options); - File modifiedFile = processor.processJar(extractedFile); - if (modifiedFile.exists()) { - try { - String newName = name.substring(0, name.length() - extractedFile.getName().length()) + modifiedFile.getName(); - if (options.verbose) { - System.out.println("Adding " + newName + " to " + outputFile.getPath()); //$NON-NLS-1$ //$NON-NLS-2$ - System.out.println(); + File outputFile = new File(getWorkingDirectory(), zipFile.getName() + ".temp"); //$NON-NLS-1$ + File parent = outputFile.getParentFile(); + if (!parent.exists()) + parent.mkdirs(); + try (ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(outputFile))) { + Enumeration<? extends ZipEntry> entries = zip.entries(); + if (entries.hasMoreElements()) { + for (ZipEntry entry = entries.nextElement(); entry != null; entry = entries.hasMoreElements() ? (ZipEntry) entries.nextElement() : null) { + String name = entry.getName(); + + InputStream entryStream = zip.getInputStream(entry); + + boolean pack = options.pack && !packExclusions.contains(name); + boolean sign = options.signCommand != null && !signExclusions.contains(name); + boolean repack = repacking() && !packExclusions.contains(name); + + File extractedFile = null; + + if (entry.getName().endsWith(extension) && (pack || sign || repack || options.unpack)) { + extractedFile = new File(tempDir, name); + parent = extractedFile.getParentFile(); + if (!parent.exists()) + parent.mkdirs(); + if (options.verbose) + System.out.println("Extracting " + entry.getName()); //$NON-NLS-1$ + FileOutputStream extracted = new FileOutputStream(extractedFile); + Utils.transferStreams(entryStream, extracted, true); // this will close the stream + entryStream = null; + + boolean skip = Utils.shouldSkipJar(extractedFile, options.processAll, options.verbose); + if (skip) { + //skipping this file + entryStream = new FileInputStream(extractedFile); + if (options.verbose) + System.out.println(entry.getName() + " is not marked, skipping."); //$NON-NLS-1$ + } else { + if (options.unpack) { + File result = processor.processJar(extractedFile); + name = name.substring(0, name.length() - extractedFile.getName().length()) + result.getName(); + extractedFile = result; + } else { + if (repack || sign) { + processor.clearProcessSteps(); + if (repack) + executor.addPackUnpackStep(processor, properties, options); + if (sign) + executor.addSignStep(processor, properties, options); + extractedFile = processor.processJar(extractedFile); + } + if (pack) { + processor.clearProcessSteps(); + executor.addPackStep(processor, properties, options); + File modifiedFile = processor.processJar(extractedFile); + if (modifiedFile.exists()) { + try { + String newName = name.substring(0, name.length() - extractedFile.getName().length()) + modifiedFile.getName(); + if (options.verbose) { + System.out.println("Adding " + newName + " to " + outputFile.getPath()); //$NON-NLS-1$ //$NON-NLS-2$ + System.out.println(); + } + ZipEntry zipEntry = new ZipEntry(newName); + entryStream = new FileInputStream(modifiedFile); + zipOut.putNextEntry(zipEntry); + Utils.transferStreams(entryStream, zipOut, false); //we want to keep zipOut open + entryStream.close(); + Utils.clear(modifiedFile); + } catch (IOException e) { + Utils.close(entryStream); + if (options.verbose) { + e.printStackTrace(); + System.out.println("Warning: Problem reading " + modifiedFile.getPath() + "."); //$NON-NLS-1$//$NON-NLS-2$ + } + } + entryStream = null; + } else if (options.verbose) { + System.out.println("Warning: " + modifiedFile.getPath() + " not found."); //$NON-NLS-1$//$NON-NLS-2$ } - ZipEntry zipEntry = new ZipEntry(newName); - entryStream = new FileInputStream(modifiedFile); - zipOut.putNextEntry(zipEntry); - Utils.transferStreams(entryStream, zipOut, false); //we want to keep zipOut open - entryStream.close(); - Utils.clear(modifiedFile); + } + } + if (extractedFile.exists()) { + try { + entryStream = new FileInputStream(extractedFile); } catch (IOException e) { - Utils.close(entryStream); if (options.verbose) { e.printStackTrace(); - System.out.println("Warning: Problem reading " + modifiedFile.getPath() + "."); //$NON-NLS-1$//$NON-NLS-2$ + System.out.println("Warning: Problem reading " + extractedFile.getPath() + "."); //$NON-NLS-1$//$NON-NLS-2$ } } - entryStream = null; - } else if (options.verbose) { - System.out.println("Warning: " + modifiedFile.getPath() + " not found."); //$NON-NLS-1$//$NON-NLS-2$ + } + + if (options.verbose && entryStream != null) { + System.out.println("Adding " + name + " to " + outputFile.getPath()); //$NON-NLS-1$ //$NON-NLS-2$ } } } - if (extractedFile.exists()) { + if (entryStream != null) { + ZipEntry newEntry = new ZipEntry(name); try { - entryStream = new FileInputStream(extractedFile); - } catch (IOException e) { + zipOut.putNextEntry(newEntry); + Utils.transferStreams(entryStream, zipOut, false); + zipOut.closeEntry(); + } catch (ZipException e) { if (options.verbose) { - e.printStackTrace(); - System.out.println("Warning: Problem reading " + extractedFile.getPath() + "."); //$NON-NLS-1$//$NON-NLS-2$ + System.out.println("Warning: " + name + " already exists in " + outputFile.getName() + ". Skipping."); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } } + entryStream.close(); } - if (options.verbose && entryStream != null) { - System.out.println("Adding " + name + " to " + outputFile.getPath()); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - } - if (entryStream != null) { - ZipEntry newEntry = new ZipEntry(name); - try { - zipOut.putNextEntry(newEntry); - Utils.transferStreams(entryStream, zipOut, false); - zipOut.closeEntry(); - } catch (ZipException e) { + if (extractedFile != null) + Utils.clear(extractedFile); + if (options.verbose) { - System.out.println("Warning: " + name + " already exists in " + outputFile.getName() + ". Skipping."); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + System.out.println(); + System.out.println("Processing " + zipFile.getPath()); //$NON-NLS-1$ } } - entryStream.close(); - } - - if (extractedFile != null) - Utils.clear(extractedFile); - - if (options.verbose) { - System.out.println(); - System.out.println("Processing " + zipFile.getPath()); //$NON-NLS-1$ } } + File finalFile = new File(getWorkingDirectory(), zipFile.getName()); + if (finalFile.exists()) + finalFile.delete(); + outputFile.renameTo(finalFile); + Utils.clear(tempDir); } - zipOut.close(); - zip.close(); - - File finalFile = new File(getWorkingDirectory(), zipFile.getName()); - if (finalFile.exists()) - finalFile.delete(); - outputFile.renameTo(finalFile); - Utils.clear(tempDir); + } private void initialize(ZipFile zip) { diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/unsigner/UnsignCommand.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/unsigner/UnsignCommand.java index d30c054a1..cce480e7d 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/unsigner/UnsignCommand.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/unsigner/UnsignCommand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,6 +21,7 @@ public class UnsignCommand extends SignCommandStep { super(options, command, verbose); } + @Override public File postProcess(File input, File workingDirectory, List<Properties> containers) { if (command != null && input != null && shouldSign(input, containers)) { execute(input); diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/verifier/Verifier.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/verifier/Verifier.java index e6f6b00ec..f75f6aa4d 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/verifier/Verifier.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/verifier/Verifier.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -87,6 +87,7 @@ public class Verifier extends JarProcessorExecutor { */ final VerifyStep verifyStep = new VerifyStep(properties, false); JarProcessor verifier = new JarProcessor() { + @Override public File processJar(File inputFile) throws IOException { Iterator<IProcessStep> iterator = getStepIterator(); if (iterator.hasNext() && iterator.next() instanceof VerifyStep) @@ -110,10 +111,12 @@ public class Verifier extends JarProcessorExecutor { Utils.clear(workingDirectory); } + @Override public void addPackStep(JarProcessor processor, Properties properties, JarProcessorExecutor.Options processOptions) { processor.addProcessStep(new VerifyStep(properties, processOptions.verbose)); } + @Override public void addPackUnpackStep(JarProcessor processor, Properties properties, Options processOptions) { processor.addProcessStep(new UnpackStep(properties, processOptions.verbose)); } diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/verifier/VerifyStep.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/verifier/VerifyStep.java index c49f9cfd2..5025addbf 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/verifier/VerifyStep.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/verifier/VerifyStep.java @@ -1,5 +1,6 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2007, 2017 IBM Corporation and others. + * All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -45,10 +46,12 @@ public class VerifyStep extends CommandStep { super(options, verifyCommand, ".jar", verbose); //$NON-NLS-1$ } + @Override public String getStepName() { return "Verify"; //$NON-NLS-1$ } + @Override public File postProcess(File input, File workingDirectory, List<Properties> containers) { if (canVerify() && verifyCommand != null) { try { @@ -67,10 +70,12 @@ public class VerifyStep extends CommandStep { return null; } + @Override public File preProcess(File input, File workingDirectory, List<Properties> containers) { return null; } + @Override public String recursionEffect(String entryName) { return null; } diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/internal/provisional/equinox/p2/jarprocessor/JarProcessor.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/internal/provisional/equinox/p2/jarprocessor/JarProcessor.java index 05d9253e9..a73cf3b8c 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/internal/provisional/equinox/p2/jarprocessor/JarProcessor.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/internal/provisional/equinox/p2/jarprocessor/JarProcessor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -18,12 +18,12 @@ import org.eclipse.equinox.internal.p2.jarprocessor.*; public class JarProcessor { public static final String PACKED_SUFFIX = "pack.gz"; //$NON-NLS-1$ - private List<IProcessStep> steps = new ArrayList<IProcessStep>(); + private List<IProcessStep> steps = new ArrayList<>(); private String workingDirectory = ""; //$NON-NLS-1$ private int depth = -1; private boolean verbose = false; private boolean processAll = false; - private LinkedList<Properties> containingInfs = new LinkedList<Properties>(); + private LinkedList<Properties> containingInfs = new LinkedList<>(); static public JarProcessor getUnpackProcessor(Properties properties) { if (!canPerformUnpack()) @@ -307,7 +307,7 @@ public class JarProcessor { JarFile jar = null; try { jar = new JarFile(workingFile, false); - Map<String, String> replacements = new HashMap<String, String>(); + Map<String, String> replacements = new HashMap<>(); Properties inf = Utils.getEclipseInf(workingFile, verbose); extractEntries(jar, tempDir, replacements, inf); diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src_ant/org/eclipse/equinox/internal/p2/jarprocessor/ant/AntBasedProcessorExecutor.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src_ant/org/eclipse/equinox/internal/p2/jarprocessor/ant/AntBasedProcessorExecutor.java index d685b25d8..74205ef81 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src_ant/org/eclipse/equinox/internal/p2/jarprocessor/ant/AntBasedProcessorExecutor.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src_ant/org/eclipse/equinox/internal/p2/jarprocessor/ant/AntBasedProcessorExecutor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -31,24 +31,22 @@ public class AntBasedProcessorExecutor extends JarProcessorExecutor { this.antTaskName = antTaskName; } + @Override protected FileFilter createFileFilter(Options opt) { baseFilter = super.createFileFilter(opt); if (inputFiles == null || inputFiles.size() == 0) return baseFilter; - filterSet = new HashSet<File>(); + filterSet = new HashSet<>(); filterSet.addAll(inputFiles); - return new FileFilter() { - public boolean accept(File pathname) { - return getFilterSet().contains(pathname); - } - }; + return pathname -> getFilterSet().contains(pathname); } protected HashSet<File> getFilterSet() { return filterSet; } + @Override protected void processDirectory(File input, FileFilter filter, boolean verbose, JarProcessor processor, Properties packProperties) throws FileNotFoundException { if (filterSet != null && filterSet.contains(input)) { File[] files = input.listFiles(); @@ -60,6 +58,7 @@ public class AntBasedProcessorExecutor extends JarProcessorExecutor { super.processDirectory(input, filter, verbose, processor, packProperties); } + @Override public void addSignStep(JarProcessor processor, Properties properties, Options opt) { if (signArguments.get(JarProcessorTask.UNSIGN) != null) processor.addProcessStep(new UnsignCommand(properties, opt.signCommand, opt.verbose)); diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src_ant/org/eclipse/equinox/internal/p2/jarprocessor/ant/AntSignCommand.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src_ant/org/eclipse/equinox/internal/p2/jarprocessor/ant/AntSignCommand.java index 8698723bf..c056cd015 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src_ant/org/eclipse/equinox/internal/p2/jarprocessor/ant/AntSignCommand.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src_ant/org/eclipse/equinox/internal/p2/jarprocessor/ant/AntSignCommand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -31,6 +31,7 @@ public class AntSignCommand extends SignCommandStep { this.antTaskName = antTaskName; } + @Override public File postProcess(File input, File workingDirectory, List<Properties> containers) { if (command != null && input != null && shouldSign(input, containers)) { execute(input); diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src_ant/org/eclipse/equinox/internal/p2/jarprocessor/ant/JarProcessorTask.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src_ant/org/eclipse/equinox/internal/p2/jarprocessor/ant/JarProcessorTask.java index c057abd21..0006cadd1 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src_ant/org/eclipse/equinox/internal/p2/jarprocessor/ant/JarProcessorTask.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src_ant/org/eclipse/equinox/internal/p2/jarprocessor/ant/JarProcessorTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -25,7 +25,7 @@ import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessorExec public class JarProcessorTask extends Task { private final Options options = new Options(); private final Properties signArgs = new Properties(); - private final ArrayList<File> inputFiles = new ArrayList<File>(); + private final ArrayList<File> inputFiles = new ArrayList<>(); public static final String ALIAS = "alias"; //$NON-NLS-1$ public static final String KEYSTORE = "keystore"; //$NON-NLS-1$ @@ -100,6 +100,7 @@ public class JarProcessorTask extends Task { } } + @Override public void execute() { options.processAll = true; adjustAndValidateConfiguration(); |