diff options
545 files changed, 11829 insertions, 6735 deletions
diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..4f0e0ff28 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,70 @@ +pipeline { + options { + timeout(time: 40, unit: 'MINUTES') + buildDiscarder(logRotator(numToKeepStr:'5')) + } + agent { + label "centos-latest" + } + tools { + maven 'apache-maven-latest' + jdk 'openjdk-jdk11-latest' + } + stages { + stage('initialize Gerrit review') { + steps { + gerritReview labels: [Verified: 0], message: "Build started $BUILD_URL" + } + } + stage('Build') { + steps { + wrap([$class: 'Xvnc', useXauthority: true]) { + sh """ + mvn clean verify --batch-mode --fail-at-end -Dmaven.repo.local=$WORKSPACE/.m2/repository \ + -Pbuild-individual-bundles -Pbree-libs -Papi-check \ + -DskipTests=false -Dcompare-version-with-baselines.skip=false \ + -Dmaven.test.error.ignore=true -Dmaven.test.failure.ignore=true \ + -Dproject.build.sourceEncoding=UTF-8 + """ + } + } + post { + always { + archiveArtifacts artifacts: '*.log,*/target/work/data/.metadata/*.log,*/tests/target/work/data/.metadata/*.log,apiAnalyzer-workspace/.metadata/*.log', allowEmptyArchive: true + junit '**/target/surefire-reports/TEST-*.xml' + publishIssues issues:[scanForIssues(tool: java()), scanForIssues(tool: mavenConsole())] + } + unstable { + gerritReview labels: [Verified: -1], message: "Build UNSTABLE (test failures) $BUILD_URL" + } + failure { + gerritReview labels: [Verified: -1], message: "Build FAILED $BUILD_URL" + } + } + } + stage('Check freeze period') { + when { + not { + branch 'master' + } + } + steps { + sh "wget https://raw.githubusercontent.com/eclipse-platform/eclipse.platform.releng.aggregator/master/scripts/verifyFreezePeriod.sh" + sh "chmod +x verifyFreezePeriod.sh" + withCredentials([string(credentialsId: 'google-api-key', variable: 'GOOGLE_API_KEY')]) { + sh './verifyFreezePeriod.sh' + } + } + post { + failure { + gerritReview labels: [Verified: -1], message: "Build and test are OK, but Eclipse project is currently in a code freeze period.\nPlease wait for end of code freeze period before merging.\n $BUILD_URL" + } + } + } + } + post { + success { + gerritReview labels: [Verified: 1], message: "Build Succcess $BUILD_URL" + } + } +} diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/.classpath b/bundles/org.eclipse.equinox.frameworkadmin.equinox/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/.classpath +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.frameworkadmin.equinox/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.frameworkadmin.equinox/.settings/org.eclipse.jdt.core.prefs index e90eac15c..1819d992f 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -36,6 +36,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -89,6 +90,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -125,9 +127,11 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 @@ -135,20 +139,23 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 @@ -238,11 +245,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert @@ -273,6 +281,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -297,13 +307,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert @@ -351,6 +365,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do no org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -387,9 +403,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -425,10 +444,14 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF index fbd1d84fd..5ad6e58c5 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.frameworkadmin.equinox;singleton:=true -Bundle-Version: 1.1.400.qualifier +Bundle-Version: 1.2.200.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Import-Package: org.eclipse.equinox.frameworkadmin;version="[2.0.0,3.0.0)", @@ -20,8 +20,8 @@ Import-Package: org.eclipse.equinox.frameworkadmin;version="[2.0.0,3.0.0)", org.osgi.util.tracker;version="1.3.0" Export-Package: org.eclipse.equinox.internal.frameworkadmin.equinox;x-friends:="org.eclipse.equinox.p2.publisher,org.eclipse.equinox.p2.publisher.eclipse,org.eclipse.equinox.simpleconfigurator.manipulator", org.eclipse.equinox.internal.frameworkadmin.equinox.utils;x-friends:="org.eclipse.equinox.p2.publisher.eclipse" -Require-Bundle: org.eclipse.equinox.common -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.equinox.common;bundle-version="3.16.000" +Bundle-RequiredExecutionEnvironment: JavaSE-11 Service-Component: OSGI-INF/fwadmin.xml Bundle-ActivationPolicy: lazy Automatic-Module-Name: org.eclipse.equinox.frameworkadmin.equinox diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/pom.xml b/bundles/org.eclipse.equinox.frameworkadmin.equinox/pom.xml index b00a46e4b..c3ecc7ec9 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/pom.xml +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.frameworkadmin.equinox</artifactId> - <version>1.1.400-SNAPSHOT</version> + <version>1.2.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java index 1dd81817b..829753a25 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java @@ -34,7 +34,7 @@ public class EclipseLauncherParser { //this figures out the location of the data area on partial data read from the <eclipse>.ini private URI getOSGiInstallArea(List<String> lines, URI base, LauncherData launcherData) { //does the eclipse.ini say anything for osgi.install.area? - File osgiInstallArea = ParserUtils.getOSGiInstallArea(lines, null, base); + File osgiInstallArea = ParserUtils.getOSGiInstallArea(lines, null, launcherData.getLauncher(), base); if (osgiInstallArea == null) { //otherwise use the launcherData to figure it out osgiInstallArea = ParserUtils.getOSGiInstallArea(lines, null, launcherData); @@ -49,12 +49,13 @@ public class EclipseLauncherParser { ParserUtils.removeArgument(EquinoxConstants.OPTION_INSTALL, lines); return; } + File folder = ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()); if (Constants.OS_MACOSX.equals(launcherData.getOS())) { - if (!new File(ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()), "../MacOS").equals(launcherFolder)) { - ParserUtils.setValueForArgument(EquinoxConstants.OPTION_INSTALL, launcherFolder.getAbsolutePath().replace('\\', '/'), lines); - } - } else if (!ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()).equals(launcherFolder)) { - ParserUtils.setValueForArgument(EquinoxConstants.OPTION_INSTALL, launcherFolder.getAbsolutePath().replace('\\', '/'), lines); + folder = new File(folder, "../MacOS"); + } + if (!folder.equals(launcherFolder)) { + // Launcher will replace "@launcher.dir" with actual path. See bug 572890. + ParserUtils.setValueForArgument(EquinoxConstants.OPTION_INSTALL, "@launcher.dir/", lines); } } diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java index 5b73611ae..8e16a04c8 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java @@ -328,20 +328,19 @@ public class EquinoxManipulatorImpl implements Manipulator { BundleInfo[] bInfos = new BundleInfo[bundles.length]; for (int i = 0; i < bundles.length; i++) { // System.out.println("bundles[" + i + "]=" + bundles[i]); - try { + Optional<File> bundleFile = FileLocator.getBundleFileLocation(bundles[i]); + if (bundleFile.isPresent()) { if (bundles[i].getBundleId() == 0) // SystemBundle bInfos[i] = new BundleInfo(bundles[i].getSymbolicName(), bundles[i].getHeaders("").get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ - FileLocator.getBundleFile(bundles[i]).getAbsoluteFile().toURI(), -1, true); + bundleFile.get().getAbsoluteFile().toURI(), -1, true); else { bInfos[i] = new BundleInfo(bundles[i].getSymbolicName(), bundles[i].getHeaders("").get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ - FileLocator.getBundleFile(bundles[i]).getAbsoluteFile().toURI(), + bundleFile.get().getAbsoluteFile().toURI(), bundles[i].adapt(BundleStartLevel.class).getStartLevel(), bundles[i].adapt(BundleStartLevel.class).isPersistentlyStarted()); } - } catch (IOException e) { - e.printStackTrace(); } } configData.setBundles(bInfos); diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java index e9a245a1c..a0a72fb01 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java @@ -28,6 +28,7 @@ import org.osgi.service.log.LogService; public class ParserUtils { private static final String FILE_PROTOCOL = "file:"; //$NON-NLS-1$ + private static final String LAUNCHER_DIR = "@launcher.dir"; //$NON-NLS-1$ public static File getOSGiInstallArea(List<String> programArgs, Properties properties, LauncherData launcherData) { if (launcherData == null) @@ -38,7 +39,7 @@ public class ParserUtils { base = launcherData.getLauncher().getParentFile().toURI(); else if (launcherData.getHome() != null) base = launcherData.getHome().toURI(); - File result = getOSGiInstallArea(programArgs, properties, base); + File result = getOSGiInstallArea(programArgs, properties, launcherData.getLauncher(), base); if (result != null) return result; @@ -84,7 +85,7 @@ public class ParserUtils { } //This method should only be used to determine the osgi install area when reading the eclipse.ini - public static File getOSGiInstallArea(List<String> args, Properties properties, URI base) { + public static File getOSGiInstallArea(List<String> args, Properties properties, File launcherFile, URI base) { if (args == null) return null; String install = getValueForArgument(EquinoxConstants.OPTION_INSTALL, args); @@ -94,6 +95,8 @@ public class ParserUtils { if (install != null) { if (install.startsWith(FILE_PROTOCOL)) install = install.substring(FILE_PROTOCOL.length() + 1); + if (install.startsWith(LAUNCHER_DIR)) + install = install.replace(LAUNCHER_DIR, launcherFile.getParent().toString()); File installFile = new File(install); if (installFile.isAbsolute()) return installFile; diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/.classpath b/bundles/org.eclipse.equinox.frameworkadmin.test/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/.classpath +++ b/bundles/org.eclipse.equinox.frameworkadmin.test/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.frameworkadmin.test/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.frameworkadmin.test/.settings/org.eclipse.jdt.core.prefs index 1794e8d27..d3982a2b0 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.frameworkadmin.test/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -35,6 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -88,6 +89,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -123,7 +125,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -137,7 +140,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -258,7 +260,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -329,7 +330,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -474,7 +474,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.frameworkadmin.test/META-INF/MANIFEST.MF index f9edb43dd..0cb1f4139 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.frameworkadmin.test/META-INF/MANIFEST.MF @@ -2,16 +2,17 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.equinox.frameworkadmin.test -Bundle-Version: 1.2.500.qualifier +Bundle-Version: 1.3.0.qualifier Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.core.runtime, org.eclipse.equinox.frameworkadmin, org.eclipse.equinox.frameworkadmin.equinox;bundle-version="1.0.100", - org.junit;bundle-version="3.8.0" + org.junit;bundle-version="3.8.0", + org.eclipse.equinox.simpleconfigurator.manipulator Bundle-Activator: org.eclipse.equinox.frameworkadmin.tests.Activator Import-Package: org.osgi.framework;version="1.4.0" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.eclipse.equinox.frameworkadmin.tests Eclipse-BundleShape: dir Automatic-Module-Name: org.eclipse.equinox.frameworkadmin.test diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/pom.xml b/bundles/org.eclipse.equinox.frameworkadmin.test/pom.xml index fc670fa39..d48775cd2 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.test/pom.xml +++ b/bundles/org.eclipse.equinox.frameworkadmin.test/pom.xml @@ -4,11 +4,25 @@ <parent> <artifactId>org.eclipse.equinox.p2.tests-parent</artifactId> <groupId>org.eclipse</groupId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../../org.eclipse.equinox.p2.releng/org.eclipse.equinox.p2.tests-parent</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.frameworkadmin.test</artifactId> - <version>1.2.500-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> + <version>1.3.0-SNAPSHOT</version> + <packaging>eclipse-test-plugin</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-surefire-plugin</artifactId> + <version>${tycho.version}</version> + <configuration> + <!-- Test execution not compatible with Tycho at the moment --> + <skipTests>true</skipTests> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/bundles/org.eclipse.equinox.frameworkadmin/.classpath b/bundles/org.eclipse.equinox.frameworkadmin/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin/.classpath +++ b/bundles/org.eclipse.equinox.frameworkadmin/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.frameworkadmin/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.frameworkadmin/.settings/org.eclipse.jdt.core.prefs index f0018a393..579521550 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.frameworkadmin/.settings/org.eclipse.jdt.core.prefs @@ -10,9 +10,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -27,6 +27,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -84,6 +85,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -119,9 +121,11 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 @@ -129,20 +133,23 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 @@ -232,11 +239,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert @@ -267,6 +275,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -291,13 +301,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert @@ -345,6 +359,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do no org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -381,9 +397,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -419,9 +438,13 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/bundles/org.eclipse.equinox.frameworkadmin/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.frameworkadmin/META-INF/MANIFEST.MF index 1d86ec3b2..d4bb7cb5e 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.frameworkadmin/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.frameworkadmin;singleton:=true -Bundle-Version: 2.1.400.qualifier +Bundle-Version: 2.2.0.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Import-Package: org.eclipse.osgi.service.pluginconversion;version="1.0.0", @@ -23,7 +23,7 @@ Export-Package: org.eclipse.equinox.frameworkadmin;version="2.0.0", org.eclipse.pde.core, org.eclipse.pde.ui, org.eclipse.equinox.p2.publisher.eclipse" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.equinox.common;bundle-version="3.4.0" Bundle-ActivationPolicy: lazy Automatic-Module-Name: org.eclipse.equinox.frameworkadmin diff --git a/bundles/org.eclipse.equinox.frameworkadmin/pom.xml b/bundles/org.eclipse.equinox.frameworkadmin/pom.xml index 80b5866a0..433dcf50f 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin/pom.xml +++ b/bundles/org.eclipse.equinox.frameworkadmin/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.frameworkadmin</artifactId> - <version>2.1.400-SNAPSHOT</version> + <version>2.2.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/.classpath b/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/.classpath index 6de27b66c..bc3587db4 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/.classpath +++ b/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/.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/JavaSE-11"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..7adc0fb9a --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,10 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/META-INF/MANIFEST.MF index 28688b977..b123fba15 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/META-INF/MANIFEST.MF @@ -2,10 +2,10 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.artifact.checksums.bouncycastle;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 1.1.0.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.equinox.p2.artifact.repository;bundle-version="[1.3.200,2.0.0)" Import-Package: org.bouncycastle.jce.provider;version="[1.59.0,2.0.0)" diff --git a/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/pom.xml b/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/pom.xml index 1e6c17c63..72d6db126 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/pom.xml +++ b/bundles/org.eclipse.equinox.p2.artifact.checksums.bouncycastle/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.artifact.checksums.bouncycastle</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/.classpath b/bundles/org.eclipse.equinox.p2.artifact.optimizers/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/.classpath +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.artifact.optimizers/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.core.prefs index 01dc9cade..6b5625424 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -36,6 +36,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -94,6 +95,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -130,9 +132,11 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 @@ -140,20 +144,23 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 @@ -245,11 +252,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert @@ -280,6 +288,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -304,13 +314,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert @@ -358,6 +372,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do no org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -394,9 +410,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -432,10 +451,14 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF index 5450fecb1..c2f216314 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.artifact.optimizers;singleton:=true -Bundle-Version: 1.1.0.qualifier +Bundle-Version: 1.2.0.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.artifact.optimizers.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -11,7 +11,7 @@ Export-Package: org.eclipse.equinox.internal.p2.artifact.optimizers;x-friends:=" org.eclipse.equinox.internal.p2.artifact.optimizers.pack200;x-internal:=true Require-Bundle: org.eclipse.equinox.common, org.eclipse.equinox.p2.artifact.repository -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.equinox.app;version="1.0.0", org.eclipse.equinox.internal.p2.core.helpers, diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/pom.xml b/bundles/org.eclipse.equinox.p2.artifact.optimizers/pom.xml index 047df807f..8d09d7881 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/pom.xml +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/pom.xml @@ -4,12 +4,12 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.artifact.optimizers</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java index 695202da5..0fcaab754 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java @@ -22,6 +22,13 @@ import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; +/** + * @noextend This class is not intended to be subclassed by clients. + * @noreference This class is not intended to be referenced by clients. + * + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. + */ +@Deprecated(forRemoval = true, since = "1.2.0") public class Application extends OptimizerApplication { // Application return code private static final Integer NON_WRITTABLE_REPOSITORY = -1; diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Messages.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Messages.java index 6865a727e..24437eb3a 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Messages.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Messages.java @@ -8,13 +8,20 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.internal.p2.artifact.optimizers.pack200; import org.eclipse.osgi.util.NLS; +/** + * @noextend This class is not intended to be subclassed by clients. + * @noreference This class is not intended to be referenced by clients. + * + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. + */ +@Deprecated(forRemoval = true, since = "1.2.0") public class Messages extends NLS { private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.p2.artifact.optimizers.pack200.messages"; //$NON-NLS-1$ public static String failed_getting_artifact; diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Optimizer.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Optimizer.java index 096885e07..8038c450d 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Optimizer.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Optimizer.java @@ -27,6 +27,13 @@ import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor; import org.eclipse.osgi.util.NLS; +/** + * @noextend This class is not intended to be subclassed by clients. + * @noreference This class is not intended to be referenced by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. + */ +@Deprecated(forRemoval = true, since = "1.2.0") public class Optimizer { private final IArtifactRepository repository; diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Pack200OptimizerStep.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Pack200OptimizerStep.java index f36f9b9df..e4937fa48 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Pack200OptimizerStep.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Pack200OptimizerStep.java @@ -26,7 +26,13 @@ import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessorExec /** * The Pack200Packer expects an input containing normal ".jar" data. + * + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + * @noreference This class is not intended to be referenced by clients. + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. */ +@Deprecated(forRemoval = true, since = "1.2.0") public class Pack200OptimizerStep extends AbstractBufferingStep { private static final String PACKED_SUFFIX = ".pack.gz"; //$NON-NLS-1$ private File incoming; diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/.classpath b/bundles/org.eclipse.equinox.p2.artifact.processors/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.processors/.classpath +++ b/bundles/org.eclipse.equinox.p2.artifact.processors/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.artifact.processors/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.artifact.processors/.settings/org.eclipse.jdt.core.prefs index 0eaaba2e8..9dab61dd4 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.processors/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.artifact.processors/.settings/org.eclipse.jdt.core.prefs @@ -18,9 +18,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -37,6 +37,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -90,6 +91,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -126,10 +128,11 @@ 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.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 @@ -137,20 +140,23 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 @@ -242,11 +248,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert @@ -277,6 +284,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -301,13 +310,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert @@ -355,6 +368,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do no org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -391,9 +406,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -429,10 +447,14 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.artifact.processors/META-INF/MANIFEST.MF index 6e8b9b149..785bd915d 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.processors/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.artifact.processors/META-INF/MANIFEST.MF @@ -2,14 +2,14 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.artifact.processors;singleton:=true -Bundle-Version: 1.1.0.qualifier +Bundle-Version: 1.2.0.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.equinox.internal.p2.artifact.processors;x-internal:=true, org.eclipse.equinox.internal.p2.artifact.processors.jardelta;x-internal:=true Require-Bundle: org.eclipse.equinox.common, org.eclipse.equinox.p2.artifact.repository -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.equinox.internal.p2.artifact.optimizers, org.eclipse.equinox.internal.p2.core.helpers, diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/pom.xml b/bundles/org.eclipse.equinox.p2.artifact.processors/pom.xml index f0205f68b..08e7da3c8 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.processors/pom.xml +++ b/bundles/org.eclipse.equinox.p2.artifact.processors/pom.xml @@ -4,12 +4,12 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.artifact.processors</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath b/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.artifact.repository/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs index 75bfd5011..f015e9f64 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -35,6 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -88,6 +89,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -123,7 +125,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -137,7 +140,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -258,7 +260,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -329,7 +330,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -474,7 +474,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF index a4e478736..05dc70a3c 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.artifact.repository;singleton:=true -Bundle-Version: 1.4.0.qualifier +Bundle-Version: 1.4.400.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.artifact.repository.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -10,6 +10,7 @@ Export-Package: org.eclipse.equinox.internal.p2.artifact.processing;x-friends:=" org.eclipse.equinox.internal.p2.artifact.processors.checksum;x-friends:="org.eclipse.equinox.p2.publisher", org.eclipse.equinox.internal.p2.artifact.processors.md5;x-internal:=true, org.eclipse.equinox.internal.p2.artifact.processors.pack200;x-friends:="org.eclipse.equinox.p2.artifact.processors,org.eclipse.equinox.p2.artifact.optimizers", + org.eclipse.equinox.internal.p2.artifact.processors.pgp;x-friends:="org.eclipse.equinox.p2.engine,org.eclipse.equinox.p2.ui.sdk,org.eclipse.equinox.p2.ui", org.eclipse.equinox.internal.p2.artifact.repository; x-friends:="org.eclipse.equinox.p2.publisher, org.eclipse.equinox.p2.reconciler.dropins, @@ -37,6 +38,14 @@ Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.7.0,4.0.0)", org.eclipse.equinox.p2.metadata, org.tukaani.xz;bundle-version="1.3.0" Import-Package: javax.xml.parsers, + org.bouncycastle.bcpg;version="1.65.0", + org.bouncycastle.jce.provider;version="1.65.1", + org.bouncycastle.openpgp;version="1.65.0", + org.bouncycastle.openpgp.bc;version="1.65.0", + org.bouncycastle.openpgp.jcajce;version="1.65.0", + org.bouncycastle.openpgp.operator;version="1.65.0", + org.bouncycastle.openpgp.operator.bc;version="1.65.0", + org.bouncycastle.openpgp.operator.jcajce;version="1.65.0", org.eclipse.core.runtime.jobs, org.eclipse.equinox.internal.p2.core.helpers, org.eclipse.equinox.internal.p2.jarprocessor, diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/plugin.xml b/bundles/org.eclipse.equinox.p2.artifact.repository/plugin.xml index bf5778333..4be690540 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/plugin.xml +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/plugin.xml @@ -41,8 +41,9 @@ <extension point="org.eclipse.equinox.p2.artifact.repository.artifactChecksums"> <artifactChecksum - algorithm="MD5" - id="md5"> + algorithm="MD5" + id="md5" + warnInsecure="true"> </artifactChecksum> </extension> <extension @@ -52,4 +53,10 @@ id="sha-256"> </artifactChecksum> </extension> + + <extension + id="org.eclipse.equinox.p2.processing.PGPSignatureCheck" + point="org.eclipse.equinox.p2.artifact.repository.processingSteps"> + <step class="org.eclipse.equinox.internal.p2.artifact.processors.pgp.PGPSignatureVerifier"/> + </extension> </plugin> diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/pom.xml b/bundles/org.eclipse.equinox.p2.artifact.repository/pom.xml index f20d0f75f..bc016ef5a 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/pom.xml +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/pom.xml @@ -4,22 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.artifact.repository</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.4.400-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> - <profiles> - <profile> - <id>jdk9-or-newer</id> - <activation> - <jdk>[9,)</jdk> - </activation> - <properties> - <maven.compiler.release>8</maven.compiler.release> - </properties> - </profile> - </profiles> </project> diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/schema/artifactChecksums.exsd b/bundles/org.eclipse.equinox.p2.artifact.repository/schema/artifactChecksums.exsd index 0f7b4b097..017af5b24 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/schema/artifactChecksums.exsd +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/schema/artifactChecksums.exsd @@ -76,6 +76,14 @@ As other tools will rely on this id, consider using some well-defined value (i.e </documentation> </annotation> </attribute> + <attribute name="warnInsecure" type="boolean"> + <annotation> + <documentation> + Since 1.4.300 +Set to true if this algorithm is now considered as insecure. A warning will be logged when this algorithm is used. An artifact that has no checksums or checksums only for insecure algorithms will emit a warning to user. + </documentation> + </annotation> + </attribute> </complexType> </element> diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumUtilities.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumUtilities.java index f45b7f203..ca091e5ea 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumUtilities.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumUtilities.java @@ -19,12 +19,13 @@ import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.util.*; import java.util.Map.Entry; +import java.util.stream.Collectors; import org.eclipse.core.runtime.*; import org.eclipse.equinox.internal.p2.artifact.repository.Messages; +import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; import org.eclipse.equinox.internal.p2.repository.Activator; import org.eclipse.equinox.internal.p2.repository.helpers.ChecksumHelper; import org.eclipse.equinox.internal.p2.repository.helpers.ChecksumProducer; -import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor; import org.eclipse.osgi.util.NLS; @@ -43,8 +44,9 @@ public class ChecksumUtilities { * @throws IllegalArgumentException if property neither {@link IArtifactDescriptor#ARTIFACT_CHECKSUM} nor {@link IArtifactDescriptor#DOWNLOAD_CHECKSUM} * @see ChecksumHelper#getChecksums(IArtifactDescriptor, String) */ - public static Collection<ProcessingStep> getChecksumVerifiers(IArtifactDescriptor descriptor, String property, Set<String> checksumsToSkip) throws IllegalArgumentException { - Collection<ProcessingStep> steps = new ArrayList<>(); + public static Collection<ChecksumVerifier> getChecksumVerifiers(IArtifactDescriptor descriptor, + String property, Set<String> checksumsToSkip) throws IllegalArgumentException { + Collection<ChecksumVerifier> steps = new ArrayList<>(); Map<String, String> checksums = ChecksumHelper.getChecksums(descriptor, property); IConfigurationElement[] checksumVerifierConfigurations = getChecksumComparatorConfigurations(); @@ -58,17 +60,25 @@ public class ChecksumUtilities { if (checksumEntry.getKey().equals(checksumId)) { String checksumAlgorithm = checksumVerifierConfiguration.getAttribute("algorithm"); //$NON-NLS-1$ String providerName = checksumVerifierConfiguration.getAttribute("providerName"); //$NON-NLS-1$ - ChecksumVerifier checksumVerifier = new ChecksumVerifier(checksumAlgorithm, providerName, checksumId); + boolean insecure = Boolean.parseBoolean(checksumVerifierConfiguration.getAttribute("warnInsecure")); //$NON-NLS-1$ + ChecksumVerifier checksumVerifier = new ChecksumVerifier(checksumAlgorithm, providerName, checksumId, insecure); checksumVerifier.initialize(null, new ProcessingStepDescriptor(null, checksumEntry.getValue(), true), descriptor); - if (checksumVerifier.getStatus().isOK()) + if (checksumVerifier.getStatus().isOK()) { steps.add(checksumVerifier); - else - // TODO log something? - continue; + } else { + LogHelper.log(checksumVerifier.getStatus()); + } } } } + if (!steps.isEmpty() && steps.stream().allMatch(ChecksumVerifier::isInsecureAlgorithm)) { + LogHelper.log(new Status(IStatus.WARNING, Activator.ID, + NLS.bind(Messages.onlyInsecureDigestAlgorithmUsed, + steps.stream().map(ChecksumVerifier::getAlgorithmId).collect(Collectors.joining(",")), //$NON-NLS-1$ + descriptor.getArtifactKey()))); + } + return steps; } diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumVerifier.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumVerifier.java index 4d913c46d..a11041bb4 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumVerifier.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumVerifier.java @@ -33,12 +33,14 @@ final public class ChecksumVerifier extends MessageDigestProcessingStep { final private String algorithmName; final private String providerName; final private String algorithmId; + private final boolean insecureAlgorithm; // public to access from tests - public ChecksumVerifier(String digestAlgorithm, String providerName, String algorithmId) { + public ChecksumVerifier(String digestAlgorithm, String providerName, String algorithmId, boolean insecure) { this.algorithmName = digestAlgorithm; this.providerName = providerName; this.algorithmId = algorithmId; + this.insecureAlgorithm = insecure; basicInitialize(null); } @@ -91,4 +93,7 @@ final public class ChecksumVerifier extends MessageDigestProcessingStep { return algorithmId; } + public boolean isInsecureAlgorithm() { + return insecureAlgorithm; + } } diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/MD5Verifier.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/MD5Verifier.java index 1128de496..8d7899788 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/MD5Verifier.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/MD5Verifier.java @@ -70,7 +70,9 @@ public class MD5Verifier extends MessageDigestProcessingStep { @Override protected void onClose(String digestString) { // if the hashes don't line up set the status to error. - if (!digestString.equals(expectedMD5)) + if (!digestString.equals(expectedMD5)) { setStatus(new Status(IStatus.ERROR, Activator.ID, ProvisionException.ARTIFACT_MD5_NOT_MATCH, NLS.bind(Messages.Error_unexpected_hash, expectedMD5, digestString), null)); + } + setStatus(new Status(IStatus.WARNING, Activator.ID, Messages.MD5_deprecated)); } } diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/Messages.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/Messages.java index 3a873e912..32636d0b8 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/Messages.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/Messages.java @@ -23,6 +23,8 @@ public class Messages extends NLS { public static String Error_MD5_unavailable; public static String Error_unexpected_hash; + public static String MD5_deprecated; + static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/messages.properties b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/messages.properties index ff1415688..1e2c7e843 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/messages.properties +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/messages.properties @@ -15,3 +15,4 @@ Error_invalid_hash=MD5 value not available or incorrect size, {0}. Error_MD5_unavailable=Could not create MD5 algorithm. Error_unexpected_hash=MD5 hash is not as expected. Expected: {0} and found {1}. +MD5_deprecated=MD5 is a deprecated and unsafe checksum algorithm. Consider abandoning it in favor of safer checksums.
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java index 9d85ac7ac..81089af71 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java @@ -32,7 +32,12 @@ import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessorExec /** * The Pack200Unpacker expects an input containing ".jar.pack.gz" data. + * @noinstantiate This class is not intended to be instantiated by clients. + * @noextend This class is not intended to be subclassed by clients. + * @noreference This class is not intended to be referenced by clients. + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. */ +@Deprecated(forRemoval = true, since = "1.4.100") public class Pack200ProcessorStep extends AbstractBufferingStep { public static final String PACKED_SUFFIX = ".pack.gz"; //$NON-NLS-1$ private static boolean detailedResult = false; diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pgp/Messages.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pgp/Messages.java new file mode 100644 index 000000000..4f522f0a0 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pgp/Messages.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2021 Red Hat Inc. and others + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.equinox.internal.p2.artifact.processors.pgp; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.p2.artifact.processors.pgp.messages"; //$NON-NLS-1$ + + public static String Error_SignatureAfterKeyExpiration; + + public static String Error_SignatureAfterKeyRevocation; + + public static String Error_SignatureAndFileDontMatch; + + public static String Error_CouldNotLoadSignature; + + public static String Warning_publicKeyNotFound; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + //empty + } +} diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pgp/PGPPublicKeyStore.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pgp/PGPPublicKeyStore.java new file mode 100644 index 000000000..8f3d15083 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pgp/PGPPublicKeyStore.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2021 Red Hat Inc. and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.equinox.internal.p2.artifact.processors.pgp; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import org.bouncycastle.bcpg.ArmoredOutputStream; +import org.bouncycastle.openpgp.*; +import org.bouncycastle.openpgp.jcajce.JcaPGPObjectFactory; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.equinox.internal.p2.artifact.repository.Activator; +import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; +import org.eclipse.equinox.p2.repository.spi.PGPPublicKeyService; + +public class PGPPublicKeyStore { + private Map<String, PGPPublicKey> keys = new LinkedHashMap<>(); + + public PGPPublicKey addKey(PGPPublicKey key) { + if (key == null) { + return null; + } + PGPPublicKey alreadyStoredKey = keys.putIfAbsent(PGPPublicKeyService.toHexFingerprint(key), key); + return alreadyStoredKey == null ? key : alreadyStoredKey; + } + + public Collection<PGPPublicKey> getKeys(long id) { + return keys.values().stream().filter(key -> key.getKeyID() == id).collect(Collectors.toList()); + } + + public void addKeys(String... armoredPublicKeys) { + for (String armoredKey : armoredPublicKeys) { + if (armoredKey != null) { + PGPPublicKeyStore.readPublicKeys(armoredKey).forEach(this::addKey); + } + } + } + + /** + * Test only + */ + public void clear() { + keys.clear(); + } + + public Collection<PGPPublicKey> all() { + return Collections.unmodifiableCollection(keys.values()); + } + + public boolean isEmpty() { + return keys.isEmpty(); + } + + public String toArmoredString() throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + ArmoredOutputStream armoredOut = new ArmoredOutputStream(out); + for (PGPPublicKey key : all()) { + key.encode(armoredOut); + } + armoredOut.close(); + out.close(); + return new String(out.toByteArray(), StandardCharsets.US_ASCII); + } + + public void remove(PGPPublicKey selectedKey) { + keys.remove(PGPPublicKeyService.toHexFingerprint(selectedKey)); + } + + public void add(File file) { + try (InputStream stream = new FileInputStream(file)) { + readPublicKeys(stream).forEach(this::addKey); + } catch (IOException e) { + LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Could not read PGP key from " + file, e)); //$NON-NLS-1$ + } + } + + public static Set<PGPPublicKey> readPublicKeys(InputStream input) throws IOException { + return readPublicKeys(new String(input.readAllBytes(), StandardCharsets.US_ASCII)); + } + + @SuppressWarnings("unchecked") + public static Set<PGPPublicKey> readPublicKeys(String armoredPublicKeyring) { + if (armoredPublicKeyring == null) { + return Set.of(); + } + Set<PGPPublicKey> res = new HashSet<>(); + try (InputStream stream = PGPUtil.getDecoderStream(new ByteArrayInputStream( + PGPSignatureVerifier.unnormalizedPGPProperty(armoredPublicKeyring) + .getBytes(StandardCharsets.US_ASCII)))) { + new JcaPGPObjectFactory(stream).forEach(o -> { + if (o instanceof PGPPublicKeyRingCollection) { + collectKeys((PGPPublicKeyRingCollection) o, res::add); + } + if (o instanceof PGPPublicKeyRing) { + collectKeys((PGPPublicKeyRing) o, res::add); + } + if (o instanceof PGPPublicKey) { + res.add((PGPPublicKey) o); + } + }); + } catch (IOException | PGPRuntimeOperationException e) { + LogHelper.log(new Status(IStatus.ERROR, Activator.ID, e.getMessage(), e)); + } + return res; + + } + + private static void collectKeys(PGPPublicKeyRingCollection pgpPublicKeyRingCollection, + Consumer<PGPPublicKey> collector) { + pgpPublicKeyRingCollection.forEach(keyring -> collectKeys(keyring, collector)); + } + + private static void collectKeys(PGPPublicKeyRing pgpPublicKeyRing, Consumer<PGPPublicKey> collector) { + pgpPublicKeyRing.getPublicKeys().forEachRemaining(collector::accept); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pgp/PGPSignatureVerifier.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pgp/PGPSignatureVerifier.java new file mode 100644 index 000000000..b994b7740 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pgp/PGPSignatureVerifier.java @@ -0,0 +1,275 @@ +/******************************************************************************* + * Copyright (c) 2021 Red Hat Inc. and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.equinox.internal.p2.artifact.processors.pgp; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.Map.Entry; +import org.bouncycastle.bcpg.ArmoredInputStream; +import org.bouncycastle.openpgp.*; +import org.bouncycastle.openpgp.bc.BcPGPObjectFactory; +import org.bouncycastle.openpgp.operator.PGPContentVerifier; +import org.bouncycastle.openpgp.operator.PGPContentVerifierBuilder; +import org.bouncycastle.openpgp.operator.bc.BcPGPContentVerifierBuilderProvider; +import org.eclipse.core.runtime.*; +import org.eclipse.equinox.internal.p2.artifact.repository.Activator; +import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; +import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.repository.artifact.*; +import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; +import org.eclipse.equinox.p2.repository.spi.PGPPublicKeyService; +import org.eclipse.osgi.util.NLS; + +/** + * This processing step verifies PGP signatures are correct (i.e., the artifact + * was not tampered during fetch). Note that is does <b>not</b> deal with trust. + * Dealing with trusted signers is done as part of CheckTrust and touchpoint + * phase. + */ +public final class PGPSignatureVerifier extends ProcessingStep { + + /** + * ID of the registering + * <code>org.eclipse.equinox.p2.artifact.repository.processingSteps</tt> + * extension. + */ + public static final String ID = "org.eclipse.equinox.p2.processing.PGPSignatureCheck"; //$NON-NLS-1$ + + public static final String PGP_SIGNER_KEYS_PROPERTY_NAME = "pgp.publicKeys"; //$NON-NLS-1$ + + public static final String PGP_SIGNATURES_PROPERTY_NAME = "pgp.signatures"; //$NON-NLS-1$ + + private PGPPublicKeyService keyService; + + private IArtifactDescriptor sourceDescriptor; + + private Map<PGPSignature, List<PGPContentVerifier>> signaturesToVerify = new LinkedHashMap<>(); + + private Map<PGPContentVerifier, PGPPublicKey> verifierKeys = new LinkedHashMap<>(); + + private List<OutputStream> signatureVerifiers = new ArrayList<>(); + + public PGPSignatureVerifier() { + super(); + link(nullOutputStream(), new NullProgressMonitor()); // this is convenience for tests + } + + public static Collection<PGPSignature> getSignatures(IArtifactDescriptor artifact) + throws IOException, PGPException { + String signatureText = unnormalizedPGPProperty(artifact.getProperty(PGP_SIGNATURES_PROPERTY_NAME)); + if (signatureText == null) { + return Collections.emptyList(); + } + List<PGPSignature> res = new ArrayList<>(); + try (InputStream in = new ArmoredInputStream( + new ByteArrayInputStream(signatureText.getBytes(StandardCharsets.US_ASCII)))) { + PGPObjectFactory pgpFactory = new BcPGPObjectFactory(in); + Object o = pgpFactory.nextObject(); + PGPSignatureList signatureList = new PGPSignatureList(new PGPSignature[0]); + if (o instanceof PGPCompressedData) { + PGPCompressedData pgpCompressData = (PGPCompressedData) o; + pgpFactory = new BcPGPObjectFactory(pgpCompressData.getDataStream()); + signatureList = (PGPSignatureList) pgpFactory.nextObject(); + } else if (o instanceof PGPSignatureList) { + signatureList = (PGPSignatureList) o; + } + signatureList.iterator().forEachRemaining(res::add); + } + return res; + } + + public static PGPPublicKeyStore getKeys(IArtifactDescriptor artifact) { + PGPPublicKeyStore keyStore = new PGPPublicKeyStore(); + String keyText = artifact.getProperty(PGPSignatureVerifier.PGP_SIGNER_KEYS_PROPERTY_NAME); + PGPPublicKeyStore.readPublicKeys(keyText).stream().forEach(keyStore::addKey); + return keyStore; + } + + @Override + public void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descriptor, + IArtifactDescriptor context) { + super.initialize(agent, descriptor, context); + + sourceDescriptor = context; + keyService = agent.getService(PGPPublicKeyService.class); + +// 1. verify declared public keys have signature from a trusted key, if so, add to KeyStore +// 2. verify artifact signature matches signature of given keys, and at least 1 of this key is trusted + String signatureText = unnormalizedPGPProperty(context.getProperty(PGP_SIGNATURES_PROPERTY_NAME)); + if (signatureText == null) { + setStatus(Status.OK_STATUS); + return; + } + + Collection<PGPSignature> signatures; + try { + signatures = getSignatures(context); + } catch (Exception ex) { + setStatus(new Status(IStatus.ERROR, Activator.ID, Messages.Error_CouldNotLoadSignature, ex)); + return; + } + + if (signatures.isEmpty()) { + setStatus(Status.OK_STATUS); + return; + } + + IArtifactRepository repository = context.getRepository(); + + PGPPublicKeyStore.readPublicKeys(context.getProperty(PGP_SIGNER_KEYS_PROPERTY_NAME)) + .forEach(keyService::addKey); + if (repository != null) { + PGPPublicKeyStore.readPublicKeys(repository.getProperty(PGP_SIGNER_KEYS_PROPERTY_NAME)) + .forEach(keyService::addKey); + } + + for (PGPSignature signature : signatures) { + long keyID = signature.getKeyID(); + Collection<PGPPublicKey> keys = keyService.getKeys(keyID); + if (keys.isEmpty()) { + LogHelper.log(new Status(IStatus.WARNING, Activator.ID, + NLS.bind(Messages.Warning_publicKeyNotFound, PGPPublicKeyService.toHex(keyID), + context.getArtifactKey().getId()))); + } else { + try { + PGPContentVerifierBuilder verifierBuilder = new BcPGPContentVerifierBuilderProvider() + .get(signature.getKeyAlgorithm(), signature.getHashAlgorithm()); + List<PGPContentVerifier> verifiers = new ArrayList<>(); + signaturesToVerify.put(signature, verifiers); + for (PGPPublicKey key : keys) { + PGPContentVerifier verifier = verifierBuilder.build(key); + verifierKeys.put(verifier, key); + verifiers.add(verifier); + signatureVerifiers.add(verifier.getOutputStream()); + } + } catch (PGPException ex) { + setStatus(new Status(IStatus.ERROR, Activator.ID, ex.getMessage(), ex)); + return; + } + } + } + } + + /** + * See // https://www.w3.org/TR/1998/REC-xml-19980210#AVNormalize, newlines + * replaced by spaces by parser, needs to be restored + * + * @param armoredPGPBlock the PGP block, in armored form + * @return fixed PGP armored blocks + */ + static String unnormalizedPGPProperty(String armoredPGPBlock) { + if (armoredPGPBlock == null) { + return null; + } + if (armoredPGPBlock.contains("\n") || armoredPGPBlock.contains("\r")) { //$NON-NLS-1$ //$NON-NLS-2$ + return armoredPGPBlock; + } + return armoredPGPBlock.replace(' ', '\n') + .replace("-----BEGIN\nPGP\nSIGNATURE-----", "-----BEGIN PGP SIGNATURE-----") //$NON-NLS-1$ //$NON-NLS-2$ + .replace("-----END\nPGP\nSIGNATURE-----", "-----END PGP SIGNATURE-----") //$NON-NLS-1$ //$NON-NLS-2$ + .replace("-----BEGIN\nPGP\nPUBLIC\nKEY\nBLOCK-----", "-----BEGIN PGP PUBLIC KEY BLOCK-----") //$NON-NLS-1$ //$NON-NLS-2$ + .replace("-----END\nPGP\nPUBLIC\nKEY\nBLOCK-----", "-----END PGP PUBLIC KEY BLOCK-----"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Override + public void write(int b) throws IOException { + getDestination().write(b); + for (OutputStream verifier : signatureVerifiers) { + verifier.write(b); + } + } + + @Override + public void write(byte[] b, int off, int len) throws IOException { + getDestination().write(b, off, len); + for (OutputStream verifier : signatureVerifiers) { + verifier.write(b, off, len); + } + } + + @Override + public void close() throws IOException { + try { + if (!getStatus().isOK()) { + return; + } + + if (signaturesToVerify.isEmpty()) { + return; + } + + PGPPublicKeyStore keyStore = new PGPPublicKeyStore(); + for (Entry<PGPSignature, List<PGPContentVerifier>> entry : signaturesToVerify.entrySet()) { + PGPSignature signature = entry.getKey(); + List<PGPContentVerifier> verifiers = entry.getValue(); + boolean verified = false; + for (PGPContentVerifier verifier : verifiers) { + try { + verifier.getOutputStream().write(signature.getSignatureTrailer()); + if (verifier.verify(signature.getSignature())) { + PGPPublicKey verifyingKey = verifierKeys.get(verifier); + if (!Boolean.FALSE.toString() + .equalsIgnoreCase(System.getProperty("p2.pgp.verifyExpiration"))) { //$NON-NLS-1$ + if (PGPPublicKeyService.compareSignatureTimeToKeyValidityTime(signature, + verifyingKey) != 0) { + LogHelper.log(new Status(IStatus.WARNING, Activator.ID, + NLS.bind(Messages.Error_SignatureAfterKeyExpiration, PGPPublicKeyService + .toHexFingerprint(verifyingKey)))); + } + } + + if (!Boolean.FALSE.toString() + .equalsIgnoreCase(System.getProperty("p2.pgp.verifyRevocation"))) { //$NON-NLS-1$ + if (!keyService.isCreatedBeforeRevocation(signature, verifyingKey)) { + setStatus(new Status(IStatus.ERROR, Activator.ID, + NLS.bind(Messages.Error_SignatureAfterKeyRevocation, PGPPublicKeyService + .toHexFingerprint(verifyingKey)))); + return; + } + } + + keyStore.addKey(verifyingKey); + verified = true; + break; + } + } catch (PGPException ex) { + LogHelper.log(new Status(IStatus.ERROR, Activator.ID, ex.getMessage(), ex)); + } + } + + if (!verified) { + setStatus(new Status(IStatus.ERROR, Activator.ID, Messages.Error_SignatureAndFileDontMatch)); + return; + } + } + + // Update the destination artifact descriptor with the signatures that have been + // verified and the keys used for that verification. + OutputStream destination = getDestination(); + if (destination instanceof IAdaptable) { + ArtifactDescriptor destinationDescriptor = ((IAdaptable) destination) + .getAdapter(ArtifactDescriptor.class); + destinationDescriptor.setProperty(PGP_SIGNATURES_PROPERTY_NAME, + sourceDescriptor.getProperty(PGP_SIGNATURES_PROPERTY_NAME)); + destinationDescriptor.setProperty(PGP_SIGNER_KEYS_PROPERTY_NAME, keyStore.toArmoredString()); + } + + setStatus(Status.OK_STATUS); + } finally + + { + super.close(); + } + } + +} diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pgp/messages.properties b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pgp/messages.properties new file mode 100644 index 000000000..09a1e7292 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pgp/messages.properties @@ -0,0 +1,16 @@ +############################################################################### +# Copyright (c) 2021 Red Hat Inc. and others +# +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### + +Error_SignatureAfterKeyRevocation=The signature is created after the revocation time of the signature's key {0} +Error_SignatureAfterKeyExpiration=The signature is created after the expiration time of the signature's key {0} +Error_SignatureAndFileDontMatch=The signature is invalid for current content +Error_CouldNotLoadSignature=The signatures could not be loaded +Warning_publicKeyNotFound=A public key with ID {0} needed to verify the signatures of {1} could not be found diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java index 22b65a2e1..a4ae2b92b 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java @@ -14,6 +14,8 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.artifact.repository; +import static java.lang.String.format; + import java.io.File; import java.io.IOException; import java.net.URI; @@ -105,7 +107,7 @@ public class Activator implements BundleActivator { private File getLockFile(URI repositoryLocation) throws IOException { if (!URIUtil.isFileURI(repositoryLocation)) { - throw new IOException("Cannot lock a non file based repository"); //$NON-NLS-1$ + throw new IOException(format("Cannot lock a non file based repository %s", repositoryLocation)); //$NON-NLS-1$ } URI result = URIUtil.append(repositoryLocation, ".artifactlock"); //$NON-NLS-1$ return URIUtil.toFile(result); diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Messages.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Messages.java index f4eba31a3..993ad714b 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Messages.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Messages.java @@ -71,6 +71,8 @@ public class Messages extends NLS { public static String calculateChecksum_ok; public static String calculateChecksum_error; public static String calculateChecksum_providerError; + public static String onlyInsecureDigestAlgorithmUsed; + public static String noDigestAlgorithmToVerifyDownload; static { // initialize resource bundles diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java index 965277d1c..ccd932110 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java @@ -151,7 +151,7 @@ public class MirrorRequest extends ArtifactRequest { return; } - IArtifactDescriptor destinationDescriptor = getDestinationDescriptor(descriptor); + IArtifactDescriptor destinationDescriptor = getDestinationDescriptor(descriptor, descriptor == canonical); IStatus status = transfer(destinationDescriptor, descriptor, monitor); // if ok, cancelled or transfer has already been done with the canonical form return with status set if (status.getSeverity() == IStatus.CANCEL) { @@ -176,7 +176,7 @@ public class MirrorRequest extends ArtifactRequest { return; } - IStatus canonicalStatus = transfer(getDestinationDescriptor(canonical), canonical, monitor); + IStatus canonicalStatus = transfer(getDestinationDescriptor(canonical, true), canonical, monitor); // To prevent the optimized transfer status severity from dominating the canonical, only merge // if the canonical severity is equal to or higher than the optimized transfer severity. if (canonicalStatus.getSeverity() < status.getSeverity()) @@ -185,7 +185,7 @@ public class MirrorRequest extends ArtifactRequest { setResult(new MultiStatus(Activator.ID, canonicalStatus.getCode() != 0 ? canonicalStatus.getCode() : status.getCode(), new IStatus[] {status, canonicalStatus}, Messages.MirrorRequest_multipleDownloadProblems, null)); } - private IArtifactDescriptor getDestinationDescriptor(IArtifactDescriptor sourceDescriptor) { + private IArtifactDescriptor getDestinationDescriptor(IArtifactDescriptor sourceDescriptor, boolean isCanonical) { // Get the descriptor to use to store the artifact // Since we are mirroring, ensure we clear out data from the original descriptor that may // not apply in the new repo location. diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java index 3e103e9cc..823bfc647 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java @@ -20,7 +20,10 @@ import java.util.Collection; import java.util.Collections; import org.eclipse.core.runtime.*; import org.eclipse.equinox.internal.p2.artifact.processors.checksum.ChecksumUtilities; +import org.eclipse.equinox.internal.p2.artifact.processors.checksum.ChecksumVerifier; import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository; +import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; +import org.eclipse.equinox.internal.p2.repository.Activator; import org.eclipse.equinox.internal.p2.repository.Transport; import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep; import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepHandler; @@ -57,7 +60,7 @@ public class RawMirrorRequest extends MirrorRequest { } IStatus status = transfer(targetDescriptor, sourceDescriptor, monitor); - // if ok, cancelled or transfer has already been done with the canonical form return with status set + // if ok, cancelled or transfer has already been done with the canonical form return with status set if (status.getSeverity() == IStatus.CANCEL) { setResult(status); return; @@ -85,9 +88,13 @@ public class RawMirrorRequest extends MirrorRequest { // Perform the mirror operation without any processing steps @Override protected IStatus getArtifact(IArtifactDescriptor artifactDescriptor, OutputStream destination, IProgressMonitor monitor) { - if (SimpleArtifactRepository.CHECKSUMS_ENABLED) { - Collection<ProcessingStep> steps = ChecksumUtilities.getChecksumVerifiers(artifactDescriptor, IArtifactDescriptor.DOWNLOAD_CHECKSUM, Collections.emptySet()); + Collection<ChecksumVerifier> steps = ChecksumUtilities.getChecksumVerifiers(artifactDescriptor, + IArtifactDescriptor.DOWNLOAD_CHECKSUM, Collections.emptySet()); + if (steps.isEmpty()) { + LogHelper.log(new Status(IStatus.WARNING, Activator.ID, + NLS.bind(Messages.noDigestAlgorithmToVerifyDownload, artifactDescriptor.getArtifactKey()))); + } ProcessingStep[] stepArray = steps.toArray(new ProcessingStep[steps.size()]); // TODO should probably be using createAndLink here ProcessingStepHandler handler = new ProcessingStepHandler(); diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/messages.properties b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/messages.properties index fa54c3f8c..6a2901ac7 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/messages.properties +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/messages.properties @@ -62,4 +62,7 @@ calculateChecksum_providerError=Checksum provider id={0} algorithm={1} provider= exception_unableToCreateParentDir = Unable to create parent directory. folder_artifact_not_file_repo=Artifact {0} is a folder but the repository is an archive or remote location. retryRequest=Download of {0} failed on repository {1}. Retrying. -error_copying_local_file=An error occurred copying file {0}.
\ No newline at end of file +error_copying_local_file=An error occurred copying file {0}. + +onlyInsecureDigestAlgorithmUsed = The digest algorithms ({0}) used to verify {1} have severely compromised security. Please report this concern to the artifact provider. +noDigestAlgorithmToVerifyDownload = No digest algorithm is available to verify download of {0}.
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java index 492e50667..b13c03692 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java @@ -29,9 +29,12 @@ import java.util.jar.JarOutputStream; import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.equinox.internal.p2.artifact.processors.checksum.ChecksumUtilities; +import org.eclipse.equinox.internal.p2.artifact.processors.checksum.ChecksumVerifier; +import org.eclipse.equinox.internal.p2.artifact.processors.pgp.PGPSignatureVerifier; import org.eclipse.equinox.internal.p2.artifact.repository.*; import org.eclipse.equinox.internal.p2.artifact.repository.Messages; import org.eclipse.equinox.internal.p2.core.helpers.FileUtils; +import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; import org.eclipse.equinox.internal.p2.metadata.expression.CompoundIterator; import org.eclipse.equinox.internal.p2.metadata.index.IndexProvider; @@ -48,8 +51,7 @@ import org.eclipse.equinox.p2.metadata.index.IIndexProvider; import org.eclipse.equinox.p2.query.*; import org.eclipse.equinox.p2.repository.*; import org.eclipse.equinox.p2.repository.artifact.*; -import org.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository; -import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; +import org.eclipse.equinox.p2.repository.artifact.spi.*; import org.eclipse.osgi.service.datalocation.Location; import org.eclipse.osgi.util.NLS; @@ -119,7 +121,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme private long cacheTimestamp = 0l; - public class ArtifactOutputStream extends OutputStream implements IStateful { + public class ArtifactOutputStream extends OutputStream implements IStateful, IAdaptable { private boolean closed; private long count = 0; private IArtifactDescriptor descriptor; @@ -203,6 +205,14 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme public void setFirstLink(OutputStream value) { firstLink = value; } + + @Override + public <T> T getAdapter(Class<T> adapter) { + if (adapter.isInstance(descriptor)) { + return adapter.cast(descriptor); + } + return null; + } } // TODO: optimize @@ -478,6 +488,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme Set<String> skipChecksums = ARTIFACT_MD5_CHECKSUM_ENABLED ? Collections.emptySet() : Collections.singleton(ChecksumHelper.MD5); addChecksumVerifiers(descriptor, steps, skipChecksums, IArtifactDescriptor.ARTIFACT_CHECKSUM); + addPGPSignatureVerifier(descriptor, steps); if (steps.isEmpty()) return destination; @@ -486,13 +497,28 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme return handler.link(stepArray, destination, monitor); } + private void addPGPSignatureVerifier(IArtifactDescriptor descriptor, ArrayList<ProcessingStep> steps) { + if (descriptor.getProperties().containsKey(PGPSignatureVerifier.PGP_SIGNATURES_PROPERTY_NAME)) { + PGPSignatureVerifier step = new PGPSignatureVerifier(); + ProcessingStepDescriptor stepDescriptor = new ProcessingStepDescriptor(PGPSignatureVerifier.ID, null, true); + step.initialize(getProvisioningAgent(), stepDescriptor, descriptor); + steps.add(step); + } + } + private OutputStream addPreSteps(ProcessingStepHandler handler, IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { ArrayList<ProcessingStep> steps = new ArrayList<>(); if (IArtifactDescriptor.TYPE_ZIP.equals(descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE))) steps.add(new ZipVerifierStep()); Set<String> skipChecksums = DOWNLOAD_MD5_CHECKSUM_ENABLED ? Collections.emptySet() : Collections.singleton(ChecksumHelper.MD5); - addChecksumVerifiers(descriptor, steps, skipChecksums, IArtifactDescriptor.DOWNLOAD_CHECKSUM); + ArrayList<ProcessingStep> downloadChecksumSteps = new ArrayList<>(); + addChecksumVerifiers(descriptor, downloadChecksumSteps, skipChecksums, IArtifactDescriptor.DOWNLOAD_CHECKSUM); + if (downloadChecksumSteps.isEmpty() && !isLocal()) { + LogHelper.log(new Status(IStatus.WARNING, Activator.ID, + NLS.bind(Messages.noDigestAlgorithmToVerifyDownload, descriptor.getArtifactKey()))); + } + steps.addAll(downloadChecksumSteps); // Add steps here if needed if (steps.isEmpty()) @@ -504,7 +530,8 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme private void addChecksumVerifiers(IArtifactDescriptor descriptor, ArrayList<ProcessingStep> steps, Set<String> skipChecksums, String property) { if (CHECKSUMS_ENABLED) { - Collection<ProcessingStep> checksumVerifiers = ChecksumUtilities.getChecksumVerifiers(descriptor, property, skipChecksums); + Collection<ChecksumVerifier> checksumVerifiers = ChecksumUtilities.getChecksumVerifiers(descriptor, + property, skipChecksums); steps.addAll(checksumVerifiers); } } @@ -899,6 +926,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme * for compatibility with the format used in optimized update sites. We call * this arrangement "flat but packed". */ + @SuppressWarnings("removal") private boolean flatButPackedEnabled(IArtifactDescriptor descriptor) { return Boolean.TRUE.toString().equals(getProperties().get(PUBLISH_PACK_FILES_AS_SIBLINGS)) && IArtifactDescriptor.FORMAT_PACKED.equals(descriptor.getProperty(IArtifactDescriptor.FORMAT)); } @@ -1272,8 +1300,10 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme boolean found = false; IStatus[] stepStatusChildren = stepStatus.getChildren(); for (int i = 0; i < stepStatusChildren.length && !found; i++) - if (stepStatusChildren[i] == status) + if (stepStatusChildren[i] == status) { found = true; + break; + } if (!found) result.merge(status); } diff --git a/bundles/org.eclipse.equinox.p2.console/.classpath b/bundles/org.eclipse.equinox.p2.console/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.console/.classpath +++ b/bundles/org.eclipse.equinox.p2.console/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.console/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.core.prefs index 58ce6826f..71d3a6cc8 100644 --- a/bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.core.prefs @@ -19,9 +19,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -37,6 +37,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -90,6 +91,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -125,7 +127,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -139,7 +142,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -260,7 +262,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -331,7 +332,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -476,7 +476,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF index de9585ecf..5fae93979 100644 --- a/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF @@ -2,12 +2,12 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.console;singleton:=true -Bundle-Version: 1.1.500.qualifier +Bundle-Version: 1.2.0.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.console.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.equinox.internal.p2.console;x-friends:="org.eclipse.equinox.p2.director.app" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Import-Package: org.eclipse.equinox.internal.p2.core.helpers, org.eclipse.equinox.internal.provisional.p2.director, org.eclipse.equinox.p2.core;version="[2.0.0,3.0.0)", diff --git a/bundles/org.eclipse.equinox.p2.console/pom.xml b/bundles/org.eclipse.equinox.p2.console/pom.xml index 8be19a86b..6be37ac24 100644 --- a/bundles/org.eclipse.equinox.p2.console/pom.xml +++ b/bundles/org.eclipse.equinox.p2.console/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.console</artifactId> - <version>1.1.500-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.core/.classpath b/bundles/org.eclipse.equinox.p2.core/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.core/.classpath +++ b/bundles/org.eclipse.equinox.p2.core/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.core/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.core.prefs index 1466d19a2..0c53402c0 100644 --- a/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.core.prefs @@ -18,9 +18,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -36,6 +36,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -89,6 +90,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -124,7 +126,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -138,7 +141,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -259,7 +261,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -330,7 +331,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -475,7 +475,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF index 6472a2bac..73462bd3e 100644 --- a/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.core;singleton:=true -Bundle-Version: 2.6.300.qualifier +Bundle-Version: 2.9.100.qualifier Bundle-ClassPath: . Bundle-Activator: org.eclipse.equinox.internal.p2.core.Activator Bundle-Vendor: %providerName @@ -64,13 +64,17 @@ Export-Package: org.eclipse.equinox.internal.p2.core;x-friends:="org.eclipse.equ org.eclipse.equinox.p2.updatesite, org.eclipse.equinox.p2.director.app, org.eclipse.equinox.p2.transport.ecf", - org.eclipse.equinox.p2.core;version="2.0.0", - org.eclipse.equinox.p2.core.spi;version="2.1.0" -Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 + org.eclipse.equinox.p2.core;version="2.8.0";uses:="org.eclipse.core.runtime", + org.eclipse.equinox.p2.core.spi;version="2.1.0";uses:="org.eclipse.equinox.p2.core" +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/eventBus.xml, OSGI-INF/agentProvider.xml -Import-Package: org.eclipse.osgi.framework.eventmgr;version="1.2.0", +Import-Package: org.bouncycastle.bcpg;version="1.65.0", + org.bouncycastle.openpgp;version="1.65.0", + org.eclipse.core.runtime;common=split;version="[3.5.0,4.0.0)", + org.eclipse.equinox.p2.core;version="[2.8.0,2.9.0)";resolution:=optional, + org.eclipse.equinox.p2.core.spi;version="[2.1.0,2.2.0)";resolution:=optional, + org.eclipse.osgi.framework.eventmgr;version="1.2.0", org.eclipse.osgi.framework.log;version="1.0.0", org.eclipse.osgi.service.debug;version="1.0.0", org.eclipse.osgi.util;version="1.0.0", diff --git a/bundles/org.eclipse.equinox.p2.core/META-INF/p2.inf b/bundles/org.eclipse.equinox.p2.core/META-INF/p2.inf new file mode 100644 index 000000000..0983c41b7 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.core/META-INF/p2.inf @@ -0,0 +1,5 @@ +# Workaround https://bugs.eclipse.org/bugs/show_bug.cgi?id=525368 +# we hint about which bundle to download at install that is capable of +# resolving packages +requires.0.namespace = osgi.bundle +requires.0.name = org.eclipse.equinox.common
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.core/pom.xml b/bundles/org.eclipse.equinox.p2.core/pom.xml index 563e894f7..3913f722d 100644 --- a/bundles/org.eclipse.equinox.p2.core/pom.xml +++ b/bundles/org.eclipse.equinox.p2.core/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.core</artifactId> - <version>2.6.300-SNAPSHOT</version> + <version>2.9.100-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java index 6f15b035a..cb40d0a44 100644 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java +++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java @@ -70,7 +70,7 @@ public class CollectionUtils { */ @Override public ListIterator<E> listIterator() { - return new ListIterator<E>() { + return new ListIterator<>() { private int index = 0; @Override diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/FileUtils.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/FileUtils.java index f97d822e7..1c48c0742 100644 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/FileUtils.java +++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/FileUtils.java @@ -25,8 +25,7 @@ public class FileUtils { private static File[] untarFile(File source, File outputDir) throws IOException, TarException { List<File> untarredFiles = new ArrayList<>(); try (TarFile tarFile = new TarFile(source)) { - for (Enumeration<TarEntry> e = tarFile.entries(); e.hasMoreElements();) { - TarEntry entry = e.nextElement(); + for (TarEntry entry : tarFile.entries()) { try (InputStream input = tarFile.getInputStream(entry)) { File outFile = createSubPathFile(outputDir, entry.getName()); outFile = outFile.getCanonicalFile(); //bug 266844 diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/SecureXMLUtil.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/SecureXMLUtil.java index 202921c17..0afeb2936 100644 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/SecureXMLUtil.java +++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/SecureXMLUtil.java @@ -16,7 +16,6 @@ package org.eclipse.equinox.internal.p2.core.helpers; import javax.xml.XMLConstants; import javax.xml.parsers.*; import org.xml.sax.*; -import org.xml.sax.helpers.XMLReaderFactory; /** * A utility class for creating an XML-related factories suitable for @@ -52,10 +51,11 @@ public class SecureXMLUtil { * Create a new {@link XMLReader}. * * @throws SAXException + * @throws ParserConfigurationException */ - public static XMLReader newSecureXMLReader() throws SAXException { - XMLReader reader = XMLReaderFactory.createXMLReader(); - reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - return reader; + public static XMLReader newSecureXMLReader() throws SAXException, ParserConfigurationException { + SAXParserFactory factory = newSecureSAXParserFactory(); + factory.setNamespaceAware(true); + return factory.newSAXParser().getXMLReader(); } } diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/TarFile.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/TarFile.java index f53ebff02..e8ccb6cd0 100644 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/TarFile.java +++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/TarFile.java @@ -14,7 +14,8 @@ package org.eclipse.equinox.internal.p2.core.helpers; import java.io.*; -import java.util.Enumeration; +import java.util.Objects; +import java.util.stream.Stream; import java.util.zip.GZIPInputStream; /** @@ -23,9 +24,7 @@ import java.util.zip.GZIPInputStream; public class TarFile implements Closeable { private File file; private TarInputStream entryEnumerationStream; - private TarEntry curEntry; private TarInputStream entryStream; - private InputStream internalEntryStream; /** @@ -54,7 +53,6 @@ public class TarFile implements Closeable { in.close(); throw ex; } - curEntry = entryEnumerationStream.getNextEntry(); } /** @@ -74,26 +72,15 @@ public class TarFile implements Closeable { * * @return enumeration of all files in the archive */ - public Enumeration<TarEntry> entries() { - return new Enumeration<TarEntry>() { - @Override - public boolean hasMoreElements() { - return (curEntry != null); - } - - @Override - public TarEntry nextElement() { - TarEntry oldEntry = curEntry; - try { - curEntry = entryEnumerationStream.getNextEntry(); - } catch (TarException e) { - curEntry = null; - } catch (IOException e) { - curEntry = null; - } - return oldEntry; + public Iterable<TarEntry> entries() throws TarException, IOException { + TarEntry first = entryEnumerationStream.getNextEntry(); // throws if stream is empty + return Stream.iterate(first, Objects::nonNull, e -> { + try { + return entryEnumerationStream.getNextEntry(); + } catch (TarException | IOException e1) { + return null; } - }; + })::iterator; } /** diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/UIServices.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/UIServices.java index 2e6e2d97b..5be838d4b 100644 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/UIServices.java +++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/UIServices.java @@ -15,6 +15,9 @@ package org.eclipse.equinox.p2.core; import java.security.cert.Certificate; +import java.util.Collection; +import java.util.Collections; +import org.bouncycastle.openpgp.PGPPublicKey; /** * Service used for prompting for user information from within lower level code. @@ -70,15 +73,71 @@ public abstract class UIServices { } /** - * Trust information returned from a trust request. * + * Trust information returned from a trust request. */ public static class TrustInfo { private final Certificate[] trustedCertificates; + private final Collection<PGPPublicKey> trustedPGPKeys; private final boolean saveTrustedCertificates; private final boolean trustUnsigned; + private final boolean trustAlways; + /** + * + * @param trusted Trusted certificates + * @param save Whether to store trusted certificates or not + * @param trustUnsigned Whether to trust unsigned. <code>true</code> if + * installation should continue despite unsigned content; + * <code>false</code> otherwise. + * @deprecated use other constructor + */ + @Deprecated public TrustInfo(Certificate[] trusted, boolean save, boolean trustUnsigned) { this.trustedCertificates = trusted; + this.trustedPGPKeys = Collections.emptyList(); + this.saveTrustedCertificates = save; + this.trustUnsigned = trustUnsigned; + trustAlways = false; + } + + /** + * + * @param trustedCertificates Trusted certificates + * @param trustedPGPKeys Trusted PGP public keys + * @param save Whether to store trusted certificates and keys or + * not. + * @param trustUnsigned Whether to trust unsigned. <code>true</code> if + * installation should continue despite unsigned + * content; <code>false</code> otherwise. + * @since 2.8 + */ + public TrustInfo(Collection<Certificate> trustedCertificates, Collection<PGPPublicKey> trustedPGPKeys, + boolean save, + boolean trustUnsigned) { + this(trustedCertificates, trustedPGPKeys, save, trustUnsigned, false); + } + + /** + * @param trustedCertificates Trusted certificates + * @param trustedPGPKeys Trusted PGP public keys + * @param save Whether to store trusted certificates and keys or + * not. + * @param trustUnsigned Whether to trust unsigned content. + * <code>true</code> if installation should continue + * despite unsigned content; <code>false</code> + * otherwise. + * @param trustAlways Whether to always trust all content regardless of + * whether it's signed, regardless of how it's + * signed, and regardless of the certificate or key + * with which it's signed. + * + * @since 2.9 + */ + public TrustInfo(Collection<Certificate> trustedCertificates, Collection<PGPPublicKey> trustedPGPKeys, + boolean save, boolean trustUnsigned, boolean trustAlways) { + this.trustAlways = trustAlways; + this.trustedCertificates = trustedCertificates.toArray(Certificate[]::new); + this.trustedPGPKeys = trustedPGPKeys; this.saveTrustedCertificates = save; this.trustUnsigned = trustUnsigned; } @@ -95,6 +154,18 @@ public abstract class UIServices { } /** + * + * Return a collection of the keys that should be trusted for the requested + * operation. + * + * @return the trusted PGP keys. + * @since 2.8 + */ + public Collection<PGPPublicKey> getTrustedPGPKeys() { + return trustedPGPKeys; + } + + /** * Return a boolean indicating whether the trusted certificates should * be persisted for future operations. * @@ -115,6 +186,20 @@ public abstract class UIServices { public boolean trustUnsignedContent() { return trustUnsigned; } + + /** + * Return a boolean indicating whether to always trust all content regardless of + * whether it's signed, regardless of how it's signed, and regardless of the + * certificate or key with which it's signed, both during this operation and for + * all future operations. + * + * @return <code>true</code> if all content should always be trusted, and + * <code>false</code> otherwise. + * @since 2.9 + */ + public boolean trustAlways() { + return trustAlways; + } } /** @@ -138,12 +223,16 @@ public abstract class UIServices { /** * Opens a UI prompt to capture information about trusted content. * - * @param untrustedChain - an array of certificate chains for which there is no current trust anchor. May be - * <code>null</code>, which means there are no untrusted certificate chains. - * @param unsignedDetail - an array of strings, where each String describes content that is not signed. - * May be <code>null</code>, which means there is no unsigned content - * @return the TrustInfo that describes the user's choices for trusting certificates and - * unsigned content. + * @param untrustedChain - an array of certificate chains for which there is no + * current trust anchor. May be <code>null</code>, which + * means there are no untrusted certificate chains. + * @param unsignedDetail - an array of strings, where each String describes + * content that is not signed. May be <code>null</code>, + * which means there is no unsigned content + * @return the TrustInfo that describes the user's choices for trusting + * certificates and unsigned content. + * @implSpec Implementors should also override + * {@link #getTrustInfo(Certificate[][], Collection, String[])}. */ public abstract TrustInfo getTrustInfo(Certificate[][] untrustedChain, String[] unsignedDetail); @@ -160,4 +249,26 @@ public abstract class UIServices { public void showInformationMessage(String title, String text, String linkText) { System.out.println(text); } + + /** + * Opens a UI prompt to capture information about trusted content. + * + * @param unTrustedCertificateChains - an array of certificate chains for which + * there is no current trust anchor. May be + * <code>null</code>, which means there are no + * untrusted certificate chains. + * @param untrustedPGPKeys Collection of PGP signer keys that are not + * trusted + * @param unsignedDetail - an array of strings, where each String + * describes content that is not signed. May + * be <code>null</code>, which means there is + * no unsigned content + * @return the TrustInfo that describes the user's choices for trusting + * certificates and unsigned content. + * @since 2.8 + */ + public TrustInfo getTrustInfo(Certificate[][] unTrustedCertificateChains, Collection<PGPPublicKey> untrustedPGPKeys, + String[] unsignedDetail) { + return getTrustInfo(unTrustedCertificateChains, unsignedDetail); + } } diff --git a/bundles/org.eclipse.equinox.p2.director.app/.classpath b/bundles/org.eclipse.equinox.p2.director.app/.classpath index 030607499..cc48f9f27 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/.classpath +++ b/bundles/org.eclipse.equinox.p2.director.app/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" output="bin_ant" path="src_ant"/> diff --git a/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.core.prefs index 563e5c11a..c70fa9628 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -35,6 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -88,6 +89,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -123,7 +125,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -137,7 +140,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -258,7 +260,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -329,7 +330,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -474,7 +474,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF index 14a13fa91..7cbc86f19 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF @@ -2,22 +2,23 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.director.app;singleton:=true -Bundle-Version: 1.1.600.qualifier +Bundle-Version: 1.2.100.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.director.app.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.equinox.internal.p2.director.app;x-internal:=true Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy -Import-Package: org.eclipse.equinox.app, +Import-Package: org.bouncycastle.openpgp, + org.eclipse.equinox.app, org.eclipse.equinox.internal.p2.core.helpers, org.eclipse.equinox.internal.p2.director, org.eclipse.equinox.internal.p2.engine, org.eclipse.equinox.internal.provisional.p2.core.eventbus, org.eclipse.equinox.internal.provisional.p2.director, org.eclipse.equinox.internal.provisional.p2.repository, - org.eclipse.equinox.p2.core;version="[2.0.0,3.0.0)", + org.eclipse.equinox.p2.core;version="[2.8.0,3.0.0)", org.eclipse.equinox.p2.core.spi;version="[2.1.0,3.0.0)", org.eclipse.equinox.p2.engine;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.engine.query;version="[2.0.0,3.0.0)", diff --git a/bundles/org.eclipse.equinox.p2.director.app/pom.xml b/bundles/org.eclipse.equinox.p2.director.app/pom.xml index 4ec63d036..44f4bde1c 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/pom.xml +++ b/bundles/org.eclipse.equinox.p2.director.app/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.director.app</artifactId> - <version>1.1.600-SNAPSHOT</version> + <version>1.2.100-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java index d163af047..4710d4cc1 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java +++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java @@ -32,6 +32,7 @@ import java.util.*; import java.util.Map.Entry; import java.util.stream.Collectors; import java.util.stream.IntStream; +import org.bouncycastle.openpgp.PGPPublicKey; import org.eclipse.core.runtime.*; import org.eclipse.equinox.app.IApplication; import org.eclipse.equinox.app.IApplicationContext; @@ -85,6 +86,21 @@ public class DirectorApplication implements IApplication, ProvisioningListener { } return new TrustInfo(trusted, false, true); } + + @Override + public TrustInfo getTrustInfo(Certificate[][] untrustedChains, Collection<PGPPublicKey> untrustedPGPKeys, + String[] unsignedDetail) { + final Collection<Certificate> trusted; + if (untrustedChains == null) { + trusted = List.of(); + } else { + trusted = new ArrayList<>(untrustedChains.length); + for (Certificate[] untrustedChain : untrustedChains) { + trusted.add(untrustedChain[0]); + } + } + return new TrustInfo(trusted, untrustedPGPKeys, false, true); + } } class LocationQueryable implements IQueryable<IInstallableUnit> { diff --git a/bundles/org.eclipse.equinox.p2.director/.classpath b/bundles/org.eclipse.equinox.p2.director/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.director/.classpath +++ b/bundles/org.eclipse.equinox.p2.director/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.director/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.jdt.core.prefs index 3bb5d9f8c..74183576f 100644 --- a/bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -36,6 +36,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -89,6 +90,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -126,13 +128,14 @@ 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.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false org.eclipse.jdt.core.formatter.align_with_spaces=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 @@ -140,21 +143,24 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 @@ -246,11 +252,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert @@ -281,6 +288,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -305,13 +314,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert @@ -359,6 +372,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do no org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -395,9 +410,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -436,10 +454,14 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF index 3aad47093..8b2a73e25 100644 --- a/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.director;singleton:=true -Bundle-Version: 2.4.700.qualifier +Bundle-Version: 2.5.200.qualifier Bundle-ClassPath: . Bundle-Activator: org.eclipse.equinox.internal.p2.director.DirectorActivator Bundle-Vendor: %providerName @@ -27,7 +27,7 @@ Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.3.0,4.0.0)", org.eclipse.equinox.p2.metadata;bundle-version="[2.0.0,3.0.0)", org.sat4j.core;bundle-version="[2.3.5,3.0.0)", org.sat4j.pb;bundle-version="[2.3.5,3.0.0)" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/director.xml, OSGI-INF/planner.xml Import-Package: org.eclipse.equinox.internal.p2.core.helpers, diff --git a/bundles/org.eclipse.equinox.p2.director/pom.xml b/bundles/org.eclipse.equinox.p2.director/pom.xml index c7be7b327..0a32c8db0 100644 --- a/bundles/org.eclipse.equinox.p2.director/pom.xml +++ b/bundles/org.eclipse.equinox.p2.director/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.director</artifactId> - <version>2.4.700-SNAPSHOT</version> + <version>2.5.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/DirectorActivator.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/DirectorActivator.java index 7d331936f..a2960e384 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/DirectorActivator.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/DirectorActivator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 IBM Corporation and others. + * Copyright (c) 2007, 2022 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -10,24 +10,26 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Christoph Läubrich - access activator static singelton in a safe way *******************************************************************************/ package org.eclipse.equinox.internal.p2.director; +import java.util.Optional; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; public class DirectorActivator implements BundleActivator { public static final String PI_DIRECTOR = "org.eclipse.equinox.p2.director"; //$NON-NLS-1$ - public static BundleContext context; + public static volatile Optional<BundleContext> context = Optional.empty(); @Override public void start(BundleContext ctx) throws Exception { - context = ctx; + context = Optional.of(ctx); } @Override public void stop(BundleContext ctx) throws Exception { - DirectorActivator.context = null; + DirectorActivator.context = Optional.empty(); } } diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Explanation.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Explanation.java index c24960dc6..780dd229e 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Explanation.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Explanation.java @@ -89,7 +89,8 @@ public abstract class Explanation implements Comparable<Explanation> { @Override public String toString() { - return NLS.bind(Messages.Explanation_hardDependency, iu, req); + return NLS.bind(req.getMax() == 0 ? Messages.Explanation_hardDependencyNegative + : Messages.Explanation_hardDependency, iu, req); } @Override diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Messages.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Messages.java index 87e08a7ec..7a5b2c3d3 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Messages.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Messages.java @@ -43,6 +43,7 @@ public class Messages extends NLS { public static String Explanation_from; public static String Explanation_fromPatch; public static String Explanation_hardDependency; + public static String Explanation_hardDependencyNegative; public static String Explanation_patchedHardDependency; public static String Explanation_missingRequired; public static String Explanation_missingRootRequired; diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java index 1d3cc1e80..42672c6e9 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java @@ -28,7 +28,6 @@ public class OptimizationFunction { private IQueryable<IInstallableUnit> picker; private IInstallableUnit selectionContext; protected Map<String, Map<Version, IInstallableUnit>> slice; //The IUs that have been considered to be part of the problem - private int numberOfInstalledIUs; //TODO this should be renamed to consideredIUs or sliceSize private IQueryable<IInstallableUnit> lastState; private List<AbstractVariable> optionalRequirementVariable; @@ -42,7 +41,7 @@ public class OptimizationFunction { //Create an optimization function favoring the highest version of each IU public List<WeightedObject<? extends Object>> createOptimizationFunction(IInstallableUnit metaIu, Collection<IInstallableUnit> newRoots) { - numberOfInstalledIUs = sizeOf(lastState); + int numberOfInstalledIUs = sizeOf(lastState); List<WeightedObject<? extends Object>> weightedObjects = new ArrayList<>(); Set<IInstallableUnit> transitiveClosure; //The transitive closure of the IUs we are adding (this also means updating) diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java index 808c70e83..458a8fb86 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2020 IBM Corporation and others. + * Copyright (c) 2007, 2022 IBM Corporation and others. * * This * program and the accompanying materials are made available under the terms of @@ -17,6 +17,7 @@ * Sonatype, Inc. - ongoing development * Rapicorp, Inc. - split the optimization function * Red Hat, Inc. - support for remediation page + * Christoph Läubrich - access activator static singelton in a safe way ******************************************************************************/ package org.eclipse.equinox.internal.p2.director; @@ -207,7 +208,8 @@ public class Projector { // allow the user to specify a longer timeout. // only set the value if it is a positive integer larger than the default. // see https://bugs.eclipse.org/336967 - timeoutString = DirectorActivator.context.getProperty(PROP_PROJECTOR_TIMEOUT); + timeoutString = DirectorActivator.context.map(ctx -> ctx.getProperty(PROP_PROJECTOR_TIMEOUT)) + .orElse(null); if (timeoutString != null) timeout = Math.max(timeout, Integer.parseInt(timeoutString)); } catch (Exception e) { @@ -299,7 +301,7 @@ public class Projector { if (weightedObjects == null) return; if (DEBUG) { - StringBuffer b = new StringBuffer(); + StringBuilder b = new StringBuilder(); for (WeightedObject<? extends Object> object : weightedObjects) { if (b.length() > 0) b.append(", "); //$NON-NLS-1$ @@ -926,7 +928,7 @@ public class Projector { private void createAtMostOne(IInstallableUnit[] ius) throws ContradictionException { if (DEBUG) { - StringBuffer b = new StringBuffer(); + StringBuilder b = new StringBuilder(); for (IInstallableUnit iu : ius) { b.append(iu.toString()); } diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/messages.properties b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/messages.properties index 1aba20a2e..17fb47c7a 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/messages.properties +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/messages.properties @@ -28,6 +28,7 @@ Explanation_alreadyInstalled=Software currently installed: {0} Explanation_from=From: {0} Explanation_fromPatch=From Patch: {0} Explanation_hardDependency=Cannot satisfy dependency: {0} depends on: {1} +Explanation_hardDependencyNegative=Cannot satisfy dependency: {0} conflicts with: {1} Explanation_patchedHardDependency=Cannot satisfy patched ({0}) dependency: {1} depends on: {2} Explanation_missingRequired=Missing requirement: {0} requires ''{1}'' but it could not be found Explanation_missingRootRequired=You requested to install ''{0}'' but it could not be found diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/PlanExecutionHelper.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/PlanExecutionHelper.java index 4c51ca1a9..83ac500b7 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/PlanExecutionHelper.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/PlanExecutionHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 IBM Corporation and others. + * Copyright (c) 2009, 2022 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -11,6 +11,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Red Hat Inc. - Bug 460967 + * Christoph Läubrich - access activator static singelton in a safe way *******************************************************************************/ package org.eclipse.equinox.internal.provisional.p2.director; @@ -36,7 +37,8 @@ public class PlanExecutionHelper { .getService(IEngine.class).perform(result.getInstallerPlan(), phaseSet, progress); if (!installerPlanStatus.isOK()) return installerPlanStatus; - Configurator configChanger = ServiceHelper.getService(DirectorActivator.context, Configurator.class); + Configurator configChanger = DirectorActivator.context + .map(ctx -> ServiceHelper.getService(ctx, Configurator.class)).orElse(null); try { configChanger.applyConfiguration(); } catch (IOException e) { diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/.classpath b/bundles/org.eclipse.equinox.p2.directorywatcher/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.directorywatcher/.classpath +++ b/bundles/org.eclipse.equinox.p2.directorywatcher/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.directorywatcher/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs index 4e79b56c0..26df1a4b1 100644 --- a/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs @@ -16,9 +16,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -35,6 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -88,6 +89,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -124,7 +126,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -138,7 +141,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -259,7 +261,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -330,7 +331,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -475,7 +475,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF index 559c6bfae..a91060a0f 100644 --- a/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF @@ -2,12 +2,12 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.directorywatcher;singleton:=true -Bundle-Version: 1.2.500.qualifier +Bundle-Version: 1.3.0.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.equinox.internal.provisional.p2.directorywatcher;x-friends:="org.eclipse.equinox.p2.reconciler.dropins,org.eclipse.equinox.p2.extensionlocation" Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.7.0,4.0)" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.equinox.internal.p2.artifact.repository.simple, org.eclipse.equinox.internal.p2.core.helpers, diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/pom.xml b/bundles/org.eclipse.equinox.p2.directorywatcher/pom.xml index e8daec668..ece589593 100644 --- a/bundles/org.eclipse.equinox.p2.directorywatcher/pom.xml +++ b/bundles/org.eclipse.equinox.p2.directorywatcher/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.directorywatcher</artifactId> - <version>1.2.500-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/.classpath b/bundles/org.eclipse.equinox.p2.discovery.compatibility/.classpath index eca7bdba8..e801ebfb4 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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.discovery.compatibility/META-INF/MANIFEST.MF index 337507969..fbfa7e023 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,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.equinox.p2.discovery.compatibility;singleton:=true -Bundle-Version: 1.2.0.qualifier +Bundle-Version: 1.2.200.qualifier Bundle-Vendor: %Bundle-Vendor Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.core.runtime;bundle-version="3.3.0", diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/pom.xml b/bundles/org.eclipse.equinox.p2.discovery.compatibility/pom.xml index d5b01a30c..b926dd577 100644 --- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/pom.xml +++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/pom.xml @@ -14,11 +14,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.discovery.compatibility</artifactId> - <version>1.2.0-SNAPSHOT</version> + <version>1.2.200-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/DirectoryParser.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DirectoryParser.java index 97a21448c..9cbb8d0a3 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 @@ -16,6 +16,7 @@ package org.eclipse.equinox.internal.p2.discovery.compatibility; import java.io.IOException; import java.io.Reader; +import javax.xml.parsers.ParserConfigurationException; import org.eclipse.equinox.internal.p2.core.helpers.SecureXMLUtil; import org.eclipse.equinox.internal.p2.discovery.compatibility.Directory.Entry; import org.eclipse.equinox.internal.p2.discovery.compatibility.util.DefaultSaxErrorHandler; @@ -42,7 +43,7 @@ public class DirectoryParser { XMLReader xmlReader; try { xmlReader = SecureXMLUtil.newSecureXMLReader(); - } catch (SAXException e) { + } catch (SAXException | ParserConfigurationException e) { throw new IOWithCauseException(e.getMessage(), e); } xmlReader.setErrorHandler(new DefaultSaxErrorHandler()); diff --git a/bundles/org.eclipse.equinox.p2.discovery/.classpath b/bundles/org.eclipse.equinox.p2.discovery/.classpath index 5f1595b77..f57eddd9b 100644 --- a/bundles/org.eclipse.equinox.p2.discovery/.classpath +++ b/bundles/org.eclipse.equinox.p2.discovery/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> <accessrules> <accessrule kind="accessible" pattern="org/eclipse/equinox/internal/p2/core/**"/> diff --git a/bundles/org.eclipse.equinox.p2.discovery/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.discovery/.settings/org.eclipse.jdt.core.prefs index c7bd22b57..456e7b09f 100644 --- a/bundles/org.eclipse.equinox.p2.discovery/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.discovery/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -35,6 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -88,6 +89,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -123,7 +125,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -137,7 +140,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -258,7 +260,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -329,7 +330,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -474,7 +474,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.discovery/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.discovery/META-INF/MANIFEST.MF index 2e89a36de..3ed751bd4 100644 --- a/bundles/org.eclipse.equinox.p2.discovery/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.discovery/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;singleton:=true -Bundle-Version: 1.1.200.qualifier +Bundle-Version: 1.2.0.qualifier Bundle-Vendor: %Bundle-Vendor -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.core.runtime;bundle-version="3.3.0", org.eclipse.equinox.p2.core;bundle-version="2.0.0" Export-Package: org.eclipse.equinox.internal.p2.discovery;x-friends:="org.eclipse.equinox.p2.discovery.compatibility,org.eclipse.equinox.p2.ui.discovery,org.eclipse.equinox.p2.discovery.repository", diff --git a/bundles/org.eclipse.equinox.p2.discovery/pom.xml b/bundles/org.eclipse.equinox.p2.discovery/pom.xml index 6a0643302..08c1a9a53 100644 --- a/bundles/org.eclipse.equinox.p2.discovery/pom.xml +++ b/bundles/org.eclipse.equinox.p2.discovery/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.discovery</artifactId> - <version>1.1.200-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.engine/.classpath b/bundles/org.eclipse.equinox.p2.engine/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.engine/.classpath +++ b/bundles/org.eclipse.equinox.p2.engine/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.engine/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.jdt.core.prefs index 1d2db97da..ae545cfe9 100644 --- a/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -35,6 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -88,6 +89,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -123,7 +125,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -137,7 +140,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -258,7 +260,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -329,7 +330,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -474,7 +474,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF index 5bd54376a..561283093 100644 --- a/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.engine;singleton:=true -Bundle-Version: 2.6.700.qualifier +Bundle-Version: 2.7.300.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.engine.EngineActivator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -14,7 +14,7 @@ Export-Package: org.eclipse.equinox.internal.p2.engine; org.eclipse.equinox.p2.ui.sdk.scheduler, org.eclipse.pde.build, org.eclipse.equinox.p2.director.app", - org.eclipse.equinox.internal.p2.engine.phases;x-friends:="org.eclipse.equinox.p2.director.app,org.eclipse.equinox.p2.repository.tools,org.eclipse.equinox.p2.ui.sdk.scheduler", + org.eclipse.equinox.internal.p2.engine.phases;x-friends:="org.eclipse.equinox.p2.director.app,org.eclipse.equinox.p2.repository.tools,org.eclipse.equinox.p2.ui.sdk,org.eclipse.equinox.p2.ui.sdk.scheduler,org.eclipse.equinox.p2.touchpoint.eclipse", org.eclipse.equinox.p2.engine;version="2.2.0", org.eclipse.equinox.p2.engine.query;version="2.0.0", org.eclipse.equinox.p2.engine.spi;version="2.0.0" @@ -22,12 +22,14 @@ Require-Bundle: org.eclipse.equinox.common, org.eclipse.equinox.registry, org.eclipse.core.jobs;bundle-version="[3.4.0,4.0.0)" Eclipse-RegisterBuddy: org.eclipse.equinox.p2.metadata.repository -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/profileRegistry.xml, OSGI-INF/engine.xml Import-Package: javax.xml.parsers, + org.bouncycastle.openpgp;version="1.65.0", org.eclipse.core.internal.preferences, org.eclipse.core.runtime.preferences, + org.eclipse.equinox.internal.p2.artifact.processors.pgp, org.eclipse.equinox.internal.p2.core.helpers, org.eclipse.equinox.internal.p2.metadata, org.eclipse.equinox.internal.p2.metadata.index, @@ -44,9 +46,10 @@ Import-Package: javax.xml.parsers, org.eclipse.equinox.p2.query;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.repository;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.repository.artifact;version="[2.0.0,3.0.0)", + org.eclipse.equinox.p2.repository.artifact.spi;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.repository.metadata;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.repository.metadata.spi;version="[2.0.0,3.0.0)", - org.eclipse.equinox.p2.repository.spi;version="2.0.0", + org.eclipse.equinox.p2.repository.spi;version="[2.0.0,3.0.0)", org.eclipse.osgi.service.datalocation;version="1.0.0", org.eclipse.osgi.service.debug;version="1.1.0", org.eclipse.osgi.service.security;version="1.0.0", diff --git a/bundles/org.eclipse.equinox.p2.engine/plugin.xml b/bundles/org.eclipse.equinox.p2.engine/plugin.xml index 3d469f492..cee2c3856 100644 --- a/bundles/org.eclipse.equinox.p2.engine/plugin.xml +++ b/bundles/org.eclipse.equinox.p2.engine/plugin.xml @@ -4,6 +4,7 @@ <extension-point id="touchpoints" name="Touchpoints" schema="schema/touchpoints.exsd"/> <extension-point id="actions" name="Actions" schema="schema/actions.exsd"/> +<extension-point id="pgp" name="PGP" schema="schema/pgp.exsd"/> <extension id="metadataRepository" point="org.eclipse.equinox.p2.metadata.repository.metadataRepositories"> diff --git a/bundles/org.eclipse.equinox.p2.engine/pom.xml b/bundles/org.eclipse.equinox.p2.engine/pom.xml index 5a8bdf177..eb9562492 100644 --- a/bundles/org.eclipse.equinox.p2.engine/pom.xml +++ b/bundles/org.eclipse.equinox.p2.engine/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.engine</artifactId> - <version>2.6.700-SNAPSHOT</version> + <version>2.7.300-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.engine/schema/pgp.exsd b/bundles/org.eclipse.equinox.p2.engine/schema/pgp.exsd new file mode 100644 index 000000000..fcb06d04a --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.engine/schema/pgp.exsd @@ -0,0 +1,107 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.eclipse.equinox.p2.engine" xmlns="http://www.w3.org/2001/XMLSchema"> +<annotation> + <appInfo> + <meta.schema plugin="org.eclipse.equinox.p2.engine" id="pgp" name="PGP"/> + </appInfo> + <documentation> + Configure PGP keys and trust for p2 operations + </documentation> + </annotation> + + <element name="extension"> + <annotation> + <appInfo> + <meta.element /> + </appInfo> + </annotation> + <complexType> + <sequence minOccurs="0" maxOccurs="unbounded"> + <element ref="trustedKeys"/> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="name" type="string"> + <annotation> + <documentation> + + </documentation> + <appInfo> + <meta.attribute translatable="true"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <element name="trustedKeys"> + <annotation> + <documentation> + PGP Keys that are trusted by default. + </documentation> + </annotation> + <complexType> + <attribute name="path" type="string"> + <annotation> + <documentation> + Path to a file containing PGP keys in armored form. + </documentation> + <appInfo> + <meta.attribute kind="resource"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appInfo> + <meta.section type="since"/> + </appInfo> + <documentation> + 2.7.300 + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="examples"/> + </appInfo> + <documentation> + [Enter extension point usage example here.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="apiinfo"/> + </appInfo> + <documentation> + [Enter API information here.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="implementation"/> + </appInfo> + <documentation> + [Enter information about supplied implementation of this extension point.] + </documentation> + </annotation> + + +</schema> diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java index cc923859b..b67af3ad9 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java @@ -35,7 +35,7 @@ public class DownloadManager { * TODO: This is copied from the ProvisioningContext class. Can we combine them? * See https://bugs.eclipse.org/335153. */ - private static final Comparator<IArtifactRepository> LOCAL_FIRST_COMPARATOR = new Comparator<IArtifactRepository>() { + private static final Comparator<IArtifactRepository> LOCAL_FIRST_COMPARATOR = new Comparator<>() { private static final String FILE_PROTOCOL = "file"; //$NON-NLS-1$ @Override diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitOperand.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitOperand.java index 6fea6e340..8b91ed338 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitOperand.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitOperand.java @@ -27,7 +27,7 @@ public class InstallableUnitOperand extends Operand { * Creates a new operand that represents replacing an installable unit * with another. At least one of the provided installable units must be * non-null. - * + * * @param first The installable unit being removed, or <code>null</code> * @param second The installable unit being added, or <code>null</code> */ @@ -38,10 +38,17 @@ public class InstallableUnitOperand extends Operand { this.second = second; } + /** + * + * @return The installable unit being removed, or <code>null</code> + */ public IInstallableUnit first() { return first; } + /** + * @return The installable unit being added, or <code>null</code> + */ public IInstallableUnit second() { return second; } diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java index f551eb287..e7dab0b35 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java @@ -8,11 +8,11 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * IBM Corporation - initial API and implementation * Cloudsmith Inc. - query indexes - * + * ******************************************************************************/ package org.eclipse.equinox.internal.p2.engine; @@ -407,6 +407,6 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile */ @Override public String toString() { - return "Profile(" + getProfileId() + ')'; //$NON-NLS-1$ + return "Profile(" + getProfileId() + ", timestamp: " + getTimestamp() + ')'; //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java index ef16bf4f9..f016c9408 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java @@ -56,6 +56,8 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService { //Internal constant used to keep track of the newly created timestamp private static final String SERVICE_SHARED_INSTALL_NEW_TIMESTAMP = IProfileRegistry.class.getName() + '_' + "NEW_SELF_TIMESTAMP"; //$NON-NLS-1$ + private static long lastTimeMillis = System.currentTimeMillis(); + protected final IProvisioningAgent agent; /** @@ -489,7 +491,8 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService { if (profiles != null) { IProfile profile = getProfile(id); if (profile != null && profile.getTimestamp() == timestamp) - throw new ProvisionException(Messages.SimpleProfileRegistry_CannotRemoveCurrentSnapshot); + throw new ProvisionException( + NLS.bind(Messages.SimpleProfileRegistry_CannotRemoveCurrentSnapshot, profile)); } File profileDirectory = getProfileFolder(id); @@ -527,6 +530,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService { // protect against NPE if (profileDirectories == null) { parser.getProfileMap(); + return Collections.emptyMap(); } for (File profileDirectorie : profileDirectories) { String directoryName = profileDirectorie.getName(); @@ -587,9 +591,10 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService { profileDirectory.mkdir(); long previousTimestamp = profile.getTimestamp(); - long currentTimestamp = System.currentTimeMillis(); - if (currentTimestamp <= previousTimestamp) - currentTimestamp = previousTimestamp + 1; + long currentTimestamp = currentTimeInMillis(lastTimeMillis); + if (currentTimestamp <= previousTimestamp) { + currentTimestamp = currentTimeInMillis(previousTimestamp); + } boolean shouldGzipFile = shouldGzipFile(profile); File profileFile = new File(profileDirectory, Long.toString(currentTimestamp) + (shouldGzipFile ? PROFILE_GZ_EXT : PROFILE_EXT)); @@ -621,6 +626,16 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService { } } + /** + * Returns current time in millis that is guaranteed to grow and higher as given + * value + */ + private static synchronized long currentTimeInMillis(long lastCurrentTime) { + long newTime = Math.max(lastCurrentTime + 1, lastTimeMillis + 1); + lastTimeMillis = Math.max(newTime, System.currentTimeMillis()); + return lastTimeMillis; + } + public void setEventBus(IProvisioningEventBus bus) { this.eventBus = bus; } @@ -890,7 +905,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService { return false; } - long currentTimestamp = (timestamps.length == 0) ? -1 : timestamps[timestamps.length - 1]; + long currentTimestamp = timestamps[timestamps.length - 1]; if (profile.getTimestamp() != currentTimestamp) { if (DebugHelper.DEBUG_PROFILE_REGISTRY) DebugHelper.debug(PROFILE_REGISTRY, "check timestamp: expected " + profile.getTimestamp() + " but was " + currentTimestamp); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/messages.properties b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/messages.properties index 6bbfb785f..615e06d27 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/messages.properties +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/messages.properties @@ -43,7 +43,7 @@ SimpleProfileRegistry_Profile_in_use=The profile is currently in use. SimpleProfileRegistry_Profile_not_locked=The profile is not locked. SimpleProfileRegistry_Profile_not_locked_due_to_exception=Profile not locked due to exception: {0} SimpleProfileRegistry_Bad_profile_location=Bad profile location: {0} -SimpleProfileRegistry_CannotRemoveCurrentSnapshot=Cannot remove the current profile timestamp +SimpleProfileRegistry_CannotRemoveCurrentSnapshot=Cannot remove current profile: {0} SimpleProfileRegistry_States_Error_Reading_File=Error reading profile state properties. SimpleProfileRegistry_States_Error_Writing_File=Error writing profile state properties. SimpleProfileRegistry_state_not_found=State {0} for profile {1} not found. diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java index 7e1e729a8..3a1589f8b 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java @@ -13,33 +13,88 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.engine.phases; -import java.io.File; -import java.io.IOException; +import java.io.*; +import java.net.URL; +import java.nio.ByteBuffer; import java.security.GeneralSecurityException; -import java.security.cert.Certificate; +import java.security.cert.*; import java.util.*; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; +import java.util.Map.Entry; +import java.util.function.Supplier; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.bouncycastle.openpgp.PGPPublicKey; +import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.equinox.internal.p2.artifact.processors.pgp.PGPPublicKeyStore; +import org.eclipse.equinox.internal.p2.artifact.processors.pgp.PGPSignatureVerifier; import org.eclipse.equinox.internal.p2.engine.*; -import org.eclipse.equinox.p2.core.IProvisioningAgent; -import org.eclipse.equinox.p2.core.UIServices; +import org.eclipse.equinox.p2.core.*; import org.eclipse.equinox.p2.core.UIServices.TrustInfo; +import org.eclipse.equinox.p2.engine.IProfile; +import org.eclipse.equinox.p2.engine.ProfileScope; +import org.eclipse.equinox.p2.metadata.IArtifactKey; +import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; +import org.eclipse.equinox.p2.repository.artifact.spi.IArtifactUIServices; +import org.eclipse.equinox.p2.repository.spi.PGPPublicKeyService; import org.eclipse.osgi.service.security.TrustEngine; import org.eclipse.osgi.signedcontent.*; import org.eclipse.osgi.util.NLS; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; +import org.osgi.framework.*; +import org.osgi.service.prefs.BackingStoreException; import org.osgi.util.tracker.ServiceTracker; /** - * Checks the certificates on a set of files or artifacts and reports back any problems - * with unsigned artifacts, untrusted certificates, or tampered content. + * Checks the certificates or PGP signatures on a set of files or artifacts and + * reports back any problems with unsigned artifacts, untrusted certificates, or + * tampered content. */ public class CertificateChecker { private static final String DEBUG_PREFIX = "certificate checker"; //$NON-NLS-1$ - private ArrayList<File> artifacts; + public static final String TRUST_ALWAYS_PROPERTY = "trustAlways"; //$NON-NLS-1$ + + public static final String TRUSTED_KEY_STORE_PROPERTY = "pgp.trustedPublicKeys"; //$NON-NLS-1$ + + public static final String TRUSTED_CERTIFICATES_PROPERTY = "trustedCertificates"; //$NON-NLS-1$ + + /*** + * Store the optional profile for PGP key handling + */ + private IProfile profile; + + /** + * Stores artifacts to check + */ + private Map<IArtifactDescriptor, File> artifacts = new HashMap<>(); private final IProvisioningAgent agent; + private final PGPPublicKeyService keyService; + + // Lazily loading + private Supplier<PGPPublicKeyStore> trustedKeys = new Supplier<>() { + private PGPPublicKeyStore cache = null; + + public PGPPublicKeyStore get() { + if (cache == null) { + cache = getPreferenceTrustedKeys(); + getContributedTrustedKeys().keySet().forEach(cache::addKey); + } + return cache; + } + }; + + // Lazily loading in case we ever add an extension point for registering + // certificates. + private Supplier<Collection<? extends Certificate>> additionalTrustedCertificates = new Supplier<>() { + private Collection<? extends Certificate> cache = null; + + public Collection<? extends Certificate> get() { + if (cache == null) { + cache = getPreferenceTrustedCertificates(); + } + return cache; + } + }; public CertificateChecker() { this(null); @@ -47,12 +102,15 @@ public class CertificateChecker { public CertificateChecker(IProvisioningAgent agent) { this.agent = agent; - artifacts = new ArrayList<>(); + artifacts = new HashMap<>(); + keyService = agent.getService(PGPPublicKeyService.class); + } public IStatus start() { final BundleContext context = EngineActivator.getContext(); - ServiceReference<SignedContentFactory> contentFactoryRef = context.getServiceReference(SignedContentFactory.class); + ServiceReference<SignedContentFactory> contentFactoryRef = context + .getServiceReference(SignedContentFactory.class); SignedContentFactory verifierFactory = context.getService(contentFactoryRef); try { return checkCertificates(verifierFactory); @@ -62,159 +120,257 @@ public class CertificateChecker { } private IStatus checkCertificates(SignedContentFactory verifierFactory) { + if (artifacts.isEmpty()) { + return Status.OK_STATUS; + } + + // If unsigned content is allowed then the flood gates are open so there is no + // point in checking for unrooted certificates nor for not-yet-trusted keys. + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=578583 + String policy = getUnsignedContentPolicy(); + if (EngineActivator.UNSIGNED_ALLOW.equals(policy)) { + return Status.OK_STATUS; + } + UIServices serviceUI = agent.getService(UIServices.class); - SignedContent content = null; - SignerInfo[] signerInfo = null; - ArrayList<Certificate> untrusted = new ArrayList<>(); - ArrayList<File> unsigned = new ArrayList<>(); - ArrayList<Certificate[]> untrustedChain = new ArrayList<>(); - Map<Certificate, Collection<File>> untrustedArtifacts = new HashMap<>(); - IStatus status = Status.OK_STATUS; - if (artifacts.size() == 0 || serviceUI == null) - return status; - checkArtifacts: for (File artifact : artifacts) { - try { - content = verifierFactory.getSignedContent(artifact); - if (!content.isSigned()) { - unsigned.add(artifact); - continue; - } - signerInfo = content.getSignerInfos(); - } catch (GeneralSecurityException e) { - return new Status(IStatus.ERROR, EngineActivator.ID, Messages.CertificateChecker_SignedContentError, e); - } catch (IOException e) { - return new Status(IStatus.ERROR, EngineActivator.ID, Messages.CertificateChecker_SignedContentIOError, e); - } + if (serviceUI == null) { + return Status.OK_STATUS; + } - // Determine if any element is trusted. - for (SignerInfo element : signerInfo) { - if (element.isTrusted()) { - continue checkArtifacts; - } - } + if (isTrustAlways()) { + return Status.OK_STATUS; + } - // Only record the untrusted elements if there are no trusted elements. - for (SignerInfo element : signerInfo) { - if (!element.isTrusted()) { - Certificate[] certificateChain = element.getCertificateChain(); - if (!untrusted.contains(certificateChain[0])) { - untrusted.add(certificateChain[0]); - untrustedChain.add(certificateChain); + IArtifactUIServices artifactServiceUI = serviceUI instanceof IArtifactUIServices + ? (IArtifactUIServices) serviceUI + : (untrustedCertificateChains, untrustedPGPKeys, unsignedArtifacts, + artifactFiles) -> IArtifactUIServices.getTrustInfo(serviceUI, untrustedCertificateChains, + untrustedPGPKeys, unsignedArtifacts, artifactFiles); + + Map<List<Certificate>, Set<IArtifactKey>> untrustedCertificates = new LinkedHashMap<>(); + Map<PGPPublicKey, Set<IArtifactKey>> untrustedPGPKeys = new LinkedHashMap<>(); + Set<IArtifactKey> unsignedArtifacts = new LinkedHashSet<>(); + Set<PGPPublicKey> trustedKeySet = new HashSet<>(); + boolean isTrustedKeySetInitialized = false; + Map<IArtifactKey, File> artifactFiles = new LinkedHashMap<>(); + for (Entry<IArtifactDescriptor, File> artifact : artifacts.entrySet()) { + IArtifactDescriptor artifactDescriptor = artifact.getKey(); + IArtifactKey artifactKey = artifactDescriptor.getArtifactKey(); + File artifactFile = artifact.getValue(); + artifactFiles.put(artifactKey, artifactFile); + try { + SignedContent content = verifierFactory.getSignedContent(artifactFile); + if (content.isSigned()) { + SignerInfo[] signerInfo = content.getSignerInfos(); + // Only record the untrusted elements if there are no trusted elements. + // Also check previously trusted certificates from the preferences. + if (Arrays.stream(signerInfo).noneMatch(SignerInfo::isTrusted) + && Arrays.stream(signerInfo).map(SignerInfo::getCertificateChain).flatMap(Arrays::stream) + .noneMatch(cert -> additionalTrustedCertificates.get().contains(cert))) { + for (SignerInfo element : signerInfo) { + if (!element.isTrusted()) { + List<Certificate> certificateChain = Arrays.asList(element.getCertificateChain()); + untrustedCertificates.computeIfAbsent(certificateChain, key -> new LinkedHashSet<>()) + .add(artifactKey); + } + } } - if (DebugHelper.DEBUG_CERTIFICATE_CHECKER_UNTRUSTED) { - if (untrustedArtifacts.containsKey(certificateChain[0])) { - untrustedArtifacts.get(certificateChain[0]).add(artifact); - } else { - untrustedArtifacts.put(certificateChain[0], new ArrayList<>(Arrays.asList(artifact))); + } else { + // The keys are in this destination artifact's properties if and only if the + // PGPSignatureVerifier verified the signatures against these keys. + List<PGPPublicKey> verifiedKeys = PGPPublicKeyStore + .readPublicKeys( + artifactDescriptor.getProperty(PGPSignatureVerifier.PGP_SIGNER_KEYS_PROPERTY_NAME)) + .stream().map(keyService::addKey).collect(Collectors.toList()); + if (!verifiedKeys.isEmpty()) { + if (!isTrustedKeySetInitialized) { + isTrustedKeySetInitialized = true; + trustedKeySet.addAll(trustedKeys.get().all()); } + // Only record the untrusted keys if none of the keys are trusted. + if (verifiedKeys.stream().noneMatch(trustedKeySet::contains)) { + verifiedKeys.forEach(key -> untrustedPGPKeys + .computeIfAbsent(key, k -> new LinkedHashSet<>()).add(artifactKey)); + } + } else { + unsignedArtifacts.add(artifactKey); } } + } catch (GeneralSecurityException e) { + return new Status(IStatus.ERROR, EngineActivator.ID, Messages.CertificateChecker_SignedContentError, e); + } catch (IOException e) { + return new Status(IStatus.ERROR, EngineActivator.ID, Messages.CertificateChecker_SignedContentIOError, + e); } } // log the unsigned artifacts if requested - if (DebugHelper.DEBUG_CERTIFICATE_CHECKER_UNSIGNED && !unsigned.isEmpty()) { + if (DebugHelper.DEBUG_CERTIFICATE_CHECKER_UNSIGNED && !unsignedArtifacts.isEmpty()) { StringBuilder message = new StringBuilder("The following artifacts are unsigned:\n"); //$NON-NLS-1$ - for (File file : unsigned) { - message.append(NLS.bind(" {0}\n", file.getPath())); //$NON-NLS-1$ + for (IArtifactKey key : unsignedArtifacts) { + message.append(NLS.bind(" {0}\n", artifactFiles.get(key).getPath())); //$NON-NLS-1$ } DebugHelper.debug(DEBUG_PREFIX, message.toString()); } // log the untrusted certificates if requested - if (DebugHelper.DEBUG_CERTIFICATE_CHECKER_UNTRUSTED && !untrusted.isEmpty()) { + if (DebugHelper.DEBUG_CERTIFICATE_CHECKER_UNTRUSTED && !untrustedCertificates.isEmpty()) { StringBuilder message = new StringBuilder("The following certificates are untrusted:\n"); //$NON-NLS-1$ - for (Certificate cert : untrustedArtifacts.keySet()) { - message.append(cert.toString() + "\n"); //$NON-NLS-1$ + for (Map.Entry<List<Certificate>, Set<IArtifactKey>> entry : untrustedCertificates.entrySet()) { + message.append(entry.getKey().get(0).toString() + "\n"); //$NON-NLS-1$ message.append(" used by the following artifacts:\n"); //$NON-NLS-1$ - for (File file : untrustedArtifacts.get(cert)) { - message.append(NLS.bind(" {0}\n", file.getPath())); //$NON-NLS-1$ + for (IArtifactKey key : entry.getValue()) { + message.append(NLS.bind(" {0}\n", artifactFiles.get(key).getPath())); //$NON-NLS-1$ } + } DebugHelper.debug(DEBUG_PREFIX, message.toString()); } - String policy = getUnsignedContentPolicy(); - //if there is unsigned content and we should never allow it, then fail without further checking certificates - if (!unsigned.isEmpty() && EngineActivator.UNSIGNED_FAIL.equals(policy)) - return new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.CertificateChecker_UnsignedNotAllowed, unsigned)); - - String[] details; - // If we always allow unsigned content, or we don't have any, we don't prompt the user about it - if (EngineActivator.UNSIGNED_ALLOW.equals(policy) || unsigned.isEmpty()) - details = null; - else { - details = new String[unsigned.size()]; - for (int i = 0; i < details.length; i++) { - details[i] = unsigned.get(i).toString(); + if (DebugHelper.DEBUG_CERTIFICATE_CHECKER_UNTRUSTED && !untrustedPGPKeys.isEmpty()) { + StringBuilder message = new StringBuilder("The following PGP Keys are untrusted:\n"); //$NON-NLS-1$ + for (Map.Entry<PGPPublicKey, Set<IArtifactKey>> entry : untrustedPGPKeys.entrySet()) { + message.append(Long.toHexString(entry.getKey().getKeyID()) + "\n"); //$NON-NLS-1$ + message.append(" used by the following artifacts:\n"); //$NON-NLS-1$ + for (IArtifactKey key : entry.getValue()) { + message.append(NLS.bind(" {0}\n", key)); //$NON-NLS-1$ + } } + DebugHelper.debug(DEBUG_PREFIX, message.toString()); } - Certificate[][] unTrustedCertificateChains; - if (untrusted.isEmpty()) { - unTrustedCertificateChains = null; - } else { - unTrustedCertificateChains = new Certificate[untrustedChain.size()][]; - for (int i = 0; i < untrustedChain.size(); i++) { - unTrustedCertificateChains[i] = untrustedChain.get(i); - } + + // if there is unsigned content and we should never allow it, then fail without + // further checking certificates + if (!unsignedArtifacts.isEmpty() && EngineActivator.UNSIGNED_FAIL.equals(policy)) { + return new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind( + Messages.CertificateChecker_UnsignedNotAllowed, + unsignedArtifacts.stream().map(key -> artifactFiles.get(key)).collect(Collectors.toList()))); } // If there was no unsigned content, and nothing untrusted, no need to prompt. - if (details == null && unTrustedCertificateChains == null) - return status; + if (unsignedArtifacts.isEmpty() && untrustedCertificates.isEmpty() && untrustedPGPKeys.isEmpty()) { + return Status.OK_STATUS; + } - TrustInfo trustInfo = serviceUI.getTrustInfo(unTrustedCertificateChains, details); + TrustInfo trustInfo = artifactServiceUI.getTrustInfo(untrustedCertificates, untrustedPGPKeys, unsignedArtifacts, + artifactFiles); - // If user doesn't trust unsigned content, cancel the operation - if (!trustInfo.trustUnsignedContent()) - return Status.CANCEL_STATUS; + setTrustAlways(trustInfo.trustAlways()); - Certificate[] trustedCertificates = trustInfo.getTrustedCertificates(); - // If we had untrusted chains and nothing was trusted, cancel the operation - if (unTrustedCertificateChains != null && trustedCertificates == null) { - return new Status(IStatus.CANCEL, EngineActivator.ID, Messages.CertificateChecker_CertificateRejected); - } - // Anything that was trusted should be removed from the untrusted list - if (trustedCertificates != null) { - for (Certificate trustedCertificate : trustedCertificates) { - untrusted.remove(trustedCertificate); + if (!trustInfo.trustAlways()) { + // If there is unsigned content and user doesn't trust unsigned content, cancel + // the operation. + if (!unsignedArtifacts.isEmpty() && !trustInfo.trustUnsignedContent()) { + return Status.CANCEL_STATUS; + } + + Certificate[] trustedCertificates = trustInfo.getTrustedCertificates(); + // If we had untrusted chains and nothing was trusted, cancel the operation + if (!untrustedCertificates.isEmpty() && trustedCertificates == null) { + return new Status(IStatus.CANCEL, EngineActivator.ID, Messages.CertificateChecker_CertificateRejected); + } + + // Anything that was trusted should be removed from the untrusted list + if (trustedCertificates != null) { + List<Certificate> trustedCertificateList = Arrays.asList(trustedCertificates); + untrustedCertificates.keySet().removeIf(it -> trustedCertificateList.contains(it.get(0))); + } + + trustedKeySet.addAll(trustInfo.getTrustedPGPKeys()); + + Set<IArtifactKey> trustedArtifactKeys = trustedKeySet.stream().map(untrustedPGPKeys::get) + .filter(Objects::nonNull).flatMap(Set::stream).collect(Collectors.toSet()); + untrustedPGPKeys.values().forEach(it -> it.removeAll(trustedArtifactKeys)); + untrustedPGPKeys.values().removeIf(Collection::isEmpty); + + // If there is still untrusted content, cancel the operation + if (!untrustedCertificates.isEmpty() || !untrustedPGPKeys.isEmpty()) { + return new Status(IStatus.CANCEL, EngineActivator.ID, Messages.CertificateChecker_CertificateRejected); } } - // If there is still untrusted content, cancel the operation - if (untrusted.size() > 0) - return new Status(IStatus.CANCEL, EngineActivator.ID, Messages.CertificateChecker_CertificateRejected); - // If we should persist the trusted certificates, add them to the trust engine - if (trustInfo.persistTrust()) - return persistTrustedCertificates(trustedCertificates); + // If we should persist the trusted certificates and keys. + if (trustInfo.persistTrust()) { + List<IStatus> statuses = new ArrayList<>(); + + Set<Certificate> unsavedCertificates = new LinkedHashSet<>(); + if (trustInfo.getTrustedCertificates() != null) { + unsavedCertificates.addAll(Arrays.asList(trustInfo.getTrustedCertificates())); + } + + if (!unsavedCertificates.isEmpty()) { + // Try to save to the trust engine first. + IStatus status = persistTrustedCertificatesInTrustEngine(unsavedCertificates); + if (status != null && !status.isOK()) { + statuses.add(status); + } + + // If we couldn't save them in the trust engine, save them in the preferences. + if (!unsavedCertificates.isEmpty()) { + // Be sure we add the new certificates to the previously saved certificates. + unsavedCertificates.addAll(getPreferenceTrustedCertificates()); + IStatus preferenceStatus = persistTrustedCertificates(unsavedCertificates); + if (preferenceStatus != null && !preferenceStatus.isOK()) { + statuses.add(preferenceStatus); + } + } + } - return status; + if (!trustInfo.getTrustedPGPKeys().isEmpty()) { + // Be sure we add the new keys to the previously saved keys. + PGPPublicKeyStore keyStore = getPreferenceTrustedKeys(); + trustInfo.getTrustedPGPKeys().forEach(keyStore::addKey); + IStatus status = persistTrustedKeys(keyStore); + if (status != null && !status.isOK()) { + statuses.add(status); + } + } + + if (!statuses.isEmpty()) { + if (statuses.size() == 1) { + return statuses.get(1); + } + String message = statuses.stream().map(IStatus::getMessage).collect(Collectors.joining("\n")); //$NON-NLS-1$ + return new MultiStatus(getClass(), IStatus.OK, statuses.toArray(IStatus[]::new), message, null); + } + } + + return Status.OK_STATUS; } - private IStatus persistTrustedCertificates(Certificate[] trustedCertificates) { - if (trustedCertificates == null) - // I'm pretty sure this would be a bug; trustedCertificates should never be null here. - return new Status(IStatus.INFO, EngineActivator.ID, Messages.CertificateChecker_CertificateRejected); - ServiceTracker<TrustEngine, TrustEngine> trustEngineTracker = new ServiceTracker<>(EngineActivator.getContext(), TrustEngine.class, null); + /** + * This modifies the argument collection to remove the certificates that were + * successfully saved. Often no certificates are saved because this tries to + * store in the Java runtime cacerts and those are typically read-only. + */ + private IStatus persistTrustedCertificatesInTrustEngine( + Collection<? extends Certificate> unsavedTrustedCertificates) { + ServiceTracker<TrustEngine, TrustEngine> trustEngineTracker = new ServiceTracker<>(EngineActivator.getContext(), + TrustEngine.class, null); trustEngineTracker.open(); Object[] trustEngines = trustEngineTracker.getServices(); try { if (trustEngines == null) return null; - for (Certificate trustedCertificate : trustedCertificates) { + for (Iterator<? extends Certificate> it = unsavedTrustedCertificates.iterator(); it.hasNext();) { + Certificate trustedCertificate = it.next(); for (Object engine : trustEngines) { TrustEngine trustEngine = (TrustEngine) engine; if (trustEngine.isReadOnly()) continue; try { trustEngine.addTrustAnchor(trustedCertificate, trustedCertificate.toString()); - // this should mean we added an anchor successfully; continue to next certificate + // this should mean we added an anchor successfully; continue to next + // certificate + it.remove(); break; } catch (IOException e) { - //just return an INFO so the user can proceed with the install - return new Status(IStatus.INFO, EngineActivator.ID, Messages.CertificateChecker_KeystoreConnectionError, e); + // just return an INFO so the user can proceed with the install + return new Status(IStatus.INFO, EngineActivator.ID, + Messages.CertificateChecker_KeystoreConnectionError, e); } catch (GeneralSecurityException e) { - return new Status(IStatus.INFO, EngineActivator.ID, Messages.CertificateChecker_CertificateError, e); + return new Status(IStatus.INFO, EngineActivator.ID, + Messages.CertificateChecker_CertificateError, e); } } } @@ -224,6 +380,43 @@ public class CertificateChecker { return Status.OK_STATUS; } + public IStatus persistTrustedCertificates(Collection<? extends Certificate> trustedCertificates) { + if (profile != null) { + ProfileScope profileScope = new ProfileScope(agent.getService(IAgentLocation.class), + profile.getProfileId()); + IEclipsePreferences node = profileScope.getNode(EngineActivator.ID); + try { + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); //$NON-NLS-1$ + CertPath certPath = certificateFactory.generateCertPath(new ArrayList<>(trustedCertificates)); + byte[] encoded = certPath.getEncoded("PKCS7"); //$NON-NLS-1$ + node.putByteArray(TRUSTED_CERTIFICATES_PROPERTY, encoded); + node.flush(); + } catch (BackingStoreException | CertificateException ex) { + return new Status(IStatus.ERROR, EngineActivator.ID, ex.getMessage(), ex); + } + } + return Status.OK_STATUS; + } + + public Set<? extends Certificate> getPreferenceTrustedCertificates() { + if (profile != null) { + ProfileScope profileScope = new ProfileScope(agent.getService(IAgentLocation.class), + profile.getProfileId()); + IEclipsePreferences node = profileScope.getNode(EngineActivator.ID); + try { + byte[] encoded = node.getByteArray(TRUSTED_CERTIFICATES_PROPERTY, null); + if (encoded != null) { + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); //$NON-NLS-1$ + CertPath certPath = certificateFactory.generateCertPath(new ByteArrayInputStream(encoded), "PKCS7"); //$NON-NLS-1$ + return new LinkedHashSet<>(certPath.getCertificates()); + } + } catch (CertificateException ex) { + DebugHelper.debug(DEBUG_PREFIX, ex.getMessage()); + } + } + return Set.of(); + } + /** * Return the policy on unsigned content. */ @@ -235,14 +428,87 @@ public class CertificateChecker { } - public void add(File toAdd) { - artifacts.add(toAdd); + public void setProfile(IProfile profile) { + this.profile = profile; + } + + public void add(Map<IArtifactDescriptor, File> toAdd) { + artifacts.putAll(toAdd); + } + + public Map<PGPPublicKey, Set<Bundle>> getContributedTrustedKeys() { + // Build the map based on fingerprints to properly avoid duplicates as we + // accumulate the full set of keys. + Map<ByteBuffer, Set<Bundle>> keys = new LinkedHashMap<>(); + + // Load from the extension registry. + for (IConfigurationElement extension : RegistryFactory.getRegistry() + .getConfigurationElementsFor(EngineActivator.ID, "pgp")) { //$NON-NLS-1$ + if ("trustedKeys".equals(extension.getName())) { //$NON-NLS-1$ + String pathInBundle = extension.getAttribute("path"); //$NON-NLS-1$ + if (pathInBundle != null) { + String name = extension.getContributor().getName(); + Stream.of(EngineActivator.getContext().getBundles()) + .filter(bundle -> bundle.getSymbolicName().equals(name)).findAny().ifPresent(bundle -> { + URL keyURL = bundle.getEntry(pathInBundle); + try (InputStream stream = keyURL.openStream()) { + PGPPublicKeyStore.readPublicKeys(stream).stream().map(keyService::addKey) + .forEach(key -> keys.computeIfAbsent(ByteBuffer.wrap(key.getFingerprint()), + k -> new LinkedHashSet<>()).add(bundle)); + } catch (IOException e) { + DebugHelper.debug(DEBUG_PREFIX, e.getMessage()); + } + }); + } + } + } + + Map<PGPPublicKey, Set<Bundle>> result = keys.entrySet().stream() + .collect(Collectors.toMap(entry -> keyService.getKey(entry.getKey().array()), Map.Entry::getValue)); + return result; + } + + public boolean isTrustAlways() { + if (profile != null) { + ProfileScope profileScope = new ProfileScope(agent.getService(IAgentLocation.class), + profile.getProfileId()); + return profileScope.getNode(EngineActivator.ID).getBoolean(TRUST_ALWAYS_PROPERTY, false); + } + return false; + } + + public void setTrustAlways(boolean trustAlways) { + if (profile != null) { + ProfileScope profileScope = new ProfileScope(agent.getService(IAgentLocation.class), + profile.getProfileId()); + profileScope.getNode(EngineActivator.ID).putBoolean(TRUST_ALWAYS_PROPERTY, trustAlways); + } } - public void add(Object[] toAdd) { - for (Object element : toAdd) { - if (element instanceof File) - add((File) element); + public PGPPublicKeyStore getPreferenceTrustedKeys() { + PGPPublicKeyStore trustStore = new PGPPublicKeyStore(); + if (profile != null) { + ProfileScope profileScope = new ProfileScope(agent.getService(IAgentLocation.class), + profile.getProfileId()); + PGPPublicKeyStore + .readPublicKeys(profileScope.getNode(EngineActivator.ID).get(TRUSTED_KEY_STORE_PROPERTY, null)) + .stream().map(keyService::addKey).forEach(trustStore::addKey); } + return trustStore; + } + + public IStatus persistTrustedKeys(PGPPublicKeyStore trustStore) { + if (profile != null) { + ProfileScope profileScope = new ProfileScope(agent.getService(IAgentLocation.class), + profile.getProfileId()); + IEclipsePreferences node = profileScope.getNode(EngineActivator.ID); + try { + node.put(TRUSTED_KEY_STORE_PROPERTY, trustStore.toArmoredString()); + node.flush(); + } catch (IOException | BackingStoreException ex) { + return new Status(IStatus.ERROR, EngineActivator.ID, ex.getMessage(), ex); + } + } + return Status.OK_STATUS; } } diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java index 531f95331..5b81e7ba3 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java @@ -7,7 +7,7 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -25,6 +25,7 @@ import org.eclipse.equinox.p2.engine.PhaseSetFactory; import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.ITouchpointType; +import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; /** * An install phase that checks if the certificates used to sign the artifacts @@ -32,7 +33,13 @@ import org.eclipse.equinox.p2.metadata.ITouchpointType; */ public class CheckTrust extends InstallableUnitPhase { - public static final String PARM_ARTIFACT_FILES = "artifactFiles"; //$NON-NLS-1$ + /** + * Parameter used to populate/get artifacts to check trust. The value for this + * property is <code>Map<IArtifactDescriptor, File></code>. + * + * @see org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.CheckTrustAction + */ + public static final String PARM_ARTIFACTS = "artifacts"; //$NON-NLS-1$ public CheckTrust(int weight) { super(PhaseSetFactory.PHASE_CHECK_TRUST, weight); @@ -46,15 +53,15 @@ public class CheckTrust extends InstallableUnitPhase { @Override protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) { @SuppressWarnings("unchecked") - Collection<File> artifactRequests = (Collection<File>) parameters.get(PARM_ARTIFACT_FILES); + Map<IArtifactDescriptor, File> artifactRequests = (Map<IArtifactDescriptor, File>) parameters + .get(PARM_ARTIFACTS); IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); // Instantiate a check trust manager CertificateChecker certificateChecker = new CertificateChecker(agent); - certificateChecker.add(artifactRequests.toArray()); - IStatus status = certificateChecker.start(); - - return status; + certificateChecker.add(artifactRequests); + certificateChecker.setProfile(profile); + return certificateChecker.start(); } @Override @@ -86,7 +93,7 @@ public class CheckTrust extends InstallableUnitPhase { @Override protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) { - parameters.put(PARM_ARTIFACT_FILES, new ArrayList<File>()); + parameters.put(PARM_ARTIFACTS, new HashMap<IArtifactDescriptor, File>()); return super.initializePhase(monitor, profile, parameters); } diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java index 5b1082881..eb82f08d8 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java @@ -51,19 +51,7 @@ public final class Memento { } public Enumeration<String> getKeys() { - return new Enumeration<String>() { - Iterator<String> keysIterator = mementoMap.keySet().iterator(); - - @Override - public boolean hasMoreElements() { - return keysIterator.hasNext(); - } - - @Override - public String nextElement() { - return keysIterator.next(); - } - }; + return Collections.enumeration(mementoMap.keySet()); } private static void validateValue(Object value) { diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/.classpath b/bundles/org.eclipse.equinox.p2.extensionlocation/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.extensionlocation/.classpath +++ b/bundles/org.eclipse.equinox.p2.extensionlocation/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.extensionlocation/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.extensionlocation/.settings/org.eclipse.jdt.core.prefs index ffc318ade..2688c8dd5 100644 --- a/bundles/org.eclipse.equinox.p2.extensionlocation/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.extensionlocation/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -36,6 +36,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -89,6 +90,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -125,7 +127,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -139,7 +142,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -260,7 +262,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -331,7 +332,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -476,7 +476,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.extensionlocation/META-INF/MANIFEST.MF index 2a2096d6c..290732d27 100644 --- a/bundles/org.eclipse.equinox.p2.extensionlocation/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.extensionlocation/META-INF/MANIFEST.MF @@ -2,14 +2,14 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.extensionlocation;singleton:=true -Bundle-Version: 1.3.400.qualifier +Bundle-Version: 1.4.100.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.extensionlocation.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin -Export-Package: org.eclipse.equinox.internal.p2.extensionlocation;x-friends:="org.eclipse.equinox.p2.reconciler.dropins,org.eclipse.equinox.p2.ui.importexport" +Export-Package: org.eclipse.equinox.internal.p2.extensionlocation;x-friends:="org.eclipse.equinox.p2.reconciler.dropins,org.eclipse.equinox.p2.ui,org.eclipse.equinox.p2.ui.importexport" Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)", org.eclipse.equinox.p2.metadata -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.equinox.internal.p2.artifact.repository.simple, org.eclipse.equinox.internal.p2.core.helpers, diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/pom.xml b/bundles/org.eclipse.equinox.p2.extensionlocation/pom.xml index 679b693ce..2cadcc0b2 100644 --- a/bundles/org.eclipse.equinox.p2.extensionlocation/pom.xml +++ b/bundles/org.eclipse.equinox.p2.extensionlocation/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.extensionlocation</artifactId> - <version>1.3.400-SNAPSHOT</version> + <version>1.4.100-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.garbagecollector/.classpath b/bundles/org.eclipse.equinox.p2.garbagecollector/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.garbagecollector/.classpath +++ b/bundles/org.eclipse.equinox.p2.garbagecollector/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.garbagecollector/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.garbagecollector/.settings/org.eclipse.jdt.core.prefs index 4e79b56c0..26df1a4b1 100644 --- a/bundles/org.eclipse.equinox.p2.garbagecollector/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.garbagecollector/.settings/org.eclipse.jdt.core.prefs @@ -16,9 +16,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -35,6 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -88,6 +89,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -124,7 +126,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -138,7 +141,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -259,7 +261,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -330,7 +331,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -475,7 +475,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.garbagecollector/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.garbagecollector/META-INF/MANIFEST.MF index 89e6d2e65..5001cdab1 100644 --- a/bundles/org.eclipse.equinox.p2.garbagecollector/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.garbagecollector/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.garbagecollector;singleton:=true -Bundle-Version: 1.1.400.qualifier +Bundle-Version: 1.2.0.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.equinox.internal.p2.garbagecollector;x-friends:="org.eclipse.equinox.p2.touchpoint.eclipse,org.eclipse.pde.core,org.eclipse.equinox.p2.ui.sdk.scheduler" @@ -24,5 +24,5 @@ Import-Package: org.eclipse.core.runtime.preferences, org.osgi.service.prefs;version="1.1.0" Service-Component: OSGI-INF/garbagecollector.xml Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.eclipse.equinox.p2.garbagecollector diff --git a/bundles/org.eclipse.equinox.p2.garbagecollector/pom.xml b/bundles/org.eclipse.equinox.p2.garbagecollector/pom.xml index 1b50a5b15..ee0e4278b 100644 --- a/bundles/org.eclipse.equinox.p2.garbagecollector/pom.xml +++ b/bundles/org.eclipse.equinox.p2.garbagecollector/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.garbagecollector</artifactId> - <version>1.1.400-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.installer/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.installer/META-INF/MANIFEST.MF index f816770fa..63f6c3707 100644 --- a/bundles/org.eclipse.equinox.p2.installer/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.installer/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-SymbolicName: org.eclipse.equinox.p2.installer;singleton:=true Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-Localization: plugin -Bundle-Version: 1.3.100.qualifier +Bundle-Version: 1.3.300.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.installer.InstallerActivator Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.osgi;bundle-version="[3.7.0,4.0.0)", diff --git a/bundles/org.eclipse.equinox.p2.installer/installer.product b/bundles/org.eclipse.equinox.p2.installer/installer.product index 7e885dd71..83b557986 100644 --- a/bundles/org.eclipse.equinox.p2.installer/installer.product +++ b/bundles/org.eclipse.equinox.p2.installer/installer.product @@ -40,7 +40,7 @@ <plugin id="org.eclipse.core.expressions"/> <plugin id="org.eclipse.core.jobs"/> <plugin id="org.eclipse.core.net"/> - <plugin id="org.eclipse.core.net.linux.x86_64" fragment="true"/> + <plugin id="org.eclipse.core.net.linux" fragment="true"/> <plugin id="org.eclipse.core.runtime"/> <plugin id="org.eclipse.core.runtime.compatibility.registry" fragment="true"/> <plugin id="org.eclipse.ecf"/> @@ -57,7 +57,8 @@ <plugin id="org.eclipse.equinox.frameworkadmin"/> <plugin id="org.eclipse.equinox.frameworkadmin.equinox"/> <plugin id="org.eclipse.equinox.launcher"/> - <plugin id="org.eclipse.equinox.launcher.cocoa.macosx" fragment="true"/> + <plugin id="org.eclipse.equinox.launcher.cocoa.macosx.x86_64" fragment="true"/> + <plugin id="org.eclipse.equinox.launcher.cocoa.macosx.aarch64" fragment="true"/> <plugin id="org.eclipse.equinox.launcher.gtk.linux.x86_64" fragment="true"/> <plugin id="org.eclipse.equinox.p2.artifact.repository"/> <plugin id="org.eclipse.equinox.p2.core"/> @@ -75,7 +76,7 @@ <plugin id="org.eclipse.equinox.preferences"/> <plugin id="org.eclipse.equinox.registry"/> <plugin id="org.eclipse.equinox.security"/> - <plugin id="org.eclipse.equinox.security.linux.x86_64" fragment="true"/> + <plugin id="org.eclipse.equinox.security.linux" fragment="true"/> <plugin id="org.eclipse.equinox.security.macosx" fragment="true"/> <plugin id="org.eclipse.equinox.simpleconfigurator"/> <plugin id="org.eclipse.equinox.simpleconfigurator.manipulator"/> @@ -86,7 +87,6 @@ <plugin id="org.eclipse.osgi.services"/> <plugin id="org.eclipse.osgi.util"/> <plugin id="org.eclipse.swt"/> - <plugin id="org.eclipse.swt.browser.chromium.gtk.linux.x86_64" fragment="true"/> <plugin id="org.eclipse.swt.cocoa.macosx" fragment="true"/> <plugin id="org.eclipse.swt.gtk.linux.x86_64" fragment="true"/> <plugin id="org.sat4j.core"/> diff --git a/bundles/org.eclipse.equinox.p2.installer/installer.properties b/bundles/org.eclipse.equinox.p2.installer/installer.properties index c28de9f82..ef00a4347 100644 --- a/bundles/org.eclipse.equinox.p2.installer/installer.properties +++ b/bundles/org.eclipse.equinox.p2.installer/installer.properties @@ -11,8 +11,8 @@ # Contributors: # IBM Corporation - initial API and implementation ############################################################################### -eclipse.p2.metadata=http://download.eclipse.org/eclipse/updates/3.5 -eclipse.p2.artifacts=http://download.eclipse.org/eclipse/updates/3.5 +eclipse.p2.metadata=https://download.eclipse.org/eclipse/updates/3.5 +eclipse.p2.artifacts=https://download.eclipse.org/eclipse/updates/3.5 eclipse.p2.flavor=tooling eclipse.p2.profileName=Eclipse SDK eclipse.p2.launcherName=eclipse diff --git a/bundles/org.eclipse.equinox.p2.installer/pom.xml b/bundles/org.eclipse.equinox.p2.installer/pom.xml index 5c1199e11..27ae673d5 100644 --- a/bundles/org.eclipse.equinox.p2.installer/pom.xml +++ b/bundles/org.eclipse.equinox.p2.installer/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.installer</artifactId> - <version>1.3.100-SNAPSHOT</version> + <version>1.3.300-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/.classpath b/bundles/org.eclipse.equinox.p2.jarprocessor/.classpath index 030607499..cc48f9f27 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/.classpath +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" output="bin_ant" path="src_ant"/> 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 54666e7f7..e8117dca4 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 @@ -16,9 +16,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -35,6 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -88,6 +89,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -125,7 +127,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -139,7 +142,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -260,7 +262,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -331,7 +332,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -476,7 +476,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true 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 b356a0d06..283bf2bb4 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.1.700.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-Version: 1.2.300.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-11 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/forceQualifierUpdate.txt b/bundles/org.eclipse.equinox.p2.jarprocessor/forceQualifierUpdate.txt index 7b44375cc..1519a409d 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/forceQualifierUpdate.txt +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/forceQualifierUpdate.txt @@ -3,4 +3,9 @@ Bug 403352 - Update all parent versions to match our build stream Bug 465620 - jar processor needs 'touch' Bug 534597 - Unanticipated comparator errors in I20180511-2000 comparator errors on new infra -Bug 566668 - Comparator errors in I20200904-0210
\ No newline at end of file +Bug 566668 - Comparator errors in I20200904-0210 +Bug 571555 - Comparator errors in I20210226-1800 +Bug 571731 - Comparator errors in I20210305-0820 +Bug 575841 - Comparator errors in I20210906-1000 +Bug 578351 - Lambda generation order is unstable in ecj +Bug 579126 - 4.24 I-Build: I20220307-0340 - Comparator Errors Found
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/pom.xml b/bundles/org.eclipse.equinox.p2.jarprocessor/pom.xml index 2ede6d33e..7064c875d 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/pom.xml +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.jarprocessor</artifactId> - <version>1.1.700-SNAPSHOT</version> + <version>1.2.300-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/Main.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/Main.java index cffbf0ce5..9ce534b08 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/Main.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/Main.java @@ -35,6 +35,7 @@ public class Main { System.out.println("-verbose verbose mode "); //$NON-NLS-1$ } + @SuppressWarnings("removal") public static JarProcessorExecutor.Options processArguments(String[] args) { if (args.length == 0) { printUsage(); @@ -64,9 +65,9 @@ public class Main { options.outputDir = args[++i]; } else if (args[i].equals("-verbose")) { //$NON-NLS-1$ options.verbose = true; - } else if (args[i].equals("-processAll")) { //$NON-NLS-1$ + } else if (args[i].equals("-processAll")) { //$NON-NLS-1$ options.processAll = true; - } + } } options.input = new File(args[i]); @@ -76,19 +77,19 @@ public class Main { if (options.unpack) { if (!JarProcessor.canPerformUnpack()) { problemMessage = "The unpack200 command cannot be found."; //$NON-NLS-1$ - } else if (options.input.isFile() && !inputName.endsWith(".zip") && !inputName.endsWith(".pack.gz")) { //$NON-NLS-1$ //$NON-NLS-2$ + } else if (options.input.isFile() && !inputName.endsWith(".zip") && !inputName.endsWith(".pack.gz")) { //$NON-NLS-1$ //$NON-NLS-2$ problemMessage = "Input file is not a pack.gz file."; //$NON-NLS-1$ - } else if (options.pack || options.repack || options.signCommand != null) { + } else if (options.pack || options.repack || options.signCommand != null) { problemMessage = "Pack, repack or sign cannot be specified with unpack."; //$NON-NLS-1$ } } else { if (options.input.isFile() && !inputName.endsWith(".zip") && !inputName.endsWith(".jar")) { //$NON-NLS-1$ //$NON-NLS-2$ problemMessage = "Input file is not a jar file."; //$NON-NLS-1$ - } else if ((options.pack || options.repack) && !JarProcessor.canPerformPack()) { + } else if ((options.pack || options.repack) && !JarProcessor.canPerformPack()) { problemMessage = "The pack200 command can not be found."; //$NON-NLS-1$ } } - if(problemMessage != null){ + if (problemMessage != null) { System.out.println(problemMessage); System.out.println(); printUsage(); @@ -97,7 +98,7 @@ public class Main { return options; } - + /** * @param args */ 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 da41e546a..1456f7f91 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 @@ -17,6 +17,13 @@ import java.io.File; import java.io.IOException; import java.util.*; +/** + * @noreference This class is not intended to be referenced by clients. + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. + */ +@Deprecated(forRemoval = true, since = "1.2.0") public class PackStep extends CommandStep { protected static String packCommand = null; @@ -40,7 +47,7 @@ public class PackStep extends CommandStep { if (location == null) { continue; } - result = execute(new String[]{location, "-V"}); //$NON-NLS-1$ + result = execute(new String[] { location, "-V" }); //$NON-NLS-1$ if (result == 0) { packCommand = location; canPack = Boolean.TRUE; @@ -98,7 +105,7 @@ public class PackStep extends CommandStep { } protected boolean shouldPack(File input, List<Properties> containers, Properties inf) { - //1: exclude by containers + // 1: exclude by containers // innermost jar is first on the list, it can override outer jars for (Properties container : containers) { if (container.containsKey(Utils.MARK_EXCLUDE_CHILDREN_PACK)) { @@ -111,8 +118,9 @@ public class PackStep extends CommandStep { } } - //2: excluded by self - if (inf != null && inf.containsKey(Utils.MARK_EXCLUDE_PACK) && Boolean.parseBoolean(inf.getProperty(Utils.MARK_EXCLUDE_PACK))) { + // 2: excluded by self + if (inf != null && inf.containsKey(Utils.MARK_EXCLUDE_PACK) + && Boolean.parseBoolean(inf.getProperty(Utils.MARK_EXCLUDE_PACK))) { if (verbose) System.out.println("Excluding " + input.getName() + " from " + getStepName()); //$NON-NLS-1$ //$NON-NLS-2$ return false; @@ -121,7 +129,8 @@ public class PackStep extends CommandStep { return true; } - protected String[] getCommand(File input, File outputFile, Properties inf, List<Properties> containers) throws IOException { + protected String[] getCommand(File input, File outputFile, Properties inf, List<Properties> containers) + throws IOException { String[] cmd = null; String arguments = getArguments(input, inf, containers); if (arguments != null && arguments.length() > 0) { @@ -132,32 +141,32 @@ public class PackStep extends CommandStep { cmd[cmd.length - 2] = outputFile.getCanonicalPath(); cmd[cmd.length - 1] = input.getCanonicalPath(); } else { - cmd = new String[] {packCommand, outputFile.getCanonicalPath(), input.getCanonicalPath()}; + cmd = new String[] { packCommand, outputFile.getCanonicalPath(), input.getCanonicalPath() }; } return cmd; } protected String getArguments(File input, Properties inf, List<Properties> containers) { - //1: Explicitly marked in our .inf file + // 1: Explicitly marked in our .inf file if (inf != null && inf.containsKey(Utils.PACK_ARGS)) { return inf.getProperty(Utils.PACK_ARGS); } - //2: Defaults set in one of our containing jars + // 2: Defaults set in one of our containing jars for (Properties container : containers) { if (container.containsKey(Utils.DEFAULT_PACK_ARGS)) { return container.getProperty(Utils.DEFAULT_PACK_ARGS); } } - //3: Set by name in outside pack.properties file + // 3: Set by name in outside pack.properties file Properties options = getOptions(); String argsKey = input.getName() + Utils.PACK_ARGS_SUFFIX; if (options.containsKey(argsKey)) { return options.getProperty(argsKey); } - //4: Set by default in outside pack.properties file + // 4: Set by default in outside pack.properties file if (options.containsKey(Utils.DEFAULT_PACK_ARGS)) { return options.getProperty(Utils.DEFAULT_PACK_ARGS); } @@ -175,7 +184,7 @@ public class PackStep extends CommandStep { if (input == null || inf == null) return false; - //don't be verbose to check if we should mark the inf + // don't be verbose to check if we should mark the inf boolean v = verbose; verbose = false; if (!shouldPack(input, containers, inf)) { @@ -184,12 +193,13 @@ public class PackStep extends CommandStep { } verbose = v; - //mark as conditioned if not previously marked. A signed jar is assumed to be previously conditioned. + // mark as conditioned if not previously marked. A signed jar is assumed to be + // previously conditioned. if (inf.getProperty(Utils.MARK_PROPERTY) != null) return false; inf.put(Utils.MARK_PROPERTY, "true"); //$NON-NLS-1$ - //record arguments used + // record arguments used String arguments = inf.getProperty(Utils.PACK_ARGS); if (arguments == null) { arguments = getArguments(input, inf, containers); 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 f9e9b6398..fe15d241b 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 @@ -18,9 +18,12 @@ import java.io.IOException; import java.util.*; /** - * @author aniefer@ca.ibm.com - * + * @noreference This class is not intended to be referenced by clients. + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. */ +@Deprecated(forRemoval = true, since = "1.2.0") public class PackUnpackStep extends PackStep { private Set<String> exclusions = 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 894bf7c00..915f5598b 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 @@ -18,6 +18,13 @@ import java.io.IOException; import java.util.List; import java.util.Properties; +/** + * @noreference This class is not intended to be referenced by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + * @noextend This class is not intended to be subclassed by clients. + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. + */ +@Deprecated(forRemoval = true, since = "1.2.0") public class UnpackStep extends CommandStep { public static final String UNPACKER_PROPERTY = "org.eclipse.update.jarprocessor.Unpacker"; //$NON-NLS-1$ private static Boolean canUnpack = null; @@ -39,7 +46,7 @@ public class UnpackStep extends CommandStep { if (location == null) { continue; } - result = execute(new String[]{location, "-V"}); //$NON-NLS-1$ + result = execute(new String[] { location, "-V" }); //$NON-NLS-1$ if (result == 0) { unpackCommand = location; canUnpack = Boolean.TRUE; @@ -82,9 +89,10 @@ public class UnpackStep extends CommandStep { String options = getOptions().getProperty(input.getName() + ".unpack.args"); //$NON-NLS-1$ String[] cmd = null; if (options != null) { - cmd = new String[] {unpackCommand, options, input.getCanonicalPath(), unpacked.getCanonicalPath()}; + cmd = new String[] { unpackCommand, options, input.getCanonicalPath(), + unpacked.getCanonicalPath() }; } else { - cmd = new String[] {unpackCommand, input.getCanonicalPath(), unpacked.getCanonicalPath()}; + cmd = new String[] { unpackCommand, input.getCanonicalPath(), unpacked.getCanonicalPath() }; } int result = execute(cmd, verbose); if (result != 0 && verbose) 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 74f4f8382..d24dbc30d 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 @@ -30,51 +30,108 @@ public class Utils { /* * Properties found in outer pack.properties file */ - //comma separated list of jars to exclude from sigining + // comma separated list of jars to exclude from sigining public static final String SIGN_EXCLUDES = "sign.excludes"; //$NON-NLS-1$ - //comma separated list of jars to exlclude from packing + // comma separated list of jars to exlclude from packing + /** + * @noreference This field is not intended to be referenced by clients. + * @deprecated See <a href= + * "https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> + * for details. + */ + @Deprecated(forRemoval = true, since = "1.2.0") public static final String PACK_EXCLUDES = "pack.excludes"; //$NON-NLS-1$ - //Suffix used when specifying arguments to use when running pack200 on a jar + // Suffix used when specifying arguments to use when running pack200 on a jar + + /** + * @noreference This field is not intended to be referenced by clients. + * @deprecated See <a href= + * "https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> + * for details. + */ + @Deprecated(forRemoval = true, since = "1.2.0") public static final String PACK_ARGS_SUFFIX = ".pack.args"; //$NON-NLS-1$ /* * Properties found in both pack.properties and eclipse.inf */ - // Default arguments to use when running pack200. - // Affects all jars when specified in pack.properties, affects children when specified in eclipse.inf + // Default arguments to use when running pack200. + // Affects all jars when specified in pack.properties, affects children when + // specified in eclipse.inf + /** + * @noreference This field is not intended to be referenced by clients. + * @deprecated See <a href= + * "https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> + * for details. + */ + @Deprecated(forRemoval = true, since = "1.2.0") public static final String DEFAULT_PACK_ARGS = "pack200.default.args"; //$NON-NLS-1$ /* * Properties found in eclipse.inf file */ - //This jar has been conditioned with pack200 + // This jar has been conditioned with pack200 + /** + * @noreference This field is not intended to be referenced by clients. + * @deprecated See <a href= + * "https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> + * for details. + */ + @Deprecated(forRemoval = true, since = "1.2.0") public static final String MARK_PROPERTY = "pack200.conditioned"; //$NON-NLS-1$ - //Exclude this jar from processing + // Exclude this jar from processing public static final String MARK_EXCLUDE = "jarprocessor.exclude"; //$NON-NLS-1$ - //Exclude this jar from pack200 + // Exclude this jar from pack200 public static final String MARK_EXCLUDE_PACK = "jarprocessor.exclude.pack"; //$NON-NLS-1$ - //Exclude this jar from signing + // Exclude this jar from signing public static final String MARK_EXCLUDE_SIGN = "jarprocessor.exclude.sign"; //$NON-NLS-1$ - //Exclude this jar's children from processing + // Exclude this jar's children from processing public static final String MARK_EXCLUDE_CHILDREN = "jarprocessor.exclude.children"; //$NON-NLS-1$ - //Exclude this jar's children from pack200 + // Exclude this jar's children from pack200 public static final String MARK_EXCLUDE_CHILDREN_PACK = "jarprocessor.exclude.children.pack"; //$NON-NLS-1$ - //Exclude this jar's children from signing + // Exclude this jar's children from signing public static final String MARK_EXCLUDE_CHILDREN_SIGN = "jarprocessor.exclude.children.sign"; //$NON-NLS-1$ - //Arguments used in pack200 for this jar + // Arguments used in pack200 for this jar + /** + * @noreference This field is not intended to be referenced by clients. + * @deprecated See <a href= + * "https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> + * for details. + */ + @Deprecated(forRemoval = true, since = "1.2.0") public static final String PACK_ARGS = "pack200.args"; //$NON-NLS-1$ - + /** + * @noreference This field is not intended to be referenced by clients. + * @deprecated See <a href= + * "https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> + * for details. + */ + @Deprecated(forRemoval = true, since = "1.2.0") public static final String PACK200_PROPERTY = "org.eclipse.update.jarprocessor.pack200"; //$NON-NLS-1$ public static final String JRE = "@jre"; //$NON-NLS-1$ public static final String PATH = "@path"; //$NON-NLS-1$ public static final String NONE = "@none"; //$NON-NLS-1$ - + /** + * @noreference This field is not intended to be referenced by clients. + * @deprecated See <a href= + * "https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> + * for details. + */ + @Deprecated(forRemoval = true, since = "1.2.0") 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 = pathname -> pathname.isFile() && pathname.getName().endsWith(".jar"); //$NON-NLS-1$ - - public static final FileFilter PACK_GZ_FILTER = pathname -> pathname.isFile() && pathname.getName().endsWith(JarProcessor.PACKED_SUFFIX); + /** + * @noreference This field is not intended to be referenced by clients. + * @deprecated See <a href= + * "https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> + * for details. + */ + @SuppressWarnings("removal") + @Deprecated(forRemoval = true, since = "1.2.0") + 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) { @@ -86,46 +143,54 @@ public class Utils { else if (stream instanceof JarFile) ((JarFile) stream).close(); } catch (IOException e) { - //ignore + // ignore } } } /** - * get the set of commands to try to execute pack/unpack + * get the set of commands to try to execute pack/unpack + * * @param cmd the command, either "pack200" or "unpack200" * @return String [] or null + * + * @noreference This method is not intended to be referenced by clients. + * @deprecated See <a href= + * "https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> + * for details. */ + @Deprecated(forRemoval = true, since = "1.2.0") public static String[] getPack200Commands(String cmd) { String[] locations = null; String prop = System.getProperty(PACK200_PROPERTY); String javaHome = System.getProperty("java.home"); //$NON-NLS-1$ if (null == prop) { - locations = new String[] {javaHome + "/bin/" + cmd, cmd}; //$NON-NLS-1$ - } else switch (prop) { + locations = new String[] { javaHome + "/bin/" + cmd, cmd }; //$NON-NLS-1$ + } else + switch (prop) { case NONE: return null; case JRE: - locations = new String[] {javaHome + "/bin/" + cmd}; //$NON-NLS-1$ + locations = new String[] { javaHome + "/bin/" + cmd }; //$NON-NLS-1$ break; case PATH: - locations = new String[] {cmd}; + locations = new String[] { cmd }; break; default: - locations = new String[] {prop + "/" + cmd}; //$NON-NLS-1$ + locations = new String[] { prop + "/" + cmd }; //$NON-NLS-1$ break; - } + } return locations; } /** - * Transfers all available bytes from the given input stream to the given - * output stream. Closes both streams if close == true, regardless of failure. - * Flushes the destination stream if close == false + * Transfers all available bytes from the given input stream to the given output + * stream. Closes both streams if close == true, regardless of failure. Flushes + * the destination stream if close == false * * @param source * @param destination - * @param close + * @param close * @throws IOException */ public static void transferStreams(InputStream source, OutputStream destination, boolean close) throws IOException { @@ -151,9 +216,9 @@ public class Utils { /** * Deletes all the files and directories from the given root down (inclusive). - * Returns false if we could not delete some file or an exception occurred - * at any point in the deletion. - * Even if an exception occurs, a best effort is made to continue deleting. + * Returns false if we could not delete some file or an exception occurred at + * any point in the deletion. Even if an exception occurs, a best effort is made + * to continue deleting. */ public static boolean clear(java.io.File root) { boolean result = clearChildren(root); @@ -167,26 +232,32 @@ public class Utils { } /** - * Deletes all the files and directories from the given root down, except for - * the root itself. - * Returns false if we could not delete some file or an exception occurred - * at any point in the deletion. - * Even if an exception occurs, a best effort is made to continue deleting. + * Deletes all the files and directories from the given root down, except for + * the root itself. Returns false if we could not delete some file or an + * exception occurred at any point in the deletion. Even if an exception occurs, + * a best effort is made to continue deleting. */ public static boolean clearChildren(java.io.File root) { boolean result = true; if (root.isDirectory()) { String[] list = root.list(); - // for some unknown reason, list() can return null. + // for some unknown reason, list() can return null. // Just skip the children If it does. if (list != null) for (String list1 : list) { result &= clear(new java.io.File(root, list1)); - } + } } return result; } + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated See <a href= + * "https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> + * for details. + */ + @Deprecated(forRemoval = true, since = "1.2.0") public static Set<String> getPackExclusions(Properties properties) { if (properties == null) return Collections.emptySet(); @@ -219,13 +290,8 @@ public class Utils { } public static String concat(String[] array) { - StringBuilder buffer = new StringBuilder(); - for (int i = 0; i < array.length; i++) { - if (i > 0) - buffer.append(' '); - buffer.append(array[i]); - } - return buffer.toString(); + String buffer = String.join(String.valueOf(' '), array); + return buffer; } public static String[] toStringArray(String input, String separator) { @@ -239,8 +305,10 @@ public class Utils { } /** - * Get the properties from the eclipse.inf file from the given jar. If the file is not a jar, null is returned. - * If the file is a jar, but does not contain an eclipse.inf file, an empty Properties object is returned. + * Get the properties from the eclipse.inf file from the given jar. If the file + * is not a jar, null is returned. If the file is a jar, but does not contain an + * eclipse.inf file, an empty Properties object is returned. + * * @param jarFile * @return The eclipse.inf properties for the given jar file */ @@ -263,7 +331,7 @@ public class Utils { } return new Properties(); } catch (ZipException e) { - //not a jar, don't bother logging this. + // not a jar, don't bother logging this. return null; } catch (IOException e) { if (verbose) { @@ -279,27 +347,29 @@ public class Utils { public static boolean shouldSkipJar(File input, boolean processAll, boolean verbose) { Properties inf = getEclipseInf(input, verbose); if (inf == null) { - //not a jar, could be a pack.gz + // not a jar, could be a pack.gz return false; } String exclude = inf.getProperty(MARK_EXCLUDE); - //was marked as exclude, we should skip + // was marked as exclude, we should skip if (exclude != null && Boolean.parseBoolean(exclude)) return true; - //process all was set, don't skip + // process all was set, don't skip if (processAll) return false; - //otherwise, we skip if not marked marked + // otherwise, we skip if not marked marked String marked = inf.getProperty(MARK_PROPERTY); return !Boolean.parseBoolean(marked); } /** - * Stores the given properties in the output stream. We store the properties - * in sorted order so that the signing hash doesn't change if the properties didn't change. + * Stores the given properties in the output stream. We store the properties in + * sorted order so that the signing hash doesn't change if the properties didn't + * change. + * * @param props * @param stream */ 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 a055ac66e..3242b1c9a 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 @@ -47,10 +47,12 @@ public class ZipProcessor { return workingDirectory; } + @SuppressWarnings("removal") private boolean repacking() { return options.repack || (options.pack && options.signCommand != null); } + @SuppressWarnings("removal") public void processZip(File zipFile) throws ZipException, IOException { if (options.verbose) System.out.println("Processing " + zipFile.getPath()); //$NON-NLS-1$ @@ -74,7 +76,9 @@ public class ZipProcessor { 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) { + for (ZipEntry entry = entries.nextElement(); entry != null; entry = entries.hasMoreElements() + ? (ZipEntry) entries.nextElement() + : null) { String name = entry.getName(); InputStream entryStream = zip.getInputStream(entry); @@ -98,14 +102,15 @@ public class ZipProcessor { boolean skip = Utils.shouldSkipJar(extractedFile, options.processAll, options.verbose); if (skip) { - //skipping this file + // 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(); + name = name.substring(0, name.length() - extractedFile.getName().length()) + + result.getName(); extractedFile = result; } else { if (repack || sign) { @@ -122,22 +127,27 @@ public class ZipProcessor { File modifiedFile = processor.processJar(extractedFile); if (modifiedFile.exists()) { try { - String newName = name.substring(0, name.length() - extractedFile.getName().length()) + modifiedFile.getName(); + 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( + "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 + 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$ + System.out.println( + "Warning: Problem reading " + modifiedFile.getPath() + "."); //$NON-NLS-1$//$NON-NLS-2$ } } entryStream = null; @@ -152,7 +162,8 @@ public class ZipProcessor { } catch (IOException e) { if (options.verbose) { e.printStackTrace(); - System.out.println("Warning: Problem reading " + extractedFile.getPath() + "."); //$NON-NLS-1$//$NON-NLS-2$ + System.out.println( + "Warning: Problem reading " + extractedFile.getPath() + "."); //$NON-NLS-1$//$NON-NLS-2$ } } } @@ -170,7 +181,8 @@ public class ZipProcessor { zipOut.closeEntry(); } catch (ZipException e) { 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("Warning: " + name + " already exists in " + outputFile.getName() //$NON-NLS-1$//$NON-NLS-2$ + + ". Skipping."); //$NON-NLS-1$ } } entryStream.close(); @@ -205,6 +217,7 @@ public class ZipProcessor { return result; } + @SuppressWarnings("removal") private void initialize(ZipFile zip) { ZipEntry entry = zip.getEntry("pack.properties"); //$NON-NLS-1$ properties = new Properties(); 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 03f1c61fd..d21aea9a6 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, 2017 IBM Corporation and others. + * Copyright (c) 2007, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -21,11 +21,14 @@ import org.eclipse.equinox.internal.p2.jarprocessor.UnpackStep; import org.eclipse.equinox.internal.p2.jarprocessor.Utils; import org.eclipse.internal.provisional.equinox.p2.jarprocessor.*; +@SuppressWarnings("removal") public class Verifier extends JarProcessorExecutor { private static void printUsage() { - System.out.println("This tool verifies that unpacking a pack.gz file with the jarprocessor results in a valid jar file."); //$NON-NLS-1$ - System.out.println("Usage: java -cp jarprocessor.jar org.eclipse.update.internal.jarprocessor.verifier.Verifier -dir <workingDirectory> input [input]"); //$NON-NLS-1$ + System.out.println( + "This tool verifies that unpacking a pack.gz file with the jarprocessor results in a valid jar file."); //$NON-NLS-1$ + System.out.println( + "Usage: java -cp jarprocessor.jar org.eclipse.update.internal.jarprocessor.verifier.Verifier -dir <workingDirectory> input [input]"); //$NON-NLS-1$ System.out.println(""); //$NON-NLS-1$ System.out.println("-dir : specifies a working directory where pack.gz files can be temporarily unpacked"); //$NON-NLS-1$ System.out.println("input : a list of directories and/or pack.gz files to verify."); //$NON-NLS-1$ @@ -44,7 +47,7 @@ public class Verifier extends JarProcessorExecutor { if (args.length == 0) { workingDirectory = "."; //$NON-NLS-1$ - input = new String[] {"."}; //$NON-NLS-1$ + input = new String[] { "." }; //$NON-NLS-1$ } else { int idx = 0; if (args[0] == "-help") { //$NON-NLS-1$ @@ -85,8 +88,10 @@ public class Verifier extends JarProcessorExecutor { Properties properties = new Properties(); - /* There is no need to use a full processor to do the verification unless we want to verify nested jars as well. - * So for now, use a custom processor to just call the verify step directly. + /* + * There is no need to use a full processor to do the verification unless we + * want to verify nested jars as well. So for now, use a custom processor to + * just call the verify step directly. */ final VerifyStep verifyStep = new VerifyStep(properties, false); JarProcessor verifier = new JarProcessor() { @@ -95,7 +100,7 @@ public class Verifier extends JarProcessorExecutor { Iterator<IProcessStep> iterator = getStepIterator(); if (iterator.hasNext() && iterator.next() instanceof VerifyStep) return verifyStep.postProcess(inputFile, workingDirectory, null); - //else we are unpacking, call super + // else we are unpacking, call super return super.processJar(inputFile); } }; @@ -115,11 +120,14 @@ public class Verifier extends JarProcessorExecutor { } @Override - public void addPackStep(JarProcessor processor, Properties properties, JarProcessorExecutor.Options processOptions) { + @Deprecated(forRemoval = true, since = "1.2.0") + public void addPackStep(JarProcessor processor, Properties properties, + JarProcessorExecutor.Options processOptions) { processor.addProcessStep(new VerifyStep(properties, processOptions.verbose)); } @Override + @Deprecated(forRemoval = true, since = "1.2.0") 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/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 19c0868c3..5605876ca 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 @@ -19,6 +19,11 @@ import java.util.jar.*; import org.eclipse.equinox.internal.p2.jarprocessor.*; public class JarProcessor { + /** + * @noreference This field is not intended to be referenced by clients. + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. + */ + @Deprecated(forRemoval = true, since = "1.2.0") public static final String PACKED_SUFFIX = "pack.gz"; //$NON-NLS-1$ private List<IProcessStep> steps = new ArrayList<>(); @@ -28,6 +33,11 @@ public class JarProcessor { private boolean processAll = false; private LinkedList<Properties> containingInfs = new LinkedList<>(); + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. + */ + @Deprecated(forRemoval = true, since = "1.2.0") static public JarProcessor getUnpackProcessor(Properties properties) { if (!canPerformUnpack()) throw new UnsupportedOperationException(); @@ -36,6 +46,11 @@ public class JarProcessor { return processor; } + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. + */ + @Deprecated(forRemoval = true, since = "1.2.0") static public JarProcessor getPackProcessor(Properties properties) { if (!canPerformPack()) throw new UnsupportedOperationException(); @@ -44,10 +59,20 @@ public class JarProcessor { return processor; } + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. + */ + @Deprecated(forRemoval = true, since = "1.2.0") static public boolean canPerformPack() { return PackStep.canPack(); } + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. + */ + @Deprecated(forRemoval = true, since = "1.2.0") static public boolean canPerformUnpack() { return UnpackStep.canUnpack(); } @@ -82,21 +107,24 @@ public class JarProcessor { } /** - * Recreate a jar file. The replacements map specifies entry names to be replaced, the replacements are - * expected to be found in directory. + * Recreate a jar file. The replacements map specifies entry names to be + * replaced, the replacements are expected to be found in directory. * - * @param jar - The input jar - * @param outputJar - the output + * @param jar - The input jar + * @param outputJar - the output * @param replacements - map of entryName -> new entryName - * @param directory - location to find file for new entryName + * @param directory - location to find file for new entryName * @throws IOException */ - private void recreateJar(JarFile jar, JarOutputStream outputJar, Map<String, String> replacements, File directory, Properties inf) throws IOException { + private void recreateJar(JarFile jar, JarOutputStream outputJar, Map<String, String> replacements, File directory, + Properties inf) throws IOException { InputStream in = null; boolean marked = false; try { Enumeration<JarEntry> entries = jar.entries(); - for (JarEntry entry = entries.nextElement(); entry != null; entry = entries.hasMoreElements() ? (JarEntry) entries.nextElement() : null) { + for (JarEntry entry = entries.nextElement(); entry != null; entry = entries.hasMoreElements() + ? (JarEntry) entries.nextElement() + : null) { File replacement = null; JarEntry newEntry = null; if (replacements.containsKey(entry.getName())) { @@ -110,11 +138,13 @@ public class JarProcessor { } catch (Exception e) { if (verbose) { e.printStackTrace(); - System.out.println("Warning: Problem reading " + replacement.getPath() + ", using " + jar.getName() + File.separator + entry.getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + System.out.println("Warning: Problem reading " + replacement.getPath() + ", using " //$NON-NLS-1$ //$NON-NLS-2$ + + jar.getName() + File.separator + entry.getName() + " instead."); //$NON-NLS-1$ } } } else if (verbose) { - System.out.println("Warning: " + replacement.getPath() + " not found, using " + jar.getName() + File.separator + entry.getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + System.out.println("Warning: " + replacement.getPath() + " not found, using " //$NON-NLS-1$ //$NON-NLS-2$ + + jar.getName() + File.separator + entry.getName() + " instead."); //$NON-NLS-1$ } } } @@ -133,7 +163,8 @@ public class JarProcessor { newEntry.setTime(entry.getTime()); outputJar.putNextEntry(newEntry); if (entry.getName().equals(Utils.MARK_FILE_NAME)) { - //The eclipse.inf file was read in earlier, don't need to reread it, just write it out now + // The eclipse.inf file was read in earlier, don't need to reread it, just write + // it out now Utils.storeProperties(inf, outputJar); marked = true; } else { @@ -142,7 +173,7 @@ public class JarProcessor { outputJar.closeEntry(); in.close(); - //delete the nested jar file + // delete the nested jar file if (replacement != null) { replacement.delete(); } @@ -170,9 +201,10 @@ public class JarProcessor { return result; } - private void extractEntries(JarFile jar, File tempDir, Map<String, String> data, Properties inf) throws IOException { + private void extractEntries(JarFile jar, File tempDir, Map<String, String> data, Properties inf) + throws IOException { if (inf != null) { - //skip if excluding children + // skip if excluding children if (inf.containsKey(Utils.MARK_EXCLUDE_CHILDREN)) { String excludeChildren = inf.getProperty(Utils.MARK_EXCLUDE_CHILDREN); if (Boolean.parseBoolean(excludeChildren)) @@ -187,7 +219,9 @@ public class JarProcessor { Enumeration<JarEntry> entries = jar.entries(); if (entries.hasMoreElements()) { - for (JarEntry entry = entries.nextElement(); entry != null; entry = entries.hasMoreElements() ? (JarEntry) entries.nextElement() : null) { + for (JarEntry entry = entries.nextElement(); entry != null; entry = entries.hasMoreElements() + ? (JarEntry) entries.nextElement() + : null) { String name = entry.getName(); String newName = recursionEffect(name); if (newName != null) { @@ -196,7 +230,7 @@ public class JarProcessor { System.out.print(" "); //$NON-NLS-1$ System.out.println("Processing nested file: " + name); //$NON-NLS-1$ } - //extract entry to temp directory + // extract entry to temp directory File extracted = ZipProcessor.createSubPathFile(tempDir, name); File parentDir = extracted.getParentFile(); if (!parentDir.exists()) @@ -207,14 +241,14 @@ public class JarProcessor { try { in = jar.getInputStream(entry); out = new BufferedOutputStream(new FileOutputStream(extracted)); - Utils.transferStreams(in, out, true); //this will close both streams + Utils.transferStreams(in, out, true); // this will close both streams } finally { Utils.close(in); Utils.close(out); } extracted.setLastModified(entry.getTime()); - //recurse + // recurse String dir = getWorkingDirectory(); try { containingInfs.addFirst(inf); @@ -227,7 +261,7 @@ public class JarProcessor { containingInfs.removeFirst(); } - //delete the extracted item leaving the recursion result + // delete the extracted item leaving the recursion result if (!name.equals(newName)) extracted.delete(); } @@ -277,7 +311,7 @@ public class JarProcessor { if (skip) System.out.println("Skipping " + input.getPath()); //$NON-NLS-1$ else { - System.out.print("Running "); //$NON-NLS-1$ + System.out.print("Running "); //$NON-NLS-1$ for (IProcessStep step : steps) { System.out.print(step.getStepName() + " "); //$NON-NLS-1$ } @@ -286,14 +320,15 @@ public class JarProcessor { } if (skip) { - //This jar was not marked as conditioned, and we are only processing conditioned jars, so do nothing + // This jar was not marked as conditioned, and we are only processing + // conditioned jars, so do nothing return input; } - //pre + // pre File workingFile = preProcess(input, workingDir); - //Extract entries from jar and recurse on them + // Extract entries from jar and recurse on them if (depth == 0) { tempDir = new File(workingDir, "temp." + workingFile.getName()); //$NON-NLS-1$ } else { @@ -312,8 +347,9 @@ public class JarProcessor { if (inf != null) infAdjusted = adjustInf(workingFile, inf); - //Recreate the jar with replacements. - //This is not strictly necessary if we didn't change the inf file and didn't change any content + // Recreate the jar with replacements. + // This is not strictly necessary if we didn't change the inf file and didn't + // change any content if (!replacements.isEmpty() || infAdjusted) { File tempJar = null; tempJar = new File(tempDir, workingFile.getName()); @@ -338,10 +374,10 @@ public class JarProcessor { Utils.close(jar); } - //post + // post File result = postProcess(workingFile, workingDir); - //have to normalize after the post steps + // have to normalize after the post steps normalize(result, workingDir); // If the original input is where we ended up, just return it @@ -369,7 +405,7 @@ public class JarProcessor { private void normalize(File input, File directory) { if (input.getName().endsWith(JarProcessor.PACKED_SUFFIX)) { - //not a jar + // not a jar return; } try { @@ -381,7 +417,9 @@ public class JarProcessor { jar = new JarFile(input, false); jarOut = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(tempJar))); Enumeration<JarEntry> entries = jar.entries(); - for (JarEntry entry = entries.nextElement(); entry != null; entry = entries.hasMoreElements() ? (JarEntry) entries.nextElement() : null) { + for (JarEntry entry = entries.nextElement(); entry != null; entry = entries.hasMoreElements() + ? (JarEntry) entries.nextElement() + : null) { JarEntry newEntry = new JarEntry(entry.getName()); newEntry.setTime(entry.getTime()); jarIn = new BufferedInputStream(jar.getInputStream(entry)); @@ -391,7 +429,7 @@ public class JarProcessor { jarIn.close(); } } catch (JarException e) { - //not a jar + // not a jar return; } finally { Utils.close(jarOut); diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/internal/provisional/equinox/p2/jarprocessor/JarProcessorExecutor.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/internal/provisional/equinox/p2/jarprocessor/JarProcessorExecutor.java index 499961491..d1d3f2a0e 100644 --- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/internal/provisional/equinox/p2/jarprocessor/JarProcessorExecutor.java +++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/internal/provisional/equinox/p2/jarprocessor/JarProcessorExecutor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 IBM Corporation and others. + * Copyright (c) 2007, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -24,8 +24,11 @@ public class JarProcessorExecutor { public static class Options { public String outputDir = "."; //$NON-NLS-1$ public String signCommand = null; + @Deprecated(forRemoval = true, since = "1.2.0") public boolean pack = false; + @Deprecated(forRemoval = true, since = "1.2.0") public boolean repack = false; + @Deprecated(forRemoval = true, since = "1.2.0") public boolean unpack = false; public boolean verbose = false; public boolean processAll = false; @@ -36,6 +39,7 @@ public class JarProcessorExecutor { private Set<String> packExclusions = null; private Set<String> signExclusions = null; + @SuppressWarnings("removal") public void runJarProcessor(Options processOptions) { this.options = processOptions; if (options.input.isFile() && options.input.getName().endsWith(".zip")) { //$NON-NLS-1$ @@ -59,7 +63,7 @@ public class JarProcessorExecutor { processor.setProcessAll(options.processAll); processor.setVerbose(options.verbose); - //load options file + // load options file Properties properties = new Properties(); if (options.input.isDirectory()) { File packProperties = new File(options.input, "pack.properties"); //$NON-NLS-1$ @@ -90,6 +94,7 @@ public class JarProcessorExecutor { } } + @SuppressWarnings("removal") protected FileFilter createFileFilter(Options processOptions) { return processOptions.unpack ? Utils.PACK_GZ_FILTER : Utils.JAR_FILTER; } @@ -142,7 +147,8 @@ public class JarProcessorExecutor { return packExclusions == null ? true : !packExclusions.contains(name); } - protected void process(File input, FileFilter filter, boolean verbose, JarProcessor processor, Properties packProperties) throws FileNotFoundException { + protected void process(File input, FileFilter filter, boolean verbose, JarProcessor processor, + Properties packProperties) throws FileNotFoundException { if (!input.exists()) throw new FileNotFoundException(); @@ -150,7 +156,7 @@ public class JarProcessorExecutor { if (input.isDirectory()) { files = input.listFiles(); } else if (filter.accept(input)) { - files = new File[] {input}; + files = new File[] { input }; } else return; for (int i = 0; i < files.length; i++) { @@ -190,7 +196,8 @@ public class JarProcessorExecutor { } } - protected void processDirectory(File input, FileFilter filter, boolean verbose, JarProcessor processor, Properties packProperties) throws FileNotFoundException { + protected void processDirectory(File input, FileFilter filter, boolean verbose, JarProcessor processor, + Properties packProperties) throws FileNotFoundException { if (!input.isDirectory()) return; String dir = processor.getWorkingDirectory(); @@ -199,19 +206,26 @@ public class JarProcessorExecutor { processor.setWorkingDirectory(dir); } - public void addPackUnpackStep(JarProcessor processor, Properties properties, JarProcessorExecutor.Options processOptions) { + @Deprecated(forRemoval = true, since = "1.2.0") + public void addPackUnpackStep(JarProcessor processor, Properties properties, + JarProcessorExecutor.Options processOptions) { processor.addProcessStep(new PackUnpackStep(properties, processOptions.verbose)); } - public void addSignStep(JarProcessor processor, Properties properties, JarProcessorExecutor.Options processOptions) { + public void addSignStep(JarProcessor processor, Properties properties, + JarProcessorExecutor.Options processOptions) { processor.addProcessStep(new SignCommandStep(properties, processOptions.signCommand, processOptions.verbose)); } - public void addPackStep(JarProcessor processor, Properties properties, JarProcessorExecutor.Options processOptions) { + @Deprecated(forRemoval = true, since = "1.2.0") + public void addPackStep(JarProcessor processor, Properties properties, + JarProcessorExecutor.Options processOptions) { processor.addProcessStep(new PackStep(properties, processOptions.verbose)); } - public void addUnpackStep(JarProcessor processor, Properties properties, JarProcessorExecutor.Options processOptions) { + @Deprecated(forRemoval = true, since = "1.2.0") + public void addUnpackStep(JarProcessor processor, Properties properties, + JarProcessorExecutor.Options processOptions) { processor.addProcessStep(new UnpackStep(properties, processOptions.verbose)); } } 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 e70ffb4fe..475b33fed 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, 2017 IBM Corporation and others. + * Copyright (c) 2007, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -21,9 +21,8 @@ import org.apache.tools.ant.types.FileSet; import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessorExecutor.Options; /** - * This task provides massaging facilities for jar files. - * It supports: signing, unsigning, normalization, packing - * - + * This task provides massaging facilities for jar files. It supports: signing, + * unsigning, normalization, packing - */ public class JarProcessorTask extends Task { private final Options options = new Options(); @@ -66,11 +65,15 @@ public class JarProcessorTask extends Task { signArgs.setProperty(KEYPASS, keypass); } + @Deprecated(forRemoval = true, since = "1.2.0") public void setPack(boolean pack) { + log("Support for pack200 is scheduled for removal after June 2023.", Project.MSG_WARN); //$NON-NLS-1$ options.pack = pack; } + @Deprecated(forRemoval = true, since = "1.2.0") public void setNormalize(boolean normalize) { + log("Support for pack200 is scheduled for removal after June 2023.", Project.MSG_WARN); //$NON-NLS-1$ options.repack = normalize; } @@ -88,12 +91,13 @@ public class JarProcessorTask extends Task { } } + @SuppressWarnings("removal") private void adjustAndValidateConfiguration() { - //Sign and pack implies a normalization + // Sign and pack implies a normalization if (options.signCommand != null && options.pack) options.repack = true; - //Check that alias, and storepass are set + // Check that alias, and storepass are set if (options.signCommand != null && signArgs.getProperty(UNSIGN) == null) { if (signArgs.getProperty(ALIAS) == null) throw new BuildException("Alias must be set"); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/.classpath b/bundles/org.eclipse.equinox.p2.metadata.repository/.classpath index 030607499..cc48f9f27 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/.classpath +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" output="bin_ant" path="src_ant"/> diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.core.prefs index f7e77d791..c9e5b47b7 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.core.prefs @@ -16,9 +16,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -34,6 +34,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -87,6 +88,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -122,7 +124,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -136,7 +139,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -257,7 +259,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -328,7 +329,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -473,7 +473,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF index b2f0e902b..a1e7379eb 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.metadata.repository;singleton:=true -Bundle-Version: 1.3.500.qualifier +Bundle-Version: 1.4.0.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.equinox.internal.p2.metadata.repository; @@ -44,5 +44,5 @@ Import-Package: javax.xml.parsers, org.xml.sax Service-Component: OSGI-INF/repositoryManager.xml Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.eclipse.equinox.p2.metadata.repository diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/pom.xml b/bundles/org.eclipse.equinox.p2.metadata.repository/pom.xml index c112723f5..4058eb8f1 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/pom.xml +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/pom.xml @@ -14,11 +14,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.metadata.repository</artifactId> - <version>1.3.500-SNAPSHOT</version> + <version>1.4.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.metadata/.classpath b/bundles/org.eclipse.equinox.p2.metadata/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/.classpath +++ b/bundles/org.eclipse.equinox.p2.metadata/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.metadata/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.jdt.core.prefs index 90e10df7d..b9b3eb020 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.jdt.core.prefs @@ -18,9 +18,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -37,6 +37,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -94,6 +95,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -130,7 +132,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -144,7 +147,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -265,7 +267,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -336,7 +337,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -481,7 +481,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF index 86573a6fe..115163dbf 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.metadata;singleton:=true -Bundle-Version: 2.5.100.qualifier +Bundle-Version: 2.6.100.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.equinox.internal.p2.metadata; @@ -85,5 +85,5 @@ Import-Package: org.eclipse.osgi.service.localization;version="1.0.0", org.eclipse.osgi.util, org.osgi.framework;version="1.6.0" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.eclipse.equinox.p2.metadata diff --git a/bundles/org.eclipse.equinox.p2.metadata/pom.xml b/bundles/org.eclipse.equinox.p2.metadata/pom.xml index ec18d0c7e..bf0807827 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/pom.xml +++ b/bundles/org.eclipse.equinox.p2.metadata/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.metadata</artifactId> - <version>2.5.100-SNAPSHOT</version> + <version>2.6.100-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java index e1fdaa4b3..7d49b306d 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java @@ -41,7 +41,7 @@ import org.eclipse.equinox.p2.metadata.expression.IMemberProvider; public class InstallableUnit implements IInstallableUnit, IMemberProvider { @SuppressWarnings("serial") - private static final Map<IFilterExpression, IMatchExpression<IInstallableUnit>> filterCache = new LinkedHashMap<IFilterExpression, IMatchExpression<IInstallableUnit>>() { + private static final Map<IFilterExpression, IMatchExpression<IInstallableUnit>> filterCache = new LinkedHashMap<>() { @Override public boolean removeEldestEntry(Map.Entry<IFilterExpression, IMatchExpression<IInstallableUnit>> expr) { return size() > 64; @@ -73,7 +73,8 @@ public class InstallableUnit implements IInstallableUnit, IMemberProvider { static { IExpressionFactory factory = ExpressionUtil.getFactory(); - filterWrap = factory.matches(factory.member(factory.thisVariable(), MEMBER_PROPERTIES), factory.indexedParameter(0)); + filterWrap = factory.matches(factory.member(factory.thisVariable(), MEMBER_PROPERTIES), + factory.indexedParameter(0)); } private IArtifactKey[] artifacts = NO_ARTIFACTS; @@ -108,7 +109,7 @@ public class InstallableUnit implements IInstallableUnit, IMemberProvider { public void addTouchpointData(ITouchpointData newData) { int tl = touchpointData.length; if (tl == 0) - touchpointData = new ITouchpointData[] {newData}; + touchpointData = new ITouchpointData[] { newData }; else { ITouchpointData[] newDatas = new ITouchpointData[tl + 1]; System.arraycopy(touchpointData, 0, newDatas, 0, tl); @@ -168,8 +169,8 @@ public class InstallableUnit implements IInstallableUnit, IMemberProvider { } /** - * Get an <i>unmodifiable copy</i> of the properties - * associated with the installable unit. + * Get an <i>unmodifiable copy</i> of the properties associated with the + * installable unit. * * @return an <i>unmodifiable copy</i> of the IU properties. */ @@ -310,7 +311,7 @@ public class InstallableUnit implements IInstallableUnit, IMemberProvider { if (capabilities.length == 0) { this.requires = NO_REQUIRES; } else { - //copy array for safety + // copy array for safety this.requires = capabilities.clone(); } } @@ -388,7 +389,7 @@ public class InstallableUnit implements IInstallableUnit, IMemberProvider { if (metaReqs.length == 0) { this.metaRequires = NO_REQUIRES; } else { - //copy array for safety + // copy array for safety this.metaRequires = metaReqs.clone(); } } diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Member.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Member.java index 16079f8ea..36d09904c 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Member.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Member.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Cloudsmith Inc. and others. + * Copyright (c) 2009, 2021 Cloudsmith Inc. and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -13,29 +13,36 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.metadata.expression; -import java.lang.reflect.*; -import java.util.*; -import org.eclipse.equinox.p2.metadata.expression.*; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Map; +import java.util.Optional; +import java.util.Queue; +import org.eclipse.equinox.p2.metadata.expression.IEvaluationContext; +import org.eclipse.equinox.p2.metadata.expression.IExpressionVisitor; +import org.eclipse.equinox.p2.metadata.expression.IMemberProvider; /** - * <p>An expression that performs member calls to obtain some value - * from some object instance. It uses standard bean semantics so - * that an attempt to obtain "value" will cause an - * attempt to call <code>getValue()</code> and if no such method - * exists, <code>isValue()</code> and if that doesn't work either, - * <code>value()</code>.</p> + * <p> + * An expression that performs member calls to obtain some value from some + * object instance. It uses standard bean semantics so that an attempt to obtain + * "value" will cause an attempt to call <code>getValue()</code> and + * if no such method exists, <code>isValue()</code> and if that doesn't work + * either, <code>value()</code>. + * </p> */ public abstract class Member extends Unary { public static final class DynamicMember extends Member { private static final String GET_PREFIX = "get"; //$NON-NLS-1$ private static final String IS_PREFIX = "is"; //$NON-NLS-1$ - private static final Class<?>[] NO_ARG_TYPES = new Class[0]; - private Class<?> lastClass; - - private transient Method method; - private transient String methodName; + private transient Method lastMethod; DynamicMember(Expression operand, String name) { super(operand, name, Expression.emptyArray); @@ -53,44 +60,14 @@ public abstract class Member extends Unary { if (self == null) throw new IllegalArgumentException("Cannot access member \'" + name + "\' in null"); //$NON-NLS-1$//$NON-NLS-2$ - Class<?> c = self.getClass(); synchronized (this) { - if (methodName == null) { - String n = name; - if (!(n.startsWith(GET_PREFIX) || n.startsWith(IS_PREFIX))) - n = GET_PREFIX + Character.toUpperCase(n.charAt(0)) + n.substring(1); - methodName = n; - } - if (lastClass == null || !lastClass.isAssignableFrom(c)) { - Method m; - for (;;) { - try { - m = c.getMethod(methodName, NO_ARG_TYPES); - if (!Modifier.isPublic(m.getModifiers())) - throw new NoSuchMethodException(); - break; - } catch (NoSuchMethodException e) { - if (methodName.startsWith(GET_PREFIX)) - // Switch from using getXxx() to isXxx() - methodName = IS_PREFIX + Character.toUpperCase(name.charAt(0)) + name.substring(1); - else if (methodName.startsWith(IS_PREFIX)) - // Switch from using isXxx() to xxx() - methodName = name; - else - throw new IllegalArgumentException("Cannot find a public member \'" + name + "\' in a " + self.getClass().getName()); //$NON-NLS-1$//$NON-NLS-2$ - } - } - - // Since we already checked that it's public. This will speed - // up the calls a bit. - m.setAccessible(true); - lastClass = c; - method = m; - } - + final Method method = (lastMethod != null && lastMethod.getDeclaringClass().isInstance(self)) + ? lastMethod + : findAccessibleMethod(self, name); + this.lastMethod = method; Exception checked; try { - return method.invoke(self, NO_ARGS); + return method.invoke(self); } catch (IllegalArgumentException e) { throw e; } catch (IllegalAccessException e) { @@ -103,8 +80,54 @@ public abstract class Member extends Unary { throw (Error) cause; checked = (Exception) cause; } - throw new RuntimeException("Problem invoking " + methodName + " on a " + self.getClass().getName(), checked); //$NON-NLS-1$ //$NON-NLS-2$ + throw new RuntimeException( + "Problem invoking " + method.getName() + " on a " + self.getClass().getName(), //$NON-NLS-1$ //$NON-NLS-2$ + checked); + } + } + + private Collection<String> getMethodNames(String propertyName) { + Collection<String> res = new ArrayList<>(3); + String n = propertyName; + res.add(propertyName); // obj.value() + if (!(n.startsWith(GET_PREFIX) || n.startsWith(IS_PREFIX))) { + res.add(GET_PREFIX + Character.toUpperCase(n.charAt(0)) + n.substring(1)); // obj.getValue() + res.add(IS_PREFIX + Character.toUpperCase(n.charAt(0)) + n.substring(1)); // obj.isValue() + } + return res; + } + + private Method findAccessibleMethod(Object self, String propertyName) { + Collection<String> methodNamesToTry = getMethodNames(propertyName); + Queue<Class<?>> typesToTry = new LinkedList<>(); + typesToTry.add(self.getClass()); + while (!typesToTry.isEmpty()) { + Class<?> currentClass = typesToTry.poll(); + for (String methodName : methodNamesToTry) { + try { + Method m = currentClass.getMethod(methodName); + if (!m.canAccess(self)) { + try { + // force accessible if possible. + // this seems necessary when invoking objects from + // nested class and "downstream" bundles + m.setAccessible(true); + } catch (Exception e) { + // ignore possible non-blocking case + } + } + if (m.canAccess(self)) { + return m; + } + } catch (NoSuchMethodException e) { + // ignore not found method + } + } + Optional.ofNullable(currentClass.getSuperclass()).ifPresent(typesToTry::add); + typesToTry.addAll(Arrays.asList(currentClass.getInterfaces())); } + throw new IllegalArgumentException("Cannot find accessor method for property \'" + name + "\' in a " //$NON-NLS-1$//$NON-NLS-2$ + + self.getClass().getName()); } } @@ -153,8 +176,6 @@ public abstract class Member extends Unary { } } - static final Object[] NO_ARGS = new Object[0]; - static Member createDynamicMember(Expression operand, String name) { return new DynamicMember(operand, name); } diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/expression/SimplePattern.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/expression/SimplePattern.java index 2b088c077..b844ee817 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/expression/SimplePattern.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/expression/SimplePattern.java @@ -182,7 +182,7 @@ public class SimplePattern implements Serializable, Comparable<SimplePattern> { private static Node parse(String pattern, int pos) { int top = pattern.length(); - StringBuffer bld = null; + StringBuilder bld = null; Node parsedNode = null; while (pos < top) { char c = pattern.charAt(pos); @@ -201,7 +201,7 @@ public class SimplePattern implements Serializable, Comparable<SimplePattern> { // fall through default : if (bld == null) - bld = new StringBuffer(); + bld = new StringBuilder(); bld.append(c); ++pos; continue; diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/Collector.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/Collector.java index 5be87df5b..ffa0d6f47 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/Collector.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/Collector.java @@ -25,20 +25,21 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.metadata.Messages; /** - * A collector is a generic visitor that collects objects passed to it, - * and can then express the result of the visit in various forms. The collector - * can also short-circuit a traversal by returning <code>false</code> from - * its {@link #accept(Object)} method. + * A collector is a generic visitor that collects objects passed to it, and can + * then express the result of the visit in various forms. The collector can also + * short-circuit a traversal by returning <code>false</code> from its + * {@link #accept(Object)} method. * <p> - * This default collector just accepts all objects passed to it. Clients may subclass - * to perform different processing on the objects passed to it. + * This default collector just accepts all objects passed to it. Clients may + * subclass to perform different processing on the objects passed to it. + * * @param <T> The type of object accepted by this collector * @since 2.0 */ public class Collector<T> implements IQueryResult<T> { private Set<T> collected = null; - public static final Collector<?> EMPTY_COLLECTOR = new Collector<Object>() { + public static final Collector<?> EMPTY_COLLECTOR = new Collector<>() { @Override public boolean accept(Object val) { return false; @@ -60,14 +61,14 @@ public class Collector<T> implements IQueryResult<T> { /** * Accepts an object. * <p> - * This default implementation adds the objects to a list. Clients may - * override this method to perform additional filtering, add different objects - * to the list, short-circuit the traversal, or process the objects directly without + * This default implementation adds the objects to a list. Clients may override + * this method to perform additional filtering, add different objects to the + * list, short-circuit the traversal, or process the objects directly without * collecting them. * * @param object the object to collect or visit - * @return <code>true</code> if the traversal should continue, - * or <code>false</code> to indicate the traversal should stop. + * @return <code>true</code> if the traversal should continue, or + * <code>false</code> to indicate the traversal should stop. */ public boolean accept(T object) { getCollection().add(object); @@ -76,6 +77,7 @@ public class Collector<T> implements IQueryResult<T> { /** * Adds the elements from one collector to this collector + * * @param queryResult The collector from which the elements should be retrieved */ public void addAll(IQueryResult<T> queryResult) { @@ -86,10 +88,10 @@ public class Collector<T> implements IQueryResult<T> { } /** - * Returns the collection that is being used to collect results. Unlike {@linkplain #toSet()}, - * this returns the actual modifiable collection that is being used to store results. The - * return value is only intended to be used within subclasses and should not be exposed - * outside of a collection class. + * Returns the collection that is being used to collect results. Unlike + * {@linkplain #toSet()}, this returns the actual modifiable collection that is + * being used to store results. The return value is only intended to be used + * within subclasses and should not be exposed outside of a collection class. * * @return the collection being used to collect results. */ @@ -101,8 +103,9 @@ public class Collector<T> implements IQueryResult<T> { /** * Returns whether this collector is empty. - * @return <code>true</code> if this collector has accepted any results, - * and <code>false</code> otherwise. + * + * @return <code>true</code> if this collector has accepted any results, and + * <code>false</code> otherwise. */ @Override public boolean isEmpty() { @@ -116,7 +119,7 @@ public class Collector<T> implements IQueryResult<T> { */ @Override public Iterator<T> iterator() { - return collected == null ? Collections.<T> emptyList().iterator() : collected.iterator(); + return collected == null ? Collections.<T>emptyList().iterator() : collected.iterator(); } /** @@ -131,8 +134,9 @@ public class Collector<T> implements IQueryResult<T> { * * @param clazz The type of array to return * @return The array of results - * @throws ArrayStoreException the runtime type of the specified array is - * not a super-type of the runtime type of every collected object + * @throws ArrayStoreException the runtime type of the specified array is not a + * super-type of the runtime type of every collected + * object */ @Override public T[] toArray(Class<T> clazz) { @@ -155,7 +159,7 @@ public class Collector<T> implements IQueryResult<T> { } /** - * Performs a query on this results of this collector. + * Performs a query on this results of this collector. */ @Override public IQueryResult<T> query(IQuery<T> query, IProgressMonitor monitor) { diff --git a/bundles/org.eclipse.equinox.p2.operations/.classpath b/bundles/org.eclipse.equinox.p2.operations/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.operations/.classpath +++ b/bundles/org.eclipse.equinox.p2.operations/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.operations/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.operations/.settings/org.eclipse.jdt.core.prefs index b6ee06ea1..3c15076cc 100644 --- a/bundles/org.eclipse.equinox.p2.operations/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.operations/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -36,6 +36,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -89,6 +90,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -125,7 +127,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -139,7 +142,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -260,7 +262,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -331,7 +332,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -476,7 +476,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF index 8c7f57e68..acddebfb1 100644 --- a/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF @@ -2,14 +2,14 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.operations;singleton:=true -Bundle-Version: 2.5.1000.qualifier +Bundle-Version: 2.6.0.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.equinox.internal.p2.operations;x-friends:="org.eclipse.pde.ui,org.eclipse.equinox.p2.ui", org.eclipse.equinox.p2.operations;version="2.0.0" Require-Bundle: org.eclipse.equinox.common;bundle-version="3.6.0", org.eclipse.core.jobs;bundle-version="3.5.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.equinox.internal.p2.core.helpers, org.eclipse.equinox.internal.p2.director, diff --git a/bundles/org.eclipse.equinox.p2.operations/pom.xml b/bundles/org.eclipse.equinox.p2.operations/pom.xml index a3e311547..ed63d9000 100644 --- a/bundles/org.eclipse.equinox.p2.operations/pom.xml +++ b/bundles/org.eclipse.equinox.p2.operations/pom.xml @@ -14,11 +14,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.operations</artifactId> - <version>2.5.1000-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/.classpath b/bundles/org.eclipse.equinox.p2.publisher.eclipse/.classpath index 030607499..cc48f9f27 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/.classpath +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" output="bin_ant" path="src_ant"/> diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.publisher.eclipse/.settings/org.eclipse.jdt.core.prefs index aac18542e..3fefd7217 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -35,6 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -92,6 +93,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -127,7 +129,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -141,7 +144,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -262,7 +264,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -333,7 +334,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -478,7 +478,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.publisher.eclipse/.settings/org.eclipse.jdt.ui.prefs index 708515333..d3d075e63 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/.settings/org.eclipse.jdt.ui.prefs +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/.settings/org.eclipse.jdt.ui.prefs @@ -23,7 +23,7 @@ sp_cleanup.always_use_this_for_non_static_method_access=false sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false +sp_cleanup.format_source_code_changes_only=true sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=true diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.publisher.eclipse/META-INF/MANIFEST.MF index f0ca32b78..0a8d62359 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/META-INF/MANIFEST.MF @@ -2,12 +2,12 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-SymbolicName: org.eclipse.equinox.p2.publisher.eclipse;singleton:=true -Bundle-Version: 1.3.800.qualifier +Bundle-Version: 1.4.2.qualifier Bundle-Activator: org.eclipse.pde.internal.publishing.Activator Bundle-ActivationPolicy: lazy Bundle-Vendor: %providerName Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Import-Package: org.eclipse.equinox.app;version="[1.0.0,2.0.0)", org.eclipse.equinox.frameworkadmin;version="[2.0.0,3.0.0)", org.eclipse.equinox.internal.frameworkadmin.equinox, diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/pom.xml b/bundles/org.eclipse.equinox.p2.publisher.eclipse/pom.xml index 98319e5aa..cf46b80e9 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/pom.xml +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/pom.xml @@ -4,12 +4,12 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.publisher.eclipse</artifactId> - <version>1.3.800-SNAPSHOT</version> + <version>1.4.2-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/compatibility/IGeneratorConstants.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/compatibility/IGeneratorConstants.java index b2c980f8d..b81373dc0 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/compatibility/IGeneratorConstants.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/compatibility/IGeneratorConstants.java @@ -21,7 +21,7 @@ package org.eclipse.equinox.internal.p2.publisher.compatibility; public interface IGeneratorConstants { public static final String DASH = "-"; //$NON-NLS-1$ - //arguments understood by the old metadata generator application + // arguments understood by the old metadata generator application public static final String PUBLISH_ARTIFACTS = "-publishArtifacts"; //$NON-NLS-1$ public static final String PA = "-pa"; //$NON-NLS-1$ public static final String PUBLISH_ATIFACT_REPOSITORY = "-publishArtifactRepository"; //$NON-NLS-1$ @@ -29,6 +29,11 @@ public interface IGeneratorConstants { public static final String APPEND = "-append"; //$NON-NLS-1$ public static final String NO_DEFAULT_IUS = "-noDefaultIUs"; //$NON-NLS-1$ public static final String COMPRESS = "-compress"; //$NON-NLS-1$ + /** + * @noreference This field is not intended to be referenced by clients. + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. + */ + @Deprecated(forRemoval = true, since = "1.6.0") public static final String REUSE_PACK200 = "-reusePack200Files"; //$NON-NLS-1$ public static final String SOURCE = "-source"; //$NON-NLS-1$ public static final String INPLACE = "-inplace"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/BrandingIron.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/BrandingIron.java index b1114b4c7..a6c14f134 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/BrandingIron.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/BrandingIron.java @@ -315,9 +315,11 @@ public class BrandingIron { descriptor.addFile(targetLauncher); } - private File findLauncher(File root) { - for (String launcherName : new String[] { "launcher", "eclipse" }) { //$NON-NLS-1$ //$NON-NLS-2$ - File launcher = new File(root, launcherName); + private File findLauncher(File root, String... candidates) { + if (candidates.length == 0) + candidates = new String[] { "launcher", "eclipse" }; //$NON-NLS-1$ //$NON-NLS-2$ + for (String candidate : candidates) { + File launcher = new File(root, candidate); if (launcher.exists()) return launcher; } @@ -359,26 +361,38 @@ public class BrandingIron { private void brandWindows(ExecutablesDescriptor descriptor) throws Exception { File root = descriptor.getLocation(); - File templateLauncher = new File(root, name + ".exe"); //$NON-NLS-1$ - if (!templateLauncher.exists()) - templateLauncher = new File(root, "launcher.exe"); //$NON-NLS-1$ - if (!templateLauncher.exists()) - templateLauncher = new File(root, "eclipse.exe"); //$NON-NLS-1$ - if (brandIcons) { - if (templateLauncher.exists()) { + String binary = name + ".exe"; //$NON-NLS-1$ + File templateLauncher = findLauncher(root, binary, "launcher.exe", "eclipse.exe"); //$NON-NLS-1$ //$NON-NLS-2$ + if (templateLauncher != null) { + if (brandIcons) { String[] args = new String[icons.length + 1]; args[0] = templateLauncher.getAbsolutePath(); System.arraycopy(icons, 0, args, 1, icons.length); IconExe.main(args); - } else { - LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Could not find executable to brand", null)); //$NON-NLS-1$ } + + if (!templateLauncher.getName().equals(binary)) { + File targetLauncher = new File(root, binary); + templateLauncher.renameTo(targetLauncher); + descriptor.replace(templateLauncher, targetLauncher); + } + } else { + LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Could not find executable to brand", null)); //$NON-NLS-1$ } - File targetLauncher = new File(root, name + ".exe"); //$NON-NLS-1$ - if (templateLauncher.exists() && !templateLauncher.getName().equals(name + ".exe")) { //$NON-NLS-1$ - templateLauncher.renameTo(targetLauncher); - descriptor.replace(templateLauncher, targetLauncher); + + // Handle console application + binary = name + "c.exe"; //$NON-NLS-1$ + templateLauncher = findLauncher(root, binary, "launcherc.exe", "eclipsec.exe"); //$NON-NLS-1$ //$NON-NLS-2$ + if (templateLauncher != null) { + if (!templateLauncher.getName().equals(binary)) { + File targetLauncher = new File(root, binary); + templateLauncher.renameTo(targetLauncher); + descriptor.replace(templateLauncher, targetLauncher); + } + } else { + LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Could not find console executable to brand", null)); //$NON-NLS-1$ } + descriptor.setExecutableName(name, true); } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java index 353aab166..5b1c6f82e 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java @@ -245,10 +245,6 @@ public class ExecutablesDescriptor { private void updateExecutableName(String newName) { if (newName.equalsIgnoreCase(executableName)) return; - String targetIni = executableName + ".ini"; //$NON-NLS-1$ - String targetExecutable = executableName; - String executableExtension = Constants.OS_WIN32.equals(os) ? ".exe" : ""; //$NON-NLS-1$ //$NON-NLS-2$ - targetExecutable = executableName + executableExtension; Set<File> filesCopy = new HashSet<>(files); for (File file : filesCopy) { String base = file.getParent(); @@ -257,9 +253,13 @@ public class ExecutablesDescriptor { base = base == null ? "" : base + "/"; //$NON-NLS-1$ //$NON-NLS-2$ if (Constants.OS_MACOSX.equals(os) && base.startsWith(executableName + ".app")) //$NON-NLS-1$ base = newName + ".app" + base.substring(executableName.length() + 4); //$NON-NLS-1$ - if (file.getName().equalsIgnoreCase(targetExecutable)) - replace(file, new File(base + newName + executableExtension)); - else if (file.getName().equalsIgnoreCase(targetIni)) + if (file.getName().equalsIgnoreCase(executableName)) + replace(file, new File(base + newName)); + else if (file.getName().equalsIgnoreCase(executableName + ".exe")) //$NON-NLS-1$ + replace(file, new File(base + newName + ".exe")); //$NON-NLS-1$ + else if (file.getName().equalsIgnoreCase(executableName + "c.exe")) //$NON-NLS-1$ + replace(file, new File(base + newName + "c.exe")); //$NON-NLS-1$ + else if (file.getName().equalsIgnoreCase(executableName + ".ini")) //$NON-NLS-1$ replace(file, new File(base + newName + ".ini")); //$NON-NLS-1$ else if (Constants.OS_MACOSX.equals(os)) replace(file, new File(base + file.getName())); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java index aabf3db8b..f05207712 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2018 Code 9 and others. + * Copyright (c) 2008, 2021 Code 9 and others. * * This * program and the accompanying materials are made available under the terms of @@ -14,6 +14,7 @@ * IBM - ongoing development * SAP AG - make optional dependencies non-greedy by default; allow setting greedy through directive (bug 247099) * Red Hat Inc. - Bug 460967 + * Christoph Läubrich - Bug 574952 p2 should distinguish between "product plugins" and "configuration plugins" (gently sponsored by Compart AG) ******************************************************************************/ package org.eclipse.equinox.p2.publisher.eclipse; @@ -136,6 +137,13 @@ public class BundlesAction extends AbstractPublisherAction { public static IInstallableUnit createBundleConfigurationUnit(String hostId, Version cuVersion, boolean isBundleFragment, GeneratorBundleInfo configInfo, String configurationFlavor, IMatchExpression<IInstallableUnit> filter) { + return createBundleConfigurationUnit(hostId, cuVersion, isBundleFragment, configInfo, configurationFlavor, + filter, false); + } + + static IInstallableUnit createBundleConfigurationUnit(String hostId, Version cuVersion, + boolean isBundleFragment, GeneratorBundleInfo configInfo, String configurationFlavor, + IMatchExpression<IInstallableUnit> filter, boolean configOnly) { if (configInfo == null) return null; @@ -145,7 +153,7 @@ public class BundlesAction extends AbstractPublisherAction { cu.setVersion(cuVersion); // Indicate the IU to which this CU apply - Version hostVersion = Version.parseVersion(configInfo.getVersion()); + Version hostVersion = configOnly ? Version.emptyVersion : Version.parseVersion(configInfo.getVersion()); VersionRange range = hostVersion == Version.emptyVersion ? VersionRange.emptyRange : new VersionRange(hostVersion, true, Version.MAX_VERSION, true); cu.setHost(new IRequirement[] { // @@ -932,6 +940,7 @@ public class BundlesAction extends AbstractPublisherAction { if (reuse && (publisherInfo.getArtifactOptions() & IPublisherInfo.A_PUBLISH) > 0) { File packFile = new Path(jarFile.getAbsolutePath()).addFileExtension("pack.gz").toFile(); //$NON-NLS-1$ if (packFile.exists()) { + @SuppressWarnings("removal") IArtifactDescriptor ad200 = createPack200ArtifactDescriptor(descriptor.getArtifactKey(), packFile, descriptor.getProperty(IArtifactDescriptor.ARTIFACT_SIZE)); publishArtifact(ad200, packFile, publisherInfo); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java index 823000c2b..ba349e047 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Code 9 and others. + * Copyright (c) 2008, 2021 Code 9 and others. * * This * program and the accompanying materials are made available under the terms of @@ -13,12 +13,14 @@ * Code 9 - initial API and implementation * IBM - ongoing development * Rapicorp - ongoing development + * Christoph Läubrich - Bug 574952 p2 should distinguish between "product plugins" and "configuration plugins" (gently sponsored by Compart AG) ******************************************************************************/ package org.eclipse.equinox.p2.publisher.eclipse; import java.io.File; import java.util.*; import java.util.Map.Entry; +import java.util.stream.Collectors; import org.eclipse.core.runtime.*; import org.eclipse.equinox.frameworkadmin.BundleInfo; import org.eclipse.equinox.internal.p2.metadata.TouchpointInstruction; @@ -106,7 +108,12 @@ public class ConfigCUsAction extends AbstractPublisherAction { String configSpec = configSpec1; Collection<IConfigAdvice> configAdvice = publisherInfo.getAdvice(configSpec, false, id, version, IConfigAdvice.class); BundleInfo[] bundles = fillInBundles(configAdvice, results); - publishBundleCUs(publisherInfo, bundles, configSpec, innerResult); + Set<String> configBundles = configAdvice.stream().filter(ProductFileAdvice.class::isInstance) + .map(ProductFileAdvice.class::cast).flatMap(pca -> pca.getBundles(true)) + .map(BundleInfo::getSymbolicName).filter(Objects::nonNull) + .distinct() + .collect(Collectors.toSet()); + publishBundleCUs(publisherInfo, bundles, configSpec, innerResult, configBundles); publishConfigIUs(configAdvice, innerResult, configSpec); Collection<IExecutableAdvice> launchingAdvice = publisherInfo.getAdvice(configSpec, false, id, version, IExecutableAdvice.class); publishIniIUs(launchingAdvice, innerResult, configSpec); @@ -324,10 +331,13 @@ public class ConfigCUsAction extends AbstractPublisherAction { } /** - * Publish the CUs related to the given set of bundles. This generally covers the start-level and - * and whether or not the bundle is to be started. + * Publish the CUs related to the given set of bundles. This generally covers + * the start-level and and whether or not the bundle is to be started. + * + * @param configBundles */ - protected void publishBundleCUs(IPublisherInfo publisherInfo, BundleInfo[] bundles, String configSpec, IPublisherResult result) { + protected void publishBundleCUs(IPublisherInfo publisherInfo, BundleInfo[] bundles, String configSpec, + IPublisherResult result, Set<String> configBundles) { if (bundles == null) return; @@ -338,24 +348,28 @@ public class ConfigCUsAction extends AbstractPublisherAction { filter = createFilterSpec(configSpec); } - for (BundleInfo bundle1 : bundles) { - GeneratorBundleInfo bundle = createGeneratorBundleInfo(bundle1, result); - if (bundle == null) + for (BundleInfo bundleInfo : bundles) { + GeneratorBundleInfo generatorBundle = createGeneratorBundleInfo(bundleInfo, result); + if (generatorBundle == null) continue; - IInstallableUnit iu = bundle.getIU(); + IInstallableUnit iu = generatorBundle.getIU(); // If there is no host, or the filters don't match, skip this one. if (iu == null || !filterMatches(iu.getFilter(), configSpec)) continue; - if (bundle.getStartLevel() == BundleInfo.NO_LEVEL && !bundle.isMarkedAsStarted()) { + if (generatorBundle.getStartLevel() == BundleInfo.NO_LEVEL && !generatorBundle.isMarkedAsStarted()) { // this bundle does not require any particular configuration, the plug-in // default IU will handle installing it continue; } - IInstallableUnit cu = null; - if (this.version != null && !this.version.equals(Version.emptyVersion)) - cu = BundlesAction.createBundleConfigurationUnit(bundle.getSymbolicName(), this.version, false, bundle, flavor + cuIdPrefix, filter); - else - cu = BundlesAction.createBundleConfigurationUnit(bundle.getSymbolicName(), Version.parseVersion(bundle.getVersion()), false, bundle, flavor + cuIdPrefix, filter); + IInstallableUnit cu; + if (configBundles.contains(bundleInfo.getSymbolicName())) { + cu = BundlesAction.createBundleConfigurationUnit(generatorBundle.getSymbolicName(), this.version, false, generatorBundle, + flavor + cuIdPrefix, filter, true); + } else if (this.version != null && !this.version.equals(Version.emptyVersion)) { + cu = BundlesAction.createBundleConfigurationUnit(generatorBundle.getSymbolicName(), this.version, false, generatorBundle, flavor + cuIdPrefix, filter); + } else { + cu = BundlesAction.createBundleConfigurationUnit(generatorBundle.getSymbolicName(), Version.parseVersion(generatorBundle.getVersion()), false, generatorBundle, flavor + cuIdPrefix, filter); + } if (cu != null) { // Product Query will run against the repo, make sure these CUs are in before then // TODO review the aggressive addition to the metadata repo. perhaps the query can query the result as well. diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java index 0e8fa0dd7..e3ec91b39 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java @@ -292,6 +292,10 @@ public class EquinoxExecutableAction extends AbstractPublisherAction { File newFile = new File(file.getParentFile(), "eclipse.exe"); //$NON-NLS-1$ file.renameTo(newFile); descriptor.replace(file, newFile); + } else if (file.getName().equals("launcherc.exe")) { //$NON-NLS-1$ + File newFile = new File(file.getParentFile(), "eclipsec.exe"); //$NON-NLS-1$ + file.renameTo(newFile); + descriptor.replace(file, newFile); } } } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java index cbc41b8c6..d11aaa39d 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java @@ -614,7 +614,14 @@ public class FeaturesAction extends AbstractPublisherAction { // artifact per feature IU. Collection<IArtifactKey> artifacts = featureIU.getArtifacts(); for (IArtifactKey artifactKey : artifacts) { - File file = new File(feature.getLocation()); + String location = feature.getLocation(); + if (location == null) { + if (PublisherHelper.isArtifactPublish(publisherInfo)) { + throw new IllegalArgumentException(NLS.bind(Messages.exception_sourcePath, feature.getId())); + } + continue; + } + File file = new File(location); ArtifactDescriptor ad = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(info, artifactKey, file); processArtifactPropertiesAdvice(featureIU, ad, publisherInfo); ad.setProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE, IArtifactDescriptor.TYPE_ZIP); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java index 551796a7a..19258375b 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Code 9 and others. + * Copyright (c) 2008, 2021 Code 9 and others. * * This * program and the accompanying materials are made available under the terms of @@ -14,11 +14,14 @@ * EclipseSource - ongoing development * IBM Corporation - ongoing development * Rapicorp - additional features + * Christoph Läubrich - Bug 574952 p2 should distinguish between "product plugins" and "configuration plugins" (gently sponsored by Compart AG) ******************************************************************************/ package org.eclipse.equinox.p2.publisher.eclipse; import java.io.File; import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.eclipse.equinox.frameworkadmin.BundleInfo; import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils; import org.eclipse.equinox.internal.p2.publisher.eclipse.DataLoader; @@ -32,10 +35,11 @@ import org.eclipse.equinox.p2.publisher.actions.ILicenseAdvice; import org.eclipse.equinox.p2.repository.IRepositoryReference; /** - * Provide advice derived from the .product file. The product can give some info on - * launching as well as the configuration (bundles, properties, ...) + * Provide advice derived from the .product file. The product can give some info + * on launching as well as the configuration (bundles, properties, ...) */ -public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, IExecutableAdvice, IConfigAdvice, IBrandingAdvice { +public class ProductFileAdvice extends AbstractAdvice + implements ILicenseAdvice, IExecutableAdvice, IConfigAdvice, IBrandingAdvice { private final static String OSGI_SPLASH_PATH = "osgi.splashPath"; //$NON-NLS-1$ private final static String SPLASH_PREFIX = "platform:/base/plugins/"; //$NON-NLS-1$ private final IProductDescriptor product; @@ -43,7 +47,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, private String ws; private String os; private String arch; - private ConfigData configData = null; + private final ProductConfigData configData; @Override protected String getId() { @@ -56,12 +60,9 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, } /** - * Constructs a new ProductFileAdvice for a given product file and a - * particular configuration. Configurations are - * specified as: ws.os.arch where: - * ws is the windowing system - * os is the operating system - * arch is the architecture + * Constructs a new ProductFileAdvice for a given product file and a particular + * configuration. Configurations are specified as: ws.os.arch where: ws is the + * windowing system os is the operating system arch is the architecture */ public ProductFileAdvice(IProductDescriptor product, String configSpec) { this.product = product; @@ -82,7 +83,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, } /** - * Returns the program arguments for this product. + * Returns the program arguments for this product. */ @Override public String[] getProgramArguments() { @@ -99,32 +100,34 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, return AbstractPublisherAction.getArrayFromString(line, " "); //$NON-NLS-1$ } - /** - * Returns the Bundles that constitute this product. These - * bundles may be specified in the .product file, .product file configuration - * area, config.ini file, or a combination of these three places. - */ @Override public BundleInfo[] getBundles() { - return configData.getBundles(); + return Stream.concat(getBundles(false), getBundles(true)) + .toArray(BundleInfo[]::new); + } + + Stream<BundleInfo> getBundles(boolean configOnly) { + if (configOnly) { + return configData.configBundles.stream(); + } + return Arrays.stream(configData.data.getBundles()); } /** - * Returns the properties associated with this product. These - * properties may be defined in the .product file, the config.ini - * file, or both. + * Returns the properties associated with this product. These properties may be + * defined in the .product file, the config.ini file, or both. */ @Override public Map<String, String> getProperties() { Map<String, String> result = new HashMap<>(); - CollectionUtils.putAll(configData.getProperties(), result); + CollectionUtils.putAll(configData.data.getProperties(), result); result.putAll(product.getConfigurationProperties(os, arch)); return result; } /** - * Returns the name of the launcher. This should be the OS-independent - * name. That is, ".exe" etc. should not be included. + * Returns the name of the launcher. This should be the OS-independent name. + * That is, ".exe" etc. should not be included. * * @return the name of the branded launcher or <code>null</code> if none. */ @@ -179,16 +182,18 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, return product.getRepositoryEntries(); } - private ConfigData getConfigData() { + private ProductConfigData getConfigData() { DataLoader loader = createDataLoader(); ConfigData result; if (loader != null) { result = loader.getConfigData(); - } else + } else { result = generateConfigData(); - - addProductFileBundles(result); // these are the bundles specified in the <plugins/> tag - addProductFileConfigBundles(result); // these are the bundles specified in the <configurations> tag in the product file + } + ProductConfigData data = new ProductConfigData(result); + addProductFileBundles(data); // these are the bundles specified in the <plugins/> tag + addProductFileConfigBundles(data); // these are the bundles specified in the <configurations> tag in the + // product file if (product.getProductId() != null) result.setProperty("eclipse.product", product.getProductId()); //$NON-NLS-1$ if (product.getApplication() != null) @@ -196,70 +201,42 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, String location = getSplashLocation(); if (location != null) result.setProperty(OSGI_SPLASH_PATH, SPLASH_PREFIX + location); - return result; + return data; } - private void addProductFileConfigBundles(ConfigData data) { - Set<BundleInfo> versionBoundBundles = new HashSet<>(); - Map<String, List<BundleInfo>> unboundedBundles = new HashMap<>(); - - BundleInfo[] bundles = data.getBundles(); - for (BundleInfo bundleInfo : bundles) { - // For each bundle we know about, cache it. If the bundle doesn't have a version - // add it to a list of bundles by name - if (bundleInfo.getVersion().equals(BundleInfo.EMPTY_VERSION)) { - addUnboundedBundle(unboundedBundles, bundleInfo); + private void addProductFileConfigBundles(ProductConfigData productConfigData) { + Map<String, List<BundleInfo>> configBundleMap = Arrays.stream(productConfigData.data.getBundles()) + .collect(Collectors.groupingBy(BundleInfo::getSymbolicName)); + for (BundleInfo configBundleInfo : product.getBundleInfos()) { + List<BundleInfo> matches = configBundleMap.get(configBundleInfo.getSymbolicName()); + if (matches == null || matches.isEmpty()) { + // if there is no match in the ConfigData (e.g. plugin or mixed type product) + // simply add this to the list of config bundles + productConfigData.configBundles.add(configBundleInfo); } else { - versionBoundBundles.add(bundleInfo); - addUnboundedBundle(unboundedBundles, bundleInfo); + // otherwise just update the existing data + for (BundleInfo target : matches) { + target.setStartLevel(configBundleInfo.getStartLevel()); + target.setMarkedAsStarted(configBundleInfo.isMarkedAsStarted()); + } } } - - List<BundleInfo> bundleInfos = product.getBundleInfos(); - for (BundleInfo bundleInfo : bundleInfos) { - // For each bundle that has configuration information, if the bundle is in the - // bundles bound by version, add the "configured" bundle instead - // If the bundle is not bound to a version, then replace all bounded versions - // with this one. Otherwise, just add this one (don't replace) - if (versionBoundBundles.contains(bundleInfo)) { - // If we found a version with the same name and version, replace it with the "configured" bundle - data.removeBundle(bundleInfo); - data.addBundle(bundleInfo); - } else if (bundleInfo.getVersion().equals(BundleInfo.EMPTY_VERSION)) { - // If we don't have a version number, look for all bundles that match by name - List<BundleInfo> list = unboundedBundles.get(bundleInfo.getSymbolicName()); - if (list == null) - data.addBundle(bundleInfo); - else - for (BundleInfo target : list) { - target.setStartLevel(bundleInfo.getStartLevel()); - target.setMarkedAsStarted(bundleInfo.isMarkedAsStarted()); - } - } else { - // Otherwise we have a version, but we could not match it, so just add this one. - data.addBundle(bundleInfo); - } - - } - } - - private void addUnboundedBundle(Map<String, List<BundleInfo>> data, BundleInfo bundleInfo) { - if (!data.containsKey(bundleInfo.getSymbolicName())) - data.put(bundleInfo.getSymbolicName(), new LinkedList<BundleInfo>()); - data.get(bundleInfo.getSymbolicName()).add(bundleInfo); } - private void addProductFileBundles(ConfigData data) { + private void addProductFileBundles(ProductConfigData productConfigData) { + if (product.useFeatures()) { + return; + } List<IVersionedId> bundles = product.getBundles(true); Set<BundleInfo> set = new HashSet<>(); - set.addAll(Arrays.asList(data.getBundles())); + set.addAll(Arrays.asList(productConfigData.data.getBundles())); for (IVersionedId vid : bundles) { BundleInfo bundleInfo = new BundleInfo(); bundleInfo.setSymbolicName(vid.getId()); bundleInfo.setVersion(vid.getVersion().toString()); if (!set.contains(bundleInfo)) - data.addBundle(bundleInfo); + productConfigData.data.addBundle(bundleInfo); } } @@ -268,7 +245,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, if (product.useFeatures()) return result; - // Add all the bundles here. We replace / update them later + // Add all the bundles here. We replace / update them later // if we find configuration information List<IVersionedId> bundles = product.getBundles(true); for (IVersionedId vid : bundles) { @@ -295,21 +272,24 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, String targetWS = AbstractPublisherAction.parseConfigSpec(spec)[0]; if (targetWS == null) targetWS = AbstractPublisherAction.CONFIG_ANY; - if (!ws.equals(targetWS) && !ws.equals(AbstractPublisherAction.CONFIG_ANY) && !targetWS.equals(AbstractPublisherAction.CONFIG_ANY)) { + if (!ws.equals(targetWS) && !ws.equals(AbstractPublisherAction.CONFIG_ANY) + && !targetWS.equals(AbstractPublisherAction.CONFIG_ANY)) { return false; } String targetOS = AbstractPublisherAction.parseConfigSpec(spec)[1]; if (targetOS == null) targetOS = AbstractPublisherAction.CONFIG_ANY; - if (!os.equals(targetOS) && !os.equals(AbstractPublisherAction.CONFIG_ANY) && !targetOS.equals(AbstractPublisherAction.CONFIG_ANY)) { + if (!os.equals(targetOS) && !os.equals(AbstractPublisherAction.CONFIG_ANY) + && !targetOS.equals(AbstractPublisherAction.CONFIG_ANY)) { return false; } String targetArch = AbstractPublisherAction.parseConfigSpec(spec)[2]; if (targetArch == null) targetArch = AbstractPublisherAction.CONFIG_ANY; - if (!arch.equals(targetArch) && !arch.equals(AbstractPublisherAction.CONFIG_ANY) && !targetArch.equals(AbstractPublisherAction.CONFIG_ANY)) { + if (!arch.equals(targetArch) && !arch.equals(AbstractPublisherAction.CONFIG_ANY) + && !targetArch.equals(AbstractPublisherAction.CONFIG_ANY)) { return false; } } @@ -325,16 +305,29 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, File configFile = new File(location); // We are assuming we are always relative from the product file - // However PDE tooling puts us relative from the workspace, that "relative" path also looks like an absolute path on linux + // However PDE tooling puts us relative from the workspace, that "relative" path + // also looks like an absolute path on linux // Build may have copied the file to the correct place for us if (!configFile.isAbsolute() || !configFile.exists()) configFile = new File(product.getLocation().getParentFile(), location); - //We don't really have an executable location, get something reasonable based on the config.ini location + // We don't really have an executable location, get something reasonable based + // on the config.ini location File parent = configFile.getParentFile(); if (parent.getName().equals("configuration") && parent.getParentFile() != null) //$NON-NLS-1$ parent = parent.getParentFile(); return new DataLoader(configFile, parent); } + private static final class ProductConfigData { + + private final List<BundleInfo> configBundles = new ArrayList<>(); + private final ConfigData data; + + public ProductConfigData(ConfigData data) { + this.data = data; + } + + } + } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java index 64d908d60..0ba53b888 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -10,11 +10,14 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Christoph Läubrich - refactor to use a more consistent API that allows error propagation to the caller *******************************************************************************/ package org.eclipse.pde.internal.swt.tools; import java.io.*; +import java.text.MessageFormat; import java.util.*; +import java.util.function.Consumer; /** * Customize the icon of a Windows exe @@ -70,24 +73,14 @@ public class IconExe { System.err.println("Usage: IconExe <windows executable> <ico file>"); //$NON-NLS-1$ return; } - ImageLoader loader = new ImageLoader(); + File[] iconFiles = new File[args.length - 1]; + for (int i = 0; i < iconFiles.length; i++) { + iconFiles[i] = new File(args[i + 1]); - List<ImageData> images = new ArrayList<>(); - for (int i = 1; i < args.length; i++) { - try { - //An ICO should contain 7 images, a BMP will contain 1 - ImageData[] current = loader.load(args[i]); - for (ImageData id : current) { - images.add(id); - } - } catch (RuntimeException e) { - //ignore so that we process the other images - } } - ImageData[] data = new ImageData[images.size()]; - data = images.toArray(data); + ImageData[] data = loadImages(iconFiles, System.err::println); - List<IconResInfo> unchangedIcons = unloadIcons(args[0], data); + Collection<IconResInfo> unchangedIcons = replaceIcons(new File(args[0]), data, System.err::println); if (unchangedIcons.size() != 0) { System.err.println(String.format("[IconExe] Error - %d original icon(s) not replaced in %s:", unchangedIcons.size(), args[0])); //$NON-NLS-1$ for (IconResInfo icon : unchangedIcons) { @@ -98,45 +91,39 @@ public class IconExe { } } - /* Implementation */ - - /** - * Retrieve the Desktop icons provided in the Windows executable program. - * These icons are typically shown in various places of the Windows desktop. + /** + * Loads images from files so they are prepared for used in replacing icons in a + * launcher executable * - * Note. The Eclipse 3.4 launcher returns the following 7 images (in any order). - * 1. 48x48, 32 bit (RGB / Alpha Channel) - * 2. 32x32, 32 bit (RGB / Alpha Channel) - * 3. 16x16, 32 bit (RGB / Alpha Channel) - * 4. 48x48, 8 bit (256 colors) - * 5. 32x32, 8 bit (256 colors) - * 6. 24x24, 8 bit (256 colors) - * 7. 16x16, 8 bit (256 colors) - * - * Note 1. The Eclipse 4.2 launcher requires an .ico file with the following 7 images (in any order). - * 1. 256x256, 32 bit (RGB / Alpha Channel) - * 2. 48x48, 32 bit (RGB / Alpha Channel) - * 3. 32x32, 32 bit (RGB / Alpha Channel) - * 4. 16x16, 32 bit (RGB / Alpha Channel) - * 5. 48x48, 8 bit (256 colors) - * 6. 32x32, 8 bit (256 colors) - * 7. 16x16, 8 bit (256 colors) - * - * @param program the Windows executable e.g c:/eclipse/eclipse.exe + * @param icons the icons to loader + * @param errorMessageConsumer a consumer that is informed about skipable errors + * while loading icons + * @return an array of image data that could be used to replace launcher icons + * @throws IOException if reading of files fails on the I/O level */ - static ImageData[] loadIcons(String program) throws FileNotFoundException, IOException { - ImageData[] data; - try (RandomAccessFile raf = new RandomAccessFile(program, "r") //$NON-NLS-1$ - ) { - IconExe iconExe = new IconExe(); - IconResInfo[] iconInfo = iconExe.getIcons(raf); - data = new ImageData[iconInfo.length]; - for (int i = 0; i < data.length; i++) - data[i] = iconInfo[i].data; + public static ImageData[] loadImages(File[] icons, Consumer<String> errorMessageConsumer) throws IOException { + ImageLoader loader = new ImageLoader(); + List<ImageData> images = new ArrayList<>(); + for (File file : icons) { + if (!file.exists()) { + errorMessageConsumer.accept(MessageFormat.format("The specified icon file {0} does not exits", file)); //$NON-NLS-1$ + continue; + } + try (FileInputStream stream = new FileInputStream(file)) { + try { + ImageData[] imageDatas = loader.load(stream); + images.addAll(Arrays.asList(imageDatas)); + } catch (RuntimeException e) { + errorMessageConsumer + .accept(MessageFormat.format("Loading of image {0} failed: {1}", file, e.getMessage())); //$NON-NLS-1$ + } + } } - return data; + return images.toArray(new ImageData[0]); } + /* Implementation */ + /** * Replace the Desktop icons provided in the Windows executable program * with icons provided by the user. @@ -173,19 +160,21 @@ public class IconExe { * Note 4. This function modifies the content of the executable program and may cause * its corruption. * - * @param program the Windows executable e.g c:/eclipse/eclipse.exe + * @param launcherFile the Windows executable e.g c:/eclipse/eclipse.exe * @param icons to write to the given executable * @return the list of icons from the original program that were not successfully replaced (empty if success) */ - static List<IconResInfo> unloadIcons(String program, ImageData[] icons) throws FileNotFoundException, IOException { - List<IconResInfo> iconInfo; - try (RandomAccessFile raf = new RandomAccessFile(program, "rw") //$NON-NLS-1$ + public static Collection<IconResInfo> replaceIcons(File launcherFile, ImageData[] icons, + Consumer<String> errorMessageConsumer) + throws FileNotFoundException, IOException { + Collection<IconResInfo> iconInfo; + try (RandomAccessFile raf = new RandomAccessFile(launcherFile, "rw") //$NON-NLS-1$ ) { - IconExe iconExe = new IconExe(); - iconInfo = new ArrayList<>(Arrays.asList(iconExe.getIcons(raf))); + iconInfo = getIcons(raf); // Display an error if no icons found in target executable. if (iconInfo.isEmpty()) { - System.err.println("Warning - no icons detected in \"" + program + "\"."); //$NON-NLS-1$ //$NON-NLS-2$ + errorMessageConsumer + .accept(MessageFormat.format("no icons detected in {0}.", launcherFile.getAbsolutePath())); //$NON-NLS-1$ raf.close(); return Collections.emptyList(); } @@ -218,26 +207,46 @@ public class IconExe { int size; } - IconResInfo[] iconInfo = null; - int iconCnt; + /** + * Retrieve the Desktop icons provided in the Windows executable program. + * These icons are typically shown in various places of the Windows desktop. + * + * Note. The Eclipse 3.4 launcher returns the following 7 images (in any order). + * 1. 48x48, 32 bit (RGB / Alpha Channel) + * 2. 32x32, 32 bit (RGB / Alpha Channel) + * 3. 16x16, 32 bit (RGB / Alpha Channel) + * 4. 48x48, 8 bit (256 colors) + * 5. 32x32, 8 bit (256 colors) + * 6. 24x24, 8 bit (256 colors) + * 7. 16x16, 8 bit (256 colors) + * + * Note 1. The Eclipse 4.2 launcher requires an .ico file with the following 7 images (in any order). + * 1. 256x256, 32 bit (RGB / Alpha Channel) + * 2. 48x48, 32 bit (RGB / Alpha Channel) + * 3. 32x32, 32 bit (RGB / Alpha Channel) + * 4. 16x16, 32 bit (RGB / Alpha Channel) + * 5. 48x48, 8 bit (256 colors) + * 6. 32x32, 8 bit (256 colors) + * 7. 16x16, 8 bit (256 colors) + * + * @param raf RandomAccessFile for the the Windows executable e.g c:/eclipse/eclipse.exe + */ + static Collection<IconResInfo> getIcons(RandomAccessFile raf) throws IOException { - IconResInfo[] getIcons(RandomAccessFile raf) throws IOException { - iconInfo = new IconResInfo[4]; - iconCnt = 0; IMAGE_DOS_HEADER imageDosHeader = new IMAGE_DOS_HEADER(); read(raf, imageDosHeader); if (imageDosHeader.e_magic != IMAGE_DOS_SIGNATURE) - return new IconResInfo[0]; + return Collections.emptyList(); int imageNtHeadersOffset = imageDosHeader.e_lfanew; raf.seek(imageNtHeadersOffset); IMAGE_NT_HEADERS imageNtHeaders = new IMAGE_NT_HEADERS(); read(raf, imageNtHeaders); if (imageNtHeaders.Signature != IMAGE_NT_SIGNATURE) - return new IconResInfo[0]; + return Collections.emptyList(); // DumpResources int resourcesRVA = imageNtHeaders.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress; if (resourcesRVA == 0) - return new IconResInfo[0]; + return Collections.emptyList(); if (DEBUG) System.out.println("* Resources (RVA= " + resourcesRVA + ")"); //$NON-NLS-1$ //$NON-NLS-2$ IMAGE_SECTION_HEADER imageSectionHeader = new IMAGE_SECTION_HEADER(); @@ -253,19 +262,16 @@ public class IconExe { } } if (!found) - return new IconResInfo[0]; + return Collections.emptyList(); int delta = imageSectionHeader.VirtualAddress - imageSectionHeader.PointerToRawData; int imageResourceDirectoryOffset = resourcesRVA - delta; - dumpResourceDirectory(raf, imageResourceDirectoryOffset, imageResourceDirectoryOffset, delta, 0, 0, false); - if (iconCnt < iconInfo.length) { - IconResInfo[] newArray = new IconResInfo[iconCnt]; - System.arraycopy(iconInfo, 0, newArray, 0, iconCnt); - iconInfo = newArray; - } - return iconInfo; + return dumpResourceDirectory(raf, imageResourceDirectoryOffset, imageResourceDirectoryOffset, delta, 0, 0, + false); } - void dumpResourceDirectory(RandomAccessFile raf, int imageResourceDirectoryOffset, int resourceBase, int delta, int type, int level, boolean rt_icon_root) throws IOException { + static Collection<IconResInfo> dumpResourceDirectory(RandomAccessFile raf, int imageResourceDirectoryOffset, + int resourceBase, int delta, int type, int level, boolean rt_icon_root) throws IOException { + Collection<IconResInfo> iconInfo = new ArrayList<>(); if (DEBUG) System.out.println("** LEVEL " + level); //$NON-NLS-1$ @@ -293,7 +299,9 @@ public class IconExe { } for (IMAGE_RESOURCE_DIRECTORY_ENTRY imageResourceDirectoryEntry : imageResourceDirectoryEntries) { if (imageResourceDirectoryEntry.DataIsDirectory) { - dumpResourceDirectory(raf, imageResourceDirectoryEntry.OffsetToDirectory + resourceBase, resourceBase, delta, imageResourceDirectoryEntry.Id, level + 1, rt_icon_root ? true : type == RT_ICON); + iconInfo.addAll(dumpResourceDirectory(raf, imageResourceDirectoryEntry.OffsetToDirectory + resourceBase, + resourceBase, delta, imageResourceDirectoryEntry.Id, level + 1, + rt_icon_root ? true : type == RT_ICON)); } else { // Resource found /// pResDirEntry->Name @@ -304,21 +312,15 @@ public class IconExe { if (DEBUG) System.out.println("Resource Id " + irde.Id + " Data Offset RVA " + data.OffsetToData + ", Size " + data.Size); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (rt_icon_root) { - if (DEBUG) - System.out.println("iconcnt " + iconCnt + " |" + iconInfo.length); //$NON-NLS-1$ //$NON-NLS-2$ - iconInfo[iconCnt] = new IconResInfo(); - iconInfo[iconCnt].data = parseIcon(raf, data.OffsetToData - delta, data.Size); - iconInfo[iconCnt].offset = data.OffsetToData - delta; - iconInfo[iconCnt].size = data.Size; - iconCnt++; - if (iconCnt == iconInfo.length) { - IconResInfo[] newArray = new IconResInfo[iconInfo.length + 4]; - System.arraycopy(iconInfo, 0, newArray, 0, iconInfo.length); - iconInfo = newArray; - } + IconResInfo resInfo = new IconResInfo(); + resInfo.data = parseIcon(raf, data.OffsetToData - delta, data.Size); + resInfo.offset = data.OffsetToData - delta; + resInfo.size = data.Size; + iconInfo.add(resInfo); } } } + return iconInfo; } static ImageData parseIcon(RandomAccessFile raf, int offset, int size) throws IOException { @@ -748,14 +750,14 @@ public class IconExe { } static long read8(RandomAccessFile raf) throws IOException { - int b0 = raf.readByte() & 0xFF; - int b1 = raf.readByte() & 0xFF; - int b2 = raf.readByte() & 0xFF; - int b3 = raf.readByte() & 0xFF; - int b4 = raf.readByte() & 0xFF; - int b5 = raf.readByte() & 0xFF; - int b6 = raf.readByte() & 0xFF; - int b7 = raf.readByte() & 0xFF; + long b0 = raf.readByte() & 0xFF; + long b1 = raf.readByte() & 0xFF; + long b2 = raf.readByte() & 0xFF; + long b3 = raf.readByte() & 0xFF; + long b4 = raf.readByte() & 0xFF; + long b5 = raf.readByte() & 0xFF; + long b6 = raf.readByte() & 0xFF; + long b7 = raf.readByte() & 0xFF; return b7 << 56 | b6 << 48 | b5 << 40 | b4 << 32 | b3 << 24 | b2 << 16 | b1 << 8 | b0; } @@ -1282,49 +1284,12 @@ public class IconExe { */ public ImageData[] load(InputStream stream) { if (stream == null) - SWT.error(SWT.ERROR_NULL_ARGUMENT); + throw new NullPointerException("stream can't be null"); //$NON-NLS-1$ reset(); data = FileFormat.load(stream, this); return data; } - /** - * Loads an array of <code>ImageData</code> objects from the - * file with the specified name. Throws an error if either - * an error occurs while loading the images, or if the images are - * not of a supported type. Returns the loaded image data array. - * - * @param filename the name of the file to load the images from - * @return an array of <code>ImageData</code> objects loaded from the specified file - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the file name is null</li> - * </ul> - * @exception RuntimeException <ul> - * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data</li> - * <li>ERROR_IO - if an IO error occurs while reading data</li> - * <li>ERROR_UNSUPPORTED_FORMAT - if the image file contains an unrecognized format</li> - * </ul> - */ - public ImageData[] load(String filename) { - if (filename == null) - SWT.error(SWT.ERROR_NULL_ARGUMENT); - InputStream stream = null; - try { - stream = new BufferedInputStream(new FileInputStream(filename)); - return load(stream); - } catch (IOException e) { - SWT.error(SWT.ERROR_IO, e); - } finally { - try { - if (stream != null) - stream.close(); - } catch (IOException e) { - // Ignore error - } - } - return null; - } } static class ImageData { @@ -1576,7 +1541,7 @@ public class IconExe { * <code>ImageLoader.load()</code>. * </p> * - * @param filename the name of the file to load the image from (must not be null) + * @param data the image data to use * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the file name is null</li> @@ -1587,8 +1552,7 @@ public class IconExe { * <li>ERROR_UNSUPPORTED_FORMAT - if the image file contains an unrecognized format</li> * </ul> */ - public ImageData(String filename) { - ImageData[] data = new ImageLoader().load(filename); + public ImageData(ImageData[] data) { if (data.length < 1) SWT.error(SWT.ERROR_INVALID_IMAGE); ImageData i = data[0]; @@ -2839,13 +2803,8 @@ public class IconExe { abstract ImageData[] loadFromByteStream(); public ImageData[] loadFromStream(LEDataInputStream stream) { - try { - inputStream = stream; - return loadFromByteStream(); - } catch (Exception e) { - SWT.error(SWT.ERROR_IO, e); - return null; - } + inputStream = stream; + return loadFromByteStream(); } public static ImageData[] load(InputStream is, ImageLoader loader) { @@ -2882,7 +2841,9 @@ public class IconExe { SWT.error(SWT.ERROR_INVALID_IMAGE); return; } - SWT.error(SWT.ERROR_INVALID_IMAGE); + throw new IllegalArgumentException(MessageFormat.format( + "only BMP_RLE8_COMPRESSION(cmp=1) or BMP_RLE4_COMPRESSION(cmp=2) compression is currently supported (given cmp={0})", //$NON-NLS-1$ + cmp)); } int decompressRLE4Data(byte[] src, int numBytes, int stride, byte[] dest, int destSize) { diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java index bb67873dd..c9a149b4e 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java @@ -41,10 +41,10 @@ public abstract class AbstractPublishTask extends Task { /** * Support nested repository elements that looking something like - * <repo location="file:/foo" metadata="true" artifact="true" /> - * Both metadata and artifact are optional: - * 1) if neither are set, the repo is used for both metadata and artifacts - * 2) if only one is true, the repo is that type and not the other + * <repo location="file:/foo" metadata="true" artifact="true" /> Both metadata + * and artifact are optional: 1) if neither are set, the repo is used for both + * metadata and artifacts 2) if only one is true, the repo is that type and not + * the other */ static public class RepoEntry { private URI repoLocation; @@ -52,7 +52,7 @@ public abstract class AbstractPublishTask extends Task { private Boolean artifact = null; /** - * If not set, default is true if we aren't set as an artifact repo + * If not set, default is true if we aren't set as an artifact repo */ public boolean isMetadataRepository() { if (metadata != null) @@ -61,7 +61,7 @@ public abstract class AbstractPublishTask extends Task { } /** - * If not set, default is true if we aren't set as a metadata repo + * If not set, default is true if we aren't set as a metadata repo */ public boolean isArtifactRepository() { if (artifact != null) @@ -117,14 +117,18 @@ public abstract class AbstractPublishTask extends Task { protected void initializeRepositories(PublisherInfo info) throws ProvisionException { if (artifactLocation != null) { - IArtifactRepository repo = Publisher.createArtifactRepository(getProvisioningAgent(), artifactLocation, artifactRepoName, compress, reusePackedFiles); + @SuppressWarnings("removal") + IArtifactRepository repo = Publisher.createArtifactRepository(getProvisioningAgent(), artifactLocation, + artifactRepoName, compress, reusePackedFiles); if (!append && !isEmpty(repo)) { File repoLocation = URIUtil.toFile(artifactLocation); if (repoLocation != null && source != null) { if (repoLocation.isFile()) repoLocation = repoLocation.getParentFile(); if (repoLocation.equals(new File(source))) - throw new IllegalArgumentException(NLS.bind(Messages.exception_artifactRepoNoAppendDestroysInput, URIUtil.toUnencodedString(artifactLocation))); + throw new IllegalArgumentException( + NLS.bind(Messages.exception_artifactRepoNoAppendDestroysInput, + URIUtil.toUnencodedString(artifactLocation))); } repo.removeAll(new NullProgressMonitor()); } @@ -133,11 +137,14 @@ public abstract class AbstractPublishTask extends Task { throw new ProvisionException(createConfigurationEror(Messages.exception_noArtifactRepo)); if (metadataLocation == null) throw new ProvisionException(createConfigurationEror(Messages.exception_noMetadataRepo)); - info.setMetadataRepository(Publisher.createMetadataRepository(getProvisioningAgent(), metadataLocation, metadataRepoName, append, compress)); + info.setMetadataRepository(Publisher.createMetadataRepository(getProvisioningAgent(), metadataLocation, + metadataRepoName, append, compress)); if (contextRepositories.size() > 0) { - CompositeMetadataRepository contextMetadata = CompositeMetadataRepository.createMemoryComposite(getProvisioningAgent()); - CompositeArtifactRepository contextArtifact = CompositeArtifactRepository.createMemoryComposite(getProvisioningAgent()); + CompositeMetadataRepository contextMetadata = CompositeMetadataRepository + .createMemoryComposite(getProvisioningAgent()); + CompositeArtifactRepository contextArtifact = CompositeArtifactRepository + .createMemoryComposite(getProvisioningAgent()); for (RepoEntry entry : contextRepositories) { if (contextMetadata != null && entry.isMetadataRepository()) diff --git a/bundles/org.eclipse.equinox.p2.publisher/.classpath b/bundles/org.eclipse.equinox.p2.publisher/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/.classpath +++ b/bundles/org.eclipse.equinox.p2.publisher/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.publisher/.settings/.api_filters b/bundles/org.eclipse.equinox.p2.publisher/.settings/.api_filters new file mode 100644 index 000000000..5fbae6834 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.publisher/.settings/.api_filters @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<component id="org.eclipse.equinox.p2.publisher" version="2"> + <resource path="META-INF/MANIFEST.MF"> + <filter id="926941240"> + <message_arguments> + <message_argument value="1.7.0"/> + <message_argument value="1.6.200"/> + </message_arguments> + </filter> + </resource> +</component> diff --git a/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.core.prefs index fe0819f9a..cb0db2a19 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.core.prefs @@ -16,9 +16,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -35,6 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -88,6 +89,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -124,7 +126,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -138,7 +141,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -268,7 +270,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -342,7 +343,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -501,7 +501,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.ui.prefs index 5df378ce1..cdf4ca19e 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.ui.prefs +++ b/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.ui.prefs @@ -24,7 +24,7 @@ sp_cleanup.convert_functional_interfaces=false sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false +sp_cleanup.format_source_code_changes_only=true sp_cleanup.insert_inferred_type_arguments=false sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false diff --git a/bundles/org.eclipse.equinox.p2.publisher/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.publisher/META-INF/MANIFEST.MF index b565a7d4c..693d9e66b 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.publisher/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-SymbolicName: org.eclipse.equinox.p2.publisher;singleton:=true -Bundle-Version: 1.5.500.qualifier +Bundle-Version: 1.7.0.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.publisher.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -24,7 +24,7 @@ Export-Package: org.eclipse.equinox.internal.p2.publisher; org.eclipse.equinox.spi.p2.publisher;x-friends:="org.eclipse.equinox.p2.updatesite,org.eclipse.equinox.p2.publisher.eclipse" Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)", org.eclipse.osgi;bundle-version="3.8.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.equinox.app;version="1.0.0";resolution:=optional, org.eclipse.equinox.internal.p2.artifact.processors.checksum, diff --git a/bundles/org.eclipse.equinox.p2.publisher/build.properties b/bundles/org.eclipse.equinox.p2.publisher/build.properties index 3e2e49a0d..adbece45b 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/build.properties +++ b/bundles/org.eclipse.equinox.p2.publisher/build.properties @@ -19,5 +19,4 @@ bin.includes = META-INF/,\ .,\ about.html,\ plugin.properties -javacWarnings..=+unusedThrown src.includes = about.html diff --git a/bundles/org.eclipse.equinox.p2.publisher/pom.xml b/bundles/org.eclipse.equinox.p2.publisher/pom.xml index aebbbd2ab..b16ba1bd1 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/pom.xml +++ b/bundles/org.eclipse.equinox.p2.publisher/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.publisher</artifactId> - <version>1.5.500-SNAPSHOT</version> + <version>1.7.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java index f5d890b08..5f1dc9d42 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Code 9 and others. + * Copyright (c) 2008, 2017 Code 9 and others. * * This * program and the accompanying materials are made available under the terms of @@ -8,8 +8,8 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation * IBM - ongoing development * SAP - ongoing development @@ -63,6 +63,7 @@ public abstract class AbstractPublisherAction implements IPublisherAction { /** * Returns a string array of { ws, os, arch } as parsed from the given string + * * @param configSpec the string to parse * @return the ws, os, arch form of the given string */ @@ -85,10 +86,11 @@ public abstract class AbstractPublisherAction implements IPublisherAction { /** * Returns the canonical form of config spec with the given ws, os and arch. - * Note that the result is intended to be machine readable (i.e., parseConfigSpec - * will parse the the result). - * @param ws the window system - * @param os the operating system + * Note that the result is intended to be machine readable (i.e., + * parseConfigSpec will parse the the result). + * + * @param ws the window system + * @param os the operating system * @param arch the machine architecture * @return the machine readable format of the given config spec */ @@ -97,15 +99,16 @@ public abstract class AbstractPublisherAction implements IPublisherAction { } protected void addSelfCapability(InstallableUnitDescription root) { - root.setCapabilities(new IProvidedCapability[] {createSelfCapability(root.getId(), root.getVersion())}); + root.setCapabilities(new IProvidedCapability[] { createSelfCapability(root.getId(), root.getVersion()) }); } /** - * Returns the LDAP filter form that matches the given config spec. Returns - * an empty String if the spec does not identify an ws, os or arch. + * Returns the LDAP filter form that matches the given config spec. Returns an + * empty String if the spec does not identify an ws, os or arch. + * * @param configSpec a config spec to filter - * @return the LDAP filter for the given spec. <code>null</code> if the given spec does not - * parse into a filter. + * @return the LDAP filter for the given spec. <code>null</code> if the given + * spec does not parse into a filter. */ protected IMatchExpression<IInstallableUnit> createFilterSpec(String configSpec) { String ldap = createLDAPString(configSpec); @@ -117,9 +120,15 @@ public abstract class AbstractPublisherAction implements IPublisherAction { protected String createLDAPString(String configSpec) { String[] config = parseConfigSpec(configSpec); if (config[0] != null || config[1] != null || config[2] != null) { - String filterWs = config[0] != null && !CONFIG_ANY.equalsIgnoreCase(config[0]) ? "(osgi.ws=" + config[0] + ")" : ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - String filterOs = config[1] != null && !CONFIG_ANY.equalsIgnoreCase(config[1]) ? "(osgi.os=" + config[1] + ")" : ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - String filterArch = config[2] != null && !CONFIG_ANY.equalsIgnoreCase(config[2]) ? "(osgi.arch=" + config[2] + ")" : ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String filterWs = config[0] != null && !CONFIG_ANY.equalsIgnoreCase(config[0]) + ? "(osgi.ws=" + config[0] + ")" //$NON-NLS-1$ //$NON-NLS-2$ + : ""; //$NON-NLS-1$ + String filterOs = config[1] != null && !CONFIG_ANY.equalsIgnoreCase(config[1]) + ? "(osgi.os=" + config[1] + ")" //$NON-NLS-1$ //$NON-NLS-2$ + : ""; //$NON-NLS-1$ + String filterArch = config[2] != null && !CONFIG_ANY.equalsIgnoreCase(config[2]) + ? "(osgi.arch=" + config[2] + ")" //$NON-NLS-1$ //$NON-NLS-2$ + : ""; //$NON-NLS-1$ if (filterWs.length() == 0 && filterOs.length() == 0 && filterArch.length() == 0) return null; return "(& " + filterWs + filterOs + filterArch + ")"; //$NON-NLS-1$ //$NON-NLS-2$ @@ -136,9 +145,10 @@ public abstract class AbstractPublisherAction implements IPublisherAction { } /** - * Returns the normalized string form of the given config spec. This is useful for putting - * in IU ids etc. Note that the result is not intended to be machine readable (i.e., parseConfigSpec - * may not work on the result). + * Returns the normalized string form of the given config spec. This is useful + * for putting in IU ids etc. Note that the result is not intended to be machine + * readable (i.e., parseConfigSpec may not work on the result). + * * @param configSpec the config spec to format * @return the readable format of the given config spec */ @@ -152,9 +162,10 @@ public abstract class AbstractPublisherAction implements IPublisherAction { } /** - * Creates and returns a collection of RequiredCapabilities for the IUs represented - * by the given collection. The collection may include a mixture of IInstallableUnits - * or VersionedNames. + * Creates and returns a collection of RequiredCapabilities for the IUs + * represented by the given collection. The collection may include a mixture of + * IInstallableUnits or VersionedNames. + * * @param children descriptions of the IUs on which requirements are to be made * @return a collection of RequiredCapabilities representing the given IUs */ @@ -164,12 +175,15 @@ public abstract class AbstractPublisherAction implements IPublisherAction { if (next instanceof IInstallableUnit) { IInstallableUnit iu = (IInstallableUnit) next; VersionRange range = new VersionRange(iu.getVersion(), true, iu.getVersion(), true); - result.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), range, iu.getFilter() == null ? null : iu.getFilter(), false, false)); + result.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), range, + iu.getFilter() == null ? null : iu.getFilter(), false, false)); } else { Version version = next.getVersion(); - VersionRange range = (version == null || Version.emptyVersion.equals(version)) ? VersionRange.emptyRange : new VersionRange(version, true, version, true); + VersionRange range = (version == null || Version.emptyVersion.equals(version)) ? VersionRange.emptyRange + : new VersionRange(version, true, version, true); IMatchExpression<IInstallableUnit> filter = getFilterAdvice(next); - result.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, next.getId(), range, filter, false, false)); + result.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, next.getId(), range, + filter, false, false)); } } return result; @@ -178,7 +192,8 @@ public abstract class AbstractPublisherAction implements IPublisherAction { private IMatchExpression<IInstallableUnit> getFilterAdvice(IVersionedId name) { if (info == null) return null; - Collection<IFilterAdvice> filterAdvice = info.getAdvice(CONFIG_ANY, true, name.getId(), name.getVersion(), IFilterAdvice.class); + Collection<IFilterAdvice> filterAdvice = info.getAdvice(CONFIG_ANY, true, name.getId(), name.getVersion(), + IFilterAdvice.class); for (IFilterAdvice advice : filterAdvice) { IMatchExpression<IInstallableUnit> result = advice.getFilter(name.getId(), name.getVersion(), false); if (result != null) @@ -194,43 +209,55 @@ public abstract class AbstractPublisherAction implements IPublisherAction { return root; } - protected IArtifactDescriptor createPack200ArtifactDescriptor(IArtifactKey key, File pathOnDisk, String installSize) { - ArtifactDescriptor result = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(info, key, pathOnDisk); - //TODO this size calculation is bogus + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. + */ + @Deprecated(forRemoval = true, since = "1.6.0") + protected IArtifactDescriptor createPack200ArtifactDescriptor(IArtifactKey key, File pathOnDisk, + String installSize) { + ArtifactDescriptor result = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(info, key, + pathOnDisk); + // TODO this size calculation is bogus if (pathOnDisk != null) { result.setProperty(IArtifactDescriptor.ARTIFACT_SIZE, installSize); // TODO - this is wrong but I'm testing a work-around for bug 205842 result.setProperty(IArtifactDescriptor.DOWNLOAD_SIZE, Long.toString(pathOnDisk.length())); } - IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] {new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true)}; //$NON-NLS-1$ + IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] { + new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true) }; //$NON-NLS-1$ result.setProcessingSteps(steps); result.setProperty(IArtifactDescriptor.FORMAT, IArtifactDescriptor.FORMAT_PACKED); return result; } - protected InstallableUnitDescription createParentIU(Collection<? extends IVersionedId> children, String id, Version version) { + protected InstallableUnitDescription createParentIU(Collection<? extends IVersionedId> children, String id, + Version version) { InstallableUnitDescription root = createIUShell(id, version); root.addRequirements(createIURequirements(children)); addSelfCapability(root); return root; } - //This is to hide FileUtils from other actions + // This is to hide FileUtils from other actions protected IPathComputer createParentPrefixComputer(int segmentsToKeep) { return FileUtils.createParentPrefixComputer(segmentsToKeep); } - //This is to hide FileUtils from other actions + // This is to hide FileUtils from other actions protected IPathComputer createRootPrefixComputer(final File root) { return FileUtils.createRootPathComputer(root); } protected IProvidedCapability createSelfCapability(String installableUnitId, Version installableUnitVersion) { - return MetadataFactory.createProvidedCapability(PublisherHelper.IU_NAMESPACE, installableUnitId, installableUnitVersion); + return MetadataFactory.createProvidedCapability(PublisherHelper.IU_NAMESPACE, installableUnitId, + installableUnitVersion); } - protected static InstallableUnitDescription[] processAdditionalInstallableUnitsAdvice(IInstallableUnit iu, IPublisherInfo publisherInfo) { - Collection<IAdditionalInstallableUnitAdvice> advice = publisherInfo.getAdvice(null, false, iu.getId(), iu.getVersion(), IAdditionalInstallableUnitAdvice.class); + protected static InstallableUnitDescription[] processAdditionalInstallableUnitsAdvice(IInstallableUnit iu, + IPublisherInfo publisherInfo) { + Collection<IAdditionalInstallableUnitAdvice> advice = publisherInfo.getAdvice(null, false, iu.getId(), + iu.getVersion(), IAdditionalInstallableUnitAdvice.class); if (advice.isEmpty()) return null; @@ -244,16 +271,20 @@ public abstract class AbstractPublisherAction implements IPublisherAction { } /** - * Add all of the advised artifact properties for the given IU and artifact descriptor. - * @param iu the IU + * Add all of the advised artifact properties for the given IU and artifact + * descriptor. + * + * @param iu the IU * @param descriptor the descriptor to decorate - * @param info the publisher info supplying the advice + * @param info the publisher info supplying the advice */ - protected static void processArtifactPropertiesAdvice(IInstallableUnit iu, IArtifactDescriptor descriptor, IPublisherInfo info) { + protected static void processArtifactPropertiesAdvice(IInstallableUnit iu, IArtifactDescriptor descriptor, + IPublisherInfo info) { if (!(descriptor instanceof SimpleArtifactDescriptor)) return; - Collection<IPropertyAdvice> advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), IPropertyAdvice.class); + Collection<IPropertyAdvice> advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), + IPropertyAdvice.class); for (IPropertyAdvice entry : advice) { Map<String, String> props = entry.getArtifactProperties(iu, descriptor); if (props == null) @@ -266,11 +297,13 @@ public abstract class AbstractPublisherAction implements IPublisherAction { /** * Add all of the advised IU properties for the given IU. - * @param iu the IU to decorate + * + * @param iu the IU to decorate * @param info the publisher info supplying the advice */ protected static void processInstallableUnitPropertiesAdvice(InstallableUnitDescription iu, IPublisherInfo info) { - Collection<IPropertyAdvice> advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), IPropertyAdvice.class); + Collection<IPropertyAdvice> advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), + IPropertyAdvice.class); for (IPropertyAdvice entry : advice) { Map<String, String> props = entry.getInstallableUnitProperties(iu); if (props == null) @@ -283,17 +316,19 @@ public abstract class AbstractPublisherAction implements IPublisherAction { /** * Add any update descriptor advice to the given IU - * @param iu the IU to decorate + * + * @param iu the IU to decorate * @param info the publisher info supplying the advice */ protected static void processUpdateDescriptorAdvice(InstallableUnitDescription iu, IPublisherInfo info) { - Collection<IUpdateDescriptorAdvice> advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), IUpdateDescriptorAdvice.class); + Collection<IUpdateDescriptorAdvice> advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), + IUpdateDescriptorAdvice.class); if (advice.isEmpty()) return; for (IUpdateDescriptorAdvice entry : advice) { - //process the IU Descriptor + // process the IU Descriptor IUpdateDescriptor updateDescriptor = entry.getUpdateDescriptor(iu); if (updateDescriptor != null) { iu.setUpdateDescriptor(updateDescriptor); @@ -302,23 +337,27 @@ public abstract class AbstractPublisherAction implements IPublisherAction { } /** - * Add all of the advised provided and required capabilities for the given installable unit. - * @param iu the IU to decorate + * Add all of the advised provided and required capabilities for the given + * installable unit. + * + * @param iu the IU to decorate * @param info the publisher info supplying the advice */ protected static void processCapabilityAdvice(InstallableUnitDescription iu, IPublisherInfo info) { - Collection<ICapabilityAdvice> advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), ICapabilityAdvice.class); + Collection<ICapabilityAdvice> advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), + ICapabilityAdvice.class); if (advice.isEmpty()) return; for (ICapabilityAdvice entry : advice) { - //process required capabilities + // process required capabilities IRequirement[] requiredAdvice = entry.getRequiredCapabilities(iu); if (requiredAdvice != null) { List<IRequirement> current = iu.getRequirements(); Set<IRequirement> resultRequiredCapabilities = new HashSet<>(current); - // remove current required capabilities that match (same name and namespace) advice. + // remove current required capabilities that match (same name and namespace) + // advice. for (IRequirement currReq : current) { IRequiredCapability currentRequiredCapability = toRequiredCapability(currReq); if (currentRequiredCapability == null) { @@ -331,7 +370,8 @@ public abstract class AbstractPublisherAction implements IPublisherAction { continue; } - if (requiredCapability.getNamespace().equals(currentRequiredCapability.getNamespace()) && requiredCapability.getName().equals(currentRequiredCapability.getName())) { + if (requiredCapability.getNamespace().equals(currentRequiredCapability.getNamespace()) + && requiredCapability.getName().equals(currentRequiredCapability.getName())) { resultRequiredCapabilities.remove(currentRequiredCapability); break; } @@ -339,16 +379,18 @@ public abstract class AbstractPublisherAction implements IPublisherAction { } // add all advice resultRequiredCapabilities.addAll(Arrays.asList(requiredAdvice)); - iu.setRequirements(resultRequiredCapabilities.toArray(new IRequirement[resultRequiredCapabilities.size()])); + iu.setRequirements( + resultRequiredCapabilities.toArray(new IRequirement[resultRequiredCapabilities.size()])); } - //process meta required capabilities + // process meta required capabilities IRequirement[] metaRequiredAdvice = entry.getMetaRequiredCapabilities(iu); if (metaRequiredAdvice != null) { Collection<IRequirement> current = iu.getMetaRequirements(); Set<IRequirement> resultMetaRequiredCapabilities = new HashSet<>(current); - // remove current meta-required capabilities that match (same name and namespace) advice. + // remove current meta-required capabilities that match (same name and + // namespace) advice. for (IRequirement currMetaReq : current) { IRequiredCapability currentMetaRequiredCapability = toRequiredCapability(currMetaReq); if (currentMetaRequiredCapability == null) { @@ -361,7 +403,8 @@ public abstract class AbstractPublisherAction implements IPublisherAction { continue; } - if (metaRequiredCapability.getNamespace().equals(currentMetaRequiredCapability.getNamespace()) && metaRequiredCapability.getName().equals(currentMetaRequiredCapability.getName())) { + if (metaRequiredCapability.getNamespace().equals(currentMetaRequiredCapability.getNamespace()) + && metaRequiredCapability.getName().equals(currentMetaRequiredCapability.getName())) { resultMetaRequiredCapabilities.remove(currentMetaRequiredCapability); break; } @@ -370,24 +413,27 @@ public abstract class AbstractPublisherAction implements IPublisherAction { // add all advice resultMetaRequiredCapabilities.addAll(Arrays.asList(metaRequiredAdvice)); - iu.setMetaRequirements(resultMetaRequiredCapabilities.toArray(new IRequirement[resultMetaRequiredCapabilities.size()])); + iu.setMetaRequirements(resultMetaRequiredCapabilities + .toArray(new IRequirement[resultMetaRequiredCapabilities.size()])); } - //process provided capabilities + // process provided capabilities IProvidedCapability[] providedAdvice = entry.getProvidedCapabilities(iu); if (providedAdvice != null) { Collection<IProvidedCapability> current = iu.getProvidedCapabilities(); Set<IProvidedCapability> resultProvidedCapabilities = new HashSet<>(current); for (IProvidedCapability currentProvidedCapability : current) { for (IProvidedCapability providedCapability : providedAdvice) { - if (providedCapability.getNamespace().equals(currentProvidedCapability.getNamespace()) && providedCapability.getName().equals(currentProvidedCapability.getName())) { + if (providedCapability.getNamespace().equals(currentProvidedCapability.getNamespace()) + && providedCapability.getName().equals(currentProvidedCapability.getName())) { resultProvidedCapabilities.remove(currentProvidedCapability); break; } } } resultProvidedCapabilities.addAll(Arrays.asList(providedAdvice)); - iu.setCapabilities(resultProvidedCapabilities.toArray(new IProvidedCapability[resultProvidedCapabilities.size()])); + iu.setCapabilities( + resultProvidedCapabilities.toArray(new IProvidedCapability[resultProvidedCapabilities.size()])); } } } @@ -407,16 +453,21 @@ public abstract class AbstractPublisherAction implements IPublisherAction { /** * Adds all applicable touchpoint advice to the given installable unit. - * @param iu The installable unit to add touchpoint advice to - * @param currentInstructions The set of touchpoint instructions assembled for this IU so far - * @param info The publisher info + * + * @param iu The installable unit to add touchpoint advice to + * @param currentInstructions The set of touchpoint instructions assembled for + * this IU so far + * @param info The publisher info */ - protected static void processTouchpointAdvice(InstallableUnitDescription iu, Map<String, ? extends Object> currentInstructions, IPublisherInfo info) { + protected static void processTouchpointAdvice(InstallableUnitDescription iu, + Map<String, ? extends Object> currentInstructions, IPublisherInfo info) { processTouchpointAdvice(iu, currentInstructions, info, null); } - protected static void processTouchpointAdvice(InstallableUnitDescription iu, Map<String, ? extends Object> currentInstructions, IPublisherInfo info, String configSpec) { - Collection<ITouchpointAdvice> advice = info.getAdvice(configSpec, false, iu.getId(), iu.getVersion(), ITouchpointAdvice.class); + protected static void processTouchpointAdvice(InstallableUnitDescription iu, + Map<String, ? extends Object> currentInstructions, IPublisherInfo info, String configSpec) { + Collection<ITouchpointAdvice> advice = info.getAdvice(configSpec, false, iu.getId(), iu.getVersion(), + ITouchpointAdvice.class); if (currentInstructions == null) { if (advice == null || advice.isEmpty()) return; @@ -433,10 +484,13 @@ public abstract class AbstractPublisherAction implements IPublisherAction { } /** - * Publishes the artifact by zipping the <code>files</code> using <code>root</code> - * as a base for relative paths. Then copying the zip into the repository. - * @param descriptor used to identify the zip. - * @param inclusion the file to be published. files can be <code>null</code> but no action is taken. + * Publishes the artifact by zipping the <code>files</code> using + * <code>root</code> as a base for relative paths. Then copying the zip into the + * repository. + * + * @param descriptor used to identify the zip. + * @param inclusion the file to be published. files can be <code>null</code> + * but no action is taken. * @param publisherInfo the publisher info. */ protected void publishArtifact(IArtifactDescriptor descriptor, File inclusion, IPublisherInfo publisherInfo) { @@ -448,13 +502,15 @@ public abstract class AbstractPublisherAction implements IPublisherAction { if (destination == null || destination.contains(descriptor)) return; - // if all we are doing is indexing things then add the descriptor and get on with it - if ((publisherInfo.getArtifactOptions() & IPublisherInfo.A_PUBLISH) == 0) { + // if all we are doing is indexing things then add the descriptor and get on + // with it + if (!PublisherHelper.isArtifactPublish(publisherInfo)) { destination.addDescriptor(descriptor, new NullProgressMonitor()); return; } - // if the file is already in the same location the repo will put it, just add the descriptor and exit + // if the file is already in the same location the repo will put it, just add + // the descriptor and exit if (destination instanceof IFileArtifactRepository) { File descriptorFile = ((IFileArtifactRepository) destination).getArtifactFile(descriptor); if (inclusion.equals(descriptorFile)) { @@ -477,15 +533,20 @@ public abstract class AbstractPublisherAction implements IPublisherAction { } /** - * Publishes the artifact by zipping the <code>files</code> using <code>root</code> - * as a base for relative paths. Then copying the zip into the repository. - * @param descriptor used to identify the zip. - * @param inclusions and folders to be included in the zip. files can be null. - * @param exclusions and folders to be excluded in the zip. files can be null. - * @param publisherInfo the publisher info. + * Publishes the artifact by zipping the <code>files</code> using + * <code>root</code> as a base for relative paths. Then copying the zip into the + * repository. + * + * @param descriptor used to identify the zip. + * @param inclusions and folders to be included in the zip. files can be + * null. + * @param exclusions and folders to be excluded in the zip. files can be + * null. + * @param publisherInfo the publisher info. * @param prefixComputer */ - protected void publishArtifact(IArtifactDescriptor descriptor, File[] inclusions, File[] exclusions, IPublisherInfo publisherInfo, IPathComputer prefixComputer) { + protected void publishArtifact(IArtifactDescriptor descriptor, File[] inclusions, File[] exclusions, + IPublisherInfo publisherInfo, IPathComputer prefixComputer) { // no files to publish so this is done. if (inclusions == null || inclusions.length < 1) return; @@ -493,15 +554,18 @@ public abstract class AbstractPublisherAction implements IPublisherAction { IArtifactRepository destination = publisherInfo.getArtifactRepository(); if (destination == null || destination.contains(descriptor)) return; - // if all we are doing is indexing things then add the descriptor and get on with it - if ((publisherInfo.getArtifactOptions() & IPublisherInfo.A_PUBLISH) == 0) { + // if all we are doing is indexing things then add the descriptor and get on + // with it + if (!PublisherHelper.isArtifactPublish(publisherInfo)) { destination.addDescriptor(descriptor, new NullProgressMonitor()); return; } // TODO need to implement the overwrite story in the repos - // boolean overwrite = (info.getArtifactOptions() & IPublisherInfo.A_OVERWRITE) > 0; - // if there is just one file and the mode is as-is, just copy the file into the repo + // boolean overwrite = (info.getArtifactOptions() & IPublisherInfo.A_OVERWRITE) + // > 0; + // if there is just one file and the mode is as-is, just copy the file into the + // repo // otherwise, zip up the files and copy the zip into the repo File tempFile = null; try { @@ -525,9 +589,10 @@ public abstract class AbstractPublisherAction implements IPublisherAction { } /** - * Loop over the known metadata repositories looking for the given IU. - * Return the first IU found. - * @param iuId the id of the IU to look for + * Loop over the known metadata repositories looking for the given IU. Return + * the first IU found. + * + * @param iuId the id of the IU to look for * @return the first matching IU or <code>null</code> if none. */ protected IInstallableUnit queryForIU(IPublisherResult publisherResult, String iuId, Version version) { @@ -549,13 +614,16 @@ public abstract class AbstractPublisherAction implements IPublisherAction { } /** - * Loop over the known metadata repositories looking for the given IU within a particular range + * Loop over the known metadata repositories looking for the given IU within a + * particular range + * * @param publisherResult - * @param iuId the id of the IU to look for - * @param versionRange the version range to consider + * @param iuId the id of the IU to look for + * @param versionRange the version range to consider * @return The the IUs with the matching ids in the given range */ - protected IQueryResult<IInstallableUnit> queryForIUs(IPublisherResult publisherResult, String iuId, VersionRange versionRange) { + protected IQueryResult<IInstallableUnit> queryForIUs(IPublisherResult publisherResult, String iuId, + VersionRange versionRange) { IQuery<IInstallableUnit> query = null; IQueryResult<IInstallableUnit> queryResult = Collector.emptyCollector(); query = QueryUtil.createIUQuery(iuId, versionRange); diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherApplication.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherApplication.java index 5a380a8e2..6f2dee301 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherApplication.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherApplication.java @@ -7,7 +7,7 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * IBM Corporation - initial API and implementation * EclipseSource - ongoing development @@ -37,14 +37,19 @@ import org.osgi.framework.ServiceReference; public abstract class AbstractPublisherApplication implements IApplication { - // The mapping rules for in-place generation need to construct paths into the structure - // of an eclipse installation; in the future the default artifact mapping declared in - // SimpleArtifactRepository may change, for example, to not have a 'bundles' directory - // instead of a 'plugins' directory, so a separate constant is defined and used here. - static final protected String[][] INPLACE_MAPPING_RULES = {{"(& (classifier=osgi.bundle) (format=packed)", "${repoUrl}/features/${id}_${version}.jar.pack.gz"}, //$NON-NLS-1$//$NON-NLS-2$ - {"(& (classifier=osgi.bundle))", "${repoUrl}/plugins/${id}_${version}.jar"}, //$NON-NLS-1$//$NON-NLS-2$ - {"(& (classifier=binary))", "${repoUrl}/binary/${id}_${version}"}, //$NON-NLS-1$//$NON-NLS-2$ - {"(& (classifier=org.eclipse.update.feature))", "${repoUrl}/features/${id}_${version}.jar"}}; //$NON-NLS-1$//$NON-NLS-2$ + // The mapping rules for in-place generation need to construct paths into the + // structure + // of an eclipse installation; in the future the default artifact mapping + // declared in + // SimpleArtifactRepository may change, for example, to not have a 'bundles' + // directory + // instead of a 'plugins' directory, so a separate constant is defined and used + // here. + static final protected String[][] INPLACE_MAPPING_RULES = { + { "(& (classifier=osgi.bundle) (format=packed)", "${repoUrl}/features/${id}_${version}.jar.pack.gz" }, //$NON-NLS-1$//$NON-NLS-2$ + { "(& (classifier=osgi.bundle))", "${repoUrl}/plugins/${id}_${version}.jar" }, //$NON-NLS-1$//$NON-NLS-2$ + { "(& (classifier=binary))", "${repoUrl}/binary/${id}_${version}" }, //$NON-NLS-1$//$NON-NLS-2$ + { "(& (classifier=org.eclipse.update.feature))", "${repoUrl}/features/${id}_${version}.jar" } }; //$NON-NLS-1$//$NON-NLS-2$ static final public String PUBLISH_PACK_FILES_AS_SIBLINGS = "publishPackFilesAsSiblings"; //$NON-NLS-1$ @@ -56,7 +61,7 @@ public abstract class AbstractPublisherApplication implements IApplication { protected String artifactRepoName; protected URI[] contextMetadataRepositories; protected URI[] contextArtifactRepositories; - //whether repository xml files should be compressed + // whether repository xml files should be compressed protected boolean compress = false; protected boolean inplace = false; protected boolean append = false; @@ -69,8 +74,8 @@ public abstract class AbstractPublisherApplication implements IApplication { protected IProvisioningAgent agent; /** - * Returns the error message for this application, or the empty string - * if the application terminated successfully. + * Returns the error message for this application, or the empty string if the + * application terminated successfully. */ public IStatus getStatus() { return status; @@ -83,7 +88,8 @@ public abstract class AbstractPublisherApplication implements IApplication { metadataLocation = location.toURI(); if (artifactLocation == null) artifactLocation = location.toURI(); - publisherInfo.setArtifactOptions(publisherInfo.getArtifactOptions() | IPublisherInfo.A_INDEX | IPublisherInfo.A_PUBLISH); + publisherInfo.setArtifactOptions( + publisherInfo.getArtifactOptions() | IPublisherInfo.A_INDEX | IPublisherInfo.A_PUBLISH); } initializeRepositories(publisherInfo); } @@ -99,14 +105,18 @@ public abstract class AbstractPublisherApplication implements IApplication { protected void initializeRepositories(PublisherInfo publisherInfo) throws ProvisionException { if (artifactLocation != null) { - IArtifactRepository repo = Publisher.createArtifactRepository(agent, artifactLocation, artifactRepoName, compress, reusePackedFiles); + @SuppressWarnings("removal") + IArtifactRepository repo = Publisher.createArtifactRepository(agent, artifactLocation, artifactRepoName, + compress, reusePackedFiles); if (!append && !isEmpty(repo)) { File repoLocation = URIUtil.toFile(artifactLocation); if (repoLocation != null && source != null) { if (repoLocation.isFile()) repoLocation = repoLocation.getParentFile(); if (repoLocation.equals(new File(source))) - throw new IllegalArgumentException(NLS.bind(Messages.exception_artifactRepoNoAppendDestroysInput, URIUtil.toUnencodedString(artifactLocation))); + throw new IllegalArgumentException( + NLS.bind(Messages.exception_artifactRepoNoAppendDestroysInput, + URIUtil.toUnencodedString(artifactLocation))); } repo.removeAll(new NullProgressMonitor()); } @@ -115,7 +125,8 @@ public abstract class AbstractPublisherApplication implements IApplication { throw new ProvisionException(createConfigurationEror(Messages.exception_noArtifactRepo)); if (metadataLocation == null) throw new ProvisionException(createConfigurationEror(Messages.exception_noMetadataRepo)); - publisherInfo.setMetadataRepository(Publisher.createMetadataRepository(agent, metadataLocation, metadataRepoName, append, compress)); + publisherInfo.setMetadataRepository( + Publisher.createMetadataRepository(agent, metadataLocation, metadataRepoName, append, compress)); if (contextMetadataRepositories != null && contextMetadataRepositories.length > 0) { CompositeMetadataRepository contextMetadata = CompositeMetadataRepository.createMemoryComposite(agent); @@ -147,8 +158,10 @@ public abstract class AbstractPublisherApplication implements IApplication { // check for args without parameters (i.e., a flag arg) processFlag(args[i], publisherInfo); - // check for args with parameters. If we are at the last argument or if the next one - // has a '-' as the first character, then we can't have an arg with a parm so continue. + // check for args with parameters. If we are at the last argument or if the next + // one + // has a '-' as the first character, then we can't have an arg with a parm so + // continue. if (i == args.length - 1 || args[i + 1].startsWith("-")) //$NON-NLS-1$ continue; processParameter(args[i], args[++i], publisherInfo); @@ -157,9 +170,11 @@ public abstract class AbstractPublisherApplication implements IApplication { /** * Process application arguments. + * * @throws URISyntaxException thrown by subclasses */ - protected void processParameter(String arg, String parameter, PublisherInfo publisherInfo) throws URISyntaxException { + protected void processParameter(String arg, String parameter, PublisherInfo publisherInfo) + throws URISyntaxException { try { if (arg.equalsIgnoreCase("-metadataRepository") || arg.equalsIgnoreCase("-mr")) //$NON-NLS-1$ //$NON-NLS-2$ metadataLocation = URIUtil.fromString(parameter); @@ -174,8 +189,10 @@ public abstract class AbstractPublisherApplication implements IApplication { metadataRepoName = parameter; if (arg.equalsIgnoreCase("-source")) { //$NON-NLS-1$ - // check here to see if the location actually exists so we can fail gracefully now rather than unpredictably later - // see bug 272956 where we would fail with an NPE if someone gave us a URL instead of a file-system path + // check here to see if the location actually exists so we can fail gracefully + // now rather than unpredictably later + // see bug 272956 where we would fail with an NPE if someone gave us a URL + // instead of a file-system path if (!new File(parameter).exists()) throw new IllegalArgumentException(NLS.bind(Messages.exception_sourcePath, parameter)); source = parameter; @@ -204,7 +221,7 @@ public abstract class AbstractPublisherApplication implements IApplication { for (String uri : list) { try { result.add(URIUtil.fromString(uri)); - }catch (URISyntaxException e) { + } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } @@ -220,7 +237,7 @@ public abstract class AbstractPublisherApplication implements IApplication { if (arg.equalsIgnoreCase("-publishArtifactRepository") || arg.equalsIgnoreCase("-par")) //$NON-NLS-1$ //$NON-NLS-2$ publisherInfo.setArtifactOptions(publisherInfo.getArtifactOptions() | IPublisherInfo.A_INDEX); - if (arg.equalsIgnoreCase("-overwriteArtifacts")) //$NON-NLS-1$ + if (arg.equalsIgnoreCase("-overwriteArtifacts")) //$NON-NLS-1$ publisherInfo.setArtifactOptions(publisherInfo.getArtifactOptions() | IPublisherInfo.A_OVERWRITE); if (arg.equalsIgnoreCase("-append")) //$NON-NLS-1$ @@ -243,13 +260,14 @@ public abstract class AbstractPublisherApplication implements IApplication { if (agent != null) return; } - ServiceReference<IProvisioningAgentProvider> providerRef = Activator.getContext().getServiceReference(IProvisioningAgentProvider.class); + ServiceReference<IProvisioningAgentProvider> providerRef = Activator.getContext() + .getServiceReference(IProvisioningAgentProvider.class); if (providerRef == null) throw new RuntimeException("No provisioning agent provider is available"); //$NON-NLS-1$ IProvisioningAgentProvider provider = Activator.getContext().getService(providerRef); if (provider == null) throw new RuntimeException("No provisioning agent provider is available"); //$NON-NLS-1$ - //obtain agent for currently running system + // obtain agent for currently running system agent = provider.createAgent(null); Activator.getContext().ungetService(providerRef); } @@ -304,7 +322,8 @@ public abstract class AbstractPublisherApplication implements IApplication { } } if (!result.matches(IStatus.ERROR | IStatus.CANCEL)) { - System.out.println(NLS.bind(Messages.message_generationCompleted, String.valueOf((after - before) / 1000))); + System.out.println( + NLS.bind(Messages.message_generationCompleted, String.valueOf((after - before) / 1000))); return IApplication.EXIT_OK; } } catch (ProvisionException e) { @@ -343,6 +362,13 @@ public abstract class AbstractPublisherApplication implements IApplication { this.metadataLocation = location; } + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated See <a href= + * "https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> + * for details. + */ + @Deprecated(forRemoval = true, since = "1.6.0") public boolean reuseExistingPack200Files() { return reusePackedFiles; } diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/IPublisherInfo.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/IPublisherInfo.java index 0e88610aa..33796f507 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/IPublisherInfo.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/IPublisherInfo.java @@ -8,8 +8,8 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation * IBM - ongoing development ******************************************************************************/ @@ -40,7 +40,7 @@ public interface IPublisherInfo { public static final int A_OVERWRITE = 4; /** - * A bitwise flag indicating that MD5 hash should not be generated when + * A bitwise flag indicating that MD5 hash should not be generated when * publishing an artifact. When this flag is not specified the MD5 hash will * be generated by default. */ @@ -61,9 +61,9 @@ public interface IPublisherInfo { public IMetadataRepository getMetadataRepository(); /** - * Returns whether or not artifacts themselves should be published. - * @return <code>true</code> if artifacts should be published. - * <code>false</code> otherwise. + * Returns a bitflag that controls the publish operation, what is a bitwhise OR + * of {@link #A_INDEX},{@value #A_PUBLISH}, {@link #A_NO_MD5}, + * {@link #A_OVERWRITE} or <code>0</code> if no flags are set. */ public int getArtifactOptions(); @@ -80,7 +80,7 @@ public interface IPublisherInfo { public <T extends IPublisherAdvice> Collection<T> getAdvice(String configSpec, boolean includeDefault, String id, Version version, Class<T> type); /** - * Add the given advice to the set of publishing advices. + * Add the given advice to the set of publishing advices. * @param advice the advice to retain */ public void addAdvice(IPublisherAdvice advice); @@ -95,19 +95,19 @@ public interface IPublisherInfo { public String[] getConfigurations(); /** - * Returns the artifact repository given to the publisher as context for - * the publisher actions. May be <code>null</code>. Note that multiple + * Returns the artifact repository given to the publisher as context for + * the publisher actions. May be <code>null</code>. Note that multiple * repositories may be represented as one composite repository. - * + * * @return the context artifact repository or <code>null</code> if none. */ public IArtifactRepository getContextArtifactRepository(); /** - * Returns the metadata repository given to the publisher as context for - * the publisher actions. May be <code>null</code>. Note that multiple + * Returns the metadata repository given to the publisher as context for + * the publisher actions. May be <code>null</code>. Note that multiple * repositories may be represented as one composite repository. - * + * * @return the context metadata repository or <code>null</code> if none. */ public IMetadataRepository getContextMetadataRepository(); diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java index 9fcd96efd..ebbdde5ea 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java @@ -8,8 +8,8 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation * IBM - ongoing development ******************************************************************************/ @@ -37,18 +37,21 @@ public class Publisher { private IPublisherResult results; /** - * Returns a metadata repository that corresponds to the given settings. If a repository at the - * given location already exists, it is updated with the settings and returned. If no repository - * is found then a new Simple repository is created, configured and returned - * @param agent the provisioning agent to use when creating the repository + * Returns a metadata repository that corresponds to the given settings. If a + * repository at the given location already exists, it is updated with the + * settings and returned. If no repository is found then a new Simple repository + * is created, configured and returned + * + * @param agent the provisioning agent to use when creating the repository * @param location the URL location of the repository - * @param name the name of the repository - * @param append whether or not the repository should appended or cleared + * @param name the name of the repository + * @param append whether or not the repository should appended or cleared * @param compress whether or not to compress the repository index * @return the discovered or created repository * @throws ProvisionException */ - public static IMetadataRepository createMetadataRepository(IProvisioningAgent agent, URI location, String name, boolean append, boolean compress) throws ProvisionException { + public static IMetadataRepository createMetadataRepository(IProvisioningAgent agent, URI location, String name, + boolean append, boolean compress) throws ProvisionException { try { IMetadataRepository result = loadMetadataRepository(agent, location, true, true); if (result != null && result.isModifiable()) { @@ -58,54 +61,75 @@ public class Publisher { return result; } } catch (ProvisionException e) { - //fall through and create a new repository + // fall through and create a new repository } - // the given repo location is not an existing repo so we have to create something + // the given repo location is not an existing repo so we have to create + // something IMetadataRepositoryManager manager = getService(agent, IMetadataRepositoryManager.SERVICE_NAME); String repositoryName = name == null ? location + " - metadata" : name; //$NON-NLS-1$ - IMetadataRepository result = manager.createRepository(location, repositoryName, IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); + IMetadataRepository result = manager.createRepository(location, repositoryName, + IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); if (result != null) { manager.removeRepository(result.getLocation()); result.setProperty(IRepository.PROP_COMPRESSED, compress ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ return result; } - // I don't think we can really get here, but just in case, we better throw a provisioning exception + // I don't think we can really get here, but just in case, we better throw a + // provisioning exception String msg = org.eclipse.equinox.internal.p2.metadata.repository.Messages.repoMan_internalError; - throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, msg, null)); + throw new ProvisionException( + new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, msg, null)); } /** * Load a metadata repository from the given location. - * @param location the URI location of the repository - * @param modifiable whether to ask the manager for a modifiable repository - * @param removeFromManager remove the loaded repository from the manager if it wasn't already loaded + * + * @param location the URI location of the repository + * @param modifiable whether to ask the manager for a modifiable + * repository + * @param removeFromManager remove the loaded repository from the manager if it + * wasn't already loaded * @return the loaded repository * @throws ProvisionException */ - public static IMetadataRepository loadMetadataRepository(IProvisioningAgent agent, URI location, boolean modifiable, boolean removeFromManager) throws ProvisionException { + public static IMetadataRepository loadMetadataRepository(IProvisioningAgent agent, URI location, boolean modifiable, + boolean removeFromManager) throws ProvisionException { IMetadataRepositoryManager manager = getService(agent, IMetadataRepositoryManager.SERVICE_NAME); boolean existing = manager.contains(location); - IMetadataRepository result = manager.loadRepository(location, modifiable ? IRepositoryManager.REPOSITORY_HINT_MODIFIABLE : 0, null); + IMetadataRepository result = manager.loadRepository(location, + modifiable ? IRepositoryManager.REPOSITORY_HINT_MODIFIABLE : 0, null); if (!existing && removeFromManager) manager.removeRepository(location); return result; } /** - * Returns an artifact repository that corresponds to the given settings. If a repository at the - * given location already exists, it is updated with the settings and returned. If no repository - * is found then a new Simple repository is created, configured and returned - * @param agent the provisioning agent to use when creating the repository - * @param location the URL location of the repository - * @param name the name of the repository - * @param compress whether or not to compress the repository index - * @param reusePackedFiles whether or not to include discovered Pack200 files in the repository + * Returns an artifact repository that corresponds to the given settings. If a + * repository at the given location already exists, it is updated with the + * settings and returned. If no repository is found then a new Simple repository + * is created, configured and returned + * + * @param agent the provisioning agent to use when creating the + * repository + * @param location the URL location of the repository + * @param name the name of the repository + * @param compress whether or not to compress the repository index + * @param reusePackedFiles whether or not to include discovered Pack200 files in + * the repository * @return the discovered or created repository * @throws ProvisionException + * + * @deprecated See <a href= + * "https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> + * for details. Use + * {@link #createArtifactRepository(IprovisioningAgent, URI, String, boolean)} + * instead. */ - public static IArtifactRepository createArtifactRepository(IProvisioningAgent agent, URI location, String name, boolean compress, boolean reusePackedFiles) throws ProvisionException { + @Deprecated(forRemoval = true, since = "2.3.0") + public static IArtifactRepository createArtifactRepository(IProvisioningAgent agent, URI location, String name, + boolean compress, boolean reusePackedFiles) throws ProvisionException { try { IArtifactRepository result = loadArtifactRepository(agent, location, true, true); if (result != null && result.isModifiable()) { @@ -115,12 +139,13 @@ public class Publisher { return result; } } catch (ProvisionException e) { - //fall through and create a new repository + // fall through and create a new repository } IArtifactRepositoryManager manager = getService(agent, IArtifactRepositoryManager.SERVICE_NAME); String repositoryName = name != null ? name : location + " - artifacts"; //$NON-NLS-1$ - IArtifactRepository result = manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); + IArtifactRepository result = manager.createRepository(location, repositoryName, + IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); if (result != null) { manager.removeRepository(result.getLocation()); if (reusePackedFiles) @@ -128,24 +153,73 @@ public class Publisher { result.setProperty(IRepository.PROP_COMPRESSED, compress ? "true" : "false"); //$NON-NLS-1$//$NON-NLS-2$ return result; } - // I don't think we can really get here, but just in case, we better throw a provisioning exception + // I don't think we can really get here, but just in case, we better throw a + // provisioning exception + String msg = org.eclipse.equinox.internal.p2.artifact.repository.Messages.repoMan_internalError; + throw new ProvisionException( + new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, msg, null)); + } + + /** + * Returns an artifact repository that corresponds to the given settings. If a + * repository at the given location already exists, it is updated with the + * settings and returned. If no repository is found then a new Simple repository + * is created, configured and returned + * + * @param agent the provisioning agent to use when creating the repository + * @param location the URL location of the repository + * @param name the name of the repository + * @param compress whether or not to compress the repository index + * @return the discovered or created repository + * @throws ProvisionException + */ + @Deprecated(forRemoval = true, since = "2.3.0") + public static IArtifactRepository createArtifactRepository(IProvisioningAgent agent, URI location, String name, + boolean compress) throws ProvisionException { + try { + IArtifactRepository result = loadArtifactRepository(agent, location, true, true); + if (result != null && result.isModifiable()) { + result.setProperty(IRepository.PROP_COMPRESSED, compress ? "true" : "false"); //$NON-NLS-1$//$NON-NLS-2$ + return result; + } + } catch (ProvisionException e) { + // fall through and create a new repository + } + + IArtifactRepositoryManager manager = getService(agent, IArtifactRepositoryManager.SERVICE_NAME); + String repositoryName = name != null ? name : location + " - artifacts"; //$NON-NLS-1$ + IArtifactRepository result = manager.createRepository(location, repositoryName, + IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); + if (result != null) { + manager.removeRepository(result.getLocation()); + result.setProperty(IRepository.PROP_COMPRESSED, compress ? "true" : "false"); //$NON-NLS-1$//$NON-NLS-2$ + return result; + } + // I don't think we can really get here, but just in case, we better throw a + // provisioning exception String msg = org.eclipse.equinox.internal.p2.artifact.repository.Messages.repoMan_internalError; - throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, msg, null)); + throw new ProvisionException( + new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, msg, null)); } /** * Load an artifact repository from the given location. - * @param location the URI location of the repository - * @param modifiable whether to ask the manager for a modifiable repository - * @param removeFromManager remove the loaded repository from the manager if it wasn't already loaded + * + * @param location the URI location of the repository + * @param modifiable whether to ask the manager for a modifiable + * repository + * @param removeFromManager remove the loaded repository from the manager if it + * wasn't already loaded * @return the loaded repository * @throws ProvisionException */ - public static IArtifactRepository loadArtifactRepository(IProvisioningAgent agent, URI location, boolean modifiable, boolean removeFromManager) throws ProvisionException { + public static IArtifactRepository loadArtifactRepository(IProvisioningAgent agent, URI location, boolean modifiable, + boolean removeFromManager) throws ProvisionException { IArtifactRepositoryManager manager = getService(agent, IArtifactRepositoryManager.SERVICE_NAME); boolean existing = manager.contains(location); - IArtifactRepository result = manager.loadRepository(location, modifiable ? IRepositoryManager.REPOSITORY_HINT_MODIFIABLE : 0, null); + IArtifactRepository result = manager.loadRepository(location, + modifiable ? IRepositoryManager.REPOSITORY_HINT_MODIFIABLE : 0, null); if (!existing && removeFromManager) manager.removeRepository(location); return result; @@ -157,12 +231,13 @@ public class Publisher { } /** - * Obtains a service from the agent, waiting for a reasonable timeout period - * if the service is not yet available. This method never returns <code>null</code>; - * an exception is thrown if the service could not be obtained. - * - * @param <T> The type of the service to return - * @param agent The agent to obtain the service from + * Obtains a service from the agent, waiting for a reasonable timeout period if + * the service is not yet available. This method never returns + * <code>null</code>; an exception is thrown if the service could not be + * obtained. + * + * @param <T> The type of the service to return + * @param agent The agent to obtain the service from * @param serviceName The name of the service to obtain * @return The service instance */ @@ -176,13 +251,13 @@ public class Publisher { try { Thread.sleep(100); } catch (InterruptedException e) { - //ignore and keep waiting + // ignore and keep waiting } service = (T) agent.getService(serviceName); if (service != null) return service; } while ((System.currentTimeMillis() - start) < SERVICE_TIMEOUT); - //could not obtain the service + // could not obtain the service throw new IllegalStateException("Unable to obtain required service: " + serviceName); //$NON-NLS-1$ } @@ -236,7 +311,7 @@ public class Publisher { if (info.getArtifactRepository() != null) { finalStatus = info.getArtifactRepository().executeBatch(artifactProcess, sub); if (!finalStatus.matches(IStatus.ERROR | IStatus.CANCEL)) - // If the batch process didn't report any errors, then + // If the batch process didn't report any errors, then // Use the status from our actions finalStatus = artifactProcess.getStatus(); } else { diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java index 55bf28314..f9c52621f 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2018 Code 9 and others. + * Copyright (c) 2008, 2021 Code 9 and others. * * This * program and the accompanying materials are made available under the terms of @@ -17,7 +17,10 @@ package org.eclipse.equinox.p2.publisher.actions; import java.io.*; +import java.lang.module.ModuleDescriptor; +import java.lang.module.ModuleDescriptor.Exports; import java.net.URL; +import java.nio.file.Files; import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils; @@ -38,8 +41,8 @@ import org.osgi.framework.*; public class JREAction extends AbstractPublisherAction { private static final String DEFAULT_JRE_NAME = "a.jre"; //$NON-NLS-1$ - private static final Version DEFAULT_JRE_VERSION = Version.parseVersion("9.0"); //$NON-NLS-1$ - private static final String DEFAULT_PROFILE = "JavaSE-9"; //$NON-NLS-1$ + private static final Version DEFAULT_JRE_VERSION = Version.parseVersion("11.0"); //$NON-NLS-1$ + private static final String DEFAULT_PROFILE = "JavaSE-11"; //$NON-NLS-1$ private static final String PROFILE_LOCATION = "jre.action.profile.location"; //$NON-NLS-1$ private static final String PROFILE_NAME = "osgi.java.profile.name"; //$NON-NLS-1$ private static final String PROFILE_TARGET_VERSION = "org.eclipse.jdt.core.compiler.codegen.targetPlatform"; //$NON-NLS-1$ @@ -102,7 +105,8 @@ public class JREAction extends AbstractPublisherAction { cu.setId(configId); cu.setVersion(iu.getVersion()); VersionRange range = iu.getVersion() == Version.emptyVersion ? VersionRange.emptyRange : new VersionRange(iu.getVersion(), true, Version.MAX_VERSION, true); - cu.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), range, null, false, false)}); + cu.setHost(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), range, null, false, + false)); cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configId, iu.getVersion())}); cu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE); @@ -195,10 +199,8 @@ public class JREAction extends AbstractPublisherAction { for (String namespace : namespaces) { if (NAMESPACE_OSGI_EE.equals(namespace)) { // this is the OSGi capability namespace "osgi.ee" parseEECapability(systemCapability, parsingStatus, parsingResult); - } else { parsingStatus.add(newWarningStatus(NLS.bind(Messages.message_eeIgnoringNamespace, namespace))); - continue; } } } @@ -297,8 +299,22 @@ public class JREAction extends AbstractPublisherAction { } private void initialize(IPublisherInfo publisherInfo) { + File runtimeProfile = null; this.info = publisherInfo; - + if (jreLocation == null && environment == null) { + // create a runtime profile + StringBuilder buffer = createDefaultProfileFromRunningJvm(); + try { + File tempDirectory = Files.createTempDirectory("JREAction").toFile(); //$NON-NLS-1$ + runtimeProfile = new File(tempDirectory, DEFAULT_PROFILE + ".profile"); //$NON-NLS-1$ + try (FileWriter writer = new FileWriter(runtimeProfile)) { + writer.write(buffer.toString()); + } + jreLocation = runtimeProfile; + } catch (IOException e) { + // ignore + } + } if (jreLocation != null) { File javaProfile = null; @@ -322,6 +338,122 @@ public class JREAction extends AbstractPublisherAction { URL profileURL = getResouceFromSystemBundle(profileFile); profileProperties = loadProfile(profileURL); } + if (runtimeProfile != null) { + runtimeProfile.delete(); + runtimeProfile.getParentFile().delete(); + } + } + + /* + * Copied from org.eclipse.osgi.storage.Storage.calculateVMPackages and adopted + * to Java 11 + */ + private String calculateVMPackages() { + try { + List<String> packages = new ArrayList<>(); + ModuleLayer bootLayer = ModuleLayer.boot(); + Set<Module> bootModules = bootLayer.modules(); + for (Module m : bootModules) { + ModuleDescriptor descriptor = m.getDescriptor(); + if (descriptor.isAutomatic()) { + /* + * Automatic modules are supposed to export all their packages. However, + * java.lang.module.ModuleDescriptor::exports returns an empty set for them. Add + * all their packages (as returned by + * java.lang.module.ModuleDescriptor::packages) to the list of VM supplied + * packages. + */ + packages.addAll(descriptor.packages()); + } else { + for (Exports export : descriptor.exports()) { + String pkg = export.source(); + if (!export.isQualified()) { + packages.add(pkg); + } + } + } + } + Collections.sort(packages); + StringBuilder result = new StringBuilder(); + for (String pkg : packages) { + if (result.length() != 0) { + result.append(',').append(' '); + } + result.append(pkg); + } + return result.toString(); + } catch (Exception e) { + + return null; + } + } + + /** + * Creates default profile with minumum version as stated by + * {@link #DEFAULT_PROFILE} and adds packages observed on currently used JVM. + * + * @return generated profile content + */ + @SuppressWarnings("nls") + private StringBuilder createDefaultProfileFromRunningJvm() { + StringBuilder buffer = new StringBuilder(); + final String NEWLINE = System.lineSeparator(); + // add systempackages + buffer.append("org.osgi.framework.system.packages = \\"); + buffer.append(NEWLINE); + buffer.append(' '); + String calculateVMPackages = calculateVMPackages(); + if (calculateVMPackages != null) { + String[] pack; + pack = calculateVMPackages.split(","); + for (int i = 0; i < pack.length; i++) { + buffer.append(pack[i]); + if (i != pack.length - 1) { + buffer.append(','); + buffer.append("\\"); + } + buffer.append(NEWLINE); + } + } + // add EE + buffer.append("org.osgi.framework.executionenvironment = \\\n" + " OSGi/Minimum-1.0,\\\n" + + " OSGi/Minimum-1.1,\\\n" + " OSGi/Minimum-1.2,\\\n" + " JavaSE/compact1-1.8,\\\n" + + " JavaSE/compact2-1.8,\\\n" + " JavaSE/compact3-1.8,\\\n" + " JRE-1.1,\\\n" + " J2SE-1.2,\\\n" + + " J2SE-1.3,\\\n" + " J2SE-1.4,\\\n" + " J2SE-1.5,\\\n" + " JavaSE-1.6,\\\n" + " JavaSE-1.7,\\\n" + + " JavaSE-1.8,\\\n"); + String version = DEFAULT_PROFILE.substring(DEFAULT_PROFILE.indexOf('-') + 1); + int ver = Integer.parseInt(version); + for (int i = 9; i < ver; i++) { + buffer.append(" JavaSE-" + String.valueOf(i) + ",\\\n"); + } + buffer.append(" JavaSE-" + String.valueOf(ver)); + buffer.append(NEWLINE); + + // add capabilities + StringBuilder versionList = new StringBuilder(); + versionList.append("1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8"); + for (int i = 9; i <= ver; i++) { + versionList.append(", " + String.valueOf(i) + ".0"); + } + buffer.append("org.osgi.framework.system.capabilities = \\\n" + + " osgi.ee; osgi.ee=\"OSGi/Minimum\"; version:List<Version>=\"1.0, 1.1, 1.2\",\\\n" + + " osgi.ee; osgi.ee=\"JRE\"; version:List<Version>=\"1.0, 1.1\",\\\n" + + " osgi.ee; osgi.ee=\"JavaSE\"; version:List<Version>=\"" + versionList.toString() + "\",\\\n" + + " osgi.ee; osgi.ee=\"JavaSE/compact1\"; version:List<Version>=\"1.8," + String.valueOf(ver) + + ".0\",\\\n" + " osgi.ee; osgi.ee=\"JavaSE/compact2\"; version:List<Version>=\"1.8," + + String.valueOf(ver) + ".0\",\\\n" + + " osgi.ee; osgi.ee=\"JavaSE/compact3\"; version:List<Version>=\"1.8," + String.valueOf(ver) + ".0\""); + buffer.append(NEWLINE); + + // add profile name and compiler options + buffer.append("osgi.java.profile.name = " + DEFAULT_PROFILE + "\n" + "org.eclipse.jdt.core.compiler.compliance=" + + String.valueOf(ver) + "\n" + "org.eclipse.jdt.core.compiler.source=" + String.valueOf(ver) + "\n" + + "org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\n" + + "org.eclipse.jdt.core.compiler.codegen.targetPlatform=" + String.valueOf(ver) + "\n" + + "org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\n" + + "org.eclipse.jdt.core.compiler.problem.enumIdentifier=error"); + buffer.append(NEWLINE); + return buffer; } private static URL getResouceFromSystemBundle(String entry) { diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java index d62b50b90..f074794b7 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java @@ -112,7 +112,7 @@ public class PublisherHelper { descriptor.setProperty(IArtifactDescriptor.ARTIFACT_SIZE, Long.toString(pathOnDisk.length())); descriptor.setProperty(IArtifactDescriptor.DOWNLOAD_SIZE, Long.toString(pathOnDisk.length())); - boolean generateChecksums = info == null || (info.getArtifactOptions() & IPublisherInfo.A_NO_MD5) == 0; + boolean generateChecksums = info == null || isArtifactGenerateChecksums(info); if (generateChecksums) { calculateChecksums(pathOnDisk, descriptor); } @@ -252,4 +252,49 @@ public class PublisherHelper { return new VersionRange(min, includeMin, max, includeMax); } + + /** + * + * @return <code>true</code> if md5 sums should be generated <code>false</code> + * otherwise + * @since 1.7.0 + */ + public static boolean isArtifactGenerateChecksums(IPublisherInfo publisherInfo) { + if ((publisherInfo.getArtifactOptions() & IPublisherInfo.A_NO_MD5) != 0) { + return false; + } + return true; + } + + /** + * + * @return <code>true</code> if existing artifacts should be overwritten + * <code>false</code> otherwise + * @since 1.7.0 + */ + public static boolean isArtifactOverwrite(IPublisherInfo publisherInfo) { + return (publisherInfo.getArtifactOptions() & IPublisherInfo.A_OVERWRITE) != 0; + } + + /** + * + * @return <code>true</code> if artifacts should published <code>false</code> + * otherwise + * @since 1.7.0 + */ + public static boolean isArtifactPublish(IPublisherInfo publisherInfo) { + int artifactOptions = publisherInfo.getArtifactOptions(); + return artifactOptions == 0 || (artifactOptions & IPublisherInfo.A_PUBLISH) != 0; + } + + /** + * + * @return <code>true</code> if the artifact index should be updated + * <code>false</code> otherwise + * @since 1.7.0 + */ + public static boolean isArtifactIndex(IPublisherInfo publisherInfo) { + int artifactOptions = publisherInfo.getArtifactOptions(); + return artifactOptions == 0 || (artifactOptions & IPublisherInfo.A_INDEX) != 0; + } } diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/.classpath b/bundles/org.eclipse.equinox.p2.reconciler.dropins/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/.classpath +++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.reconciler.dropins/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.reconciler.dropins/.settings/org.eclipse.jdt.core.prefs index daddac459..83ab682e5 100644 --- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/.settings/org.eclipse.jdt.core.prefs @@ -18,9 +18,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -37,6 +37,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -90,6 +91,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -126,7 +128,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -140,7 +143,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -261,7 +263,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -332,7 +333,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -477,7 +477,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/Bootstrap.product b/bundles/org.eclipse.equinox.p2.reconciler.dropins/Bootstrap.product index 833e2413c..f48bab7f0 100644 --- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/Bootstrap.product +++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/Bootstrap.product @@ -30,7 +30,7 @@ <plugin id="org.eclipse.core.expressions"/> <plugin id="org.eclipse.core.jobs"/> <plugin id="org.eclipse.core.net"/> - <plugin id="org.eclipse.core.net.linux.x86_64" fragment="true"/> + <plugin id="org.eclipse.core.net.linux" fragment="true"/> <plugin id="org.eclipse.core.runtime"/> <plugin id="org.eclipse.core.runtime.compatibility.registry" fragment="true"/> <plugin id="org.eclipse.ecf"/> @@ -64,7 +64,7 @@ <plugin id="org.eclipse.equinox.preferences"/> <plugin id="org.eclipse.equinox.registry"/> <plugin id="org.eclipse.equinox.security"/> - <plugin id="org.eclipse.equinox.security.linux.x86_64" fragment="true"/> + <plugin id="org.eclipse.equinox.security.linux" fragment="true"/> <plugin id="org.eclipse.equinox.simpleconfigurator"/> <plugin id="org.eclipse.equinox.simpleconfigurator.manipulator"/> <plugin id="org.eclipse.equinox.util"/> diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.reconciler.dropins/META-INF/MANIFEST.MF index bbab9bf24..104fdb8d6 100644 --- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.reconciler.dropins;singleton:=true -Bundle-Version: 1.3.500.qualifier +Bundle-Version: 1.4.100.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.reconciler.dropins.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -10,7 +10,7 @@ Export-Package: org.eclipse.equinox.internal.p2.reconciler.dropins;x-internal:=t Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)", org.eclipse.equinox.p2.touchpoint.eclipse;bundle-version="1.0.0", org.eclipse.equinox.p2.metadata -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Import-Package: org.eclipse.equinox.app;version="1.0.0", org.eclipse.equinox.internal.p2.artifact.repository, org.eclipse.equinox.internal.p2.core.helpers, diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/pom.xml b/bundles/org.eclipse.equinox.p2.reconciler.dropins/pom.xml index ce2b820d8..d2362a506 100644 --- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/pom.xml +++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.reconciler.dropins</artifactId> - <version>1.3.500-SNAPSHOT</version> + <version>1.4.100-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/.classpath b/bundles/org.eclipse.equinox.p2.repository.tools/.classpath index 030607499..cc48f9f27 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/.classpath +++ b/bundles/org.eclipse.equinox.p2.repository.tools/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" output="bin_ant" path="src_ant"/> diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.repository.tools/.settings/org.eclipse.jdt.core.prefs index 2e78065b1..cc029895e 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.repository.tools/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -36,6 +36,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -89,6 +90,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -125,10 +127,11 @@ 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.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 @@ -136,20 +139,23 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 @@ -241,11 +247,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert @@ -276,6 +283,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -300,13 +309,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert @@ -354,6 +367,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do no org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -390,9 +405,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -428,10 +446,14 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF index 12b2a9c6c..3dba706cb 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-SymbolicName: org.eclipse.equinox.p2.repository.tools;singleton:=true -Bundle-Version: 2.2.600.qualifier +Bundle-Version: 2.3.0.qualifier Bundle-Activator: org.eclipse.equinox.p2.internal.repository.tools.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -15,7 +15,7 @@ Export-Package: org.eclipse.equinox.p2.internal.repository.comparator;x-internal Require-Bundle: org.eclipse.equinox.common;bundle-version="3.3.0", org.eclipse.equinox.registry, org.tukaani.xz;bundle-version="1.3.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.equinox.app;version="1.0.0", org.eclipse.equinox.frameworkadmin;version="2.0.0", diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/pom.xml b/bundles/org.eclipse.equinox.p2.repository.tools/pom.xml index 1a108c792..379a11b8a 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/pom.xml +++ b/bundles/org.eclipse.equinox.p2.repository.tools/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.repository.tools</artifactId> - <version>2.2.600-SNAPSHOT</version> + <version>2.3.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/ClassFileReader.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/ClassFileReader.java index 6ad7ce7e7..1616ea649 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/ClassFileReader.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/ClassFileReader.java @@ -77,7 +77,6 @@ public class ClassFileReader extends ClassFileStruct { private InnerClassesAttribute innerClassesAttribute; private int[] interfaceIndexes; private char[][] interfaceNames; - private int interfacesCount; private int magicNumber; private int majorVersion; private MethodInfo[] methods; @@ -199,21 +198,21 @@ public class ClassFileReader extends ClassFileStruct { } // Read the interfaces, use exception handlers to catch bad format - this.interfacesCount = u2At(classFileBytes, readOffset, 0); + int interfacesCount = u2At(classFileBytes, readOffset, 0); readOffset += 2; this.interfaceNames = NO_INTERFACES_NAMES; this.interfaceIndexes = Utility.EMPTY_INT_ARRAY; - if (this.interfacesCount != 0) { + if (interfacesCount != 0) { if ((decodingFlags & SUPER_INTERFACES) != CONSTANT_POOL) { - this.interfaceNames = new char[this.interfacesCount][]; - this.interfaceIndexes = new int[this.interfacesCount]; - for (int i = 0; i < this.interfacesCount; i++) { + this.interfaceNames = new char[interfacesCount][]; + this.interfaceIndexes = new int[interfacesCount]; + for (int i = 0; i < interfacesCount; i++) { this.interfaceIndexes[i] = u2At(classFileBytes, readOffset, 0); this.interfaceNames[i] = getConstantClassNameAt(classFileBytes, constantPoolOffsets, this.interfaceIndexes[i]); readOffset += 2; } } else { - readOffset += (2 * this.interfacesCount); + readOffset += (2 * interfacesCount); } } // Read the this.fields, use exception handlers to catch bad format diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java index 524c9faea..2a830635e 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java @@ -7,7 +7,7 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * IBM Corporation - initial API and implementation * Compeople AG (Stefan Liebig) - various ongoing maintenance @@ -90,9 +90,11 @@ public class Mirroring { public MultiStatus run(boolean failOnError, boolean verbose) { if (!destination.isModifiable()) - throw new IllegalStateException(NLS.bind(Messages.exception_destinationNotModifiable, destination.getLocation())); + throw new IllegalStateException( + NLS.bind(Messages.exception_destinationNotModifiable, destination.getLocation())); if (compare) - getComparator(); //initialize the comparator. Only needed if we're comparing. Used to force error if comparatorID is invalid. + getComparator(); // initialize the comparator. Only needed if we're comparing. Used to force + // error if comparatorID is invalid. MultiStatus multiStatus = new MultiStatus(Activator.ID, IStatus.OK, Messages.message_mirroringStatus, null); Iterator<IArtifactKey> keys = null; if (keysToMirror != null) @@ -103,7 +105,8 @@ public class Mirroring { } if (compareExclusionQuery != null) { - IQueryResult<IArtifactDescriptor> exclusions = source.descriptorQueryable().query(compareExclusionQuery, null); + IQueryResult<IArtifactDescriptor> exclusions = source.descriptorQueryable().query(compareExclusionQuery, + null); compareExclusions = exclusions.toUnmodifiableSet(); } @@ -112,10 +115,10 @@ public class Mirroring { IArtifactDescriptor[] descriptors = source.getArtifactDescriptors(key); for (IArtifactDescriptor descriptor : descriptors) { IStatus result = mirror(descriptor, verbose); - //Only log INFO and WARNING if we want verbose logging. Always log ERRORs + // Only log INFO and WARNING if we want verbose logging. Always log ERRORs if (!result.isOK() && (verbose || result.getSeverity() == IStatus.ERROR)) multiStatus.add(result); - //stop mirroring as soon as we have an error + // stop mirroring as soon as we have an error if (failOnError && multiStatus.getSeverity() == IStatus.ERROR) return multiStatus; } @@ -146,23 +149,26 @@ public class Mirroring { return multiStatus; } + @SuppressWarnings("removal") private IStatus mirror(IArtifactDescriptor sourceDescriptor, boolean verbose) { - if (!includePacked && IArtifactDescriptor.FORMAT_PACKED.equals(sourceDescriptor.getProperty(IArtifactDescriptor.FORMAT))) + if (!includePacked + && IArtifactDescriptor.FORMAT_PACKED.equals(sourceDescriptor.getProperty(IArtifactDescriptor.FORMAT))) return Status.OK_STATUS; IArtifactDescriptor targetDescriptor = raw ? sourceDescriptor : new ArtifactDescriptor(sourceDescriptor); IArtifactDescriptor baselineDescriptor = getBaselineDescriptor(sourceDescriptor); if (verbose) - System.out.println("Mirroring: " + sourceDescriptor.getArtifactKey() + " (Descriptor: " + sourceDescriptor + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + System.out.println( + "Mirroring: " + sourceDescriptor.getArtifactKey() + " (Descriptor: " + sourceDescriptor + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ MultiStatus compareStatus = new MultiStatus(Activator.ID, IStatus.OK, null, null); boolean comparing = compare && !compareExclusions.contains(sourceDescriptor); if (comparing) { if (baselineDescriptor != null) { - //compare source & baseline + // compare source & baseline compareStatus.add(compare(baseline, baselineDescriptor, source, sourceDescriptor)); - //compare baseline & destination + // compare baseline & destination if (destination.contains(baselineDescriptor)) { compareStatus.add(compareToDestination(baselineDescriptor)); return compareStatus; @@ -173,13 +179,13 @@ public class Mirroring { } } - //from source or baseline + // from source or baseline IArtifactRepository sourceRepository = baselineDescriptor != null ? baseline : source; sourceDescriptor = baselineDescriptor != null ? baselineDescriptor : sourceDescriptor; targetDescriptor = baselineDescriptor != null ? baselineDescriptor : targetDescriptor; IStatus status = null; if (!destination.contains(targetDescriptor)) - //actual download + // actual download status = downloadArtifact(sourceRepository, targetDescriptor, sourceDescriptor); else { String message = NLS.bind(Messages.mirror_alreadyExists, sourceDescriptor, destination); @@ -194,10 +200,13 @@ public class Mirroring { } /** - * Takes an IArtifactDescriptor descriptor and the ProvisionException that was thrown when destination.getOutputStream(descriptor) - * and compares descriptor to the duplicate descriptor in the destination. - * - * Callers should verify the ProvisionException was thrown due to the artifact existing in the destination before invoking this method. + * Takes an IArtifactDescriptor descriptor and the ProvisionException that was + * thrown when destination.getOutputStream(descriptor) and compares descriptor + * to the duplicate descriptor in the destination. + * + * Callers should verify the ProvisionException was thrown due to the artifact + * existing in the destination before invoking this method. + * * @param descriptor * @return the status of the compare */ @@ -209,12 +218,15 @@ public class Mirroring { destDescriptor = destDescriptors[i]; } if (destDescriptor == null) - return new Status(IStatus.INFO, Activator.ID, ProvisionException.ARTIFACT_EXISTS, Messages.Mirroring_noMatchingDescriptor, null); + return new Status(IStatus.INFO, Activator.ID, ProvisionException.ARTIFACT_EXISTS, + Messages.Mirroring_noMatchingDescriptor, null); return compare(source, descriptor, destination, destDescriptor); } - private IStatus compare(IArtifactRepository sourceRepository, IArtifactDescriptor sourceDescriptor, IArtifactRepository destRepository, IArtifactDescriptor destDescriptor) { - IStatus comparison = getComparator().compare(sourceRepository, sourceDescriptor, destRepository, destDescriptor); + private IStatus compare(IArtifactRepository sourceRepository, IArtifactDescriptor sourceDescriptor, + IArtifactRepository destRepository, IArtifactDescriptor destDescriptor) { + IStatus comparison = getComparator().compare(sourceRepository, sourceDescriptor, destRepository, + destDescriptor); if (comparatorLog != null && !comparison.isOK()) comparatorLog.log(sourceDescriptor, comparison); return comparison; @@ -223,7 +235,8 @@ public class Mirroring { /* * Create, and execute a MirrorRequest for a given descriptor. */ - private IStatus downloadArtifact(IArtifactRepository sourceRepo, IArtifactDescriptor destDescriptor, IArtifactDescriptor srcDescriptor) { + private IStatus downloadArtifact(IArtifactRepository sourceRepo, IArtifactDescriptor destDescriptor, + IArtifactDescriptor srcDescriptor) { RawMirrorRequest request = new RawMirrorRequest(srcDescriptor, destDescriptor, destination, transport); request.perform(sourceRepo, new NullProgressMonitor()); @@ -235,7 +248,7 @@ public class Mirroring { } /* - * Get the equivalent descriptor from the baseline repository + * Get the equivalent descriptor from the baseline repository */ private IArtifactDescriptor getBaselineDescriptor(IArtifactDescriptor descriptor) { if (baseline == null || !baseline.contains(descriptor)) @@ -250,8 +263,9 @@ public class Mirroring { return null; } - /* - * Simple validation of a mirror to see if all source descriptors are present in the destination + /* + * Simple validation of a mirror to see if all source descriptors are present in + * the destination */ private IStatus validateMirror(boolean verbose) { MultiStatus status = new MultiStatus(Activator.ID, 0, Messages.Mirroring_ValidationError, null); @@ -280,7 +294,8 @@ public class Mirroring { // Missing an artifact if (verbose) System.out.println(NLS.bind(Messages.Mirroring_missingDescriptor, srcDescriptors[src])); - status.add(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.Mirroring_missingDescriptor, srcDescriptors[src++]))); + status.add(new Status(IStatus.ERROR, Activator.ID, + NLS.bind(Messages.Mirroring_missingDescriptor, srcDescriptors[src++]))); } else { // Its okay if there are extra descriptors in the destination dest++; @@ -294,7 +309,8 @@ public class Mirroring { if (baselineDescriptor != null) srcProperties = baselineDescriptor.getProperties(); } - // Baseline not set, or could not find descriptor so we'll use the source descriptor + // Baseline not set, or could not find descriptor so we'll use the source + // descriptor if (srcProperties == null) srcProperties = srcDescriptors[src].getProperties(); @@ -302,8 +318,12 @@ public class Mirroring { for (String key : srcProperties.keySet()) { if (!srcProperties.get(key).equals(destMap.get(key))) { if (verbose) - System.out.println(NLS.bind(Messages.Mirroring_differentDescriptorProperty, new Object[] {destDescriptors[dest], key, srcProperties.get(key), destMap.get(key)})); - status.add(new Status(IStatus.WARNING, Activator.ID, NLS.bind(Messages.Mirroring_differentDescriptorProperty, new Object[] {destDescriptors[dest], key, srcProperties.get(key), destMap.get(key)}))); + System.out.println(NLS.bind(Messages.Mirroring_differentDescriptorProperty, + new Object[] { destDescriptors[dest], key, srcProperties.get(key), + destMap.get(key) })); + status.add(new Status(IStatus.WARNING, Activator.ID, + NLS.bind(Messages.Mirroring_differentDescriptorProperty, new Object[] { + destDescriptors[dest], key, srcProperties.get(key), destMap.get(key) }))); } } src++; @@ -311,11 +331,13 @@ public class Mirroring { } } - // If there are still source descriptors they're missing from the destination repository + // If there are still source descriptors they're missing from the destination + // repository while (src < srcDescriptors.length) { if (verbose) System.out.println(NLS.bind(Messages.Mirroring_missingDescriptor, srcDescriptors[src])); - status.add(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.Mirroring_missingDescriptor, srcDescriptors[src++]))); + status.add(new Status(IStatus.ERROR, Activator.ID, + NLS.bind(Messages.Mirroring_missingDescriptor, srcDescriptors[src++]))); } } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java index 59555f69f..0e1bb9335 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java @@ -65,10 +65,12 @@ public class RecreateRepositoryApplication extends AbstractApplication { IArtifactRepositoryManager repositoryManager = getArtifactRepositoryManager(); removeArtifactRepo = !repositoryManager.contains(repoLocation); - IArtifactRepository repository = repositoryManager.loadRepository(repoLocation, IRepositoryManager.REPOSITORY_HINT_MODIFIABLE, monitor); + IArtifactRepository repository = repositoryManager.loadRepository(repoLocation, + IRepositoryManager.REPOSITORY_HINT_MODIFIABLE, monitor); if (repository == null || !repository.isModifiable()) - throw new ProvisionException(NLS.bind(Messages.exception_destinationNotModifiable, repository.getLocation())); + throw new ProvisionException( + NLS.bind(Messages.exception_destinationNotModifiable, repository.getLocation())); if (!(repository instanceof IFileArtifactRepository)) throw new ProvisionException(NLS.bind(Messages.exception_notLocalFileRepo, repository.getLocation())); @@ -99,10 +101,11 @@ public class RecreateRepositoryApplication extends AbstractApplication { private void recreateRepository(IProgressMonitor monitor) throws ProvisionException { IArtifactRepositoryManager manager = getArtifactRepositoryManager(); - //add pack200 mappings, the existing repoProperties is not modifiable + // add pack200 mappings, the existing repoProperties is not modifiable Map<String, String> newProperties = new HashMap<>(repoProperties); newProperties.put(PUBLISH_PACK_FILES_AS_SIBLINGS, "true"); //$NON-NLS-1$ - IArtifactRepository repository = manager.createRepository(repoLocation, repoName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, newProperties); + IArtifactRepository repository = manager.createRepository(repoLocation, repoName, + IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, newProperties); if (!(repository instanceof IFileArtifactRepository)) throw new ProvisionException(NLS.bind(Messages.exception_notLocalFileRepo, repository.getLocation())); @@ -130,7 +133,8 @@ public class RecreateRepositoryApplication extends AbstractApplication { // TODO handle errors in some way LogHelper.log(status); - Map<String, String> checksumsToProperties = ChecksumUtilities.checksumsToProperties(IArtifactDescriptor.DOWNLOAD_CHECKSUM, checksums); + Map<String, String> checksumsToProperties = ChecksumUtilities + .checksumsToProperties(IArtifactDescriptor.DOWNLOAD_CHECKSUM, checksums); newDescriptor.addProperties(checksumsToProperties); File temp = new File(artifactFile.getParentFile(), artifactFile.getName() + ".pack.gz"); //$NON-NLS-1$ @@ -148,13 +152,15 @@ public class RecreateRepositoryApplication extends AbstractApplication { } } + @Deprecated(forRemoval = true, since = "2.3.0") private ArtifactDescriptor createPack200ArtifactDescriptor(IArtifactKey key, File packFile, String installSize) { if (packFile != null && packFile.exists()) { ArtifactDescriptor result = new ArtifactDescriptor(key); result.setProperty(IArtifactDescriptor.ARTIFACT_SIZE, installSize); result.setProperty(IArtifactDescriptor.DOWNLOAD_SIZE, Long.toString(packFile.length())); - IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] {new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true)}; //$NON-NLS-1$ + IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] { + new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true) }; //$NON-NLS-1$ result.setProcessingSteps(steps); result.setProperty(IArtifactDescriptor.FORMAT, IArtifactDescriptor.FORMAT_PACKED); return result; diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ProcessRepoTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ProcessRepoTask.java index 243e468d2..6a41e1dcc 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ProcessRepoTask.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ProcessRepoTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 IBM Corporation and others. + * Copyright (c) 2009, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -17,8 +17,7 @@ package org.eclipse.equinox.p2.internal.repository.tools.tasks; import java.io.File; import java.net.URI; import java.net.URISyntaxException; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; +import org.apache.tools.ant.*; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.URIUtil; import org.eclipse.equinox.internal.p2.jarprocessor.ant.JarProcessorTask; @@ -64,6 +63,7 @@ public class ProcessRepoTask extends Task { private SigningOptions signing = null; private JarProcessorTask jarProcessor = null; + @SuppressWarnings("removal") @Override public void execute() throws BuildException { File file = URIUtil.toFile(repository); @@ -112,11 +112,15 @@ public class ProcessRepoTask extends Task { } } + @Deprecated(forRemoval = true, since = "2.3.0") public void setPack(boolean pack) { + log("Support for pack200 is scheduled for removal after June 2023.", Project.MSG_WARN); //$NON-NLS-1$ this.pack = pack; } + @Deprecated(forRemoval = true, since = "2.3.0") public void setNormalize(boolean normalize) { + log("Support for pack200 is scheduled for removal after June 2023.", Project.MSG_WARN); //$NON-NLS-1$ this.repack = normalize; } diff --git a/bundles/org.eclipse.equinox.p2.repository/.options b/bundles/org.eclipse.equinox.p2.repository/.options new file mode 100644 index 000000000..c2d3dc538 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.repository/.options @@ -0,0 +1,3 @@ +org.eclipse.equinox.p2.repository/credentials/debug = false +org.eclipse.equinox.p2.repository/transport/debug = false +org.eclipse.equinox.p2.repository/keyservice/debug = false diff --git a/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF index 444ede092..0f0800872 100644 --- a/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.repository;singleton:=true -Bundle-Version: 2.5.0.qualifier +Bundle-Version: 2.6.0.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.repository.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -42,6 +42,16 @@ Require-Bundle: org.eclipse.equinox.common, Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Import-Package: javax.crypto, + org.bouncycastle;version="1.69.0", + org.bouncycastle.bcpg;version="1.69.0", + org.bouncycastle.gpg.keybox;version="1.69.0", + org.bouncycastle.gpg.keybox.jcajce;version="1.69.0", + org.bouncycastle.openpgp;version="1.69.0", + org.bouncycastle.openpgp.jcajce;version="1.69.0", + org.bouncycastle.openpgp.operator;version="1.69.0", + org.bouncycastle.openpgp.operator.bc;version="1.69.0", + org.bouncycastle.openpgp.operator.jcajce;version="1.69.0", + org.bouncycastle.util.encoders;version="1.69.0", org.eclipse.core.runtime.jobs, org.eclipse.core.runtime.preferences;version="3.2.0", org.eclipse.equinox.internal.p2.core, @@ -61,5 +71,5 @@ Import-Package: javax.crypto, org.osgi.service.packageadmin;version="1.2.0", org.osgi.service.prefs;version="1.0.0", org.osgi.util.tracker;version="1.4.0" -Service-Component: OSGI-INF/cacheManager.xml +Service-Component: OSGI-INF/cacheManager.xml, OSGI-INF/pgpPublicKeyService.xml Automatic-Module-Name: org.eclipse.equinox.p2.repository diff --git a/bundles/org.eclipse.equinox.p2.repository/OSGI-INF/pgpPublicKeyService.xml b/bundles/org.eclipse.equinox.p2.repository/OSGI-INF/pgpPublicKeyService.xml new file mode 100644 index 000000000..e303cd93e --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.repository/OSGI-INF/pgpPublicKeyService.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.equinox.p2.repository.spi.pgpPublicKeyService"> + <implementation class="org.eclipse.equinox.internal.p2.repository.PGPKeyServiceComponent"/> + <service> + <provide interface="org.eclipse.equinox.p2.core.spi.IAgentServiceFactory"/> + </service> + <property name="p2.agent.servicename" type="String" value="org.eclipse.equinox.p2.repository.spi.PGPPublicKeyService"/> +</scr:component> diff --git a/bundles/org.eclipse.equinox.p2.repository/build.properties b/bundles/org.eclipse.equinox.p2.repository/build.properties index f3b28f666..89e396d06 100644 --- a/bundles/org.eclipse.equinox.p2.repository/build.properties +++ b/bundles/org.eclipse.equinox.p2.repository/build.properties @@ -17,6 +17,7 @@ bin.includes = META-INF/,\ about.html,\ plugin.properties,\ OSGI-INF/cacheManager.xml,\ - OSGI-INF/ + OSGI-INF/,\ + .options src.includes = about.html source.. = src/ diff --git a/bundles/org.eclipse.equinox.p2.repository/pom.xml b/bundles/org.eclipse.equinox.p2.repository/pom.xml index 1d72fc07f..7b16ab7c0 100644 --- a/bundles/org.eclipse.equinox.p2.repository/pom.xml +++ b/bundles/org.eclipse.equinox.p2.repository/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.repository</artifactId> - <version>2.5.0-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java index a31a7515d..cfcd0bbe7 100644 --- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java @@ -122,7 +122,7 @@ public class XMLWriter implements XMLConstants { } public static String escape(String txt) { - StringBuffer buffer = null; + StringBuilder buffer = null; for (int i = 0; i < txt.length(); ++i) { String replace; char c = txt.charAt(i); @@ -162,7 +162,7 @@ public class XMLWriter implements XMLConstants { replace = Character.isWhitespace(c) ? " " : null; //$NON-NLS-1$ } if (buffer == null) { - buffer = new StringBuffer(txt.length() + 16); + buffer = new StringBuilder(txt.length() + 16); buffer.append(txt.substring(0, i)); } if (replace != null) diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java index 99b3e9f41..aeda92105 100644 --- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java @@ -27,12 +27,13 @@ import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent; import org.eclipse.equinox.p2.core.IAgentLocation; import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.repository.IRepository; +import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.osgi.util.NLS; /** * A class to manage metadata cache files. Creating the cache files will place * the file in the AgentData location in a cache directory. - * + * * Using the bus listeners will allow the manager to listen for repository * events. When a repository is removed, it will remove the cache file if one * was created for the repository. @@ -94,6 +95,7 @@ public class CacheManager { if (!isURL(remoteFile)) { throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, NLS.bind(Messages.CacheManager_CannotLoadNonUrlLocation, remoteFile), null)); } + checkLocationIsSecure(remoteFile); SubMonitor submonitor = SubMonitor.convert(monitor, 1000); try { @@ -144,13 +146,13 @@ public class CacheManager { /** * Returns a local cache file with the contents of the given remote location, * or <code>null</code> if a local cache could not be created. - * + * * @param repositoryLocation The remote location to be cached * @param prefix The prefix to use when creating the cache file * @param monitor a progress monitor * @return A {@link File} object pointing to the cache file or <code>null</code> * if the location is not a repository. - * @throws FileNotFoundException if neither jar nor xml index file exists at given location + * @throws FileNotFoundException if neither jar nor xml index file exists at given location * @throws AuthenticationFailedException if jar not available and xml causes authentication fail * @throws IOException on general IO errors * @throws ProvisionException on any error (e.g. user cancellation, unknown host, malformed address, connection refused, etc.) @@ -160,7 +162,7 @@ public class CacheManager { if (!isURL(repositoryLocation)) { throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, NLS.bind(Messages.CacheManager_CannotLoadNonUrlLocation, repositoryLocation), null)); } - + checkLocationIsSecure(repositoryLocation); SubMonitor submonitor = SubMonitor.convert(monitor, 1000); try { knownPrefixes.add(prefix); @@ -169,7 +171,7 @@ public class CacheManager { URI xmlLocation = URIUtil.append(repositoryLocation, prefix + XML_EXTENSION); int hashCode = computeHash(repositoryLocation); - // Knowing if cache is stale is complicated by the fact that a jar could have been + // Knowing if cache is stale is complicated by the fact that a jar could have been // produced after an xml index (and vice versa), and by the need to capture any // errors, as these needs to be reported to the user as something meaningful - instead of // just a general "can't read repository". @@ -189,7 +191,7 @@ public class CacheManager { // bug 269588 - server may return 0 when file exists, so extra flag is needed boolean useJar = true; try { - lastModifiedRemote = transport.getLastModified(jarLocation, submonitor.newChild(1)); + lastModifiedRemote = getLastModified(jarLocation, submonitor.newChild(1)); if (lastModifiedRemote <= 0) LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "Server returned lastModified <= 0 for " + jarLocation)); //$NON-NLS-1$ } catch (AuthenticationFailedException e) { @@ -226,8 +228,8 @@ public class CacheManager { // (Status is reported based on finding the XML file as giving up on certain errors // when checking for the jar may not be correct). try { - lastModifiedRemote = transport.getLastModified(xmlLocation, submonitor.newChild(1)); - // if lastModifiedRemote is 0 - something is wrong in the communication stack, as + lastModifiedRemote = getLastModified(xmlLocation, submonitor.newChild(1)); + // if lastModifiedRemote is 0 - something is wrong in the communication stack, as // a FileNotFound exception should have been thrown. // bug 269588 - server may return 0 when file exists - site is not correctly configured if (lastModifiedRemote <= 0) @@ -267,6 +269,30 @@ public class CacheManager { } } + private void checkLocationIsSecure(URI repositoryLocation) { + if ("http".equals(repositoryLocation.getScheme())) { //$NON-NLS-1$ + LogHelper.log(new Status(IStatus.WARNING, Activator.ID, NLS.bind(Messages.unsafeHttp, repositoryLocation))); + } + } + + private long getLastModified(URI location, IProgressMonitor monitor) throws AuthenticationFailedException, FileNotFoundException, CoreException { + CoreException exception = null; + long lastModifiedRemote = -1L; + do { + try { + lastModifiedRemote = transport.getLastModified(location, monitor); + } catch (CoreException e) { + if (e.getStatus() == null) { + throw e; + } + exception = e; + } + } while (exception != null && exception.getStatus() != null && exception.getStatus().getCode() == IArtifactRepository.CODE_RETRY); + if (exception != null) + throw exception; + return lastModifiedRemote; + } + /** * Deletes the local cache file(s) for the given repository * @param repositoryLocation @@ -386,7 +412,7 @@ public class CacheManager { if (!downloadDir.exists()) downloadDir.mkdir(); File tempFile = new File(downloadDir, cacheFile.getName()); - // Ensure that the file from a previous download attempt is removed + // Ensure that the file from a previous download attempt is removed if (tempFile.exists()) safeDelete(tempFile); @@ -402,6 +428,9 @@ public class CacheManager { try { submonitor.setWorkRemaining(1000); result = transport.download(remoteFile, stream, submonitor.newChild(1000)); + while (result.getCode() == IArtifactRepository.CODE_RETRY) { + result = transport.download(remoteFile, stream, submonitor.newChild(1000)); + } } catch (OperationCanceledException e) { // need to pick up the status - a new operation canceled exception is thrown at the end // as status will be CANCEL. diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Messages.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Messages.java index cd508f561..cd53a09b0 100644 --- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Messages.java +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Messages.java @@ -7,7 +7,7 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * IBM Corporation - initial API and implementation * Cloudsmith Inc - additional messages @@ -89,6 +89,7 @@ public class Messages extends NLS { public static String UnableToRead_0_UserCanceled; public static String RepositoryTransport_failedReadRepo; + public static String unsafeHttp; static { // initialize resource bundles diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/PGPKeyServiceComponent.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/PGPKeyServiceComponent.java new file mode 100644 index 000000000..dfb73bc90 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/PGPKeyServiceComponent.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2022 Eclipse contributors and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.equinox.internal.p2.repository; + +import org.eclipse.equinox.internal.provisional.p2.repository.DefaultPGPPublicKeyService; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory; + +public class PGPKeyServiceComponent implements IAgentServiceFactory { + @Override + public Object createService(IProvisioningAgent agent) { + return new DefaultPGPPublicKeyService(agent); + } +} diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/RepositoryPreferences.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/RepositoryPreferences.java index a126e80b6..23ce204bf 100644 --- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/RepositoryPreferences.java +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/RepositoryPreferences.java @@ -15,25 +15,44 @@ package org.eclipse.equinox.internal.p2.repository; */ public class RepositoryPreferences { + /** See bug 574173: allow to retry download if specified */ + private static boolean retryOnSocketTimeout = Boolean.getBoolean("p2.RepositoryPreferences.retryOnSocketTimeout"); //$NON-NLS-1$ + + /** See bug 574173 */ + private static int connectionRetryCount = Integer.getInteger("p2.RepositoryPreferences.connectionRetryCount", 1); //$NON-NLS-1$ + + /** See bug 574173 */ + private static int connectionMsRetryDelay = Integer.getInteger("p2.RepositoryPreferences.connectionMsRetryDelay", //$NON-NLS-1$ + 200); + /** - * Number of attempts to connect (with same credentials) before giving up. - * Note that newer ECF using apache HTTPclient has retry by default. - * TODO - make this configurable via a property. - * TODO - consider removing this option + * Number of attempts to connect (with same credentials) before giving up. Note + * that newer ECF using apache HTTPclient has retry by default. TODO - consider + * removing this option + * * @return the value 1 */ public static int getConnectionRetryCount() { - return 1; + return connectionRetryCount; } /** * Reconnect delay after failure to connect (with same credentials)- in milliseconds. * Current implementation returns 200ms. - * TODO - make this configurable via a property * @return the value 200 */ public static long getConnectionMsRetryDelay() { - return 200; + return connectionMsRetryDelay; + } + + /** + * Whether an attempt should be made to retry download if the connection was + * terminated by SocketTimeoutException + * + * @return {@code false} by default + */ + public static boolean getRetryOnSocketTimeout() { + return retryOnSocketTimeout; } /** diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java index 06a338c2a..e85bdb2cb 100644 --- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java @@ -32,8 +32,8 @@ import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent; import org.eclipse.equinox.p2.core.*; import org.eclipse.equinox.p2.core.spi.IAgentService; import org.eclipse.equinox.p2.query.*; -import org.eclipse.equinox.p2.repository.IRepository; -import org.eclipse.equinox.p2.repository.IRepositoryManager; +import org.eclipse.equinox.p2.repository.*; +import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.security.storage.EncodingUtils; import org.eclipse.osgi.util.NLS; import org.osgi.service.prefs.BackingStoreException; @@ -196,6 +196,7 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager clearNotFound(location); boolean wasEnabled = isEnabled(location); String nick = getRepositoryProperty(location, IRepository.PROP_NICKNAME); + String system = getRepositoryProperty(location, IRepository.PROP_SYSTEM); //remove the repository so event is broadcast and repositories can clear their caches if (!removeRepository(location)) fail(location, ProvisionException.REPOSITORY_NOT_FOUND); @@ -204,6 +205,11 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager IRepository<T> result = loadRepository(location, monitor, null, 0); loaded = true; setEnabled(location, wasEnabled); + if (result instanceof ICompositeRepository<?>) { + for (URI childLocation : ((ICompositeRepository<?>) result).getChildren()) { + basicRefreshRepository(childLocation, monitor); + } + } return result; } finally { //if we failed to load, make sure the repository is not lost @@ -211,6 +217,9 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager addRepository(location, wasEnabled, true); if (nick != null) setRepositoryProperty(location, IRepository.PROP_NICKNAME, nick); + if (system != null) { + setRepositoryProperty(location, IRepository.PROP_SYSTEM, system); + } } } @@ -727,6 +736,9 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager ByteArrayOutputStream index = new ByteArrayOutputStream(); IStatus indexFileStatus = null; indexFileStatus = getTransport().download(indexFileURI, index, monitor); + while (indexFileStatus.getCode() == IArtifactRepository.CODE_RETRY) { + indexFileStatus = getTransport().download(indexFileURI, index, monitor); + } if (indexFileStatus != null && indexFileStatus.isOK()) return LocationProperties.create(new ByteArrayInputStream(index.toByteArray())); return LocationProperties.createEmptyIndexFile(); diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java index bb422888a..e4955cefe 100644 --- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java @@ -25,15 +25,18 @@ public class DebugHelper { public static final boolean DEBUG_REPOSITORY_CREDENTIALS; public static final boolean DEBUG_REPOSITORY_TRANSPORT; + public static final boolean DEBUG_KEY_SERVICE; static { DebugOptions options = ServiceHelper.getService(Activator.getContext(), DebugOptions.class); if (options != null) { DEBUG_REPOSITORY_CREDENTIALS = options.getBooleanOption(Activator.ID + "/credentials/debug", false); //$NON-NLS-1$ DEBUG_REPOSITORY_TRANSPORT = options.getBooleanOption(Activator.ID + "/transport/debug", false); //$NON-NLS-1$ + DEBUG_KEY_SERVICE = options.getBooleanOption(Activator.ID + "/keyservice/debug", false); //$NON-NLS-1$ } else { DEBUG_REPOSITORY_CREDENTIALS = false; DEBUG_REPOSITORY_TRANSPORT = false; + DEBUG_KEY_SERVICE = false; } } @@ -50,7 +53,7 @@ public class DebugHelper { System.out.println(buffer.toString()); } - public static void debug(String name, String message, Object[] keyValueArray) { + public static void debug(String name, String message, Object... keyValueArray) { if (keyValueArray == null || keyValueArray.length == 0) debug(name, message); else { diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/messages.properties b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/messages.properties index 8c920be73..a2b8daa56 100644 --- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/messages.properties +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/messages.properties @@ -80,3 +80,4 @@ connection_to_0_failed_on_1_retry_attempt_2=Connection to {0} failed on {1}. Ret UnableToRead_0_TooManyAttempts=Unable to read repository at: {0}. Too many failed login attempts. UnableToRead_0_UserCanceled=Unable to read repository at: {0}. Login canceled by user. RepositoryTransport_failedReadRepo=Error while reading from repository: {0}. +unsafeHttp=Using unsafe http transport to retrieve {0}, see CVE-2021-41033. Consider using https instead.
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/provisional/p2/repository/DefaultPGPPublicKeyService.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/provisional/p2/repository/DefaultPGPPublicKeyService.java new file mode 100644 index 000000000..3aa501986 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/provisional/p2/repository/DefaultPGPPublicKeyService.java @@ -0,0 +1,869 @@ +/******************************************************************************* + * Copyright (c) 2022 Eclipse contributors and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.equinox.internal.provisional.p2.repository; + +import java.io.*; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.ByteBuffer; +import java.nio.file.*; +import java.nio.file.Path; +import java.nio.file.attribute.FileTime; +import java.util.*; +import java.util.function.*; +import org.bouncycastle.bcpg.ArmoredInputStream; +import org.bouncycastle.bcpg.ArmoredOutputStream; +import org.bouncycastle.gpg.keybox.*; +import org.bouncycastle.gpg.keybox.jcajce.JcaKeyBoxBuilder; +import org.bouncycastle.openpgp.*; +import org.bouncycastle.openpgp.jcajce.JcaPGPObjectFactory; +import org.bouncycastle.openpgp.operator.bc.BcPGPContentVerifierBuilderProvider; +import org.bouncycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator; +import org.eclipse.core.runtime.*; +import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; +import org.eclipse.equinox.internal.p2.repository.Transport; +import org.eclipse.equinox.internal.p2.repository.helpers.DebugHelper; +import org.eclipse.equinox.p2.core.IAgentLocation; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.repository.spi.PGPPublicKeyService; + +/** + * @since 2.6 + */ +public class DefaultPGPPublicKeyService extends PGPPublicKeyService { + + /** + * Enable debug tracing either via debug options or via a system property. + */ + private static final boolean DEBUG_KEY_SERVICE = DebugHelper.DEBUG_KEY_SERVICE + || Boolean.TRUE.toString().equalsIgnoreCase(System.getProperty("p2.keyserver.debug")); //$NON-NLS-1$ + + /** + * The system property used to initialized the {@link #keyServer}. + */ + private static final String KEY_SERVERS_PROPERTY = "p2.keyservers"; //$NON-NLS-1$ + + /** + * The system property used to determine where to look for the GPG pubring. + * + * @see #getGPPDirectory() + */ + private static final String GPG_HOME_PROPERTY = "p2.gpg.home"; //$NON-NLS-1$ + + /** + * The system property used to determine whether to enable GPG pubring lookup. + * + * @see #gpg + * @see #setGPG(boolean) + */ + private static final String GPG_PROPERTY = "p2.gpg"; //$NON-NLS-1$ + + /** + * The number of elapsed milliseconds after which keys cached from a key server + * are considered stale such that they will be re-fetched if possible. + */ + private static final long STALE_AFTER_MILLIS = Long.getLong("p2.keyserver.cache.stale", 24) * 1000 * 60 * 60; //$NON-NLS-1$ + + /** + * Reuse p2's transport layer for fetching keys from the key server. + */ + private final Transport transport; + + /** + * Keys {@link #addKey(PGPPublicKey) added} to this key service are cached via + * this map. + */ + private final Map<Long, LocalKeyCache> localKeys = new LinkedHashMap<>(); + + /** + * A folder with locally cached keys, indexed on {@link PGPPublicKey#getKeyID() + * key ID}. + */ + private final Path keyCache; + + /** + * The current key servers. + */ + private final Map<String, PGPKeyServer> keyServers = new LinkedHashMap<>(); + + /** + * Whether to load from GPG's pubring. + */ + private boolean gpg; + + /** + * Creates an instance associated with the given agent. + * + * @param agent the agent for which a key service is provided. + */ + public DefaultPGPPublicKeyService(IProvisioningAgent agent) { + IAgentLocation agentLocation = agent.getService(IAgentLocation.class); + URI dataArea = agentLocation.getDataArea(org.eclipse.equinox.internal.p2.repository.Activator.ID); + keyCache = Paths.get(dataArea).resolve("pgp"); //$NON-NLS-1$ + try { + Files.createDirectories(keyCache); + } catch (IOException e) { + throw new RuntimeException(e); + } + + if (DEBUG_KEY_SERVICE) { + DebugHelper.debug("KeyServer", "Cache", "location", keyCache); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + String keyServersProperty = System.getProperty(KEY_SERVERS_PROPERTY, ""); //$NON-NLS-1$ + if (!keyServersProperty.isBlank()) { + Set<String> keyServersSet = new LinkedHashSet<>(); + for (String keyServer : keyServersProperty.split("[,; \t]+")) { //$NON-NLS-1$ + if (!keyServer.isEmpty()) { + keyServersSet.add(keyServer); + } + } + + setKeyServers(keyServersSet); + } + + setGPG(Boolean.TRUE.toString().equalsIgnoreCase(System.getProperty(GPG_PROPERTY, Boolean.TRUE.toString())) + || !System.getProperty(GPG_HOME_PROPERTY, "").isBlank()); //$NON-NLS-1$ + + transport = agent.getService(Transport.class); + } + + public Set<String> getKeyServers() { + return Collections.unmodifiableSet(keyServers.keySet()); + } + + public void setKeyServers(Set<String> keyServers) { + Map<String, PGPKeyServer> newKeyServers = new LinkedHashMap<>(); + for (String keyServer : keyServers) { + PGPKeyServer pgpKeyServer = this.keyServers.get(keyServer); + if (pgpKeyServer == null) { + pgpKeyServer = new PGPKeyServer(keyServer, this.keyCache) { + @Override + protected boolean isStale(Path path) { + return DefaultPGPPublicKeyService.this.isStale(path); + } + + @Override + protected IStatus download(URI uri, OutputStream receiver, IProgressMonitor monitor) { + return DefaultPGPPublicKeyService.this.download(uri, receiver, monitor); + } + + @Override + protected void log(Throwable throwable) { + DefaultPGPPublicKeyService.this.log(throwable); + } + }; + } + newKeyServers.put(keyServer, pgpKeyServer); + } + + this.keyServers.clear(); + this.keyServers.putAll(newKeyServers); + } + + @Override + public PGPPublicKey getKey(String fingerprint) { + int length = fingerprint.length(); + if (length >= 16) { + long keyID = Long.parseUnsignedLong(fingerprint.substring(length - 16, length), 16); + Collection<PGPPublicKey> keys = getKeys(keyID); + for (PGPPublicKey key : keys) { + if (toHexFingerprint(key).equalsIgnoreCase(fingerprint)) { + return key; + } + } + } + return null; + } + + @Override + public Collection<PGPPublicKey> getKeys(long keyID) { + List<PGPPublicKey> keys = new ArrayList<>(); + for (PGPKeyServer keyServer : keyServers.values()) { + keys.addAll(keyServer.getKeys(keyID)); + } + + keys.addAll(getLocalKeyCache(keyID).get()); + + keys.addAll(getDefaultKeys(keyID)); + + return reconcileKeys(keys); + } + + public boolean isGGP() { + return gpg; + } + + public void setGPG(boolean gpg) { + this.gpg = gpg; + } + + protected List<PGPPublicKey> getDefaultKeys(long keyID) { + return gpg ? getGPGPubringKeys(keyID) : Collections.emptyList(); + } + + protected List<PGPPublicKey> reconcileKeys(List<PGPPublicKey> keys) { + if (keys.size() <= 1) { + return new ArrayList<>(keys); + } + + Map<ByteBuffer, PGPPublicKey> encodings = new LinkedHashMap<>(); + Map<ByteBuffer, PGPPublicKey> fingerprints = new LinkedHashMap<>(); + for (PGPPublicKey key : keys) { + try { + ByteBuffer encoding = ByteBuffer.wrap(key.getEncoded()); + PGPPublicKey existingKey = encodings.put(encoding, key); + if (existingKey == null) { + ByteBuffer fingerprint = ByteBuffer.wrap(key.getFingerprint()); + PGPPublicKey otherKey = fingerprints.put(fingerprint, key); + if (otherKey != null) { + fingerprints.put(fingerprint, choose(otherKey, key)); + } + } + } catch (IOException e) { + log(e); + } + } + + return new ArrayList<>(fingerprints.values()); + } + + /** + * While {@link #reconcileKeys(List) reconciling}, when two keys have the same + * fingerprint, this method must be chosen in favor of the other to be retained + * in the result. + * + * @param key1 the first key from which to choose. + * @param key2 the second key from which to choose. + * @return the key with the newest or most complete details. + */ + protected PGPPublicKey choose(PGPPublicKey key1, PGPPublicKey key2) { + // Favor the one with the newest information. + long signatureTime1 = getNewestSignature(key1); + long signatureTime2 = getNewestSignature(key2); + if (signatureTime1 > signatureTime2) { + return key1; + } else if (signatureTime1 < signatureTime2) { + return key2; + } + + // Favor the one with the most information. + int signatureCount1 = getSignatureCount(key1); + int signatureCount2 = getSignatureCount(key2); + if (signatureCount1 > signatureCount2) { + return key1; + } else if (signatureCount1 < signatureCount2) { + return key2; + } + + return key1; + } + + protected static int getSignatureCount(PGPPublicKey key) { + int result = 0; + for (Iterator<PGPSignature> signatures = key.getSignatures(); signatures.hasNext(); signatures.next()) { + ++result; + } + for (Iterator<PGPSignature> signatures = key.getKeySignatures(); signatures.hasNext(); signatures.next()) { + ++result; + } + return result; + } + + protected static long getNewestSignature(PGPPublicKey key) { + long result = 0; + for (Iterator<PGPSignature> signatures = key.getSignatures(); signatures.hasNext();) { + PGPSignature signature = signatures.next(); + long time = signature.getCreationTime().getTime(); + result = Math.max(result, time); + } + for (Iterator<PGPSignature> signatures = key.getKeySignatures(); signatures.hasNext();) { + PGPSignature signature = signatures.next(); + long time = signature.getCreationTime().getTime(); + result = Math.max(result, time); + } + + return result; + } + + @Override + public PGPPublicKey addKey(PGPPublicKey key) { + long keyID = key.getKeyID(); + LocalKeyCache localKeyCache = getLocalKeyCache(keyID); + localKeyCache.add(key); + + Collection<PGPPublicKey> keys = getKeys(keyID); + byte[] fingerprint = key.getFingerprint(); + for (PGPPublicKey otherKey : keys) { + if (Arrays.equals(otherKey.getFingerprint(), fingerprint)) { + return otherKey; + } + } + + // We should never get this far. + return key; + } + + protected boolean isStale(Path path) { + try { + FileTime lastModifiedTime = Files.getLastModifiedTime(path); + long lastModified = lastModifiedTime.toMillis(); + long currentTime = System.currentTimeMillis(); + return currentTime - lastModified > STALE_AFTER_MILLIS; + } catch (IOException e) { + return true; + } + } + + @Override + public Set<PGPPublicKey> getVerifiedCertifications(PGPPublicKey key) { + Set<PGPPublicKey> certifications = new LinkedHashSet<>(); + LOOP: for (Iterator<PGPSignature> signatures = key.getSignatures(); signatures.hasNext();) { + PGPSignature signature = signatures.next(); + long signingKeyID = signature.getKeyID(); + for (PGPPublicKey signingKey : getKeys(signingKeyID)) { + switch (signature.getSignatureType()) { + case PGPSignature.SUBKEY_BINDING: + case PGPSignature.PRIMARYKEY_BINDING: { + try { + signature.init(new BcPGPContentVerifierBuilderProvider(), signingKey); + if (signature.verifyCertification(signingKey, key) + && isCreatedBeforeRevocation(signature, signingKey)) { + certifications.add(signingKey); + continue LOOP; + } + } catch (PGPException e) { + //$FALL-THROUGH$ + } + break; + } + case PGPSignature.DEFAULT_CERTIFICATION: + case PGPSignature.NO_CERTIFICATION: + case PGPSignature.CASUAL_CERTIFICATION: + case PGPSignature.POSITIVE_CERTIFICATION: { + for (Iterator<String> userIDs = key.getUserIDs(); userIDs.hasNext();) { + String userID = userIDs.next(); + try { + signature.init(new BcPGPContentVerifierBuilderProvider(), signingKey); + if (signature.verifyCertification(userID, key) + && isCreatedBeforeRevocation(signature, signingKey)) { + certifications.add(signingKey); + continue LOOP; + } + } catch (PGPException e) { + //$FALL-THROUGH$ + } + } + break; + } + } + } + } + return certifications; + } + + @Override + public Date getVerifiedRevocationDate(PGPPublicKey key) { + for (Iterator<PGPSignature> signatures = key.getSignatures(); signatures.hasNext();) { + PGPSignature signature = signatures.next(); + long signingKeyID = signature.getKeyID(); + for (PGPPublicKey signingKey : getKeys(signingKeyID)) { + switch (signature.getSignatureType()) { + case PGPSignature.KEY_REVOCATION: + case PGPSignature.CERTIFICATION_REVOCATION: { + try { + signature.init(new BcPGPContentVerifierBuilderProvider(), signingKey); + if (signature.verifyCertification(key)) { + return signature.getCreationTime(); + } + } catch (PGPException e) { + //$FALL-THROUGH$ + } + break; + } + } + } + } + return null; + } + + private LocalKeyCache getLocalKeyCache(long keyID) { + LocalKeyCache localKeyCache = localKeys.get(keyID); + if (localKeyCache == null) { + String hexKeyID = toHex(keyID); + Path cache = keyCache.resolve(hexKeyID + ".asc"); //$NON-NLS-1$ + localKeyCache = new LocalKeyCache(cache) { + @Override + protected List<PGPPublicKey> reconcileKeys(List<PGPPublicKey> keys) { + return DefaultPGPPublicKeyService.this.reconcileKeys(keys); + } + + @Override + protected void log(Throwable throwable) { + DefaultPGPPublicKeyService.this.log(throwable); + } + }; + localKeys.put(keyID, localKeyCache); + } + return localKeyCache; + } + + protected Collection<PGPPublicKey> fetchKeys(URI uri, Path cache) throws IOException { + try { + ByteArrayOutputStream reciever = new ByteArrayOutputStream(); + IStatus download = download(uri, reciever, new NullProgressMonitor()); + if (!download.isOK()) { + Throwable exception = download.getException(); + if (exception != null) { + throw new IOException(download.getMessage(), exception); + } + throw new IOException(download.getMessage()); + } + List<PGPPublicKey> result = new ArrayList<>(); + byte[] bytes = reciever.toByteArray(); + try (InputStream input = new ArmoredInputStream(new ByteArrayInputStream(bytes))) { + result.addAll(loadKeys(input)); + } + + try (OutputStream out = newAtomicOutputStream(cache)) { + out.write(bytes); + } + + return result; + } catch (IOException ex) { + if (Files.isRegularFile(cache)) { + try (InputStream input = new ArmoredInputStream(new BufferedInputStream(Files.newInputStream(cache)))) { + return loadKeys(input); + } catch (IOException ex1) { + try { + // Assume the cache is corrupt so delete it. + Files.delete(cache); + } catch (IOException ex2) { + log(ex2); + } + // Rethrow original network failure exception + throw new IOException("Error while processing " + uri + " as well while processing the cache " //$NON-NLS-1$ //$NON-NLS-2$ + + cache + ": " + ex1.getMessage(), ex); //$NON-NLS-1$ + } + } + throw new IOException("Error while processing " + uri, ex); //$NON-NLS-1$ + } + } + + protected IStatus download(URI uri, OutputStream receiver, IProgressMonitor monitor) { + return transport.download(uri, receiver, monitor); + } + + protected void log(Throwable throwable) { + if (DEBUG_KEY_SERVICE) { + LogHelper.log(new Status(IStatus.ERROR, org.eclipse.equinox.internal.p2.repository.Activator.ID, + throwable.getMessage(), throwable)); + } + } + + protected static OutputStream newAtomicOutputStream(Path cache) throws IOException { + Path temp = Files.createTempFile(cache.getParent(), "out", ".tmp"); //$NON-NLS-1$ //$NON-NLS-2$ + return new BufferedOutputStream(Files.newOutputStream(temp)) { + @Override + public void close() throws IOException { + super.close(); + Files.move(temp, cache, StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING); + } + }; + } + + protected static List<PGPPublicKey> loadKeys(InputStream input) throws IOException { + try { + List<PGPPublicKey> result = new ArrayList<>(); + for (Object o : new JcaPGPObjectFactory(input)) { + if (o instanceof PGPPublicKeyRingCollection) { + collectKeys((PGPPublicKeyRingCollection) o, result::add); + } else if (o instanceof PGPPublicKeyRing) { + collectKeys((PGPPublicKeyRing) o, result::add); + } else if (o instanceof PGPPublicKey) { + result.add((PGPPublicKey) o); + } + } + return result; + } catch (RuntimeException ex) { + throw new IOException(ex); + } + } + + private static void collectKeys(PGPPublicKeyRingCollection pgpPublicKeyRingCollection, + Consumer<PGPPublicKey> collector) { + pgpPublicKeyRingCollection.forEach(keyring -> collectKeys(keyring, collector)); + } + + private static void collectKeys(PGPPublicKeyRing pgpPublicKeyRing, Consumer<PGPPublicKey> collector) { + pgpPublicKeyRing.getPublicKeys().forEachRemaining(collector::accept); + } + + private static abstract class LocalKeyCache { + private Path cache; + private FileTime lastModifiedTime; + private List<PGPPublicKey> keys; + + public LocalKeyCache(Path cache) { + this.cache = cache; + } + + protected abstract void log(Throwable throwable); + + protected abstract List<PGPPublicKey> reconcileKeys(List<PGPPublicKey> keysToReconcile); + + public List<PGPPublicKey> get() { + if (keys != null) { + try { + FileTime newLastModifiedTime = Files.getLastModifiedTime(cache); + if (lastModifiedTime == null || lastModifiedTime.compareTo(newLastModifiedTime) < 0) { + lastModifiedTime = newLastModifiedTime; + } else { + return keys; + } + } catch (Exception e) { + //$FALL-THROUGH$ + } + } + + if (!Files.isRegularFile(cache)) { + return List.of(); + } + + try (InputStream input = new ArmoredInputStream(new BufferedInputStream(Files.newInputStream(cache)))) { + keys = loadKeys(input); + return keys; + } catch (IOException ex) { + log(ex); + try { + // Assume the cache is corrupt so delete it. + Files.delete(cache); + } catch (IOException ex2) { + log(ex2); + } + return List.of(); + } + } + + public void add(PGPPublicKey key) { + List<PGPPublicKey> oldKeys = get(); + List<PGPPublicKey> newKeys = new ArrayList<>(oldKeys); + newKeys.add(key); + newKeys = reconcileKeys(newKeys); + if (!oldKeys.equals(newKeys)) { + try (OutputStream underlyingStream = newAtomicOutputStream(cache); + OutputStream output = new ArmoredOutputStream(underlyingStream)) { + for (PGPPublicKey newKey : newKeys) { + newKey.encode(output); + } + } catch (IOException e) { + log(e); + return; + } + keys = newKeys; + } + } + } + + private static abstract class PGPKeyServer { + private final Map<Long, List<PGPPublicKey>> keyIDMap = new LinkedHashMap<>(); + + private final String keyServer; + + private final Path keyCache; + + public PGPKeyServer(String keyServer, Path baseCache) { + this.keyServer = keyServer; + keyCache = baseCache.resolve(keyServer.replace(':', '_')); + if (!Files.isDirectory(this.keyCache)) { + try { + Files.createDirectory(keyCache); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + + protected abstract boolean isStale(Path path); + + protected abstract IStatus download(URI uri, OutputStream receiver, IProgressMonitor monitor); + + protected abstract void log(Throwable throwable); + + public List<PGPPublicKey> getKeys(long keyID) { + List<PGPPublicKey> keys = keyIDMap.get(keyID); + String hexKeyID = toHex(keyID); + Path cache = keyCache.resolve(hexKeyID + ".asc"); //$NON-NLS-1$ + boolean needsRemoteFetch = !Files.isRegularFile(cache) || isStale(cache); + if (keys == null || needsRemoteFetch) { + try { + Iterable<PGPPublicKey> fetchedKeys; + if (needsRemoteFetch) { + String link = "https://" + keyServer + "/pks/lookup?op=get&search=0x" + hexKeyID; //$NON-NLS-1$ //$NON-NLS-2$ + if (DEBUG_KEY_SERVICE) { + DebugHelper.debug("KeyServer", "Searching", "uri", link); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + URI uri = new URI(link); + fetchedKeys = fetchKeys(uri, cache); + } else { + try (InputStream input = new ArmoredInputStream( + new BufferedInputStream(Files.newInputStream(cache)))) { + fetchedKeys = loadKeys(input); + } + } + + List<PGPPublicKey> newKeys = new ArrayList<>(); + for (PGPPublicKey fetchedKey : fetchedKeys) { + long fetchedKeyID = fetchedKey.getKeyID(); + if (fetchedKeyID == keyID) { + newKeys.add(fetchedKey); + } + } + + keyIDMap.put(keyID, newKeys); + keys = newKeys; + } catch (URISyntaxException | IOException e) { + log(e); + if (keys == null || keys.isEmpty()) { + List<PGPPublicKey> newKeys = List.of(); + keyIDMap.put(keyID, newKeys); + keys = newKeys; + } + } + } + + return Collections.unmodifiableList(keys); + } + + protected Collection<PGPPublicKey> fetchKeys(URI uri, Path cache) throws IOException { + try { + ByteArrayOutputStream reciever = new ByteArrayOutputStream(); + IStatus download = download(uri, reciever, new NullProgressMonitor()); + if (!download.isOK()) { + // If the file is not found, save an empty file to prevent repeated attempts to + // download from this URI. + Throwable exception = download.getException(); + if (exception instanceof FileNotFoundException) { + log(exception); + } else { + if (exception != null) { + throw new IOException(download.getMessage(), exception); + } + throw new IOException(download.getMessage()); + } + } + List<PGPPublicKey> result; + byte[] bytes = reciever.toByteArray(); + try { + try (InputStream input = new ArmoredInputStream(new ByteArrayInputStream(bytes))) { + result = loadKeys(input); + } + } catch (IOException ex) { + log(ex); + // If the bytes can't be processed cache an empty file to prevent repeated + // attempts. + bytes = new byte[0]; + result = List.of(); + } + + try (OutputStream out = newAtomicOutputStream(cache)) { + out.write(bytes); + } + + return result; + } catch (IOException ex) { + // If the key server fails, load the cache if it exists. + if (Files.isRegularFile(cache)) { + try (InputStream input = new ArmoredInputStream( + new BufferedInputStream(Files.newInputStream(cache)))) { + return loadKeys(input); + } catch (IOException ex1) { + try { + // Assume the cache is corrupt so delete it. + Files.delete(cache); + } catch (IOException ex2) { + log(ex2); + } + // Rethrow original network failure exception with additional details + throw new IOException("Error while processing " + uri + " as well while processing the cache " //$NON-NLS-1$ //$NON-NLS-2$ + + cache + ": " + ex1.getMessage(), ex); //$NON-NLS-1$ + } + } + throw new IOException("Error while processing " + uri, ex); //$NON-NLS-1$ + } + } + + } + + private static List<PGPPublicKey> getGPGPubringKeys(long keyID) { + return GPGPubringCache.getKeys(keyID); + } + + private static class GPGPubringCache { + private static final Supplier<PGPPublicKeyRingCollection> GPG_PUBRING = getGPGPubring(); + private static volatile PGPPublicKeyRingCollection cachePubring; + private static volatile Map<Long, List<PGPPublicKey>> cache; + + public static List<PGPPublicKey> getKeys(long keyID) { + PGPPublicKeyRingCollection pubring = GPG_PUBRING.get(); + if (pubring != cachePubring) { + Map<Long, List<PGPPublicKey>> newCache = new LinkedHashMap<>(); + for (Iterator<PGPPublicKeyRing> keyRings = pubring.getKeyRings(); keyRings.hasNext();) { + for (PGPPublicKey key : keyRings.next()) { + long keyID2 = key.getKeyID(); + List<PGPPublicKey> keys = newCache.computeIfAbsent(keyID2, it -> new ArrayList<>()); + keys.add(key); + } + } + cache = newCache; + cachePubring = pubring; + } + + List<PGPPublicKey> result = cache.get(keyID); + return result == null ? List.of() : result; + } + } + + private static abstract class GPGPubringSupplier implements Supplier<PGPPublicKeyRingCollection> { + + private final Path pubring; + + private PGPPublicKeyRingCollection keyRingCollection; + + private FileTime lastModifiedTime; + + public GPGPubringSupplier(Path pubring) { + this.pubring = pubring; + try { + keyRingCollection = new PGPPublicKeyRingCollection(Collections.emptyList()); + } catch (IOException | PGPException e) { + // Cannot happen for an empty collection. + throw new RuntimeException(e); + } + } + + @Override + public PGPPublicKeyRingCollection get() { + try { + FileTime newLastModifiedTime = Files.getLastModifiedTime(pubring); + if (lastModifiedTime == null || lastModifiedTime.compareTo(newLastModifiedTime) < 0) { + lastModifiedTime = newLastModifiedTime; + keyRingCollection = buildPubring(); + } + } catch (Exception e) { + //$FALL-THROUGH$ + } + return keyRingCollection; + } + + protected abstract PGPPublicKeyRingCollection buildPubring() throws Exception; + } + + private static Supplier<PGPPublicKeyRingCollection> getGPGPubring() { + Path gpgDirectory = getGPPDirectory(); + Path pubringGpg = gpgDirectory.resolve("pubring.gpg"); //$NON-NLS-1$ + Path pubringKbx = gpgDirectory.resolve("pubring.kbx"); //$NON-NLS-1$ + + if (Files.isRegularFile(pubringGpg)) { + return new GPGPubringSupplier(pubringGpg) { + @Override + protected PGPPublicKeyRingCollection buildPubring() throws Exception { + try (InputStream input = new BufferedInputStream(Files.newInputStream(pubringGpg))) { + PGPPublicKeyRingCollection keyRingCollection = new PGPPublicKeyRingCollection(input, + new JcaKeyFingerprintCalculator()); + return keyRingCollection; + } + } + }; + } else if (Files.isRegularFile(pubringKbx)) { + return new GPGPubringSupplier(pubringKbx) { + @Override + protected PGPPublicKeyRingCollection buildPubring() throws Exception { + try (InputStream input = new BufferedInputStream(Files.newInputStream(pubringKbx))) { + KeyBox keyBox = new JcaKeyBoxBuilder().build(input); + List<PGPPublicKeyRing> pgpPublicKeyRings = new ArrayList<>(); + for (KeyBlob keyBlob : keyBox.getKeyBlobs()) { + switch (keyBlob.getType()) { + case OPEN_PGP_BLOB: { + PGPPublicKeyRing pgpPublicKeyRing = ((PublicKeyRingBlob) keyBlob).getPGPPublicKeyRing(); + pgpPublicKeyRings.add(pgpPublicKeyRing); + } + default: { + //$FALL-THROUGH$ + } + } + } + PGPPublicKeyRingCollection keyRingCollection = new PGPPublicKeyRingCollection( + pgpPublicKeyRings); + return keyRingCollection; + } + } + }; + } else { + PGPPublicKeyRingCollection empty; + try { + empty = new PGPPublicKeyRingCollection(Collections.emptyList()); + } catch (IOException | PGPException e) { + // Cannot happen for an empty collection. + throw new RuntimeException(e); + } + return () -> empty; + } + } + + @SuppressWarnings("nls") + private static Path getGPPDirectory() { + // Handle ~ as might be used on macos and linux. + Function<String, Path> resolveTilde = s -> { + if (s.startsWith("~/") || s.startsWith("~" + File.separatorChar)) { + return new File(System.getProperty("user.home"), s.substring(2)).getAbsoluteFile().toPath(); + } + return Paths.get(s); + }; + + // Allow the user to specify the GPG home used by p2 specifically. + Path path = checkDirectory(System.getProperty(GPG_HOME_PROPERTY), resolveTilde); + if (path != null) { + return path; + } + + path = checkDirectory(System.getenv("GNUPGHOME"), resolveTilde); + if (path != null) { + return path; + } + + if ("win32".equals(System.getProperty("osgi.os"))) { + // On Windows prefer %APPDATA%\gnupg if it exists, even if Cygwin is used. + path = checkDirectory(System.getenv("APPDATA"), //$NON-NLS-1$ + s -> Paths.get(s).resolve("gnupg")); //$NON-NLS-1$ + if (path != null) { + return path; + } + } + // All systems, including Cygwin and even Windows if %APPDATA%\gnupg doesn't + // exist. + return resolveTilde.apply("~/.gnupg"); //$NON-NLS-1$ + } + + private static Path checkDirectory(String dir, Function<String, Path> toPath) { + if (dir != null && !dir.isBlank()) { + try { + Path directory = toPath.apply(dir); + if (Files.isDirectory(directory)) { + return directory; + } + } catch (RuntimeException e) { + //$FALL-THROUGH$ + } + } + return null; + } +} diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactDescriptor.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactDescriptor.java index 9b5cd4d9b..2403402ac 100644 --- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactDescriptor.java +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactDescriptor.java @@ -23,7 +23,7 @@ import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; * descriptor defines the artifact it contains, as well as any processing steps that * must be performed when the artifact is transferred out of the repository (such * as decompression, error checking, etc). - * + * * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. Instead subclass the {@link ArtifactDescriptor} class * @since 2.0 @@ -34,37 +34,36 @@ public interface IArtifactDescriptor { * An artifact descriptor property (value "download.size") indicating the number * of bytes that will be transferred when this artifact is transferred out of the repository. */ - public static final String DOWNLOAD_SIZE = "download.size"; //$NON-NLS-1$ + String DOWNLOAD_SIZE = "download.size"; //$NON-NLS-1$ /** * An artifact descriptor property (value "artifact.size") indicating the size in * bytes of the artifact in its native format (after processing steps have been applied). */ - public static final String ARTIFACT_SIZE = "artifact.size"; //$NON-NLS-1$ + String ARTIFACT_SIZE = "artifact.size"; //$NON-NLS-1$ /** * A prefix of an artifact descriptor properties storing checksum * of the artifact bytes that are transferred. * @since 2.4 */ - public static final String DOWNLOAD_CHECKSUM = "download.checksum"; //$NON-NLS-1$ + String DOWNLOAD_CHECKSUM = "download.checksum"; //$NON-NLS-1$ /** * An artifact descriptor property (value "download.md5") indicating the MD5 * checksum of the artifact bytes that are transferred. * @see #DOWNLOAD_CHECKSUM */ - @Deprecated - public static final String DOWNLOAD_MD5 = "download.md5"; //$NON-NLS-1$ + @Deprecated String DOWNLOAD_MD5 = "download.md5"; //$NON-NLS-1$ /** - * An artifact descriptor property (value "download.contentType") indicating the + * An artifact descriptor property (value "download.contentType") indicating the * content type of the artifact bytes that are transferred. */ - public static final String DOWNLOAD_CONTENTTYPE = "download.contentType"; //$NON-NLS-1$ + String DOWNLOAD_CONTENTTYPE = "download.contentType"; //$NON-NLS-1$ /** * An content type (value "application/zip") indicating the content is a zip file. */ - public static final String TYPE_ZIP = "application/zip"; //$NON-NLS-1$ + String TYPE_ZIP = "application/zip"; //$NON-NLS-1$ /** * A prefix of an artifact descriptor property storing list of @@ -72,7 +71,7 @@ public interface IArtifactDescriptor { * been applied). * @since 2.4 */ - public static final String ARTIFACT_CHECKSUM = "artifact.checksum"; //$NON-NLS-1$ + String ARTIFACT_CHECKSUM = "artifact.checksum"; //$NON-NLS-1$ /** * An artifact descriptor property (value "artifact.md5") indicating the MD5 @@ -80,59 +79,61 @@ public interface IArtifactDescriptor { * been applied). * @see #ARTIFACT_CHECKSUM */ - @Deprecated - public static final String ARTIFACT_MD5 = "artifact.md5"; //$NON-NLS-1$ + @Deprecated String ARTIFACT_MD5 = "artifact.md5"; //$NON-NLS-1$ /** * An artifact descriptor property (value "format") indicating the storage format * of the artifact in the repository. * @see #FORMAT_PACKED */ - public static final String FORMAT = "format"; //$NON-NLS-1$ + String FORMAT = "format"; //$NON-NLS-1$ /** * A property value for the {@link #FORMAT} artifact descriptor property (value "packed") * indicating the storage format is using pack200 compression. * @see #FORMAT + * @noreference This field is not intended to be referenced by clients. + * + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. */ - public static final String FORMAT_PACKED = "packed"; //$NON-NLS-1$ + @Deprecated(forRemoval = true, since = "2.5.0") String FORMAT_PACKED = "packed"; //$NON-NLS-1$ /** * Return the key for the artifact described by this descriptor. * @return the key associated with this descriptor */ - public abstract IArtifactKey getArtifactKey(); + IArtifactKey getArtifactKey(); /** - * Return the value of the given property in this descriptor <code>null</code> + * Return the value of the given property in this descriptor <code>null</code> * is returned if no such property exists * @param key the property key to look for * @return the value of the given property or <code>null</code> */ - public abstract String getProperty(String key); + String getProperty(String key); /** * Returns a read-only collection of the properties of the artifact descriptor. * @return the properties of this artifact descriptor. */ - public Map<String, String> getProperties(); + Map<String, String> getProperties(); - /** + /** * Return the list of processing steps associated with this descriptor. * An empty set of steps implies that this descriptor describes a complete * copy of the artifact in its native form. If one or more steps are present, * they may be performed when the artifact is transferred from the repository * that contains it. - * + * * @return the list of processing steps for this descriptor */ - public abstract IProcessingStepDescriptor[] getProcessingSteps(); + IProcessingStepDescriptor[] getProcessingSteps(); /** * Return the artifact repository that holds the artifact described by this descriptor. * <code>null</code> is returned if this descriptor is not held in a repository. - * + * * @return the repository holding this artifact or <code>null</code> if none. */ - public abstract IArtifactRepository getRepository(); + IArtifactRepository getRepository(); } diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/spi/IArtifactUIServices.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/spi/IArtifactUIServices.java new file mode 100644 index 000000000..b5cc328f5 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/spi/IArtifactUIServices.java @@ -0,0 +1,96 @@ +/******************************************************************************* + * Copyright (c) 2022 Eclipse contributors and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.equinox.p2.repository.artifact.spi; + +import java.io.File; +import java.security.cert.Certificate; +import java.util.*; +import org.bouncycastle.openpgp.PGPPublicKey; +import org.eclipse.equinox.p2.core.UIServices; +import org.eclipse.equinox.p2.core.UIServices.TrustInfo; +import org.eclipse.equinox.p2.metadata.IArtifactKey; + +/** + * An interface optionally implemented by {@link UIServices} to provide richer + * information for the users. In particular, the users often wish to know which + * artifacts are signed by which certificates or which keys when they are + * {@link UIServices#getTrustInfo(Certificate[][], Collection, String[]) + * prompted} whether to trust such certificates or keys. + * + * @since 2.6 + * + * @see UIServices#getTrustInfo(Certificate[][], Collection, String[]) + */ +public interface IArtifactUIServices { + + /** + * Opens a UI prompt to capture information about trusted content. + * + * @param untrustedCertificateChains a map from untrusted certificate chains to + * the set of keys of the artifacts signed by + * that chain. + * @param untrustedPGPKeys a map of untrusted PGP public keys to the + * set of keys of the artifacts signed by that + * key. + * @param unsignedArtifacts a set of keys of the artifacts that are not + * signed. + * @param artifactFiles a map from artifact keys to the file + * associated with that artifact key. + * + * @return the TrustInfo that describes the user's choices for trusting + * certificates, keys, and unsigned content. + * + * @see #getTrustInfo(UIServices, Map, Map, Set, Map) + * @see UIServices + */ + TrustInfo getTrustInfo( // + Map<List<Certificate>, Set<IArtifactKey>> untrustedCertificateChains, // + Map<PGPPublicKey, Set<IArtifactKey>> untrustedPGPKeys, // + Set<IArtifactKey> unsignedArtifacts, // + Map<IArtifactKey, File> artifactFiles); + + /** + * Opens a UI prompt to capture information about trusted content. This + * implementation is useful for delegating to an old-style + * {@link UIServices#getTrustInfo(Certificate[][], Collection, String[]) + * UIServices implementation} that does not support the IArtifactUIServices + * interface. + * + * @param uiServices the delegate UI services. + * @param untrustedCertificateChains a map from untrusted certificate chains to + * the set of keys of the artifacts signed by + * that chain. + * @param untrustedPGPKeys a map of untrusted PGP public keys to the + * set of keys of the artifacts signed by that + * key. + * @param unsignedArtifacts a set of keys of the artifacts that are not + * signed. + * @param artifactFiles a map from artifact keys to the file + * associated with that artifact key. + * + * @return the TrustInfo that describes the user's choices for trusting + * certificates, keys, and unsigned content. + * + * @see #getTrustInfo(Map, Map, Set, Map) + * @see UIServices#getTrustInfo(Certificate[][], Collection, String[]) + */ + static TrustInfo getTrustInfo(UIServices uiServices, // + Map<List<Certificate>, Set<IArtifactKey>> untrustedCertificateChains, // + Map<PGPPublicKey, Set<IArtifactKey>> untrustedPGPKeys, // + Set<IArtifactKey> unsignedArtifacts, // + Map<IArtifactKey, File> artifactFiles) { + Certificate[][] unTrustedCertificateChainsArray = untrustedCertificateChains.keySet().stream() + .map(c -> c.toArray(Certificate[]::new)).toArray(Certificate[][]::new); + String[] details = unsignedArtifacts.isEmpty() ? null + : unsignedArtifacts.stream().map(artifactFiles::get).map(Objects::toString).toArray(String[]::new); + return uiServices.getTrustInfo(unTrustedCertificateChainsArray, untrustedPGPKeys.keySet(), details); + } +} diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/spi/PGPPublicKeyService.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/spi/PGPPublicKeyService.java new file mode 100644 index 000000000..6fbdff286 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/spi/PGPPublicKeyService.java @@ -0,0 +1,243 @@ +/******************************************************************************* + * Copyright (c) 2022 Eclipse contributors and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.equinox.p2.repository.spi; + +import java.util.*; +import org.bouncycastle.openpgp.PGPPublicKey; +import org.bouncycastle.openpgp.PGPSignature; +import org.bouncycastle.util.encoders.Hex; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory; + +/** + * A service for managing and searching {@link PGPPublicKey keys}. + * Implementations may make use of a + * <a href="https://datatracker.ietf.org/doc/html/draft-shaw-openpgp-hkp-00">key + * server</a> to fetch up-to-date information about keys. Implementations should + * generally provide support for caching and efficient lookup of keys, + * especially lookup based on {@link PGPPublicKey#getKeyID() key ID} because + * signatures generally use {@link PGPSignature#getKeyID() key IDs} and this is + * the primary use case. + * + * <p> + * Implementors of this service are responsible for registering the + * implementation with the {@link IProvisioningAgent provisioning agent} either + * {@link IProvisioningAgent#registerService(String, Object) explicitly} or via + * an {@link IAgentServiceFactory agent service factory}. + * </p> + * + * @see PGPPublicKey#getKeyID() + * @see PGPSignature#getKeyID() + * @see IAgentServiceFactory + * @see IProvisioningAgent#registerService(String, Object) + * + * @since 2.6 + */ +public abstract class PGPPublicKeyService { + /** + * The name used for obtaining a reference to the key service. + * + * @see IProvisioningAgent#getService(Class) + * @see IProvisioningAgent#getService(String) + */ + public static final String SERVICE_NAME = PGPPublicKeyService.class.getName(); + + /** + * Returns the key associated with the given + * {@link PGPPublicKey#getFingerprint() fingerprint}. + * + * @param fingerprint the fingerprint for which to search. + * @return the key with the matching fingerprint. + * + * @see PGPPublicKey#getFingerprint() + */ + public PGPPublicKey getKey(byte[] fingerprint) { + return getKey(toHex(fingerprint)); + } + + /** + * Returns the key associated with the given + * {@link PGPPublicKey#getFingerprint() fingerprint} represented as a + * {@link #toHex(byte[]) hexadecimal} string value. + * + * @param fingerprint the fingerprint for which to search. + * @return the key with the matching fingerprint. + * + * @see PGPPublicKey#getFingerprint() + * @see #toHex(byte[]) + */ + public abstract PGPPublicKey getKey(String fingerprint); + + /** + * Returns the keys associated with the given {@link PGPPublicKey#getKeyID() key + * ID}. In general, key ID collisions are possible so implementations must be + * tolerant of that. + * + * @param keyID the key ID for which to search. + * @return the keys with the matching key IDs. + * + * @see PGPPublicKey#getKeyID() + * @see PGPSignature#getKeyID() + */ + public abstract Collection<PGPPublicKey> getKeys(long keyID); + + /** + * Adds the given key to this key service. An implementations may fetch more + * up-to-date information about this key from a key server and may return a + * different key than the one passed in here. In general an implementation may + * also return an existing key, with the same fingerprint, already known to the + * key service. + * + * @param key the key to add. + * @return the normalized key available in this key service. + */ + public abstract PGPPublicKey addKey(PGPPublicKey key); + + /** + * Returns the set of keys that have been verified to have signed the given key. + * These are the links in the web of trust. + * + * @param key the key for which to find keys that have signed it. + * @return the set of keys that have been verified to have signed the given key. + * + * @see PGPSignature#verifyCertification(String, PGPPublicKey) + * @see PGPSignature#verifyCertification(PGPPublicKey, PGPPublicKey) + */ + public abstract Set<PGPPublicKey> getVerifiedCertifications(PGPPublicKey key); + + /** + * If this key has a revocation signature that is verified to have been signed + * by the public key of that revocation signature, this returns the + * {@link PGPSignature#getCreationTime() creation time} of that signature, + * otherwise it returns <code>null</code>. + * + * @param key the key to test for revocation. + * @return when this key was verifiably revoked, or <code>null</code> if it is + * not revoked. + * + * @see PGPSignature#getKeyID() + * @see PGPPublicKey#hasRevocation() + * @see PGPSignature#getCreationTime() + * @see PGPSignature#KEY_REVOCATION + * @see PGPSignature#SUBKEY_REVOCATION + */ + public abstract Date getVerifiedRevocationDate(PGPPublicKey key); + + /** + * Returns whether the signature's {@link PGPSignature creation time} is before + * the key's {@link #getVerifiedRevocationDate(PGPPublicKey) verified revocation + * date}, if that key has one. + * + * @param signature the signature to test. + * @param key the corresponding key of this signature against which to + * test. + * @return <code>true</code> if the signature was created before the key was + * revoked or if the key is not revoked, <code>false</code> otherwise. + * + * @throws IllegalArgumentException if the signature's + * {@link PGPSignature#getKeyID() key} is not + * the same as the key's + * {@link PGPPublicKey#getKeyID() key ID} + */ + public boolean isCreatedBeforeRevocation(PGPSignature signature, PGPPublicKey key) { + if (signature.getKeyID() != key.getKeyID()) { + throw new IllegalArgumentException("The signature's key ID must be the same as the key's key ID"); //$NON-NLS-1$ + } + Date verifiedRevocationDate = getVerifiedRevocationDate(key); + if (verifiedRevocationDate != null) { + long signatureCreationTime = signature.getCreationTime().getTime(); + if (signatureCreationTime >= verifiedRevocationDate.getTime()) { + return false; + } + } + return true; + } + + /** + * Returns the hexadecimal representation of the key's + * {@link PGPPublicKey#getFingerprint() fingerprint}. + * + * @param key the key for which to get the hexadecimal fingerprint. + * + * @return the hexadecimal representation of the key's fingerprint. + */ + public static String toHexFingerprint(PGPPublicKey key) { + return Hex.toHexString(key.getFingerprint()); + } + + /** + * Returns the hexadecimal representation of the given bytes. + * + * @param bytes the bytes to convert to a hexadecimal representation. + * @return the hexadecimal representation of the given bytes. + */ + public static String toHex(byte[] bytes) { + return Hex.toHexString(bytes); + } + + /** + * Returns the hexadecimal representation of the given long value, typically a + * key ID, padded with leading zeros to a length of 16. + * + * @param keyID the long value, typically a key ID, to convert to a hexadecimal + * representation. + * @return the hexadecimal representation of the given long value, padded with + * leading zeros. + */ + public static String toHex(long keyID) { + return String.format("%1$016x", keyID); //$NON-NLS-1$ + } + + /** + * If the signature's {@link PGPSignature#getCreationTime() creation time} is + * before the key's {@link PGPPublicKey#getCreationTime() creation time}, this + * returns a negative value equal to the number of milliseconds that the + * signature was created before the key was created. If the key has a + * {@link PGPPublicKey#getValidSeconds() validity period}, i.e., if the key + * expires, and the signature's creation time is after the key's expiration, + * returns a positive value equal to the number of milliseconds that the + * signature was created after the key's expiration. Otherwise, the signature + * was created during the period of time that the key was valid and this returns + * <code>0</code>. + * + * @param signature the signature to test. + * @param key the corresponding key of this signature against which to + * test. + * @return a negative value representing the number of milliseconds the + * signature was created before the key was created, a positive value + * representing the number of milliseconds the signature as created + * after the key expired, or <code>0</code> if the signature was created + * during the valid period of the key. + * @throws IllegalArgumentException if the signature's + * {@link PGPSignature#getKeyID() key} is not + * the same as the key's + * {@link PGPPublicKey#getKeyID() key ID} + */ + public static long compareSignatureTimeToKeyValidityTime(PGPSignature signature, PGPPublicKey key) { + if (signature.getKeyID() != key.getKeyID()) { + throw new IllegalArgumentException("The signature's key ID must be the same as the key's key ID"); //$NON-NLS-1$ + } + long keyCreationTime = key.getCreationTime().getTime(); + long signatureCreationTime = signature.getCreationTime().getTime(); + long delta = signatureCreationTime - keyCreationTime; + if (delta < 0) { + return delta; + } + long validSeconds = key.getValidSeconds(); + if (validSeconds != 0) { + delta = signatureCreationTime - (keyCreationTime + validSeconds * 1000); + if (delta > 0) { + return delta; + } + } + return 0; + } +} diff --git a/bundles/org.eclipse.equinox.p2.sar/.classpath b/bundles/org.eclipse.equinox.p2.sar/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.sar/.classpath +++ b/bundles/org.eclipse.equinox.p2.sar/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.sar/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.sar/.settings/org.eclipse.jdt.core.prefs index 2ac7183aa..53cfcf706 100644 --- a/bundles/org.eclipse.equinox.p2.sar/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.sar/.settings/org.eclipse.jdt.core.prefs @@ -18,9 +18,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -37,6 +37,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -90,6 +91,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -126,10 +128,11 @@ 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.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 @@ -137,20 +140,23 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 @@ -242,11 +248,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert @@ -277,6 +284,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -301,13 +310,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert @@ -355,6 +368,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do no org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -391,9 +406,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -429,10 +447,14 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.equinox.p2.sar/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.sar/META-INF/MANIFEST.MF index 14256c8cb..00469f5fe 100644 --- a/bundles/org.eclipse.equinox.p2.sar/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.sar/META-INF/MANIFEST.MF @@ -2,9 +2,9 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Sar Plug-in Bundle-SymbolicName: org.eclipse.equinox.p2.sar;singleton:=true -Bundle-Version: 0.2.0.qualifier +Bundle-Version: 0.3.0.qualifier Import-Package: org.osgi.framework;version="1.3.0" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: org.eclipse.equinox.internal.p2.sar;x-friends:="org.eclipse.equinox.p2.artifact.optimizers,org.eclipse.equinox.p2.artifact.processors" Automatic-Module-Name: org.eclipse.equinox.p2.sar diff --git a/bundles/org.eclipse.equinox.p2.sar/pom.xml b/bundles/org.eclipse.equinox.p2.sar/pom.xml index dc1167742..fb9f99428 100644 --- a/bundles/org.eclipse.equinox.p2.sar/pom.xml +++ b/bundles/org.eclipse.equinox.p2.sar/pom.xml @@ -4,12 +4,12 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.sar</artifactId> - <version>0.2.0-SNAPSHOT</version> + <version>0.3.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.tests.discovery/.classpath b/bundles/org.eclipse.equinox.p2.tests.discovery/.classpath index c552bdbf4..0632a4d48 100644 --- a/bundles/org.eclipse.equinox.p2.tests.discovery/.classpath +++ b/bundles/org.eclipse.equinox.p2.tests.discovery/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> <accessrules> <accessrule kind="accessible" pattern="**/internal/**"/> diff --git a/bundles/org.eclipse.equinox.p2.tests.discovery/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.tests.discovery/.settings/org.eclipse.jdt.core.prefs index c28a10615..3d432ca34 100644 --- a/bundles/org.eclipse.equinox.p2.tests.discovery/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.tests.discovery/.settings/org.eclipse.jdt.core.prefs @@ -18,9 +18,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -37,6 +37,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -90,6 +91,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -126,10 +128,11 @@ 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.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 @@ -137,20 +140,23 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 @@ -242,11 +248,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert @@ -277,6 +284,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -301,13 +310,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert @@ -355,6 +368,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do no org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -391,9 +406,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -429,10 +447,14 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.equinox.p2.tests.discovery/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests.discovery/META-INF/MANIFEST.MF index 154242c9a..361f71e5e 100644 --- a/bundles/org.eclipse.equinox.p2.tests.discovery/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.tests.discovery/META-INF/MANIFEST.MF @@ -2,8 +2,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.equinox.p2.tests.discovery;singleton:=true -Bundle-Version: 1.2.0.qualifier -Bundle-Vendor: %Bundle-Provider +Bundle-Version: 1.3.200.qualifier +Bundle-Vendor: %Bundle-Vendor Bundle-Localization: plugin Export-Package: org.eclipse.equinox.p2.discovery.tests;x-internal:=true, org.eclipse.equinox.p2.discovery.tests.core;x-internal:=true, @@ -15,6 +15,6 @@ Require-Bundle: org.eclipse.equinox.p2.discovery;bundle-version="1.0.0", org.junit;bundle-version="3.8.0", org.eclipse.core.runtime;bundle-version="3.1.0", org.eclipse.ui;bundle-version="3.1.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Eclipse-BundleShape: dir Automatic-Module-Name: org.eclipse.equinox.p2.tests.discovery diff --git a/bundles/org.eclipse.equinox.p2.tests.discovery/plugin.xml b/bundles/org.eclipse.equinox.p2.tests.discovery/plugin.xml index 968754bef..f6f6a95f0 100644 --- a/bundles/org.eclipse.equinox.p2.tests.discovery/plugin.xml +++ b/bundles/org.eclipse.equinox.p2.tests.discovery/plugin.xml @@ -86,7 +86,7 @@ style="push"> <parameter name="org.eclipse.equinox.p2.ui.discovery.commands.DirectoryParameter" - value="http://www.eclipse.org/mylyn/discovery/directory-3.3.xml"> + value="https://www.eclipse.org/mylyn/discovery/directory-3.3.xml"> </parameter> <parameter name="org.eclipse.equinox.p2.ui.discovery.commands.TagsParameter" @@ -99,7 +99,7 @@ style="push"> <parameter name="org.eclipse.equinox.p2.ui.discovery.commands.RepositoryParameter" - value="http://download.eclipse.org/tools/mylyn/update/e3.4"> + value="https://download.eclipse.org/tools/mylyn/update/e3.4"> </parameter> </command> </menuContribution> diff --git a/bundles/org.eclipse.equinox.p2.tests.discovery/pom.xml b/bundles/org.eclipse.equinox.p2.tests.discovery/pom.xml index b926bbf97..ce3ff89b1 100644 --- a/bundles/org.eclipse.equinox.p2.tests.discovery/pom.xml +++ b/bundles/org.eclipse.equinox.p2.tests.discovery/pom.xml @@ -4,12 +4,12 @@ <parent> <artifactId>org.eclipse.equinox.p2.tests-parent</artifactId> <groupId>org.eclipse</groupId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../../org.eclipse.equinox.p2.releng/org.eclipse.equinox.p2.tests-parent</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.tests.discovery</artifactId> - <version>1.2.0-SNAPSHOT</version> + <version>1.3.200-SNAPSHOT</version> <packaging>eclipse-test-plugin</packaging> <properties> diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/pom.xml b/bundles/org.eclipse.equinox.p2.tests.optimizers/pom.xml index ca8e0c26a..089a4d389 100644 --- a/bundles/org.eclipse.equinox.p2.tests.optimizers/pom.xml +++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>org.eclipse.equinox.p2.tests-parent</artifactId> <groupId>org.eclipse</groupId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../../org.eclipse.equinox.p2.releng/org.eclipse.equinox.p2.tests-parent</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> diff --git a/bundles/org.eclipse.equinox.p2.tests.reconciler.product/pom.xml b/bundles/org.eclipse.equinox.p2.tests.reconciler.product/pom.xml index 8671f35bc..13eefc82a 100644 --- a/bundles/org.eclipse.equinox.p2.tests.reconciler.product/pom.xml +++ b/bundles/org.eclipse.equinox.p2.tests.reconciler.product/pom.xml @@ -11,7 +11,7 @@ <parent> <groupId>org.eclipse</groupId> <artifactId>org.eclipse.equinox.p2.tests-parent</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../../org.eclipse.equinox.p2.releng/org.eclipse.equinox.p2.tests-parent</relativePath> </parent> diff --git a/bundles/org.eclipse.equinox.p2.tests.reconciler.product/reconciler.product b/bundles/org.eclipse.equinox.p2.tests.reconciler.product/reconciler.product index 02388ffa0..0532b3ab5 100644 --- a/bundles/org.eclipse.equinox.p2.tests.reconciler.product/reconciler.product +++ b/bundles/org.eclipse.equinox.p2.tests.reconciler.product/reconciler.product @@ -38,8 +38,8 @@ <plugin id="org.apache.commons.jxpath"/> <plugin id="org.apache.commons.logging"/> <plugin id="org.apache.felix.scr"/> - <plugin id="org.apache.httpcomponents.httpclient"/> - <plugin id="org.apache.httpcomponents.httpcore"/> + <plugin id="org.apache.httpcomponents.client5.httpclient5"/> + <plugin id="org.apache.httpcomponents.core5.httpcore5"/> <plugin id="org.apache.xmlgraphics"/> <plugin id="org.eclipse.core.commands"/> <plugin id="org.eclipse.core.contenttype"/> @@ -49,7 +49,7 @@ <plugin id="org.eclipse.core.expressions"/> <plugin id="org.eclipse.core.jobs"/> <plugin id="org.eclipse.core.net"/> - <plugin id="org.eclipse.core.net.linux.x86_64" fragment="true"/> + <plugin id="org.eclipse.core.net.linux" fragment="true"/> <plugin id="org.eclipse.core.runtime"/> <plugin id="org.eclipse.e4.core.commands"/> <plugin id="org.eclipse.e4.core.contexts"/> @@ -78,7 +78,7 @@ <plugin id="org.eclipse.ecf.filetransfer"/> <plugin id="org.eclipse.ecf.identity"/> <plugin id="org.eclipse.ecf.provider.filetransfer"/> - <plugin id="org.eclipse.ecf.provider.filetransfer.httpclient45"/> + <plugin id="org.eclipse.ecf.provider.filetransfer.httpclient5"/> <plugin id="org.eclipse.ecf.provider.filetransfer.source"/> <plugin id="org.eclipse.ecf.provider.filetransfer.ssl" fragment="true"/> <plugin id="org.eclipse.ecf.ssl" fragment="true"/> @@ -120,7 +120,7 @@ <plugin id="org.eclipse.equinox.preferences"/> <plugin id="org.eclipse.equinox.registry"/> <plugin id="org.eclipse.equinox.security"/> - <plugin id="org.eclipse.equinox.security.linux.x86_64" fragment="true"/> + <plugin id="org.eclipse.equinox.security.linux" fragment="true"/> <plugin id="org.eclipse.equinox.security.ui"/> <plugin id="org.eclipse.equinox.simpleconfigurator"/> <plugin id="org.eclipse.equinox.simpleconfigurator.manipulator"/> @@ -133,7 +133,6 @@ <plugin id="org.eclipse.osgi.services"/> <plugin id="org.eclipse.osgi.util"/> <plugin id="org.eclipse.swt"/> - <plugin id="org.eclipse.swt.browser.chromium.gtk.linux.x86_64" fragment="true"/> <plugin id="org.eclipse.swt.cocoa.macosx.x86_64" fragment="true"/> <plugin id="org.eclipse.swt.gtk.linux.x86_64" fragment="true"/> <plugin id="org.eclipse.swt.win32.win32.x86_64" fragment="true"/> diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/All p2 UI tests.launch b/bundles/org.eclipse.equinox.p2.tests.ui/All p2 UI tests.launch index 8c97b40d7..d1009331c 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/All p2 UI tests.launch +++ b/bundles/org.eclipse.equinox.p2.tests.ui/All p2 UI tests.launch @@ -78,7 +78,6 @@ <setEntry value="javax.el@default:default"/> <setEntry value="javax.inject@default:default"/> <setEntry value="javax.servlet.jsp@default:default"/> - <setEntry value="javax.servlet@default:default"/> <setEntry value="javax.xml@default:default"/> <setEntry value="net.i2p.crypto.eddsa@default:default"/> <setEntry value="org.apache.ant@default:default"/> @@ -100,7 +99,6 @@ <setEntry value="org.apache.httpcomponents.httpclient@default:default"/> <setEntry value="org.apache.httpcomponents.httpcore@default:default"/> <setEntry value="org.apache.jasper.glassfish@default:default"/> - <setEntry value="org.apache.log4j@default:default"/> <setEntry value="org.apache.lucene.analyzers-common*8.4.1.v20200122-1459@default:default"/> <setEntry value="org.apache.lucene.analyzers-smartcn@default:default"/> <setEntry value="org.apache.lucene.core*8.4.1.v20200122-1459@default:default"/> @@ -108,7 +106,6 @@ <setEntry value="org.apache.sshd.sftp@default:default"/> <setEntry value="org.apache.xerces@default:default"/> <setEntry value="org.apache.xml.resolver@default:default"/> - <setEntry value="org.apache.xml.serializer@default:default"/> <setEntry value="org.apache.xmlgraphics@default:default"/> <setEntry value="org.apiguardian@default:default"/> <setEntry value="org.bouncycastle.bcpg@default:default"/> @@ -249,7 +246,6 @@ <setEntry value="org.eclipse.jdt.launching@default:default"/> <setEntry value="org.eclipse.jdt.ui@default:default"/> <setEntry value="org.eclipse.jdt@default:default"/> - <setEntry value="org.eclipse.jem.util@default:default"/> <setEntry value="org.eclipse.jetty.http@default:default"/> <setEntry value="org.eclipse.jetty.io@default:default"/> <setEntry value="org.eclipse.jetty.security@default:default"/> @@ -305,7 +301,6 @@ <setEntry value="org.eclipse.rcp@default:default"/> <setEntry value="org.eclipse.sdk@default:default"/> <setEntry value="org.eclipse.search@default:default"/> - <setEntry value="org.eclipse.swt.browser.chromium.gtk.linux.x86_64@default:false"/> <setEntry value="org.eclipse.swt.gtk.linux.x86_64@default:false"/> <setEntry value="org.eclipse.swt@default:default"/> <setEntry value="org.eclipse.team.core@default:default"/> @@ -338,7 +333,6 @@ <setEntry value="org.eclipse.urischeme@default:default"/> <setEntry value="org.eclipse.wst.common.core@default:default"/> <setEntry value="org.eclipse.wst.common.emf@default:default"/> - <setEntry value="org.eclipse.wst.common.emfworkbench.integration@default:default"/> <setEntry value="org.eclipse.wst.common.environment@default:default"/> <setEntry value="org.eclipse.wst.common.frameworks.ui@default:default"/> <setEntry value="org.eclipse.wst.common.frameworks@default:default"/> @@ -359,8 +353,6 @@ <setEntry value="org.junit.platform.engine@default:default"/> <setEntry value="org.junit.platform.launcher@default:default"/> <setEntry value="org.junit@default:default"/> - <setEntry value="org.objectweb.asm*9.0.0.v20201001-1419@default:default"/> - <setEntry value="org.objectweb.asm.tree*9.0.0.v20201001-1419@default:default"/> <setEntry value="org.opentest4j@default:default"/> <setEntry value="org.sat4j.core@default:default"/> <setEntry value="org.sat4j.pb@default:default"/> @@ -375,6 +367,7 @@ <setEntry value="org.eclipse.equinox.frameworkadmin.equinox@default:default"/> <setEntry value="org.eclipse.equinox.frameworkadmin.test@default:default"/> <setEntry value="org.eclipse.equinox.frameworkadmin@default:default"/> + <setEntry value="org.eclipse.equinox.p2.artifact.checksums.bouncycastle@default:default"/> <setEntry value="org.eclipse.equinox.p2.artifact.optimizers@default:default"/> <setEntry value="org.eclipse.equinox.p2.artifact.processors@default:default"/> <setEntry value="org.eclipse.equinox.p2.artifact.repository@default:default"/> @@ -382,6 +375,7 @@ <setEntry value="org.eclipse.equinox.p2.core@default:default"/> <setEntry value="org.eclipse.equinox.p2.director.app@default:default"/> <setEntry value="org.eclipse.equinox.p2.director@default:default"/> + <setEntry value="org.eclipse.equinox.p2.directorywatcher@default:default"/> <setEntry value="org.eclipse.equinox.p2.discovery.compatibility@default:default"/> <setEntry value="org.eclipse.equinox.p2.discovery@default:default"/> <setEntry value="org.eclipse.equinox.p2.engine@default:default"/> @@ -391,6 +385,8 @@ <setEntry value="org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility@default:default"/> <setEntry value="org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates@default:default"/> <setEntry value="org.eclipse.equinox.p2.examples.rcp.sdkui@default:default"/> + <setEntry value="org.eclipse.equinox.p2.extensionlocation@default:default"/> + <setEntry value="org.eclipse.equinox.p2.garbagecollector@default:default"/> <setEntry value="org.eclipse.equinox.p2.installer@default:default"/> <setEntry value="org.eclipse.equinox.p2.jarprocessor@default:default"/> <setEntry value="org.eclipse.equinox.p2.metadata.repository@default:default"/> @@ -402,10 +398,12 @@ <setEntry value="org.eclipse.equinox.p2.repository.tools@default:default"/> <setEntry value="org.eclipse.equinox.p2.repository@default:default"/> <setEntry value="org.eclipse.equinox.p2.sar@default:default"/> + <setEntry value="org.eclipse.equinox.p2.tests.discovery@default:default"/> <setEntry value="org.eclipse.equinox.p2.tests.optimizers@default:default"/> <setEntry value="org.eclipse.equinox.p2.tests.ui@default:default"/> <setEntry value="org.eclipse.equinox.p2.tests.verifier@default:default"/> <setEntry value="org.eclipse.equinox.p2.tests@default:default"/> + <setEntry value="org.eclipse.equinox.p2.testserver@default:default"/> <setEntry value="org.eclipse.equinox.p2.touchpoint.eclipse@default:default"/> <setEntry value="org.eclipse.equinox.p2.touchpoint.natives@default:default"/> <setEntry value="org.eclipse.equinox.p2.transport.ecf@default:default"/> diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF index 3edf505f8..58c4adbf1 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.tests.ui -Bundle-Version: 1.3.100.qualifier +Bundle-Version: 1.3.400.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.100", diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/build.properties b/bundles/org.eclipse.equinox.p2.tests.ui/build.properties index e715d4bc7..0264e2b00 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/build.properties +++ b/bundles/org.eclipse.equinox.p2.tests.ui/build.properties @@ -19,4 +19,3 @@ bin.includes = META-INF/,\ plugin.properties,\ test.xml src.includes = about.html -javacWarnings..=-raw,-unchecked,-varargsCast diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml b/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml index 795795864..f941878fb 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml +++ b/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml @@ -15,13 +15,13 @@ <parent> <artifactId>org.eclipse.equinox.p2.tests-parent</artifactId> <groupId>org.eclipse</groupId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../../org.eclipse.equinox.p2.releng/org.eclipse.equinox.p2.tests-parent</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.tests.ui</artifactId> - <version>1.3.100-SNAPSHOT</version> + <version>1.3.400-SNAPSHOT</version> <packaging>eclipse-test-plugin</packaging> <properties> diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java index 048f7e5af..fdb0c5299 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java +++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java @@ -78,7 +78,7 @@ public class ImportExportRemoteTests extends ServerBasedTestCase { try (InputStream input = new FileInputStream(testFile)) { List<IUDetail> ius = importexportService.importP2F(input); assertEquals("Exported the number of features is not expected.", 1, ius.size()); - assertTrue("Exported feature is not expected.", iu.equals(ius.get(0).getIU())); + assertEquals("Exported feature is not expected.", iu, ius.get(0).getIU()); assertEquals("Exported the number of referred repositories is not expected.", 1, ius.get(0).getReferencedRepositories().size()); assertEquals("Exported referred repository is not expected.", uri, @@ -128,7 +128,7 @@ public class ImportExportRemoteTests extends ServerBasedTestCase { try (InputStream input = new FileInputStream(testFile)) { List<IUDetail> ius = importexportService.importP2F(input); assertEquals("Exported the number of features is not expected.", 1, ius.size()); - assertTrue("Exported feature is not expected.", iu.equals(ius.get(0).getIU())); + assertEquals("Exported feature is not expected.", iu, ius.get(0).getIU()); assertEquals("Exported the number of referred repositories is not expected.", 1, ius.get(0).getReferencedRepositories().size()); assertEquals("Exported referred repository is not expected.", uri, diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java index 84353aeea..cbde87226 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java +++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java @@ -14,6 +14,8 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.importexport; +import static org.junit.Assert.assertThrows; + import java.io.*; import java.util.ArrayList; import java.util.List; @@ -67,16 +69,16 @@ public class ImportExportTests extends AbstractProvisioningTest { try (InputStream input = new FileInputStream(p2fFile)) { List<IUDetail> iuDetails = importexportService.importP2F(input); - assertTrue("Should load two features from the p2f file.", iuDetails.size() == 2); + assertEquals("Should load two features from the p2f file.", 2, iuDetails.size()); int counter = 0; for (IUDetail iu : iuDetails) { if ("org.polarion.eclipse.team.svn.connector.feature.group".equals(iu.getIU().getId())) { counter++; - assertTrue("Should have two referred repository.", iu.getReferencedRepositories().size() == 2); + assertEquals("Should have two referred repository.", 2, iu.getReferencedRepositories().size()); } else if ("org.polarion.eclipse.team.svn.connector.svnkit16.feature.group" .equals(iu.getIU().getId())) { counter++; - assertTrue("Should have one referred repository", iu.getReferencedRepositories().size() == 1); + assertEquals("Should have one referred repository", 1, iu.getReferencedRepositories().size()); } } assertEquals("Load unexpected content.", 2, counter); @@ -96,10 +98,8 @@ public class ImportExportTests extends AbstractProvisioningTest { File p2fFile = getTestData("Error load test file.", "testData/importexport/incompatible.p2f"); try (InputStream input = new FileInputStream(p2fFile)) { - importexportService.importP2F(input); - assertTrue("Didn't complain the given file is not supported by current version.", false); - } catch (VersionIncompatibleException e) { - // expected + assertThrows("Didn't complain the given file is not supported by current version.", + VersionIncompatibleException.class, () -> importexportService.importP2F(input)); } } diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java index 319338c91..a4cfbd144 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java +++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java @@ -14,6 +14,8 @@ package org.eclipse.equinox.p2.tests.ui.actions; +import static org.junit.Assert.assertNotEquals; + import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; @@ -35,7 +37,7 @@ public class ElementUtilsTest extends ProfileModificationActionTest { } public void testInvalid() { - assertTrue(ElementUtils.elementsToIUs(getInvalidSelection()).size() == 0); + assertTrue(ElementUtils.elementsToIUs(getInvalidSelection()).isEmpty()); } public void testIUs() { @@ -47,7 +49,7 @@ public class ElementUtilsTest extends ProfileModificationActionTest { } public void testMixedIUsAndNonIUs() { - assertTrue(getMixedIUsAndNonIUs().length != ElementUtils.elementsToIUs(getMixedIUsAndNonIUs()).size()); + assertNotEquals(getMixedIUsAndNonIUs().length, ElementUtils.elementsToIUs(getMixedIUsAndNonIUs()).size()); } public void testMixedIUsAndElements() { @@ -56,15 +58,15 @@ public class ElementUtilsTest extends ProfileModificationActionTest { public void testUpdateUsingElements() throws URISyntaxException { // Two visible repos, one is added, the other is not - URI known1 = new URI("http://example.com/known1"); - URI known2 = new URI("http://example.com/known2"); + URI known1 = new URI("https://example.com/known1"); + URI known2 = new URI("https://example.com/known2"); IMetadataRepositoryManager manager = getMetadataRepositoryManager(); manager.addRepository(known1); // Add system repos that should not be known or affected by ElementUtils // One is an enabled system repo, one is disabled system repo - URI uri = new URI("http://example.com/1"); - URI uri2 = new URI("http://example.com/2"); + URI uri = new URI("https://example.com/1"); + URI uri2 = new URI("https://example.com/2"); manager.addRepository(uri); manager.setRepositoryProperty(uri, IRepository.PROP_SYSTEM, Boolean.toString(true)); manager.addRepository(uri2); @@ -80,10 +82,10 @@ public class ElementUtilsTest extends ProfileModificationActionTest { MetadataRepositoryElement[] elements = children.toArray(new MetadataRepositoryElement[children.size()]); // Add a visible repo not known by the elements - URI uri3 = new URI("http://example.com/3"); + URI uri3 = new URI("https://example.com/3"); manager.addRepository(uri3); - // Now update the repo using the elements. + // Now update the repo using the elements. // We expect known2 to get added because it was in the elements // We expect uri3 to get removed (as if it had been removed from a pref page) // System repos shouldn't be touched diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWithRemediationTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWithRemediationTest.java index acf2fe1d4..bedcda8ae 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWithRemediationTest.java +++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWithRemediationTest.java @@ -35,9 +35,9 @@ import org.eclipse.swt.widgets.TreeItem; */ public class InstallWithRemediationTest extends WizardTest { - // private static final String SELECTION_PAGE = "IUSelectionPage"; + // private static final String SELECTION_PAGE = "IUSelectionPage"; private static final String AVAILABLE_SOFTWARE_PAGE = "AvailableSoftwarePage"; - // private static final String MAIN_IU = "MainIU"; + // private static final String MAIN_IU = "MainIU"; IInstallableUnit toInstall; @@ -54,154 +54,175 @@ public class InstallWithRemediationTest extends WizardTest { iu.setProperty(InstallableUnitDescription.PROP_TYPE_GROUP, "true"); iu.setVersion(Version.createOSGi(2, 0, 0)); iu.setSingleton(true); - iu.setLicenses(new ILicense[] {new License(null, "There is a license to accept!", null)}); - iu.setCapabilities(new IProvidedCapability[] {MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, TOPLEVELIU, iu.getVersion())}); + iu.setLicenses(new ILicense[] { new License(null, "There is a license to accept!", null) }); + iu.setCapabilities(new IProvidedCapability[] { MetadataFactory + .createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, TOPLEVELIU, iu.getVersion()) }); toInstall = MetadataFactory.createInstallableUnit(iu); - createTestMetdataRepository(new IInstallableUnit[] {toInstall, anotherIUToInstall}); + createTestMetdataRepository(new IInstallableUnit[] { toInstall, anotherIUToInstall }); } // - // public void testInstallWizardResolved() { - // ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>(); - // iusInvolved.add(toInstall); - // InstallOperation op = new InstallOperation(getSession(), iusInvolved); - // op.setProfileId(TESTPROFILE); - // PreselectedIUInstallWizard wizard = new PreselectedIUInstallWizard(getProvisioningUI(), op, iusInvolved, null); - // ProvisioningWizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard); - // dialog.setBlockOnOpen(false); - // dialog.open(); - // ProfileModificationJob longOp = null; + // public void testInstallWizardResolved() { + // ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>(); + // iusInvolved.add(toInstall); + // InstallOperation op = new InstallOperation(getSession(), iusInvolved); + // op.setProfileId(TESTPROFILE); + // PreselectedIUInstallWizard wizard = new + // PreselectedIUInstallWizard(getProvisioningUI(), op, iusInvolved, null); + // ProvisioningWizardDialog dialog = new + // ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard); + // dialog.setBlockOnOpen(false); + // dialog.open(); + // ProfileModificationJob longOp = null; // - // try { - // SelectableIUsPage page1 = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE); - // // should already have a plan - // assertTrue("1.0", page1.isPageComplete()); - // // simulate the next button by getting next page and showing - // IWizardPage page = page1.getNextPage(); - // dialog.showPage(page); - // // we should be ok - // assertTrue("1.1", page.isPageComplete()); + // try { + // SelectableIUsPage page1 = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE); + // // should already have a plan + // assertTrue("1.0", page1.isPageComplete()); + // // simulate the next button by getting next page and showing + // IWizardPage page = page1.getNextPage(); + // dialog.showPage(page); + // // we should be ok + // assertTrue("1.1", page.isPageComplete()); // - // // if another operation is scheduled for this profile, we should not be allowed to proceed - // longOp = getLongTestOperation(); - // getProvisioningUI().schedule(longOp, StatusManager.LOG); - // // causes recalculation of plan and status - // wizard.recomputePlan(dialog); - // // can't move to next page while op is running - // assertFalse("1.2", page.isPageComplete()); - // longOp.cancel(); + // // if another operation is scheduled for this profile, we should not be + // allowed to proceed + // longOp = getLongTestOperation(); + // getProvisioningUI().schedule(longOp, StatusManager.LOG); + // // causes recalculation of plan and status + // wizard.recomputePlan(dialog); + // // can't move to next page while op is running + // assertFalse("1.2", page.isPageComplete()); + // longOp.cancel(); // - // // op is no longer running, recompute plan - // wizard.recomputePlan(dialog); + // // op is no longer running, recompute plan + // wizard.recomputePlan(dialog); // - // // license needs approval - // assertFalse("1.4", wizard.canFinish()); - // // finish button should be disabled - // dialog.updateButtons(); - // Button finishButton = dialog.testGetButton(IDialogConstants.FINISH_ID); - // assertFalse("1.5", finishButton.isEnabled()); - // } finally { - // dialog.getShell().close(); - // if (longOp != null) - // longOp.cancel(); - // } - // } + // // license needs approval + // assertFalse("1.4", wizard.canFinish()); + // // finish button should be disabled + // dialog.updateButtons(); + // Button finishButton = dialog.testGetButton(IDialogConstants.FINISH_ID); + // assertFalse("1.5", finishButton.isEnabled()); + // } finally { + // dialog.getShell().close(); + // if (longOp != null) + // longOp.cancel(); + // } + // } // - // public void testInstallWizard() throws Exception { - // ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>(); - // iusInvolved.add(toInstall); - // InstallOperation op = new MyNewInstallOperation(getSession(), iusInvolved); - // op.setProfileId(TESTPROFILE); - // PreselectedIUInstallWizard wizard = new PreselectedIUInstallWizard(getProvisioningUI(), op, iusInvolved, null); - // ProvisioningWizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard); - // dialog.setBlockOnOpen(false); - // dialog.open(); - // ProfileModificationJob longOp = null; + // public void testInstallWizard() throws Exception { + // ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>(); + // iusInvolved.add(toInstall); + // InstallOperation op = new MyNewInstallOperation(getSession(), iusInvolved); + // op.setProfileId(TESTPROFILE); + // PreselectedIUInstallWizard wizard = new + // PreselectedIUInstallWizard(getProvisioningUI(), op, iusInvolved, null); + // ProvisioningWizardDialog dialog = new + // ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard); + // dialog.setBlockOnOpen(false); + // dialog.open(); + // ProfileModificationJob longOp = null; // - // try { - // SelectableIUsPage page1 = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE); - // // should already have a plan - // assertTrue("1.0", page1.isPageComplete()); - // // simulate the next button by getting next page and showing - // InstallWizardPage page = (InstallWizardPage) page1.getNextPage(); + // try { + // SelectableIUsPage page1 = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE); + // // should already have a plan + // assertTrue("1.0", page1.isPageComplete()); + // // simulate the next button by getting next page and showing + // InstallWizardPage page = (InstallWizardPage) page1.getNextPage(); // - // // get the operation - // Field opField = ResolutionResultsWizardPage.class.getDeclaredField("resolvedOperation"); - // opField.setAccessible(true); - // assertTrue("Expected instance of MyNewInstallOperation", opField.get(page) instanceof MyNewInstallOperation); - // } finally { - // dialog.getShell().close(); - // if (longOp != null) - // longOp.cancel(); - // } - // } + // // get the operation + // Field opField = + // ResolutionResultsWizardPage.class.getDeclaredField("resolvedOperation"); + // opField.setAccessible(true); + // assertTrue("Expected instance of MyNewInstallOperation", opField.get(page) + // instanceof MyNewInstallOperation); + // } finally { + // dialog.getShell().close(); + // if (longOp != null) + // longOp.cancel(); + // } + // } // - // public void testInstallWizardWithoutLicenceBypass() throws Exception { - // ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>(); - // iusInvolved.add(toInstall); - // InstallOperation op = new MyNewInstallOperation(getSession(), iusInvolved); - // op.setProfileId(TESTPROFILE); - // PreselectedIUInstallWizard wizard = new PreselectedIUInstallWizard(getProvisioningUI(), op, iusInvolved, null); - // wizard.setBypassLicencePage(false); - // ProvisioningWizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard); - // dialog.setBlockOnOpen(false); - // dialog.open(); - // ProfileModificationJob longOp = null; + // public void testInstallWizardWithoutLicenceBypass() throws Exception { + // ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>(); + // iusInvolved.add(toInstall); + // InstallOperation op = new MyNewInstallOperation(getSession(), iusInvolved); + // op.setProfileId(TESTPROFILE); + // PreselectedIUInstallWizard wizard = new + // PreselectedIUInstallWizard(getProvisioningUI(), op, iusInvolved, null); + // wizard.setBypassLicencePage(false); + // ProvisioningWizardDialog dialog = new + // ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard); + // dialog.setBlockOnOpen(false); + // dialog.open(); + // ProfileModificationJob longOp = null; // - // try { - // SelectableIUsPage selectableIUsPage = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE); - // // should already have a plan - // assertTrue("1.0", selectableIUsPage.isPageComplete()); - // // simulate the next button by getting next page and showing - // InstallWizardPage installWizardPage = (InstallWizardPage) selectableIUsPage.getNextPage(); + // try { + // SelectableIUsPage selectableIUsPage = (SelectableIUsPage) + // wizard.getPage(SELECTION_PAGE); + // // should already have a plan + // assertTrue("1.0", selectableIUsPage.isPageComplete()); + // // simulate the next button by getting next page and showing + // InstallWizardPage installWizardPage = (InstallWizardPage) + // selectableIUsPage.getNextPage(); // - // assertFalse("Licence page bypass flag must be false", wizard.isBypassLicencePage()); - // IWizardPage licensePage = installWizardPage.getNextPage(); - // assertTrue("Expected instance of AcceptLicensesWizardPage", licensePage instanceof AcceptLicensesWizardPage); + // assertFalse("Licence page bypass flag must be false", + // wizard.isBypassLicencePage()); + // IWizardPage licensePage = installWizardPage.getNextPage(); + // assertTrue("Expected instance of AcceptLicensesWizardPage", licensePage + // instanceof AcceptLicensesWizardPage); // - // } finally { - // dialog.getShell().close(); - // if (longOp != null) - // longOp.cancel(); - // } - // } + // } finally { + // dialog.getShell().close(); + // if (longOp != null) + // longOp.cancel(); + // } + // } // - // public void testInstallWizardWithLicenceBypass() throws Exception { - // ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>(); - // iusInvolved.add(toInstall); - // InstallOperation op = new MyNewInstallOperation(getSession(), iusInvolved); - // op.setProfileId(TESTPROFILE); - // PreselectedIUInstallWizard wizard = new PreselectedIUInstallWizard(getProvisioningUI(), op, iusInvolved, null); - // wizard.setBypassLicencePage(true); - // ProvisioningWizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard); - // dialog.setBlockOnOpen(false); - // dialog.open(); - // ProfileModificationJob longOp = null; + // public void testInstallWizardWithLicenceBypass() throws Exception { + // ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>(); + // iusInvolved.add(toInstall); + // InstallOperation op = new MyNewInstallOperation(getSession(), iusInvolved); + // op.setProfileId(TESTPROFILE); + // PreselectedIUInstallWizard wizard = new + // PreselectedIUInstallWizard(getProvisioningUI(), op, iusInvolved, null); + // wizard.setBypassLicencePage(true); + // ProvisioningWizardDialog dialog = new + // ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard); + // dialog.setBlockOnOpen(false); + // dialog.open(); + // ProfileModificationJob longOp = null; // - // try { - // SelectableIUsPage selectableIUsPage = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE); - // // should already have a plan - // assertTrue("1.0", selectableIUsPage.isPageComplete()); - // // simulate the next button by getting next page and showing - // InstallWizardPage installWizardPage = (InstallWizardPage) selectableIUsPage.getNextPage(); + // try { + // SelectableIUsPage selectableIUsPage = (SelectableIUsPage) + // wizard.getPage(SELECTION_PAGE); + // // should already have a plan + // assertTrue("1.0", selectableIUsPage.isPageComplete()); + // // simulate the next button by getting next page and showing + // InstallWizardPage installWizardPage = (InstallWizardPage) + // selectableIUsPage.getNextPage(); // - // assertTrue("Licence page bypass flag must be true", wizard.isBypassLicencePage()); - // IWizardPage licensePage = installWizardPage.getNextPage(); - // assertNull("Expected instance of AcceptLicensesWizardPage must be null", licensePage); + // assertTrue("Licence page bypass flag must be true", + // wizard.isBypassLicencePage()); + // IWizardPage licensePage = installWizardPage.getNextPage(); + // assertNull("Expected instance of AcceptLicensesWizardPage must be null", + // licensePage); // - // } finally { - // dialog.getShell().close(); - // if (longOp != null) - // longOp.cancel(); - // } - // } + // } finally { + // dialog.getShell().close(); + // if (longOp != null) + // longOp.cancel(); + // } + // } // - // private static class MyNewInstallOperation extends InstallOperation { - // public MyNewInstallOperation(ProvisioningSession session, Collection<IInstallableUnit> toInstall) { - // super(session, toInstall); - // } - // } + // private static class MyNewInstallOperation extends InstallOperation { + // public MyNewInstallOperation(ProvisioningSession session, + // Collection<IInstallableUnit> toInstall) { + // super(session, toInstall); + // } + // } /** * Tests the wizard @@ -223,15 +244,17 @@ public class InstallWithRemediationTest extends WizardTest { AvailableIUsPage page1 = (AvailableIUsPage) wizard.getPage(AVAILABLE_SOFTWARE_PAGE); // test initial wizard state - assertTrue("1.0", page1.getSelectedIUs().size() == 0); + assertTrue("1.0", page1.getSelectedIUs().isEmpty()); assertFalse("1.1", page1.isPageComplete()); // Start reaching in... AvailableIUGroup group = page1.testGetAvailableIUGroup(); group.setRepositoryFilter(AvailableIUGroup.AVAILABLE_ALL, null); - // Now manipulate the tree itself. we are reaching way in. - // We are trying to select everything in the repo apart from the IU we know is broken - DeferredQueryContentProvider provider = (DeferredQueryContentProvider) group.getCheckboxTreeViewer().getContentProvider(); + // Now manipulate the tree itself. we are reaching way in. + // We are trying to select everything in the repo apart from the IU we know is + // broken + DeferredQueryContentProvider provider = (DeferredQueryContentProvider) group.getCheckboxTreeViewer() + .getContentProvider(); provider.setSynchronous(true); group.getCheckboxTreeViewer().refresh(); group.getCheckboxTreeViewer().expandAll(); @@ -268,11 +291,12 @@ public class InstallWithRemediationTest extends WizardTest { remediationPage = wizard.getNextPage(page1); dialog.showPage(remediationPage); - // // this doesn't test much, it's just calling group API to flesh out NPE's, etc. - // group.getCheckedLeafIUs(); - // group.getDefaultFocusControl(); - // group.getSelectedIUElements(); - // group.getSelectedIUs(); + // // this doesn't test much, it's just calling group API to flesh out NPE's, + // etc. + // group.getCheckedLeafIUs(); + // group.getDefaultFocusControl(); + // group.getSelectedIUElements(); + // group.getSelectedIUs(); } finally { dialog.close(); diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java index f1ca13870..125fdd7b4 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java +++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java @@ -52,10 +52,11 @@ public class InstallWizardTest extends WizardTest { iu.setProperty(InstallableUnitDescription.PROP_TYPE_GROUP, "true"); iu.setVersion(Version.createOSGi(1, 0, 0)); iu.setSingleton(true); - iu.setLicenses(new ILicense[] {new License(null, "There is a license to accept!", null)}); - iu.setCapabilities(new IProvidedCapability[] {MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, MAIN_IU, iu.getVersion())}); + iu.setLicenses(new ILicense[] { new License(null, "There is a license to accept!", null) }); + iu.setCapabilities(new IProvidedCapability[] { + MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, MAIN_IU, iu.getVersion()) }); toInstall = MetadataFactory.createInstallableUnit(iu); - createTestMetdataRepository(new IInstallableUnit[] {toInstall}); + createTestMetdataRepository(new IInstallableUnit[] { toInstall }); } public void testInstallWizardResolved() { @@ -79,7 +80,8 @@ public class InstallWizardTest extends WizardTest { // we should be ok assertTrue("1.1", page.isPageComplete()); - // if another operation is scheduled for this profile, we should not be allowed to proceed + // if another operation is scheduled for this profile, we should not be allowed + // to proceed longOp = getLongTestOperation(); getProvisioningUI().schedule(longOp, StatusManager.LOG); // causes recalculation of plan and status @@ -125,7 +127,8 @@ public class InstallWizardTest extends WizardTest { // get the operation Field opField = ResolutionResultsWizardPage.class.getDeclaredField("resolvedOperation"); opField.setAccessible(true); - assertTrue("Expected instance of MyNewInstallOperation", opField.get(page) instanceof MyNewInstallOperation); + assertTrue("Expected instance of MyNewInstallOperation", + opField.get(page) instanceof MyNewInstallOperation); } finally { dialog.getShell().close(); if (longOp != null) @@ -154,7 +157,8 @@ public class InstallWizardTest extends WizardTest { assertFalse("License page bypass flag must be false", wizard.isBypassLicensePage()); IWizardPage licensePage = installWizardPage.getNextPage(); - assertTrue("Expected instance of AcceptLicensesWizardPage", licensePage instanceof AcceptLicensesWizardPage); + assertTrue("Expected instance of AcceptLicensesWizardPage", + licensePage instanceof AcceptLicensesWizardPage); } finally { dialog.getShell().close(); @@ -219,15 +223,17 @@ public class InstallWizardTest extends WizardTest { AvailableIUsPage page1 = (AvailableIUsPage) wizard.getPage(AVAILABLE_SOFTWARE_PAGE); // test initial wizard state - assertTrue("1.0", page1.getSelectedIUs().size() == 0); + assertTrue("1.0", page1.getSelectedIUs().isEmpty()); assertFalse("1.1", page1.isPageComplete()); // Start reaching in... AvailableIUGroup group = page1.testGetAvailableIUGroup(); group.setRepositoryFilter(AvailableIUGroup.AVAILABLE_ALL, null); - // Now manipulate the tree itself. we are reaching way in. - // We are trying to select everything in the repo apart from the IU we know is broken - DeferredQueryContentProvider provider = (DeferredQueryContentProvider) group.getCheckboxTreeViewer().getContentProvider(); + // Now manipulate the tree itself. we are reaching way in. + // We are trying to select everything in the repo apart from the IU we know is + // broken + DeferredQueryContentProvider provider = (DeferredQueryContentProvider) group.getCheckboxTreeViewer() + .getContentProvider(); provider.setSynchronous(true); group.getCheckboxTreeViewer().refresh(); group.getCheckboxTreeViewer().expandAll(); @@ -252,7 +258,8 @@ public class InstallWizardTest extends WizardTest { dialog.showPage(page); assertTrue("3.0", page.isPageComplete()); - // if another operation is scheduled for this profile, we should not be allowed to proceed + // if another operation is scheduled for this profile, we should not be allowed + // to proceed longOp = getLongTestOperation(); getProvisioningUI().schedule(longOp, StatusManager.LOG); // causes recalculation of plan and status diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/InstallOperationTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/InstallOperationTests.java index fc71e623c..47676b6ee 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/InstallOperationTests.java +++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/InstallOperationTests.java @@ -36,17 +36,19 @@ import org.eclipse.equinox.p2.tests.ui.AbstractProvisioningUITest; public class InstallOperationTests extends AbstractProvisioningUITest { public void testInstallerPlan() throws ProvisionException { URI uri = getTestData("InstallHandler", "testData/installPlan").toURI(); - Set<IInstallableUnit> ius = getMetadataRepositoryManager().loadRepository(uri, getMonitor()).query(QueryUtil.createIUQuery("A"), getMonitor()).toSet(); - assertTrue("One IU", ius.size() == 1); + Set<IInstallableUnit> ius = getMetadataRepositoryManager().loadRepository(uri, getMonitor()) + .query(QueryUtil.createIUQuery("A"), getMonitor()).toSet(); + assertEquals("One IU", 1, ius.size()); InstallOperation op = new InstallOperation(getSession(), ius); op.setProfileId(TESTPROFILE); ProvisioningContext pc = new ProvisioningContext(getAgent()); - pc.setArtifactRepositories(new URI[] {uri}); - pc.setMetadataRepositories(new URI[] {uri}); + pc.setArtifactRepositories(new URI[] { uri }); + pc.setMetadataRepositories(new URI[] { uri }); op.setProvisioningContext(pc); assertTrue("Should resolve", op.resolveModal(getMonitor()).isOK()); assertTrue("Should install", op.getProvisioningJob(null).runModal(getMonitor()).isOK()); - assertFalse("Action1 should have been installed", getProfile(TESTPROFILE).query(QueryUtil.createIUQuery("Action1"), getMonitor()).isEmpty()); + assertFalse("Action1 should have been installed", + getProfile(TESTPROFILE).query(QueryUtil.createIUQuery("Action1"), getMonitor()).isEmpty()); } public void testDetectMissingRequirement() throws ProvisionException, OperationCanceledException { @@ -59,35 +61,43 @@ public class InstallOperationTests extends AbstractProvisioningUITest { repoA = getMetadataRepositoryManager().loadRepository(uriA, getMonitor()); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=305565 - repoA.addReferences(Collections.singletonList(new RepositoryReference(uriA, null, IRepository.TYPE_ARTIFACT, IRepository.ENABLED))); + repoA.addReferences(Collections + .singletonList(new RepositoryReference(uriA, null, IRepository.TYPE_ARTIFACT, IRepository.ENABLED))); // now create a second set of repos and refer from the first repoB = getMetadataRepositoryManager().loadRepository(uriB, getMonitor()); - repoB.addReferences(Collections.singletonList(new RepositoryReference(uriB, null, IRepository.TYPE_ARTIFACT, IRepository.ENABLED))); - repoA.addReferences(Collections.singletonList(new RepositoryReference(repoB.getLocation(), null, IRepository.TYPE_METADATA, IRepository.ENABLED))); + repoB.addReferences(Collections + .singletonList(new RepositoryReference(uriB, null, IRepository.TYPE_ARTIFACT, IRepository.ENABLED))); + repoA.addReferences(Collections.singletonList( + new RepositoryReference(repoB.getLocation(), null, IRepository.TYPE_METADATA, IRepository.ENABLED))); // this repo is referred by the previous one repoC = getMetadataRepositoryManager().loadRepository(uriC, getMonitor()); - repoC.addReferences(Collections.singletonList(new RepositoryReference(uriC, null, IRepository.TYPE_ARTIFACT, IRepository.ENABLED))); - repoB.addReferences(Collections.singletonList(new RepositoryReference(repoC.getLocation(), null, IRepository.TYPE_METADATA, IRepository.ENABLED))); + repoC.addReferences(Collections + .singletonList(new RepositoryReference(uriC, null, IRepository.TYPE_ARTIFACT, IRepository.ENABLED))); + repoB.addReferences(Collections.singletonList( + new RepositoryReference(repoC.getLocation(), null, IRepository.TYPE_METADATA, IRepository.ENABLED))); String id = "TestProfileIDForMissingRequirement"; createProfile(id); ProvisioningContext context = new ProvisioningContext(getAgent()); - context.setMetadataRepositories(new URI[] {repoA.getLocation()}); + context.setMetadataRepositories(new URI[] { repoA.getLocation() }); context.setArtifactRepositories(new URI[0]); - IInstallableUnit[] units = repoA.query(QueryUtil.createIUQuery("A"), getMonitor()).toArray(IInstallableUnit.class); + IInstallableUnit[] units = repoA.query(QueryUtil.createIUQuery("A"), getMonitor()) + .toArray(IInstallableUnit.class); assertTrue("should find A in main repo", units.length > 0); // NOW WE CAN TEST! - assertNull("ProvisioningContext does not follow by default", context.getProperty(ProvisioningContext.FOLLOW_REPOSITORY_REFERENCES)); + assertNull("ProvisioningContext does not follow by default", + context.getProperty(ProvisioningContext.FOLLOW_REPOSITORY_REFERENCES)); InstallOperation op = new InstallOperation(getSession(), Collections.singleton(units[0])); op.setProvisioningContext(context); op.setProfileId(id); assertTrue("Should resolve", op.resolveModal(getMonitor()).isOK()); - assertNotNull("Context was reset to follow", context.getProperty(ProvisioningContext.FOLLOW_REPOSITORY_REFERENCES)); + assertNotNull("Context was reset to follow", + context.getProperty(ProvisioningContext.FOLLOW_REPOSITORY_REFERENCES)); getArtifactRepositoryManager().removeRepository(uriA); getArtifactRepositoryManager().removeRepository(uriB); @@ -99,7 +109,7 @@ public class InstallOperationTests extends AbstractProvisioningUITest { } public void testUpdateWithNamespaceChange() { - //Create the IU that will be detected as an update + // Create the IU that will be detected as an update InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription(); iud.setId("NewB"); iud.setVersion(Version.create("1.0.0")); @@ -110,14 +120,15 @@ public class InstallOperationTests extends AbstractProvisioningUITest { Collection<IMatchExpression<IInstallableUnit>> updateExpression = new ArrayList<>(); updateExpression.add(matchExpression); - iud.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(updateExpression, IUpdateDescriptor.HIGH, (String) null, (URI) null)); + iud.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(updateExpression, IUpdateDescriptor.HIGH, + (String) null, (URI) null)); IInstallableUnit newIUB = MetadataFactory.createInstallableUnit(iud); - //create the IU being updated + // create the IU being updated IInstallableUnit installed = createIU("B"); - //Setup the profile - installAsRoots(profile, new IInstallableUnit[] {installed}, true, createPlanner(), createEngine()); + // Setup the profile + installAsRoots(profile, new IInstallableUnit[] { installed }, true, createPlanner(), createEngine()); List<IInstallableUnit> ius = new ArrayList<>(); ius.add(newIUB); @@ -126,6 +137,7 @@ public class InstallOperationTests extends AbstractProvisioningUITest { IStatus resolutionStatus = op.resolveModal(getMonitor()); assertEquals(IStatusCodes.PROFILE_CHANGE_ALTERED, ((MultiStatus) resolutionStatus).getChildren()[0].getCode()); - assertEquals(IStatusCodes.ALTERED_IMPLIED_UPDATE, ((MultiStatus) (((MultiStatus) resolutionStatus).getChildren()[0])).getChildren()[0].getCode()); + assertEquals(IStatusCodes.ALTERED_IMPLIED_UPDATE, + ((MultiStatus) (((MultiStatus) resolutionStatus).getChildren()[0])).getChildren()[0].getCode()); } } diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UpdateOperationTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UpdateOperationTests.java index cb0c9aa5c..0b84b4e63 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UpdateOperationTests.java +++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UpdateOperationTests.java @@ -33,43 +33,73 @@ public class UpdateOperationTests extends AbstractProvisioningUITest { protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0")); - IUpdateDescriptor update = MetadataFactory.createUpdateDescriptor("A", new VersionRange("[1.0.0, 1.0.0]"), 0, "update description"); - a120WithDifferentId = createIU("UpdateA", Version.createOSGi(1, 2, 0), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, null, NO_TP_DATA, false, update, NO_REQUIRES); - a130 = createIU("A", Version.createOSGi(1, 3, 0), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, null, NO_TP_DATA, false, update, NO_REQUIRES); - a140WithDifferentId = createIU("UpdateForA", Version.createOSGi(1, 4, 0), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, null, NO_TP_DATA, false, update, NO_REQUIRES); - IRequirementChange change = MetadataFactory.createRequirementChange(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", VersionRange.emptyRange, null, false, false, false), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.1.0, 1.3.0)"), null, false, false, true)); - IRequirement lifeCycle = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 1.0.0]"), null, false, false); - firstPatchForA1 = createIUPatch("P", Version.create("1.0.0"), true, new IRequirementChange[] {change}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, false, false)}}, lifeCycle); - secondPatchForA1 = createIUPatch("P", Version.create("2.0.0"), true, new IRequirementChange[] {change}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, false, false)}}, lifeCycle); - thirdPatchForA1 = createIUPatch("P2", Version.create("1.0.0"), true, new IRequirementChange[] {change}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, false, false)}}, lifeCycle); + IUpdateDescriptor update = MetadataFactory.createUpdateDescriptor("A", new VersionRange("[1.0.0, 1.0.0]"), 0, + "update description"); + a120WithDifferentId = createIU("UpdateA", Version.createOSGi(1, 2, 0), null, NO_REQUIRES, NO_PROVIDES, + NO_PROPERTIES, null, NO_TP_DATA, false, update, NO_REQUIRES); + a130 = createIU("A", Version.createOSGi(1, 3, 0), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, null, + NO_TP_DATA, false, update, NO_REQUIRES); + a140WithDifferentId = createIU("UpdateForA", Version.createOSGi(1, 4, 0), null, NO_REQUIRES, NO_PROVIDES, + NO_PROPERTIES, null, NO_TP_DATA, false, update, NO_REQUIRES); + IRequirementChange change = MetadataFactory.createRequirementChange( + MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", VersionRange.emptyRange, null, + false, false, false), + MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", + new VersionRange("[1.1.0, 1.3.0)"), null, false, false, true)); + IRequirement lifeCycle = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", + new VersionRange("[1.0.0, 1.0.0]"), null, false, false); + firstPatchForA1 = createIUPatch("P", Version.create("1.0.0"), true, new IRequirementChange[] { change }, + new IRequirement[][] { { MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", + VersionRange.emptyRange, null, false, false) } }, + lifeCycle); + secondPatchForA1 = createIUPatch("P", Version.create("2.0.0"), true, new IRequirementChange[] { change }, + new IRequirement[][] { { MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", + VersionRange.emptyRange, null, false, false) } }, + lifeCycle); + thirdPatchForA1 = createIUPatch("P2", Version.create("1.0.0"), true, new IRequirementChange[] { change }, + new IRequirement[][] { { MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", + VersionRange.emptyRange, null, false, false) } }, + lifeCycle); - IRequirementChange change2 = MetadataFactory.createRequirementChange(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", VersionRange.emptyRange, null, false, false, false), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.1.0, 1.3.0)"), null, false, false, true)); - IRequirement lifeCycle2 = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[2.0.0, 3.2.0]"), null, false, false); - patchFora2 = createIUPatch("P", Version.create("1.0.0"), true, new IRequirementChange[] {change2}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, false, false)}}, lifeCycle2); + IRequirementChange change2 = MetadataFactory.createRequirementChange( + MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", VersionRange.emptyRange, null, + false, false, false), + MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", + new VersionRange("[1.1.0, 1.3.0)"), null, false, false, true)); + IRequirement lifeCycle2 = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", + new VersionRange("[2.0.0, 3.2.0]"), null, false, false); + patchFora2 = createIUPatch("P", Version.create("1.0.0"), true, new IRequirementChange[] { change2 }, + new IRequirement[][] { { MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", + VersionRange.emptyRange, null, false, false) } }, + lifeCycle2); b1 = createIU("B", Version.create("1.0.0")); - update = MetadataFactory.createUpdateDescriptor("B", new VersionRange("[1.0.0, 1.0.0]"), 0, "update description"); - b12 = createIU("B", Version.createOSGi(1, 2, 0), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, null, NO_TP_DATA, false, update, NO_REQUIRES); + update = MetadataFactory.createUpdateDescriptor("B", new VersionRange("[1.0.0, 1.0.0]"), 0, + "update description"); + b12 = createIU("B", Version.createOSGi(1, 2, 0), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, null, + NO_TP_DATA, false, update, NO_REQUIRES); // Ensure that all versions, not just the latest, are considered by the UI getPolicy().setShowLatestVersionsOnly(false); } public void testChooseUpdateOverPatch() { - createTestMetdataRepository(new IInstallableUnit[] {a1, a120WithDifferentId, a130, firstPatchForA1, patchFora2}); + createTestMetdataRepository( + new IInstallableUnit[] { a1, a120WithDifferentId, a130, firstPatchForA1, patchFora2 }); install(a1, true, false); ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>(); iusInvolved.add(a1); UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null); op.resolveModal(getMonitor()); IProfileChangeRequest request = op.getProfileChangeRequest(); - assertTrue("1.0", request.getAdditions().size() == 1); - assertTrue("1.1", request.getAdditions().iterator().next().equals(a130)); - assertTrue("1.2", request.getRemovals().size() == 1); - assertTrue("1.3", request.getRemovals().iterator().next().equals(a1)); + assertEquals("1.0", 1, request.getAdditions().size()); + assertEquals("1.1", a130, request.getAdditions().iterator().next()); + assertEquals("1.2", 1, request.getRemovals().size()); + assertEquals("1.3", a1, request.getRemovals().iterator().next()); } public void testForcePatchOverUpdate() { - createTestMetdataRepository(new IInstallableUnit[] {a1, a120WithDifferentId, a130, firstPatchForA1, patchFora2}); + createTestMetdataRepository( + new IInstallableUnit[] { a1, a120WithDifferentId, a130, firstPatchForA1, patchFora2 }); install(a1, true, false); ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>(); iusInvolved.add(a1); @@ -84,16 +114,17 @@ public class UpdateOperationTests extends AbstractProvisioningUITest { } } assertNotNull(".99", firstPatch); - op.setSelectedUpdates(new Update[] {firstPatch}); + op.setSelectedUpdates(new Update[] { firstPatch }); op.resolveModal(getMonitor()); IProfileChangeRequest request = op.getProfileChangeRequest(); - assertTrue("1.0", request.getAdditions().size() == 1); - assertTrue("1.1", request.getAdditions().iterator().next().equals(firstPatchForA1)); - assertTrue("1.2", request.getRemovals().size() == 0); + assertEquals("1.0", 1, request.getAdditions().size()); + assertEquals("1.1", firstPatchForA1, request.getAdditions().iterator().next()); + assertTrue("1.2", request.getRemovals().isEmpty()); } public void testRecognizePatchIsInstalled() { - createTestMetdataRepository(new IInstallableUnit[] {a1, a120WithDifferentId, a130, firstPatchForA1, patchFora2}); + createTestMetdataRepository( + new IInstallableUnit[] { a1, a120WithDifferentId, a130, firstPatchForA1, patchFora2 }); install(a1, true, false); install(firstPatchForA1, true, false); ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>(); @@ -102,15 +133,17 @@ public class UpdateOperationTests extends AbstractProvisioningUITest { op.resolveModal(getMonitor()); IProfileChangeRequest request = op.getProfileChangeRequest(); // update was favored, that would happen even if patch was not installed - assertTrue("1.0", request.getAdditions().size() == 1); - assertTrue("1.1", request.getAdditions().iterator().next().equals(a130)); - // the patch is not being shown to the user because we figured out it was already installed + assertEquals("1.0", 1, request.getAdditions().size()); + assertEquals("1.1", a130, request.getAdditions().iterator().next()); + // the patch is not being shown to the user because we figured out it was + // already installed // The elements showing are a130 and a120WithDifferentId assertEquals("1.2", 2, op.getPossibleUpdates().length); } public void testChooseNotTheNewest() { - createTestMetdataRepository(new IInstallableUnit[] {a1, a120WithDifferentId, a130, firstPatchForA1, patchFora2}); + createTestMetdataRepository( + new IInstallableUnit[] { a1, a120WithDifferentId, a130, firstPatchForA1, patchFora2 }); install(a1, true, false); ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>(); iusInvolved.add(a1); @@ -125,18 +158,18 @@ public class UpdateOperationTests extends AbstractProvisioningUITest { } } assertNotNull(".99", notNewest); - op.setSelectedUpdates(new Update[] {notNewest}); + op.setSelectedUpdates(new Update[] { notNewest }); op.resolveModal(getMonitor()); IProfileChangeRequest request = op.getProfileChangeRequest(); // selected was favored - assertTrue("1.0", request.getAdditions().size() == 1); - assertTrue("1.1", request.getAdditions().iterator().next().equals(a120WithDifferentId)); + assertEquals("1.0", 1, request.getAdditions().size()); + assertEquals("1.1", a120WithDifferentId, request.getAdditions().iterator().next()); // The two updates and the patch were recognized assertEquals("1.2", 3, op.getPossibleUpdates().length); } public void testChooseLatestPatches() { - createTestMetdataRepository(new IInstallableUnit[] {a1, firstPatchForA1, secondPatchForA1, thirdPatchForA1}); + createTestMetdataRepository(new IInstallableUnit[] { a1, firstPatchForA1, secondPatchForA1, thirdPatchForA1 }); install(a1, true, false); ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>(); iusInvolved.add(a1); @@ -145,7 +178,7 @@ public class UpdateOperationTests extends AbstractProvisioningUITest { IProfileChangeRequest request = op.getProfileChangeRequest(); // the latest two patches were selected HashSet<IInstallableUnit> chosen = new HashSet<>(); - assertTrue("1.0", request.getAdditions().size() == 2); + assertEquals("1.0", 2, request.getAdditions().size()); chosen.addAll(request.getAdditions()); assertTrue("1.1", chosen.contains(secondPatchForA1)); assertTrue("1.2", chosen.contains(thirdPatchForA1)); @@ -154,7 +187,8 @@ public class UpdateOperationTests extends AbstractProvisioningUITest { } public void testLatestHasDifferentId() { - createTestMetdataRepository(new IInstallableUnit[] {a1, firstPatchForA1, secondPatchForA1, thirdPatchForA1, a120WithDifferentId, a130, a140WithDifferentId}); + createTestMetdataRepository(new IInstallableUnit[] { a1, firstPatchForA1, secondPatchForA1, thirdPatchForA1, + a120WithDifferentId, a130, a140WithDifferentId }); install(a1, true, false); ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>(); iusInvolved.add(a1); @@ -162,15 +196,15 @@ public class UpdateOperationTests extends AbstractProvisioningUITest { op.resolveModal(getMonitor()); IProfileChangeRequest request = op.getProfileChangeRequest(); // update 140 was recognized as the latest even though it had a different id - assertTrue("1.0", request.getAdditions().size() == 1); - assertTrue("1.1", request.getAdditions().iterator().next().equals(a140WithDifferentId)); + assertEquals("1.0", 1, request.getAdditions().size()); + assertEquals("1.1", a140WithDifferentId, request.getAdditions().iterator().next()); // All three patches and all three updates can be chosen assertEquals("1.2", 6, op.getPossibleUpdates().length); } // bug 300445 public void testRemoveSelectionAfterResolve() { - createTestMetdataRepository(new IInstallableUnit[] {a1, a130, b1, b12}); + createTestMetdataRepository(new IInstallableUnit[] { a1, a130, b1, b12 }); install(a1, true, false); ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>(); iusInvolved.add(a1); @@ -180,14 +214,14 @@ public class UpdateOperationTests extends AbstractProvisioningUITest { Update[] updates = op.getSelectedUpdates(); assertEquals("1.0", 2, updates.length); // choose just one - op.setSelectedUpdates(new Update[] {updates[0]}); + op.setSelectedUpdates(new Update[] { updates[0] }); op.resolveModal(getMonitor()); assertEquals("1.1", 1, op.getSelectedUpdates().length); } // bug 290858 public void testSearchForUpdatesInJob() { - createTestMetdataRepository(new IInstallableUnit[] {a1, a130, b1, b12}); + createTestMetdataRepository(new IInstallableUnit[] { a1, a130, b1, b12 }); install(a1, true, false); ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>(); iusInvolved.add(a1); diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryProviderTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryProviderTests.java index 6214b5448..9d279de2c 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryProviderTests.java +++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryProviderTests.java @@ -40,12 +40,16 @@ public class QueryProviderTests extends AbstractProvisioningUITest { categoryProperties.put("org.eclipse.equinox.p2.type.category", "true"); HashMap<String, String> groupProperties = new HashMap<>(); groupProperties.put("org.eclipse.equinox.p2.type.group", "true"); - category = createIU(CAT, Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, NESTED), categoryProperties, true); - nestedCategory = createIU(NESTED, Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, A), categoryProperties, true); - a = createIU(A, Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, B), groupProperties, true); - b = createIU(B, Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, C), groupProperties, true); + category = createIU(CAT, Version.create("1.0.0"), + createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, NESTED), categoryProperties, true); + nestedCategory = createIU(NESTED, Version.create("1.0.0"), + createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, A), categoryProperties, true); + a = createIU(A, Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, B), + groupProperties, true); + b = createIU(B, Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, C), + groupProperties, true); c = createIU(C, Version.create("1.0.0"), NO_REQUIRES, NO_PROPERTIES, true); - testRepo = createTestMetdataRepository(new IInstallableUnit[] {category, nestedCategory, a, b, c}); + testRepo = createTestMetdataRepository(new IInstallableUnit[] { category, nestedCategory, a, b, c }); } public void testNestedCategories() { @@ -69,8 +73,9 @@ public class QueryProviderTests extends AbstractProvisioningUITest { public void testInstallDrilldown() { IUElementListRoot root = new IUElementListRoot(); - AvailableIUElement element = new AvailableIUElement(root, a, TESTPROFILE, getPolicy().getShowDrilldownRequirements()); - root.setChildren(new Object[] {element}); + AvailableIUElement element = new AvailableIUElement(root, a, TESTPROFILE, + getPolicy().getShowDrilldownRequirements()); + root.setChildren(new Object[] { element }); ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>(); iusInvolved.add(a); InstallOperation op = new InstallOperation(getSession(), iusInvolved); @@ -79,7 +84,7 @@ public class QueryProviderTests extends AbstractProvisioningUITest { IQueryable<IInstallableUnit> queryable = op.getProvisioningPlan().getAdditions(); element.setQueryable(queryable); Object[] children = element.getChildren(element); - assertTrue("1.1", children.length == 1); + assertEquals("1.1", 1, children.length); } } diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableArtifactRepositoryManagerTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableArtifactRepositoryManagerTest.java index 181b9bbab..6630186f2 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableArtifactRepositoryManagerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableArtifactRepositoryManagerTest.java @@ -50,7 +50,7 @@ public class QueryableArtifactRepositoryManagerTest extends AbstractQueryTest { QueryableArtifactRepositoryManager manager = getQueryableManager(); IQueryResult<URI> result = manager.locationsQueriable().query(new RepositoryLocationQuery(), getMonitor()); - assertTrue(queryResultSize(result) == repoCount); + assertEquals(repoCount, queryResultSize(result)); } private QueryableArtifactRepositoryManager getQueryableManager() { diff --git a/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF index d3fc4adee..adaef97d8 100644 --- a/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF @@ -1,8 +1,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: Test Install Verifier +Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.equinox.p2.tests.verifier;singleton:=true -Bundle-Version: 1.3.0.qualifier +Bundle-Version: 1.3.100.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.tests.verifier.Activator Export-Package: org.eclipse.equinox.internal.p2.tests.verifier;x-internal:=true Require-Bundle: org.eclipse.core.runtime, @@ -22,3 +22,4 @@ Bundle-ActivationPolicy: lazy Bundle-ClassPath: bin/, . Automatic-Module-Name: org.eclipse.equinox.p2.tests.verifier +Bundle-Vendor: %Bundle-Vendor diff --git a/bundles/org.eclipse.equinox.p2.tests.verifier/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.equinox.p2.tests.verifier/OSGI-INF/l10n/bundle.properties new file mode 100644 index 000000000..0cebbef04 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests.verifier/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,3 @@ +#Properties file for org.eclipse.equinox.p2.tests.verifier +Bundle-Vendor = Eclipse.org - Equinox +Bundle-Name = Test Install Verifier
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.tests.verifier/build.properties b/bundles/org.eclipse.equinox.p2.tests.verifier/build.properties index d0960de35..d0ec30270 100644 --- a/bundles/org.eclipse.equinox.p2.tests.verifier/build.properties +++ b/bundles/org.eclipse.equinox.p2.tests.verifier/build.properties @@ -16,5 +16,6 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ plugin.xml,\ - about.html -javacWarnings..=-raw,-unchecked,-varargsCast + about.html,\ + OSGI-INF/l10n/bundle.properties,\ + OSGI-INF/ diff --git a/bundles/org.eclipse.equinox.p2.tests.verifier/pom.xml b/bundles/org.eclipse.equinox.p2.tests.verifier/pom.xml index 0100260fc..08bb6782c 100644 --- a/bundles/org.eclipse.equinox.p2.tests.verifier/pom.xml +++ b/bundles/org.eclipse.equinox.p2.tests.verifier/pom.xml @@ -4,11 +4,11 @@ <parent> <artifactId>org.eclipse.equinox.p2.tests-parent</artifactId> <groupId>org.eclipse</groupId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../../org.eclipse.equinox.p2.releng/org.eclipse.equinox.p2.tests-parent</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.tests.verifier</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>1.3.100-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF index bd3e42b8f..73c3d22e7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.tests;singleton:=true -Bundle-Version: 1.8.100.qualifier +Bundle-Version: 1.8.700.qualifier Bundle-ClassPath: . Bundle-Activator: org.eclipse.equinox.p2.tests.TestActivator Bundle-Vendor: %providerName @@ -26,7 +26,6 @@ Require-Bundle: org.eclipse.equinox.frameworkadmin, org.eclipse.core.tests.harness;bundle-version="3.4.0", org.eclipse.core.runtime;bundle-version="3.4.0", org.eclipse.equinox.p2.publisher;bundle-version="1.0.0", - org.easymock;bundle-version="2.4.0", org.eclipse.equinox.frameworkadmin.test;bundle-version="1.0.0", org.junit;bundle-version="4.8.0", org.hamcrest.core;bundle-version="1.3.0", @@ -46,7 +45,7 @@ Require-Bundle: org.eclipse.equinox.frameworkadmin, org.eclipse.ecf.filetransfer;bundle-version="4.0.0", org.eclipse.ecf.identity;bundle-version="3.1.0", org.eclipse.ecf.provider.filetransfer;bundle-version="3.1.0", - org.eclipse.ecf.provider.filetransfer.httpclient45, + org.eclipse.ecf.provider.filetransfer.httpclient5, org.eclipse.equinox.p2.reconciler.dropins;bundle-version="1.1.0", org.eclipse.ant.core;bundle-version="3.2.200", org.apache.ant;bundle-version="1.7.1", @@ -54,7 +53,10 @@ Require-Bundle: org.eclipse.equinox.frameworkadmin, org.eclipse.equinox.p2.publisher.eclipse;bundle-version="1.0.0", org.eclipse.equinox.p2.operations;bundle-version="2.1.0", org.eclipse.equinox.p2.ui.sdk.scheduler, - org.eclipse.equinox.p2.artifact.repository;bundle-version="[1.3.0,2.0.0)" + org.eclipse.equinox.p2.artifact.repository;bundle-version="[1.3.0,2.0.0)", + org.hamcrest.library;bundle-version="1.3.0", + org.mockito.mockito-core, + net.bytebuddy.byte-buddy Eclipse-RegisterBuddy: org.eclipse.equinox.p2.artifact.repository Bundle-RequiredExecutionEnvironment: JavaSE-11 Eclipse-BundleShape: dir diff --git a/bundles/org.eclipse.equinox.p2.tests/build.properties b/bundles/org.eclipse.equinox.p2.tests/build.properties index 2eaa95987..0ed56864b 100644 --- a/bundles/org.eclipse.equinox.p2.tests/build.properties +++ b/bundles/org.eclipse.equinox.p2.tests/build.properties @@ -22,4 +22,3 @@ bin.includes = META-INF/,\ test.xml customCallBack=foo.xml src.includes = about.html -javacWarnings..=-raw,-unchecked,-varargsCast diff --git a/bundles/org.eclipse.equinox.p2.tests/plugin.xml b/bundles/org.eclipse.equinox.p2.tests/plugin.xml index 841b529ea..857699598 100644 --- a/bundles/org.eclipse.equinox.p2.tests/plugin.xml +++ b/bundles/org.eclipse.equinox.p2.tests/plugin.xml @@ -153,4 +153,10 @@ suffix="@testArtifactRepositoryRegistry"> </filter> </extension> + <extension + point="org.eclipse.equinox.p2.engine.pgp"> + <trustedKeys + path="testData/pgp/signer2-publickey.asc"> + </trustedKeys> + </extension> </plugin> diff --git a/bundles/org.eclipse.equinox.p2.tests/pom.xml b/bundles/org.eclipse.equinox.p2.tests/pom.xml index b3285d0b3..894085114 100644 --- a/bundles/org.eclipse.equinox.p2.tests/pom.xml +++ b/bundles/org.eclipse.equinox.p2.tests/pom.xml @@ -10,13 +10,13 @@ <parent> <groupId>org.eclipse</groupId> <artifactId>org.eclipse.equinox.p2.tests-parent</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../../org.eclipse.equinox.p2.releng/org.eclipse.equinox.p2.tests-parent</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.tests</artifactId> - <version>1.8.100-SNAPSHOT</version> + <version>1.8.700-SNAPSHOT</version> <packaging>eclipse-test-plugin</packaging> <properties> diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java index dcc84bbfb..ab74b9572 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java @@ -739,7 +739,7 @@ public abstract class AbstractProvisioningTest extends TestCase { } } - public static void writeBuffer(File outputFile, StringBuffer buffer) throws IOException { + public static void writeBuffer(File outputFile, StringBuilder buffer) throws IOException { outputFile.getParentFile().mkdirs(); try (FileOutputStream stream = new FileOutputStream(outputFile)) { stream.write(buffer.toString().getBytes()); @@ -1367,7 +1367,7 @@ public abstract class AbstractProvisioningTest extends TestCase { IInstallableUnit sourceIU = it.next(); IQueryResult destinationCollector = destination.query(QueryUtil.createIUQuery(sourceIU), null); assertEquals(message, 1, queryResultSize(destinationCollector)); - assertTrue(message, sourceIU.equals(destinationCollector.iterator().next())); + assertEquals(message, sourceIU, destinationCollector.iterator().next()); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestData.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestData.java index c17384334..d2a8bc870 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestData.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestData.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2018 compeople AG and others. + * Copyright (c) 2007, 2021 compeople AG and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -22,7 +22,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.zip.ZipEntry; @@ -136,30 +135,31 @@ public class TestData { * @throws IOException */ public static void assertEquals(ZipInputStream expected, ZipInputStream actual) throws IOException { - Map<String, Object[]> jar1 = getEntries(expected); - Map<String, Object[]> jar2 = getEntries(actual); - for (String name : jar1.keySet()) { - Object[] file1 = jar1.get(name); - Object[] file2 = jar2.remove(name); - Assert.assertNotNull(file2); - - ZipEntry entry1 = (ZipEntry) file1[0]; - ZipEntry entry2 = (ZipEntry) file2[0]; + Map<String, Object[]> expectedEntries = getEntries(expected); + Map<String, Object[]> actualEntries = getEntries(actual); + for (String name : expectedEntries.keySet()) { + Object[] expectedFiles = expectedEntries.get(name); + Object[] actualFiles = actualEntries.remove(name); + Assert.assertNotNull(name + " entry is missing in actual zip stream (actual=" + actualEntries.keySet() + + ", expected=" + expectedEntries.keySet() + ")", actualFiles); + + ZipEntry entry1 = (ZipEntry) expectedFiles[0]; + ZipEntry entry2 = (ZipEntry) actualFiles[0]; // compare the entries - Assert.assertTrue(entry1.getName().equals(entry2.getName())); - Assert.assertTrue(entry1.getSize() == entry2.getSize()); + Assert.assertEquals(entry1.getName(), entry2.getName()); + Assert.assertEquals(entry1.getSize(), entry2.getSize()); // TODO for now skip over the timestamp as they seem to be different // assertTrue(entry1.getTime() == entry2.getTime()); - Assert.assertTrue(entry1.isDirectory() == entry2.isDirectory()); - Assert.assertTrue(entry1.getCrc() == entry2.getCrc()); - Assert.assertTrue(entry1.getMethod() == entry2.getMethod()); + Assert.assertEquals(entry1.isDirectory(), entry2.isDirectory()); + Assert.assertEquals(entry1.getCrc(), entry2.getCrc()); + Assert.assertEquals(entry1.getMethod(), entry2.getMethod()); // check the content of the entries - Assert.assertTrue(Arrays.equals((byte[]) file1[1], (byte[]) file2[1])); + Assert.assertArrayEquals((byte[]) expectedFiles[1], (byte[]) actualFiles[1]); } // ensure that we have consumed all of the entries in the second JAR - Assert.assertTrue(jar2.size() == 0); + Assert.assertEquals(0, actualEntries.size()); } /** @@ -181,11 +181,11 @@ public class TestData { File entry1 = (File) file1[0]; ZipEntry entry2 = (ZipEntry) file2[0]; - Assert.assertTrue(entry1.isDirectory() == entry2.isDirectory()); + Assert.assertEquals(entry1.isDirectory(), entry2.isDirectory()); // check the content of the entries if (compareContent) - Assert.assertTrue(Arrays.equals((byte[]) file1[1], (byte[]) file2[1])); + Assert.assertArrayEquals((byte[]) file1[1], (byte[]) file2[1]); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestLicenseConsistency.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestLicenseConsistency.java index e0c3f74e3..44cb6f077 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestLicenseConsistency.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestLicenseConsistency.java @@ -27,13 +27,14 @@ import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; /** - * Tests that licenses in the indigo repository are consistent with the platform feature license. - * Note this test isn't intended to be included in automated tests. It produces a report - * on stdout that can be used to identify features with inconsistent feature licenses. + * Tests that licenses in the latest release repository are consistent with the + * platform feature license. Note this test isn't intended to be included in + * automated tests. It produces a report on stdout that can be used to identify + * features with inconsistent feature licenses. */ public class TestLicenseConsistency extends AbstractProvisioningTest { public void testLicenses() throws URISyntaxException, ProvisionException, OperationCanceledException { - URI repoLocation = new URI("http://download.eclipse.org/releases/indigo/201103180900"); + URI repoLocation = new URI("https://download.eclipse.org/releases/latest"); IMetadataRepository repo = getMetadataRepositoryManager().loadRepository(repoLocation, null); IQueryResult<IInstallableUnit> allFeatures = repo.query(QueryUtil.createIUGroupQuery(), null); IQueryResult<IInstallableUnit> platform = allFeatures.query(QueryUtil.createIUQuery("org.eclipse.platform.feature.group"), null); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java index 75d7732c1..3ab304109 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java @@ -14,7 +14,10 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.ant; -import java.io.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; import java.net.URI; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.p2.core.ProvisionException; @@ -22,7 +25,9 @@ import org.eclipse.equinox.p2.metadata.IArtifactKey; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.query.IQueryResult; import org.eclipse.equinox.p2.query.QueryUtil; -import org.eclipse.equinox.p2.repository.artifact.*; +import org.eclipse.equinox.p2.repository.artifact.ArtifactKeyQuery; +import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; +import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; import org.eclipse.equinox.p2.tests.AbstractAntProvisioningTest; @@ -130,6 +135,7 @@ public class Repo2RunnableTaskTests extends AbstractAntProvisioningTest { /* * Ensure that the output repository is of the expected type */ + @SuppressWarnings("removal") protected boolean expectedFormat(URI location) { IArtifactRepository repo = null; try { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/AllTests.java index d797c0186..01422270a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/AllTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/AllTests.java @@ -19,9 +19,10 @@ import org.junit.runners.Suite; /** * Performs all automated director tests. */ +@SuppressWarnings("removal") @RunWith(Suite.class) @Suite.SuiteClasses({ Pack200ProcessorTest.class, ZipVerifierProcessorTest.class, ChecksumVerifierTest.class, - ChecksumUtilitiesTest.class }) + ChecksumUtilitiesTest.class, PGPSignatureVerifierTest.class }) public class AllTests { // test suite } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/ChecksumUtilitiesTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/ChecksumUtilitiesTest.java index c0cc0dce2..3f5b73987 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/ChecksumUtilitiesTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/ChecksumUtilitiesTest.java @@ -26,7 +26,6 @@ import org.eclipse.equinox.internal.p2.artifact.processors.checksum.ChecksumUtil import org.eclipse.equinox.internal.p2.artifact.processors.checksum.ChecksumVerifier; import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; import org.eclipse.equinox.internal.p2.metadata.OSGiVersion; -import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; import org.junit.Before; @@ -70,10 +69,11 @@ public class ChecksumUtilitiesTest { @Test public void testChecksumProperty() { - Collection<ProcessingStep> checksumVerifiers = ChecksumUtilities.getChecksumVerifiers(artifactDescriptor, propertyType, emptySet()); + Collection<ChecksumVerifier> checksumVerifiers = ChecksumUtilities.getChecksumVerifiers(artifactDescriptor, + propertyType, emptySet()); assertEquals(format("Verifier for property=%s", property), 1, checksumVerifiers.size()); - ChecksumVerifier verifier = (ChecksumVerifier) checksumVerifiers.iterator().next(); + ChecksumVerifier verifier = checksumVerifiers.iterator().next(); assertEquals(digestAlgorithm, verifier.getAlgorithmName()); assertEquals(algorithmId, verifier.getAlgorithmId()); assertEquals(value, verifier.getExpectedChecksum()); @@ -82,7 +82,8 @@ public class ChecksumUtilitiesTest { @Test public void testChecksumsToSkip() { - Collection<ProcessingStep> checksumVerifiers = ChecksumUtilities.getChecksumVerifiers(artifactDescriptor, propertyType, singleton(algorithmId)); + Collection<ChecksumVerifier> checksumVerifiers = ChecksumUtilities.getChecksumVerifiers(artifactDescriptor, + propertyType, singleton(algorithmId)); assertEquals(emptyList(), checksumVerifiers); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/ChecksumVerifierTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/ChecksumVerifierTest.java index f16eb28e4..1a66379d9 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/ChecksumVerifierTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/ChecksumVerifierTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2019 Mykola Nikishov. + * Copyright (c) 2015, 2021 Mykola Nikishov and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -13,12 +13,10 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.artifact.processors; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.eq; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.not; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; +import static org.mockito.AdditionalMatchers.not; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.io.IOException; import java.util.Arrays; @@ -66,63 +64,55 @@ public class ChecksumVerifierTest { @Test public void testInitialize() throws IOException, IllegalArgumentException, SecurityException { - IProcessingStepDescriptor processingStepDescriptor = createMock(IProcessingStepDescriptor.class); - expect(processingStepDescriptor.getData()).andReturn(checksum); - replay(processingStepDescriptor); + IProcessingStepDescriptor processingStepDescriptor = mock(IProcessingStepDescriptor.class); + when(processingStepDescriptor.getData()).thenReturn(checksum); - ChecksumVerifier verifier = new ChecksumVerifier(digestAlgorithm, providerName, algorithmId); + ChecksumVerifier verifier = new ChecksumVerifier(digestAlgorithm, providerName, algorithmId, false); verifier.initialize(null, processingStepDescriptor, null); Assert.assertEquals(Status.OK_STATUS, verifier.getStatus()); verifier.close(); - verify(processingStepDescriptor); } @Test public void testInitialize_DownloadChecksum() throws IOException, IllegalArgumentException, SecurityException { - IProcessingStepDescriptor processingStepDescriptor = createMock(IProcessingStepDescriptor.class); - expect(processingStepDescriptor.getData()).andReturn(downloadProperty); - IArtifactDescriptor artifactDescriptor = createMock(IArtifactDescriptor.class); - replay(processingStepDescriptor); - expect(artifactDescriptor.getProperty(eq(downloadProperty))).andReturn(checksum); - expect(artifactDescriptor.getProperty(not(eq(downloadProperty)))).andReturn(null).times(1, 2); + IProcessingStepDescriptor processingStepDescriptor = mock(IProcessingStepDescriptor.class); + when(processingStepDescriptor.getData()).thenReturn(downloadProperty); + IArtifactDescriptor artifactDescriptor = mock(IArtifactDescriptor.class); + when(artifactDescriptor.getProperty(eq(downloadProperty))).thenReturn(checksum); + when(artifactDescriptor.getProperty(not(eq(downloadProperty)))).thenReturn(null); HashMap<String, String> properties = new HashMap<>(); properties.put(downloadProperty, checksum); - expect(artifactDescriptor.getProperties()).andReturn(properties); - replay(artifactDescriptor); + when(artifactDescriptor.getProperties()).thenReturn(properties); - ChecksumVerifier verifier = new ChecksumVerifier(digestAlgorithm, providerName, algorithmId); + ChecksumVerifier verifier = new ChecksumVerifier(digestAlgorithm, providerName, algorithmId, false); verifier.initialize(null, processingStepDescriptor, artifactDescriptor); Assert.assertEquals(Status.OK_STATUS, verifier.getStatus()); verifier.close(); - verify(processingStepDescriptor); } @Test public void testInitialize_ArtifactChecksum() throws IOException, IllegalArgumentException, SecurityException { - IProcessingStepDescriptor processingStepDescriptor = createMock(IProcessingStepDescriptor.class); - expect(processingStepDescriptor.getData()).andReturn(artifactProperty); - IArtifactDescriptor artifactDescriptor = createMock(IArtifactDescriptor.class); - replay(processingStepDescriptor); - expect(artifactDescriptor.getProperty(eq(artifactProperty))).andReturn(checksum); + IProcessingStepDescriptor processingStepDescriptor = mock(IProcessingStepDescriptor.class); + when(processingStepDescriptor.getData()).thenReturn(artifactProperty); + IArtifactDescriptor artifactDescriptor = mock(IArtifactDescriptor.class); + when(artifactDescriptor.getProperty(eq(artifactProperty))).thenReturn(checksum); HashMap<String, String> properties = new HashMap<>(); properties.put(artifactProperty, checksum); - expect(artifactDescriptor.getProperties()).andReturn(properties); - expect(artifactDescriptor.getProperty(not(eq(artifactProperty)))).andReturn(null).times(1, 2); - replay(artifactDescriptor); + when(artifactDescriptor.getProperties()).thenReturn(properties); + when(artifactDescriptor.getProperty(not(eq(artifactProperty)))).thenReturn(null); - ChecksumVerifier verifier = new ChecksumVerifier(digestAlgorithm, providerName, algorithmId); + ChecksumVerifier verifier = new ChecksumVerifier(digestAlgorithm, providerName, algorithmId, false); verifier.initialize(null, processingStepDescriptor, artifactDescriptor); Assert.assertEquals(Status.OK_STATUS, verifier.getStatus()); verifier.close(); - verify(processingStepDescriptor); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/PGPSignatureVerifierTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/PGPSignatureVerifierTest.java new file mode 100644 index 000000000..dd3356767 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/PGPSignatureVerifierTest.java @@ -0,0 +1,176 @@ +/******************************************************************************* + * Copyright (c) 2021 Red Hat Inc. and others + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.equinox.p2.tests.artifact.processors; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.nio.file.Files; +import java.util.Set; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.artifact.processors.pgp.PGPSignatureVerifier; +import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; +import org.eclipse.equinox.internal.provisional.p2.repository.DefaultPGPPublicKeyService; +import org.eclipse.equinox.p2.core.ProvisionException; +import org.eclipse.equinox.p2.metadata.Version; +import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; +import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor; +import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; +import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor; +import org.eclipse.equinox.p2.repository.spi.PGPPublicKeyService; +import org.eclipse.equinox.p2.tests.TestAgentProvider; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +public class PGPSignatureVerifierTest { + + @Rule + public TestAgentProvider agentProvider = new TestAgentProvider(); + + @Before + public void initialize() { + try { + PGPPublicKeyService keyService = agentProvider.getService(PGPPublicKeyService.class); + if (keyService instanceof DefaultPGPPublicKeyService) { + DefaultPGPPublicKeyService defaultPGPPublicKeyService = (DefaultPGPPublicKeyService) keyService; + defaultPGPPublicKeyService.setKeyServers(Set.of()); + defaultPGPPublicKeyService.setGPG(false); + } + } catch (ProvisionException e) { + //$FALL-THROUGH$ + } + } + + // @formatter:off + /* + * About test keys: * Install the public&private keys locally * then generate + * signatures with eg `gpg -u signer2@fakeuser.eclipse.org -a --output + * signed_by_signer_2 --detach-sig testArtifact` + */ + // @formatter:on + + private IArtifactDescriptor createArtifact(String signaturesResourcePath, String publicKeyResourcePath) + throws IOException, URISyntaxException { + ArtifactDescriptor res = new ArtifactDescriptor( + new ArtifactKey("whatever", "whatever", Version.parseVersion("1.0.0"))); + res.setProperty(PGPSignatureVerifier.PGP_SIGNATURES_PROPERTY_NAME, read(signaturesResourcePath)); + res.setProperty(PGPSignatureVerifier.PGP_SIGNER_KEYS_PROPERTY_NAME, read(publicKeyResourcePath)); + return res; + } + + private static class ArtifactOutputStream extends ByteArrayOutputStream implements IAdaptable { + IArtifactDescriptor descriptor = new ArtifactDescriptor( + new ArtifactKey("whatever", "whatever", Version.parseVersion("1.0.0"))); + + public IArtifactDescriptor getDescriptor() { + return descriptor; + } + + @Override + public <T> T getAdapter(Class<T> adapter) { + if (adapter.isInstance(descriptor)) { + return adapter.cast(descriptor); + } + return null; + } + } + + private String read(String resource) throws IOException, URISyntaxException { + return Files.readString(new File(FileLocator.toFileURL(getClass().getResource(resource)).toURI()).toPath()); + } + + @Test + public void testOK() throws Exception { + IProcessingStepDescriptor processingStepDescriptor = new ProcessingStepDescriptor(null, null, false); + IArtifactDescriptor artifact = createArtifact("signed_by_signer_1", "public_signer1.pgp"); + @SuppressWarnings("resource") + PGPSignatureVerifier verifier = new PGPSignatureVerifier(); + verifier.initialize(agentProvider.getAgent(), processingStepDescriptor, artifact); + ArtifactOutputStream artifactOutputStream = new ArtifactOutputStream(); + verifier.link(artifactOutputStream, new NullProgressMonitor()); + Assert.assertTrue(verifier.getStatus().toString(), verifier.getStatus().isOK()); + try (InputStream bytes = getClass().getResourceAsStream("testArtifact")) { + bytes.transferTo(verifier); + } + Assert.assertTrue(verifier.getStatus().isOK()); + verifier.close(); + Assert.assertTrue(verifier.getStatus().isOK()); + + IArtifactDescriptor descriptor = artifactOutputStream.getDescriptor(); + Assert.assertNotNull("Signatures should be present", + descriptor.getProperty(PGPSignatureVerifier.PGP_SIGNATURES_PROPERTY_NAME)); + Assert.assertNotNull("Keys should be present", + descriptor.getProperty(PGPSignatureVerifier.PGP_SIGNER_KEYS_PROPERTY_NAME)); + } + + @Test + public void testNoPublicKeyFound() throws Exception { + IProcessingStepDescriptor processingStepDescriptor = new ProcessingStepDescriptor(null, null, false); + IArtifactDescriptor artifact = createArtifact("signed_by_signer_1", "public_signer2.pgp"); + try (PGPSignatureVerifier verifier = new PGPSignatureVerifier()) { + verifier.initialize(agentProvider.getAgent(), processingStepDescriptor, artifact); + ArtifactOutputStream artifactOutputStream = new ArtifactOutputStream(); + verifier.link(artifactOutputStream, new NullProgressMonitor()); + Assert.assertTrue(verifier.getStatus().toString(), verifier.getStatus().isOK()); + try (InputStream bytes = getClass().getResourceAsStream("testArtifact")) { + bytes.transferTo(verifier); + } + Assert.assertTrue(verifier.getStatus().isOK()); + verifier.close(); + Assert.assertTrue(verifier.getStatus().isOK()); + + IArtifactDescriptor descriptor = artifactOutputStream.getDescriptor(); + Assert.assertNull("No signatures should be present", + descriptor.getProperty(PGPSignatureVerifier.PGP_SIGNATURES_PROPERTY_NAME)); + Assert.assertNull("No keys should be present", + descriptor.getProperty(PGPSignatureVerifier.PGP_SIGNER_KEYS_PROPERTY_NAME)); + } + } + + @Test + public void testTamperedSignature() throws Exception { + IProcessingStepDescriptor processingStepDescriptor = new ProcessingStepDescriptor(null, null, false); + IArtifactDescriptor artifact = createArtifact("signed_by_signer_1_tampered", "public_signer1.pgp"); + try (PGPSignatureVerifier verifier = new PGPSignatureVerifier()) { + verifier.initialize(agentProvider.getAgent(), processingStepDescriptor, artifact); + // signature has random modification, making it invalid by itself + Assert.assertFalse(verifier.getStatus().isOK()); + } + } + + @Test + public void testSignatureForAnotherArtifact() throws Exception { + IProcessingStepDescriptor processingStepDescriptor = new ProcessingStepDescriptor(null, null, false); + IArtifactDescriptor artifact = createArtifact("signed_by_signer_1_otherArtifact", "public_signer1.pgp"); + @SuppressWarnings("resource") + PGPSignatureVerifier verifier = new PGPSignatureVerifier(); + verifier.initialize(agentProvider.getAgent(), processingStepDescriptor, artifact); + Assert.assertTrue(verifier.getStatus().isOK()); + try (InputStream bytes = getClass().getResourceAsStream("testArtifact")) { + bytes.transferTo(verifier); + } + Assert.assertTrue(verifier.getStatus().isOK()); + verifier.close(); + IStatus status = verifier.getStatus(); + assertEquals(IStatus.ERROR, status.getSeverity()); + assertTrue(status.getMessage().matches(".*signature.*invalid.*")); + } +} diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/Pack200ProcessorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/Pack200ProcessorTest.java index d6a7a1010..a1447d16a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/Pack200ProcessorTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/Pack200ProcessorTest.java @@ -13,7 +13,14 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.artifact.processors; -import java.io.*; +import java.io.BufferedOutputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.util.Arrays; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.artifact.processors.pack200.Pack200ProcessorStep; @@ -24,6 +31,7 @@ import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; import org.eclipse.equinox.p2.tests.TestActivator; import org.osgi.framework.Bundle; +@Deprecated(forRemoval = true) public class Pack200ProcessorTest extends AbstractProvisioningTest { public Pack200ProcessorTest(String name) { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/private_signer1.pgp b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/private_signer1.pgp new file mode 100644 index 000000000..33d2c2f5f --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/private_signer1.pgp @@ -0,0 +1,84 @@ +-----BEGIN PGP PRIVATE KEY BLOCK----- + +lQWFBGB1bugBDADQ5l7YnS9hNFRkBKSrvVNHt/TxeHaNNIHkdTC56I1QdThsOt4Y +oQRI27AEOaY1GFEi6+QqwxALcMMMSTgkCRs2NFGqlWMVzNYE7bJMWChVa7uQ/9CG +1HRbXwVwQx3hFgU4kmw1Kl/IH4LX76d9gAMyFANPjYZJSjbAv54wOlKruDRgpQFF +pZeuXW7SnerL6sgd/+ZroikdkrjIs5t18C2ofzf6YnOokYkEEJSAEoQK5svVzT4G +H3sw6FlE41RvnYKpuhvvyQhKjISDYfRaIL4JIpvR9Uko48eN9x654lJaucbMiLP4 +ROI9q7RQ6t1IMCiIN9QKgS+nVtHnN9MnXS0czGxfLdStv6bB+xgUoyBc7Uiqf4X0 +x8z9PE6O1L6Rgy2JMJHPgLWCF8h/u1FO88Br3I7TMzu2q/cg3k18L7eujnxVyYiD +YIMxDBXBNnGCKRC4shgt8e+PzAPXIDFvbv7HOaERnx5c6eLl0tD12ocQeZHp1VlW +nQteQ6CfvN07dNUAEQEAAf4HAwIrnfDjnCh1APMEp1xfdT91mv9aZw2xx3DU6gYT +0lkgeZKe8HVLCuulx+MJ1Rl48ub2OnShpE7eMAI3M7N+7uaAFtNlTSR+ADW44eVF +OzmH/CLjMsYD2pNSGdkvqdNzLHi52350TVnuKIciQs0QPAiMDMBrNEckUM3YDbmp +wJlqywaUmjUUKdfvSjBrWTGfLtliRbsPh4BY7ule6R2DVwFDluCAWg9K2VkCL3QB +6f+rdwvi5OzklxJuwd7cuerqNetlZnNHhdU/ZenGdjNuKMUCSEOXpbOWEABUV/dc +9MyIhJdnvV8KovRMpo7RurBe8mv1cFjraA9oe+gM/7Iu+y6ZYlzQdLOJV/uc475k +bHN/lF9jLsTC//gvW8oxdw1a4MIjG7w32L2J6ofeG1g3s8Hw4F84V/igS7WaQShF +VxA3vu8Enggosdfx6lnOgFiR9qVNWcjLtIB2tgxrFDKJY2rFufRZ7VE1NED1AgCa +weg8J8iYbqB14AMS2kiQhzYJ6AQukRidu7QnDhWeuOKcZ3klZvPna8e1ZAEar7os +kjZVjbBpiwOgh2ZXhHvnl7po8XPfdbTZm48DFazDPxVUn+9PxS8/g6bDbrjAo2kk +Wd1HKcOVTSbpO3l3cc0rC7wbZW+NxWrHTuZ8iMrIwtzI3+SZX5W9Fls8vmGpuA/W +ZsGVMr3saXWKeVz8DpUzjPgsVscdQHgt6B6wpEhj8mWccL0BfviqmZnWCVcy2qTv +9PXnCU4TNa7Y2cYtfXbmlOslT9ptBQ0fz+6/OuqB0NRWJl1AQNTBsM7GX8DF3mDb +L+kv+IdIpmk0AN3iFcMo1K7nGoNyMDPuIXaPGYW9o7cfQsDuPO0rPUN8swAG8It3 +gLE1IFuQXyzJJ3pvTqf/NV9Wkh5YrCa8HvrzzR5WNnCBoUruNzWLfkFCZGOpiOGV +//DnXvH2UPZA3hdSumz1yMnqXs1Zx/rMkblqufzxZR9EKwis4IrSULoaswir4IXc +o4qi74OnaMWY+N7/CDAn07HAuB4HgK9UrnRTOYAM7pvOGRMzzbFMenE95hfotaEp +mOjbqMiSGvXMHz1o2blZjHiq63pREP88XGBBfP3pSpVmjA+9Jrt+luVs9FkkTLqt +N6snvrtc83Y92otxNpz8psU3CRu0avUKBF1eM5dPcg5RgGSV9ghCxXFsuOclrJ/q +RI7O5uiEJF3VutvCM2Cz388IGuqejw15xSemXAmAAAPMmxL3t1gAPqLlyI6JW7UT +WKYkiyKFRgLFt6Q+Xal92A/g+waJnxOrcM+va5i0xInTB+DnR3RD6egID42jP7V1 +e/6gZgmFKYWH1XDm9JsZSbW+5lDupuKutDdFY2xpcHNlIHAyIHRlc3QgU2lnbmVy +IDEgPHNpZ25lcjFAZmFrZXVzZXIuZWNsaXBzZS5vcmc+iQHUBBMBCAA+FiEE6ZbG +cKp/ZUCb9dtWE5442Q3tEfAFAmB1bugCGwMFCQPCZwAFCwkIBwIGFQoJCAsCBBYC +AwECHgECF4AACgkQE5442Q3tEfC5dgv9GLaAehcQs3v11ae4LmGOHteAqq6qVmDe +ouCQvID/nj8RHHscssweNTm1UhVpxn1RZvfQHPHqJXHaEy0v/QUUnVLSLDBMNd+3 +/0Sg++yaYTFVgSJLHkfGw9cz5eh8y+Lvmc3fiIxQhTdKAovMeqVZwLdPteMNYoLx +ORNy60gBojMExGyyS0lHc5jNZtvDODPzexWmh9YZ/Ehb3UfX1mvyuMheI3LLW6VG +d+xrP7Fd5d8rFlmzTQW0gg55YGEK2xvz/xS/cVEMrr6VffECp8wbrtrMlekVp9Yk +aLKbKl9LCLokDzrpY7PD0N9upYiVj8QwiHJmuxacaIaGEBq/A6JJZhXrmigViigo +c2Yh6Sm9FlLCUa7C+dmv7bjvW6uQKgbxjPYTLbxCNzQ2BeVcCSoVSQ7aA08WxeST +UQL6/M7aWWmpE5L2m3bl0QFxRKB9yMU4Va/Znkh2YaMUR7joIk0RXM2CQ/73vAk/ +vClw4JIX+ed44GPhvtDSy4n4ywT8XHpJnQWFBGB1bugBDACy3hAYd33D5XdQeBEx +hkhJ9gClwAraoFPVm9/TVATfwlS0M8olqsOWDFxpe5fqM5xsXrQ4x3n12E2alpli +mhwlkyCcRKPT9Ofhxl9bC06jU+ibwtuDXMYohgBpHaZNvyaQLAnCxkJRkKaH7Oyl +pzF1VF2ZaYJdwXEVz/qAErFw8Vl/3cllojfeqwunHIDnsAlXlyT9NjWIWYDocXF6 +FqawBV13nqC7I5F6QkmVkdcT2kgJUQapVR91tJBcSJLfzqRkN+1d7fqmF2PWC0Wx +EsegEjz4vuja+t2ePVRmC2/EFskn5AB+EXz5/zhEUiL0JNjxyF5f5h8MwR2D0n0s +bnhfk/c7Vld4S+50qT+GpYF/7aut2SF0XLIZErTJOs749D61keFwc+p+jgSJWS0L +gFOkHpC0sFg0AZgxF12ZkyCniUTbEaJvxJjCidy3fLV+YH7HruWrrkgVUz8gDA3o +G4xe2Bv5mSaJP54qBzWkri4KxkltACU/OQMZBXr0Y3KOWmEAEQEAAf4HAwLLvoWv +eKC2/fMh+cA0nyp8Q5POdY1Y57YJSp7HcrUJVGFPMwY25rI9K/hg5LIKuXMlTiMw +Jep9pAxERxhvohjPoKqb8zTT85PGFgSl6Mml+0h44CAGLT1bNuuB8/qqrOzWO3l+ +NvHYmaGTYtWKtETRvTZkepTyoKFZY7u0KO3xKusJS+MfuMKFvBlyibR8YLRQED2F +KzNO8rPDLoFt8g6bfEnTgQbn/VqWBliFZ+W9oQAGXaoWC80LR7SBim4/XgsT5G/O +PCZBsOIhHCEV0U6pO2kjDxjh+74CNOLnNTs54M2psYCKthMruQ7umGe1dMO+mQYU +vu0xApMYoXAfCSWLq41b48IxLxGF53PhpjgAafM4TFYHDj56G7foZRmNDvLSFpzq +/xyUxJGcDmx+J9GvAOuvObFn/25DrQJN2NXFm3cPcb6spDJspabBWR6rB+9mJelS +b091fZN0cQM808dmbPyOgRwikB2078MOllFVKOoYbol0J9pZvxhjpAAUBYzSIQfe ++M6QYwHjqFVIaaM00ceo95QoXYbXmnrW2/TRpgZb0zKd26KSumhcS1saLgBb0TqM +va+7xX+sdlOLNGAylulTmfOfsBryB6YogX4j6FpmZnzIwtfUS7KfuU9Ex6l50DY3 +kzRMFVpDTN2jRM90loztnTO3Mqa7yjTXgPv0lga2LIlJYYhzRTrt6alWsKxdAwWY +JxuQiaa119ptdAqgRZkhuWpITFO8XnuQ1L/0vS9qw4SGjnDNm4zxH7AybWlSWzUG +qsoETYAYMjPIcDuzggAu2YHVastfBI862vuUzPlLPHxQfT7uFWB5C+nyghSzocyZ +3bL4FrRrf18LoPSODzoc0unMCXCnE8uS/fOqWTFTXCceNFB6em70p0f/BGpbFrxD +kgE6Pb/VeX57KSuZLuHWbWxgUbVLf75WkkMUhJJ6ZscWpUtrBr6GpeiW0yp+Iw3b +sRofxLSZ4KRBA3zB9WuhCOrqexVPvT+yRbFyzBtpwRfMpWqOdN+3L6wAqBiFzuuc +zLqG9RrTLhRtVAGARRbA3K/0cd2Eu4yFj9JennA3/NGRzFrDx+CvnOoJh/cY9eYb +GOU1KqMABWnpvc6D3UYtSA6pOwZ4k7/qwNuv+p+PwhEfsoBwoaGB5cPiZNKtvIBM +oTV1J3J6MD0dZ2MbVisWr8L5DZOy41OpRv/nB3qxUjO9VWyx92f2oGeeOLrnwBt5 +TnmGP+KxtA9Q0EmRBxuASEHQ35Vc2J2qPBTGVEchHF+h8ojHpWuyc3vXQo4SaBoy +arQN3DjExZfjjp0iaFYRGe8Tix3PrazL1XSDWRcfsdACjB0UJnYy2ngAR0CSZQ6m +iQG8BBgBCAAmFiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB1bugCGwwFCQPCZwAA +CgkQE5442Q3tEfDnvAwA0AkwV8a5kyU0mVHilaNAtZAx0GmlfkYkZqrmEd1sRSOr +oCRRVqc4BvVfEO72BnmRTB2DP7Q7mP4HTMBwXEdd8mMqM7JWq+6mrOCy/22IDqqv +kokhkwxAVvtNPuVpcJpa77my3OqMPatrE5jqa6t0O33ovrBADVZ8pgcZ1Vf2SFRj +6Zv0ZIdSRRk//EhMipArrRttyTDP9OnCIWcHQ+mlkmSuBBcNJcH18q/Jd2ah9Fsn +VRHn9Q1DSETOPDtGHcEvbo3eYiiiiZW+F8cBouiCks6Vxe6Ra5ur6kt9OrtxZ2pO +YW9oLPHaZzaO1C9YFJuaa/Lyd8YYNeSgo2Cs/JOmQ7CFlC011Cdt4vGcKskGo9W2 +o8DdPvzHwtGZKELUNiP0x3Ci0jDkfk44up+xYznFZelaAyk43cY/ToAJW2e1vYxA +K61Iw3QpP5uI6vYfaYaZYgR6Lpf52rsLZVJ0HrNVft/UZPZe4HXSloN3ZcIOgowe +TJJnGnssYADXMioK7p6Y +=P53y +-----END PGP PRIVATE KEY BLOCK----- diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/private_signer2.pgp b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/private_signer2.pgp new file mode 100644 index 000000000..c54415f0c --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/private_signer2.pgp @@ -0,0 +1,84 @@ +-----BEGIN PGP PRIVATE KEY BLOCK----- + +lQWGBGB1hRUBDACuNDnJk8q+E8bZmIKkOCL9HTrj+ZAo2cfFfi/bLD9UsjRBOa21 +ly9oIjDSsmlFMBGX6J/xvwrnWs4lx1YI5yGw0sX9kzBC5ghAE+LVT28OEBkQZciQ +i87C9ad8NjZYg+/ZUbW8Hrss9yQz18Lu0Abejs7redAxbhqpbtkqArvRGOKgC+P7 +qFuYuywvIoiAmh3OGzY+B39KLspFaavSorMNcxveoNXehCoDk9eI4WGhyng+XV1N +ZSquRW4GB8zpEDY0a4Dq4bQsK50A3FeYQMC3Ud0mnMcHERLbghtMQC81Isd/0x44 +nOvjozelRxKzq0MowYXFxQ0jDJN26wVH+3FiovTTxfzk1ZyBOBbjT8yA7xHDgvff +9HMEhCTWyHtxsJIAZrji+pjx4bgPsdvFb7/noQJsP1Ea/ihSl4SSiJk1wrKoQoA4 +3CVdKJ4FIF+v9Kf7ADftGqMdtTHu02AWdT60iu7eKeWY8by2TbsczOTPzb4opWxS +QnCJwtdUngs+Hs0AEQEAAf4HAwLqAXbd6kJNxvMykoDbiN1hl3GLcD4gEiF76UHv +zIdNk1QihIlcSRUHUERdMuHNgnrUQp9WPjNzptwEjAJcP4DYkWcR4+DxPrS07MUa +3Rba+OPMMwgdqZOF3Ql5EvTqudkuIIFFflF4/ComqyDs9p0MvLIffAbcvV0u4plf +gyjWFijh3vZvzRkHvTaIrPnzJFgcTztZ8bIIMsL48TX3Sz3JZiF7chcXUeutUrSJ +740n5jiB0qEHPJ8hZRmAqaYFgInpx1+aRI1ueJCp8ML124Gnn9Tk5l6QSjSTEyPl +E1YRBHszHRcLP2MJ1TfjyCuXoErpu8kXCKI1/aTTV95cguzEFX8gP32l6vnBC0xB +NmQ3eNb9NFbb6QO0E9NEF3BG5ADjRplW4sHnrlQn0+TwDReR9X/RsRPEc2zIBnKe +BZi3o9Judt/CQizyDXtObbg97sIdtnc/EaAIZMrA3uMAxrA5rin5DOIsz/H3zyh9 +w8LZ1cbaWCnp+POv74FjkgXBklniwxkpSSPrVmA2Zw2smXObZq+GcdmRhz0mG2l4 +oKYyPTe4WK74Ho96x1jlDPub7+4/HrCJnxXYsMR35tQvPplWfq1PLOY2mnsXzRho +h7jWYxYNM949EFCwMF09abDBj34ZpRUfYpP6VC8NATG8//v6LwhhrD3AQwLYbpmA +YK64LrnCyh8LfSFibp+8yBis+HHsxz2RgJ7gkrSORoKXAGJAHu+GYuhP9am1ObCH +CUsO1McgCx4yUQZqMbSZuvhf8h61kmnW/+CZSQQ8pO25zvysdhwCPwY1ffsnFX8m +gIVdMBM7QtC9PepJEGQctXMLH/yng6nCPwkb5dkWwoRywG+VhnokARua9n7fMyJJ +C+MEVpmWpRNO2pUjtrW8IjftsjLyLah5FLfhfXR1ciQse5J9HkDsuoRr7owvZJ9U +ZMZStlLZdrMNAIS6k/fRdgBG2mUhLRvdeBcqJ0zO3ZB6RT+Xi4T/C0BEr/tQ65lE +iX3rgvjs7nqCCq45xmPoY34ClOKvAiXmE/5X9DtGVesJVpSkbDjzNeljH/UG/fSi +1/pGlYS5FpYtjrPvS8dPvasobafl2nISTWVUpnChLdFSRvEnj71KtuqHmJf2K0F9 +9yz74UPiSv4Ff5Zyw0IcCeK8KIDsvEwfkTvo53ug3qrEA0mjajBNTK9jKDvCYeWD +v4dbGZqDrMd9Q2UvXXOz9BBrgVN35nAsXXg0hTpKhcDgkKeYi3ssf0T/SR0aYu10 +LVGaN7AqvH11eaXW3Pxa4nO8qm2TBntJMnNO6IEozaba9uM4qrs/5BXWxcJRGBaz +82PyG4AeTOccU6rJBK1zYhz0KMApuuA5rLQ3RWNsaXBzZSBwMiB0ZXN0IFNpZ25l +ciAyIDxzaWduZXIyQGZha2V1c2VyLmVjbGlwc2Uub3JnPokB1AQTAQgAPhYhBFTo +Ck5d9bkVHcBczvkSCo3ck5v0BQJgdYUVAhsDBQkDwmcABQsJCAcCBhUKCQgLAgQW +AgMBAh4BAheAAAoJEPkSCo3ck5v0THMMAIx1c03u7PsAIXRdi0av9NhvPHjjmYAO ++aTxJB3UJFuCqvj61rKXZqBPYgZbQUJUTeDqENZ2+fZ/7kKZhFu5X3dmCePUGBfF +tHnC6NfEj4Lp0+WMYTweoJ6jJQpW2ZqiWVMUgLlGGCbdTTnp9D10qSahaqYBcIgk +v/38Qfqx+D3vyGrqPiUHUwCjwoXL5fsH7r3iNeJBsPdm+2fbjcuij5wzfXhK79B+ +xBQ0VEPcJi1Kbi+QCQC0HUdjc3OSDNSVXbEEgkCNrPPfHz6A14/E0Q+b04OaW2f7 +yq/p/wwVonh+AJomWTk/9bEi1WGahN8WjahHMbycR6Lqm3upyF+/CCiQjUGD0yG2 +XuGtfoieHvHcJF0g2eUAPrRlEtKQfp3Z/UTFAP+bWEhQMlUFLCBXCcPESxzomSkK +P/ia0PjE7YvWxbV9qgO286EyToqAUqIBEfyxRRv/x3QhtKlTFa8/u/ysJLFx6bVr +TdMXC6czbXnryZT9HqkdxqnCP2TNpZWo9p0FhgRgdYUVAQwAyp3Wtn6kUDuBPmYm +9jrrvprMYkjBPapI7Qq/IsuLJfIRex5Pvj4ro1Hnm/FgEjgiAxDocp81HZ6M0PGG +2PYfO444cqdpGGW1I4Ak7Wus78rSaBpbd98l5zpQYu1b6XILtXQQRY5rGIrbhlZu +/Hpsdb5jf671GcFjCj+9UW2qJfQch1z9AU4uDBK/43iqWNjR+5hyVI1PQi4m/kYu +uzEpuBwa0Y8UWWVbO2GQPYbmnSWnU/5MkBvLC5h3f85Q673byHdQCp5WWV99zSUC +rMXb+xM1cCr6Q95xt1DstpbM1MgNJXiXs5cvb6LetTFeZGG5N0h7r5Qul20fTCyb +IV89OPBKvkkMWNWwysy8L5mttNEfx78Z64cX/rpfKnS2dtW0G8RYi4JUPVTLekDA +BQOyVsry8oPJ84NM4AoXO8Mln3bvSZgmSaNRJC+lNqX0xbb+42nZ2yR58rmh/mGc +uuqdPVxzTeozvPXdDKl2veK/2fuo85mDt/c/QVAzf3uDvRmJABEBAAH+BwMC9jOj +3vfR2C/zv0u3eFIq0QIXDgpmKvdClJasHTyyGAvNNJYjZmScm4JNnocGe3jmqCAq +H9L8Y77q+ApljGiQXANFOYV/WMsfTjiqyL1FgNY9OgoNIMnkcMFva+vmlw+aBTYU +HSL1BafF/nh7eJwDoTrSyH8ObnsuqeN8ZwL1iThix70fwbHmvQ7QEl6hgRFKE3oG ++EPmnlQOVbvYfDVYN6sQahRHVluHMZIrMfvMiEUklKAIH7Di/p1dgwoQCN+kHWrG +GMQVJzuO8gWJqC5o61LtcnLau5nIgFFDhqqPi233KBGuqaFmA/7gEZO9d77+W9tU +F2R6Xx4l9FNGws5o1YtwOTeHoLVNRTYoNMfz7B+Sj9RqJG4xQiwCFEKohlA8lIXp +DJhI+TycFeVh3F/esGL4uRWoI46s3FmoliSFuBSqeE3Gz8OtXBOr3CT4RcSrjziF +OuGCnbJAykVmx/2RpWNHN9RdzbmwGyZ8Gz4lxsmas6jRacBWMEn9DXMDq5AjeyYW +lfpXEHAF/n06s+M5nAqJ6uhi1GDYcPQcY1CR6xT9rQoijP+xQUF3ssFGnBWQ1oC6 +nRl4ACJGODgcNuSu+f1/naNK2ZgfaA9hA4mA/YleaIQRvcwWG22ATqpkHnnacU6b +CqesN+jan65BCR6qRRbSi/paK04AORikCwfz8eJXnZ9A0mlPIYi8ld5nNsdEV5MP +BUdZdprrIk0KmSHq/0YovQ/ZqtOkXKZWF18Zk9QR/QFRkJ01eARK9AwKQixh6D89 +ZXv0PqWiquaFCsCE7YlkCC5f4XSwSY3KtqtK0BG5zmdus3Tl4gzOY6k1fCOczcpi +d8ktPEPFBuDWUq8Lutme/a1yAwm82TvOVWPBikASIXpDXWM0JVjEN+4SwrxQ0Hrd +HnCUkr/eHm4EOkmHGHCQnfs+Q50aJNquAorydhMPVez0AhaXu1DwCinAX0K3zAOa +In5/JAhkZ7L5Fy4DG+uQ8YsZA0/2T/5Nr+k2nX1ERZuQ6zta67mAiZpw/M2J6ujZ +AGEbImcGzN48NG8E4sykm/mUIjtxmwakWJ1Cb7+AtMG/8v2jCjwVDVThRWwkdrsY +ug62N/HPQ+sXow6CMA7s1TaQvxn2p1s2zJk+cMOPPn/4VC4y6xPT6nr9Zsi+XxWy +i87H8PyfwG2MqaJEgIr0vGoWPpnCJjUYvK3xqFXPsxz6ngDQW8mG704uWiZhGuua +sXkWyxiobQ/1HtQyk0NA1MCQWSHfHlMf+Km9KrFSm3MlLFtvLvk9VHq8dqfttIZs +l5WHh0o43X3iqMNBlWeJ8A4qmg6/k4n/Zek/y0znieFFXi8Tl3eCsLZWraaE1jP5 +wZyJAbwEGAEIACYWIQRU6ApOXfW5FR3AXM75EgqN3JOb9AUCYHWFFQIbDAUJA8Jn +AAAKCRD5EgqN3JOb9JV1C/sEGGnSLRnVLurlTw6IFIRH0XXggzFaA6JN3cwTmJK5 +xCf4sSwyCt67LXQWZ+YTTFt+EXo/Yd25tPNyJDBAh1dg7TBkTAIGV3PrPJ6Ixmjo +j5Tw2ykaw5fzI37+FjMhB91jzNMDpwcth+7+qu/ru6yIJ/AcHqfSKLD9ao38/jIf +rfbmcZCb+5ZZCSUoyLRAUjSMFqqiRKfy5JiD/qz2ej5rXx4hv1zyq3XauVRC7H5c +ZAAu4g9mP/ri9YhRelGrjm/VmkYMYJ9LS2kMHet7031ldpmcCZfex5ZUR0HLTrF7 +jBd1bN0VbGXZMIchXgJuVrJq7Kw36cjTvP+l46ufWYO+1VArGWk0CKhXIf/MR7C9 +W9RycZUlWTVGBXrncfvqY5Db3SABUJOTRwUyf43G5KCrScx8w7BM0hn+zJyAW9W/ +GplTfzZ8/SWpbNYSlJStpzvEzVUousCk5ERKTp93qYqI/m65zIrxxsaQUc70zUOQ +dhlWIjDhIRD9JBC+M657iNc= +=OHTb +-----END PGP PRIVATE KEY BLOCK----- diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/public_signer1.pgp b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/public_signer1.pgp new file mode 100644 index 000000000..485e0bb6f --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/public_signer1.pgp @@ -0,0 +1,41 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQGNBGB1bugBDADQ5l7YnS9hNFRkBKSrvVNHt/TxeHaNNIHkdTC56I1QdThsOt4Y +oQRI27AEOaY1GFEi6+QqwxALcMMMSTgkCRs2NFGqlWMVzNYE7bJMWChVa7uQ/9CG +1HRbXwVwQx3hFgU4kmw1Kl/IH4LX76d9gAMyFANPjYZJSjbAv54wOlKruDRgpQFF +pZeuXW7SnerL6sgd/+ZroikdkrjIs5t18C2ofzf6YnOokYkEEJSAEoQK5svVzT4G +H3sw6FlE41RvnYKpuhvvyQhKjISDYfRaIL4JIpvR9Uko48eN9x654lJaucbMiLP4 +ROI9q7RQ6t1IMCiIN9QKgS+nVtHnN9MnXS0czGxfLdStv6bB+xgUoyBc7Uiqf4X0 +x8z9PE6O1L6Rgy2JMJHPgLWCF8h/u1FO88Br3I7TMzu2q/cg3k18L7eujnxVyYiD +YIMxDBXBNnGCKRC4shgt8e+PzAPXIDFvbv7HOaERnx5c6eLl0tD12ocQeZHp1VlW +nQteQ6CfvN07dNUAEQEAAbQ3RWNsaXBzZSBwMiB0ZXN0IFNpZ25lciAxIDxzaWdu +ZXIxQGZha2V1c2VyLmVjbGlwc2Uub3JnPokB1AQTAQgAPhYhBOmWxnCqf2VAm/Xb +VhOeONkN7RHwBQJgdW7oAhsDBQkDwmcABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA +AAoJEBOeONkN7RHwuXYL/Ri2gHoXELN79dWnuC5hjh7XgKquqlZg3qLgkLyA/54/ +ERx7HLLMHjU5tVIVacZ9UWb30Bzx6iVx2hMtL/0FFJ1S0iwwTDXft/9EoPvsmmEx +VYEiSx5HxsPXM+XofMvi75nN34iMUIU3SgKLzHqlWcC3T7XjDWKC8TkTcutIAaIz +BMRssktJR3OYzWbbwzgz83sVpofWGfxIW91H19Zr8rjIXiNyy1ulRnfsaz+xXeXf +KxZZs00FtIIOeWBhCtsb8/8Uv3FRDK6+lX3xAqfMG67azJXpFafWJGiymypfSwi6 +JA866WOzw9DfbqWIlY/EMIhyZrsWnGiGhhAavwOiSWYV65ooFYooKHNmIekpvRZS +wlGuwvnZr+2471urkCoG8Yz2Ey28Qjc0NgXlXAkqFUkO2gNPFsXkk1EC+vzO2llp +qROS9pt25dEBcUSgfcjFOFWv2Z5IdmGjFEe46CJNEVzNgkP+97wJP7wpcOCSF/nn +eOBj4b7Q0suJ+MsE/Fx6SbkBjQRgdW7oAQwAst4QGHd9w+V3UHgRMYZISfYApcAK +2qBT1Zvf01QE38JUtDPKJarDlgxcaXuX6jOcbF60OMd59dhNmpaZYpocJZMgnESj +0/Tn4cZfWwtOo1Pom8Lbg1zGKIYAaR2mTb8mkCwJwsZCUZCmh+zspacxdVRdmWmC +XcFxFc/6gBKxcPFZf93JZaI33qsLpxyA57AJV5ck/TY1iFmA6HFxehamsAVdd56g +uyORekJJlZHXE9pICVEGqVUfdbSQXEiS386kZDftXe36phdj1gtFsRLHoBI8+L7o +2vrdnj1UZgtvxBbJJ+QAfhF8+f84RFIi9CTY8cheX+YfDMEdg9J9LG54X5P3O1ZX +eEvudKk/hqWBf+2rrdkhdFyyGRK0yTrO+PQ+tZHhcHPqfo4EiVktC4BTpB6QtLBY +NAGYMRddmZMgp4lE2xGib8SYwonct3y1fmB+x67lq65IFVM/IAwN6BuMXtgb+Zkm +iT+eKgc1pK4uCsZJbQAlPzkDGQV69GNyjlphABEBAAGJAbwEGAEIACYWIQTplsZw +qn9lQJv121YTnjjZDe0R8AUCYHVu6AIbDAUJA8JnAAAKCRATnjjZDe0R8Oe8DADQ +CTBXxrmTJTSZUeKVo0C1kDHQaaV+RiRmquYR3WxFI6ugJFFWpzgG9V8Q7vYGeZFM +HYM/tDuY/gdMwHBcR13yYyozslar7qas4LL/bYgOqq+SiSGTDEBW+00+5Wlwmlrv +ubLc6ow9q2sTmOprq3Q7fei+sEANVnymBxnVV/ZIVGPpm/Rkh1JFGT/8SEyKkCut +G23JMM/06cIhZwdD6aWSZK4EFw0lwfXyr8l3ZqH0WydVEef1DUNIRM48O0YdwS9u +jd5iKKKJlb4XxwGi6IKSzpXF7pFrm6vqS306u3Fnak5hb2gs8dpnNo7UL1gUm5pr +8vJ3xhg15KCjYKz8k6ZDsIWULTXUJ23i8ZwqyQaj1bajwN0+/MfC0ZkoQtQ2I/TH +cKLSMOR+Tji6n7FjOcVl6VoDKTjdxj9OgAlbZ7W9jEArrUjDdCk/m4jq9h9phpli +BHoul/nauwtlUnQes1V+39Rk9l7gddKWg3dlwg6CjB5MkmcaeyxgANcyKgrunpg= +=JYpC +-----END PGP PUBLIC KEY BLOCK----- diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/public_signer2.pgp b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/public_signer2.pgp new file mode 100644 index 000000000..0beadf637 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/public_signer2.pgp @@ -0,0 +1,41 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQGNBGB1hRUBDACuNDnJk8q+E8bZmIKkOCL9HTrj+ZAo2cfFfi/bLD9UsjRBOa21 +ly9oIjDSsmlFMBGX6J/xvwrnWs4lx1YI5yGw0sX9kzBC5ghAE+LVT28OEBkQZciQ +i87C9ad8NjZYg+/ZUbW8Hrss9yQz18Lu0Abejs7redAxbhqpbtkqArvRGOKgC+P7 +qFuYuywvIoiAmh3OGzY+B39KLspFaavSorMNcxveoNXehCoDk9eI4WGhyng+XV1N +ZSquRW4GB8zpEDY0a4Dq4bQsK50A3FeYQMC3Ud0mnMcHERLbghtMQC81Isd/0x44 +nOvjozelRxKzq0MowYXFxQ0jDJN26wVH+3FiovTTxfzk1ZyBOBbjT8yA7xHDgvff +9HMEhCTWyHtxsJIAZrji+pjx4bgPsdvFb7/noQJsP1Ea/ihSl4SSiJk1wrKoQoA4 +3CVdKJ4FIF+v9Kf7ADftGqMdtTHu02AWdT60iu7eKeWY8by2TbsczOTPzb4opWxS +QnCJwtdUngs+Hs0AEQEAAbQ3RWNsaXBzZSBwMiB0ZXN0IFNpZ25lciAyIDxzaWdu +ZXIyQGZha2V1c2VyLmVjbGlwc2Uub3JnPokB1AQTAQgAPhYhBFToCk5d9bkVHcBc +zvkSCo3ck5v0BQJgdYUVAhsDBQkDwmcABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA +AAoJEPkSCo3ck5v0THMMAIx1c03u7PsAIXRdi0av9NhvPHjjmYAO+aTxJB3UJFuC +qvj61rKXZqBPYgZbQUJUTeDqENZ2+fZ/7kKZhFu5X3dmCePUGBfFtHnC6NfEj4Lp +0+WMYTweoJ6jJQpW2ZqiWVMUgLlGGCbdTTnp9D10qSahaqYBcIgkv/38Qfqx+D3v +yGrqPiUHUwCjwoXL5fsH7r3iNeJBsPdm+2fbjcuij5wzfXhK79B+xBQ0VEPcJi1K +bi+QCQC0HUdjc3OSDNSVXbEEgkCNrPPfHz6A14/E0Q+b04OaW2f7yq/p/wwVonh+ +AJomWTk/9bEi1WGahN8WjahHMbycR6Lqm3upyF+/CCiQjUGD0yG2XuGtfoieHvHc +JF0g2eUAPrRlEtKQfp3Z/UTFAP+bWEhQMlUFLCBXCcPESxzomSkKP/ia0PjE7YvW +xbV9qgO286EyToqAUqIBEfyxRRv/x3QhtKlTFa8/u/ysJLFx6bVrTdMXC6czbXnr +yZT9HqkdxqnCP2TNpZWo9rkBjQRgdYUVAQwAyp3Wtn6kUDuBPmYm9jrrvprMYkjB +PapI7Qq/IsuLJfIRex5Pvj4ro1Hnm/FgEjgiAxDocp81HZ6M0PGG2PYfO444cqdp +GGW1I4Ak7Wus78rSaBpbd98l5zpQYu1b6XILtXQQRY5rGIrbhlZu/Hpsdb5jf671 +GcFjCj+9UW2qJfQch1z9AU4uDBK/43iqWNjR+5hyVI1PQi4m/kYuuzEpuBwa0Y8U +WWVbO2GQPYbmnSWnU/5MkBvLC5h3f85Q673byHdQCp5WWV99zSUCrMXb+xM1cCr6 +Q95xt1DstpbM1MgNJXiXs5cvb6LetTFeZGG5N0h7r5Qul20fTCybIV89OPBKvkkM +WNWwysy8L5mttNEfx78Z64cX/rpfKnS2dtW0G8RYi4JUPVTLekDABQOyVsry8oPJ +84NM4AoXO8Mln3bvSZgmSaNRJC+lNqX0xbb+42nZ2yR58rmh/mGcuuqdPVxzTeoz +vPXdDKl2veK/2fuo85mDt/c/QVAzf3uDvRmJABEBAAGJAbwEGAEIACYWIQRU6ApO +XfW5FR3AXM75EgqN3JOb9AUCYHWFFQIbDAUJA8JnAAAKCRD5EgqN3JOb9JV1C/sE +GGnSLRnVLurlTw6IFIRH0XXggzFaA6JN3cwTmJK5xCf4sSwyCt67LXQWZ+YTTFt+ +EXo/Yd25tPNyJDBAh1dg7TBkTAIGV3PrPJ6Ixmjoj5Tw2ykaw5fzI37+FjMhB91j +zNMDpwcth+7+qu/ru6yIJ/AcHqfSKLD9ao38/jIfrfbmcZCb+5ZZCSUoyLRAUjSM +FqqiRKfy5JiD/qz2ej5rXx4hv1zyq3XauVRC7H5cZAAu4g9mP/ri9YhRelGrjm/V +mkYMYJ9LS2kMHet7031ldpmcCZfex5ZUR0HLTrF7jBd1bN0VbGXZMIchXgJuVrJq +7Kw36cjTvP+l46ufWYO+1VArGWk0CKhXIf/MR7C9W9RycZUlWTVGBXrncfvqY5Db +3SABUJOTRwUyf43G5KCrScx8w7BM0hn+zJyAW9W/GplTfzZ8/SWpbNYSlJStpzvE +zVUousCk5ERKTp93qYqI/m65zIrxxsaQUc70zUOQdhlWIjDhIRD9JBC+M657iNc= +=Kto/ +-----END PGP PUBLIC KEY BLOCK----- diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/signed_by_signer_1 b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/signed_by_signer_1 new file mode 100644 index 000000000..a001778a4 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/signed_by_signer_1 @@ -0,0 +1,14 @@ +-----BEGIN PGP SIGNATURE----- + +iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB1jSEdHHNpZ25lcjFA +ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfDElAv/YEgAwby4DXD3J0ZX +6iAU2nRjpaUqZ7SAVkOiueeuuxlDw9HnVpIEp/nAOM0OiJrY5h9jQwpLY+p7QmL/ +hWows1fX1PKzpJNATS3bHr+B7qxPkM2N2LKK/ipkknjBXeQIOZyn47nT1nI8/UbA +UePb5PXDZdIraP6trf5WcsMPxncPntFA4hnPzoVSgvfIYw+Rnjnbsva67grJAe0s +RJLQatTtPM35n7g3UiNwd09lADPz6u9Ka63GFIf1Prt/mZxsihYq+oJ3xwTudxin +n2KFCVIw6pCfpXAdYp5CkpbLCBUxyM0TjwphpiVjpa3haqay6iOYcYTubpTcS60S +Dmz0PE9RCyQq5ycXFPD1UGQKe4C3J/0PzUciT/WzDlxWhM0Wglgez+tYphwDyYHA +4Q+aSv4FMtKJ/I+RVpgOeF+XApEFwPXB5gw9VtjP9e9uu2T3qEnllrzhfPnNzgY9 +km2tk2WYL2hFdRolQnSfzcimTBaa6GI7dWhMCYe0z1Q0xa1i +=0YYr +-----END PGP SIGNATURE----- diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/signed_by_signer_1_otherArtifact b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/signed_by_signer_1_otherArtifact new file mode 100644 index 000000000..f8c604147 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/signed_by_signer_1_otherArtifact @@ -0,0 +1,14 @@ +-----BEGIN PGP SIGNATURE----- + +iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB1+EodHHNpZ25lcjFA +ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfD5LAwAyPl8TBsC0bYZAsRX +BSGXjlJ+oBKci5VH6bgM/ldnZD5SsYv6PVoxxdOJA2R6S88xxd0DuWivYuG+9aiZ +w98hx6g0vNH8AWL+yd+l+2yIS8i/MJ57MCvVztexq935fIYU5KGdUNNEjDIrGHQQ +AR5QWfTiy9EGracG4W6F9twmMOfDlCJ3eRCetp5OTvqBzS2gLom8ECaw7tezYvA/ +09Ok88j7vMI5kL3FO3WzzR+obeYUc19F6602h4cEJs/yOTOj/gz6GCXsAnuYQs1L +yhjv4Cp4sBnMw+zPX0jFeNHu35mPt8oOFz1NLN85GHO7v3FFXmtwxj8bVBWBQR3R +Vfi+n8SfR3WO5pYpsqPHZgP95K+W53ere1BZd67cT6uuJDtoDWC6TYPjndm5tnN1 ++AzDQO12cC4w2cgIt3ElNYK0T8ADvrmCMPZPRPJ+GeZb0jb871SLDU1MPGZ9NHUl +hiuiOU3vTN/X/SbZM/Zcz2eahRAOBOc8sXzqcbjQHN/Akzbg +=acJE +-----END PGP SIGNATURE----- diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/signed_by_signer_1_tampered b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/signed_by_signer_1_tampered new file mode 100644 index 000000000..d165ca5a4 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/signed_by_signer_1_tampered @@ -0,0 +1,14 @@ +-----BEGIN PGP SIGNATURE----- + +iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB1jSEdHHNpZ25lcjFA +ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfDElAv/YEgAwby4DXD3J0ZX +6iAU2nRjpaUqZ7SAVkOiueeuuxlDw9HnVpIEp/nAOM0OiJrY5h9jQwpLY+p7QmL/ +hWows1fX1PKzpJNATS3bHr+B7qxPkM2N2LKK/ipkknjBXeQIOZyn47nT1nI8/UbA +UePb5PXDZdIraP6trf5WcsMPxncPntFA4hnPzoVSgvfIYw+Rnjnbsva67grJAe0s +RJLQatTtPM35n7g3UiNwd09lADPz6u9Ka63GFIf1Prt/mZxsihYq+oJ3xwTudxin +n2KFCVIw6pCfpXAdYp5CkpbLCBUxyM0TjwphpiVjpa3haqay6iOYcYTubpTcS60S +Dmz0PE9RCyQq5ycXFPD1UGQKe4C3J/0PzUciT/WzDlxWhM0Wglgez+tYphwDyYHA +5Q+aSv4FMtKJ/I+RVpgOeF+XApEFwPXB5gw9VtjP9e9uu2T3qEnllrzhfPnNzgY9 +km2tk2WYL2hFdRolQnSfzcimTBaa6GI7dWhMCYe0z1Q0xa1i +=0YYr +-----END PGP SIGNATURE----- diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/signed_by_signer_2 b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/signed_by_signer_2 new file mode 100644 index 000000000..056858dbd --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/signed_by_signer_2 @@ -0,0 +1,14 @@ +-----BEGIN PGP SIGNATURE----- + +iQHRBAABCAA7FiEEVOgKTl31uRUdwFzO+RIKjdyTm/QFAmB1jTEdHHNpZ25lcjJA +ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQ+RIKjdyTm/REpQv8DJeanIGgPjvV09sP +BCBTSbHjoV6b5N6vjc15yZhBcWLJe0PAvApdCt0t7E4kTIKOqAz1sABB6YmJjGOZ +SLL3AToVPk30b07Eq4qgOjEkb3pGlpVFshxEmtrLpbVy068774wacW+PLpvgP0FN +7v0MlCbdcTBA18MVE3eraA14KL+yfLFkEgdtHSpZ6jzhRcQZexKJRpnS7/Bcah80 +RMZ69/N4HPWTo3ys7ELyeDC80P8B35fcayPLJVsFUgrUQ74UsIUwsaUQwoRNuZYR +RSizHrJxkLhfYY5CMFTh9Bl1odY/kiXdBGw2Cqk02K3BlwFMsw5mK4CRtoagpGRO +l1mX58sWjrE+J0tla6MG9aDZiUBdQzFoDGIppex5Bq9ePDcB6CCjR5HO4t7xIg5d +1/pZly/T0kACgzrbfY3IkBVtL0Fv+PCOJRkmTqw2Lvo3Nhq18TTyZWQLqaZQt/Tc +dmZVisxh4YbI8wpTRYh3jSlKJ1YYwlj6/QMG7t2UI9B2jg+7 +=8i0n +-----END PGP SIGNATURE----- diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/testArtifact b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/testArtifact new file mode 100644 index 000000000..fd80c131c --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/testArtifact @@ -0,0 +1 @@ +Hello! Please don't modify me because I'm signed for tests and modifying me in any way would make tests fail
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/AllTests.java index fac04a26a..0abfcc708 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/AllTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/AllTests.java @@ -26,7 +26,7 @@ import org.junit.runners.Suite; BatchExecuteArtifactRepositoryTest.class, Bug252308.class, Bug265577.class, Bug351944.class, CompositeArtifactRepositoryTest.class, CorruptedJar.class, FoldersRepositoryTest.class, JarURLArtifactRepositoryTest.class, LocationTest.class, MD5Tests.class, MirrorSelectorTest.class, - MirrorRequestTest.class, SimpleArtifactRepositoryTest.class, TransferTest.class + MirrorRequestTest.class, SimpleArtifactRepositoryTest.class, TransferTest.class, PGPVerifierTest.class }) public class AllTests { // test suite diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorSelectorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorSelectorTest.java index 527fbc098..154400956 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorSelectorTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorSelectorTest.java @@ -38,223 +38,223 @@ public class MirrorSelectorTest { originals = new ArrayList<>(); MirrorInfo mi = null; - mi = new MirrorInfo("http://ftp.wh2.tu-dresden.de/pub/mirrors/eclipse/", 3); + mi = new MirrorInfo("https://ftp.wh2.tu-dresden.de/pub/mirrors/eclipse/", 3); mi.setBytesPerSecond(224906); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/", 1); + mi = new MirrorInfo("https://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/", 1); mi.setBytesPerSecond(125868); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://mirror.netcologne.de/eclipse//", 0); + mi = new MirrorInfo("https://mirror.netcologne.de/eclipse//", 0); mi.setBytesPerSecond(199719); mi.incrementFailureCount(); mi.incrementFailureCount(); //mi.totalFailureCount = 2; originals.add(mi); - mi = new MirrorInfo("http://mirror.selfnet.de/eclipse/", 5); + mi = new MirrorInfo("https://mirror.selfnet.de/eclipse/", 5); mi.setBytesPerSecond(132379); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://mirror.switch.ch/eclipse/", 7); + mi = new MirrorInfo("https://mirror.switch.ch/eclipse/", 7); mi.setBytesPerSecond(137107); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://www.rcp-vision.com/eclipse/eclipseMirror/", 8); + mi = new MirrorInfo("https://www.rcp-vision.com/eclipse/eclipseMirror/", 8); mi.setBytesPerSecond(128472); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://eclipse.mirror.garr.it/mirrors/eclipse//", 10); + mi = new MirrorInfo("https://eclipse.mirror.garr.it/mirrors/eclipse//", 10); mi.setBytesPerSecond(129359); mi.incrementFailureCount(); mi.incrementFailureCount(); //mi.totalFailureCount = 2; originals.add(mi); - mi = new MirrorInfo("http://ftp.roedu.net/pub/mirrors/eclipse.org/", 6); + mi = new MirrorInfo("https://ftp.roedu.net/pub/mirrors/eclipse.org/", 6); mi.setBytesPerSecond(59587); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://giano.com.dist.unige.it/eclipse/", 9); + mi = new MirrorInfo("https://giano.com.dist.unige.it/eclipse/", 9); mi.setBytesPerSecond(85624); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://ftp.roedu.net/mirrors/eclipse.org//", 19); + mi = new MirrorInfo("https://ftp.roedu.net/mirrors/eclipse.org//", 19); mi.setBytesPerSecond(149572); mi.incrementFailureCount(); mi.incrementFailureCount(); //mi.totalFailureCount = 2; originals.add(mi); - mi = new MirrorInfo("http://ftp.ing.umu.se/mirror/eclipse/", 18); + mi = new MirrorInfo("https://ftp.ing.umu.se/mirror/eclipse/", 18); mi.setBytesPerSecond(105858); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://mirrors.fe.up.pt/pub/eclipse//", 15); + mi = new MirrorInfo("https://mirrors.fe.up.pt/pub/eclipse//", 15); mi.setBytesPerSecond(67202); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://ftp.heanet.ie/pub/eclipse//", 17); + mi = new MirrorInfo("https://ftp.heanet.ie/pub/eclipse//", 17); mi.setBytesPerSecond(68067); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://ftp.sh.cvut.cz/MIRRORS/eclipse/", 21); + mi = new MirrorInfo("https://ftp.sh.cvut.cz/MIRRORS/eclipse/", 21); mi.setBytesPerSecond(73659); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://ftp.man.poznan.pl/eclipse/", 22); + mi = new MirrorInfo("https://ftp.man.poznan.pl/eclipse/", 22); mi.setBytesPerSecond(73446); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://eclipse.dcc.fc.up.pt/", 16); + mi = new MirrorInfo("https://eclipse.dcc.fc.up.pt/", 16); mi.setBytesPerSecond(45175); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://eclipse.nordnet.fi/eclipse/", 23); + mi = new MirrorInfo("https://eclipse.nordnet.fi/eclipse/", 23); mi.setBytesPerSecond(61443); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://www.gtlib.gatech.edu/pub/eclipse/", 26); + mi = new MirrorInfo("https://www.gtlib.gatech.edu/pub/eclipse/", 26); mi.setBytesPerSecond(57637); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://ftp.osuosl.org/pub/eclipse//", 28); + mi = new MirrorInfo("https://ftp.osuosl.org/pub/eclipse//", 28); mi.setBytesPerSecond(35928); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://mirrors.med.harvard.edu/eclipse//", 32); + mi = new MirrorInfo("https://mirrors.med.harvard.edu/eclipse//", 32); mi.setBytesPerSecond(40683); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://mirrors.ibiblio.org/pub/mirrors/eclipse/", 31); + mi = new MirrorInfo("https://mirrors.ibiblio.org/pub/mirrors/eclipse/", 31); mi.setBytesPerSecond(34207); mi.incrementFailureCount(); mi.incrementFailureCount(); //mi.totalFailureCount = 2; originals.add(mi); - mi = new MirrorInfo("http://ftp.ussg.iu.edu/eclipse/", 33); + mi = new MirrorInfo("https://ftp.ussg.iu.edu/eclipse/", 33); mi.setBytesPerSecond(31402); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://mirrors.xmission.com/eclipse/", 29); + mi = new MirrorInfo("https://mirrors.xmission.com/eclipse/", 29); mi.setBytesPerSecond(24147); mi.incrementFailureCount(); //mi.totalFailureCount = 1; originals.add(mi); - mi = new MirrorInfo("http://ftp.osuosl.org/pub/eclipse/", 34); + mi = new MirrorInfo("https://ftp.osuosl.org/pub/eclipse/", 34); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://www.ftp.saix.net/Eclipse//", 40); + mi = new MirrorInfo("https://www.ftp.saix.net/Eclipse//", 40); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://ftp.daum.net/eclipse/", 41); + mi = new MirrorInfo("https://ftp.daum.net/eclipse/", 41); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://eclipse.stu.edu.tw/", 43); + mi = new MirrorInfo("https://eclipse.stu.edu.tw/", 43); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://eclipse.stu.edu.tw/", 44); + mi = new MirrorInfo("https://eclipse.stu.edu.tw/", 44); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://ftp.kaist.ac.kr/eclipse/", 45); + mi = new MirrorInfo("https://ftp.kaist.ac.kr/eclipse/", 45); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://eclipse.stu.edu.tw//", 46); + mi = new MirrorInfo("https://eclipse.stu.edu.tw//", 46); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://ftp.tsukuba.wide.ad.jp/software/eclipse//", 47); + mi = new MirrorInfo("https://ftp.tsukuba.wide.ad.jp/software/eclipse//", 47); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://mirror.neu.edu.cn/eclipse/", 50); + mi = new MirrorInfo("https://mirror.neu.edu.cn/eclipse/", 50); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://mirror.bit.edu.cn/eclipse/", 51); + mi = new MirrorInfo("https://mirror.bit.edu.cn/eclipse/", 51); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://ftp.cs.pu.edu.tw/pub/eclipse/", 52); + mi = new MirrorInfo("https://ftp.cs.pu.edu.tw/pub/eclipse/", 52); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://ftp.neu.edu.cn/mirrors/eclipse/", 53); + mi = new MirrorInfo("https://ftp.neu.edu.cn/mirrors/eclipse/", 53); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://download.actuatechina.com/eclipse/", 54); + mi = new MirrorInfo("https://download.actuatechina.com/eclipse/", 54); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://linorg.usp.br/eclipse/", 57); + mi = new MirrorInfo("https://linorg.usp.br/eclipse/", 57); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://eclipse.c3sl.ufpr.br/", 59); + mi = new MirrorInfo("https://eclipse.c3sl.ufpr.br/", 59); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); - mi = new MirrorInfo("http://download.eclipse.org/", 61); + mi = new MirrorInfo("https://download.eclipse.org/", 61); mi.setBytesPerSecond(-1); //mi.totalFailureCount = 0; originals.add(mi); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/PGPVerifierTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/PGPVerifierTest.java new file mode 100644 index 000000000..0d4525b23 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/PGPVerifierTest.java @@ -0,0 +1,132 @@ +/******************************************************************************* + * Copyright (c) 2021 Red Hat Inc. and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.equinox.p2.tests.artifact.repository; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Comparator; +import java.util.Set; +import java.util.stream.Stream; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.artifact.processors.pgp.PGPSignatureVerifier; +import org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest; +import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; +import org.eclipse.equinox.internal.provisional.p2.repository.DefaultPGPPublicKeyService; +import org.eclipse.equinox.p2.core.IAgentLocation; +import org.eclipse.equinox.p2.metadata.Version; +import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; +import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; +import org.eclipse.equinox.p2.repository.spi.PGPPublicKeyService; +import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class PGPVerifierTest extends AbstractProvisioningTest { + IArtifactRepository targetRepo = null; + IArtifactRepository sourceRepo = null; + + @Override + @Before + public void setUp() throws Exception { + super.setUp(); + } + + private void loadPGPTestRepo(String repoName) throws Exception { + sourceRepo = getArtifactRepositoryManager().loadRepository( + getTestData("Test repository for PGP", "testData/pgp/" + repoName).toURI(), new NullProgressMonitor()); + targetRepo = createArtifactRepository(Files.createTempDirectory(PGPVerifierTest.class.getSimpleName()).toUri(), + NO_PROPERTIES); + } + + @Test + public void testAllGood() throws Exception { + MirrorRequest mirrorRequest = performMirrorFrom("repoPGPOK"); + IStatus mirrorStatus = mirrorRequest.getResult(); + assertOK(mirrorStatus); + + IArtifactDescriptor[] artifactDescriptors = targetRepo.getArtifactDescriptors(mirrorRequest.getArtifactKey()); + Assert.assertEquals(1, artifactDescriptors.length); + IArtifactDescriptor descriptor = artifactDescriptors[0]; + Assert.assertNotNull("Signatures should be present", + descriptor.getProperty(PGPSignatureVerifier.PGP_SIGNATURES_PROPERTY_NAME)); + Assert.assertNotNull("Keys should be present", + descriptor.getProperty(PGPSignatureVerifier.PGP_SIGNER_KEYS_PROPERTY_NAME)); + } + + @Test + public void testAllGoodWithEncodedProperties() throws Exception { + MirrorRequest mirrorRequest = performMirrorFrom("repoPGPOK_encoded"); + IStatus mirrorStatus = mirrorRequest.getResult(); + assertOK(mirrorStatus); + + IArtifactDescriptor[] artifactDescriptors = targetRepo.getArtifactDescriptors(mirrorRequest.getArtifactKey()); + Assert.assertEquals(1, artifactDescriptors.length); + IArtifactDescriptor descriptor = artifactDescriptors[0]; + Assert.assertNotNull("Signatures should be present", + descriptor.getProperty(PGPSignatureVerifier.PGP_SIGNATURES_PROPERTY_NAME)); + Assert.assertNotNull("Keys should be present", + descriptor.getProperty(PGPSignatureVerifier.PGP_SIGNER_KEYS_PROPERTY_NAME)); + } + + private MirrorRequest performMirrorFrom(String repoName) throws Exception { + // Clear the remembered keys/cache of the agent. + IAgentLocation agentLocation = getAgent().getService(IAgentLocation.class); + Path repositoryCache = Paths + .get(agentLocation.getDataArea(org.eclipse.equinox.internal.p2.repository.Activator.ID)); + if (Files.isDirectory(repositoryCache)) { + try (Stream<Path> walk = Files.walk(repositoryCache)) { + walk.sorted(Comparator.reverseOrder()).forEach(path -> { + try { + Files.delete(path); + } catch (IOException e) { + // Ignore + } + }); + } + } + DefaultPGPPublicKeyService keyService = new DefaultPGPPublicKeyService(getAgent()); + keyService.setGPG(false); + keyService.setKeyServers(Set.of()); + + getAgent().registerService(PGPPublicKeyService.SERVICE_NAME, keyService); + loadPGPTestRepo(repoName); + ArtifactKey key = new ArtifactKey("osgi.bundle", "blah", Version.create("1.0.0.123456")); + MirrorRequest mirrorRequest = new MirrorRequest(key, targetRepo, NO_PROPERTIES, NO_PROPERTIES, getTransport()); + mirrorRequest.perform(sourceRepo, getMonitor()); + return mirrorRequest; + } + + @Test + public void testMissingPublicKey() throws Exception { + MirrorRequest mirrorRequest = performMirrorFrom("repoMissingPublicKey"); + IStatus mirrorStatus = mirrorRequest.getResult(); + assertOK(mirrorStatus); + + IArtifactDescriptor[] artifactDescriptors = targetRepo.getArtifactDescriptors(mirrorRequest.getArtifactKey()); + Assert.assertEquals(1, artifactDescriptors.length); + IArtifactDescriptor descriptor = artifactDescriptors[0]; + Assert.assertNull("Signatures should not be present", + descriptor.getProperty(PGPSignatureVerifier.PGP_SIGNATURES_PROPERTY_NAME)); + Assert.assertNull("Keys should not be present", + descriptor.getProperty(PGPSignatureVerifier.PGP_SIGNER_KEYS_PROPERTY_NAME)); + } + + @Override + protected void tearDown() throws Exception { + getArtifactRepositoryManager().removeRepository(sourceRepo.getLocation()); + getArtifactRepositoryManager().removeRepository(targetRepo.getLocation()); + super.tearDown(); + } +} diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java index 6c1d4f87a..c398b0025 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java @@ -256,6 +256,7 @@ public class SimpleArtifactRepositoryTest extends AbstractProvisioningTest { /* * Test that the appropriate location for a packed feature is returned. */ + @Deprecated(forRemoval = true) public void testProperPackedFeatureLocation() { try { repositoryFile = getTempFolder(); @@ -423,6 +424,7 @@ public class SimpleArtifactRepositoryTest extends AbstractProvisioningTest { System.out.println("Total time: " + (end - start)); } + @SuppressWarnings("removal") public void testQuery() throws Exception { File folder = getTestFolder("ArtifactRepository_testQuery"); repositoryURI = folder.toURI(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/TransferTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/TransferTest.java index 6af6b822c..dd7b38315 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/TransferTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/TransferTest.java @@ -41,7 +41,8 @@ public class TransferTest extends AbstractProvisioningTest { } catch (BundleException e) { fail("1.5", e); } - final URI toDownload = new URI("http://download.eclipse.org/eclipse/updates/4.11/R-4.11-201903070500/plugins/javax.servlet.jsp_2.2.0.v201112011158.jar.pack.gz"); + final URI toDownload = new URI( + "https://download.eclipse.org/eclipse/updates/4.11/R-4.11-201903070500/plugins/javax.servlet.jsp_2.2.0.v201112011158.jar.pack.gz"); IStatus s = getTransport().download(toDownload, fos, new NullProgressMonitor()); assertOK("2.0", s); int httpSize = -1; @@ -56,7 +57,9 @@ public class TransferTest extends AbstractProvisioningTest { try { fos.close(); if (f != null) { - String[] ecfPlugins = new String[] {"org.eclipse.ecf", "org.eclipse.ecf.identity", "org.eclipse.ecf.filetransfer", "org.eclipse.ecf.provider.filetransfer", "org.eclipse.ecf.provider.filetransfer.httpclient45"}; + String[] ecfPlugins = new String[] { "org.eclipse.ecf", "org.eclipse.ecf.identity", + "org.eclipse.ecf.filetransfer", "org.eclipse.ecf.provider.filetransfer", + "org.eclipse.ecf.provider.filetransfer.httpclient5" }; StringBuilder buffer = new StringBuilder(); for (String ecfPlugin : ecfPlugins) { Bundle bundle = Platform.getBundle(ecfPlugin); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java index 749403ee0..c5706241b 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2007, 2020 compeople AG and others. +* Copyright (c) 2007, 2021 compeople AG and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -44,6 +44,7 @@ import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor; import org.eclipse.equinox.p2.tests.TestActivator; import org.junit.Test; +@SuppressWarnings("removal") public class ProcessingStepHandlerTest { // private static final int BUFFER_SIZE = 8 * 1024; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/BackupTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/BackupTest.java index daf3a5020..30faf7e96 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/BackupTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/BackupTest.java @@ -13,297 +13,189 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.core; -import java.io.*; -import org.eclipse.equinox.internal.p2.touchpoint.natives.BackupStore; +import static java.nio.file.FileVisitResult.CONTINUE; +import static java.nio.file.StandardOpenOption.CREATE_NEW; + +import java.io.File; +import java.io.IOException; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import org.eclipse.equinox.internal.p2.touchpoint.natives.SimpleBackupStore; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; public class BackupTest extends AbstractProvisioningTest { - private static final String BUPREFIX = "BackupTest"; - private File sourceDir; - private File aDir; - private File aaDir; - private File bDir; - private File aTxt; - private File bTxt; - private File abDir; - private File cTxt; - private File cTxtRelative; + private static final String BUPREFIX = "backup-test"; + + private Path sourceDir; + + private Path aDir; + private Path aaDir; + private Path aTxt; + + private Path bDir; + private Path bTxt; + + private Path abDir; + + private Path cTxt; + + private SimpleBackupStore store; /** - * Sets up directories and files under user.home - * <ul><li>P2BUTEST/</li> - * <ul><li>A/</li> - * <ul><li>AA/</li> - * <ul><li>a.txt</li> - * <li>b.txt</li> - * </ul> - * </ul> - * <li>B/</li> - * </ul> - * </ul> + * <pre> + * /p2-backup-test + * /a + * /aa + * /a.txt + * /b.txt + * /ab + * /c.txt + * /b + * </pre> */ @Override - public void setUp() { - // create some test files under user.home - // do not want them under /tmp as it may be on its own file system (and even - // be an in-memory file system). - // + public void setUp() throws IOException { + // Don't want to backup under /tmp since it may be it's own file system or an + // in-memory file system String userHome = System.getProperty("user.home"); - sourceDir = new File(new File(userHome), "P2BUTEST"); - aDir = new File(sourceDir, "A"); - aDir.mkdirs(); - aaDir = new File(aDir, "AA"); - aaDir.mkdir(); - abDir = new File(aDir, "AB"); - abDir.mkdir(); - - bDir = new File(sourceDir, "B"); - bDir.mkdirs(); - aTxt = new File(aaDir, "a.txt"); - bTxt = new File(aaDir, "b.txt"); - cTxt = new File(abDir, "c.txt"); - cTxtRelative = new File(aaDir, "../AB/c.txt"); - try { - writeToFile(aTxt, "A\nA file with an A"); - writeToFile(bTxt, "B\nA file with a B"); - writeToFile(cTxt, "C\nA file with a C"); - } catch (IOException e) { - fail(); - } - } + sourceDir = Path.of(userHome, "p2-backup-test"); + deleteAll(sourceDir); - private void writeToFile(File file, String content) throws IOException { - file.getParentFile().mkdirs(); - file.createNewFile(); + aDir = sourceDir.resolve("a"); + Files.createDirectories(aDir); - try (Writer writer = new BufferedWriter(new FileWriter(file))) { - writer.write(content); - } + aaDir = aDir.resolve("aa"); + Files.createDirectories(aaDir); + + aTxt = aaDir.resolve("a.txt"); + Files.write(aTxt, "A\nA file with an A".getBytes()); + + bTxt = aaDir.resolve("b.txt"); + Files.write(bTxt, "B\nA file with a B".getBytes()); + + abDir = aDir.resolve("ab"); + Files.createDirectories(abDir); + + cTxt = abDir.resolve("c.txt"); + Files.write(cTxt, "C\nA file with a C".getBytes()); + + bDir = sourceDir.resolve("b"); + Files.createDirectories(bDir); + + store = new SimpleBackupStore(null, BUPREFIX); } @Override - public void tearDown() { - fullyDelete(sourceDir); + public void tearDown() throws IOException { + deleteAll(sourceDir); } - /** - * Deletes a file, or a directory with all of it's children. - * @param file the file or directory to fully delete - * @return true if, and only if the file is deleted - */ - private boolean fullyDelete(File file) { - if (!file.exists()) - return true; - if (file.isDirectory()) { - File[] children = file.listFiles(); - for (File child : children) { - if (!fullyDelete(new File(file, child.getName()))) { - return false; + private static void deleteAll(Path path) throws IOException { + if (!Files.exists(path)) { + return; + } + + Files.walkFileTree(path, new SimpleFileVisitor<Path>() { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + Files.delete(file); + return CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + if (exc != null) { + throw exc; } + Files.delete(dir); + return CONTINUE; } - } - return file.delete(); + }); } /** * Test that a path containing ".." can be backed up and restored. */ - public void testBackupRelative() { - BackupStore store = new BackupStore(null, BUPREFIX); - // backup and overwrite a.txt - try { - store.backup(cTxtRelative); - } catch (IOException e) { - e.printStackTrace(); - fail("IO Exception when backing up cTxtRelative"); - } - if (cTxt.exists()) - fail("File not moved to backup - still exists"); - try { - writeToFile(cTxt, "XXXX\n- This file should be restored with C"); - } catch (IOException e) { - e.printStackTrace(); - fail("Could not write a file for testing purposes."); - } + public void testBackupRelative() throws IOException { + Path cTxtRelative = aaDir.resolve(aaDir.relativize(cTxt)); - // restore - try { - store.restore(); - } catch (IOException e) { - e.printStackTrace(); - fail("Restore operation failed with IOException"); - } - // assert restore - assertFileContent("Restore of C failed - not original content", cTxt, "C"); + store.backup(cTxtRelative.toFile()); + assertFalse(Files.exists(cTxt)); + + Files.write(cTxt, "XXXX\n- This file should be restored with C".getBytes()); + + store.restore(); + assertFileContent("Restore of C failed - not original content", cTxt.toFile(), "C"); assertNoGarbage(store); } - public void testBackupRestore() { - BackupStore store = new BackupStore(null, BUPREFIX); - // backup and overwrite a.txt - try { - store.backup(aTxt); - } catch (IOException e) { - e.printStackTrace(); - fail("IO Exception when backing up aTxt"); - } - if (aTxt.exists()) - fail("File not moved to backup - still exists"); - try { - writeToFile(aTxt, "XXXX\n- This file should be restored with A"); - } catch (IOException e) { - e.printStackTrace(); - fail("Could not write a file for testing purposes."); - } + public void testBackupRestore() throws IOException { + store.backup(aTxt.toFile()); + assertFalse("File not moved to backup - still exists", Files.exists(aTxt)); - // backup the empty B directory - try { - store.backup(bDir); - } catch (IOException e) { - e.printStackTrace(); - fail("IO Exception when backing up bDir"); - } - if (bDir.exists()) - fail("Backed up directory was not moved"); - - // backup b as a copy - try { - store.backupCopy(bTxt); - assertFileContent("File should have been copied", bTxt, "B"); - } catch (IOException e) { - fail("Could not backupCopy bTxt"); - } + Files.write(aTxt, "XXXX\n- This file should be restored with A".getBytes()); - // restore - try { - store.restore(); - } catch (IOException e) { - e.printStackTrace(); - fail("Restore operation failed with IOException"); - } + store.backup(bDir.toFile()); + assertFalse("Backed up directory was not moved", Files.isDirectory(bDir)); - // assert restore - assertFileContent("Restore of A failed - not original content", aTxt, "A"); - if (!bDir.isDirectory() && bDir.listFiles().length != 0) - fail("Empty directory not restored ok"); + store.backupCopy(bTxt.toFile()); + assertFileContent("File should have been copied", bTxt.toFile(), "B"); + store.restore(); + assertFileContent("Restore of A failed - not original content", aTxt.toFile(), "A"); + assertTrue("Empty directory not restored ok", Files.isDirectory(bDir) && Files.list(bDir).count() == 0); assertNoGarbage(store); } - public void testBackupDiscard() { - BackupStore store = new BackupStore(null, BUPREFIX); - // backup and overwrite a.txt - try { - store.backup(aTxt); - } catch (IOException e) { - e.printStackTrace(); - fail("IO Exception when backing up aTxt"); - } - if (aTxt.exists()) - fail("File not moved to backup - still exists"); - try { - writeToFile(aTxt, "XXXX\n- This file should be restored with A"); - } catch (IOException e) { - e.printStackTrace(); - fail("Could not write a file for testing purposes."); - } - - // backup the empty B directory - try { - store.backup(bDir); - } catch (IOException e) { - e.printStackTrace(); - fail("IO Exception when backing up bDir"); - } - if (bDir.exists()) - fail("Backed up directory was not moved"); + public void testBackupDiscard() throws IOException { + store.backup(aTxt.toFile()); + assertFalse("File not moved to backup - still exists", Files.exists(aTxt)); - // restore - store.discard(); + Files.write(aTxt, "XXXX\n- This file should be restored with A".getBytes()); - // assert discard - assertFileContent("Discard of A failed - not new content", aTxt, "XXXX"); - if (bDir.isDirectory()) - fail("Remove of empty directory not discarded ok"); + store.backup(bDir.toFile()); + assertFalse("Backed up directory was not moved", Files.exists(bDir)); + store.discard(); + assertFileContent("Discard of a.txt failed - not new content", aTxt.toFile(), "XXXX"); + assertFalse("Empty directory not discarded - still exists", Files.isDirectory(bDir)); assertNoGarbage(store); } - public void testBackupAll() { - BackupStore store = new BackupStore(null, BUPREFIX); - // backup and overwrite a.txt - try { - store.backupAll(aDir); - } catch (IOException e) { - e.printStackTrace(); - fail("IO Exception when backing up aDir"); - } - if (aTxt.exists()) - fail("File not moved to backup - still exists"); - if (bTxt.exists()) - fail("File bTxt not moved to backup - still exists"); - - try { - writeToFile(aTxt, "XXXX\n- This file should be restored with A"); - } catch (IOException e) { - e.printStackTrace(); - fail("Could not write a file for testing purposes."); - } - try { - store.restore(); - } catch (IOException e) { - fail("Restore failed"); - } - assertFileContent("A not restored", aTxt, "A"); - assertFileContent("B not restored", bTxt, "B"); + public void testBackupAll() throws IOException { + store.backupAll(aDir.toFile()); + assertFalse("File not moved to backup - still exists", Files.exists(aTxt)); + assertFalse("File bTxt not moved to backup - still exists", Files.exists(bTxt)); + + Files.createDirectories(aTxt.getParent()); + Files.write(aTxt, "XXXX\n- This file should be restored with A".getBytes(), CREATE_NEW); + + store.restore(); + assertFileContent("A not restored", aTxt.toFile(), "A"); + assertFileContent("B not restored", bTxt.toFile(), "B"); assertNoGarbage(store); } - public void testBackupCopyAll() { - BackupStore store = new BackupStore(null, BUPREFIX); - // backup and overwrite a.txt - try { - store.backupCopyAll(aDir); - } catch (IOException e) { - e.printStackTrace(); - fail("IO Exception when backing up aDir"); - } - if (!aTxt.exists()) - fail("File not copied to backup - does not exist"); - if (!bTxt.exists()) - fail("File bTxt not copied to backup - does not exists"); - - try { - writeToFile(aTxt, "XXXX\n- This file should be restored with A"); - writeToFile(bTxt, "XXXX\n- This file should be restored with B"); - } catch (IOException e) { - e.printStackTrace(); - fail("Could not write a file for testing purposes."); - } - try { - store.restore(); - } catch (IOException e) { - fail("Restore failed"); - } - assertFileContent("A not restored", aTxt, "A"); - assertFileContent("B not restored", bTxt, "B"); + public void testBackupCopyAll() throws IOException { + store.backupCopyAll(aDir.toFile()); + assertTrue("File not copied to backup - does not exist", Files.exists(aTxt)); + assertTrue("File bTxt not copied to backup - does not exists", Files.exists(bTxt)); + + Files.write(aTxt, "XXXX\n- This file should be restored with A".getBytes()); + Files.write(bTxt, "XXXX\n- This file should be restored with B".getBytes()); + + store.restore(); + assertFileContent("A not restored", aTxt.toFile(), "A"); + assertFileContent("B not restored", bTxt.toFile(), "B"); assertNoGarbage(store); } - private void assertNoGarbage(BackupStore store) { - File buDir = new File(store.getBackupRoot(), BUPREFIX); - if (buDir.exists()) - fail("Backup directory not cleaned up"); - - // Set roots = store.getBackupRoots(); - // if (roots.size() == 0) - // assertTrue("Root set is empty", true); - // for (Iterator itor = roots.iterator(); itor.hasNext();) { - // File root = (File) itor.next(); - // File buDir = new File(root, BUPREFIX); - // if (buDir.exists()) - // fail("Backup directory not cleaned up"); - // } + private static void assertNoGarbage(SimpleBackupStore store) { + File buDir = store.getBackupRoot(); + assertFalse("Backup directory not cleaned up", buDir.exists()); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java index fd4e953e9..268b42d5f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java @@ -35,7 +35,7 @@ public class ProvisioningAgentTest extends AbstractProvisioningTest { * @throws URISyntaxException */ public void testMultipleAgents() throws ProvisionException, URISyntaxException { - URI repoLocation = new URI("http://download.eclipse.org/eclipse/updates/3.6"); + URI repoLocation = new URI("https://download.eclipse.org/eclipse/updates/latest"); URI p2location = getTempFolder().toURI(); String PROFILE_ID = "testMultipleAgents"; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/DirectorApplicationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/DirectorApplicationTest.java index 973a234ff..9ac6d4b8a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/DirectorApplicationTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/DirectorApplicationTest.java @@ -838,4 +838,24 @@ public class DirectorApplicationTest extends AbstractProvisioningTest { return avoidTrustPromptService.getTrustInfo(untrustedChain, null); } + public void testPGPSignedArtifact() throws Exception { + File srcRepo = getTestData(null, "/testData/pgp/repoPGPOK"); + + IArtifactRepositoryManager artifactManager = getAgent().getService(IArtifactRepositoryManager.class); + IMetadataRepositoryManager metadataManager = getAgent().getService(IMetadataRepositoryManager.class); + assertNotNull(artifactManager); + assertNotNull(metadataManager); + + File destinationRepo = new File(getTempFolder(), "DirectorApp Destination"); + String[] args = getSingleRepoArgs(null, srcRepo, srcRepo, destinationRepo, "blah"); + + destinationRepo.mkdirs(); + + StringBuffer buffer = runDirectorApp(null, args); + assertFalse(buffer.toString(), buffer.toString().contains("failed")); + + artifactManager.removeRepository(srcRepo.toURI()); + metadataManager.removeRepository(srcRepo.toURI()); + delete(destinationRepo); + } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/IUListFormatterTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/IUListFormatterTest.java index efa48f080..a2e1bf8ea 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/IUListFormatterTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/IUListFormatterTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2017 SAP AG and others. + * Copyright (c) 2014, 2021 SAP AG and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -14,22 +14,21 @@ package org.eclipse.equinox.p2.tests.director; import static java.util.Arrays.asList; -import static org.easymock.EasyMock.anyObject; -import static org.easymock.EasyMock.createNiceMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.getCurrentArguments; -import static org.easymock.EasyMock.replay; import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.easymock.IAnswer; import org.eclipse.equinox.internal.p2.director.app.IUListFormatter; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.Version; import org.junit.Test; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; public class IUListFormatterTest { @Test @@ -75,37 +74,35 @@ public class IUListFormatterTest { } private static IInstallableUnit createIU(String id, String version, String name, String description) { - IInstallableUnit iu = createNiceMock(id, IInstallableUnit.class); - expect(iu.getId()).andStubReturn(id); - expect(iu.getVersion()).andStubReturn(Version.create(version)); + IInstallableUnit iu = mock(IInstallableUnit.class); + when(iu.getId()).thenReturn(id); + when(iu.getVersion()).thenReturn(Version.create(version)); final Map<String, String> properties = new HashMap<>(3, 1); properties.put(IInstallableUnit.PROP_NAME, name); properties.put(IInstallableUnit.PROP_DESCRIPTION, description); - expect(iu.getProperties()).andStubReturn(properties); - expect(iu.getProperty((String) anyObject())).andStubAnswer(new MapAnswer<>(properties)); - expect(iu.getProperty((String) anyObject(), (String) anyObject())).andStubAnswer(new MapAnswer<>(properties)); - replay(iu); + when(iu.getProperties()).thenReturn(properties); + when(iu.getProperty(anyString())).thenAnswer(new MapAnswer<>(properties)); + when(iu.getProperty(anyString(), anyString())).thenAnswer(new MapAnswer<>(properties)); return iu; } private static IInstallableUnit createIU(String id, String version, int propCount) { - IInstallableUnit iu = createNiceMock(id, IInstallableUnit.class); - expect(iu.getId()).andStubReturn(id); - expect(iu.getVersion()).andStubReturn(Version.create(version)); + IInstallableUnit iu = mock(IInstallableUnit.class); + when(iu.getId()).thenReturn(id); + when(iu.getVersion()).thenReturn(Version.create(version)); final Map<String, String> properties = new HashMap<>(propCount, 1); for (int i = 0; i < propCount; i++) { properties.put("prop_" + i, "propValue_" + i); } - expect(iu.getProperties()).andStubReturn(properties); - expect(iu.getProperty((String) anyObject())).andStubAnswer(new MapAnswer<>(properties)); - expect(iu.getProperty((String) anyObject(), (String) anyObject())).andStubAnswer(new MapAnswer<>(properties)); - replay(iu); + when(iu.getProperties()).thenReturn(properties); + when(iu.getProperty(anyString())).thenAnswer(new MapAnswer<>(properties)); + when(iu.getProperty(anyString(), anyString())).thenAnswer(new MapAnswer<>(properties)); return iu; } - private static final class MapAnswer<T> implements IAnswer<T> { + private static final class MapAnswer<T> implements Answer<T> { private final Map<?, T> map; MapAnswer(Map<?, T> map) { @@ -113,8 +110,8 @@ public class IUListFormatterTest { } @Override - public T answer() throws Throwable { - return map.get(getCurrentArguments()[0]); + public T answer(InvocationOnMock arg) throws Throwable { + return map.get(arg.getArguments()[0]); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/CertificateCheckerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/CertificateCheckerTest.java index 79c58faf5..ba56cc6ea 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/CertificateCheckerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/CertificateCheckerTest.java @@ -15,12 +15,28 @@ package org.eclipse.equinox.p2.tests.engine; import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.security.cert.Certificate; +import java.util.Comparator; +import java.util.Map; +import java.util.Set; +import java.util.stream.Stream; import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.artifact.processors.pgp.PGPSignatureVerifier; +import org.eclipse.equinox.internal.p2.core.AgentLocation; import org.eclipse.equinox.internal.p2.core.ProvisioningAgent; import org.eclipse.equinox.internal.p2.engine.EngineActivator; import org.eclipse.equinox.internal.p2.engine.phases.CertificateChecker; +import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; +import org.eclipse.equinox.internal.provisional.p2.repository.DefaultPGPPublicKeyService; +import org.eclipse.equinox.p2.core.IAgentLocation; +import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.core.UIServices; +import org.eclipse.equinox.p2.engine.IProfileRegistry; +import org.eclipse.equinox.p2.metadata.Version; +import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; +import org.eclipse.equinox.p2.repository.spi.PGPPublicKeyService; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; import org.eclipse.equinox.p2.tests.TestActivator; import org.eclipse.equinox.p2.tests.TestData; @@ -29,6 +45,98 @@ import org.eclipse.equinox.p2.tests.TestData; * Tests for {@link CertificateChecker}. */ public class CertificateCheckerTest extends AbstractProvisioningTest { + private static final String PGP_SIGNER1_PUBLIC_KEY = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + "\n" + + "mQGNBGB1bugBDADQ5l7YnS9hNFRkBKSrvVNHt/TxeHaNNIHkdTC56I1QdThsOt4Y\n" + + "oQRI27AEOaY1GFEi6+QqwxALcMMMSTgkCRs2NFGqlWMVzNYE7bJMWChVa7uQ/9CG\n" + + "1HRbXwVwQx3hFgU4kmw1Kl/IH4LX76d9gAMyFANPjYZJSjbAv54wOlKruDRgpQFF\n" + + "pZeuXW7SnerL6sgd/+ZroikdkrjIs5t18C2ofzf6YnOokYkEEJSAEoQK5svVzT4G\n" + + "H3sw6FlE41RvnYKpuhvvyQhKjISDYfRaIL4JIpvR9Uko48eN9x654lJaucbMiLP4\n" + + "ROI9q7RQ6t1IMCiIN9QKgS+nVtHnN9MnXS0czGxfLdStv6bB+xgUoyBc7Uiqf4X0\n" + + "x8z9PE6O1L6Rgy2JMJHPgLWCF8h/u1FO88Br3I7TMzu2q/cg3k18L7eujnxVyYiD\n" + + "YIMxDBXBNnGCKRC4shgt8e+PzAPXIDFvbv7HOaERnx5c6eLl0tD12ocQeZHp1VlW\n" + + "nQteQ6CfvN07dNUAEQEAAbQ3RWNsaXBzZSBwMiB0ZXN0IFNpZ25lciAxIDxzaWdu\n" + + "ZXIxQGZha2V1c2VyLmVjbGlwc2Uub3JnPokB1AQTAQgAPhYhBOmWxnCqf2VAm/Xb\n" + + "VhOeONkN7RHwBQJgdW7oAhsDBQkDwmcABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA\n" + + "AAoJEBOeONkN7RHwuXYL/Ri2gHoXELN79dWnuC5hjh7XgKquqlZg3qLgkLyA/54/\n" + + "ERx7HLLMHjU5tVIVacZ9UWb30Bzx6iVx2hMtL/0FFJ1S0iwwTDXft/9EoPvsmmEx\n" + + "VYEiSx5HxsPXM+XofMvi75nN34iMUIU3SgKLzHqlWcC3T7XjDWKC8TkTcutIAaIz\n" + + "BMRssktJR3OYzWbbwzgz83sVpofWGfxIW91H19Zr8rjIXiNyy1ulRnfsaz+xXeXf\n" + + "KxZZs00FtIIOeWBhCtsb8/8Uv3FRDK6+lX3xAqfMG67azJXpFafWJGiymypfSwi6\n" + + "JA866WOzw9DfbqWIlY/EMIhyZrsWnGiGhhAavwOiSWYV65ooFYooKHNmIekpvRZS\n" + + "wlGuwvnZr+2471urkCoG8Yz2Ey28Qjc0NgXlXAkqFUkO2gNPFsXkk1EC+vzO2llp\n" + + "qROS9pt25dEBcUSgfcjFOFWv2Z5IdmGjFEe46CJNEVzNgkP+97wJP7wpcOCSF/nn\n" + + "eOBj4b7Q0suJ+MsE/Fx6SbkBjQRgdW7oAQwAst4QGHd9w+V3UHgRMYZISfYApcAK\n" + + "2qBT1Zvf01QE38JUtDPKJarDlgxcaXuX6jOcbF60OMd59dhNmpaZYpocJZMgnESj\n" + + "0/Tn4cZfWwtOo1Pom8Lbg1zGKIYAaR2mTb8mkCwJwsZCUZCmh+zspacxdVRdmWmC\n" + + "XcFxFc/6gBKxcPFZf93JZaI33qsLpxyA57AJV5ck/TY1iFmA6HFxehamsAVdd56g\n" + + "uyORekJJlZHXE9pICVEGqVUfdbSQXEiS386kZDftXe36phdj1gtFsRLHoBI8+L7o\n" + + "2vrdnj1UZgtvxBbJJ+QAfhF8+f84RFIi9CTY8cheX+YfDMEdg9J9LG54X5P3O1ZX\n" + + "eEvudKk/hqWBf+2rrdkhdFyyGRK0yTrO+PQ+tZHhcHPqfo4EiVktC4BTpB6QtLBY\n" + + "NAGYMRddmZMgp4lE2xGib8SYwonct3y1fmB+x67lq65IFVM/IAwN6BuMXtgb+Zkm\n" + + "iT+eKgc1pK4uCsZJbQAlPzkDGQV69GNyjlphABEBAAGJAbwEGAEIACYWIQTplsZw\n" + + "qn9lQJv121YTnjjZDe0R8AUCYHVu6AIbDAUJA8JnAAAKCRATnjjZDe0R8Oe8DADQ\n" + + "CTBXxrmTJTSZUeKVo0C1kDHQaaV+RiRmquYR3WxFI6ugJFFWpzgG9V8Q7vYGeZFM\n" + + "HYM/tDuY/gdMwHBcR13yYyozslar7qas4LL/bYgOqq+SiSGTDEBW+00+5Wlwmlrv\n" + + "ubLc6ow9q2sTmOprq3Q7fei+sEANVnymBxnVV/ZIVGPpm/Rkh1JFGT/8SEyKkCut\n" + + "G23JMM/06cIhZwdD6aWSZK4EFw0lwfXyr8l3ZqH0WydVEef1DUNIRM48O0YdwS9u\n" + + "jd5iKKKJlb4XxwGi6IKSzpXF7pFrm6vqS306u3Fnak5hb2gs8dpnNo7UL1gUm5pr\n" + + "8vJ3xhg15KCjYKz8k6ZDsIWULTXUJ23i8ZwqyQaj1bajwN0+/MfC0ZkoQtQ2I/TH\n" + + "cKLSMOR+Tji6n7FjOcVl6VoDKTjdxj9OgAlbZ7W9jEArrUjDdCk/m4jq9h9phpli\n" + + "BHoul/nauwtlUnQes1V+39Rk9l7gddKWg3dlwg6CjB5MkmcaeyxgANcyKgrunpg=\n" + "=JYpC\n" + + "-----END PGP PUBLIC KEY BLOCK-----\n"; + private static final String PGP_SIGNER1_SIGNATURE = "-----BEGIN PGP SIGNATURE-----\n" + "\n" + + "iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB4Bf8dHHNpZ25lcjFA\n" + + "ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfBPuAwAhE4zA7BswKFhEtzm\n" + + "DS3EbyRr/U13sV01YxqGtxYDCfrOt8TGVPXJSvo0AVP4vLFc5b+0jtVFoarFJNBu\n" + + "xhbVuyC72YdqudNbncSlW6KG5SgeWIM//ThKfl95pOWRWvJEoKJhmDwbDqhZYtL5\n" + + "SECegnWGtGx/klFtZihzHYJE/nfSnhySDaz5lCvXFFYRhIbNmNm2Yq7ztCOsN4Ys\n" + + "3uN+GEdoXGvv1DFg/xZPvwCOhZGsSQfkl1jmUwVltgKrw9OCFbdfYz7H6dbGWhRu\n" + + "2XpuKxPXGavKfpSvssVQIZ6aWi5W6wp5lZAQQddZvYAv3Gi5CZZcUT7ayFJYdD23\n" + + "p9jz76G7MXm0f0uNT9B57T72QryokUIEIJYsCb6lNjWUQB4cd0+JesM7sHwweOQ3\n" + + "7iTFc+WgVJkP0e695mm1tcvtQHUPbIItYJUsndyLgGInzglxN8+F4U4k8uapydI9\n" + + "RmV2NVAifYp8z95Am5AnlG8lqjwrWk5bMbJH82QsQESrNT/h\n" + "=8Vrn\n" + "-----END PGP SIGNATURE-----\n"; + + private static final String PGP_SIGNER2_PUBLIC_KEY = "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n" + "\r\n" + + "mQINBGHUyxYBEADATeNx4XA4H2fP9mD5xwlIyh7qvHLezgXpqCwNS9ATqBwnfrCV\r\n" + + "06a+pfSLsLoXrP/sdaB5WhijfuxTis18RMfoDVwGMRqyD2GiBCl2vwJDg3BUwHnc\r\n" + + "H7W6XkWKO7dkPmF+TUbD3cTWZ7cvrPmMjinmXaq8htuktGuE2VEGZRnuG1m+ChDM\r\n" + + "PnSb1ioFS2+MJv13P2fagVk2qC95DkPJGpMk3CY3ghLDEaY/KaJl+8axAlUUUk9N\r\n" + + "d3k/KVxxf5k3g26EVQkWWgH2mmolptGO101xW64iked97Cy4NK2yafOF/wmpsavx\r\n" + + "PGpOewnDgAJBBPkum6mPH0vcOZgxmLyh4uqfPfr3IaBQlbJLN2dXaDsV83j5t1wZ\r\n" + + "2qxOPcWBfORm6W7dC0TQgCXbEG0geMBpJtvnMX83Q2ORqDpjbHRJsV2k+8NxaXON\r\n" + + "pYXGr+Lj/9n0xfNEDXhCdGab0XP2tVZ5jfr2OQ5dAomEaPqK5Kq7akoWMddpDLNC\r\n" + + "G4IvH8G0cxwruJk00uwd6Nd2NVqVMRYCsBbA89VanUnutLUIpVnnOAetlX9blXHO\r\n" + + "JtmiCPGgHyp+iYGhKYVzfuZQyFhonbi0AhidJDvbHsoLT3p4Mcog1B9y6MODBE7R\r\n" + + "jwrU+qMqYsYeFhGYKbYyXv9TfEyUvtCQ/GnTtRJAQyicFdOdbK37WecS6QARAQAB\r\n" + + "tDdFY2xpcHNlIHAyIHRlc3QgU2lnbmVyIDIgPHNpZ25lcjJAZmFrZXVzZXIuZWNs\r\n" + + "aXBzZS5vcmc+iQJYBBMBCABCFiEEzZ1aK4a8T+GDlFHh4vaU9BsKs3AFAmHUyxYC\r\n" + + "GwMFCQPCZwAFCwkIBwIDIgIBBhUKCQgLAgQWAgMBAh4HAheAAAoJEOL2lPQbCrNw\r\n" + + "wH4QAIiCaw1mREgt4ldz7hQvmGxdMuQwVKZPzbOIAlYbZBo0q9SmeMf/CBCO90hg\r\n" + + "LFmJmsZV4KUU5NKI7UwkDVrpUCl00Ok6+gtiUTId2tRcwXI+25I478VX27j6OkQj\r\n" + + "7Xr6giv8cn8nstt5CF6xxeqrxvpmnZC0u30jE6CL6SdXSd0vViFDPQj3KgGJCRc9\r\n" + + "St+LHB3XJTsadihzQnscqI4E2i5Z3Uj1GogqxtR59M1NAXubl5dySM0qHhwn8O+6\r\n" + + "lcgCCeuyMLLde1M1v8w07jdRUM+IFqHrRnE89EPH3MQeZbQ3UfFXK2r7wx2BJCqL\r\n" + + "Irtn68kz834ByKchGR6DqaAw0q+iF2QkgzYxpwai41BgmtUCYnj+HxQNIF4KTzDe\r\n" + + "nd8mDAPWttGCoVuV2Tyu9peYOaqyAZ2PZwUEH5MqihPCbenU17RLXzRu/IT/SH47\r\n" + + "NGrN3yKGgLZr2EVWPWFibpoxP4G4NUCHsY75uiL2EWPVSjK/+OOeHIE5k3U3lYwB\r\n" + + "7clhBwMkIhQHJ+a0SHRkKixkwrQDw4veKY4LaD0NCBLHFoV5L9orH1ToGM729kr/\r\n" + + "+4I1VQFkL3KvfLjmRbTUgwHeqEquQ96JtqowbNwlpujfHXQKDNsuiKGP5OazXll5\r\n" + + "sH2CR7e4ePqhhzxjLvi9e/79Khq+08eqllS3rs06EXEAJYTo\r\n" + "=807V\r\n" + + "-----END PGP PUBLIC KEY BLOCK-----\r\n" + ""; + private static final String PGP_SIGNER2_SIGNATURE = "-----BEGIN PGP SIGNATURE-----\n" + "\n" + + "iQIzBAABCAAdFiEEzZ1aK4a8T+GDlFHh4vaU9BsKs3AFAmHUy4UACgkQ4vaU9BsK\n" + + "s3DjuhAAvlCtqhK/7/aAG0/cXtlpu0fPC176OmEmBGTjCsrGdWwuRHsqXbLnMBVZ\n" + + "0D1m38MDvuYZfJuP7arw7USKp+Jy54Bv/YwvHLl74YTx1BN9hAN9QvyLxLZOjdm1\n" + + "/ipiWUuUgGa/brxEZNQqSR0w17TqXkIJHeFFS3T/rNH/Ckom5vQhAEm9HwJYeGdt\n" + + "tJ5BUl7BS1rrEOs+xmzqLu6AaERREc5gGRniJe7aP2Ke+/wL6oOLG3v/6vsJSM2e\n" + + "t+Olo4Ugc6JbdNrwvTO8kkTxsi0gp2CPhKl3RZVnbGoe4tXHawmk2V3eVTa0w6iP\n" + + "ARPJ/xH2dDsRi4Kz3OkcyQOI24jGmaqpUrx3+f2BnEbcVs4cHIJc+O2gh1WUz6uY\n" + + "Zw7qtK0W3H+E7RuJLCScgasPZZPBzyA6B3o2J3bfXnG5r41aJEuiq3otgllrBakG\n" + + "u7fX00h8lylgRrlCb4mquZxxRsrl+ac6U5eYdDMkK5VNkXgrus8FedIh3vmqI7RR\n" + + "ou9GEjho4kebt1Y1yTAQnxWBtTUG2hFt6VirKydI7+ZcCZmbD9lrZT6xVQOCkyUQ\n" + + "Cwy7vNPWkpMBBRVLoaThD2+7znDpb6wNYf9mDCcCK8tyuVCDSYEFX6jlqv1yfpNl\n" + + "QlYE1biLAHl09NH397Ta/9cWdfu68I7Mv4Ev2zu45OGa83h820M=\n" + "=9Ha/\n" + "-----END PGP SIGNATURE-----\n"; + class CertificateTestService extends UIServices { public boolean unsignedReturnValue = true; public boolean wasPrompted = false; @@ -55,14 +163,22 @@ public class CertificateCheckerTest extends AbstractProvisioningTest { CertificateTestService serviceUI; File unsigned; private ProvisioningAgent testAgent; + private Path agentLocation; @Override protected void setUp() throws Exception { serviceUI = new CertificateTestService(); testAgent = new ProvisioningAgent(); testAgent.registerService(UIServices.SERVICE_NAME, serviceUI); + agentLocation = Files.createTempDirectory("certificateTest"); + testAgent.setLocation(agentLocation.toUri()); testAgent.setBundleContext(TestActivator.getContext()); checker = new CertificateChecker(testAgent); + PGPPublicKeyService keyService = testAgent.getService(PGPPublicKeyService.class); + if (keyService instanceof DefaultPGPPublicKeyService) { + ((DefaultPGPPublicKeyService) keyService).setKeyServers(Set.of()); + } + try { unsigned = TestData.getFile("CertificateChecker", "unsigned.jar"); } catch (IOException e) { @@ -72,15 +188,29 @@ public class CertificateCheckerTest extends AbstractProvisioningTest { assertTrue("1.0", unsigned.exists()); } + @Override + protected void tearDown() throws Exception { + try (Stream<Path> walk = Files.walk(agentLocation)) { + walk.sorted(Comparator.reverseOrder()).forEach(path -> { + try { + Files.delete(path); + } catch (IOException e) { + // Ignore + } + }); + } + } + /** - * Tests that installing unsigned content is not allowed when the policy says it must fail. + * Tests that installing unsigned content is not allowed when the policy says it + * must fail. */ public void testPolicyAllow() { try { - //if the service is consulted it will say no + // if the service is consulted it will say no serviceUI.unsignedReturnValue = false; System.getProperties().setProperty(EngineActivator.PROP_UNSIGNED_POLICY, EngineActivator.UNSIGNED_ALLOW); - checker.add(unsigned); + checker.add(Map.of(new ArtifactDescriptor(new ArtifactKey("what", "ever", Version.create("1"))), unsigned)); IStatus result = checker.start(); assertEquals("1.0", IStatus.OK, result.getSeverity()); } finally { @@ -89,12 +219,13 @@ public class CertificateCheckerTest extends AbstractProvisioningTest { } /** - * Tests that installing unsigned content is not allowed when the policy says it must fail. + * Tests that installing unsigned content is not allowed when the policy says it + * must fail. */ public void testPolicyFail() { try { System.getProperties().setProperty(EngineActivator.PROP_UNSIGNED_POLICY, EngineActivator.UNSIGNED_FAIL); - checker.add(unsigned); + checker.add(Map.of(new ArtifactDescriptor(new ArtifactKey("what", "ever", Version.create("1"))), unsigned)); IStatus result = checker.start(); assertEquals("1.0", IStatus.ERROR, result.getSeverity()); @@ -104,13 +235,14 @@ public class CertificateCheckerTest extends AbstractProvisioningTest { } /** - * Tests that installing unsigned content with the "prompt" policy and the prompt succeeds. + * Tests that installing unsigned content with the "prompt" policy and the + * prompt succeeds. */ public void testPolicyPromptSuccess() { try { System.getProperties().setProperty(EngineActivator.PROP_UNSIGNED_POLICY, EngineActivator.UNSIGNED_PROMPT); serviceUI.unsignedReturnValue = true; - checker.add(unsigned); + checker.add(Map.of(new ArtifactDescriptor(new ArtifactKey("what", "ever", Version.create("1"))), unsigned)); IStatus result = checker.start(); assertEquals("1.0", IStatus.OK, result.getSeverity()); assertTrue("1.1", serviceUI.wasPrompted); @@ -125,20 +257,21 @@ public class CertificateCheckerTest extends AbstractProvisioningTest { public void testPolicyDefault() { System.getProperties().remove(EngineActivator.PROP_UNSIGNED_POLICY); serviceUI.unsignedReturnValue = true; - checker.add(unsigned); + checker.add(Map.of(new ArtifactDescriptor(new ArtifactKey("what", "ever", Version.create("1"))), unsigned)); IStatus result = checker.start(); assertEquals("1.0", IStatus.OK, result.getSeverity()); assertTrue("1.1", serviceUI.wasPrompted); } /** - * Tests that installing unsigned content with the "prompt" policy and the prompt says no. + * Tests that installing unsigned content with the "prompt" policy and the + * prompt says no. */ public void testPolicyPromptCancel() { try { System.getProperties().setProperty(EngineActivator.PROP_UNSIGNED_POLICY, EngineActivator.UNSIGNED_PROMPT); serviceUI.unsignedReturnValue = false; - checker.add(unsigned); + checker.add(Map.of(new ArtifactDescriptor(new ArtifactKey("what", "ever", Version.create("1"))), unsigned)); IStatus result = checker.start(); assertEquals("1.0", IStatus.CANCEL, result.getSeverity()); assertTrue("1.1", serviceUI.wasPrompted); @@ -148,16 +281,17 @@ public class CertificateCheckerTest extends AbstractProvisioningTest { } /** - * Tests that trust checks that occur in a headless environment are properly treated - * as permissive, but not persistent, the same way as it would be if the service registration - * were not there. + * Tests that trust checks that occur in a headless environment are properly + * treated as permissive, but not persistent, the same way as it would be if the + * service registration were not there. */ public void testBug291049() { try { // Intentionally replace our service with a null service testAgent.registerService(UIServices.SERVICE_NAME, null); - checker.add(unsigned); - // TODO need to add some untrusted files here, too. To prove that we treated them as trusted temporarily + checker.add(Map.of(new ArtifactDescriptor(new ArtifactKey("what", "ever", Version.create("1"))), unsigned)); + // TODO need to add some untrusted files here, too. To prove that we treated + // them as trusted temporarily System.getProperties().setProperty(EngineActivator.PROP_UNSIGNED_POLICY, EngineActivator.UNSIGNED_PROMPT); IStatus result = checker.start(); assertTrue("1.0", result.isOK()); @@ -165,4 +299,85 @@ public class CertificateCheckerTest extends AbstractProvisioningTest { System.getProperties().remove(EngineActivator.PROP_UNSIGNED_POLICY); } } + + public void testPGPSignedArtifactUntrustedKey() throws IOException, ProvisionException { + try { + // create a test profile + testAgent.registerService("FORCED_SELF", IProfileRegistry.SELF); + testAgent.registerService(IAgentLocation.SERVICE_NAME, + new AgentLocation(Files.createTempDirectory( + CertificateCheckerTest.class.getName() + "testPGPSignedArtifactUntrustedKey-profile") + .toUri())); + testAgent.getService(IProfileRegistry.class).addProfile(IProfileRegistry.SELF); + + unsigned = TestData.getFile("pgp/repoPGPOK/plugins", "blah_1.0.0.123456.jar"); + ArtifactDescriptor artifactDescriptor = new ArtifactDescriptor( + new ArtifactKey("what", "ever", Version.create("1"))); + artifactDescriptor + .addProperties(Map.of(PGPSignatureVerifier.PGP_SIGNATURES_PROPERTY_NAME, PGP_SIGNER1_SIGNATURE, // + PGPSignatureVerifier.PGP_SIGNER_KEYS_PROPERTY_NAME, PGP_SIGNER1_PUBLIC_KEY)); + checker.add(Map.of(artifactDescriptor, unsigned)); + System.getProperties().setProperty(EngineActivator.PROP_UNSIGNED_POLICY, EngineActivator.UNSIGNED_PROMPT); + IStatus result = checker.start(); + assertFalse(result.isOK()); + assertTrue(serviceUI.wasPrompted); + } finally { + System.getProperties().remove(EngineActivator.PROP_UNSIGNED_POLICY); + } + } + + public void testPGPSignedArtifactTrustedKeyInProvideCapability() throws IOException { + try { + unsigned = TestData.getFile("pgp/repoPGPOK/plugins", "blah_1.0.0.123456.jar"); + ArtifactDescriptor artifactDescriptor = new ArtifactDescriptor( + new ArtifactKey("what", "ever", Version.create("1"))); + artifactDescriptor + .addProperties(Map.of(PGPSignatureVerifier.PGP_SIGNATURES_PROPERTY_NAME, PGP_SIGNER2_SIGNATURE, + PGPSignatureVerifier.PGP_SIGNER_KEYS_PROPERTY_NAME, PGP_SIGNER2_PUBLIC_KEY)); + checker.add(Map.of(artifactDescriptor, unsigned)); + System.getProperties().setProperty(EngineActivator.PROP_UNSIGNED_POLICY, EngineActivator.UNSIGNED_PROMPT); + IStatus result = checker.start(); + assertTrue(result.isOK()); + assertFalse(serviceUI.wasPrompted); + } finally { + System.getProperties().remove(EngineActivator.PROP_UNSIGNED_POLICY); + } + } + + //// SECURITY ISSUE: next lines become an attack vector as we have no guarantee + //// the metadata of those IUs is safe/were signed. + //// https://bugs.eclipse.org/bugs/show_bug.cgi?id=576705#c4 +// public void testPGPSignedArtifactTrustedKeyInInstalledIU() throws ProvisionException, IOException { +// try { +// // create a test profile +// testAgent.registerService("FORCED_SELF", IProfileRegistry.SELF); +// testAgent +// .registerService(IAgentLocation.SERVICE_NAME, +// new AgentLocation(Files.createTempDirectory( +// CertificateCheckerTest.class.getName() + "testPGPSignedArtifactTrustedKey-profile") +// .toUri())); +// IProfile testProfile = testAgent.getService(IProfileRegistry.class).addProfile(IProfileRegistry.SELF); +// // install an IU that declares trusted keys +// InstallableUnitDescription desc = new InstallableUnitDescription(); +// desc.setProperty(CertificateChecker.TRUSTED_KEY_STORE_PROPERTY, PGP_PUBLIC_KEY); +// desc.setId("unitWithTrustedKeys"); +// desc.setVersion(Version.create("1.0.0")); +// IEngine engine = testAgent.getService(IEngine.class); +// IProvisioningPlan plan = engine.createPlan(testProfile, new ProvisioningContext(testAgent)); +// plan.addInstallableUnit(MetadataFactory.createInstallableUnit(desc)); +// assertTrue(engine.perform(plan, getMonitor()).isOK()); +// +// unsigned = TestData.getFile("pgp/repoPGPOK/plugins", "blah_1.0.0.123456.jar"); +// ArtifactDescriptor artifactDescriptor = new ArtifactDescriptor( +// new ArtifactKey("what", "ever", Version.create("1"))); +// artifactDescriptor.addProperties(Map.of(PGPSignatureVerifier.PGP_SIGNATURES_PROPERTY_NAME, PGP_SIGNATURE)); +// checker.add(Map.of(artifactDescriptor, unsigned)); +// System.getProperties().setProperty(EngineActivator.PROP_UNSIGNED_POLICY, EngineActivator.UNSIGNED_PROMPT); +// IStatus result = checker.start(); +// assertTrue(result.isOK()); +// assertFalse(serviceUI.wasPrompted); +// } finally { +// System.getProperties().remove(EngineActivator.PROP_UNSIGNED_POLICY); +// } +// } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/DownloadManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/DownloadManagerTest.java index 908bb64e9..bd344be8b 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/DownloadManagerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/DownloadManagerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 IBM Corporation and others. + * Copyright (c) 2007, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -17,7 +17,10 @@ import java.net.URI; import java.net.URISyntaxException; import junit.framework.Test; import junit.framework.TestSuite; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.URIUtil; import org.eclipse.equinox.internal.p2.engine.DownloadManager; import org.eclipse.equinox.p2.engine.ProvisioningContext; import org.eclipse.equinox.p2.metadata.IArtifactKey; @@ -177,7 +180,7 @@ public class DownloadManagerTest extends AbstractProvisioningTest { IArtifactRequest[] requests = new IArtifactRequest[] {createArtifactRequest()}; manager.add(requests); IStatus result = manager.start(null); - assertTrue("1.0", result.isOK()); + assertTrue(result.getMessage(), result.isOK()); // Right now the provisioning context adds these to the manager so // we have to remove them so as not to affect other tests. @@ -197,7 +200,7 @@ public class DownloadManagerTest extends AbstractProvisioningTest { IArtifactRequest[] requests = new IArtifactRequest[] {createArtifactRequest()}; manager.add(requests); IStatus result = manager.start(null); - assertTrue("1.0", result.isOK()); + assertTrue(result.getMessage(), result.isOK()); // Right now the provisioning context adds these to the manager so // we have to remove them so as not to affect other tests. @@ -224,7 +227,7 @@ public class DownloadManagerTest extends AbstractProvisioningTest { IArtifactRequest[] requests = new IArtifactRequest[] {createArtifactRequest()}; manager.add(requests); IStatus result = manager.start(null); - assertTrue("1.0", result.isOK()); + assertTrue(result.getMessage(), result.isOK()); // Right now the provisioning context adds these to the manager so // we have to remove them so as not to affect other tests. diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java index 310665dfe..0cc4d9152 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java @@ -243,7 +243,6 @@ public class PhaseSetTest extends AbstractProvisioningTest { @Test public void testPauseAndResumeMoreThanOnce() throws ProvisionException, InterruptedException { - // URI repoLoc = URI.create("http://download.eclipse.org/releases/indigo"); URI repoLoc = getTestData("Load test data.", "/testData/pausefeature").toURI(); final PhaseSet phaseSet = (PhaseSet) PhaseSetFactory.createDefaultPhaseSet(); final int threhold = 3; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest.java index 409e64309..f94358f9c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest.java @@ -16,14 +16,28 @@ package org.eclipse.equinox.p2.tests.engine; import java.io.ByteArrayInputStream; import java.io.File; import java.net.URI; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.EventObject; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.eclipse.core.internal.registry.ExtensionRegistry; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.spi.RegistryContributor; import org.eclipse.equinox.internal.p2.artifact.repository.MirrorEvent; -import org.eclipse.equinox.internal.p2.engine.*; +import org.eclipse.equinox.internal.p2.engine.CollectEvent; +import org.eclipse.equinox.internal.p2.engine.CommitOperationEvent; +import org.eclipse.equinox.internal.p2.engine.InstallableUnitEvent; +import org.eclipse.equinox.internal.p2.engine.PhaseEvent; +import org.eclipse.equinox.internal.p2.engine.RollbackOperationEvent; import org.eclipse.equinox.internal.p2.metadata.TouchpointData; import org.eclipse.equinox.internal.p2.metadata.TouchpointInstruction; import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util; @@ -31,9 +45,18 @@ import org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.ActionConstant import org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.RemoveRepositoryAction; import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener; import org.eclipse.equinox.p2.core.ProvisionException; -import org.eclipse.equinox.p2.engine.*; +import org.eclipse.equinox.p2.engine.IEngine; +import org.eclipse.equinox.p2.engine.IProfile; +import org.eclipse.equinox.p2.engine.IProvisioningPlan; +import org.eclipse.equinox.p2.engine.PhaseSetFactory; +import org.eclipse.equinox.p2.engine.ProvisioningContext; import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.equinox.p2.metadata.*; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.IRequirement; +import org.eclipse.equinox.p2.metadata.ITouchpointInstruction; +import org.eclipse.equinox.p2.metadata.ITouchpointType; +import org.eclipse.equinox.p2.metadata.MetadataFactory; +import org.eclipse.equinox.p2.metadata.Version; import org.eclipse.equinox.p2.query.IQueryResult; import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.p2.repository.IRepository; @@ -41,7 +64,9 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.p2.repository.artifact.IArtifactRequest; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; import org.eclipse.equinox.p2.tests.TestActivator; -import org.junit.*; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; public class ProvisioningEventTest extends AbstractProvisioningTest { private IEngine engine; @@ -203,7 +228,7 @@ public class ProvisioningEventTest extends AbstractProvisioningTest { IProfile profile = createProfile("testConfigureEvent"); IProvisioningPlan plan = engine.createPlan(profile, null); - final String testLocation = "http://download.eclipse.org/releases/juno"; + final String testLocation = "https://download.eclipse.org/releases/2021-09"; // remove the existing location in case it has Map<String, Object> args = new HashMap<>(); args.put(ActionConstants.PARM_AGENT, getAgent()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest35.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest35.java index 76148ba98..4725ca6a9 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest35.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest35.java @@ -59,7 +59,7 @@ public class End2EndTest35 extends AbstractEnd2EndTest { @Override protected URI getRepositoryLocation() { - return URI.create("http://download.eclipse.org/eclipse/updates/3.5"); + return URI.create("https://download.eclipse.org/eclipse/updates/3.5"); } @Override diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest36.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest36.java index ec819c5d9..fe33e7936 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest36.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest36.java @@ -17,7 +17,10 @@ import java.io.File; import java.io.IOException; import java.net.URI; import org.eclipse.core.runtime.Platform; -import org.eclipse.equinox.internal.provisional.frameworkadmin.*; +import org.eclipse.equinox.internal.provisional.frameworkadmin.FrameworkAdmin; +import org.eclipse.equinox.internal.provisional.frameworkadmin.FrameworkAdminRuntimeException; +import org.eclipse.equinox.internal.provisional.frameworkadmin.LauncherData; +import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator; import org.eclipse.equinox.p2.metadata.VersionedId; /** @@ -59,7 +62,7 @@ public class End2EndTest36 extends AbstractEnd2EndTest { @Override protected URI getRepositoryLocation() { - return URI.create("http://download.eclipse.org/eclipse/updates/3.6"); + return URI.create("https://download.eclipse.org/eclipse/updates/3.6"); } @Override diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest37.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest37.java index b5f3cb394..6ea361ebf 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest37.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest37.java @@ -59,7 +59,7 @@ public class End2EndTest37 extends AbstractEnd2EndTest { @Override protected URI getRepositoryLocation() { - return URI.create("http://download.eclipse.org/eclipse/updates/3.7"); + return URI.create("https://download.eclipse.org/eclipse/updates/3.7"); } @Override diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/gc/GCCleanTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/gc/GCCleanTest.java index 8b9592993..e77597a59 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/gc/GCCleanTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/gc/GCCleanTest.java @@ -23,7 +23,10 @@ import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.metadata.IArtifactKey; import org.eclipse.equinox.p2.metadata.Version; -import org.eclipse.equinox.p2.repository.artifact.*; +import org.eclipse.equinox.p2.repository.artifact.ArtifactKeyQuery; +import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; +import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; +import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; @@ -31,6 +34,7 @@ import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; * Tests for the sweep (clean) phase of the garbage collection */ public class GCCleanTest extends AbstractProvisioningTest { + @SuppressWarnings("removal") private IArtifactRepository createRepository(File location) throws ProvisionException { URI repositoryURI = location.toURI(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/GeneratorTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/GeneratorTests.java index 4cd3e61c3..e09e8bc4d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/GeneratorTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/GeneratorTests.java @@ -27,7 +27,9 @@ import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAndBundlesPublisherAppli import org.eclipse.equinox.p2.publisher.eclipse.InstallPublisherApplication; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; -import org.eclipse.equinox.p2.tests.*; +import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; +import org.eclipse.equinox.p2.tests.StringBufferStream; +import org.eclipse.equinox.p2.tests.TestActivator; import org.eclipse.osgi.util.NLS; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; @@ -90,7 +92,7 @@ public class GeneratorTests extends AbstractProvisioningTest { for (int i = 0; i < limit; i++) { BundleContext context = TestActivator.getContext(); Bundle bundle = context.getBundle(i); - File bundleFile = FileLocator.getBundleFile(bundle); + File bundleFile = FileLocator.getBundleFileLocation(bundle).get(); if (!bundleFile.isFile()) { //only jars please ++limit; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/jarprocessor/JarProcessorTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/jarprocessor/JarProcessorTests.java index afb71ab55..abc3a1592 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/jarprocessor/JarProcessorTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/jarprocessor/JarProcessorTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2017 IBM Corporation and others. + * Copyright (c) 2005, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -13,7 +13,11 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.jarprocessor; -import java.io.*; +import java.io.File; +import java.io.FileFilter; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.PrintStream; import org.eclipse.core.runtime.Platform; import org.eclipse.equinox.internal.p2.jarprocessor.PackStep; import org.eclipse.equinox.internal.p2.jarprocessor.verifier.Verifier; @@ -23,6 +27,7 @@ import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessor; import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessorExecutor; import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessorExecutor.Options; +@SuppressWarnings("removal") public class JarProcessorTests extends AbstractProvisioningTest { public void testVerifyStep() throws Exception { @@ -78,6 +83,7 @@ public class JarProcessorTests extends AbstractProvisioningTest { } + @Deprecated(forRemoval = true) public void testPackUnpackVerify() throws Exception { if (!PackStep.canPack() || !VerifyStep.canVerify()) return; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java index 2b4ebef6a..6ac039147 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2018 IBM Corporation and others. + * Copyright (c) 2007, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -14,6 +14,8 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.metadata.repository; +import static org.junit.Assert.assertNotEquals; + import java.io.File; import java.io.IOException; import java.io.PrintStream; @@ -379,23 +381,20 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest { * cache is updated when it becomes stale. */ public void testMetadataCachingRemoteRepo() throws URISyntaxException, ProvisionException { - URI repoLocation = new URI("http://download.eclipse.org/eclipse/updates/3.4milestones/"); + URI repoLocation = new URI("https://download.eclipse.org/eclipse/updates/4.21/R-4.21-202109060500/"); if (!repoAvailable(repoLocation)) return; IAgentLocation agentLocation = ServiceHelper.getService(TestActivator.getContext(), IAgentLocation.class); - URI dataArea = agentLocation.getDataArea("org.eclipse.equinox.p2.metadata.repository/cache/"); + URI dataArea = agentLocation.getDataArea("org.eclipse.equinox.p2.repository/cache/"); File dataAreaFile = URIUtil.toFile(dataArea); - File cacheFileXML = new File(dataAreaFile, "content" + repoLocation.hashCode() + ".xml"); - File cacheFileJAR = new File(dataAreaFile, "content" + repoLocation.hashCode() + ".jar"); - File cacheFile; + File cacheFile = new File(dataAreaFile, + Integer.toString(URIUtil.append(repoLocation, "content.xml.xz").hashCode())); // as implemented in + // XZedSimpleMetadataRepository + // and CacheManager // load a remote repository and check that a local cache was created manager.loadRepository(repoLocation, null); - assertTrue("Cache file was not created.", cacheFileXML.exists() || cacheFileJAR.exists()); - if (cacheFileXML.exists()) - cacheFile = cacheFileXML; - else - cacheFile = cacheFileJAR; + assertTrue("Cache file was not created.", cacheFile.exists()); // modify the last modified date to be older than the remote file cacheFile.setLastModified(0); @@ -403,7 +402,7 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest { manager.removeRepository(repoLocation); manager.loadRepository(repoLocation, null); long lastModified = cacheFile.lastModified(); - assertTrue(0 != lastModified); + assertNotEquals(0, lastModified); // reload the repository and check that the cache was not updated manager.loadRepository(repoLocation, null); @@ -505,9 +504,9 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest { getEventBus().removeListener(referenceCollector); } assertEquals("1.0", 4, references.size()); - assertTrue("1.1", references.contains(new URI("http://download.eclipse.org/url/with/spaces/a%20b"))); + assertTrue("1.1", references.contains(new URI("https://download.eclipse.org/url/with/spaces/a%20b"))); assertTrue("1.2", references.contains(new URI("file:/c:/tmp/url%20with%20spaces/"))); - assertTrue("1.3", references.contains(new URI("http://download.eclipse.org/uri/with/spaces/a%20b"))); + assertTrue("1.3", references.contains(new URI("https://download.eclipse.org/uri/with/spaces/a%20b"))); assertTrue("1.4", references.contains(new URI("file:/c:/tmp/uri%20with%20spaces/"))); } @@ -560,7 +559,7 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest { try { IMetadataRepository repoSlash = manager.loadRepository(locationSlash, null); IMetadataRepository repoNoSlash = manager.loadRepository(locationNoSlash, null); - assertTrue("1.0", repoNoSlash == repoSlash); + assertSame("1.0", repoNoSlash, repoSlash); } catch (ProvisionException e) { fail("1.99", e); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ResumeDownloadTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ResumeDownloadTest.java index 7c8dc873c..10ac9590f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ResumeDownloadTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ResumeDownloadTest.java @@ -19,7 +19,7 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; public class ResumeDownloadTest extends AbstractProvisioningTest { - private static String UPDATE_SITE = "http://download.eclipse.org/eclipse/updates/3.4"; + private static String UPDATE_SITE = "https://download.eclipse.org/eclipse/updates/4.21"; private IMetadataRepositoryManager mgr; private URI repoLoc; private String originalResumeProp; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java index 5ecc71c3f..416f4a8a3 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java @@ -14,6 +14,7 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.mirror; +import static org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor.FORMAT_PACKED; import static org.junit.Assert.assertNotEquals; import java.io.File; @@ -882,6 +883,7 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest { /** * Verifies that the mirror application executes processing steps correctly */ + @SuppressWarnings("removal") public void testArtifactProcessingSteps() { if (System.getProperty("java.specification.version").compareTo("14") >= 0) { // Test explicitly uses pack200 artifacts which are not supported on Java 14+ @@ -901,7 +903,8 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest { for (IArtifactKey key : packedRepo.query(ArtifactKeyQuery.ALL_KEYS, null)) { for (IArtifactDescriptor srcDescriptor : packedRepo.getArtifactDescriptors(key)) { - if (!(srcDescriptor.getProperty(IArtifactDescriptor.FORMAT) == null) && srcDescriptor.getProperty(IArtifactDescriptor.FORMAT).equals(IArtifactDescriptor.FORMAT_PACKED)) { + if (!(srcDescriptor.getProperty(IArtifactDescriptor.FORMAT) == null) + && srcDescriptor.getProperty(IArtifactDescriptor.FORMAT).equals(FORMAT_PACKED)) { //if we have a packed artifact IArtifactDescriptor newDescriptor = new ArtifactDescriptor(key); Map<String, String> properties = new OrderedProperties(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java index 004b5db20..94bdec524 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java @@ -14,7 +14,9 @@ package org.eclipse.equinox.p2.tests.mirror; import java.io.File; -import java.net.*; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; import java.util.HashMap; import java.util.Map; import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository; @@ -516,7 +518,7 @@ public class MetadataMirrorApplicationTest extends AbstractProvisioningTest { public void testMetadataMirrorToInvalid() { URI invalidDestRepository; try { - invalidDestRepository = new URI("http://eclipse.org/equinox/foobar/abcdefg"); + invalidDestRepository = new URI("https://eclipse.org/equinox/foobar/abcdefg"); basicRunMirrorApplication("14.1", sourceRepoLocation.toURL(), invalidDestRepository.toURL(), true); //we expect an illegal state exception to be thrown and should never get here fail("14.0 IllegalStateExpection not thrown"); @@ -535,7 +537,7 @@ public class MetadataMirrorApplicationTest extends AbstractProvisioningTest { delete(invalidRepository); try { - URI invalidDestRepository = new URI("http://eclipse.org/equinox/foobar/abcdefg"); + URI invalidDestRepository = new URI("https://eclipse.org/equinox/foobar/abcdefg"); basicRunMirrorApplication("15.1", invalidRepository.toURL(), invalidDestRepository.toURL(), true); //we expect a provisioning exception to be thrown and should never get here fail("15.0 ProvisionExpection not thrown"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java index 700ebd54c..7a8c97e60 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java @@ -940,6 +940,7 @@ public class NewMirrorApplicationArtifactTest extends AbstractProvisioningTest { /** * Verifies that the mirror application executes processing steps correctly */ + @SuppressWarnings("removal") @Test public void testArtifactProcessingSteps() { if (System.getProperty("java.specification.version").compareTo("14") >= 0) { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationMetadataTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationMetadataTest.java index 173bb4ca0..4d8c2ac71 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationMetadataTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationMetadataTest.java @@ -14,8 +14,12 @@ package org.eclipse.equinox.p2.tests.mirror; import java.io.File; -import java.net.*; -import java.util.*; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository; import org.eclipse.equinox.internal.simpleconfigurator.utils.URIUtil; import org.eclipse.equinox.p2.core.ProvisionException; @@ -551,7 +555,7 @@ public class NewMirrorApplicationMetadataTest extends AbstractProvisioningTest { public void testMetadataMirrorToInvalid() { URI invalidDestRepository = null; try { - invalidDestRepository = new URI("http://eclipse.org/equinox/foobar/abcdefg"); + invalidDestRepository = new URI("https://eclipse.org/equinox/foobar/abcdefg"); basicRunMirrorApplication("14.1", sourceRepoLocation.toURL(), invalidDestRepository.toURL(), true); //we expect an illegal state exception to be thrown and should never get here fail("14.0 IllegalStateExpection not thrown"); @@ -574,7 +578,7 @@ public class NewMirrorApplicationMetadataTest extends AbstractProvisioningTest { delete(invalidRepository); try { - URI invalidDestRepository = new URI("http://eclipse.org/equinox/foobar/abcdefg"); + URI invalidDestRepository = new URI("https://eclipse.org/equinox/foobar/abcdefg"); basicRunMirrorApplication("15.1", invalidRepository.toURL(), invalidDestRepository.toURL(), true); //we expect a provisioning exception to be thrown and should never get here fail("15.0 ProvisionExpection not thrown"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AbsolutePlanTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AbsolutePlanTest.java index d14302449..9e5d9b322 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AbsolutePlanTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AbsolutePlanTest.java @@ -52,6 +52,7 @@ public class AbsolutePlanTest extends AbstractProvisioningTest { for (Operand op : ops) { if (op instanceof InstallableUnitPropertyOperand) { found = true; + break; } } assertTrue(found); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309717.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309717.java index 5e3dad312..faedba0c8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309717.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309717.java @@ -32,7 +32,8 @@ public class Bug309717 extends AbstractProvisioningTest { public void testUpdate() throws ProvisionException, OperationCanceledException, URISyntaxException { IProvisioningAgent agent = getAgentProvider().createAgent(getTestData("test data bug309717", "testData/bug309717/p2").toURI()); - IMetadataRepository repo1 = agent.getService(IMetadataRepositoryManager.class).loadRepository(new URI("http://download.eclipse.org/releases/helios"), null); + IMetadataRepository repo1 = agent.getService(IMetadataRepositoryManager.class) + .loadRepository(new URI("https://download.eclipse.org/releases/2021-09"), null); // assertFalse(repo1.query(QueryUtil.createIUQuery("org.eclipse.rap.jface.databinding"), new NullProgressMonitor()).isEmpty()); assertNotNull(repo1); @@ -42,21 +43,13 @@ public class Bug309717 extends AbstractProvisioningTest { URI jdojo = getTestData("repo for bug309717", "testData/bug309717/repo/jdojo").toURI(); IMetadataRepository repo3 = agent.getService(IMetadataRepositoryManager.class).loadRepository(jdojo, null); assertNotNull(repo3); - IMetadataRepository repo4 = agent.getService(IMetadataRepositoryManager.class).loadRepository(new URI("http://download.eclipse.org/eclipse/updates/3.6"), null); + IMetadataRepository repo4 = agent.getService(IMetadataRepositoryManager.class) + .loadRepository(new URI("https://download.eclipse.org/eclipse/updates/4.21"), null); // assertFalse(repo1.query(QueryUtil.createIUQuery("org.eclipse.rap.jface.databinding"), new NullProgressMonitor()).isEmpty()); assertNotNull(repo4); IPlanner planner = getPlanner(agent); IProfile profile = agent.getService(IProfileRegistry.class).getProfile("PlatformProfile"); IProfileChangeRequest request = planner.createChangeRequest(profile); assertNotNull(request); - // Set<IInstallableUnit> ius = repo2.query(QueryUtil.createIUQuery("org.eclipse.riena.toolbox.feature.feature.group", Version.create("2.0.0.201003181312")), new NullProgressMonitor()).toUnmodifiableSet(); - // request.addAll(ius); - // ProvisioningContext ctx = new ProvisioningContext(getAgent()); - // ctx.setMetadataRepositories(new URI[] {new URI("http://download.eclipse.org/releases/helios"), rienaRepo}); - // IProvisioningPlan plan = planner.getProvisioningPlan(request, ctx, new NullProgressMonitor()); - // - // assertOK("resolution failed", plan.getStatus()); - // assertEquals(0, plan.getAdditions().query(QueryUtil.createIUQuery("org.eclipse.rap.jface.databinding"), new NullProgressMonitor()).toUnmodifiableSet().size()); - // System.out.println(plan); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java index 0e3a5fe7b..08701b299 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java @@ -1,15 +1,28 @@ package org.eclipse.equinox.p2.tests.planner; import java.net.URISyntaxException; -import java.util.*; -import org.eclipse.core.runtime.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.URIUtil; import org.eclipse.equinox.internal.p2.director.Projector; import org.eclipse.equinox.internal.p2.director.Slicer; import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.engine.IProfile; -import org.eclipse.equinox.p2.metadata.*; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.IProvidedCapability; +import org.eclipse.equinox.p2.metadata.IRequirement; +import org.eclipse.equinox.p2.metadata.MetadataFactory; +import org.eclipse.equinox.p2.metadata.Version; +import org.eclipse.equinox.p2.metadata.VersionRange; import org.eclipse.equinox.p2.planner.IProfileChangeRequest; -import org.eclipse.equinox.p2.query.*; +import org.eclipse.equinox.p2.query.Collector; +import org.eclipse.equinox.p2.query.IQueryable; +import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; @@ -20,7 +33,9 @@ public class TychoUsage extends AbstractProvisioningTest { private void setupTopLevelIU() { IRequirement[] reqPlatform1 = new IRequirement[1]; - reqPlatform1[0] = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "org.eclipse.emf.sdk.feature.group", new VersionRange("[2.7.2.v20120130-0943, 2.7.2.v20120130-0943]"), null, false, false, true); + reqPlatform1[0] = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, + "org.eclipse.emf.sdk.feature.group", new VersionRange("[2.27.0.v20210816-1137, 2.27.0.v20210816-1137]"), + null, false, false, true); Map<String, String> p = new HashMap<>(); topLevelIU = createIU("topLevelIU", Version.create("1.0.0"), null, reqPlatform1, new IProvidedCapability[0], p, null, null, true); } @@ -32,7 +47,7 @@ public class TychoUsage extends AbstractProvisioningTest { } public void testEquivalentP2Call() throws ProvisionException, URISyntaxException { - loadMetadataRepository(URIUtil.fromString("http://download.eclipse.org/releases/indigo")); + loadMetadataRepository(URIUtil.fromString("https://download.eclipse.org/releases/2021-09")); profile = createProfile("TestProfile." + getName()); IProfileChangeRequest pcr = getPlanner(getAgent()).createChangeRequest(profile); pcr.add(topLevelIU); @@ -42,8 +57,11 @@ public class TychoUsage extends AbstractProvisioningTest { } public void testTychoUsage() throws ProvisionException, URISyntaxException { - IMetadataRepository repo = loadMetadataRepository(URIUtil.fromString("http://download.eclipse.org/releases/indigo")); - IInstallableUnit newRoot1 = repo.query(QueryUtil.createIUQuery("org.eclipse.emf.sdk.feature.group", Version.create("2.7.2.v20120130-0943")), new NullProgressMonitor()).iterator().next(); + IMetadataRepository repo = loadMetadataRepository( + URIUtil.fromString("https://download.eclipse.org/releases/2021-09")); + IInstallableUnit newRoot1 = repo.query( + QueryUtil.createIUQuery("org.eclipse.emf.sdk.feature.group", Version.create("2.27.0.v20210816-1137")), + new NullProgressMonitor()).iterator().next(); Collection<IInstallableUnit> newRoots = new ArrayList<>(); newRoots.add(newRoot1); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ANYConfigCUsActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ANYConfigCUsActionTest.java index bb92cf4ef..d6085fd8a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ANYConfigCUsActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ANYConfigCUsActionTest.java @@ -14,13 +14,17 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; -import static org.easymock.EasyMock.expect; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.matches; +import static org.mockito.Mockito.when; import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.easymock.EasyMock; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.metadata.InstallableUnit; import org.eclipse.equinox.internal.p2.publisher.eclipse.DataLoader; @@ -212,7 +216,8 @@ public class ANYConfigCUsActionTest extends ActionTest { fail("Unable to create product file advice", e); //$NON-NLS-1$ } - expect(publisherInfo.getAdvice(EasyMock.matches(configSpec), EasyMock.eq(false), (String) EasyMock.anyObject(), (Version) EasyMock.anyObject(), EasyMock.eq(IExecutableAdvice.class))).andReturn(launchingList).anyTimes(); + when(publisherInfo.getAdvice(matches(configSpec), eq(false), anyString(), any(Version.class), + eq(IExecutableAdvice.class))).thenReturn(launchingList); //configure IConfigAdvice ConfigData configData = loader.getConfigData(); @@ -220,14 +225,15 @@ public class ANYConfigCUsActionTest extends ActionTest { ArrayList<IConfigAdvice> configList = new ArrayList<>(); configList.add(configAdvice); configList.add(productAdvice); - expect(publisherInfo.getAdvice(EasyMock.matches(configSpec), EasyMock.eq(false), (String) EasyMock.anyObject(), (Version) EasyMock.anyObject(), EasyMock.eq(IConfigAdvice.class))).andReturn(configList).anyTimes(); + when(publisherInfo.getAdvice(matches(configSpec), eq(false), anyString(), any(Version.class), + eq(IConfigAdvice.class))).thenReturn(configList); //setup metadata repository IInstallableUnit[] ius = {mockIU("foo", null), mockIU("bar", null)}; //$NON-NLS-1$ //$NON-NLS-2$ metadataRepo = new TestMetadataRepository(getAgent(), ius); - expect(publisherInfo.getMetadataRepository()).andReturn(metadataRepo).anyTimes(); - expect(publisherInfo.getContextMetadataRepository()).andReturn(null).anyTimes(); + when(publisherInfo.getMetadataRepository()).thenReturn(metadataRepo); + when(publisherInfo.getContextMetadataRepository()).thenReturn(null); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java index 66707af19..ffe6009d5 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java @@ -15,19 +15,25 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; +import static org.mockito.Mockito.verify; + import java.io.File; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Map; -import org.easymock.Capture; -import org.easymock.EasyMock; +import java.util.stream.Collectors; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.equinox.frameworkadmin.BundleInfo; import org.eclipse.equinox.internal.provisional.frameworkadmin.ConfigData; -import org.eclipse.equinox.p2.publisher.eclipse.*; +import org.eclipse.equinox.p2.publisher.IPublisherAdvice; +import org.eclipse.equinox.p2.publisher.eclipse.AccumulateConfigDataAction; +import org.eclipse.equinox.p2.publisher.eclipse.ConfigAdvice; +import org.eclipse.equinox.p2.publisher.eclipse.LaunchingAdvice; import org.eclipse.equinox.p2.tests.TestActivator; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; public class AccumulateConfigDataActionTest extends ActionTest { @@ -41,13 +47,11 @@ public class AccumulateConfigDataActionTest extends ActionTest { private static String launcherName = "launcherName"; //$NON-NLS-1$ private static String launcherVersion = "0.0.0"; //$NON-NLS-1$ - Capture<ConfigAdvice> configAdviceCapture; - Capture<LaunchingAdvice> launchingAdviceCapture; + ArgumentCaptor<IPublisherAdvice> capture; @Override public void setUp() throws Exception { - configAdviceCapture = new Capture<>(); - launchingAdviceCapture = new Capture<>(); + capture = ArgumentCaptor.forClass(IPublisherAdvice.class); setupPublisherInfo(); setupPublisherResult(); testAction = new AccumulateConfigDataAction(publisherInfo, configSpec, configLocation, executableLocation); @@ -55,13 +59,15 @@ public class AccumulateConfigDataActionTest extends ActionTest { public void testAccumulateConfigDataAction() throws Exception { testAction.perform(publisherInfo, publisherResult, new NullProgressMonitor()); + verify(publisherInfo, Mockito.atLeastOnce()).addAdvice(capture.capture()); verifyConfigAdvice(); verifyLaunchAdvice(); debug("Completed AccumulateConfigDataActionTest."); //$NON-NLS-1$ } private void verifyLaunchAdvice() throws URISyntaxException { - LaunchingAdvice captured = launchingAdviceCapture.getValue(); + LaunchingAdvice captured = (LaunchingAdvice) capture.getAllValues().stream() + .filter(LaunchingAdvice.class::isInstance).collect(Collectors.toList()).get(0); String[] programArgs = captured.getProgramArguments(); assertTrue(programArgs.length == 4); assertTrue(programArgs[0].equalsIgnoreCase("-startup")); //$NON-NLS-1$ @@ -79,7 +85,8 @@ public class AccumulateConfigDataActionTest extends ActionTest { } private void verifyConfigAdvice() throws Exception { - ConfigAdvice captured = configAdviceCapture.getValue(); + ConfigAdvice captured = (ConfigAdvice) capture.getAllValues().stream().filter(ConfigAdvice.class::isInstance) + .collect(Collectors.toList()).get(0); Map<String, String> prop = captured.getProperties(); assertTrue(prop.get("eclipse.buildId").equalsIgnoreCase("TEST-ID")); //$NON-NLS-1$ //$NON-NLS-2$ assertTrue(prop.get("eclipse.p2.profile").equalsIgnoreCase("PlatformProfile")); //$NON-NLS-1$//$NON-NLS-2$ @@ -107,8 +114,5 @@ public class AccumulateConfigDataActionTest extends ActionTest { ConfigAdvice configAdvice = new ConfigAdvice(configData, configSpec); ArrayList<ConfigAdvice> configList = new ArrayList<>(); configList.add(configAdvice); - - publisherInfo.addAdvice(EasyMock.and(EasyMock.isA(ConfigAdvice.class), EasyMock.capture(configAdviceCapture))); - publisherInfo.addAdvice(EasyMock.and(EasyMock.isA(LaunchingAdvice.class), EasyMock.capture(launchingAdviceCapture))); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java index 1741c7878..25290d337 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java @@ -14,10 +14,9 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; import static org.hamcrest.MatcherAssert.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.io.ByteArrayOutputStream; import java.io.File; @@ -118,9 +117,9 @@ public abstract class ActionTest extends AbstractProvisioningTest { for (IRequirement act : actual) { if (expected.getMatches().equals(act.getMatches())) { String descr = "IRequirement " + expected.getMatches(); - Assert.assertEquals("Min of " + descr, expected.getMin(), act.getMin()); - Assert.assertEquals("Max of " + descr, expected.getMax(), act.getMax()); - Assert.assertEquals("Greedy of " + descr, expected.isGreedy(), act.isGreedy()); + assertEquals("Min of " + descr, expected.getMin(), act.getMin()); + assertEquals("Max of " + descr, expected.getMax(), act.getMax()); + assertEquals("Greedy of " + descr, expected.isGreedy(), act.isGreedy()); return; } } @@ -128,13 +127,12 @@ public abstract class ActionTest extends AbstractProvisioningTest { } protected IInstallableUnit mockIU(String id, Version version) { - IInstallableUnit result = createMock(IInstallableUnit.class); - expect(result.getId()).andReturn(id).anyTimes(); + IInstallableUnit result = mock(IInstallableUnit.class); + when(result.getId()).thenReturn(id); if (version == null) version = Version.emptyVersion; - expect(result.getVersion()).andReturn(version).anyTimes(); - expect(result.getFilter()).andReturn(null).anyTimes(); - replay(result); + when(result.getVersion()).thenReturn(version); + when(result.getFilter()).thenReturn(null); return result; } @@ -170,31 +168,20 @@ public abstract class ActionTest extends AbstractProvisioningTest { * Call this method to setup Publisher Info, not <code>insertPublisherInfoBehavior</code> */ public void setupPublisherInfo() { - publisherInfo = createPublisherInfoMock(); + publisherInfo = mock(IPublisherInfo.class); String[] config = getArrayFromString(configSpec, COMMA_SEPARATOR); - expect(publisherInfo.getConfigurations()).andReturn(config).anyTimes(); + when(publisherInfo.getConfigurations()).thenReturn(config); insertPublisherInfoBehavior(); - replay(publisherInfo); - } - - /** - * Creates the mock object for the IPublisherInfo. Subclasses - * can override to create a nice or strict mock instead. - * @return The publisher info mock - * @see org.easymock.EasyMock#createNiceMock(Class) - * @see org.easymock.EasyMock#createStrictMock(Class) - */ - protected IPublisherInfo createPublisherInfoMock() { - return createMock(IPublisherInfo.class); } /** * Do not call this method, it is called by <code>setupPublisherInfo</code>. */ protected void insertPublisherInfoBehavior() { - expect(publisherInfo.getMetadataRepository()).andReturn(createTestMetdataRepository(new IInstallableUnit[0])).anyTimes(); - expect(publisherInfo.getContextMetadataRepository()).andReturn(createTestMetdataRepository(new IInstallableUnit[0])).anyTimes(); + when(publisherInfo.getMetadataRepository()).thenReturn(createTestMetdataRepository(new IInstallableUnit[0])); + when(publisherInfo.getContextMetadataRepository()) + .thenReturn(createTestMetdataRepository(new IInstallableUnit[0])); } public void cleanup() { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceMatcher.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceMatcher.java deleted file mode 100644 index f23e1f53b..000000000 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceMatcher.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2017 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.tests.publisher.actions; - -import org.easymock.EasyMock; -import org.easymock.IArgumentMatcher; -import org.eclipse.equinox.p2.metadata.Version; -import org.eclipse.equinox.p2.publisher.IPublisherAdvice; - -/** - * A matcher that matches advice applicable to a given id and version. - */ -public class AdviceMatcher implements IArgumentMatcher { - private final Version version; - private final String id; - private static Class<?> clazz; - - public static IPublisherAdvice adviceMatches(String id, Version version, Class<?> clazz) { - AdviceMatcher.clazz = clazz; - EasyMock.reportMatcher(new AdviceMatcher(id, version)); - return null; - } - - public AdviceMatcher(String id, Version version) { - this.id = id; - this.version = version; - } - - @Override - public void appendTo(StringBuffer buf) { - buf.append("AdviceMatcher[" + id + ',' + version + ']'); - } - - @Override - public boolean matches(Object arg) { - if (!(arg instanceof IPublisherAdvice)) - return false; - if (!(clazz.isAssignableFrom(arg.getClass()))) - return false; - IPublisherAdvice advice = (IPublisherAdvice) arg; - return advice.isApplicable("", false, id, version); - } -} diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java index f56b010af..fd95c834b 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java @@ -16,15 +16,16 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; -import static org.easymock.EasyMock.and; -import static org.easymock.EasyMock.capture; -import static org.easymock.EasyMock.expect; import static org.eclipse.equinox.p2.tests.publisher.actions.StatusMatchers.errorStatus; import static org.eclipse.equinox.p2.tests.publisher.actions.StatusMatchers.statusWithMessageWhich; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.hasItem; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import java.io.BufferedInputStream; import java.io.File; @@ -39,7 +40,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.zip.ZipInputStream; -import org.easymock.EasyMock; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; @@ -58,6 +58,7 @@ import org.eclipse.equinox.p2.metadata.IUpdateDescriptor; import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription; import org.eclipse.equinox.p2.metadata.Version; import org.eclipse.equinox.p2.metadata.VersionRange; +import org.eclipse.equinox.p2.metadata.expression.IMatchExpression; import org.eclipse.equinox.p2.publisher.AbstractPublisherApplication; import org.eclipse.equinox.p2.publisher.AdviceFileAdvice; import org.eclipse.equinox.p2.publisher.IPublisherInfo; @@ -78,6 +79,8 @@ import org.eclipse.equinox.p2.tests.TestActivator; import org.eclipse.equinox.p2.tests.TestData; import org.eclipse.equinox.p2.tests.publisher.TestArtifactRepository; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; public class BundlesActionTest extends ActionTest { private static final String OSGI = PublisherHelper.OSGI_BUNDLE_CLASSIFIER; @@ -141,39 +144,27 @@ public class BundlesActionTest extends ActionTest { private static final VersionRange TEST1_IU_D_VERSION_RANGE = VersionRange.create("1.3.0");//$NON-NLS-1$ protected TestArtifactRepository artifactRepository = new TestArtifactRepository(getAgent()); - - private MultiCapture<ITouchpointAdvice> tpAdvice1, tpAdvice2; - private MultiCapture<IUpdateDescriptorAdvice> udAdvice3; - private MultiCapture<ICapabilityAdvice> capAdvice5; - - @Override - public void setupPublisherInfo() { - tpAdvice1 = new MultiCapture<>(); - tpAdvice2 = new MultiCapture<>(); - - udAdvice3 = new MultiCapture<>(); - capAdvice5 = new MultiCapture<>(); - - super.setupPublisherInfo(); - } + private ArgumentCaptor<AdviceFileAdvice> updateDescriptorCapture; public void testAll() throws Exception { File[] files = TEST_BASE.listFiles(); - testAction = new BundlesAction(files); + testAction = Mockito.spy(new BundlesAction(files)); setupPublisherResult(); setupPublisherInfo(); artifactRepository.setProperty(AbstractPublisherApplication.PUBLISH_PACK_FILES_AS_SIBLINGS, "true");//$NON-NLS-1$ + updateDescriptorCapture = ArgumentCaptor.forClass(AdviceFileAdvice.class); + IStatus status = testAction.perform(publisherInfo, publisherResult, new NullProgressMonitor()); + verify(publisherInfo, Mockito.atLeastOnce()).addAdvice(updateDescriptorCapture.capture()); + assertEquals(Status.OK_STATUS, status); - assertEquals(Status.OK_STATUS, testAction.perform(publisherInfo, publisherResult, new NullProgressMonitor())); verifyBundlesAction(); cleanup(); - debug("Completed BundlesActionTest.");//$NON-NLS-1$ } public void testTranslationFragment() { File foo_fragment = new File(TestActivator.getTestDataFolder(), "FragmentPublisherTest/foo.fragment");//$NON-NLS-1$ File foo = new File(TestActivator.getTestDataFolder(), "FragmentPublisherTest/foo");//$NON-NLS-1$ - BundlesAction bundlesAction = new BundlesAction(new File[] {foo_fragment}); + BundlesAction bundlesAction = new BundlesAction(new File[] { foo_fragment }); PublisherInfo info = new PublisherInfo(); PublisherResult results = new PublisherResult(); @@ -183,7 +174,7 @@ public class BundlesActionTest extends ActionTest { info = new PublisherInfo(); results = new PublisherResult(); - bundlesAction = new BundlesAction(new File[] {foo}); + bundlesAction = new BundlesAction(new File[] { foo }); bundlesAction.perform(info, results, new NullProgressMonitor()); ius = results.getIUs(null, null); assertEquals(1, ius.size()); @@ -195,7 +186,7 @@ public class BundlesActionTest extends ActionTest { utils.setTranslationSource(queryableArray); assertEquals("English Foo", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME)); - bundlesAction = new BundlesAction(new File[] {foo_fragment}); + bundlesAction = new BundlesAction(new File[] { foo_fragment }); bundlesAction.perform(info, results, new NullProgressMonitor()); ius = results.getIUs(null, null); assertEquals(3, ius.size()); @@ -218,6 +209,7 @@ public class BundlesActionTest extends ActionTest { verifyArtifactRepository(); } + @SuppressWarnings("removal") private void verifyArtifactRepository() throws Exception { IArtifactKey key2 = ArtifactKey.parse("osgi.bundle,test2,1.0.0.qualifier");//$NON-NLS-1$ IArtifactDescriptor[] descriptors = artifactRepository.getArtifactDescriptors(key2); @@ -235,7 +227,8 @@ public class BundlesActionTest extends ActionTest { canonicalIdx = 0; } - try (ZipInputStream actual = artifactRepository.getZipInputStream(descriptors[canonicalIdx]); ZipInputStream expected = new ZipInputStream(new FileInputStream(TEST_FILE2))) { + try (ZipInputStream actual = artifactRepository.getZipInputStream(descriptors[canonicalIdx]); + ZipInputStream expected = new ZipInputStream(new FileInputStream(TEST_FILE2))) { TestData.assertEquals(expected, actual); } @@ -245,12 +238,14 @@ public class BundlesActionTest extends ActionTest { IArtifactKey key1 = ArtifactKey.parse("osgi.bundle,test1,0.1.0");//$NON-NLS-1$ ZipInputStream zis = artifactRepository.getZipInputStream(key1); - Map<String, Object[]> fileMap = getFileMap(new HashMap<>(), new File[] {TEST_FILE1}, new Path(TEST_FILE1.getAbsolutePath())); + Map<String, Object[]> fileMap = getFileMap(new HashMap<>(), new File[] { TEST_FILE1 }, + new Path(TEST_FILE1.getAbsolutePath())); TestData.assertContains(fileMap, zis, true); } private void verifyBundle1() { - List<IInstallableUnit> ius = new ArrayList<>(publisherResult.getIUs(TEST1_PROVBUNDLE_NAME, IPublisherResult.ROOT)); + List<IInstallableUnit> ius = new ArrayList<>( + publisherResult.getIUs(TEST1_PROVBUNDLE_NAME, IPublisherResult.ROOT)); assertEquals(1, ius.size()); IInstallableUnit bundle1IU = ius.get(0); @@ -269,25 +264,28 @@ public class BundlesActionTest extends ActionTest { verifyProvidedCapability(providedCapabilities, OSGI_IDENTITY, TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION); verifyProvidedCapability(providedCapabilities, OSGI, TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION); verifyProvidedCapability(providedCapabilities, TEST1_PROV_Z_NAMESPACE, TEST1_PROVZ_NAME, TEST2_PROVZ_VERSION); - verifyProvidedCapability(providedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "source", Version.create("1.0.0"));//$NON-NLS-1$//$NON-NLS-2$ + verifyProvidedCapability(providedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "source", //$NON-NLS-1$ + Version.create("1.0.0"));//$NON-NLS-1$ assertEquals(5, providedCapabilities.size()); - Collection<ITouchpointData> data = bundle1IU.getTouchpointData(); + List<AdviceFileAdvice> tData = updateDescriptorCapture.getAllValues(); boolean found = false; - for (ITouchpointData td : data) { - ITouchpointInstruction configure = td.getInstruction("configure"); - if (configure == null) - continue; - String body = configure.getBody(); - if (body != null && body.indexOf("download.eclipse.org/releases/ganymede") > 0) { - found = true; + for (AdviceFileAdvice iTouchpointAdvice : tData) { + ITouchpointInstruction configure = iTouchpointAdvice.getTouchpointData(NO_TP_DATA) + .getInstruction("configure"); + if (configure != null) { + String body = configure.getBody(); + if (body != null && body.indexOf("download.eclipse.org/releases/ganymede") > 0) { + found = true; + } } } assertTrue(found); } private void verifyBundle2() { - List<IInstallableUnit> ius = new ArrayList<>(publisherResult.getIUs(TEST2_PROV_BUNDLE_NAME, IPublisherResult.ROOT)); + List<IInstallableUnit> ius = new ArrayList<>( + publisherResult.getIUs(TEST2_PROV_BUNDLE_NAME, IPublisherResult.ROOT)); assertEquals(1, ius.size()); IInstallableUnit bundleIu = ius.get(0); @@ -304,14 +302,16 @@ public class BundlesActionTest extends ActionTest { // check provided capabilities Collection<IProvidedCapability> providedCapabilities = bundleIu.getProvidedCapabilities(); - verifyProvidedCapability(providedCapabilities, PROVBUNDLE_NAMESPACE, TEST2_PROV_BUNDLE_NAME, PROVBUNDLE2_VERSION); + verifyProvidedCapability(providedCapabilities, PROVBUNDLE_NAMESPACE, TEST2_PROV_BUNDLE_NAME, + PROVBUNDLE2_VERSION); verifyProvidedCapability(providedCapabilities, OSGI, TEST2_PROV_BUNDLE_NAME, BUNDLE2_VERSION); verifyProvidedCapability(providedCapabilities, OSGI_IDENTITY, TEST2_PROV_BUNDLE_NAME, BUNDLE2_VERSION); verifyProvidedCapability(providedCapabilities, TEST2_PROV_Z_NAMESPACE, TEST2_PROV_Z_NAME, TEST2_PROVZ_VERSION); verifyProvidedCapability(providedCapabilities, TEST2_PROV_Y_NAMESPACE, TEST2_PROV_Y_NAME, TEST2_PROVY_VERSION); verifyProvidedCapability(providedCapabilities, TEST2_PROV_X_NAMESPACE, TEST2_PROV_X_NAME, TEST2_PROVX_VERSION); - verifyProvidedCapability(providedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "bundle", Version.create("1.0.0"));//$NON-NLS-1$//$NON-NLS-2$ - assertEquals(7, providedCapabilities.size()); /*number of tested elements*/ + verifyProvidedCapability(providedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "bundle", //$NON-NLS-1$ + Version.create("1.0.0"));//$NON-NLS-1$ + assertEquals(7, providedCapabilities.size()); /* number of tested elements */ // check %bundle name is correct Map<String, String> prop = bundleIu.getProperties(); @@ -333,27 +333,41 @@ public class BundlesActionTest extends ActionTest { } private void verifyBundle3() { - // also a regression test for bug 393051: manifest headers use uncommon (but valid) capitalization - ArrayList<IInstallableUnit> ius = new ArrayList<>(publisherResult.getIUs(TEST3_PROV_BUNDLE_NAME, IPublisherResult.ROOT)); + // also a regression test for bug 393051: manifest headers use uncommon (but + // valid) capitalization + ArrayList<IInstallableUnit> ius = new ArrayList<>( + publisherResult.getIUs(TEST3_PROV_BUNDLE_NAME, IPublisherResult.ROOT)); assertEquals(1, ius.size()); - - IInstallableUnit bundleIu = ius.get(0); - - IUpdateDescriptor updateDescriptor = bundleIu.getUpdateDescriptor(); - String name = RequiredCapability.extractName(updateDescriptor.getIUsBeingUpdated().iterator().next()); + IUpdateDescriptor updateDescriptor = null; + boolean found = false; + for (AdviceFileAdvice advice : updateDescriptorCapture.getAllValues()) { + IUpdateDescriptor descriptor = advice.getUpdateDescriptor(new InstallableUnitDescription()); + if (descriptor != null) { + Collection<IMatchExpression<IInstallableUnit>> iUsBeingUpdated = descriptor.getIUsBeingUpdated(); + if (iUsBeingUpdated != null) { + String name = RequiredCapability.extractName(descriptor.getIUsBeingUpdated().iterator().next()); + if (TEST3_PROV_BUNDLE_NAME.equals(name)) { + updateDescriptor = descriptor; + found = true; + break; + } + } + } + } + assertTrue(found); VersionRange range = RequiredCapability.extractRange(updateDescriptor.getIUsBeingUpdated().iterator().next()); String description = updateDescriptor.getDescription(); int severity = updateDescriptor.getSeverity(); VersionRange expectedRange = new VersionRange("(0.0.1," + BUNDLE3_VERSION + "]"); - assertEquals(TEST3_PROV_BUNDLE_NAME, name); assertEquals(expectedRange, range); assertEquals("Some description about this update", description.trim()); assertEquals(8, severity); } private void verifyBundle4() { - ArrayList<IInstallableUnit> ius = new ArrayList<>(publisherResult.getIUs(TEST4_PROV_BUNDLE_NAME, IPublisherResult.ROOT)); + ArrayList<IInstallableUnit> ius = new ArrayList<>( + publisherResult.getIUs(TEST4_PROV_BUNDLE_NAME, IPublisherResult.ROOT)); assertEquals(1, ius.size()); IInstallableUnit bundleIu = ius.get(0); @@ -362,23 +376,29 @@ public class BundlesActionTest extends ActionTest { // check required capabilities Collection<IRequirement> requirements = bundleIu.getRequirements(); - verifyRequirement(requirements, JAVA_PACKAGE, TEST4_REQ_PACKAGE_OPTIONAL_NAME, DEFAULT_VERSION_RANGE, null, 0, 1, false); - verifyRequirement(requirements, JAVA_PACKAGE, TEST4_REQ_PACKAGE_OPTGREEDY_NAME, DEFAULT_VERSION_RANGE, null, 0, 1, true); + verifyRequirement(requirements, JAVA_PACKAGE, TEST4_REQ_PACKAGE_OPTIONAL_NAME, DEFAULT_VERSION_RANGE, null, 0, + 1, false); + verifyRequirement(requirements, JAVA_PACKAGE, TEST4_REQ_PACKAGE_OPTGREEDY_NAME, DEFAULT_VERSION_RANGE, null, 0, + 1, true); verifyRequirement(requirements, OSGI, TEST4_REQ_BUNDLE_OPTIONAL_NAME, DEFAULT_VERSION_RANGE, null, 0, 1, false); verifyRequirement(requirements, OSGI, TEST4_REQ_BUNDLE_OPTGREEDY_NAME, DEFAULT_VERSION_RANGE, null, 0, 1, true); assertEquals(4, requirements.size()); } private void verifyBundle5() { - ArrayList<IInstallableUnit> ius = new ArrayList<>(publisherResult.getIUs(TEST5_PROV_BUNDLE_NAME, IPublisherResult.ROOT)); + ArrayList<IInstallableUnit> ius = new ArrayList<>( + publisherResult.getIUs(TEST5_PROV_BUNDLE_NAME, IPublisherResult.ROOT)); assertEquals(1, ius.size()); IInstallableUnit bundle5IU = ius.get(0); - + for (AdviceFileAdvice adv : updateDescriptorCapture.getAllValues()) { + IRequirement[] reqs = adv.getRequiredCapabilities(new InstallableUnitDescription()); + if (reqs != null) { + verifyRequirement(List.of(reqs), "bar", "foo", VersionRange.emptyRange, null, 6, 7, true); + } + } Collection<IRequirement> requirements = bundle5IU.getRequirements(); verifyRequirement(requirements, OSGI_EE, TEST5_REQ_EE, null, 1, 1, true); - verifyRequirement(requirements, "bar", "foo", VersionRange.emptyRange, null, 6, 7, true); - assertEquals(2, requirements.size()); } @Override @@ -392,7 +412,8 @@ public class BundlesActionTest extends ActionTest { @Override protected void insertPublisherInfoBehavior() { - //super sets publisherInfo.getMetadataRepository and publisherInfo.getContextMetadataRepository + // super sets publisherInfo.getMetadataRepository and + // publisherInfo.getContextMetadataRepository super.insertPublisherInfoBehavior(); Map<String, String> sarProperties = new HashMap<>(); sarProperties.put("key1", "value1");//$NON-NLS-1$//$NON-NLS-2$ @@ -402,23 +423,21 @@ public class BundlesActionTest extends ActionTest { sdkProperties.put("key1", "value1");//$NON-NLS-1$//$NON-NLS-2$ sdkProperties.put("key2", "value2");//$NON-NLS-1$//$NON-NLS-2$ - expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes(); - expect(publisherInfo.getArtifactOptions()).andReturn(IPublisherInfo.A_INDEX | IPublisherInfo.A_OVERWRITE | IPublisherInfo.A_PUBLISH).anyTimes(); - expect(publisherInfo.getAdvice(null, false, null, null, ICapabilityAdvice.class)).andReturn(new ArrayList<>()).anyTimes(); + when(publisherInfo.getArtifactRepository()).thenReturn(artifactRepository); + when(publisherInfo.getArtifactOptions()) + .thenReturn(IPublisherInfo.A_INDEX | IPublisherInfo.A_OVERWRITE | IPublisherInfo.A_PUBLISH); + when(publisherInfo.getAdvice(null, false, null, null, ICapabilityAdvice.class)).thenReturn(new ArrayList<>()); expectOtherAdviceQueries(TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION); expectPropertyAdviceQuery(TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION, sarProperties); expectUpdateDescriptorAdviceQuery(TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION, null); - expectTouchpointAdviceQuery(TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION, tpAdvice1); expectOtherAdviceQueries(TEST2_PROV_BUNDLE_NAME, BUNDLE2_VERSION); expectPropertyAdviceQuery(TEST2_PROV_BUNDLE_NAME, BUNDLE2_VERSION, sdkProperties); expectUpdateDescriptorAdviceQuery(TEST2_PROV_BUNDLE_NAME, BUNDLE2_VERSION, null); - expectTouchpointAdviceQuery(TEST2_PROV_BUNDLE_NAME, BUNDLE2_VERSION, tpAdvice2); expectOtherAdviceQueries(TEST3_PROV_BUNDLE_NAME, BUNDLE3_VERSION); expectPropertyAdviceQuery(TEST3_PROV_BUNDLE_NAME, BUNDLE3_VERSION, sarProperties); - expectUpdateDescriptorAdviceQuery(TEST3_PROV_BUNDLE_NAME, BUNDLE3_VERSION, udAdvice3); expectTouchpointAdviceQuery(TEST3_PROV_BUNDLE_NAME, BUNDLE3_VERSION, null); expectOtherAdviceQueries(TEST4_PROV_BUNDLE_NAME, BUNDLE4_VERSION); @@ -426,49 +445,43 @@ public class BundlesActionTest extends ActionTest { expectUpdateDescriptorAdviceQuery(TEST4_PROV_BUNDLE_NAME, BUNDLE4_VERSION, null); expectTouchpointAdviceQuery(TEST4_PROV_BUNDLE_NAME, BUNDLE4_VERSION, null); - expectCapabilityAdviceQuery(TEST5_PROV_BUNDLE_NAME, BUNDLE5_VERSION, capAdvice5); +// expectCapabilityAdviceQuery(TEST5_PROV_BUNDLE_NAME, BUNDLE5_VERSION, capAdvice5.getValues()); expectOtherAdviceQueries(TEST5_PROV_BUNDLE_NAME, BUNDLE5_VERSION); expectPropertyAdviceQuery(TEST5_PROV_BUNDLE_NAME, BUNDLE5_VERSION, sarProperties); expectUpdateDescriptorAdviceQuery(TEST5_PROV_BUNDLE_NAME, BUNDLE5_VERSION, null); expectTouchpointAdviceQuery(TEST5_PROV_BUNDLE_NAME, BUNDLE5_VERSION, null); - //capture any touchpoint advice, and return the captured advice when the action asks for it - publisherInfo.addAdvice(and(AdviceMatcher.adviceMatches(TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION, ITouchpointAdvice.class), capture(tpAdvice1))); - EasyMock.expectLastCall().anyTimes(); - - publisherInfo.addAdvice(and(AdviceMatcher.adviceMatches(TEST2_PROV_BUNDLE_NAME, BUNDLE2_VERSION, ITouchpointAdvice.class), capture(tpAdvice2))); - EasyMock.expectLastCall().anyTimes(); - - publisherInfo.addAdvice(and(AdviceMatcher.adviceMatches(TEST3_PROV_BUNDLE_NAME, BUNDLE3_VERSION, AdviceFileAdvice.class), capture(udAdvice3))); - - publisherInfo.addAdvice(and(AdviceMatcher.adviceMatches(TEST5_PROV_BUNDLE_NAME, BUNDLE5_VERSION, AdviceFileAdvice.class), capture(capAdvice5))); - EasyMock.expectLastCall().anyTimes(); } private void expectOtherAdviceQueries(String bundleName, Version bundleVersion) { - expect(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, ICapabilityAdvice.class)) - .andReturn(Collections.emptyList()); - expect(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, IAdditionalInstallableUnitAdvice.class)) - .andReturn(Collections.emptyList()); - expect(publisherInfo.getAdvice(null, true, bundleName, bundleVersion, IBundleShapeAdvice.class)).andReturn(null); + when(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, ICapabilityAdvice.class)) + .thenReturn(Collections.emptyList()); + when(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, IAdditionalInstallableUnitAdvice.class)) + .thenReturn(Collections.emptyList()); + when(publisherInfo.getAdvice(null, true, bundleName, bundleVersion, IBundleShapeAdvice.class)).thenReturn(null); } - private void expectCapabilityAdviceQuery(String bundleName, Version bundleVersion, Collection<ICapabilityAdvice> answer) { - if (answer == null) - answer = Collections.emptyList(); - expect(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, ICapabilityAdvice.class)).andReturn(answer); - } +// private void expectCapabilityAdviceQuery(String bundleName, Version bundleVersion, +// Collection<ICapabilityAdvice> answer) { +// if (answer == null) +// answer = Collections.emptyList(); +// when(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, ICapabilityAdvice.class)) +// .thenReturn(answer); +// } - private void expectUpdateDescriptorAdviceQuery(String bundleName, Version bundleVersion, Collection<IUpdateDescriptorAdvice> answer) { + private void expectUpdateDescriptorAdviceQuery(String bundleName, Version bundleVersion, + Collection<IUpdateDescriptorAdvice> answer) { if (answer == null) answer = Collections.emptyList(); - expect(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, IUpdateDescriptorAdvice.class)).andReturn(answer); + when(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, IUpdateDescriptorAdvice.class)) + .thenReturn(answer); } - private void expectTouchpointAdviceQuery(String bundleName, Version bundleVersion, Collection<ITouchpointAdvice> answer) { + private void expectTouchpointAdviceQuery(String bundleName, Version bundleVersion, List<ITouchpointAdvice> answer) { if (answer == null) answer = Collections.emptyList(); - expect(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, ITouchpointAdvice.class)).andReturn(answer).anyTimes(); + when(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, ITouchpointAdvice.class)) + .thenReturn(answer); } private void expectPropertyAdviceQuery(String bundleName, Version bundleVersion, Map<String, String> answer) { @@ -477,20 +490,22 @@ public class BundlesActionTest extends ActionTest { propertyAdvices = Collections.singletonList(createPropertyAdvice(answer)); else propertyAdvices = Collections.emptyList(); - expect(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, IPropertyAdvice.class)).andReturn(propertyAdvices).times(2); + when(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, IPropertyAdvice.class)) + .thenReturn(propertyAdvices); } private IPropertyAdvice createPropertyAdvice(Map<String, String> properties) { - IPropertyAdvice mockAdvice = EasyMock.createMock(IPropertyAdvice.class); - expect(mockAdvice.getInstallableUnitProperties((InstallableUnitDescription) EasyMock.anyObject())).andReturn(null).anyTimes(); - expect(mockAdvice.getArtifactProperties((IInstallableUnit) EasyMock.anyObject(), (IArtifactDescriptor) EasyMock.anyObject())).andReturn(properties).anyTimes(); - EasyMock.replay(mockAdvice); + IPropertyAdvice mockAdvice = mock(IPropertyAdvice.class); + when(mockAdvice.getInstallableUnitProperties(any(InstallableUnitDescription.class))).thenReturn(null); + when(mockAdvice.getArtifactProperties(any(IInstallableUnit.class), any(IArtifactDescriptor.class))) + .thenReturn(properties); return mockAdvice; } public void testDynamicImport() throws Exception { File testData = getTestData("dymamicImport", "testData/dynamicImport"); - IInstallableUnit iu = BundlesAction.createBundleIU(BundlesAction.createBundleDescription(testData), null, new PublisherInfo()); + IInstallableUnit iu = BundlesAction.createBundleIU(BundlesAction.createBundleDescription(testData), null, + new PublisherInfo()); Collection<IRequirement> requirements = iu.getRequirements(); verifyRequirement(requirements, OSGI_EE, TESTDYN_REQ_EE, null, 1, 1, true); @@ -507,11 +522,13 @@ public class BundlesActionTest extends ActionTest { // overall status shall be error... assertThat(status, errorStatus()); List<IStatus> childStatuses = Arrays.asList(status.getChildren()); - assertThat(childStatuses, hasItem(statusWithMessageWhich(containsString("The manifest line \"foo\" is invalid; it has no colon ':' character after the header key.")))); + assertThat(childStatuses, hasItem(statusWithMessageWhich(containsString( + "The manifest line \"foo\" is invalid; it has no colon ':' character after the header key.")))); assertThat(childStatuses.size(), is(1)); // ... but the valid bundle must still be published - Collection<IInstallableUnit> ius = publisherResult.getIUs("org.eclipse.p2.test.validManifest", IPublisherResult.ROOT); + Collection<IInstallableUnit> ius = publisherResult.getIUs("org.eclipse.p2.test.validManifest", + IPublisherResult.ROOT); assertThat(ius.size(), is(1)); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/CaptureList.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/CaptureList.java deleted file mode 100644 index e317d621c..000000000 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/CaptureList.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2017 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.tests.publisher.actions; - -import java.util.AbstractList; -import org.easymock.Capture; - -/** - * An object that adapts an EasyMock Capture to a List. - */ -public class CaptureList<E> extends AbstractList<E> { - private Capture<E> capture; - - public CaptureList(Capture<E> capture) { - this.capture = capture; - } - - @Override - public E get(int arg0) { - return capture.getValue(); - } - - @Override - public int size() { - return capture.hasCaptured() ? 1 : 0; - } - -} diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java index 24b6997bb..99afa871c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java @@ -15,13 +15,17 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; -import static org.easymock.EasyMock.expect; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.matches; +import static org.mockito.Mockito.when; import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.easymock.EasyMock; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.metadata.InstallableUnit; import org.eclipse.equinox.internal.p2.publisher.eclipse.DataLoader; @@ -147,7 +151,8 @@ public class ConfigCUsActionTest extends ActionTest { ConfigAdvice configAdvice = new ConfigAdvice(configData, configSpec); ArrayList<IConfigAdvice> configList = new ArrayList<>(); configList.add(configAdvice); - expect(publisherInfo.getAdvice(EasyMock.matches(configSpec), EasyMock.eq(false), (String) EasyMock.anyObject(), (Version) EasyMock.anyObject(), EasyMock.eq(IConfigAdvice.class))).andReturn(configList).anyTimes(); + when(publisherInfo.getAdvice(matches(configSpec), eq(false), anyString(), any(Version.class), + eq(IConfigAdvice.class))).thenReturn(configList); //configure IExecutableAdvice LauncherData launcherData = loader.getLauncherData(); @@ -164,14 +169,15 @@ public class ConfigCUsActionTest extends ActionTest { // TODO Auto-generated catch block } - expect(publisherInfo.getAdvice(EasyMock.matches(configSpec), EasyMock.eq(false), (String) EasyMock.anyObject(), (Version) EasyMock.anyObject(), EasyMock.eq(IExecutableAdvice.class))).andReturn(launchingList).anyTimes(); + when(publisherInfo.getAdvice(matches(configSpec), eq(false), anyString(), any(Version.class), + eq(IExecutableAdvice.class))).thenReturn(launchingList); //setup metadata repository IInstallableUnit[] ius = {mockIU("foo", null), mockIU("bar", null)}; //$NON-NLS-1$ //$NON-NLS-2$ metadataRepo = new TestMetadataRepository(getAgent(), ius); - expect(publisherInfo.getMetadataRepository()).andReturn(metadataRepo).anyTimes(); - expect(publisherInfo.getContextMetadataRepository()).andReturn(null).anyTimes(); + when(publisherInfo.getMetadataRepository()).thenReturn(metadataRepo); + when(publisherInfo.getContextMetadataRepository()).thenReturn(null); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java index 41bf705a0..532bab05e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Code 9 and others. + * Copyright (c) 2008, 2021 Code 9 and others. * * This * program and the accompanying materials are made available under the terms of @@ -15,9 +15,11 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; -import static org.easymock.EasyMock.anyBoolean; -import static org.easymock.EasyMock.anyObject; -import static org.easymock.EasyMock.expect; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.nullable; +import static org.mockito.Mockito.when; import java.io.File; import java.io.FileInputStream; @@ -30,6 +32,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; import java.util.LinkedList; +import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.zip.ZipEntry; @@ -62,10 +65,9 @@ public class EquinoxExecutableActionTest extends ActionTest { private static final File LINUX_EXEC = new File(TestActivator.getTestDataFolder(), "EquinoxExecutableActionTest/linux/"); //$NON-NLS-1$ private static final File WIN_EXEC = new File(TestActivator.getTestDataFolder(), "EquinoxExecutableActionTest/win/"); //$NON-NLS-1$ private final String EXECUTABLE_NAME = "LauncherName"; //$NON-NLS-1$ - private Collection<IBrandingAdvice> brandingAdvice = new LinkedList<>(); private String macConfigCocoa = "cocoa.macosx.x86"; //$NON-NLS-1$ - private String winConfig = "win32.win32.x86"; //$NON-NLS-1$ - private String linuxConfig = "linux.gtk.x86"; //$NON-NLS-1$ + private String winConfig = "win32.win32.x86_64"; //$NON-NLS-1$ + private String linuxConfig = "linux.gtk.x86_64"; //$NON-NLS-1$ private ExecutablesDescriptor executablesDescriptor; private IArtifactRepository artifactRepository; private Version version = Version.create("1.2.3"); //$NON-NLS-1$ @@ -76,9 +78,6 @@ public class EquinoxExecutableActionTest extends ActionTest { public void setUp() throws Exception { setupPublisherInfo(); setupPublisherResult(); - } - - private void setupArtifactRepository() { artifactRepository = new TestArtifactRepository(getAgent()); } @@ -118,7 +117,10 @@ public class EquinoxExecutableActionTest extends ActionTest { private void testExecutableAction(String idBase, final String osArg, String config, File exec, File icon) { id = idBase; - setupBrandingAdvice(osArg, configSpec, exec, icon); + when(publisherInfo.getArtifactRepository()).thenReturn(artifactRepository); + when(publisherInfo.getArtifactOptions()).thenReturn(IPublisherInfo.A_PUBLISH); + when(publisherInfo.getAdvice(anyString(), anyBoolean(), nullable(String.class), nullable(Version.class), + eq(IBrandingAdvice.class))).then(invocation -> setupBrandingAdvice(osArg, icon)); executablesDescriptor = ExecutablesDescriptor.createDescriptor(osArg, "eclipse", exec); testAction = new EquinoxExecutableAction(executablesDescriptor, config, idBase, version, flavorArg); testAction.perform(publisherInfo, publisherResult, new NullProgressMonitor()); @@ -128,10 +130,10 @@ public class EquinoxExecutableActionTest extends ActionTest { private void verifyResults(String idBase, String confSpec) { ArrayList<IInstallableUnit> iuList = new ArrayList<>(publisherResult.getIUs(null, IPublisherResult.ROOT)); + assertEquals(3, iuList.size()); verifyEclipseIU(iuList, idBase, confSpec); verifyCU(iuList, idBase, confSpec); verifyExecIU(iuList, idBase, confSpec); - assertTrue(iuList.size() == 3); } private void verifyCU(ArrayList<IInstallableUnit> iuList, String idBase, String confSpec) { @@ -162,16 +164,16 @@ public class EquinoxExecutableActionTest extends ActionTest { private void verifyEclipseIU(ArrayList<IInstallableUnit> iuList, String idBase, String confSpec) { for (IInstallableUnit possibleEclipse : iuList) { if (possibleEclipse.getId().equals((idBase + ".executable." + confSpec + "." + EXECUTABLE_NAME))) { //$NON-NLS-1$//$NON-NLS-2$ - assertTrue(possibleEclipse.getVersion().equals(version)); + assertEquals(version, possibleEclipse.getVersion()); Collection<IProvidedCapability> providedCapability = possibleEclipse.getProvidedCapabilities(); verifyProvidedCapability(providedCapability, IInstallableUnit.NAMESPACE_IU_ID, idBase + ".executable." + confSpec + "." + EXECUTABLE_NAME, version); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(providedCapability.size() == 1); + assertEquals(1, providedCapability.size()); Collection<IRequirement> req = possibleEclipse.getRequirements(); - assertTrue(req.size() == 0); + assertEquals(0, req.size()); return;//pass } } - fail(); + fail("No executable installable unit."); } private void verifyExecIU(ArrayList<IInstallableUnit> iuList, String idBase, String confSpec) { @@ -274,15 +276,8 @@ public class EquinoxExecutableActionTest extends ActionTest { } } - @Override - protected void insertPublisherInfoBehavior() { - setupArtifactRepository(); - expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes(); - expect(publisherInfo.getArtifactOptions()).andReturn(IPublisherInfo.A_PUBLISH).anyTimes(); - expect(publisherInfo.getAdvice((String) anyObject(), anyBoolean(), (String) anyObject(), (Version) anyObject(), (Class<IBrandingAdvice>) anyObject())).andReturn(brandingAdvice); - } - - private void setupBrandingAdvice(final String osArg, final String config, final File exec, final File icon) { + private List<IBrandingAdvice> setupBrandingAdvice(final String osArg, final File icon) { + List<IBrandingAdvice> brandingAdvice = new LinkedList<>(); brandingAdvice.add(new IBrandingAdvice() { @Override public boolean isApplicable(String configSpec, boolean includeDefault, String id, Version version) { @@ -304,5 +299,6 @@ public class EquinoxExecutableActionTest extends ActionTest { return EXECUTABLE_NAME; } }); + return brandingAdvice; } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java index 95442d175..ff0b846fb 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java @@ -15,9 +15,8 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.Collection; @@ -56,13 +55,12 @@ public class EquinoxLauncherCUActionTest extends ActionTest { } protected IInstallableUnit mockIU(String id, Version version, boolean fragment) { - IInstallableUnit result = createMock(IInstallableUnit.class); - expect(result.getId()).andReturn(id).anyTimes(); + IInstallableUnit result = mock(IInstallableUnit.class); + when(result.getId()).thenReturn(id); if (version == null) version = Version.emptyVersion; - expect(result.getVersion()).andReturn(version).anyTimes(); - expect(result.getFilter()).andReturn(null).anyTimes(); - replay(result); + when(result.getVersion()).thenReturn(version); + when(result.getFilter()).thenReturn(null); return result; } @@ -108,7 +106,10 @@ public class EquinoxLauncherCUActionTest extends ActionTest { ArrayList<IVersionAdvice> versionList = new ArrayList<>(); versionList.add(versionAdvice); - expect(publisherInfo.getAdvice(null, true, EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER, null, IVersionAdvice.class)).andReturn(versionList); - expect(publisherInfo.getAdvice(configSpec, true, EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER + "." + configSpec, null, IVersionAdvice.class)).andReturn(versionList); //$NON-NLS-1$ + when(publisherInfo.getAdvice(null, true, EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER, null, + IVersionAdvice.class)).thenReturn(versionList); + when(publisherInfo.getAdvice(configSpec, true, + EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER + "." + configSpec, null, IVersionAdvice.class)) //$NON-NLS-1$ + .thenReturn(versionList); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java index a83f52b14..279660892 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java @@ -15,10 +15,10 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; -import static org.easymock.EasyMock.and; -import static org.easymock.EasyMock.capture; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.isA; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import java.io.File; import java.io.IOException; @@ -26,10 +26,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.zip.ZipInputStream; -import org.easymock.Capture; -import org.easymock.EasyMock; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; @@ -62,6 +61,8 @@ import org.eclipse.equinox.p2.tests.TestData; import org.eclipse.equinox.p2.tests.TestMetadataRepository; import org.eclipse.equinox.p2.tests.publisher.TestArtifactRepository; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; public class FeaturesActionTest extends ActionTest { @@ -75,12 +76,12 @@ public class FeaturesActionTest extends ActionTest { private Version barVersion = Version.create("1.1.1"); //$NON-NLS-1$ private String BAR = "bar"; //$NON-NLS-1$ private String FOO = "foo"; //$NON-NLS-1$ - private Capture<ITouchpointAdvice> tpAdvice; + private ArgumentCaptor<ITouchpointAdvice> capture = ArgumentCaptor.forClass(ITouchpointAdvice.class); @Override public void setUp() throws Exception { - testAction = new FeaturesAction(new File[] {root}); - tpAdvice = new Capture<>(); + super.setUp(); + testAction = Mockito.spy(new FeaturesAction(new File[] { root })); setupPublisherInfo(); setupPublisherResult(); } @@ -90,37 +91,41 @@ public class FeaturesActionTest extends ActionTest { */ public void testSimple() throws Exception { testAction.perform(publisherInfo, publisherResult, new NullProgressMonitor()); + verify(publisherInfo, Mockito.atLeastOnce()).addAdvice(capture.capture()); verifyRepositoryContents(); debug("Completed FeaturesAction."); //$NON-NLS-1$ } public void testFeaturePatch() throws Exception { File testFolder = getTestFolder("FeaturesAction.testFilters"); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append("<feature id=\"test.feature\" version=\"1.0.0\" > \n"); buffer.append(" <requires> \n"); - buffer.append(" <import feature=\"org.foo\" version=\"[1.0.0,2.0.0)\" match=\"versionRange\" patch=\"true\"/> \n"); + buffer.append( + " <import feature=\"org.foo\" version=\"[1.0.0,2.0.0)\" match=\"versionRange\" patch=\"true\"/> \n"); buffer.append(" </requires> \n"); buffer.append("</feature> \n"); File featureXML = new File(testFolder, "feature.xml"); writeBuffer(featureXML, buffer); publisherInfo = new PublisherInfo(); - FeaturesAction action = new FeaturesAction(new File[] {testFolder}); + FeaturesAction action = new FeaturesAction(new File[] { testFolder }); action.perform(publisherInfo, publisherResult, new NullProgressMonitor()); - IInstallableUnitPatch iu = (IInstallableUnitPatch) publisherResult.getIU("test.feature.feature.group", Version.parseVersion("1.0.0"), null); + IInstallableUnitPatch iu = (IInstallableUnitPatch) publisherResult.getIU("test.feature.feature.group", + Version.parseVersion("1.0.0"), null); IRequirement[][] applicabilityScope = iu.getApplicabilityScope(); assertEquals(1, applicabilityScope.length); IRequiredCapability require = (IRequiredCapability) applicabilityScope[0][0]; - IRequirement expected = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "org.foo.feature.group", VersionRange.create("[1.0.0, 2.0.0)"), null, false, false, true); + IRequirement expected = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, + "org.foo.feature.group", VersionRange.create("[1.0.0, 2.0.0)"), null, false, false, true); verifyRequirement(Collections.singleton(expected), require); } public void testMatchRange() throws Exception { File testFolder = getTestFolder("FeaturesAction.testFilters"); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append("<feature id=\"test.feature\" version=\"1.0.0\" > \n"); buffer.append(" <requires> \n"); buffer.append(" <import plugin=\"org.plug\" version=\"[1.0.0,2.0.0)\" match=\"versionRange\" /> \n"); @@ -131,7 +136,7 @@ public class FeaturesActionTest extends ActionTest { writeBuffer(featureXML, buffer); publisherInfo = new PublisherInfo(); - FeaturesAction action = new FeaturesAction(new File[] {testFolder}); + FeaturesAction action = new FeaturesAction(new File[] { testFolder }); action.perform(publisherInfo, publisherResult, new NullProgressMonitor()); IInstallableUnit iu = publisherResult.getIU("test.feature.feature.group", Version.parseVersion("1.0.0"), null); @@ -141,10 +146,12 @@ public class FeaturesActionTest extends ActionTest { String requireName = ((IRequiredCapability) require).getName(); if (requireName.equals("org.foo.feature.group")) { - IRequirement expected = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "org.foo.feature.group", VersionRange.create("[1.0.0, 2.0.0)"), null, false, false, true); + IRequirement expected = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, + "org.foo.feature.group", VersionRange.create("[1.0.0, 2.0.0)"), null, false, false, true); verifyRequirement(Collections.singleton(expected), require); } else if (requireName.equals("org.plug")) { - IRequirement expected = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "org.plug", VersionRange.create("[1.0.0, 2.0.0)"), null, false, false, true); + IRequirement expected = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "org.plug", + VersionRange.create("[1.0.0, 2.0.0)"), null, false, false, true); verifyRequirement(Collections.singleton(expected), require); } } @@ -152,7 +159,7 @@ public class FeaturesActionTest extends ActionTest { public void testMatchGreaterOrEqual() throws Exception { File testFolder = getTestFolder("FeaturesAction.testFilters"); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append("<feature id=\"test.feature\" version=\"1.0.0\" > \n"); buffer.append(" <requires> \n"); buffer.append(" <import plugin=\"org.plug\" version=\"1.0.0\" match=\"greaterOrEqual\" /> \n"); @@ -163,7 +170,7 @@ public class FeaturesActionTest extends ActionTest { writeBuffer(featureXML, buffer); publisherInfo = new PublisherInfo(); - FeaturesAction action = new FeaturesAction(new File[] {testFolder}); + FeaturesAction action = new FeaturesAction(new File[] { testFolder }); action.perform(publisherInfo, publisherResult, new NullProgressMonitor()); IInstallableUnit iu = publisherResult.getIU("test.feature.feature.group", Version.parseVersion("1.0.0"), null); @@ -173,10 +180,12 @@ public class FeaturesActionTest extends ActionTest { String requireName = ((IRequiredCapability) require).getName(); if (requireName.equals("org.foo.feature.group")) { - IRequirement expected = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "org.foo.feature.group", VersionRange.create("1.0.0"), null, false, false, true); + IRequirement expected = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, + "org.foo.feature.group", VersionRange.create("1.0.0"), null, false, false, true); verifyRequirement(Collections.singleton(expected), require); } else if (requireName.equals("org.plug")) { - IRequirement expected = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "org.plug", VersionRange.create("1.0.0"), null, false, false, true); + IRequirement expected = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "org.plug", + VersionRange.create("1.0.0"), null, false, false, true); verifyRequirement(Collections.singleton(expected), require); } } @@ -184,7 +193,7 @@ public class FeaturesActionTest extends ActionTest { public void testFilters() throws Exception { File testFolder = getTestFolder("FeaturesAction.testFilters"); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append("<feature id=\"test.feature\" version=\"1.0.0\" > \n"); buffer.append(" <includes id=\"org.foo\" version=\"1.0.0\" filter=\"(osgi.os=win32)\"/> \n"); buffer.append(" <plugin id=\"org.plug\" version=\"1.0.0\" filter=\"(my.prop=foo)\" os=\"win32\" /> \n"); @@ -197,7 +206,7 @@ public class FeaturesActionTest extends ActionTest { writeBuffer(featureXML, buffer); publisherInfo = new PublisherInfo(); - FeaturesAction action = new FeaturesAction(new File[] {testFolder}); + FeaturesAction action = new FeaturesAction(new File[] { testFolder }); action.perform(publisherInfo, publisherResult, new NullProgressMonitor()); IInstallableUnit iu = publisherResult.getIU("test.feature.feature.group", Version.parseVersion("1.0.0"), null); @@ -207,7 +216,8 @@ public class FeaturesActionTest extends ActionTest { if (((IRequiredCapability) require).getName().equals("org.foo.feature.group")) { assertEquals(ExpressionUtil.parseLDAP("(osgi.os=win32)"), require.getFilter().getParameters()[0]); } else if (((IRequiredCapability) require).getName().equals("org.plug")) { - assertEquals(ExpressionUtil.parseLDAP("(&(my.prop=foo)(osgi.os=win32))"), require.getFilter().getParameters()[0]); + assertEquals(ExpressionUtil.parseLDAP("(&(my.prop=foo)(osgi.os=win32))"), + require.getFilter().getParameters()[0]); } else if (((IRequiredCapability) require).getName().equals("org.plug2")) { assertEquals(ExpressionUtil.parseLDAP("(my.prop=foo)"), require.getFilter().getParameters()[0]); } else if (((IRequiredCapability) require).getName().equals("org.foo2.feature.group")) { @@ -222,151 +232,173 @@ public class FeaturesActionTest extends ActionTest { } private void verifyMetadata() { - //{foo.feature.jar=[foo.feature.jar 1.0.0], bar.feature.jar=[bar.feature.jar 1.1.1], foo.feature.group=[foo.feature.group 1.0.0], bar.feature.group=[bar.feature.group 1.1.1]} - ArrayList<IInstallableUnit> fooIUs = new ArrayList<>(publisherResult.getIUs("foo.feature.jar", IPublisherResult.NON_ROOT)); //$NON-NLS-1$ - assertTrue(fooIUs.size() == 1); + // {foo.feature.jar=[foo.feature.jar 1.0.0], bar.feature.jar=[bar.feature.jar + // 1.1.1], foo.feature.group=[foo.feature.group 1.0.0], + // bar.feature.group=[bar.feature.group 1.1.1]} + ArrayList<IInstallableUnit> fooIUs = new ArrayList<>( + publisherResult.getIUs("foo.feature.jar", IPublisherResult.NON_ROOT)); //$NON-NLS-1$ + assertEquals(1, fooIUs.size()); IInstallableUnit foo = fooIUs.get(0); assertTrue(foo.getId().equalsIgnoreCase("foo.feature.jar")); //$NON-NLS-1$ - assertTrue(foo.getVersion().equals(fooVersion)); + assertEquals(fooVersion, foo.getVersion()); assertEquals("Foo Feature", foo.getProperty(IInstallableUnit.PROP_NAME)); assertEquals("Foo Description", foo.getProperty(IInstallableUnit.PROP_DESCRIPTION)); assertEquals("Foo License", foo.getLicenses().iterator().next().getBody()); assertEquals("Foo Copyright", foo.getCopyright().getBody()); - assertTrue(foo.getProperty("key1").equals("value1")); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue(foo.getProperty("key2").equals("value2")); //$NON-NLS-1$//$NON-NLS-2$ - assertTrue(foo.getArtifacts().iterator().next().equals(FOO_KEY)); - assertEquals(foo.getFilter().getParameters()[0], ExpressionUtil.parseLDAP("(org.eclipse.update.install.features=true)")); //$NON-NLS-1$ + assertEquals("value1", foo.getProperty("key1")); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("value2", foo.getProperty("key2")); //$NON-NLS-1$//$NON-NLS-2$ + assertEquals(FOO_KEY, foo.getArtifacts().iterator().next()); + assertEquals(foo.getFilter().getParameters()[0], + ExpressionUtil.parseLDAP("(org.eclipse.update.install.features=true)")); //$NON-NLS-1$ - //check touchpointType + // check touchpointType assertTrue(foo.getTouchpointType().getId().equalsIgnoreCase("org.eclipse.equinox.p2.osgi")); //$NON-NLS-1$ - assertTrue(foo.getTouchpointType().getVersion().equals(fooVersion)); + assertEquals(fooVersion, foo.getTouchpointType().getVersion()); - //zipped=true + // zipped=true Collection<ITouchpointData> tpData = foo.getTouchpointData(); String fooValue = tpData.iterator().next().getInstructions().get("zipped").getBody(); //$NON-NLS-1$ assertTrue(fooValue.equalsIgnoreCase("true")); //$NON-NLS-1$ Collection<IRequirement> fooRequiredCapabilities = foo.getRequirements(); - assertTrue(fooRequiredCapabilities.size() == 0); + assertTrue(fooRequiredCapabilities.isEmpty()); Collection<IProvidedCapability> fooProvidedCapabilities = foo.getProvidedCapabilities(); - verifyProvidedCapability(fooProvidedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "foo.feature.jar", fooVersion); //$NON-NLS-1$ - verifyProvidedCapability(fooProvidedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "feature", fooVersion); //$NON-NLS-1$ + verifyProvidedCapability(fooProvidedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "foo.feature.jar", //$NON-NLS-1$ + fooVersion); + verifyProvidedCapability(fooProvidedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "feature", //$NON-NLS-1$ + fooVersion); verifyProvidedCapability(fooProvidedCapabilities, "org.eclipse.update.feature", FOO, fooVersion); //$NON-NLS-1$ - assertTrue(fooProvidedCapabilities.size() == 3); + assertEquals(3, fooProvidedCapabilities.size()); - //feature group IU for foo + // feature group IU for foo fooIUs = new ArrayList<>(publisherResult.getIUs("foo.feature.group", IPublisherResult.ROOT)); //$NON-NLS-1$ - assertTrue(fooIUs.size() == 1); + assertEquals(1, fooIUs.size()); IInstallableUnit fooGroup = fooIUs.get(0); - tpData = fooGroup.getTouchpointData(); - assertEquals(1, tpData.size()); - ITouchpointInstruction instruction = tpData.iterator().next().getInstruction("install"); + ITouchpointAdvice tData = capture.getValue(); + ITouchpointInstruction instruction = tData.getTouchpointData(NO_TP_DATA).getInstruction("install"); assertNotNull(instruction); - assertEquals("ln(targetDir:@artifact,linkTarget:foo/lib.1.so,linkName:lib.so);chmod(targetDir:@artifact,targetFile:lib/lib.so,permissions:755);", instruction.getBody()); + assertEquals( + "ln(targetDir:@artifact,linkTarget:foo/lib.1.so,linkName:lib.so);chmod(targetDir:@artifact,targetFile:lib/lib.so,permissions:755);", + instruction.getBody()); assertNull(fooGroup.getFilter()); - /*verify bar*/ - ArrayList<IInstallableUnit> barIUs = new ArrayList<>(publisherResult.getIUs("bar.feature.jar", IPublisherResult.NON_ROOT)); //$NON-NLS-1$ - assertTrue(barIUs.size() == 1); + /* verify bar */ + ArrayList<IInstallableUnit> barIUs = new ArrayList<>( + publisherResult.getIUs("bar.feature.jar", IPublisherResult.NON_ROOT)); //$NON-NLS-1$ + assertEquals(1, barIUs.size()); IInstallableUnit bar = barIUs.get(0); - assertTrue(bar.getId().equals("bar.feature.jar")); //$NON-NLS-1$ - assertTrue(bar.getVersion().equals(barVersion)); - assertTrue(bar.getProperty("key1").equals("value1")); //$NON-NLS-1$//$NON-NLS-2$ - assertTrue(bar.getProperty("key2").equals("value2")); //$NON-NLS-1$//$NON-NLS-2$ + assertEquals("bar.feature.jar", bar.getId()); //$NON-NLS-1$ + assertEquals(barVersion, bar.getVersion()); + assertEquals("value1", bar.getProperty("key1")); //$NON-NLS-1$//$NON-NLS-2$ + assertEquals("value2", bar.getProperty("key2")); //$NON-NLS-1$//$NON-NLS-2$ assertTrue(bar.getProperties().containsKey("org.eclipse.update.installHandler")); //$NON-NLS-1$ assertTrue(bar.getProperties().containsValue("handler=bar handler")); //$NON-NLS-1$ - assertTrue(bar.getArtifacts().iterator().next().equals(BAR_KEY)); - assertEquals(bar.getFilter().getParameters()[0], ExpressionUtil.parseLDAP("(org.eclipse.update.install.features=true)")); //$NON-NLS-1$ + assertEquals(BAR_KEY, bar.getArtifacts().iterator().next()); + assertEquals(bar.getFilter().getParameters()[0], + ExpressionUtil.parseLDAP("(org.eclipse.update.install.features=true)")); //$NON-NLS-1$ assertTrue(bar.isSingleton()); barIUs = new ArrayList<>(publisherResult.getIUs("bar.feature.group", IPublisherResult.ROOT)); //$NON-NLS-1$ - assertTrue(fooIUs.size() == 1); + assertEquals(1, fooIUs.size()); IInstallableUnit barGroup = barIUs.get(0); Collection<IRequirement> barRequiredCapabilities = barGroup.getRequirements(); - //contains(barRequiredCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "bar_root", new VersionRange(barVersion, true, barVersion, true), null, false /*multiple*/, false /*optional*/); //$NON-NLS-1$//$NON-NLS-2$ - verifyRequirement(barRequiredCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "bar.feature.jar", new VersionRange(barVersion, true, barVersion, true), "(org.eclipse.update.install.features=true)", 1, 1, true); //$NON-NLS-1$//$NON-NLS-2$ - verifyRequirement(barRequiredCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "org.bar.feature.feature.group", VersionRange.emptyRange, "(&(|(osgi.nl=de)(osgi.nl=en)(osgi.nl=fr)))", 1, 1, true); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals(barGroup.getFilter().getParameters()[0], ExpressionUtil.parseLDAP("(&(|(osgi.os=macosx)(osgi.os=win32))(|(osgi.ws=carbon)(osgi.ws=win32))(|(osgi.arch=ppc)(osgi.arch=x86))(osgi.nl=en))")); - - //check zipped=true in touchpointData + // contains(barRequiredCapabilities, IInstallableUnit.NAMESPACE_IU_ID, + // "bar_root", new VersionRange(barVersion, true, barVersion, true), null, false + // /*multiple*/, false /*optional*/); //$NON-NLS-1$//$NON-NLS-2$ + verifyRequirement(barRequiredCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "bar.feature.jar", //$NON-NLS-1$ + new VersionRange(barVersion, true, barVersion, true), "(org.eclipse.update.install.features=true)", 1, //$NON-NLS-1$ + 1, true); + verifyRequirement(barRequiredCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "org.bar.feature.feature.group", //$NON-NLS-1$ + VersionRange.emptyRange, "(&(|(osgi.nl=de)(osgi.nl=en)(osgi.nl=fr)))", 1, 1, true); //$NON-NLS-1$ + assertEquals(barGroup.getFilter().getParameters()[0], ExpressionUtil.parseLDAP( + "(&(|(osgi.os=macosx)(osgi.os=win32))(|(osgi.ws=carbon)(osgi.ws=win32))(|(osgi.arch=ppc)(osgi.arch=x86))(osgi.nl=en))")); + + // check zipped=true in touchpointData String barValue = bar.getTouchpointData().iterator().next().getInstructions().get("zipped").getBody(); //$NON-NLS-1$ assertTrue(barValue.equalsIgnoreCase("true")); //$NON-NLS-1$ - //check touchpointType + // check touchpointType assertTrue(bar.getTouchpointType().getId().equalsIgnoreCase("org.eclipse.equinox.p2.osgi")); //$NON-NLS-1$ - assertTrue(bar.getTouchpointType().getVersion().equals(fooVersion)); - //String namespace, String name, VersionRange range, String filter, boolean optional, boolean multiple, boolean greedy) + assertEquals(fooVersion, bar.getTouchpointType().getVersion()); + // String namespace, String name, VersionRange range, String filter, boolean + // optional, boolean multiple, boolean greedy) barRequiredCapabilities = bar.getRequirements(); - assertTrue(barRequiredCapabilities.size() == 0); + assertTrue(barRequiredCapabilities.isEmpty()); Collection<IProvidedCapability> barProvidedCapabilities = bar.getProvidedCapabilities(); - verifyProvidedCapability(barProvidedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "bar.feature.jar", barVersion); //$NON-NLS-1$ - verifyProvidedCapability(barProvidedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "feature", fooVersion); //$NON-NLS-1$ + verifyProvidedCapability(barProvidedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "bar.feature.jar", //$NON-NLS-1$ + barVersion); + verifyProvidedCapability(barProvidedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "feature", //$NON-NLS-1$ + fooVersion); verifyProvidedCapability(barProvidedCapabilities, "org.eclipse.update.feature", BAR, barVersion); //$NON-NLS-1$ - assertTrue(barProvidedCapabilities.size() == 3); + assertEquals(3, barProvidedCapabilities.size()); } private void verifyArtifacts() throws IOException { ZipInputStream actualStream = artifactRepository.getZipInputStream(FOO_KEY); - Map<String, Object[]> expected = getFileMap(new HashMap<>(), new File[] {new File(root, FOO)}, new Path(new File(root, FOO).getAbsolutePath())); + Map<String, Object[]> expected = getFileMap(new HashMap<>(), new File[] { new File(root, FOO) }, + new Path(new File(root, FOO).getAbsolutePath())); TestData.assertContains(expected, actualStream, true); - expected = getFileMap(new HashMap<>(), new File[] {new File(root, BAR)}, new Path(new File(root, BAR).getAbsolutePath())); + expected = getFileMap(new HashMap<>(), new File[] { new File(root, BAR) }, + new Path(new File(root, BAR).getAbsolutePath())); actualStream = artifactRepository.getZipInputStream(BAR_KEY); TestData.assertContains(expected, actualStream, true); } @Override protected void insertPublisherInfoBehavior() { - //setup metadataRepository with barIU - metadataRepository = new TestMetadataRepository(getAgent(), new IInstallableUnit[] {mockIU(BAR, null)}); - - ArrayList<IPropertyAdvice> adviceCollection = fillAdvice(new ArrayList<>()); - expect(publisherInfo.getAdvice(null, false, "bar.feature.jar", barVersion, IPropertyAdvice.class)).andReturn(adviceCollection).anyTimes(); - expect(publisherInfo.getAdvice(null, false, "bar", barVersion, IPropertyAdvice.class)).andReturn(adviceCollection).anyTimes(); - expect(publisherInfo.getAdvice(null, false, "bar", barVersion, IFeatureRootAdvice.class)) - .andReturn(Collections.emptyList()).anyTimes(); - expect(publisherInfo.getAdvice(null, false, "bar.feature.group", barVersion, IPropertyAdvice.class)).andReturn(adviceCollection).anyTimes(); - expect(publisherInfo.getAdvice(null, false, "bar.feature.group", barVersion, ITouchpointAdvice.class)) - .andReturn(Collections.emptyList()).anyTimes(); - expect(publisherInfo.getAdvice(null, false, "bar.feature.group", barVersion, ICapabilityAdvice.class)) - .andReturn(Collections.emptyList()).anyTimes(); - expect(publisherInfo.getAdvice(null, false, "bar.feature.group", barVersion, - IAdditionalInstallableUnitAdvice.class)).andReturn(Collections.emptyList()).anyTimes(); - expect(publisherInfo.getAdvice(null, false, "foo.feature.jar", fooVersion, IPropertyAdvice.class)).andReturn(adviceCollection).anyTimes(); - expect(publisherInfo.getAdvice(null, false, "bar.feature.group", barVersion, IUpdateDescriptorAdvice.class)) - .andReturn(Collections.emptyList()).anyTimes(); - expect(publisherInfo.getAdvice(null, false, "foo", fooVersion, IPropertyAdvice.class)).andReturn(adviceCollection).anyTimes(); - expect(publisherInfo.getAdvice(null, false, "foo", fooVersion, IFeatureRootAdvice.class)) - .andReturn(Collections.emptyList()).anyTimes(); - expect(publisherInfo.getAdvice(null, false, "foo.feature.group", fooVersion, IPropertyAdvice.class)).andReturn(adviceCollection).anyTimes(); - expect(publisherInfo.getAdvice(null, false, "foo.feature.group", fooVersion, ICapabilityAdvice.class)) - .andReturn(Collections.emptyList()).anyTimes(); - expect(publisherInfo.getAdvice(null, false, "foo.feature.group", fooVersion, - IAdditionalInstallableUnitAdvice.class)).andReturn(Collections.emptyList()).anyTimes(); - expect(publisherInfo.getAdvice(null, false, "foo.feature.group", fooVersion, IUpdateDescriptorAdvice.class)) - .andReturn(Collections.emptyList()).anyTimes(); - expect(publisherInfo.getArtifactOptions()).andReturn(IPublisherInfo.A_INDEX | IPublisherInfo.A_OVERWRITE | IPublisherInfo.A_PUBLISH).anyTimes(); - expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes(); - expect(publisherInfo.getMetadataRepository()).andReturn(metadataRepository).anyTimes(); - expect(publisherInfo.getContextMetadataRepository()).andReturn(null).anyTimes(); - - //capture any touchpoint advice, and return the captured advice when the action asks for it - publisherInfo.addAdvice(and(isA(ITouchpointAdvice.class), capture(tpAdvice))); - EasyMock.expectLastCall().anyTimes(); - expect(publisherInfo.getAdvice(null, false, "foo.feature.group", fooVersion, ITouchpointAdvice.class)).andReturn(new CaptureList<>(tpAdvice)).anyTimes(); + // setup metadataRepository with barIU + metadataRepository = new TestMetadataRepository(getAgent(), new IInstallableUnit[] { mockIU(BAR, null) }); + + List<IPropertyAdvice> adviceCollection = fillAdvice(new ArrayList<>()); + when(publisherInfo.getAdvice(null, false, "bar.feature.jar", barVersion, IPropertyAdvice.class)) + .thenReturn(adviceCollection); + when(publisherInfo.getAdvice(null, false, "bar", barVersion, IPropertyAdvice.class)) + .thenReturn(adviceCollection); + when(publisherInfo.getAdvice(null, false, "bar", barVersion, IFeatureRootAdvice.class)) + .thenReturn(Collections.emptyList()); + when(publisherInfo.getAdvice(null, false, "bar.feature.group", barVersion, IPropertyAdvice.class)) + .thenReturn(adviceCollection); + when(publisherInfo.getAdvice(null, false, "bar.feature.group", barVersion, ITouchpointAdvice.class)) + .thenReturn(Collections.emptyList()); + when(publisherInfo.getAdvice(null, false, "bar.feature.group", barVersion, ICapabilityAdvice.class)) + .thenReturn(Collections.emptyList()); + when(publisherInfo.getAdvice(null, false, "bar.feature.group", barVersion, + IAdditionalInstallableUnitAdvice.class)).thenReturn(Collections.emptyList()); + when(publisherInfo.getAdvice(null, false, "foo.feature.jar", fooVersion, IPropertyAdvice.class)) + .thenReturn(adviceCollection); + when(publisherInfo.getAdvice(null, false, "bar.feature.group", barVersion, IUpdateDescriptorAdvice.class)) + .thenReturn(Collections.emptyList()); + when(publisherInfo.getAdvice(null, false, "foo", fooVersion, IPropertyAdvice.class)) + .thenReturn(adviceCollection); + when(publisherInfo.getAdvice(null, false, "foo", fooVersion, IFeatureRootAdvice.class)) + .thenReturn(Collections.emptyList()); + when(publisherInfo.getAdvice(null, false, "foo.feature.group", fooVersion, IPropertyAdvice.class)) + .thenReturn(adviceCollection); + when(publisherInfo.getAdvice(null, false, "foo.feature.group", fooVersion, ICapabilityAdvice.class)) + .thenReturn(Collections.emptyList()); + when(publisherInfo.getAdvice(null, false, "foo.feature.group", fooVersion, + IAdditionalInstallableUnitAdvice.class)).thenReturn(Collections.emptyList()); + when(publisherInfo.getAdvice(null, false, "foo.feature.group", fooVersion, IUpdateDescriptorAdvice.class)) + .thenReturn(Collections.emptyList()); + when(publisherInfo.getArtifactOptions()) + .thenReturn(IPublisherInfo.A_INDEX | IPublisherInfo.A_OVERWRITE | IPublisherInfo.A_PUBLISH); + when(publisherInfo.getArtifactRepository()).thenReturn(artifactRepository); + when(publisherInfo.getMetadataRepository()).thenReturn(metadataRepository); + when(publisherInfo.getContextMetadataRepository()).thenReturn(null); } - private ArrayList<IPropertyAdvice> fillAdvice(ArrayList<IPropertyAdvice> adviceCollection) { + private List<IPropertyAdvice> fillAdvice(ArrayList<IPropertyAdvice> adviceCollection) { Map<String, String> prop = new HashMap<>(); prop.put("key1", "value1"); //$NON-NLS-1$//$NON-NLS-2$ prop.put("key2", "value2"); //$NON-NLS-1$//$NON-NLS-2$ - IPropertyAdvice propertyAdvice = EasyMock.createMock(IPropertyAdvice.class); - expect(propertyAdvice.getInstallableUnitProperties((InstallableUnitDescription) EasyMock.anyObject())).andReturn(prop).anyTimes(); - expect(propertyAdvice.getArtifactProperties((IInstallableUnit) EasyMock.anyObject(), (IArtifactDescriptor) EasyMock.anyObject())).andReturn(null).anyTimes(); - EasyMock.replay(propertyAdvice); + IPropertyAdvice propertyAdvice = mock(IPropertyAdvice.class); + when(propertyAdvice.getInstallableUnitProperties(any(InstallableUnitDescription.class))).thenReturn(prop); + when(propertyAdvice.getArtifactProperties(any(IInstallableUnit.class), any(IArtifactDescriptor.class))) + .thenReturn(null); adviceCollection.add(propertyAdvice); return adviceCollection; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java index 088b3bd9c..dc5719e14 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2018 Code 9 and others. + * Copyright (c) 2008, 2021 Code 9 and others. * * This * program and the accompanying materials are made available under the terms of @@ -16,15 +16,17 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; -import static org.easymock.EasyMock.expect; import static org.eclipse.equinox.p2.tests.publisher.actions.StatusMatchers.errorStatus; import static org.eclipse.equinox.p2.tests.publisher.actions.StatusMatchers.okStatus; import static org.eclipse.equinox.p2.tests.publisher.actions.StatusMatchers.statusWithMessageWhich; +import static org.hamcrest.CoreMatchers.anyOf; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.hasItem; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.greaterThan; +import static org.mockito.Mockito.when; import java.io.ByteArrayOutputStream; import java.io.File; @@ -57,7 +59,12 @@ import org.eclipse.equinox.p2.tests.TestData; import org.eclipse.equinox.p2.tests.TestMetadataRepository; import org.eclipse.equinox.p2.tests.publisher.TestArtifactRepository; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; +@RunWith(JUnit4.class) public class JREActionTest extends ActionTest { private File J14 = new File(TestActivator.getTestDataFolder(), "JREActionTest/1.4/"); //$NON-NLS-1$ @@ -70,12 +77,14 @@ public class JREActionTest extends ActionTest { protected TestMetadataRepository metadataRepository; @Override + @Before public void setUp() throws Exception { setupPublisherInfo(); setupPublisherResult(); } // TODO this name is misleading: the test doesn't test the real Java 1.4 JRE IU but a broken local copy of the 1.4 profile + @Test public void test14() throws Exception { performAction(new JREAction(J14)); @@ -85,6 +94,7 @@ public class JREActionTest extends ActionTest { verifyArtifactRepository(ArtifactKey.parse("binary,a.jre.j2se,1.4.0"), J14, "J2SE-1.4.profile"); //$NON-NLS-1$ //$NON-NLS-2$ } + @Test public void test15() throws Exception { performAction(new JREAction(J15)); @@ -94,6 +104,7 @@ public class JREActionTest extends ActionTest { verifyArtifactRepository(ArtifactKey.parse("binary,a.jre.j2se,1.5.0"), J15, "J2SE-1.5.profile"); //$NON-NLS-1$ //$NON-NLS-2$ } + @Test public void test16() throws Exception { performAction(new JREAction(J16)); @@ -103,6 +114,7 @@ public class JREActionTest extends ActionTest { verifyArtifactRepository(ArtifactKey.parse("binary,a.jre.javase,1.6.0"), J16, "JavaSE-1.6.profile"); //$NON-NLS-1$//$NON-NLS-2$ } + @Test public void testOSGiMin() throws Exception { performAction(new JREAction("OSGi/Minimum-1.2")); @@ -111,6 +123,7 @@ public class JREActionTest extends ActionTest { // verifyConfigIU("a.jre.osgi.minimum", jreVersion); // TODO config IU is not needed!? } + @Test public void testPackageVersionsFromJreFolder() throws Exception { performAction(new JREAction(jreWithPackageVersionsFolder)); @@ -121,6 +134,7 @@ public class JREActionTest extends ActionTest { verifyArtifactRepository(ArtifactKey.parse("binary,a.jre.test,1.0.0"), jreWithPackageVersionsFolder, "test-1.0.0.profile"); //$NON-NLS-1$//$NON-NLS-2$ } + @Test public void testPackageVersionsFromJavaProfile() throws Exception { // introduced for bug 334519: directly point to a profile file performAction(new JREAction(jreWithPackageVersionsProfile)); @@ -130,27 +144,22 @@ public class JREActionTest extends ActionTest { assertThat(providedCapabilities, hasItem(MetadataFactory.createProvidedCapability(PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, "my.package", Version.create("1.0.0")))); } + @Test public void testDefaultJavaProfile() throws Exception { performAction(new JREAction((String) null)); // these assertions need to be changed each time the default java profile, hardcoded in o.e.e.p2.publisher.actions.JREAction, is changed; - verifyMetadataIU("a.jre.javase", 226, 21, Version.parseVersion("9.0.0")); + verifyMetadataIU("a.jre.javase", 226, 23, Version.parseVersion("11.0.0")); // verifyConfigIU(DEFAULT_JRE_NAME, DEFAULT_JRE_VERSION); // TODO config IU is not needed!? } + @Test(expected = IllegalArgumentException.class) public void testNonExistingJreLocation() { File nonExistingProfile = new File(jreWithPackageVersionsFolder, "no.profile"); - try { - performAction(new JREAction(nonExistingProfile)); - fail("Expected failure when the JRE location does not exists."); - // TODO shouldn't this be an error status? - } catch (IllegalArgumentException e) { - // test is successful - } catch (Exception e) { - fail("Expected IllegalArgumentException when the JRE location does not exists, caught " + e.getClass().getName()); - } + performAction(new JREAction(nonExistingProfile)); } + @Test public void testOsgiEECapabilities() { // added for bug 388566 performAction(new JREAction("J2SE-1.5")); @@ -163,6 +172,7 @@ public class JREActionTest extends ActionTest { assertThat(capabilities, not(hasItem(createEECapability("J2SE", "1.5")))); } + @Test public void testSingleOsgiEECapability() { // contains a single version:Version attribute instead of the common version:List<Version> performAction(new JREAction("OSGi/Minimum-1.0")); @@ -172,6 +182,7 @@ public class JREActionTest extends ActionTest { assertThat(capabilities, hasItem(createEECapability("OSGi/Minimum", "1.0"))); } + @Test public void testInvalidOsgiEECapabilitySpec() { testAction = new JREAction(new File(TestActivator.getTestDataFolder(), "JREActionTest/invalidOsgiEE/ee-capability-syntax-test.profile")); IStatus status = testAction.perform(publisherInfo, publisherResult, new NullProgressMonitor()); @@ -184,7 +195,7 @@ public class JREActionTest extends ActionTest { assertThat(Arrays.asList(eeStatus.getChildren()), hasItem(statusWithMessageWhich(containsString("Syntax error in version '1.a.invalidversion'")))); assertThat(Arrays.asList(eeStatus.getChildren()), hasItem(statusWithMessageWhich(containsString("Ignoring unknown capability namespace 'other.namespace'")))); assertThat(Arrays.asList(eeStatus.getChildren()), hasItem(statusWithMessageWhich(containsString("Cannot specify both 'version:Version' and 'version:List<Version>'")))); - assertThat(eeStatus.getChildren().length, is(5)); + assertEquals(5, eeStatus.getChildren().length); } private void performAction(JREAction jreAction) { @@ -196,34 +207,37 @@ public class JREActionTest extends ActionTest { IInstallableUnit foo = getPublishedUnit(id); // check version - assertTrue(foo.getVersion().equals(jreVersion)); + assertEquals(jreVersion, foo.getVersion()); // check touchpointType assertTrue(foo.getTouchpointType().getId().equalsIgnoreCase("org.eclipse.equinox.p2.native")); //$NON-NLS-1$ - assertTrue(foo.getTouchpointType().getVersion().equals(Version.create("1.0.0"))); //$NON-NLS-1$ + assertEquals(Version.create("1.0.0"), foo.getTouchpointType().getVersion()); //$NON-NLS-1$ // check provided capabilities Collection<IProvidedCapability> fooProvidedCapabilities = foo.getProvidedCapabilities(); - assertThat(fooProvidedCapabilities.size(), is(1 + expectedProvidedPackages + expectedProvidedEEs)); + int expected = expectedProvidedPackages + expectedProvidedEEs; + assertThat(fooProvidedCapabilities.size(), anyOf(is(expected), greaterThan(expected))); } private void verifyConfigIU(String id, Version jreVersion) { IInstallableUnit bar = getPublishedUnit("config." + id); Map<?, ?> instructions = bar.getTouchpointData().iterator().next().getInstructions(); - assertTrue(((ITouchpointInstruction) instructions.get("install")).getBody().equals("unzip(source:@artifact, target:${installFolder});")); //$NON-NLS-1$//$NON-NLS-2$ - assertTrue(((ITouchpointInstruction) instructions.get("uninstall")).getBody().equals("cleanupzip(source:@artifact, target:${installFolder});")); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("unzip(source:@artifact, target:${installFolder});", //$NON-NLS-1$ + ((ITouchpointInstruction) instructions.get("install")).getBody()); //$NON-NLS-1$ + assertEquals("cleanupzip(source:@artifact, target:${installFolder});", //$NON-NLS-1$ + ((ITouchpointInstruction) instructions.get("uninstall")).getBody()); //$NON-NLS-1$ assertTrue(bar instanceof IInstallableUnitFragment); Collection<IRequirement> requiredCapability = ((IInstallableUnitFragment) bar).getHost(); verifyRequirement(requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, id, new VersionRange(jreVersion, true, Version.MAX_VERSION, true)); - assertTrue(requiredCapability.size() == 1); + assertEquals(1, requiredCapability.size()); Collection<IProvidedCapability> providedCapability = bar.getProvidedCapabilities(); verifyProvidedCapability(providedCapability, IInstallableUnit.NAMESPACE_IU_ID, "config." + id, jreVersion); //$NON-NLS-1$ - assertTrue(providedCapability.size() == 1); + assertEquals(1, providedCapability.size()); - assertTrue(bar.getProperty("org.eclipse.equinox.p2.type.fragment").equals("true")); //$NON-NLS-1$//$NON-NLS-2$ - assertTrue(bar.getVersion().equals(jreVersion)); + assertEquals("true", bar.getProperty("org.eclipse.equinox.p2.type.fragment")); //$NON-NLS-1$//$NON-NLS-2$ + assertEquals(jreVersion, bar.getVersion()); } private void verifyArtifactRepository(IArtifactKey key, File JRELocation, final String fileName) throws IOException { @@ -241,13 +255,13 @@ public class JREActionTest extends ActionTest { private IInstallableUnit getPublishedUnit(String id) { Collection<IInstallableUnit> units = publisherResult.getIUs(id, IPublisherResult.ROOT); - assertThat(units.size(), is(1)); + assertEquals(1, units.size()); return units.iterator().next(); } private Collection<IProvidedCapability> getPublishedCapabilitiesOf(String id) { Collection<IInstallableUnit> ius = publisherResult.getIUs(id, IPublisherResult.ROOT); - assertThat(ius.size(), is(1)); + assertEquals(1, ius.size()); IInstallableUnit iu = ius.iterator().next(); return iu.getProvidedCapabilities(); } @@ -262,7 +276,7 @@ public class JREActionTest extends ActionTest { @Override protected void insertPublisherInfoBehavior() { - expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes(); - expect(publisherInfo.getArtifactOptions()).andReturn(IPublisherInfo.A_PUBLISH).anyTimes(); + when(publisherInfo.getArtifactRepository()).thenReturn(artifactRepository); + when(publisherInfo.getArtifactOptions()).thenReturn(IPublisherInfo.A_PUBLISH); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java index 706760c4e..53d5f03b8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java @@ -14,9 +14,11 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; -import static org.easymock.EasyMock.anyBoolean; -import static org.easymock.EasyMock.anyObject; -import static org.easymock.EasyMock.expect; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.when; import java.io.File; import java.util.Collection; @@ -29,7 +31,6 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.ITouchpointData; import org.eclipse.equinox.p2.metadata.ITouchpointInstruction; import org.eclipse.equinox.p2.metadata.Version; -import org.eclipse.equinox.p2.publisher.IPublisherAdvice; import org.eclipse.equinox.p2.publisher.IPublisherInfo; import org.eclipse.equinox.p2.tests.TestData; import org.eclipse.equinox.p2.tests.publisher.TestArtifactRepository; @@ -48,10 +49,11 @@ public class LocalUpdateSiteActionTest extends ActionTest { @Override protected void insertPublisherInfoBehavior() { super.insertPublisherInfoBehavior(); - expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes(); - expect(publisherInfo.getArtifactOptions()).andReturn(IPublisherInfo.A_INDEX | IPublisherInfo.A_OVERWRITE | IPublisherInfo.A_PUBLISH).anyTimes(); - expect(publisherInfo.getAdvice((String) anyObject(), anyBoolean(), (String) anyObject(), (Version) anyObject(), - (Class<IPublisherAdvice>) anyObject())).andReturn(Collections.emptyList()).anyTimes(); + when(publisherInfo.getArtifactRepository()).thenReturn(artifactRepository); + when(publisherInfo.getArtifactOptions()) + .thenReturn(IPublisherInfo.A_INDEX | IPublisherInfo.A_OVERWRITE | IPublisherInfo.A_PUBLISH); + when(publisherInfo.getAdvice(anyString(), anyBoolean(), anyString(), any(Version.class), any(Class.class))) + .thenReturn(Collections.emptyList()); } /** diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MultiCapture.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MultiCapture.java deleted file mode 100644 index 3f9d8133d..000000000 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MultiCapture.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2017 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.tests.publisher.actions; - -import java.util.*; -import org.easymock.Capture; - -/** - * A capture that captures multiple values - */ -public class MultiCapture<T> extends Capture<T> implements Collection<T> { - private static final long serialVersionUID = 1L; - private final List<T> captured = new ArrayList<>(); - - @Override - public boolean add(T arg0) { - return captured.add(arg0); - } - - @Override - public boolean addAll(Collection<? extends T> arg0) { - return captured.addAll(arg0); - } - - @Override - public void clear() { - captured.clear(); - } - - @Override - public boolean contains(Object arg0) { - return captured.contains(arg0); - } - - @Override - public boolean containsAll(Collection<?> arg0) { - return captured.containsAll(arg0); - } - - @Override - public boolean isEmpty() { - return captured.isEmpty(); - } - - @Override - public Iterator<T> iterator() { - return captured.iterator(); - } - - @Override - public boolean remove(Object arg0) { - return captured.remove(arg0); - } - - @Override - public boolean removeAll(Collection<?> arg0) { - return captured.removeAll(arg0); - } - - @Override - public boolean retainAll(Collection<?> arg0) { - return captured.retainAll(arg0); - } - - @Override - public void setValue(T value) { - captured.add(value); - super.setValue(value); - } - - @Override - public int size() { - return captured.size(); - } - - @Override - public Object[] toArray() { - return captured.toArray(); - } - - @Override - public <X> X[] toArray(X[] arg0) { - return captured.toArray(arg0); - } -} diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java index ffddce266..898c5f0fb 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java @@ -16,65 +16,35 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; -import static org.easymock.EasyMock.anyBoolean; -import static org.easymock.EasyMock.anyObject; -import static org.easymock.EasyMock.createNiceMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.expectLastCall; import static org.eclipse.equinox.p2.tests.publisher.actions.StatusMatchers.okStatus; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.mockito.Mockito.verify; import java.io.File; -import java.util.Collections; -import org.easymock.Capture; -import org.easymock.EasyMock; +import java.util.stream.Collectors; import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.frameworkadmin.BundleInfo; import org.eclipse.equinox.internal.p2.publisher.eclipse.ProductFile; -import org.eclipse.equinox.p2.metadata.Version; import org.eclipse.equinox.p2.publisher.IPublisherAdvice; -import org.eclipse.equinox.p2.publisher.IPublisherInfo; -import org.eclipse.equinox.p2.publisher.actions.RootIUAdvice; import org.eclipse.equinox.p2.publisher.eclipse.IConfigAdvice; import org.eclipse.equinox.p2.publisher.eclipse.IExecutableAdvice; import org.eclipse.equinox.p2.publisher.eclipse.ProductAction; import org.eclipse.equinox.p2.publisher.eclipse.ProductFileAdvice; import org.eclipse.equinox.p2.tests.TestData; import org.eclipse.equinox.p2.tests.publisher.TestArtifactRepository; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; public class ProductActionCapturingTest extends ActionTest { File executablesFeatureLocation = null; String source = ""; - private Capture<RootIUAdvice> rootIUAdviceCapture; - private Capture<ProductFileAdvice> productFileAdviceCapture; protected TestArtifactRepository artifactRepository = new TestArtifactRepository(getAgent()); @Override - protected IPublisherInfo createPublisherInfoMock() { - //override to create a nice mock, because we don't care about other method calls. - return createNiceMock(IPublisherInfo.class); - } - - @Override - protected void insertPublisherInfoBehavior() { - // capture these calls for assertions - publisherInfo.addAdvice(EasyMock.and(EasyMock.isA(RootIUAdvice.class), EasyMock.capture(rootIUAdviceCapture))); - publisherInfo.addAdvice(EasyMock.and(EasyMock.isA(ProductFileAdvice.class), EasyMock.capture(productFileAdviceCapture))); - - expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes(); - expect(publisherInfo.getArtifactOptions()).andReturn(IPublisherInfo.A_PUBLISH).anyTimes(); - //Return an empty list every time getAdvice is called - expect(publisherInfo.getAdvice((String) anyObject(), anyBoolean(), (String) anyObject(), (Version) anyObject(), (Class<IPublisherAdvice>) anyObject())).andReturn(Collections.emptyList()); - expectLastCall().anyTimes(); - } - - @Override public void setUp() throws Exception { - rootIUAdviceCapture = new Capture<>(); - productFileAdviceCapture = new Capture<>(); setupPublisherInfo(); setupPublisherResult(); } @@ -84,15 +54,18 @@ public class ProductActionCapturingTest extends ActionTest { * IConfigAdvice (start levels, auto-start). */ public void testSetBundleConfigData() throws Exception { + ArgumentCaptor<IPublisherAdvice> productFileAdviceCapture = ArgumentCaptor.forClass(IPublisherAdvice.class); addContextIU("org.eclipse.rcp.feature.group", "3.5.0.v20081110-9C9tEvNEla71LZ2jFz-RFB-t"); ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "startLevel.product").toString()); - testAction = new ProductAction(source, productFile, flavorArg, executablesFeatureLocation); + testAction = Mockito.spy(new ProductAction(source, productFile, flavorArg, executablesFeatureLocation)); IStatus status = testAction.perform(publisherInfo, publisherResult, null); + verify(publisherInfo, Mockito.atLeastOnce()).addAdvice(productFileAdviceCapture.capture()); assertThat(status, is(okStatus())); - IConfigAdvice configAdvice = productFileAdviceCapture.getValue(); + IConfigAdvice configAdvice = (IConfigAdvice) productFileAdviceCapture.getAllValues().stream() + .filter(IConfigAdvice.class::isInstance).collect(Collectors.toList()).get(0); BundleInfo[] bundles = configAdvice.getBundles(); assertEquals("1.0", 2, bundles.length); assertEquals("1.1", "org.eclipse.equinox.common", bundles[0].getSymbolicName()); @@ -110,14 +83,17 @@ public class ProductActionCapturingTest extends ActionTest { * Tests that correct advice is created for the org.eclipse.platform product. */ public void testPlatformProduct() throws Exception { + ArgumentCaptor<IPublisherAdvice> productFileAdviceCapture = ArgumentCaptor.forClass(IPublisherAdvice.class); ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "platform.product").toString()); addContextIU("org.eclipse.platform.feature.group", "1.2.3"); - testAction = new ProductAction(source, productFile, flavorArg, executablesFeatureLocation); + testAction = Mockito.spy(new ProductAction(source, productFile, flavorArg, executablesFeatureLocation)); IStatus status = testAction.perform(publisherInfo, publisherResult, null); + verify(publisherInfo, Mockito.atLeastOnce()).addAdvice(productFileAdviceCapture.capture()); assertThat(status, is(okStatus())); - IExecutableAdvice launchAdvice = productFileAdviceCapture.getValue(); + IExecutableAdvice launchAdvice = (IExecutableAdvice) productFileAdviceCapture.getAllValues().stream() + .filter(ProductFileAdvice.class::isInstance).collect(Collectors.toList()).get(0); assertEquals("1.0", "eclipse", launchAdvice.getExecutableName()); String[] programArgs = launchAdvice.getProgramArguments(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java index 3405c53e5..994cfafcd 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java @@ -16,7 +16,6 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; -import static org.easymock.EasyMock.createNiceMock; import static org.eclipse.equinox.p2.tests.publisher.actions.StatusMatchers.errorStatus; import static org.eclipse.equinox.p2.tests.publisher.actions.StatusMatchers.okStatus; import static org.eclipse.equinox.p2.tests.publisher.actions.StatusMatchers.statusWithMessageWhich; @@ -71,21 +70,18 @@ public class ProductActionTest extends ActionTest { String source = ""; protected TestArtifactRepository artifactRepository = new TestArtifactRepository(getAgent()); - @Override protected IPublisherInfo createPublisherInfoMock() { - //override to create a nice mock, because we don't care about other method calls. - return createNiceMock(IPublisherInfo.class); - } - - @Override public void setUp() throws Exception { + @Override + public void setUp() throws Exception { setupPublisherInfo(); setupPublisherResult(); } - @Override public void setupPublisherInfo() { + @Override + public void setupPublisherInfo() { PublisherInfo publisherInfoImpl = new PublisherInfo(); publisherInfoImpl.setArtifactRepository(artifactRepository); publisherInfoImpl.setArtifactOptions(IPublisherInfo.A_PUBLISH); - publisherInfoImpl.setConfigurations(new String[] {configSpec}); + publisherInfoImpl.setConfigurations(new String[] { configSpec }); publisherInfo = publisherInfoImpl; } @@ -95,18 +91,20 @@ public class ProductActionTest extends ActionTest { * splash screen, icon, etc. */ public void testBrandedApplication() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "brandedProduct/branded.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "brandedProduct/branded.product").toString()); addContextIU("org.eclipse.platform.feature.group", "1.2.3"); performProductAction(productFile); Collection<IInstallableUnit> ius = publisherResult.getIUs("branded.product", IPublisherResult.NON_ROOT); assertEquals("1.0", 1, ius.size()); - //TODO assert branding was done correctly + // TODO assert branding was done correctly } public void testLicense() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "productWithLicense.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "productWithLicense.product").toString()); performProductAction(productFile); Collection<IInstallableUnit> ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT); assertEquals("1.0", 1, ius.size()); @@ -116,7 +114,8 @@ public class ProductActionTest extends ActionTest { } public void testLicenseNoURL() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "licenseNoURL.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "licenseNoURL.product").toString()); performProductAction(productFile); Collection<IInstallableUnit> ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT); assertEquals("1.0", 1, ius.size()); @@ -126,7 +125,8 @@ public class ProductActionTest extends ActionTest { } public void testLicenseNoText() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "licenseNoText.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "licenseNoText.product").toString()); performProductAction(productFile); Collection<IInstallableUnit> ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT); assertEquals("1.0", 1, ius.size()); @@ -136,7 +136,8 @@ public class ProductActionTest extends ActionTest { } public void testMissingLicense() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "productWithNoLicense.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "productWithNoLicense.product").toString()); performProductAction(productFile); Collection<IInstallableUnit> ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT); assertEquals("1.0", 1, ius.size()); @@ -145,8 +146,10 @@ public class ProductActionTest extends ActionTest { } public void testMultiProductPublishing() throws Exception { - ProductFile productFile1 = new ProductFile(TestData.getFile("ProductActionTest", "boundedVersionConfigurations.product").toString()); - ProductFile productFile2 = new ProductFile(TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); + ProductFile productFile1 = new ProductFile( + TestData.getFile("ProductActionTest", "boundedVersionConfigurations.product").toString()); + ProductFile productFile2 = new ProductFile( + TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); addContextIU("org.eclipse.core.runtime", "4.0.0"); performProductAction(productFile1); @@ -158,7 +161,8 @@ public class ProductActionTest extends ActionTest { } public void testMultiPlatformCUs_DifferentPlatforms() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); setConfiguration(LINUX_CONFIG_SPEC); addContextIU("org.eclipse.core.runtime", "0.0.0", WIN_FILTER); @@ -169,7 +173,8 @@ public class ProductActionTest extends ActionTest { } public void testMultiPlatformCUs_SamePlatforms() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); setConfiguration(LINUX_CONFIG_SPEC); addContextIU("org.eclipse.core.runtime", "0.0.0", LINUX_FILTER); @@ -180,7 +185,8 @@ public class ProductActionTest extends ActionTest { } public void testMultiPlatformCUs_SamePlatforms_NoVersion() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); setConfiguration(LINUX_CONFIG_SPEC); addContextIU("org.eclipse.core.runtime", null, LINUX_FILTER); @@ -191,11 +197,13 @@ public class ProductActionTest extends ActionTest { } public void testMultiPlatformCUs_SamePlatforms_BoundedVersions() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); setConfiguration(LINUX_CONFIG_SPEC); - // Set a specific version number, the one in the .product file uses 0.0.0. Let's see if it binds properly - //filter is different from linuxConfigSpec, but will still match + // Set a specific version number, the one in the .product file uses 0.0.0. Let's + // see if it binds properly + // filter is different from linuxConfigSpec, but will still match addContextIU("org.eclipse.core.runtime", "4.0.0", "(osgi.os=linux)"); performProductAction(productFile); @@ -205,36 +213,45 @@ public class ProductActionTest extends ActionTest { } public void testCUsHost() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); setConfiguration(LINUX_CONFIG_SPEC); - // Set a specific version number, the one in the .product file uses 0.0.0. Let's see if it binds properly - //filter is different from linuxConfigSpec, but will still match + // Set a specific version number, the one in the .product file uses 0.0.0. Let's + // see if it binds properly + // filter is different from linuxConfigSpec, but will still match addContextIU("org.eclipse.core.runtime", "4.0.0", "(osgi.os=linux)"); performProductAction(productFile); - IInstallableUnitFragment fragment = (IInstallableUnitFragment) getUniquePublishedIU(flavorArg + LINUX_CONFIG_SPEC + "org.eclipse.core.runtime"); - assertEquals("1.1", "org.eclipse.core.runtime", RequiredCapability.extractName(fragment.getHost().iterator().next().getMatches())); - assertEquals("1.2", Version.create("4.0.0"), RequiredCapability.extractRange(fragment.getHost().iterator().next().getMatches()).getMinimum()); + IInstallableUnitFragment fragment = (IInstallableUnitFragment) getUniquePublishedIU( + flavorArg + LINUX_CONFIG_SPEC + "org.eclipse.core.runtime"); + assertEquals("1.1", "org.eclipse.core.runtime", + RequiredCapability.extractName(fragment.getHost().iterator().next().getMatches())); + assertEquals("1.2", Version.create("4.0.0"), + RequiredCapability.extractRange(fragment.getHost().iterator().next().getMatches()).getMinimum()); assertEquals("1.3", Version.create("1.0.0"), fragment.getVersion()); } public void testMultiConfigspecProductPublishing() throws IOException, Exception { ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "platform.product").toString()); - ((PublisherInfo) publisherInfo).setConfigurations(new String[] {"carbon.macos.x86", "cocoa.macos.x86"}); + ((PublisherInfo) publisherInfo).setConfigurations(new String[] { "carbon.macos.x86", "cocoa.macos.x86" }); addContextIU("org.eclipse.platform.feature.group", "1.2.3"); performProductAction(productFile); - Collection<IConfigAdvice> advice = publisherInfo.getAdvice("carbon.macos.x86", false, null, null, IConfigAdvice.class); + Collection<IConfigAdvice> advice = publisherInfo.getAdvice("carbon.macos.x86", false, null, null, + IConfigAdvice.class); assertEquals("1.0", 1, advice.size()); } public void testANYConfigSpecPublishing_GeneralBundle() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); - String configSpecANY = AbstractPublisherAction.createConfigSpec("ANY", "ANY", "ANY"); // configuration spec to create CUs without filters + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); + String configSpecANY = AbstractPublisherAction.createConfigSpec("ANY", "ANY", "ANY"); // configuration spec to + // create CUs without + // filters setConfiguration(configSpecANY); addContextIU("org.eclipse.core.runtime", "4.0.0"); @@ -242,16 +259,22 @@ public class ProductActionTest extends ActionTest { performProductAction(productFile); // there is a CU for the IU because it applies to all platforms - IInstallableUnitFragment fragment = (IInstallableUnitFragment) getUniquePublishedIU(flavorArg + configSpecANY + "org.eclipse.core.runtime"); - assertEquals("1.1", "org.eclipse.core.runtime", RequiredCapability.extractName(fragment.getHost().iterator().next().getMatches())); - assertEquals("1.2", Version.create("4.0.0"), RequiredCapability.extractRange(fragment.getHost().iterator().next().getMatches()).getMinimum()); + IInstallableUnitFragment fragment = (IInstallableUnitFragment) getUniquePublishedIU( + flavorArg + configSpecANY + "org.eclipse.core.runtime"); + assertEquals("1.1", "org.eclipse.core.runtime", + RequiredCapability.extractName(fragment.getHost().iterator().next().getMatches())); + assertEquals("1.2", Version.create("4.0.0"), + RequiredCapability.extractRange(fragment.getHost().iterator().next().getMatches()).getMinimum()); assertEquals("1.3", Version.create("1.0.0"), fragment.getVersion()); assertNull("1.3", fragment.getFilter()); } public void testANYConfigSpecPublishing_PlatformSpecificBundle() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); - String configSpecANY = AbstractPublisherAction.createConfigSpec("ANY", "ANY", "ANY"); // configuration spec to create CUs without filters + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString()); + String configSpecANY = AbstractPublisherAction.createConfigSpec("ANY", "ANY", "ANY"); // configuration spec to + // create CUs without + // filters setConfiguration(configSpecANY); addContextIU("org.eclipse.core.runtime", "4.0.0", WIN_FILTER); // any valid filter can be set here @@ -276,13 +299,15 @@ public class ProductActionTest extends ActionTest { testAction = new ProductAction(source, productFile, flavorArg, executablesFeatureLocation); PublisherInfo info = new PublisherInfo(); info.setContextMetadataRepository(repository); - // TODO this line doesn't have any effect -> is this a bug in the implementation? + // TODO this line doesn't have any effect -> is this a bug in the + // implementation? info.addAdvice(new QueryableFilterAdvice(info.getContextMetadataRepository())); IStatus status = testAction.perform(info, publisherResult, null); assertThat(status, is(okStatus())); - IQueryResult<IInstallableUnit> results = publisherResult.query(QueryUtil.createIUQuery("org.eclipse.platform.ide", Version.create("3.5.0.I20081118")), null); + IQueryResult<IInstallableUnit> results = publisherResult + .query(QueryUtil.createIUQuery("org.eclipse.platform.ide", Version.create("3.5.0.I20081118")), null); assertEquals("1.0", 1, queryResultSize(results)); IInstallableUnit unit = results.iterator().next(); Collection<IRequirement> requiredCapabilities = unit.getRequirements(); @@ -296,12 +321,14 @@ public class ProductActionTest extends ActionTest { } } assertTrue("1.1", capability != null); - assertEquals("1.2", InstallableUnit.parseFilter("(org.eclipse.update.install.features=true)"), capability.getFilter()); + assertEquals("1.2", InstallableUnit.parseFilter("(org.eclipse.update.install.features=true)"), + capability.getFilter()); } public void testProductWithAdviceFile() throws Exception { // product file that has a corresponding advice file (p2.inf). - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest/productWithAdvice", "productWithAdvice.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest/productWithAdvice", "productWithAdvice.product").toString()); testAction = new ProductAction(source, productFile, flavorArg, executablesFeatureLocation); IStatus status = testAction.perform(new PublisherInfo(), publisherResult, null); assertThat(status, is(okStatus())); @@ -310,27 +337,30 @@ public class ProductActionTest extends ActionTest { Collection<ITouchpointData> data = product.getTouchpointData(); assertEquals("1.1", 1, data.size()); String configure = data.iterator().next().getInstruction("configure").getBody(); - assertEquals("1.2", "addRepository(type:0,location:http${#58}//download.eclipse.org/releases/fred);addRepository(type:1,location:http${#58}//download.eclipse.org/releases/fred);", configure); - - //update.id = com.zoobar - //update.range = [4.0,4.3) - //update.severity = 0 - //update.description = This is the description + assertEquals("1.2", + "addRepository(type:0,location:http${#58}//download.eclipse.org/releases/fred);addRepository(type:1,location:http${#58}//download.eclipse.org/releases/fred);", + configure); + + // update.id = com.zoobar + // update.range = [4.0,4.3) + // update.severity = 0 + // update.description = This is the description IUpdateDescriptor update = product.getUpdateDescriptor(); assertEquals("2.0", 0, update.getSeverity()); assertEquals("2.1", "This is the description", update.getDescription()); - //unit that fits in range + // unit that fits in range assertTrue("2.2", update.isUpdateOf(createIU("com.zoobar", Version.createOSGi(4, 1, 0)))); - //unit that is too old for range + // unit that is too old for range assertFalse("2.3", update.isUpdateOf(createIU("com.zoobar", Version.createOSGi(3, 1, 0)))); - //version that is too new and outside of range + // version that is too new and outside of range assertFalse("2.4", update.isUpdateOf(createIU("com.zoobar", Version.createOSGi(6, 1, 0)))); - //unit with matching version but not matching id + // unit with matching version but not matching id assertFalse("2.6", update.isUpdateOf(createIU("com.other", Version.createOSGi(4, 1, 0)))); } public void testFiltersOfInclusions() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "productIncludingFragments.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "productIncludingFragments.product").toString()); addContextIU("generalbundle", "1.0.1"); addContextIU("fragment.win", "1.0.2", WIN_FILTER); // no fragment.linux in the context @@ -338,39 +368,48 @@ public class ProductActionTest extends ActionTest { IStatus status = performProductActionAndReturnStatus(productFile); IInstallableUnit productIU = getUniquePublishedIU("productIncludingFragments.uid"); - assertThat(productIU.getRequirements(), hasItem(createIURequirement("generalbundle", createStrictVersionRange("1.0.1")))); - assertThat(productIU.getRequirements(), hasItem(createIURequirement("fragment.win", createStrictVersionRange("1.0.2"), WIN_FILTER))); + assertThat(productIU.getRequirements(), + hasItem(createIURequirement("generalbundle", createStrictVersionRange("1.0.1")))); + assertThat(productIU.getRequirements(), + hasItem(createIURequirement("fragment.win", createStrictVersionRange("1.0.2"), WIN_FILTER))); - // this is bug 390361: the Linux fragment is required without filter, so the product cannot be installed for Windows ... + // this is bug 390361: the Linux fragment is required without filter, so the + // product cannot be installed for Windows ... assertThat(productIU.getRequirements(), hasItem(createIURequirement("fragment.linux", ANY_VERSION))); // ... therefore the action shall report an error assertThat(status, is(errorStatus())); - assertThat(Arrays.asList(status.getChildren()), hasItem(statusWithMessageWhich(containsString("Included element fragment.linux 0.0.0 is missing")))); + assertThat(Arrays.asList(status.getChildren()), + hasItem(statusWithMessageWhich(containsString("Included element fragment.linux 0.0.0 is missing")))); } public void testMessageForProductWithIgnoredContent() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "mixedContentIgnored.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "mixedContentIgnored.product").toString()); IStatus status = performProductActionAndReturnStatus(productFile); - // expect a warning about redundant, ignored content in product file -> requested in bug 325611 + // expect a warning about redundant, ignored content in product file -> + // requested in bug 325611 assertThat(Arrays.asList(status.getChildren()), hasItem(statusWithMessageWhich(containsString("are ignored")))); // TODO the message should have a code identifying it } public void testJREIncluded() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "brandedProduct/branded.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "brandedProduct/branded.product").toString()); addContextIU("org.eclipse.platform.feature.group", "1.2.3"); performProductAction(productFile); Collection<IInstallableUnit> ius = publisherResult.getIUs("branded.product", IPublisherResult.NON_ROOT); assertEquals(1, ius.size()); assertEquals("Missing a.jre.javase", 1, publisherResult.getIUs("a.jre.javase", IPublisherResult.ROOT).size()); - assertEquals("Missing config.a.jre.javase", 1, publisherResult.getIUs("config.a.jre.javase", IPublisherResult.ROOT).size()); + assertEquals("Missing config.a.jre.javase", 1, + publisherResult.getIUs("config.a.jre.javase", IPublisherResult.ROOT).size()); } public void testRequiredEEAsSpecified() throws Exception { - ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "productFileActionTest.product").toString()); + ProductFile productFile = new ProductFile( + TestData.getFile("ProductActionTest", "productFileActionTest.product").toString()); addContextIU("org.eclipse.core.commands", "5.0.0"); performProductAction(productFile); @@ -407,7 +446,7 @@ public class ProductActionTest extends ActionTest { } private void setConfiguration(String configSpec) { - ((PublisherInfo) publisherInfo).setConfigurations(new String[] {configSpec}); + ((PublisherInfo) publisherInfo).setConfigurations(new String[] { configSpec }); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java index 87a455079..7673a092c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java @@ -13,30 +13,23 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; -import static org.easymock.EasyMock.anyBoolean; -import static org.easymock.EasyMock.anyObject; -import static org.easymock.EasyMock.createNiceMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.expectLastCall; import static org.eclipse.equinox.p2.tests.publisher.actions.StatusMatchers.okStatus; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.mockito.Mockito.verify; import java.io.File; -import java.util.Collections; -import org.easymock.Capture; -import org.easymock.EasyMock; +import java.util.stream.Collectors; import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.internal.p2.publisher.eclipse.ProductFile; -import org.eclipse.equinox.p2.metadata.Version; import org.eclipse.equinox.p2.publisher.AbstractPublisherAction; import org.eclipse.equinox.p2.publisher.IPublisherAdvice; -import org.eclipse.equinox.p2.publisher.IPublisherInfo; -import org.eclipse.equinox.p2.publisher.actions.RootIUAdvice; import org.eclipse.equinox.p2.publisher.eclipse.IExecutableAdvice; import org.eclipse.equinox.p2.publisher.eclipse.ProductAction; import org.eclipse.equinox.p2.publisher.eclipse.ProductFileAdvice; import org.eclipse.equinox.p2.tests.TestData; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; /** * Tests for {@link ProductAction} specific to Mac. @@ -44,30 +37,11 @@ import org.eclipse.equinox.p2.tests.TestData; public class ProductActionTestMac extends ActionTest { private File executablesFeatureLocation = null; - private Capture<RootIUAdvice> rootIUAdviceCapture; - private Capture<ProductFileAdvice> productFileAdviceCapture; private String source = ""; @Override - protected IPublisherInfo createPublisherInfoMock() { - //override to create a nice mock, because we don't care about other method calls. - return createNiceMock(IPublisherInfo.class); - } - - @Override - protected void insertPublisherInfoBehavior() { - publisherInfo.addAdvice(EasyMock.and(EasyMock.isA(RootIUAdvice.class), EasyMock.capture(rootIUAdviceCapture))); - publisherInfo.addAdvice(EasyMock.and(EasyMock.isA(ProductFileAdvice.class), EasyMock.capture(productFileAdviceCapture))); - //Return an empty list every time getAdvice is called - expect(publisherInfo.getAdvice((String) anyObject(), anyBoolean(), (String) anyObject(), (Version) anyObject(), (Class<IPublisherAdvice>) anyObject())).andReturn(Collections.emptyList()); - expectLastCall().anyTimes(); - } - - @Override public void setUp() throws Exception { configSpec = AbstractPublisherAction.createConfigSpec("carbon", "macosx", "x86"); - rootIUAdviceCapture = new Capture<>(); - productFileAdviceCapture = new Capture<>(); setupPublisherInfo(); setupPublisherResult(); } @@ -76,13 +50,16 @@ public class ProductActionTestMac extends ActionTest { * Tests that correct advice is created for the org.eclipse.platform product. */ public void testPlatformProduct() throws Exception { + ArgumentCaptor<IPublisherAdvice> productFileAdviceCapture = ArgumentCaptor.forClass(IPublisherAdvice.class); ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "platform.product").toString()); addContextIU("org.eclipse.platform.feature.group", "3.8.3"); - testAction = new ProductAction(source, productFile, flavorArg, executablesFeatureLocation); + testAction = Mockito.spy(new ProductAction(source, productFile, flavorArg, executablesFeatureLocation)); IStatus status = testAction.perform(publisherInfo, publisherResult, null); + verify(publisherInfo, Mockito.atLeastOnce()).addAdvice(productFileAdviceCapture.capture()); assertThat(status, is(okStatus())); - IExecutableAdvice launchAdvice = productFileAdviceCapture.getValue(); + IExecutableAdvice launchAdvice = (IExecutableAdvice) productFileAdviceCapture.getAllValues().stream() + .filter(ProductFileAdvice.class::isInstance).collect(Collectors.toList()).get(0); assertEquals("1.0", "eclipse", launchAdvice.getExecutableName()); String[] programArgs = launchAdvice.getProgramArguments(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java index 3a93eb59a..91bc64d39 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java @@ -208,7 +208,7 @@ public class ProductFileAdviceTest extends AbstractProvisioningTest { configProperties.put("osgi.bundles", "org.eclipse.equinox.simpleconfigurator@1:start"); writeProperties(new File(rootFolder, "config.ini"), configProperties); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append("org.eclipse.equinox.common,3.5.100.v20090817,plugins/org.eclipse.equinox.common_3.5.100.v20090817.jar,2,true\n"); buffer.append("org.eclipse.equinox.simpleconfigurator,1.0.200.v20090729-1800,plugins/org.eclipse.equinox.simpleconfigurator_1.0.200.v20090729-1800.jar,1,true\n"); writeBuffer(new File(rootFolder, "org.eclipse.equinox.simpleconfigurator/bundles.info"), buffer); @@ -229,7 +229,7 @@ public class ProductFileAdviceTest extends AbstractProvisioningTest { File root = getTestFolder("configNullLauncher"); File testProduct = new File(root, "test.product"); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append("<product id=\"test.product\" version=\"1\" useFeatures=\"false\"> \n"); buffer.append(" <configIni use=\"default\"> \n"); buffer.append(" <win32>config.ini</win32> \n"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootFilesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootFilesActionTest.java index 9fa2a5d65..030cd8b2a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootFilesActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootFilesActionTest.java @@ -15,19 +15,30 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; -import static org.easymock.EasyMock.expect; - -import java.io.*; -import java.util.*; +import static org.mockito.Mockito.when; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; import java.util.zip.ZipInputStream; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; import org.eclipse.equinox.internal.p2.core.helpers.FileUtils; import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; import org.eclipse.equinox.p2.metadata.IArtifactKey; import org.eclipse.equinox.p2.metadata.Version; import org.eclipse.equinox.p2.publisher.AbstractPublisherAction; import org.eclipse.equinox.p2.publisher.IPublisherInfo; -import org.eclipse.equinox.p2.publisher.actions.*; +import org.eclipse.equinox.p2.publisher.actions.IRootFilesAdvice; +import org.eclipse.equinox.p2.publisher.actions.ITouchpointAdvice; +import org.eclipse.equinox.p2.publisher.actions.RootFilesAction; +import org.eclipse.equinox.p2.publisher.actions.RootFilesAdvice; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.p2.tests.TestActivator; import org.eclipse.equinox.p2.tests.TestData; @@ -68,10 +79,13 @@ public class RootFilesActionTest extends ActionTest { @Override public void insertPublisherInfoBehavior() { - expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes(); - expect(publisherInfo.getArtifactOptions()).andReturn(IPublisherInfo.A_INDEX | IPublisherInfo.A_OVERWRITE | IPublisherInfo.A_PUBLISH).anyTimes(); - expect(publisherInfo.getAdvice(configSpec, true, null, null, IRootFilesAdvice.class)).andReturn(adviceCollection).anyTimes(); - expect(publisherInfo.getAdvice(configSpec, false, flavorArg + topArg, versionArg, ITouchpointAdvice.class)).andReturn(null).anyTimes(); + when(publisherInfo.getArtifactRepository()).thenReturn(artifactRepository); + when(publisherInfo.getArtifactOptions()) + .thenReturn(IPublisherInfo.A_INDEX | IPublisherInfo.A_OVERWRITE | IPublisherInfo.A_PUBLISH); + when(publisherInfo.getAdvice(configSpec, true, null, null, IRootFilesAdvice.class)) + .thenReturn(adviceCollection); + when(publisherInfo.getAdvice(configSpec, false, flavorArg + topArg, versionArg, ITouchpointAdvice.class)) + .thenReturn(null); } private void setupTestCase(int testArg) throws Exception { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootIUActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootIUActionTest.java index 21b4dd4b2..637465c39 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootIUActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootIUActionTest.java @@ -15,7 +15,7 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; -import static org.easymock.EasyMock.expect; +import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.Collection; @@ -358,16 +358,22 @@ public class RootIUActionTest extends ActionTest { @Override public void insertPublisherInfoBehavior() { - expect(publisherInfo.getAdvice(null, false, rootIU, versionArg, ICapabilityAdvice.class)).andReturn(new ArrayList<>()).anyTimes(); - expect(publisherInfo.getAdvice(null, true, null, null, IRootIUAdvice.class)).andReturn(rootIUAdviceCollection).anyTimes(); - expect(publisherInfo.getAdvice(null, true, null, null, IVersionAdvice.class)).andReturn(null).anyTimes(); - expect(publisherInfo.getAdvice(null, false, rootIU, versionArg, ITouchpointAdvice.class)).andReturn(new ArrayList<>()).anyTimes(); - expect(publisherInfo.getAdvice(null, false, rootIU, versionArg, IUpdateDescriptorAdvice.class)).andReturn(new ArrayList<>()).anyTimes(); - expect(publisherInfo.getAdvice(null, false, rootIU, versionArg, IPropertyAdvice.class)).andReturn(new ArrayList<>()).anyTimes(); - expect(publisherInfo.getAdvice(null, false, rootIU, versionArg, IAdditionalInstallableUnitAdvice.class)).andReturn(new ArrayList<>()).anyTimes(); - expect(publisherInfo.getAdvice(null, true, rootIU, versionArg, ILicenseAdvice.class)).andReturn(new ArrayList<>()).anyTimes(); - expect(publisherInfo.getMetadataRepository()).andReturn(metadataRepository).anyTimes(); - expect(publisherInfo.getContextMetadataRepository()).andReturn(null).anyTimes(); + when(publisherInfo.getAdvice(null, false, rootIU, versionArg, ICapabilityAdvice.class)) + .thenReturn(new ArrayList<>()); + when(publisherInfo.getAdvice(null, true, null, null, IRootIUAdvice.class)).thenReturn(rootIUAdviceCollection); + when(publisherInfo.getAdvice(null, true, null, null, IVersionAdvice.class)).thenReturn(null); + when(publisherInfo.getAdvice(null, false, rootIU, versionArg, ITouchpointAdvice.class)) + .thenReturn(new ArrayList<>()); + when(publisherInfo.getAdvice(null, false, rootIU, versionArg, IUpdateDescriptorAdvice.class)) + .thenReturn(new ArrayList<>()); + when(publisherInfo.getAdvice(null, false, rootIU, versionArg, IPropertyAdvice.class)) + .thenReturn(new ArrayList<>()); + when(publisherInfo.getAdvice(null, false, rootIU, versionArg, IAdditionalInstallableUnitAdvice.class)) + .thenReturn(new ArrayList<>()); + when(publisherInfo.getAdvice(null, true, rootIU, versionArg, ILicenseAdvice.class)) + .thenReturn(new ArrayList<>()); + when(publisherInfo.getMetadataRepository()).thenReturn(metadataRepository); + when(publisherInfo.getContextMetadataRepository()).thenReturn(null); } @Override diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java index 2f070abf5..e0fb19b41 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java @@ -394,7 +394,7 @@ public class PerformanceTest extends AbstractProvisioningTest { IInstallableUnit envIU = InstallableUnit.contextIU(env); CompositeMetadataRepository compositeMetadataRepository = CompositeMetadataRepository.createMemoryComposite(getMetadataRepositoryManager().getAgent()); - compositeMetadataRepository.addChild(new URI("http://download.eclipse.org/releases/galileo")); + compositeMetadataRepository.addChild(new URI("https://download.eclipse.org/releases/galileo")); IMetadataRepository repo = compositeMetadataRepository; IQueryResult<IInstallableUnit> r = repo.query(QueryUtil.createIUQuery("org.eclipse.sdk.ide"), new NullProgressMonitor()); IInstallableUnit[] roots = r.toArray(IInstallableUnit.class); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java index f1b090aa9..81d99b186 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java @@ -281,7 +281,7 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest { detailedMessage.append(" install location is ").append(getInstallLocation()).append('\n'); String message = "Need to set the \"org.eclipse.equinox.p2.reconciler.tests.platform.archive\" system property with a valid path to the platform binary drop or copy the archive to be a sibling of the install folder."; assertNotNull(message + "\n" + detailedMessage, file); - assertTrue(message, file.exists()); + assertTrue(message + "\nThe file '" + file.getAbsolutePath() + "' does not exist", file.exists()); assertTrue("File is zero length: " + file.getAbsolutePath(), file.length() > 0); return file; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest2.java index ea51e6291..a07f73ad8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest2.java @@ -201,7 +201,7 @@ public class FileReaderTest2 extends AbstractProvisioningTest { } private void doFileReaderTest(final PauseJob pauseJob, IProgressMonitor monitor) throws IOException, CoreException { - final String testRemoteFileURL = "http://download.eclipse.org/releases/photon/201806271001/content.jar"; + final String testRemoteFileURL = "https://download.eclipse.org/releases/2021-09/202109151000/content.jar"; File tmpFolder = getTempFolder(); File tmpFile = new File(tmpFolder, "testDownloadPauseResume.zip"); File tmpFile1 = new File(tmpFolder, "testDownloadWithoutPause.zip"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CheckTrustActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CheckTrustActionTest.java index fbc3fc5f4..b1cade2a0 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CheckTrustActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CheckTrustActionTest.java @@ -14,7 +14,9 @@ package org.eclipse.equinox.p2.tests.touchpoint.eclipse; import java.io.File; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand; import org.eclipse.equinox.internal.p2.engine.phases.CheckTrust; @@ -65,7 +67,7 @@ public class CheckTrustActionTest extends AbstractProvisioningTest { Map<String, Object> parameters = new HashMap<>(); parameters.put(ActionConstants.PARM_AGENT, getAgent()); parameters.put(ActionConstants.PARM_PROFILE, profile); - parameters.put(CheckTrust.PARM_ARTIFACT_FILES, new ArrayList<>()); + parameters.put(CheckTrust.PARM_ARTIFACTS, new HashMap<>()); EclipseTouchpoint touchpoint = new EclipseTouchpoint(); touchpoint.initializePhase(null, profile, "test", parameters); InstallableUnitOperand operand = new InstallableUnitOperand(null, iu); @@ -73,13 +75,13 @@ public class CheckTrustActionTest extends AbstractProvisioningTest { touchpoint.initializeOperand(profile, parameters); parameters = Collections.unmodifiableMap(parameters); - assertFalse(((List<?>) parameters.get(CheckTrust.PARM_ARTIFACT_FILES)).contains(osgiTarget)); + assertFalse(((Map<?, File>) parameters.get(CheckTrust.PARM_ARTIFACTS)).values().contains(osgiTarget)); CheckTrustAction action = new CheckTrustAction(); action.execute(parameters); - assertTrue(((List<?>) parameters.get(CheckTrust.PARM_ARTIFACT_FILES)).contains(osgiTarget)); + assertTrue(((Map<?, File>) parameters.get(CheckTrust.PARM_ARTIFACTS)).values().contains(osgiTarget)); // does nothing so should not alter parameters action.undo(parameters); - assertTrue(((List<?>) parameters.get(CheckTrust.PARM_ARTIFACT_FILES)).contains(osgiTarget)); + assertTrue(((Map<?, File>) parameters.get(CheckTrust.PARM_ARTIFACTS)).values().contains(osgiTarget)); } }
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetLauncherNameActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetLauncherNameActionTest.java index de6ddd662..f01f88db3 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetLauncherNameActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/SetLauncherNameActionTest.java @@ -14,7 +14,9 @@ package org.eclipse.equinox.p2.tests.touchpoint.eclipse; import java.io.File; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; import org.eclipse.equinox.frameworkadmin.BundleInfo; import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand; import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint; @@ -99,7 +101,7 @@ public class SetLauncherNameActionTest extends AbstractProvisioningTest { //profile will start using "eclipse" by default, give it some content and see if it //survives a name change. File eclipseIni = new File(tempFolder, "eclipse.ini"); - StringBuffer ini = new StringBuffer(); + StringBuilder ini = new StringBuilder(); ini.append("-startup\n"); ini.append("plugins/org.eclipse.equinox.launcher_1.2.4.v1234.jar\n"); writeBuffer(eclipseIni, ini); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/AllTests.java index 08ffbaf7c..27f0c1618 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/AllTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/AllTests.java @@ -23,7 +23,7 @@ import org.junit.runners.Suite; @Suite.SuiteClasses({ ChmodActionTest.class, CleanupzipActionTest.class, CollectActionTest.class, LinkActionTest.class, MkdirActionTest.class, NativeTouchpointTest.class, RmdirActionTest.class, UnzipActionTest.class, - CopyActionTest.class, RemoveActionTest.class, BackupStoreTest.class, + CopyActionTest.class, RemoveActionTest.class, SimpleBackupStoreTest.class, CheckAndPromptNativePackageWindowsRegistryTest.class }) public class AllTests { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/BackupStoreTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/BackupStoreTest.java deleted file mode 100644 index 011c4d3cd..000000000 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/BackupStoreTest.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014, 2017 EclipseSource and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * EclipseSource - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.tests.touchpoint.natives; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; -import org.eclipse.equinox.internal.p2.touchpoint.natives.BackupStore; -import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; - -public class BackupStoreTest extends AbstractProvisioningTest { - - private static final String BUPREFIX = "BackupTest"; - private File sourceDir; - private File aDir; - private File aaDir; - private File aTxt; - private File bDir; - private File bTxt; - - /** - * Sets up directories and files under user.home - * <ul><li>P2BUTEST/</li> - * <ul><li>A/</li> - * <ul><li>AA/</li> - * <ul><li>a.txt</li> - * </ul> - * </ul> - * </ul> - * </ul> - */ - @Override - public void setUp() { - // create some test files under user.home - // do not want them under /tmp as it may be on its own file system (and even - // be an in-memory file system). - // - String userHome = System.getProperty("user.home"); - sourceDir = new File(new File(userHome), "P2BUTEST"); - fullyDelete(sourceDir); - aDir = new File(sourceDir, "A"); - aDir.mkdirs(); - aaDir = new File(aDir, "AA"); - aaDir.mkdir(); - aTxt = new File(aaDir, "eclipse.exe"); - bDir = new File(sourceDir, "B"); - bTxt = new File(bDir, "b.txt"); - try { - writeToFile(aTxt, "A\nA file with an A"); - } catch (IOException e) { - fail(); - } - } - - private void writeToFile(File file, String content) throws IOException { - file.getParentFile().mkdirs(); - file.createNewFile(); - - try (Writer writer = new BufferedWriter(new FileWriter(file))) { - writer.write(content); - } - } - - @Override - public void tearDown() { - fullyDelete(sourceDir); - } - - /** - * Deletes a file, or a directory with all of it's children. - * @param file the file or directory to fully delete - * @return true if, and only if the file is deleted - */ - private boolean fullyDelete(File file) { - if (!file.exists()) - return true; - if (file.isDirectory()) { - File[] children = file.listFiles(); - for (File child : children) { - if (!fullyDelete(new File(file, child.getName()))) { - return false; - } - } - } - return file.delete(); - } - - public void testBackupByRenamingFile() { - String filePath = aTxt.getAbsolutePath(); - class TestBackupByRenamingFileBackupStore extends BackupStore { - public TestBackupByRenamingFileBackupStore() { - super(null, BUPREFIX); - } - - @Override - public void renameInPlace(File file) { - super.renameInPlace(file); - } - - @Override - protected String getTimeStamp() { - return "-123"; - } - } - TestBackupByRenamingFileBackupStore backupStore = new TestBackupByRenamingFileBackupStore(); - backupStore.renameInPlace(aTxt); - - assertFalse(aTxt.exists()); - assertTrue(new File(filePath + "-123.p2bu").exists()); - - backupStore.discard(); - assertFalse(new File(filePath + "-123.p2bu").exists()); - } - - public void testRenameIfMoveToBackupFails() throws IOException { - String filePath = aTxt.getAbsolutePath(); - class TestRenameIfMoveToBackupFailsBackupStore extends BackupStore { - public TestRenameIfMoveToBackupFailsBackupStore() { - super(null, BUPREFIX); - } - - @Override - public void renameInPlace(File file) { - super.renameInPlace(file); - } - - @Override - public boolean moveToBackupStore(File a, File b) { - return false; - } - - @Override - public void moveToBackup(File a, File b) throws IOException { - super.moveToBackup(a, b); - } - - @Override - protected String getTimeStamp() { - return "-123"; - } - } - TestRenameIfMoveToBackupFailsBackupStore backupStore = new TestRenameIfMoveToBackupFailsBackupStore(); - backupStore.moveToBackup(aTxt, bTxt); - - assertFalse(aTxt.exists()); - assertTrue(new File(filePath + "-123.p2bu").exists()); - assertFalse(bTxt.exists()); - - backupStore.discard(); - assertFalse(new File(filePath + "-123.p2bu").exists()); - } - - public void testDoNotRenameIfMoveToBackupWorks() throws IOException { - String filePath = aTxt.getAbsolutePath(); - new BackupStore(null, BUPREFIX) { - @Override - public void renameInPlace(File file) { - super.renameInPlace(file); - } - - @Override - public boolean moveToBackupStore(File a, File b) { - return super.moveToBackupStore(a, b); - } - - @Override - public void moveToBackup(File a, File b) throws IOException { - super.moveToBackup(a, b); - } - }.moveToBackup(aTxt, bTxt); - - assertFalse(aTxt.exists()); - assertFalse(new File(filePath + ".p2bu").exists()); - assertTrue(bTxt.exists()); - } -} diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/SimpleBackupStoreTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/SimpleBackupStoreTest.java new file mode 100644 index 000000000..a6f270835 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/SimpleBackupStoreTest.java @@ -0,0 +1,166 @@ +/******************************************************************************* + * Copyright (c) 2014, 2021 EclipseSource and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * EclipseSource - initial API and implementation + * Todor Boev - refactor to the java 7 file api + *******************************************************************************/ +package org.eclipse.equinox.p2.tests.touchpoint.natives; + +import static java.nio.file.FileVisitResult.CONTINUE; + +import java.io.IOException; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import org.eclipse.equinox.internal.p2.touchpoint.natives.SimpleBackupStore; +import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; + +public class SimpleBackupStoreTest extends AbstractProvisioningTest { + private static final String BACKUP_PREFIX = "backup-test"; + + private Path sourceDir; + + private Path aDir; + private Path aaDir; + private Path aFile; + + /** + * <pre> + * /p2-backup-test + * /a + * /aa + * /eclipse.exe + * </pre> + */ + @Override + public void setUp() throws IOException { + String userHome = System.getProperty("user.home"); + + sourceDir = Path.of(userHome, "p2-backup-test"); + deleteAll(sourceDir); + + aDir = sourceDir.resolve("a"); + Files.createDirectories(aDir); + + aaDir = aDir.resolve("aa"); + Files.createDirectories(aaDir); + + // The eclipse.exe is the only one eligible for backup-in-place + aFile = aaDir.resolve("eclipse.exe"); + Files.createFile(aFile); + } + + @Override + public void tearDown() throws IOException { + deleteAll(sourceDir); + } + + private static void deleteAll(Path path) throws IOException { + if (!Files.exists(path)) { + return; + } + + Files.walkFileTree(path, new SimpleFileVisitor<Path>() { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + Files.delete(file); + return CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + if (exc != null) { + throw exc; + } + Files.delete(dir); + return CONTINUE; + } + }); + } + + public void testBackupInPlace() throws IOException { + class TestMoveInPlaceStore extends SimpleBackupStore { + public TestMoveInPlaceStore() { + super(null, BACKUP_PREFIX); + } + + @Override + public Path toInPlaceBackupPath(Path path) { + return super.toInPlaceBackupPath(path); + } + + @Override + protected void move(Path a, Path b) throws IOException { + // In place backup - allow + if (b.equals(toInPlaceBackupPath(a))) { + super.move(a, b); + } + // In place restore - allow + else if (a.equals(toInPlaceBackupPath(b))) { + super.move(a, b); + } + // Everything else - fail + else if (a.getFileName().endsWith("eclipse.exe")) { + // Simulate what happens on Windows when moving a running executable between + // drives. In this case the file will be copied to the target but will not be + // removed from the source. + Files.copy(a, b); + } else { + throw new IOException("Test fail move: " + a + " -> " + b); + } + } + } + + TestMoveInPlaceStore buStore = new TestMoveInPlaceStore(); + + final Path path = aFile; + final Path inPlaceBuPath = buStore.toInPlaceBackupPath(aFile); + + buStore.backup(path.toFile()); + + assertFalse(Files.exists(path)); + assertTrue(Files.exists(inPlaceBuPath)); + + buStore.restore(); + + assertTrue(Files.exists(path)); + assertFalse(Files.exists(inPlaceBuPath)); + } + + public void testNoBackupInPlace() throws IOException { + class TestNoBackupInPlaceStore extends SimpleBackupStore { + public TestNoBackupInPlaceStore() { + super(null, BACKUP_PREFIX); + } + + @Override + public Path toInPlaceBackupPath(Path path) { + return super.toInPlaceBackupPath(path); + } + } + + TestNoBackupInPlaceStore buStore = new TestNoBackupInPlaceStore(); + + final Path path = aFile; + final Path inPlaceBuPath = buStore.toInPlaceBackupPath(aFile); + + buStore.backup(path.toFile()); + + assertFalse(Files.exists(path)); + assertFalse(Files.exists(inPlaceBuPath)); + + buStore.restore(); + + assertTrue(Files.exists(path)); + } +} diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java index c75a95bb9..05cfb29a8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java @@ -16,20 +16,31 @@ package org.eclipse.equinox.p2.tests.updatesite; import java.io.File; import java.io.PrintStream; import java.net.URI; -import java.util.*; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.URIUtil; import org.eclipse.equinox.internal.p2.updatesite.SiteXMLAction; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.IProvidedCapability; -import org.eclipse.equinox.p2.publisher.*; +import org.eclipse.equinox.p2.publisher.IPublisherAction; +import org.eclipse.equinox.p2.publisher.IPublisherResult; +import org.eclipse.equinox.p2.publisher.PublisherInfo; +import org.eclipse.equinox.p2.publisher.PublisherResult; import org.eclipse.equinox.p2.publisher.actions.MergeResultsAction; import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAction; -import org.eclipse.equinox.p2.query.*; +import org.eclipse.equinox.p2.query.IQuery; +import org.eclipse.equinox.p2.query.IQueryResult; +import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.p2.repository.IRepository; import org.eclipse.equinox.p2.repository.IRepositoryReference; -import org.eclipse.equinox.p2.tests.*; +import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; +import org.eclipse.equinox.p2.tests.StringBufferStream; +import org.eclipse.equinox.p2.tests.TestData; +import org.eclipse.equinox.p2.tests.TestMetadataRepository; /** * Tests for {@link org.eclipse.equinox.internal.p2.updatesite.SiteXMLAction}. @@ -88,7 +99,7 @@ public class SiteXMLActionTest extends AbstractProvisioningTest { assertEquals("1.0", 2, references.size()); boolean metadataFound = false, artifactFound = false; for (IRepositoryReference ref : references) { - assertEquals("1.1", "http://download.eclipse.org/eclipse/updates/3.5", ref.getLocation().toString()); + assertEquals("1.1", "https://download.eclipse.org/eclipse/updates/4.21", ref.getLocation().toString()); assertEquals("1.2", IRepository.ENABLED, ref.getOptions()); assertEquals("1.3", "Eclipse Project Update Site", ref.getNickname()); @@ -103,7 +114,8 @@ public class SiteXMLActionTest extends AbstractProvisioningTest { public void testMirrorsURL() { String mirrorsURL = metadataRepository.getProperties().get(IRepository.PROP_MIRRORS_URL); - assertEquals("1.0", "http://www.eclipse.org/downloads/download.php?file=/eclipse/updates/3.4&format=xml", mirrorsURL); + assertEquals("1.0", "https://www.eclipse.org/downloads/download.php?file=/eclipse/updates/4.21&format=xml", + mirrorsURL); } public void testBundleInCategory() { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java index a3204eb7d..67dde3c36 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java @@ -711,8 +711,8 @@ public class UpdateSiteTest extends AbstractProvisioningTest { public void _testFeatureSiteReferences() throws ProvisionException, URISyntaxException { File site = getTestData("0.1", "/testData/updatesite/siteFeatureReferences"); URI siteURI = site.toURI(); - URI testUpdateSite = new URI("http://download.eclipse.org/test/updatesite/"); - URI testDiscoverySite = new URI("http://download.eclipse.org/test/discoverysite"); + URI testUpdateSite = new URI("https://download.eclipse.org/test/updatesite/"); + URI testDiscoverySite = new URI("https://download.eclipse.org/test/discoverysite"); IMetadataRepositoryManager manager = getAgent().getService(IMetadataRepositoryManager.class); assertNotNull(manager); @@ -800,6 +800,7 @@ public class UpdateSiteTest extends AbstractProvisioningTest { // Should have a packed & canonical version assertEquals(2, descriptors.length); + @SuppressWarnings("removal") IArtifactDescriptor desc = IArtifactDescriptor.FORMAT_PACKED.equals(descriptors[0].getProperty(IArtifactDescriptor.FORMAT)) ? descriptors[0] : descriptors[1]; try (OutputStream out = new FileOutputStream(output)) { @@ -815,6 +816,7 @@ public class UpdateSiteTest extends AbstractProvisioningTest { } } + @SuppressWarnings("removal") public void testMirrors() { String testDataLocation = "/testData/updatesite/packedSiteWithMirror"; File targetLocation = null; diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/CertificateChecker/selfsigned/artifacts.xml b/bundles/org.eclipse.equinox.p2.tests/testData/CertificateChecker/selfsigned/artifacts.xml new file mode 100644 index 000000000..68b911bfa --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/CertificateChecker/selfsigned/artifacts.xml @@ -0,0 +1,16 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?artifactRepository version='1.1.0'?> +<repository name='file:/home/mistria/sandbox/repo/ - artifacts' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1'> + <properties size='2'> + <property name='p2.timestamp' value='1618433231272'/> + <property name='p2.compressed' value='false'/> + </properties> + <mappings size='3'> + <rule filter='(& (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/> + <rule filter='(& (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/> + <rule filter='(& (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/> + </mappings> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='blah' version='1.0.0.123456'/> + </artifacts> +</repository> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/CertificateChecker/selfsigned/content.xml b/bundles/org.eclipse.equinox.p2.tests/testData/CertificateChecker/selfsigned/content.xml new file mode 100644 index 000000000..db8f67ba2 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/CertificateChecker/selfsigned/content.xml @@ -0,0 +1,49 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?metadataRepository version='1.2.0'?> +<repository name='file:/home/mistria/sandbox/repo/ - metadata' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1'> + <properties size='2'> + <property name='p2.timestamp' value='1618433231272'/> + <property name='p2.compressed' value='false'/> + </properties> + <units size='2'> + <unit id='blah' version='1.0.0.123456' singleton='false'> + <update id='blah' range='[0.0.0,1.0.0.123456)' severity='0'/> + <provides size='4'> + <provided namespace='org.eclipse.equinox.p2.iu' name='blah' version='1.0.0.123456'/> + <provided namespace='osgi.bundle' name='blah' version='1.0.0.123456'/> + <provided namespace='osgi.identity' name='blah' version='1.0.0.123456'> + <properties size='1'> + <property name='type' value='osgi.bundle'/> + </properties> + </provided> + <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/> + </provides> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='blah' version='1.0.0.123456'/> + </artifacts> + <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/> + <touchpointData size='1'> + <instructions size='2'> + <instruction key='zipped'> + true + </instruction> + <instruction key='manifest'> + Bundle-SymbolicName: blah
Bundle-Version: 1.0.0.qualifier
 + </instruction> + </instructions> + </touchpointData> + </unit> + <unit id='Category' version='0.0.0'> + <properties size='3'> + <property name='org.eclipse.equinox.p2.type.category' value='true'/> + </properties> + <provides size='1'> + <provided namespace='org.eclipse.equinox.p2.iu' name='Category' version='0.0.0'/> + </provides> + <requires size='1'> + <required namespace='org.eclipse.equinox.p2.iu' name='blah' range='[1.0.0.123456,1.0.0.123456]'/> + </requires> + <touchpoint id='null' version='0.0.0'/> + </unit> + </units> +</repository> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/CertificateChecker/selfsigned/plugins/blah_1.0.0.123456.jar b/bundles/org.eclipse.equinox.p2.tests/testData/CertificateChecker/selfsigned/plugins/blah_1.0.0.123456.jar Binary files differnew file mode 100644 index 000000000..81573b2aa --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/CertificateChecker/selfsigned/plugins/blah_1.0.0.123456.jar diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/corruptedJarRepo/artifacts.xml b/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/corruptedJarRepo/artifacts.xml index 3093c3db4..126d69b9d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/corruptedJarRepo/artifacts.xml +++ b/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/corruptedJarRepo/artifacts.xml @@ -13,7 +13,7 @@ <rule filter='(& (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/> </mappings> <artifacts size='1'> - <artifact classifier='osgi.bundle' id='org.eclipse.equinox.common' version='3.5.0.corrupted'> + <artifact classifier='osgi.bundle' id='org.eclipse.equinox.common' version='3.15.0.v20210428-1632'> <properties size='4'> <property name='download.contentType' value='application/zip'/> </properties> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/corruptedJarRepo/content.xml b/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/corruptedJarRepo/content.xml index 0606c14e5..dd28b8da8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/corruptedJarRepo/content.xml +++ b/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/corruptedJarRepo/content.xml @@ -7,18 +7,18 @@ <property name='site.checksum' value='2404093275'/> </properties> <units size='1'> - <unit id='testBundle' version='3.5.0.corrupted'> + <unit id='testBundle' version='3.15.0.v20210428-1632'> <properties size='3'> <property name='org.eclipse.equinox.p2.name' value='Uncategorized'/> <property name='org.eclipse.equinox.p2.description' value='Default category for otherwise uncategorized features'/> <property name='org.eclipse.equinox.p2.type.category' value='true'/> </properties> <provides size='1'> - <provided namespace='org.eclipse.equinox.p2.iu' name='testBundle' version='3.5.0.corrupted'/> + <provided namespace='org.eclipse.equinox.p2.iu' name='testBundle' version='3.15.0.v20210428-1632'/> </provides> <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/> <artifacts size='1'> - <artifact classifier='osgi.bundle' id='org.eclipse.equinox.common' version='3.5.0.corrupted'/> + <artifact classifier='osgi.bundle' id='org.eclipse.equinox.common' version='3.15.0.v20210428-1632'/> </artifacts> </unit> </units> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/corruptedJarRepo/plugins/org.eclipse.equinox.common_3.15.0.v20210428-1632.jar b/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/corruptedJarRepo/plugins/org.eclipse.equinox.common_3.15.0.v20210428-1632.jar Binary files differnew file mode 100644 index 000000000..ba48f48f9 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/corruptedJarRepo/plugins/org.eclipse.equinox.common_3.15.0.v20210428-1632.jar diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/corruptedJarRepo/plugins/org.eclipse.equinox.common_3.5.0.corrupted.jar b/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/corruptedJarRepo/plugins/org.eclipse.equinox.common_3.5.0.corrupted.jar Binary files differdeleted file mode 100644 index 7fdbb530d..000000000 --- a/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/corruptedJarRepo/plugins/org.eclipse.equinox.common_3.5.0.corrupted.jar +++ /dev/null diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/generator/Europa/site.xml b/bundles/org.eclipse.equinox.p2.tests/testData/generator/Europa/site.xml index a9bf0170d..d9102ed21 100644 --- a/bundles/org.eclipse.equinox.p2.tests/testData/generator/Europa/site.xml +++ b/bundles/org.eclipse.equinox.p2.tests/testData/generator/Europa/site.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<site digestURL="http://download.eclipse.org/releases/europa/" mirrorsURL="http://www.eclipse.org/downloads/download.php?file=/releases/europa/site.xml&format=xml&protocol=http" pack200="true"> +<site digestURL="https://download.eclipse.org/releases/europa/" mirrorsURL="http://www.eclipse.org/downloads/download.php?file=/releases/europa/site.xml&format=xml&protocol=http" pack200="true"> <description url="http://www.eclipse.org/europa/"> This Europa Discovery Site contains a number of Eclipse based projects diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/generator/eclipse3.3/features/org.eclipse.platform.source_3.3.0.v20070612-_19UEkLEzwsdF9jSqQ-G/feature.xml b/bundles/org.eclipse.equinox.p2.tests/testData/generator/eclipse3.3/features/org.eclipse.platform.source_3.3.0.v20070612-_19UEkLEzwsdF9jSqQ-G/feature.xml index b9cb4db57..5357a19cc 100644 --- a/bundles/org.eclipse.equinox.p2.tests/testData/generator/eclipse3.3/features/org.eclipse.platform.source_3.3.0.v20070612-_19UEkLEzwsdF9jSqQ-G/feature.xml +++ b/bundles/org.eclipse.equinox.p2.tests/testData/generator/eclipse3.3/features/org.eclipse.platform.source_3.3.0.v20070612-_19UEkLEzwsdF9jSqQ-G/feature.xml @@ -10,9 +10,9 @@ %license </license> <url> - <update label="%updateSiteName" url="http://update.eclipse.org/updates/3.3"/> - <discovery label="%updateSiteName" url="http://update.eclipse.org/updates/3.3"/> - <discovery label="%secondaryUpdateSiteName" url="http://download.eclipse.org/releases/europa"/> + <update label="%updateSiteName" url="https://update.eclipse.org/updates/3.3"/> + <discovery label="%updateSiteName" url="https://update.eclipse.org/updates/3.3"/> + <discovery label="%secondaryUpdateSiteName" url="https://download.eclipse.org/releases/europa"/> </url> <includes id="org.eclipse.rcp.source" version="3.3.0.v20070607-8y8eE8NEbsN3X_fjWS8HPNG"/> <plugin fragment="false" unpack="false" download-size="0" install-size="0" id="org.eclipse.platform.doc.isv" version="3.3.0.v20070621"/> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/generator/eclipse3.3/features/org.eclipse.platform_3.3.0.v20070612-_19UEkLEzwsdF9jSqQ-G/feature.xml b/bundles/org.eclipse.equinox.p2.tests/testData/generator/eclipse3.3/features/org.eclipse.platform_3.3.0.v20070612-_19UEkLEzwsdF9jSqQ-G/feature.xml index e4974b851..8f1ffb44d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/testData/generator/eclipse3.3/features/org.eclipse.platform_3.3.0.v20070612-_19UEkLEzwsdF9jSqQ-G/feature.xml +++ b/bundles/org.eclipse.equinox.p2.tests/testData/generator/eclipse3.3/features/org.eclipse.platform_3.3.0.v20070612-_19UEkLEzwsdF9jSqQ-G/feature.xml @@ -19,9 +19,9 @@ </license> <url> - <update label="%updateSiteName" url="http://update.eclipse.org/updates/3.3"/> - <discovery label="%updateSiteName" url="http://update.eclipse.org/updates/3.3"/> - <discovery label="%secondaryUpdateSiteName" url="http://download.eclipse.org/releases/europa"/> + <update label="%updateSiteName" url="https://update.eclipse.org/updates/3.3"/> + <discovery label="%updateSiteName" url="https://update.eclipse.org/updates/3.3"/> + <discovery label="%secondaryUpdateSiteName" url="https://download.eclipse.org/releases/europa"/> </url> <plugin diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/generator/eclipse3.3/features/org.eclipse.sdk_3.3.0.v20070607-7M7J-BIolz-OcxWxvWAPSfLPqevO/feature.xml b/bundles/org.eclipse.equinox.p2.tests/testData/generator/eclipse3.3/features/org.eclipse.sdk_3.3.0.v20070607-7M7J-BIolz-OcxWxvWAPSfLPqevO/feature.xml index 0b59abbde..87abcbbfd 100644 --- a/bundles/org.eclipse.equinox.p2.tests/testData/generator/eclipse3.3/features/org.eclipse.sdk_3.3.0.v20070607-7M7J-BIolz-OcxWxvWAPSfLPqevO/feature.xml +++ b/bundles/org.eclipse.equinox.p2.tests/testData/generator/eclipse3.3/features/org.eclipse.sdk_3.3.0.v20070607-7M7J-BIolz-OcxWxvWAPSfLPqevO/feature.xml @@ -19,9 +19,9 @@ </license> <url> - <update label="%updateSiteName" url="http://update.eclipse.org/updates/3.3"/> - <discovery label="%updateSiteName" url="http://update.eclipse.org/updates/3.3"/> - <discovery label="%secondaryUpdateSiteName" url="http://download.eclipse.org/releases/europa"/> + <update label="%updateSiteName" url="https://update.eclipse.org/updates/3.3"/> + <discovery label="%updateSiteName" url="https://update.eclipse.org/updates/3.3"/> + <discovery label="%secondaryUpdateSiteName" url="https://download.eclipse.org/releases/europa"/> </url> <includes diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/importexport/unknownformat.p2f b/bundles/org.eclipse.equinox.p2.tests/testData/importexport/unknownformat.p2f index 9ae98bf32..56e172939 100644 --- a/bundles/org.eclipse.equinox.p2.tests/testData/importexport/unknownformat.p2f +++ b/bundles/org.eclipse.equinox.p2.tests/testData/importexport/unknownformat.p2f @@ -131,7 +131,7 @@ </unit> </units> <repositories> - <repository uri='http://download.eclipse.org/releases/helios'/> + <repository uri='https://download.eclipse.org/releases/helios'/> <repository uri='file:/folk/kzhu0/tmp/plugins/'/> <repository uri='http://hge.javaforge.com/hgeclipse'/> </repositories> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/metadataRepo/unencodedreporeferences/content.xml b/bundles/org.eclipse.equinox.p2.tests/testData/metadataRepo/unencodedreporeferences/content.xml index 3d6cd6174..814936f0c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/testData/metadataRepo/unencodedreporeferences/content.xml +++ b/bundles/org.eclipse.equinox.p2.tests/testData/metadataRepo/unencodedreporeferences/content.xml @@ -2,9 +2,9 @@ <?metadataRepository class='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1.0.0'?> <repository name='update site: file:/C:/1target/provmiddle/org.eclipse.equinox.p2.tests/testData/updatesite/site' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1'> <references size='4'> - <repository url='http://download.eclipse.org/url/with/spaces/a b' type='0' options='0'/> + <repository url='https://download.eclipse.org/url/with/spaces/a b' type='0' options='0'/> <repository url='file:/c:/tmp/url with spaces/' type='1' options='0'/> - <repository uri='http://download.eclipse.org/uri/with/spaces/a%20b' type='0' options='0'/> + <repository uri='https://download.eclipse.org/uri/with/spaces/a%20b' type='0' options='0'/> <repository uri='file:/c:/tmp/uri%20with%20spaces/' type='1' options='0'/> </references> <properties size='3'> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/mirror/mirrorSourceRepoWithRefs/content.xml b/bundles/org.eclipse.equinox.p2.tests/testData/mirror/mirrorSourceRepoWithRefs/content.xml index 3a3575af8..d53fba1e4 100644 --- a/bundles/org.eclipse.equinox.p2.tests/testData/mirror/mirrorSourceRepoWithRefs/content.xml +++ b/bundles/org.eclipse.equinox.p2.tests/testData/mirror/mirrorSourceRepoWithRefs/content.xml @@ -6,10 +6,10 @@ <property name='p2.timestamp' value='1222693511921'/> </properties> <references size='4'> - <repository uri='http://download.eclipse.org/eclipse/updates/3.5/' url='http://download.eclipse.org/eclipse/updates/3.5/' type='0' options='0'/> - <repository uri='http://download.eclipse.org/eclipse/updates/3.5/' url='http://download.eclipse.org/eclipse/updates/3.5/' type='1' options='0'/> - <repository uri='http://download.eclipse.org/eclipse/updates/3.6/' url='http://download.eclipse.org/eclipse/updates/3.6/' type='0' options='0'/> - <repository uri='http://download.eclipse.org/eclipse/updates/3.6/' url='http://download.eclipse.org/eclipse/updates/3.6/' type='1' options='0'/> + <repository uri='https://download.eclipse.org/eclipse/updates/3.5/' url='https://download.eclipse.org/eclipse/updates/3.5/' type='0' options='0'/> + <repository uri='https://download.eclipse.org/eclipse/updates/3.5/' url='https://download.eclipse.org/eclipse/updates/3.5/' type='1' options='0'/> + <repository uri='https://download.eclipse.org/eclipse/updates/3.6/' url='https://download.eclipse.org/eclipse/updates/3.6/' type='0' options='0'/> + <repository uri='https://download.eclipse.org/eclipse/updates/3.6/' url='https://download.eclipse.org/eclipse/updates/3.6/' type='1' options='0'/> </references> <units size='8'> <unit id='helloworldfeature.feature.jar' version='1.0.1'> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pausefeature/artifacts.xml b/bundles/org.eclipse.equinox.p2.tests/testData/pausefeature/artifacts.xml index baf533cae..a9f083ecd 100644 --- a/bundles/org.eclipse.equinox.p2.tests/testData/pausefeature/artifacts.xml +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pausefeature/artifacts.xml @@ -12,14 +12,14 @@ </properties> <mappings size='5'> <rule filter='(& (classifier=osgi.bundle) (format=packed))' - output='http://download.eclipse.org/eclipse/updates/3.7/R-3.7.2-201202080800/plugins/${id}_${version}.jar.pack.gz' /> - <rule filter='(& (classifier=osgi.bundle))' output='http://download.eclipse.org/eclipse/updates/3.7/R-3.7.2-201202080800/plugins/${id}_${version}.jar' /> - <rule filter='(& (classifier=binary))' output='http://download.eclipse.org/eclipse/updates/3.7/R-3.7.2-201202080800/binary/${id}_${version}' /> + output='https://download.eclipse.org/eclipse/updates/3.7/R-3.7.2-201202080800/plugins/${id}_${version}.jar.pack.gz' /> + <rule filter='(& (classifier=osgi.bundle))' output='https://download.eclipse.org/eclipse/updates/3.7/R-3.7.2-201202080800/plugins/${id}_${version}.jar' /> + <rule filter='(& (classifier=binary))' output='https://download.eclipse.org/eclipse/updates/3.7/R-3.7.2-201202080800/binary/${id}_${version}' /> <rule filter='(& (classifier=org.eclipse.update.feature) (format=packed))' - output='http://download.eclipse.org/eclipse/updates/3.7/R-3.7.2-201202080800/features/${id}_${version}.jar.pack.gz' /> + output='https://download.eclipse.org/eclipse/updates/3.7/R-3.7.2-201202080800/features/${id}_${version}.jar.pack.gz' /> <rule filter='(& (classifier=org.eclipse.update.feature))' - output='http://download.eclipse.org/eclipse/updates/3.7/R-3.7.2-201202080800/features/${id}_${version}.jar' /> + output='https://download.eclipse.org/eclipse/updates/3.7/R-3.7.2-201202080800/features/${id}_${version}.jar' /> </mappings> <artifacts size='13433'> <artifact classifier='binary' diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/artifacts.xml b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/artifacts.xml new file mode 100644 index 000000000..2ffef6a9f --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/artifacts.xml @@ -0,0 +1,36 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?artifactRepository version='1.1.0'?> +<repository name='file:/home/mistria/sandbox/repo/ - artifacts' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1'> + <properties size='2'> + <property name='p2.timestamp' value='1618433231272'/> + <property name='p2.compressed' value='false'/> + <!-- See PGPSignatureVerifierTest about this public key--> + </properties> + <mappings size='3'> + <rule filter='(& (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/> + <rule filter='(& (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/> + <rule filter='(& (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/> + </mappings> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='blah' version='1.0.0.123456'> + <properties size='1'> + <!-- gpg -u signer1@fakeuser.eclipse.org -a -detach-sig plugins/blah_1.0.0.123456.jar --> + <property name='pgp.signatures' value='-----BEGIN PGP SIGNATURE----- + +iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB4Bf8dHHNpZ25lcjFA +ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfBPuAwAhE4zA7BswKFhEtzm +DS3EbyRr/U13sV01YxqGtxYDCfrOt8TGVPXJSvo0AVP4vLFc5b+0jtVFoarFJNBu +xhbVuyC72YdqudNbncSlW6KG5SgeWIM//ThKfl95pOWRWvJEoKJhmDwbDqhZYtL5 +SECegnWGtGx/klFtZihzHYJE/nfSnhySDaz5lCvXFFYRhIbNmNm2Yq7ztCOsN4Ys +3uN+GEdoXGvv1DFg/xZPvwCOhZGsSQfkl1jmUwVltgKrw9OCFbdfYz7H6dbGWhRu +2XpuKxPXGavKfpSvssVQIZ6aWi5W6wp5lZAQQddZvYAv3Gi5CZZcUT7ayFJYdD23 +p9jz76G7MXm0f0uNT9B57T72QryokUIEIJYsCb6lNjWUQB4cd0+JesM7sHwweOQ3 +7iTFc+WgVJkP0e695mm1tcvtQHUPbIItYJUsndyLgGInzglxN8+F4U4k8uapydI9 +RmV2NVAifYp8z95Am5AnlG8lqjwrWk5bMbJH82QsQESrNT/h +=8Vrn +-----END PGP SIGNATURE----- +'/> + </properties> + </artifact> + </artifacts> +</repository> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/content.xml b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/content.xml new file mode 100644 index 000000000..db8f67ba2 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/content.xml @@ -0,0 +1,49 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?metadataRepository version='1.2.0'?> +<repository name='file:/home/mistria/sandbox/repo/ - metadata' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1'> + <properties size='2'> + <property name='p2.timestamp' value='1618433231272'/> + <property name='p2.compressed' value='false'/> + </properties> + <units size='2'> + <unit id='blah' version='1.0.0.123456' singleton='false'> + <update id='blah' range='[0.0.0,1.0.0.123456)' severity='0'/> + <provides size='4'> + <provided namespace='org.eclipse.equinox.p2.iu' name='blah' version='1.0.0.123456'/> + <provided namespace='osgi.bundle' name='blah' version='1.0.0.123456'/> + <provided namespace='osgi.identity' name='blah' version='1.0.0.123456'> + <properties size='1'> + <property name='type' value='osgi.bundle'/> + </properties> + </provided> + <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/> + </provides> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='blah' version='1.0.0.123456'/> + </artifacts> + <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/> + <touchpointData size='1'> + <instructions size='2'> + <instruction key='zipped'> + true + </instruction> + <instruction key='manifest'> + Bundle-SymbolicName: blah
Bundle-Version: 1.0.0.qualifier
 + </instruction> + </instructions> + </touchpointData> + </unit> + <unit id='Category' version='0.0.0'> + <properties size='3'> + <property name='org.eclipse.equinox.p2.type.category' value='true'/> + </properties> + <provides size='1'> + <provided namespace='org.eclipse.equinox.p2.iu' name='Category' version='0.0.0'/> + </provides> + <requires size='1'> + <required namespace='org.eclipse.equinox.p2.iu' name='blah' range='[1.0.0.123456,1.0.0.123456]'/> + </requires> + <touchpoint id='null' version='0.0.0'/> + </unit> + </units> +</repository> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/plugins/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/plugins/META-INF/MANIFEST.MF new file mode 100644 index 000000000..b9fdcbf2f --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/plugins/META-INF/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: blah +Bundle-Version: 1.0.0.qualifier diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/plugins/blah_1.0.0.123456.jar b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/plugins/blah_1.0.0.123456.jar Binary files differnew file mode 100644 index 000000000..9cc7b8da0 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/plugins/blah_1.0.0.123456.jar diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/plugins/blah_1.0.0.123456.jar.asc b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/plugins/blah_1.0.0.123456.jar.asc new file mode 100644 index 000000000..1489f2552 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoMissingPublicKey/plugins/blah_1.0.0.123456.jar.asc @@ -0,0 +1,14 @@ +-----BEGIN PGP SIGNATURE----- + +iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB4Bf8dHHNpZ25lcjFA +ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfBPuAwAhE4zA7BswKFhEtzm +DS3EbyRr/U13sV01YxqGtxYDCfrOt8TGVPXJSvo0AVP4vLFc5b+0jtVFoarFJNBu +xhbVuyC72YdqudNbncSlW6KG5SgeWIM//ThKfl95pOWRWvJEoKJhmDwbDqhZYtL5 +SECegnWGtGx/klFtZihzHYJE/nfSnhySDaz5lCvXFFYRhIbNmNm2Yq7ztCOsN4Ys +3uN+GEdoXGvv1DFg/xZPvwCOhZGsSQfkl1jmUwVltgKrw9OCFbdfYz7H6dbGWhRu +2XpuKxPXGavKfpSvssVQIZ6aWi5W6wp5lZAQQddZvYAv3Gi5CZZcUT7ayFJYdD23 +p9jz76G7MXm0f0uNT9B57T72QryokUIEIJYsCb6lNjWUQB4cd0+JesM7sHwweOQ3 +7iTFc+WgVJkP0e695mm1tcvtQHUPbIItYJUsndyLgGInzglxN8+F4U4k8uapydI9 +RmV2NVAifYp8z95Am5AnlG8lqjwrWk5bMbJH82QsQESrNT/h +=8Vrn +-----END PGP SIGNATURE----- diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/artifacts.xml b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/artifacts.xml new file mode 100644 index 000000000..68b911bfa --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/artifacts.xml @@ -0,0 +1,16 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?artifactRepository version='1.1.0'?> +<repository name='file:/home/mistria/sandbox/repo/ - artifacts' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1'> + <properties size='2'> + <property name='p2.timestamp' value='1618433231272'/> + <property name='p2.compressed' value='false'/> + </properties> + <mappings size='3'> + <rule filter='(& (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/> + <rule filter='(& (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/> + <rule filter='(& (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/> + </mappings> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='blah' version='1.0.0.123456'/> + </artifacts> +</repository> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/content.xml b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/content.xml new file mode 100644 index 000000000..db8f67ba2 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/content.xml @@ -0,0 +1,49 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?metadataRepository version='1.2.0'?> +<repository name='file:/home/mistria/sandbox/repo/ - metadata' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1'> + <properties size='2'> + <property name='p2.timestamp' value='1618433231272'/> + <property name='p2.compressed' value='false'/> + </properties> + <units size='2'> + <unit id='blah' version='1.0.0.123456' singleton='false'> + <update id='blah' range='[0.0.0,1.0.0.123456)' severity='0'/> + <provides size='4'> + <provided namespace='org.eclipse.equinox.p2.iu' name='blah' version='1.0.0.123456'/> + <provided namespace='osgi.bundle' name='blah' version='1.0.0.123456'/> + <provided namespace='osgi.identity' name='blah' version='1.0.0.123456'> + <properties size='1'> + <property name='type' value='osgi.bundle'/> + </properties> + </provided> + <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/> + </provides> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='blah' version='1.0.0.123456'/> + </artifacts> + <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/> + <touchpointData size='1'> + <instructions size='2'> + <instruction key='zipped'> + true + </instruction> + <instruction key='manifest'> + Bundle-SymbolicName: blah
Bundle-Version: 1.0.0.qualifier
 + </instruction> + </instructions> + </touchpointData> + </unit> + <unit id='Category' version='0.0.0'> + <properties size='3'> + <property name='org.eclipse.equinox.p2.type.category' value='true'/> + </properties> + <provides size='1'> + <provided namespace='org.eclipse.equinox.p2.iu' name='Category' version='0.0.0'/> + </provides> + <requires size='1'> + <required namespace='org.eclipse.equinox.p2.iu' name='blah' range='[1.0.0.123456,1.0.0.123456]'/> + </requires> + <touchpoint id='null' version='0.0.0'/> + </unit> + </units> +</repository> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/plugins/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/plugins/META-INF/MANIFEST.MF new file mode 100644 index 000000000..b9fdcbf2f --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/plugins/META-INF/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: blah +Bundle-Version: 1.0.0.qualifier diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/plugins/blah_1.0.0.123456.jar b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/plugins/blah_1.0.0.123456.jar Binary files differnew file mode 100644 index 000000000..9cc7b8da0 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/plugins/blah_1.0.0.123456.jar diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/plugins/blah_1.0.0.123456.jar.asc b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/plugins/blah_1.0.0.123456.jar.asc new file mode 100644 index 000000000..1489f2552 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoNoPGP/plugins/blah_1.0.0.123456.jar.asc @@ -0,0 +1,14 @@ +-----BEGIN PGP SIGNATURE----- + +iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB4Bf8dHHNpZ25lcjFA +ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfBPuAwAhE4zA7BswKFhEtzm +DS3EbyRr/U13sV01YxqGtxYDCfrOt8TGVPXJSvo0AVP4vLFc5b+0jtVFoarFJNBu +xhbVuyC72YdqudNbncSlW6KG5SgeWIM//ThKfl95pOWRWvJEoKJhmDwbDqhZYtL5 +SECegnWGtGx/klFtZihzHYJE/nfSnhySDaz5lCvXFFYRhIbNmNm2Yq7ztCOsN4Ys +3uN+GEdoXGvv1DFg/xZPvwCOhZGsSQfkl1jmUwVltgKrw9OCFbdfYz7H6dbGWhRu +2XpuKxPXGavKfpSvssVQIZ6aWi5W6wp5lZAQQddZvYAv3Gi5CZZcUT7ayFJYdD23 +p9jz76G7MXm0f0uNT9B57T72QryokUIEIJYsCb6lNjWUQB4cd0+JesM7sHwweOQ3 +7iTFc+WgVJkP0e695mm1tcvtQHUPbIItYJUsndyLgGInzglxN8+F4U4k8uapydI9 +RmV2NVAifYp8z95Am5AnlG8lqjwrWk5bMbJH82QsQESrNT/h +=8Vrn +-----END PGP SIGNATURE----- diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/artifacts.xml b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/artifacts.xml new file mode 100644 index 000000000..4ddbddbb3 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/artifacts.xml @@ -0,0 +1,78 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?artifactRepository version='1.1.0'?> +<repository name='file:/home/mistria/sandbox/repo/ - artifacts' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1'> + <properties size='3'> + <property name='p2.timestamp' value='1618433231272'/> + <property name='p2.compressed' value='false'/> + <!-- See PGPSignatureVerifierTest about this public key--> + <property name='pgp.publicKeys' value='-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQGNBGB1bugBDADQ5l7YnS9hNFRkBKSrvVNHt/TxeHaNNIHkdTC56I1QdThsOt4Y +oQRI27AEOaY1GFEi6+QqwxALcMMMSTgkCRs2NFGqlWMVzNYE7bJMWChVa7uQ/9CG +1HRbXwVwQx3hFgU4kmw1Kl/IH4LX76d9gAMyFANPjYZJSjbAv54wOlKruDRgpQFF +pZeuXW7SnerL6sgd/+ZroikdkrjIs5t18C2ofzf6YnOokYkEEJSAEoQK5svVzT4G +H3sw6FlE41RvnYKpuhvvyQhKjISDYfRaIL4JIpvR9Uko48eN9x654lJaucbMiLP4 +ROI9q7RQ6t1IMCiIN9QKgS+nVtHnN9MnXS0czGxfLdStv6bB+xgUoyBc7Uiqf4X0 +x8z9PE6O1L6Rgy2JMJHPgLWCF8h/u1FO88Br3I7TMzu2q/cg3k18L7eujnxVyYiD +YIMxDBXBNnGCKRC4shgt8e+PzAPXIDFvbv7HOaERnx5c6eLl0tD12ocQeZHp1VlW +nQteQ6CfvN07dNUAEQEAAbQ3RWNsaXBzZSBwMiB0ZXN0IFNpZ25lciAxIDxzaWdu +ZXIxQGZha2V1c2VyLmVjbGlwc2Uub3JnPokB1AQTAQgAPhYhBOmWxnCqf2VAm/Xb +VhOeONkN7RHwBQJgdW7oAhsDBQkDwmcABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA +AAoJEBOeONkN7RHwuXYL/Ri2gHoXELN79dWnuC5hjh7XgKquqlZg3qLgkLyA/54/ +ERx7HLLMHjU5tVIVacZ9UWb30Bzx6iVx2hMtL/0FFJ1S0iwwTDXft/9EoPvsmmEx +VYEiSx5HxsPXM+XofMvi75nN34iMUIU3SgKLzHqlWcC3T7XjDWKC8TkTcutIAaIz +BMRssktJR3OYzWbbwzgz83sVpofWGfxIW91H19Zr8rjIXiNyy1ulRnfsaz+xXeXf +KxZZs00FtIIOeWBhCtsb8/8Uv3FRDK6+lX3xAqfMG67azJXpFafWJGiymypfSwi6 +JA866WOzw9DfbqWIlY/EMIhyZrsWnGiGhhAavwOiSWYV65ooFYooKHNmIekpvRZS +wlGuwvnZr+2471urkCoG8Yz2Ey28Qjc0NgXlXAkqFUkO2gNPFsXkk1EC+vzO2llp +qROS9pt25dEBcUSgfcjFOFWv2Z5IdmGjFEe46CJNEVzNgkP+97wJP7wpcOCSF/nn +eOBj4b7Q0suJ+MsE/Fx6SbkBjQRgdW7oAQwAst4QGHd9w+V3UHgRMYZISfYApcAK +2qBT1Zvf01QE38JUtDPKJarDlgxcaXuX6jOcbF60OMd59dhNmpaZYpocJZMgnESj +0/Tn4cZfWwtOo1Pom8Lbg1zGKIYAaR2mTb8mkCwJwsZCUZCmh+zspacxdVRdmWmC +XcFxFc/6gBKxcPFZf93JZaI33qsLpxyA57AJV5ck/TY1iFmA6HFxehamsAVdd56g +uyORekJJlZHXE9pICVEGqVUfdbSQXEiS386kZDftXe36phdj1gtFsRLHoBI8+L7o +2vrdnj1UZgtvxBbJJ+QAfhF8+f84RFIi9CTY8cheX+YfDMEdg9J9LG54X5P3O1ZX +eEvudKk/hqWBf+2rrdkhdFyyGRK0yTrO+PQ+tZHhcHPqfo4EiVktC4BTpB6QtLBY +NAGYMRddmZMgp4lE2xGib8SYwonct3y1fmB+x67lq65IFVM/IAwN6BuMXtgb+Zkm +iT+eKgc1pK4uCsZJbQAlPzkDGQV69GNyjlphABEBAAGJAbwEGAEIACYWIQTplsZw +qn9lQJv121YTnjjZDe0R8AUCYHVu6AIbDAUJA8JnAAAKCRATnjjZDe0R8Oe8DADQ +CTBXxrmTJTSZUeKVo0C1kDHQaaV+RiRmquYR3WxFI6ugJFFWpzgG9V8Q7vYGeZFM +HYM/tDuY/gdMwHBcR13yYyozslar7qas4LL/bYgOqq+SiSGTDEBW+00+5Wlwmlrv +ubLc6ow9q2sTmOprq3Q7fei+sEANVnymBxnVV/ZIVGPpm/Rkh1JFGT/8SEyKkCut +G23JMM/06cIhZwdD6aWSZK4EFw0lwfXyr8l3ZqH0WydVEef1DUNIRM48O0YdwS9u +jd5iKKKJlb4XxwGi6IKSzpXF7pFrm6vqS306u3Fnak5hb2gs8dpnNo7UL1gUm5pr +8vJ3xhg15KCjYKz8k6ZDsIWULTXUJ23i8ZwqyQaj1bajwN0+/MfC0ZkoQtQ2I/TH +cKLSMOR+Tji6n7FjOcVl6VoDKTjdxj9OgAlbZ7W9jEArrUjDdCk/m4jq9h9phpli +BHoul/nauwtlUnQes1V+39Rk9l7gddKWg3dlwg6CjB5MkmcaeyxgANcyKgrunpg= +=JYpC +-----END PGP PUBLIC KEY BLOCK----- +'/> + </properties> + <mappings size='3'> + <rule filter='(& (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/> + <rule filter='(& (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/> + <rule filter='(& (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/> + </mappings> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='blah' version='1.0.0.123456'> + <properties size='1'> + <!-- gpg -u signer1@fakeuser.eclipse.org -a -detach-sig plugins/blah_1.0.0.123456.jar --> + <property name='pgp.signatures' value='-----BEGIN PGP SIGNATURE----- + +iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB4Bf8dHHNpZ25lcjFA +ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfBPuAwAhE4zA7BswKFhEtzm +DS3EbyRr/U13sV01YxqGtxYDCfrOt8TGVPXJSvo0AVP4vLFc5b+0jtVFoarFJNBu +xhbVuyC72YdqudNbncSlW6KG5SgeWIM//ThKfl95pOWRWvJEoKJhmDwbDqhZYtL5 +SECegnWGtGx/klFtZihzHYJE/nfSnhySDaz5lCvXFFYRhIbNmNm2Yq7ztCOsN4Ys +3uN+GEdoXGvv1DFg/xZPvwCOhZGsSQfkl1jmUwVltgKrw9OCFbdfYz7H6dbGWhRu +2XpuKxPXGavKfpSvssVQIZ6aWi5W6wp5lZAQQddZvYAv3Gi5CZZcUT7ayFJYdD23 +p9jz76G7MXm0f0uNT9B57T72QryokUIEIJYsCb6lNjWUQB4cd0+JesM7sHwweOQ3 +7iTFc+WgVJkP0e695mm1tcvtQHUPbIItYJUsndyLgGInzglxN8+F4U4k8uapydI9 +RmV2NVAifYp8z95Am5AnlG8lqjwrWk5bMbJH82QsQESrNT/h +=8Vrn +-----END PGP SIGNATURE----- +'/> + </properties> + </artifact> + </artifacts> +</repository> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/content.xml b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/content.xml new file mode 100644 index 000000000..db8f67ba2 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/content.xml @@ -0,0 +1,49 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?metadataRepository version='1.2.0'?> +<repository name='file:/home/mistria/sandbox/repo/ - metadata' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1'> + <properties size='2'> + <property name='p2.timestamp' value='1618433231272'/> + <property name='p2.compressed' value='false'/> + </properties> + <units size='2'> + <unit id='blah' version='1.0.0.123456' singleton='false'> + <update id='blah' range='[0.0.0,1.0.0.123456)' severity='0'/> + <provides size='4'> + <provided namespace='org.eclipse.equinox.p2.iu' name='blah' version='1.0.0.123456'/> + <provided namespace='osgi.bundle' name='blah' version='1.0.0.123456'/> + <provided namespace='osgi.identity' name='blah' version='1.0.0.123456'> + <properties size='1'> + <property name='type' value='osgi.bundle'/> + </properties> + </provided> + <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/> + </provides> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='blah' version='1.0.0.123456'/> + </artifacts> + <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/> + <touchpointData size='1'> + <instructions size='2'> + <instruction key='zipped'> + true + </instruction> + <instruction key='manifest'> + Bundle-SymbolicName: blah
Bundle-Version: 1.0.0.qualifier
 + </instruction> + </instructions> + </touchpointData> + </unit> + <unit id='Category' version='0.0.0'> + <properties size='3'> + <property name='org.eclipse.equinox.p2.type.category' value='true'/> + </properties> + <provides size='1'> + <provided namespace='org.eclipse.equinox.p2.iu' name='Category' version='0.0.0'/> + </provides> + <requires size='1'> + <required namespace='org.eclipse.equinox.p2.iu' name='blah' range='[1.0.0.123456,1.0.0.123456]'/> + </requires> + <touchpoint id='null' version='0.0.0'/> + </unit> + </units> +</repository> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/plugins/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/plugins/META-INF/MANIFEST.MF new file mode 100644 index 000000000..b9fdcbf2f --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/plugins/META-INF/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: blah +Bundle-Version: 1.0.0.qualifier diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/plugins/blah_1.0.0.123456.jar b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/plugins/blah_1.0.0.123456.jar Binary files differnew file mode 100644 index 000000000..9cc7b8da0 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/plugins/blah_1.0.0.123456.jar diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/plugins/blah_1.0.0.123456.jar.asc b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/plugins/blah_1.0.0.123456.jar.asc new file mode 100644 index 000000000..1489f2552 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK/plugins/blah_1.0.0.123456.jar.asc @@ -0,0 +1,14 @@ +-----BEGIN PGP SIGNATURE----- + +iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB4Bf8dHHNpZ25lcjFA +ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfBPuAwAhE4zA7BswKFhEtzm +DS3EbyRr/U13sV01YxqGtxYDCfrOt8TGVPXJSvo0AVP4vLFc5b+0jtVFoarFJNBu +xhbVuyC72YdqudNbncSlW6KG5SgeWIM//ThKfl95pOWRWvJEoKJhmDwbDqhZYtL5 +SECegnWGtGx/klFtZihzHYJE/nfSnhySDaz5lCvXFFYRhIbNmNm2Yq7ztCOsN4Ys +3uN+GEdoXGvv1DFg/xZPvwCOhZGsSQfkl1jmUwVltgKrw9OCFbdfYz7H6dbGWhRu +2XpuKxPXGavKfpSvssVQIZ6aWi5W6wp5lZAQQddZvYAv3Gi5CZZcUT7ayFJYdD23 +p9jz76G7MXm0f0uNT9B57T72QryokUIEIJYsCb6lNjWUQB4cd0+JesM7sHwweOQ3 +7iTFc+WgVJkP0e695mm1tcvtQHUPbIItYJUsndyLgGInzglxN8+F4U4k8uapydI9 +RmV2NVAifYp8z95Am5AnlG8lqjwrWk5bMbJH82QsQESrNT/h +=8Vrn +-----END PGP SIGNATURE----- diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/artifacts.xml b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/artifacts.xml new file mode 100644 index 000000000..43557706b --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/artifacts.xml @@ -0,0 +1,25 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?artifactRepository version='1.1.0'?> +<repository name='file:/home/mistria/sandbox/repo/ - artifacts' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1'> + <properties size='3'> + <property name='p2.timestamp' value='1618433231272'/> + <property name='p2.compressed' value='false'/> + <!-- See PGPSignatureVerifierTest about this public key --> + <!-- encoded with org.eclipse.equinox.internal.p2.persistence.XMLWriter.escape() --> + <property name='pgp.publicKeys' value='-----BEGIN PGP PUBLIC KEY BLOCK-----

mQGNBGB1bugBDADQ5l7YnS9hNFRkBKSrvVNHt/TxeHaNNIHkdTC56I1QdThsOt4Y
oQRI27AEOaY1GFEi6+QqwxALcMMMSTgkCRs2NFGqlWMVzNYE7bJMWChVa7uQ/9CG
1HRbXwVwQx3hFgU4kmw1Kl/IH4LX76d9gAMyFANPjYZJSjbAv54wOlKruDRgpQFF
pZeuXW7SnerL6sgd/+ZroikdkrjIs5t18C2ofzf6YnOokYkEEJSAEoQK5svVzT4G
H3sw6FlE41RvnYKpuhvvyQhKjISDYfRaIL4JIpvR9Uko48eN9x654lJaucbMiLP4
ROI9q7RQ6t1IMCiIN9QKgS+nVtHnN9MnXS0czGxfLdStv6bB+xgUoyBc7Uiqf4X0
x8z9PE6O1L6Rgy2JMJHPgLWCF8h/u1FO88Br3I7TMzu2q/cg3k18L7eujnxVyYiD
YIMxDBXBNnGCKRC4shgt8e+PzAPXIDFvbv7HOaERnx5c6eLl0tD12ocQeZHp1VlW
nQteQ6CfvN07dNUAEQEAAbQ3RWNsaXBzZSBwMiB0ZXN0IFNpZ25lciAxIDxzaWdu
ZXIxQGZha2V1c2VyLmVjbGlwc2Uub3JnPokB1AQTAQgAPhYhBOmWxnCqf2VAm/Xb
VhOeONkN7RHwBQJgdW7oAhsDBQkDwmcABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA
AAoJEBOeONkN7RHwuXYL/Ri2gHoXELN79dWnuC5hjh7XgKquqlZg3qLgkLyA/54/
ERx7HLLMHjU5tVIVacZ9UWb30Bzx6iVx2hMtL/0FFJ1S0iwwTDXft/9EoPvsmmEx
VYEiSx5HxsPXM+XofMvi75nN34iMUIU3SgKLzHqlWcC3T7XjDWKC8TkTcutIAaIz
BMRssktJR3OYzWbbwzgz83sVpofWGfxIW91H19Zr8rjIXiNyy1ulRnfsaz+xXeXf
KxZZs00FtIIOeWBhCtsb8/8Uv3FRDK6+lX3xAqfMG67azJXpFafWJGiymypfSwi6
JA866WOzw9DfbqWIlY/EMIhyZrsWnGiGhhAavwOiSWYV65ooFYooKHNmIekpvRZS
wlGuwvnZr+2471urkCoG8Yz2Ey28Qjc0NgXlXAkqFUkO2gNPFsXkk1EC+vzO2llp
qROS9pt25dEBcUSgfcjFOFWv2Z5IdmGjFEe46CJNEVzNgkP+97wJP7wpcOCSF/nn
eOBj4b7Q0suJ+MsE/Fx6SbkBjQRgdW7oAQwAst4QGHd9w+V3UHgRMYZISfYApcAK
2qBT1Zvf01QE38JUtDPKJarDlgxcaXuX6jOcbF60OMd59dhNmpaZYpocJZMgnESj
0/Tn4cZfWwtOo1Pom8Lbg1zGKIYAaR2mTb8mkCwJwsZCUZCmh+zspacxdVRdmWmC
XcFxFc/6gBKxcPFZf93JZaI33qsLpxyA57AJV5ck/TY1iFmA6HFxehamsAVdd56g
uyORekJJlZHXE9pICVEGqVUfdbSQXEiS386kZDftXe36phdj1gtFsRLHoBI8+L7o
2vrdnj1UZgtvxBbJJ+QAfhF8+f84RFIi9CTY8cheX+YfDMEdg9J9LG54X5P3O1ZX
eEvudKk/hqWBf+2rrdkhdFyyGRK0yTrO+PQ+tZHhcHPqfo4EiVktC4BTpB6QtLBY
NAGYMRddmZMgp4lE2xGib8SYwonct3y1fmB+x67lq65IFVM/IAwN6BuMXtgb+Zkm
iT+eKgc1pK4uCsZJbQAlPzkDGQV69GNyjlphABEBAAGJAbwEGAEIACYWIQTplsZw
qn9lQJv121YTnjjZDe0R8AUCYHVu6AIbDAUJA8JnAAAKCRATnjjZDe0R8Oe8DADQ
CTBXxrmTJTSZUeKVo0C1kDHQaaV+RiRmquYR3WxFI6ugJFFWpzgG9V8Q7vYGeZFM
HYM/tDuY/gdMwHBcR13yYyozslar7qas4LL/bYgOqq+SiSGTDEBW+00+5Wlwmlrv
ubLc6ow9q2sTmOprq3Q7fei+sEANVnymBxnVV/ZIVGPpm/Rkh1JFGT/8SEyKkCut
G23JMM/06cIhZwdD6aWSZK4EFw0lwfXyr8l3ZqH0WydVEef1DUNIRM48O0YdwS9u
jd5iKKKJlb4XxwGi6IKSzpXF7pFrm6vqS306u3Fnak5hb2gs8dpnNo7UL1gUm5pr
8vJ3xhg15KCjYKz8k6ZDsIWULTXUJ23i8ZwqyQaj1bajwN0+/MfC0ZkoQtQ2I/TH
cKLSMOR+Tji6n7FjOcVl6VoDKTjdxj9OgAlbZ7W9jEArrUjDdCk/m4jq9h9phpli
BHoul/nauwtlUnQes1V+39Rk9l7gddKWg3dlwg6CjB5MkmcaeyxgANcyKgrunpg=
=JYpC
-----END PGP PUBLIC KEY BLOCK-----
'/> + </properties> + <mappings size='3'> + <rule filter='(& (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/> + <rule filter='(& (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/> + <rule filter='(& (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/> + </mappings> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='blah' version='1.0.0.123456'> + <properties size='1'> + <!-- gpg -u signer1@fakeuser.eclipse.org -a -detach-sig plugins/blah_1.0.0.123456.jar --> + <!-- encoded with org.eclipse.equinox.internal.p2.persistence.XMLWriter.escape() --> + <property name='pgp.signatures' value='-----BEGIN PGP SIGNATURE-----

iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB4Bf8dHHNpZ25lcjFA
ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfBPuAwAhE4zA7BswKFhEtzm
DS3EbyRr/U13sV01YxqGtxYDCfrOt8TGVPXJSvo0AVP4vLFc5b+0jtVFoarFJNBu
xhbVuyC72YdqudNbncSlW6KG5SgeWIM//ThKfl95pOWRWvJEoKJhmDwbDqhZYtL5
SECegnWGtGx/klFtZihzHYJE/nfSnhySDaz5lCvXFFYRhIbNmNm2Yq7ztCOsN4Ys
3uN+GEdoXGvv1DFg/xZPvwCOhZGsSQfkl1jmUwVltgKrw9OCFbdfYz7H6dbGWhRu
2XpuKxPXGavKfpSvssVQIZ6aWi5W6wp5lZAQQddZvYAv3Gi5CZZcUT7ayFJYdD23
p9jz76G7MXm0f0uNT9B57T72QryokUIEIJYsCb6lNjWUQB4cd0+JesM7sHwweOQ3
7iTFc+WgVJkP0e695mm1tcvtQHUPbIItYJUsndyLgGInzglxN8+F4U4k8uapydI9
RmV2NVAifYp8z95Am5AnlG8lqjwrWk5bMbJH82QsQESrNT/h
=8Vrn
-----END PGP SIGNATURE-----
'/> + </properties> + </artifact> + </artifacts> +</repository> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/content.xml b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/content.xml new file mode 100644 index 000000000..db8f67ba2 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/content.xml @@ -0,0 +1,49 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?metadataRepository version='1.2.0'?> +<repository name='file:/home/mistria/sandbox/repo/ - metadata' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1'> + <properties size='2'> + <property name='p2.timestamp' value='1618433231272'/> + <property name='p2.compressed' value='false'/> + </properties> + <units size='2'> + <unit id='blah' version='1.0.0.123456' singleton='false'> + <update id='blah' range='[0.0.0,1.0.0.123456)' severity='0'/> + <provides size='4'> + <provided namespace='org.eclipse.equinox.p2.iu' name='blah' version='1.0.0.123456'/> + <provided namespace='osgi.bundle' name='blah' version='1.0.0.123456'/> + <provided namespace='osgi.identity' name='blah' version='1.0.0.123456'> + <properties size='1'> + <property name='type' value='osgi.bundle'/> + </properties> + </provided> + <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/> + </provides> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='blah' version='1.0.0.123456'/> + </artifacts> + <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/> + <touchpointData size='1'> + <instructions size='2'> + <instruction key='zipped'> + true + </instruction> + <instruction key='manifest'> + Bundle-SymbolicName: blah
Bundle-Version: 1.0.0.qualifier
 + </instruction> + </instructions> + </touchpointData> + </unit> + <unit id='Category' version='0.0.0'> + <properties size='3'> + <property name='org.eclipse.equinox.p2.type.category' value='true'/> + </properties> + <provides size='1'> + <provided namespace='org.eclipse.equinox.p2.iu' name='Category' version='0.0.0'/> + </provides> + <requires size='1'> + <required namespace='org.eclipse.equinox.p2.iu' name='blah' range='[1.0.0.123456,1.0.0.123456]'/> + </requires> + <touchpoint id='null' version='0.0.0'/> + </unit> + </units> +</repository> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/plugins/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/plugins/META-INF/MANIFEST.MF new file mode 100644 index 000000000..b9fdcbf2f --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/plugins/META-INF/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: blah +Bundle-Version: 1.0.0.qualifier diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/plugins/blah_1.0.0.123456.jar b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/plugins/blah_1.0.0.123456.jar Binary files differnew file mode 100644 index 000000000..9cc7b8da0 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/plugins/blah_1.0.0.123456.jar diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/plugins/blah_1.0.0.123456.jar.asc b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/plugins/blah_1.0.0.123456.jar.asc new file mode 100644 index 000000000..1489f2552 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoPGPOK_encoded/plugins/blah_1.0.0.123456.jar.asc @@ -0,0 +1,14 @@ +-----BEGIN PGP SIGNATURE----- + +iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB4Bf8dHHNpZ25lcjFA +ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfBPuAwAhE4zA7BswKFhEtzm +DS3EbyRr/U13sV01YxqGtxYDCfrOt8TGVPXJSvo0AVP4vLFc5b+0jtVFoarFJNBu +xhbVuyC72YdqudNbncSlW6KG5SgeWIM//ThKfl95pOWRWvJEoKJhmDwbDqhZYtL5 +SECegnWGtGx/klFtZihzHYJE/nfSnhySDaz5lCvXFFYRhIbNmNm2Yq7ztCOsN4Ys +3uN+GEdoXGvv1DFg/xZPvwCOhZGsSQfkl1jmUwVltgKrw9OCFbdfYz7H6dbGWhRu +2XpuKxPXGavKfpSvssVQIZ6aWi5W6wp5lZAQQddZvYAv3Gi5CZZcUT7ayFJYdD23 +p9jz76G7MXm0f0uNT9B57T72QryokUIEIJYsCb6lNjWUQB4cd0+JesM7sHwweOQ3 +7iTFc+WgVJkP0e695mm1tcvtQHUPbIItYJUsndyLgGInzglxN8+F4U4k8uapydI9 +RmV2NVAifYp8z95Am5AnlG8lqjwrWk5bMbJH82QsQESrNT/h +=8Vrn +-----END PGP SIGNATURE----- diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/artifacts.xml b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/artifacts.xml new file mode 100644 index 000000000..67aec85fb --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/artifacts.xml @@ -0,0 +1,78 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?artifactRepository version='1.1.0'?> +<repository name='file:/home/mistria/sandbox/repo/ - artifacts' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1'> + <properties size='3'> + <property name='p2.timestamp' value='1618433231272'/> + <property name='p2.compressed' value='false'/> + <!-- See PGPSignatureVerifierTest about this public key--> + <property name='pgp.publicKeys' value='-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQGNBGB1bugBDADQ5l7YnS9hNFRkBKSrvVNHt/TxeHaNNIHkdTC56I1QdThsOt4Y +oQRI27AEOaY1GFEi6+QqwxALcMMMSTgkCRs2NFGqlWMVzNYE7bJMWChVa7uQ/9CG +1HRbXwVwQx3hFgU4kmw1Kl/IH4LX76d9gAMyFANPjYZJSjbAv54wOlKruDRgpQFF +pZeuXW7SnerL6sgd/+ZroikdkrjIs5t18C2ofzf6YnOokYkEEJSAEoQK5svVzT4G +H3sw6FlE41RvnYKpuhvvyQhKjISDYfRaIL4JIpvR9Uko48eN9x654lJaucbMiLP4 +ROI9q7RQ6t1IMCiIN9QKgS+nVtHnN9MnXS0czGxfLdStv6bB+xgUoyBc7Uiqf4X0 +x8z9PE6O1L6Rgy2JMJHPgLWCF8h/u1FO88Br3I7TMzu2q/cg3k18L7eujnxVyYiD +YIMxDBXBNnGCKRC4shgt8e+PzAPXIDFvbv7HOaERnx5c6eLl0tD12ocQeZHp1VlW +nQteQ6CfvN07dNUAEQEAAbQ3RWNsaXBzZSBwMiB0ZXN0IFNpZ25lciAxIDxzaWdu +ZXIxQGZha2V1c2VyLmVjbGlwc2Uub3JnPokB1AQTAQgAPhYhBOmWxnCqf2VAm/Xb +VhOeONkN7RHwBQJgdW7oAhsDBQkDwmcABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA +AAoJEBOeONkN7RHwuXYL/Ri2gHoXELN79dWnuC5hjh7XgKquqlZg3qLgkLyA/54/ +ERx7HLLMHjU5tVIVacZ9UWb30Bzx6iVx2hMtL/0FFJ1S0iwwTDXft/9EoPvsmmEx +VYEiSx5HxsPXM+XofMvi75nN34iMUIU3SgKLzHqlWcC3T7XjDWKC8TkTcutIAaIz +BMRssktJR3OYzWbbwzgz83sVpofWGfxIW91H19Zr8rjIXiNyy1ulRnfsaz+xXeXf +KxZZs00FtIIOeWBhCtsb8/8Uv3FRDK6+lX3xAqfMG67azJXpFafWJGiymypfSwi6 +JA866WOzw9DfbqWIlY/EMIhyZrsWnGiGhhAavwOiSWYV65ooFYooKHNmIekpvRZS +wlGuwvnZr+2471urkCoG8Yz2Ey28Qjc0NgXlXAkqFUkO2gNPFsXkk1EC+vzO2llp +qROS9pt25dEBcUSgfcjFOFWv2Z5IdmGjFEe46CJNEVzNgkP+97wJP7wpcOCSF/nn +eOBj4b7Q0suJ+MsE/Fx6SbkBjQRgdW7oAQwAst4QGHd9w+V3UHgRMYZISfYApcAK +2qBT1Zvf01QE38JUtDPKJarDlgxcaXuX6jOcbF60OMd59dhNmpaZYpocJZMgnESj +0/Tn4cZfWwtOo1Pom8Lbg1zGKIYAaR2mTb8mkCwJwsZCUZCmh+zspacxdVRdmWmC +XcFxFc/6gBKxcPFZf93JZaI33qsLpxyA57AJV5ck/TY1iFmA6HFxehamsAVdd56g +uyORekJJlZHXE9pICVEGqVUfdbSQXEiS386kZDftXe36phdj1gtFsRLHoBI8+L7o +2vrdnj1UZgtvxBbJJ+QAfhF8+f84RFIi9CTY8cheX+YfDMEdg9J9LG54X5P3O1ZX +eEvudKk/hqWBf+2rrdkhdFyyGRK0yTrO+PQ+tZHhcHPqfo4EiVktC4BTpB6QtLBY +NAGYMRddmZMgp4lE2xGib8SYwonct3y1fmB+x67lq65IFVM/IAwN6BuMXtgb+Zkm +iT+eKgc1pK4uCsZJbQAlPzkDGQV69GNyjlphABEBAAGJAbwEGAEIACYWIQTplsZw +qn9lQJv121YTnjjZDe0R8AUCYHVu6AIbDAUJA8JnAAAKCRATnjjZDe0R8Oe8DADQ +CTBXxrmTJTSZUeKVo0C1kDHQaaV+RiRmquYR3WxFI6ugJFFWpzgG9V8Q7vYGeZFM +HYM/tDuY/gdMwHBcR13yYyozslar7qas4LL/bYgOqq+SiSGTDEBW+00+5Wlwmlrv +ubLc6ow9q2sTmOprq3Q7fei+sEANVnymBxnVV/ZIVGPpm/Rkh1JFGT/8SEyKkCut +G23JMM/06cIhZwdD6aWSZK4EFw0lwfXyr8l3ZqH0WydVEef1DUNIRM48O0YdwS9u +jd5iKKKJlb4XxwGi6IKSzpXF7pFrm6vqS306u3Fnak5hb2gs8dpnNo7UL1gUm5pr +8vJ3xhg15KCjYKz8k6ZDsIWULTXUJ23i8ZwqyQaj1bajwN0+/MfC0ZkoQtQ2I/TH +cKLSMOR+Tji6n7FjOcVl6VoDKTjdxj9OgAlbZ7W9jEArrUjDdCk/m4jq9h9phpli +BHoul/nauwtlUnQes1V+39Rk9l7gddKWg3dlwg6CjB5MkmcaeyxgANcyKgrunpg= +=JYpC +-----END PGP PUBLIC KEY BLOCK----- +'/> + </properties> + <mappings size='3'> + <rule filter='(& (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/> + <rule filter='(& (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/> + <rule filter='(& (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/> + </mappings> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='blah' version='1.0.0.123456'> + <properties size='1'> + <!-- gpg -u signer1@fakeuser.eclipse.org -a -detach-sig plugins/blah_1.0.0.123456.jar --> + <property name='pgp.signatures' value='-----BEGIN PGP SIGNATURE----- + +iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB1+EodHHNpZ25lcjFA +ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfD5LAwAyPl8TBsC0bYZAsRX +BSGXjlJ+oBKci5VH6bgM/ldnZD5SsYv6PVoxxdOJA2R6S88xxd0DuWivYuG+9aiZ +w98hx6g0vNH8AWL+yd+l+2yIS8i/MJ57MCvVztexq935fIYU5KGdUNNEjDIrGHQQ +AR5QWfTiy9EGracG4W6F9twmMOfDlCJ3eRCetp5OTvqBzS2gLom8ECaw7tezYvA/ +09Ok88j7vMI5kL3FO3WzzR+obeYUc19F6602h4cEJs/yOTOj/gz6GCXsAnuYQs1L +yhjv4Cp4sBnMw+zPX0jFeNHu35mPt8oOFz1NLN85GHO7v3FFXmtwxj8bVBWBQR3R +Vfi+n8SfR3WO5pYpsqPHZgP95K+W53ere1BZd67cT6uuJDtoDWC6TYPjndm5tnN1 ++AzDQO12cC4w2cgIt3ElNYK0T8ADvrmCMPZPRPJ+GeZb0jb871SLDU1MPGZ9NHUl +hiuiOU3vTN/X/SbZM/Zcz2eahRAOBOc8sXzqcbjQHN/Akzbg +=acJE +-----END PGP SIGNATURE----- +'/> + </properties> + </artifact> + </artifacts> +</repository> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/content.xml b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/content.xml new file mode 100644 index 000000000..db8f67ba2 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/content.xml @@ -0,0 +1,49 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?metadataRepository version='1.2.0'?> +<repository name='file:/home/mistria/sandbox/repo/ - metadata' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1'> + <properties size='2'> + <property name='p2.timestamp' value='1618433231272'/> + <property name='p2.compressed' value='false'/> + </properties> + <units size='2'> + <unit id='blah' version='1.0.0.123456' singleton='false'> + <update id='blah' range='[0.0.0,1.0.0.123456)' severity='0'/> + <provides size='4'> + <provided namespace='org.eclipse.equinox.p2.iu' name='blah' version='1.0.0.123456'/> + <provided namespace='osgi.bundle' name='blah' version='1.0.0.123456'/> + <provided namespace='osgi.identity' name='blah' version='1.0.0.123456'> + <properties size='1'> + <property name='type' value='osgi.bundle'/> + </properties> + </provided> + <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/> + </provides> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='blah' version='1.0.0.123456'/> + </artifacts> + <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/> + <touchpointData size='1'> + <instructions size='2'> + <instruction key='zipped'> + true + </instruction> + <instruction key='manifest'> + Bundle-SymbolicName: blah
Bundle-Version: 1.0.0.qualifier
 + </instruction> + </instructions> + </touchpointData> + </unit> + <unit id='Category' version='0.0.0'> + <properties size='3'> + <property name='org.eclipse.equinox.p2.type.category' value='true'/> + </properties> + <provides size='1'> + <provided namespace='org.eclipse.equinox.p2.iu' name='Category' version='0.0.0'/> + </provides> + <requires size='1'> + <required namespace='org.eclipse.equinox.p2.iu' name='blah' range='[1.0.0.123456,1.0.0.123456]'/> + </requires> + <touchpoint id='null' version='0.0.0'/> + </unit> + </units> +</repository> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/plugins/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/plugins/META-INF/MANIFEST.MF new file mode 100644 index 000000000..b9fdcbf2f --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/plugins/META-INF/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: blah +Bundle-Version: 1.0.0.qualifier diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/plugins/blah_1.0.0.123456.jar b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/plugins/blah_1.0.0.123456.jar Binary files differnew file mode 100644 index 000000000..9cc7b8da0 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/plugins/blah_1.0.0.123456.jar diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/plugins/blah_1.0.0.123456.jar.asc b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/plugins/blah_1.0.0.123456.jar.asc new file mode 100644 index 000000000..1489f2552 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoSignatureDoesntMatchContent/plugins/blah_1.0.0.123456.jar.asc @@ -0,0 +1,14 @@ +-----BEGIN PGP SIGNATURE----- + +iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB4Bf8dHHNpZ25lcjFA +ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfBPuAwAhE4zA7BswKFhEtzm +DS3EbyRr/U13sV01YxqGtxYDCfrOt8TGVPXJSvo0AVP4vLFc5b+0jtVFoarFJNBu +xhbVuyC72YdqudNbncSlW6KG5SgeWIM//ThKfl95pOWRWvJEoKJhmDwbDqhZYtL5 +SECegnWGtGx/klFtZihzHYJE/nfSnhySDaz5lCvXFFYRhIbNmNm2Yq7ztCOsN4Ys +3uN+GEdoXGvv1DFg/xZPvwCOhZGsSQfkl1jmUwVltgKrw9OCFbdfYz7H6dbGWhRu +2XpuKxPXGavKfpSvssVQIZ6aWi5W6wp5lZAQQddZvYAv3Gi5CZZcUT7ayFJYdD23 +p9jz76G7MXm0f0uNT9B57T72QryokUIEIJYsCb6lNjWUQB4cd0+JesM7sHwweOQ3 +7iTFc+WgVJkP0e695mm1tcvtQHUPbIItYJUsndyLgGInzglxN8+F4U4k8uapydI9 +RmV2NVAifYp8z95Am5AnlG8lqjwrWk5bMbJH82QsQESrNT/h +=8Vrn +-----END PGP SIGNATURE----- diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/artifacts.xml b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/artifacts.xml new file mode 100644 index 000000000..0d7b0204e --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/artifacts.xml @@ -0,0 +1,78 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?artifactRepository version='1.1.0'?> +<repository name='file:/home/mistria/sandbox/repo/ - artifacts' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1'> + <properties size='3'> + <property name='p2.timestamp' value='1618433231272'/> + <property name='p2.compressed' value='false'/> + <!-- See PGPSignatureVerifierTest about this public key--> + <property name='pgp.publicKeys' value='-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQGNBGB1bugBDADQ5l7YnS9hNFRkBKSrvVNHt/TxeHaNNIHkdTC56I1QdThsOt4Y +oQRI27AEOaY1GFEi6+QqwxALcMMMSTgkCRs2NFGqlWMVzNYE7bJMWChVa7uQ/9CG +1HRbXwVwQx3hFgU4kmw1Kl/IH4LX76d9gAMyFANPjYZJSjbAv54wOlKruDRgpQFF +pZeuXW7SnerL6sgd/+ZroikdkrjIs5t18C2ofzf6YnOokYkEEJSAEoQK5svVzT4G +H3sw6FlE41RvnYKpuhvvyQhKjISDYfRaIL4JIpvR9Uko48eN9x654lJaucbMiLP4 +ROI9q7RQ6t1IMCiIN9QKgS+nVtHnN9MnXS0czGxfLdStv6bB+xgUoyBc7Uiqf4X0 +x8z9PE6O1L6Rgy2JMJHPgLWCF8h/u1FO88Br3I7TMzu2q/cg3k18L7eujnxVyYiD +YIMxDBXBNnGCKRC4shgt8e+PzAPXIDFvbv7HOaERnx5c6eLl0tD12ocQeZHp1VlW +nQteQ6CfvN07dNUAEQEAAbQ3RWNsaXBzZSBwMiB0ZXN0IFNpZ25lciAxIDxzaWdu +ZXIxQGZha2V1c2VyLmVjbGlwc2Uub3JnPokB1AQTAQgAPhYhBOmWxnCqf2VAm/Xb +VhOeONkN7RHwBQJgdW7oAhsDBQkDwmcABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA +AAoJEBOeONkN7RHwuXYL/Ri2gHoXELN79dWnuC5hjh7XgKquqlZg3qLgkLyA/54/ +ERx7HLLMHjU5tVIVacZ9UWb30Bzx6iVx2hMtL/0FFJ1S0iwwTDXft/9EoPvsmmEx +VYEiSx5HxsPXM+XofMvi75nN34iMUIU3SgKLzHqlWcC3T7XjDWKC8TkTcutIAaIz +BMRssktJR3OYzWbbwzgz83sVpofWGfxIW91H19Zr8rjIXiNyy1ulRnfsaz+xXeXf +KxZZs00FtIIOeWBhCtsb8/8Uv3FRDK6+lX3xAqfMG67azJXpFafWJGiymypfSwi6 +JA866WOzw9DfbqWIlY/EMIhyZrsWnGiGhhAavwOiSWYV65ooFYooKHNmIekpvRZS +wlGuwvnZr+2471urkCoG8Yz2Ey28Qjc0NgXlXAkqFUkO2gNPFsXkk1EC+vzO2llp +qROS9pt25dEBcUSgfcjFOFWv2Z5IdmGjFEe46CJNEVzNgkP+97wJP7wpcOCSF/nn +eOBj4b7Q0suJ+MsE/Fx6SbkBjQRgdW7oAQwAst4QGHd9w+V3UHgRMYZISfYApcAK +2qBT1Zvf01QE38JUtDPKJarDlgxcaXuX6jOcbF60OMd59dhNmpaZYpocJZMgnESj +0/Tn4cZfWwtOo1Pom8Lbg1zGKIYAaR2mTb8mkCwJwsZCUZCmh+zspacxdVRdmWmC +XcFxFc/6gBKxcPFZf93JZaI33qsLpxyA57AJV5ck/TY1iFmA6HFxehamsAVdd56g +uyORekJJlZHXE9pICVEGqVUfdbSQXEiS386kZDftXe36phdj1gtFsRLHoBI8+L7o +2vrdnj1UZgtvxBbJJ+QAfhF8+f84RFIi9CTY8cheX+YfDMEdg9J9LG54X5P3O1ZX +eEvudKk/hqWBf+2rrdkhdFyyGRK0yTrO+PQ+tZHhcHPqfo4EiVktC4BTpB6QtLBY +NAGYMRddmZMgp4lE2xGib8SYwonct3y1fmB+x67lq65IFVM/IAwN6BuMXtgb+Zkm +iT+eKgc1pK4uCsZJbQAlPzkDGQV69GNyjlphABEBAAGJAbwEGAEIACYWIQTplsZw +qn9lQJv121YTnjjZDe0R8AUCYHVu6AIbDAUJA8JnAAAKCRATnjjZDe0R8Oe8DADQ +CTBXxrmTJTSZUeKVo0C1kDHQaaV+RiRmquYR3WxFI6ugJFFWpzgG9V8Q7vYGeZFM +HYM/tDuY/gdMwHBcR13yYyozslar7qas4LL/bYgOqq+SiSGTDEBW+00+5Wlwmlrv +ubLc6ow9q2sTmOprq3Q7fei+sEANVnymBxnVV/ZIVGPpm/Rkh1JFGT/8SEyKkCut +G23JMM/06cIhZwdD6aWSZK4EFw0lwfXyr8l3ZqH0WydVEef1DUNIRM48O0YdwS9u +jd5iKKKJlb4XxwGi6IKSzpXF7pFrm6vqS306u3Fnak5hb2gs8dpnNo7UL1gUm5pr +8vJ3xhg15KCjYKz8k6ZDsIWULTXUJ23i8ZwqyQaj1bajwN0+/MfC0ZkoQtQ2I/TH +cKLSMOR+Tji6n7FjOcVl6VoDKTjdxj9OgAlbZ7W9jEArrUjDdCk/m4jq9h9phpli +BHoul/nauwtlUnQes1V+39Rk9l7gddKWg3dlwg6CjB5MkmcaeyxgANcyKgrunpg= +=JYpC +-----END PGP PUBLIC KEY BLOCK----- +'/> + </properties> + <mappings size='3'> + <rule filter='(& (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/> + <rule filter='(& (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/> + <rule filter='(& (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/> + </mappings> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='blah' version='1.0.0.123456'> + <properties size='1'> + <!-- gpg -u signer1@fakeuser.eclipse.org -a -detach-sig plugins/blah_1.0.0.123456.jar --> + <property name='pgp.signatures' value='-----BEGIN PGP SIGNATURE----- + +iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB4Bf8dHHNpZ25lcjFA +ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfBPuAwAhE4zA7BswKFhEtzm +DS3EbyRr/U13sV01YxqGtxYDCfrOt8TGVPXJSvo0AVP4vLFc5b+0jtVFoarFJNBu +xhbVuyC72YdqudNbncSlW6KG5SgeWIM//ThKfl95pOWRWvJEoKJhmDwbDqhZYtL5 +SECegnWG____TAMPERED_____________________________________COsN4Ys +3uN+GEdoXGvv1DFg/xZPvwCOhZGsSQfkl1jmUwVltgKrw9OCFbdfYz7H6dbGWhRu +2XpuKxPXGavKfpSvssVQIZ6aWi5W6wp5lZAQQddZvYAv3Gi5CZZcUT7ayFJYdD23 +p9jz76G7MXm0f0uNT9B57T72QryokUIEIJYsCb6lNjWUQB4cd0+JesM7sHwweOQ3 +7iTFc+WgVJkP0e695mm1tcvtQHUPbIItYJUsndyLgGInzglxN8+F4U4k8uapydI9 +RmV2NVAifYp8z95Am5AnlG8lqjwrWk5bMbJH82QsQESrNT/h +=8Vrn +-----END PGP SIGNATURE----- +'/> + </properties> + </artifact> + </artifacts> +</repository> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/content.xml b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/content.xml new file mode 100644 index 000000000..db8f67ba2 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/content.xml @@ -0,0 +1,49 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?metadataRepository version='1.2.0'?> +<repository name='file:/home/mistria/sandbox/repo/ - metadata' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1'> + <properties size='2'> + <property name='p2.timestamp' value='1618433231272'/> + <property name='p2.compressed' value='false'/> + </properties> + <units size='2'> + <unit id='blah' version='1.0.0.123456' singleton='false'> + <update id='blah' range='[0.0.0,1.0.0.123456)' severity='0'/> + <provides size='4'> + <provided namespace='org.eclipse.equinox.p2.iu' name='blah' version='1.0.0.123456'/> + <provided namespace='osgi.bundle' name='blah' version='1.0.0.123456'/> + <provided namespace='osgi.identity' name='blah' version='1.0.0.123456'> + <properties size='1'> + <property name='type' value='osgi.bundle'/> + </properties> + </provided> + <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/> + </provides> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='blah' version='1.0.0.123456'/> + </artifacts> + <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/> + <touchpointData size='1'> + <instructions size='2'> + <instruction key='zipped'> + true + </instruction> + <instruction key='manifest'> + Bundle-SymbolicName: blah
Bundle-Version: 1.0.0.qualifier
 + </instruction> + </instructions> + </touchpointData> + </unit> + <unit id='Category' version='0.0.0'> + <properties size='3'> + <property name='org.eclipse.equinox.p2.type.category' value='true'/> + </properties> + <provides size='1'> + <provided namespace='org.eclipse.equinox.p2.iu' name='Category' version='0.0.0'/> + </provides> + <requires size='1'> + <required namespace='org.eclipse.equinox.p2.iu' name='blah' range='[1.0.0.123456,1.0.0.123456]'/> + </requires> + <touchpoint id='null' version='0.0.0'/> + </unit> + </units> +</repository> diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/plugins/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/plugins/META-INF/MANIFEST.MF new file mode 100644 index 000000000..b9fdcbf2f --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/plugins/META-INF/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: blah +Bundle-Version: 1.0.0.qualifier diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/plugins/blah_1.0.0.123456.jar b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/plugins/blah_1.0.0.123456.jar Binary files differnew file mode 100644 index 000000000..9cc7b8da0 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/plugins/blah_1.0.0.123456.jar diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/plugins/blah_1.0.0.123456.jar.asc b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/plugins/blah_1.0.0.123456.jar.asc new file mode 100644 index 000000000..1489f2552 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/repoTamperedInvalidSignature/plugins/blah_1.0.0.123456.jar.asc @@ -0,0 +1,14 @@ +-----BEGIN PGP SIGNATURE----- + +iQHRBAABCAA7FiEE6ZbGcKp/ZUCb9dtWE5442Q3tEfAFAmB4Bf8dHHNpZ25lcjFA +ZmFrZXVzZXIuZWNsaXBzZS5vcmcACgkQE5442Q3tEfBPuAwAhE4zA7BswKFhEtzm +DS3EbyRr/U13sV01YxqGtxYDCfrOt8TGVPXJSvo0AVP4vLFc5b+0jtVFoarFJNBu +xhbVuyC72YdqudNbncSlW6KG5SgeWIM//ThKfl95pOWRWvJEoKJhmDwbDqhZYtL5 +SECegnWGtGx/klFtZihzHYJE/nfSnhySDaz5lCvXFFYRhIbNmNm2Yq7ztCOsN4Ys +3uN+GEdoXGvv1DFg/xZPvwCOhZGsSQfkl1jmUwVltgKrw9OCFbdfYz7H6dbGWhRu +2XpuKxPXGavKfpSvssVQIZ6aWi5W6wp5lZAQQddZvYAv3Gi5CZZcUT7ayFJYdD23 +p9jz76G7MXm0f0uNT9B57T72QryokUIEIJYsCb6lNjWUQB4cd0+JesM7sHwweOQ3 +7iTFc+WgVJkP0e695mm1tcvtQHUPbIItYJUsndyLgGInzglxN8+F4U4k8uapydI9 +RmV2NVAifYp8z95Am5AnlG8lqjwrWk5bMbJH82QsQESrNT/h +=8Vrn +-----END PGP SIGNATURE----- diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/pgp/signer2-publickey.asc b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/signer2-publickey.asc new file mode 100644 index 000000000..0218bdce7 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/pgp/signer2-publickey.asc @@ -0,0 +1,29 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGHUyxYBEADATeNx4XA4H2fP9mD5xwlIyh7qvHLezgXpqCwNS9ATqBwnfrCV +06a+pfSLsLoXrP/sdaB5WhijfuxTis18RMfoDVwGMRqyD2GiBCl2vwJDg3BUwHnc +H7W6XkWKO7dkPmF+TUbD3cTWZ7cvrPmMjinmXaq8htuktGuE2VEGZRnuG1m+ChDM +PnSb1ioFS2+MJv13P2fagVk2qC95DkPJGpMk3CY3ghLDEaY/KaJl+8axAlUUUk9N +d3k/KVxxf5k3g26EVQkWWgH2mmolptGO101xW64iked97Cy4NK2yafOF/wmpsavx +PGpOewnDgAJBBPkum6mPH0vcOZgxmLyh4uqfPfr3IaBQlbJLN2dXaDsV83j5t1wZ +2qxOPcWBfORm6W7dC0TQgCXbEG0geMBpJtvnMX83Q2ORqDpjbHRJsV2k+8NxaXON +pYXGr+Lj/9n0xfNEDXhCdGab0XP2tVZ5jfr2OQ5dAomEaPqK5Kq7akoWMddpDLNC +G4IvH8G0cxwruJk00uwd6Nd2NVqVMRYCsBbA89VanUnutLUIpVnnOAetlX9blXHO +JtmiCPGgHyp+iYGhKYVzfuZQyFhonbi0AhidJDvbHsoLT3p4Mcog1B9y6MODBE7R +jwrU+qMqYsYeFhGYKbYyXv9TfEyUvtCQ/GnTtRJAQyicFdOdbK37WecS6QARAQAB +tDdFY2xpcHNlIHAyIHRlc3QgU2lnbmVyIDIgPHNpZ25lcjJAZmFrZXVzZXIuZWNs +aXBzZS5vcmc+iQJYBBMBCABCFiEEzZ1aK4a8T+GDlFHh4vaU9BsKs3AFAmHUyxYC +GwMFCQPCZwAFCwkIBwIDIgIBBhUKCQgLAgQWAgMBAh4HAheAAAoJEOL2lPQbCrNw +wH4QAIiCaw1mREgt4ldz7hQvmGxdMuQwVKZPzbOIAlYbZBo0q9SmeMf/CBCO90hg +LFmJmsZV4KUU5NKI7UwkDVrpUCl00Ok6+gtiUTId2tRcwXI+25I478VX27j6OkQj +7Xr6giv8cn8nstt5CF6xxeqrxvpmnZC0u30jE6CL6SdXSd0vViFDPQj3KgGJCRc9 +St+LHB3XJTsadihzQnscqI4E2i5Z3Uj1GogqxtR59M1NAXubl5dySM0qHhwn8O+6 +lcgCCeuyMLLde1M1v8w07jdRUM+IFqHrRnE89EPH3MQeZbQ3UfFXK2r7wx2BJCqL +Irtn68kz834ByKchGR6DqaAw0q+iF2QkgzYxpwai41BgmtUCYnj+HxQNIF4KTzDe +nd8mDAPWttGCoVuV2Tyu9peYOaqyAZ2PZwUEH5MqihPCbenU17RLXzRu/IT/SH47 +NGrN3yKGgLZr2EVWPWFibpoxP4G4NUCHsY75uiL2EWPVSjK/+OOeHIE5k3U3lYwB +7clhBwMkIhQHJ+a0SHRkKixkwrQDw4veKY4LaD0NCBLHFoV5L9orH1ToGM729kr/ ++4I1VQFkL3KvfLjmRbTUgwHeqEquQ96JtqowbNwlpujfHXQKDNsuiKGP5OazXll5 +sH2CR7e4ePqhhzxjLvi9e/79Khq+08eqllS3rs06EXEAJYTo +=807V +-----END PGP PUBLIC KEY BLOCK----- diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/updatesite/CategoryXMLActionTest/associateSites.xml b/bundles/org.eclipse.equinox.p2.tests/testData/updatesite/CategoryXMLActionTest/associateSites.xml index 1238ec316..bddf9e047 100644 --- a/bundles/org.eclipse.equinox.p2.tests/testData/updatesite/CategoryXMLActionTest/associateSites.xml +++ b/bundles/org.eclipse.equinox.p2.tests/testData/updatesite/CategoryXMLActionTest/associateSites.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <associateSites> -<associateSite url="http://download.eclipse.org/eclipse/updates/3.5" label="Eclipse Project Update Site"/> +<associateSite url="https://download.eclipse.org/eclipse/updates/3.5" label="Eclipse Project Update Site"/> <associateSite url="This is a bogus URI" label="broken"/> </associateSites>
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/updatesite/SiteXMLActionTest/associateSites.xml b/bundles/org.eclipse.equinox.p2.tests/testData/updatesite/SiteXMLActionTest/associateSites.xml index 1238ec316..fb00b10b3 100644 --- a/bundles/org.eclipse.equinox.p2.tests/testData/updatesite/SiteXMLActionTest/associateSites.xml +++ b/bundles/org.eclipse.equinox.p2.tests/testData/updatesite/SiteXMLActionTest/associateSites.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <associateSites> -<associateSite url="http://download.eclipse.org/eclipse/updates/3.5" label="Eclipse Project Update Site"/> +<associateSite url="https://download.eclipse.org/eclipse/updates/4.21" label="Eclipse Project Update Site"/> <associateSite url="This is a bogus URI" label="broken"/> </associateSites>
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/updatesite/SiteXMLActionTest/site.xml b/bundles/org.eclipse.equinox.p2.tests/testData/updatesite/SiteXMLActionTest/site.xml index 3e0b2f175..63668e601 100644 --- a/bundles/org.eclipse.equinox.p2.tests/testData/updatesite/SiteXMLActionTest/site.xml +++ b/bundles/org.eclipse.equinox.p2.tests/testData/updatesite/SiteXMLActionTest/site.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<site associateSitesURL="associateSites.xml" mirrorsURL="http://www.eclipse.org/downloads/download.php?file=/eclipse/updates/3.4&format=xml"> +<site associateSitesURL="associateSites.xml" mirrorsURL="https://www.eclipse.org/downloads/download.php?file=/eclipse/updates/4.21&format=xml"> <feature url="features/test.feature_1.0.0.jar" id="test.feature" version="1.0.0"> <category name="Test Category"/> </feature> diff --git a/bundles/org.eclipse.equinox.p2.testserver/.classpath b/bundles/org.eclipse.equinox.p2.testserver/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.testserver/.classpath +++ b/bundles/org.eclipse.equinox.p2.testserver/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.testserver/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.jdt.core.prefs index 97d2ee121..b3d5b56d8 100644 --- a/bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.testserver/.settings/org.eclipse.jdt.core.prefs @@ -18,9 +18,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -37,6 +37,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -94,6 +95,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -131,10 +133,11 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 @@ -142,20 +145,23 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 @@ -247,11 +253,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert @@ -282,6 +289,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -306,13 +315,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert @@ -360,6 +373,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do no org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -396,9 +411,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -434,10 +452,14 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/bundles/org.eclipse.equinox.p2.testserver/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.testserver/META-INF/MANIFEST.MF index f9c0c2733..46417adf1 100644 --- a/bundles/org.eclipse.equinox.p2.testserver/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.testserver/META-INF/MANIFEST.MF @@ -2,13 +2,13 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Testserver Bundle-SymbolicName: org.eclipse.equinox.p2.testserver;singleton:=true -Bundle-Version: 1.1.100.qualifier +Bundle-Version: 1.2.0.qualifier Bundle-Activator: org.eclipse.equinox.p2.testserver.Activator Bundle-Vendor: Eclipse -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Import-Package: org.osgi.framework;version="1.3.0" Bundle-ActivationPolicy: lazy -Require-Bundle: javax.servlet;bundle-version="2.4.0", +Require-Bundle: jakarta.servlet-api;bundle-version="2.4.0", org.eclipse.equinox.http.registry, org.eclipse.equinox.http.servlet;bundle-version="1.0.200", org.eclipse.osgi.services;bundle-version="3.2.0", diff --git a/bundles/org.eclipse.equinox.p2.testserver/pom.xml b/bundles/org.eclipse.equinox.p2.testserver/pom.xml index 475b53b37..15046df14 100644 --- a/bundles/org.eclipse.equinox.p2.testserver/pom.xml +++ b/bundles/org.eclipse.equinox.p2.testserver/pom.xml @@ -4,11 +4,11 @@ <parent> <artifactId>org.eclipse.equinox.p2.tests-parent</artifactId> <groupId>org.eclipse</groupId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../../org.eclipse.equinox.p2.releng/org.eclipse.equinox.p2.tests-parent</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.testserver</artifactId> - <version>1.1.100-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/Activator.java b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/Activator.java index b96c5afd3..31e6cffda 100644 --- a/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/Activator.java +++ b/bundles/org.eclipse.equinox.p2.testserver/src/org/eclipse/equinox/p2/testserver/Activator.java @@ -45,9 +45,9 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer<Http private AlwaysFailContext alwaysFail; private FlipFlopFailContext flipFlop; - private static final String SITE = "http://download.eclipse.org/eclipse/updates/3.4"; //$NON-NLS-1$ - private static final String SITE2 = "http://www.eclipse.org/equinox/p2/testing/updateSite"; //$NON-NLS-1$ - private static final String SITE3 = "http://download.eclipse.org/eclipse/updates/3.5-I-builds/"; //$NON-NLS-1$ + private static final String SITE = "https://download.eclipse.org/eclipse/updates/3.4"; //$NON-NLS-1$ + private static final String SITE2 = "https://www.eclipse.org/equinox/p2/testing/updateSite"; //$NON-NLS-1$ + private static final String SITE3 = "https://download.eclipse.org/eclipse/updates/3.5-I-builds/"; //$NON-NLS-1$ @Override public void start(BundleContext aContext) throws Exception { diff --git a/bundles/org.eclipse.equinox.p2.testserver/webfiles/index.html b/bundles/org.eclipse.equinox.p2.testserver/webfiles/index.html index c07f8d265..9f1800e6e 100644 --- a/bundles/org.eclipse.equinox.p2.testserver/webfiles/index.html +++ b/bundles/org.eclipse.equinox.p2.testserver/webfiles/index.html @@ -8,10 +8,10 @@ log in. The credentials are: user: <b>Aladdin</b>, password: <b>open sesame</b>. <a href="http://localhost:8080/private/index.html">here</a></p> <p>The following real content is registered:</p> <ul> -<li>/proxy/private/ - goes to http://http://download.eclipse.org/eclipse/updates/3.4, but requires authentication.</li> -<li>/proxy/public/ - goes to http://http://download.eclipse.org/eclipse/updates/3.4, (useful in redirects).</li> -<li>/proxy/never/ - goes to http://http://download.eclipse.org/eclipse/updates/3.4, but always fail authentication.</li> -<li>/proxy/flipFlop/ - goes to http://http://download.eclipse.org/eclipse/updates/3.4, but fails authentication every second attempt.</li> +<li>/proxy/private/ - goes to https://download.eclipse.org/eclipse/updates/3.4, but requires authentication.</li> +<li>/proxy/public/ - goes to https://download.eclipse.org/eclipse/updates/3.4, (useful in redirects).</li> +<li>/proxy/never/ - goes to https://download.eclipse.org/eclipse/updates/3.4, but always fail authentication.</li> +<li>/proxy/flipFlop/ - goes to https://download.eclipse.org/eclipse/updates/3.4, but fails authentication every second attempt.</li> <li>/proxy/truncated - goes to updates/3.4, but truncates all files</li> <li>/proxy/molested - goes to updates/3.4, but generates gibberish for all files</li> <li>/proxy/decelerate - goes to updates/3.4, but delivers files in very small delayed packets - delay increases.</li> diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.classpath b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.classpath +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.touchpoint.eclipse/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.core.prefs index 2575694e1..fc51c69b1 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -36,6 +36,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -89,6 +90,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -126,7 +128,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -140,7 +143,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -261,7 +263,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -332,7 +333,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -477,7 +477,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF index 39e94461d..71901cee2 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.touchpoint.eclipse;singleton:=true -Bundle-Version: 2.2.800.qualifier +Bundle-Version: 2.3.100.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.touchpoint.eclipse.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -15,12 +15,14 @@ Export-Package: org.eclipse.equinox.internal.p2.touchpoint.eclipse;version="2.0. org.eclipse.equinox.internal.p2.update;version="2.0.0";x-friends:="org.eclipse.equinox.p2.reconciler.dropins,org.eclipse.equinox.p2.extensionlocation,org.eclipse.equinox.p2.directorywatcher", org.eclipse.equinox.p2.touchpoint.eclipse.query;version="2.0.0" Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Import-Package: javax.xml.parsers, org.eclipse.equinox.frameworkadmin;version="[2.0.0,3.0.0)", + org.eclipse.equinox.internal.p2.artifact.processors.pgp, org.eclipse.equinox.internal.p2.core.helpers, org.eclipse.equinox.internal.p2.engine, + org.eclipse.equinox.internal.p2.engine.phases, org.eclipse.equinox.internal.p2.garbagecollector, org.eclipse.equinox.internal.p2.metadata, org.eclipse.equinox.internal.provisional.frameworkadmin, diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/pom.xml b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/pom.xml index 1aa4f305a..7fff2566e 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/pom.xml +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.touchpoint.eclipse</artifactId> - <version>2.2.800-SNAPSHOT</version> + <version>2.3.100-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java index ee394cfcf..ec918b53c 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java @@ -17,7 +17,6 @@ public class ActionConstants { public static final String PARM_AGENT = "agent"; //$NON-NLS-1$ public static final String PARM_AT_ARTIFACT = "@artifact"; //$NON-NLS-1$ - public static final String PARM_ARTIFACT_FILES = "artifactFiles"; //$NON-NLS-1$ public static final String PARM_ARTIFACT_REQUESTS = "artifactRequests"; //$NON-NLS-1$ public static final String PARM_BUNDLE = "bundle"; //$NON-NLS-1$ public static final String PARM_FEATURE = "feature"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CheckTrustAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CheckTrustAction.java index 201535517..7c7b51c17 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CheckTrustAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CheckTrustAction.java @@ -18,6 +18,7 @@ import java.util.Collection; import java.util.Map; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.equinox.internal.p2.engine.phases.CheckTrust; import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint; import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util; import org.eclipse.equinox.p2.core.IProvisioningAgent; @@ -26,6 +27,8 @@ import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; import org.eclipse.equinox.p2.metadata.IArtifactKey; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.query.QueryUtil; +import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; +import org.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository; /** * This action collects the set of bundle files on which the signature trust @@ -47,14 +50,21 @@ public class CheckTrustAction extends ProvisioningAction { if (!profile.available(QueryUtil.createIUQuery(iu), null).isEmpty()) return null; @SuppressWarnings("unchecked") - Collection<File> bundleFiles = (Collection<File>) parameters.get(ActionConstants.PARM_ARTIFACT_FILES); + Map<IArtifactDescriptor, File> bundleFiles = (Map<IArtifactDescriptor, File>) parameters + .get(CheckTrust.PARM_ARTIFACTS); Collection<IArtifactKey> artifacts = iu.getArtifacts(); - if (artifacts == null) + if (artifacts == null) { return null; + } + IFileArtifactRepository repo = Util.getAggregatedBundleRepository(agent, profile); for (IArtifactKey key : artifacts) { - File bundleFile = Util.getArtifactFile(agent, key, profile); - if (!bundleFiles.contains(bundleFile)) - bundleFiles.add(bundleFile); + for (IArtifactDescriptor descriptor : repo.getArtifactDescriptors(key)) { + IFileArtifactRepository currentRepo = descriptor.getRepository() instanceof IFileArtifactRepository + ? (IFileArtifactRepository) descriptor.getRepository() + : repo; + File artifactFile = currentRepo.getArtifactFile(descriptor); + bundleFiles.put(descriptor, artifactFile); + } } return null; } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath +++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.touchpoint.natives/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.core.prefs index 4e79b56c0..26df1a4b1 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.core.prefs @@ -16,9 +16,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -35,6 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -88,6 +89,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -124,7 +126,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -138,7 +141,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -259,7 +261,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -330,7 +331,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -475,7 +475,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF index c524327e1..3e794a0db 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF @@ -2,17 +2,20 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.touchpoint.natives;singleton:=true -Bundle-Version: 1.3.600.qualifier +Bundle-Version: 1.4.300.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.touchpoint.natives.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin -Export-Package: org.eclipse.equinox.internal.p2.touchpoint.natives;x-internal:=true, +Export-Package: + org.eclipse.equinox.internal.p2.touchpoint.natives;x-internal:=true, org.eclipse.equinox.internal.p2.touchpoint.natives.actions;x-internal:=true -Require-Bundle: org.eclipse.equinox.common, +Require-Bundle: + org.eclipse.equinox.common, org.eclipse.equinox.app;bundle-version="1.3.0";resolution:=optional -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy -Import-Package: org.eclipse.equinox.internal.p2.core.helpers, +Import-Package: + org.eclipse.equinox.internal.p2.core.helpers, org.eclipse.equinox.internal.p2.engine, org.eclipse.equinox.p2.core;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.engine;version="[2.0.0,3.0.0)", diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/p2.inf b/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/p2.inf deleted file mode 100644 index 2ea1bf303..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/p2.inf +++ /dev/null @@ -1,43 +0,0 @@ -provides.0.namespace=org.eclipse.equinox.p2.iu -provides.0.name=org.eclipse.equinox.p2.touchpoint.natives -provides.0.version=1.1.100.v20140523-0116 - -provides.1.namespace=org.eclipse.equinox.p2.iu -provides.1.name=org.eclipse.equinox.p2.touchpoint.natives -provides.1.version=1.2.0.$qualifier$ - -provides.2.namespace=org.eclipse.equinox.p2.iu -provides.2.name=org.eclipse.equinox.p2.touchpoint.natives -provides.2.version=1.2.100.$qualifier$ - -provides.3.namespace=org.eclipse.equinox.p2.iu -provides.3.name=org.eclipse.equinox.p2.touchpoint.natives -provides.3.version=1.2.200.$qualifier$ - -provides.4.namespace=org.eclipse.equinox.p2.iu -provides.4.name=org.eclipse.equinox.p2.touchpoint.natives -provides.4.version=1.3.0.$qualifier$ - -provides.5.namespace=org.eclipse.equinox.p2.iu -provides.5.name=org.eclipse.equinox.p2.touchpoint.natives -provides.5.version=1.3.100.$qualifier$ - -provides.6.namespace=org.eclipse.equinox.p2.iu -provides.6.name=org.eclipse.equinox.p2.touchpoint.natives -provides.6.version=1.3.200.$qualifier$ - -provides.7.namespace=org.eclipse.equinox.p2.iu -provides.7.name=org.eclipse.equinox.p2.touchpoint.natives -provides.7.version=1.3.300.$qualifier$ - -provides.8.namespace=org.eclipse.equinox.p2.iu -provides.8.name=org.eclipse.equinox.p2.touchpoint.natives -provides.8.version=1.3.400.$qualifier$ - -provides.9.namespace=org.eclipse.equinox.p2.iu -provides.9.name=org.eclipse.equinox.p2.touchpoint.natives -provides.9.version=1.3.500.$qualifier$ - -provides.10.namespace=org.eclipse.equinox.p2.iu -provides.10.name=org.eclipse.equinox.p2.touchpoint.natives -provides.10.version=1.3.600.$qualifier$ diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/pom.xml b/bundles/org.eclipse.equinox.p2.touchpoint.natives/pom.xml index d4c436370..f90831920 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/pom.xml +++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.touchpoint.natives</artifactId> - <version>1.3.600-SNAPSHOT</version> + <version>1.4.300-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java deleted file mode 100644 index 3bd9b5fc5..000000000 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java +++ /dev/null @@ -1,834 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2018 Cloudsmith Inc. and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Cloudsmith Inc. - initial API and implementation - * SAP AG - Ongoing development - *******************************************************************************/ - -package org.eclipse.equinox.internal.p2.touchpoint.natives; - -import java.io.*; -import java.net.*; -import java.util.*; -import java.util.Map.Entry; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; -import org.eclipse.osgi.util.NLS; - -/** - * Stores files by copying them to a uniquely named temporary directory. - * The BackupStore remembers filenames and can recreate them in their original location. - * - * <h3>Usage</h3> - * The user of this class should instantiate the BackupStore with some prefix that is - * meaningful to a human. Uniqueness is obtained without the prefix - the prefix is used to - * be able to differentiate between different backup directories by a human (in case of crashes etc). - * - * If instantiated with a directory this directory will be used to store the backup root directory. If - * this directory is null, the users home directory is used by default. - * - * Once instantiated, use the {@link #backup(File)} and {@link #backupDirectory(File)} methods - * to move files to backup instead of deleting them. A file that - * is backed up should not be deleted - it is simply moved out of the way. - * Use {@link #backupCopy(File)} to - * move the file out of harms way, but keep a copy of it in the original location. - * The methods {@link #backupAll(File)} and {@link #backupCopyAll(File)} backs up an entire structure. - * - * When backup is finished - the user should either call {@link #restore()} to put all - * of the files back, or call {@link #discard()} to remove all of the backed up "copies". - * - * If {@link #restore()} or {@link #discard()} is not called the backup files will never be deleted. - * - * The backup store does not synchronize directories - actions that write new files are - * responsible for removing them. Overwriting existing files should be done by first backing - * up the file, and then creating a new file. Modifying a file, should be done by - * using {@link #backupCopy(File)} or - * first making a copy, then backing up the original, and then renaming the copy. - * - * <h3>Read Only and Permissions</h3> - * Directories that are read only (to current user) can not be backed up. - * Backup is performed using {@link File#renameTo(File)} and handling of permissions - * is operating system dependent. It is expected that a Un*x type system retains the - * permissions as a file is moved to the backup store and later gets restored. - * Backup directories are created as they are needed and will (at least on Un*x) inherit the - * permissions from its parent directory. - * - * If a rename can not be performed, the backup store will make a copy and delete the original - * file. This makes it possible to backup and restore across volume boundaries. - * - * When restoring directories they - * will be created with permissions in a platform specific way (on UN*IX they will inherit the permissions - * of the parent directory). - * - * <h3>Checkpointing</h3> - * Checkpointing (i.e. to be able to rollback to a particular point) can be implemented by using - * multiple instances of BackupStore. The client code will need to remember the individual order - * among the backup stores. - * - * <h3>Restartability</h3> - * Not implemented - it is possible to obtain the name of the backup directories, - * so manual restore is possible after a crash. An idea is to add persistence to a file, and - * be able to read it back in again. - * - * <h3>A note about exceptions</h3> - * In general {@link IllegalArgumentException} is thrown when attempting an operation - * that is considered "wrong use", and an {@link IllegalStateException} or subclass thereof is thrown on an overall - * wrong use of BackupStore (i.e. attempt to backup when store has been restored). Some cases of - * "wrong use" can not be differentiated from I/O errors (like a "file not found" as this could - * be caused by an entire disk disappearing - in these case an {@link IOException} is thrown. - * - * <h3>Implementation Note</h3> - * The backup root directory will contain folders that reflects file system roots. These are encoded using - * "_" for the UNI*X root directory, "__" for a Windows network mounted directory, and single "drive letter" folders - * corresponding to Windows drive letters. Typically, on UN*X there will only be a "_" directory in the backup root, - * and on windows there will typically be a single directory called "C". - * - * - */ -public class BackupStore implements IBackupStore { - - private static final String BACKUP_FILE_EXTENSION = ".p2bu"; //$NON-NLS-1$ - - /** - * The name to use for a directory that represents leading separator (i.e. "/" or "\"). - */ - private static final String ROOTCHAR = "_"; //$NON-NLS-1$ - - /** - * Map of directory File to backup root (File) - the backup root has - * a directory named {@link #backupName} where the backup is found. - */ - //private Map backups = new HashMap(); - private final File backupRoot; - - /** - * The name of the backup directory (no path - relative to the backup root). - */ - private final String backupName; - - /** - * The name of a dummy file used to backup empty directories - */ - private final String dummyName; - - /** - * A server socket that is used to obtain a port (a shared resource on this machine) - * and thus create a unique number. Used as part of the unique id of backup directories - * and probe files. - */ - private ServerSocket socket = null; - - /** - * Counter of how many files where backed up. Used as a simple check mechanism if - * everything was restored (a guard against manual/external tampering with the backup directories). - */ - private long backupCounter; - - /** - * Counter of how many files where restored. See {@link #backupCounter}. - */ - private long restoreCounter; - - /** - * Flag indicating if this BackupStore has been restored or canceled. - */ - private boolean closed; - - private final Map<String, String> renamedInPlace = new HashMap<>(); - - /** - * Generates a BackupStore with a default prefix of ".p2bu" for backup directory and - * probe file. - * The full id of the store is on the format "prefix_hextime_hexIPport" - * - see {@link #genUnique()} for more info. - */ - public BackupStore() { - this(null, BACKUP_FILE_EXTENSION); - } - - /** - * Generates a BackupStore with a specified prefix for backup directories and - * probe file. - * The full id of the store is on the format "prefix_hextime_hexipport" - * - see {@link #genUnique()} for more info. - * - * @param buParentDirectory - name of directory where the backup directory should be created - if null, java.io.tmpdir is used - * @param prefix - prefix used for human identification of backup directories - */ - public BackupStore(File buParentDirectory, String prefix) { - if (buParentDirectory == null) - buParentDirectory = new File(System.getProperty("java.io.tmpdir")); //$NON-NLS-1$ - backupRoot = buParentDirectory; - - // generate a name for the backup store and the dummy file used for empty directories - String unique = genUnique(); - dummyName = prefix + "d_" + unique; //$NON-NLS-1$ - backupName = prefix + "_" + unique; //$NON-NLS-1$ - backupCounter = 0; - restoreCounter = 0; - closed = false; - } - - /** - * Since a socket port is used to create a unique number, the socket - * must be closed if this instance is garbage collected and the user - * of the instance has not either restored or discarded. - */ - @Override - protected void finalize() throws Throwable { - try { - if (socket != null && !socket.isClosed()) - socket.close(); - } finally { - super.finalize(); - } - } - - /** - * Returns the unique backup name (this is the name of generated backup directories). - * @return the backup name. - */ - @Override - public String getBackupName() { - return backupName; - } - - public File getBackupRoot() { - return backupRoot; - } - - /** - * Backup the file by moving it to the backup store (for later (optional) restore). - * Calling this method with a file that represents a directory is equivalent to calling - * {@link #backupDirectory(File)}. - * - * A file (path) can only be backed up once per BackupStore instance. - * When the file is backed up, it is moved to a directory under this BackupStore instance's directory - * with a relative path corresponding to the original relative path from the backup root e.g. - * the file /A/B/C/foo.txt could be moved to /A/.p2bu_ffffff_ffffff/B/C/foo.txt when /A is the - * backup root. - * - * If a directory is first backed up, and later replaced by a regular file, and this file - * is backed up (or vice versa) - an {@link IllegalArgumentException} is thrown - * - * A backup can not be performed on a closed BackupStore. - * - * @param file - the file (or directory) to backup - * @return true if the file was backed up, false if this file (path) has already been backed up (the file is not moved to the store). - * @throws IOException - if the backup operation fails, or the file does not exist - * @throws ClosedBackupStoreException - if the BackupStore has been closed - * @throws IllegalArgumentException - on type mismatch (file vs. directory) of earlier backup, or if file does not exist - */ - @Override - public boolean backup(File file) throws IOException { - if (closed) - throw new ClosedBackupStoreException("Can not perform backup()"); //$NON-NLS-1$ - if (!file.exists()) - throw new IOException(NLS.bind(Messages.BackupStore_file_not_found, file.getAbsolutePath())); - if (file.isDirectory()) - return backupDirectory(file); - file = makeParentCanonical(file); - File buFile = getBackupFile(file); - // already backed up, but was a directory = wrong usage - if (buFile.isDirectory()) - throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_directory_file_mismatch, buFile.getAbsolutePath())); - // has already been backed up - can only be done once with one BackupStore - if (buFile.exists()) { - // although backed up, the file can be still on the file system when, for example, - // two IUs are unzipping their contents to the same location and share a few common file, - // which have to be removed twice - if (file.exists() && !file.delete()) - throw new IOException(NLS.bind(Messages.BackupStore_can_not_remove, file.getAbsolutePath())); - return false; - } - - moveToBackup(file, buFile); - - return true; - } - - /** - * Move/rename file to a backup file. Callers of the method must have ensured that the source file exists and the - * backup file has not been created yet. - * - * @param file source file to move; should already exist and must not be directory - * @param buFile destination backup file to move to; should not exist and must be a directory - * @throws IOException if the backup operation fails - */ - protected void moveToBackup(File file, File buFile) throws IOException { - // make sure all of the directories exist / gets created - buFile.getParentFile().mkdirs(); - if (buFile.getParentFile().exists() && !buFile.getParentFile().isDirectory()) - throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_file_directory_mismatch, buFile.getParentFile().getAbsolutePath())); - if (moveToBackupStore(file, buFile)) { - backupCounter++; - return; - } - // could not move - this can happen because source and target are on different volumes, or - // that source is locked "in use" on a windows machine. The copy will work across volumes, - // but the locked file will fail on the subsequent delete. - // - // Rename in place - if (isEclipseExe(file)) - renameInPlace(file); - else { - Util.copyStream(new FileInputStream(file), true, new FileOutputStream(buFile), true); - backupCounter++; - } - - // File.exists() is not reliable so always attempt to delete first and check why it may have failed second. - if (!file.delete() && file.exists()) - throw new IOException(NLS.bind(Messages.BackupStore_can_not_delete_after_copy_0, file)); - } - - private boolean isEclipseExe(File file) { - String launcher = System.getProperty("eclipse.launcher"); //$NON-NLS-1$ - if (launcher != null) { - String base = new File(launcher).getName(); - if (file.getName().equalsIgnoreCase(base)) - return true; - } - return file.getName().equalsIgnoreCase("eclipse.exe") || file.getName().equalsIgnoreCase("eclipsec.exe"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - protected boolean moveToBackupStore(File file, File buFile) { - if (file.renameTo(buFile)) { - // if the original file still exists, we have a problem. - if (file.exists()) { - // If the renamed work, but the file still exists, remove the backup - // and return false - if (buFile.exists()) - buFile.delete(); - } else { - return true; - } - } - return false; - } - - protected void renameInPlace(File file) { - String newName = file.getAbsolutePath() + getTimeStamp() + BACKUP_FILE_EXTENSION; - renamedInPlace.put(file.getAbsolutePath(), newName); - file.renameTo(new File(newName)); - } - - protected String getTimeStamp() { - return "-" + new Date().getTime(); //$NON-NLS-1$ - } - - private File getBackupFile(File file) { - File buRoot = backupRoot; - File buDir = new File(buRoot, backupName); - // create the relative path from root and use that in buDir - File buFile = new File(buDir, makeRelativeFromRoot(file).getPath()); - return buFile; - } - - /** - * Backs up a file, or everything under a directory. - * - * @param file - file to backup or directory - * @throws IOException if backup operation failed - */ - @Override - public void backupAll(File file) throws IOException { - if (!file.exists()) - return; - file = makeParentCanonical(file); - if (file.isDirectory()) { - File[] files = file.listFiles(); - if (files != null) - for (File f : files) { - backupAll(f); - } - } - backup(file); - } - - /** - * Backs up a file, or everything under a directory. - * A copy of the backup is left in the original place. - * @param file - * @throws IOException - */ - @Override - public void backupCopyAll(File file) throws IOException { - if (!file.exists()) - return; - file = makeParentCanonical(file); - if (file.isDirectory()) { - File[] files = file.listFiles(); - if (files != null) - for (File f : files) { - backupCopyAll(f); - } - // if directory was empty, it needs to be backed up and then recreated - // - if (files == null || files.length == 0) { - backupDirectory(file); - file.mkdir(); - } - } else - backupCopy(file); - } - - /** - * Backup the file by moving it to the backup store (for later (optional) restore) but leaving - * a copy of the contents in the original location. - * Calling this method with a file that represents a directory throws an {@link IllegalArgumentException}. - * - * A file (path) can only be backed up once per BackupStore instance. - * When the file is backed up, it is moved to a directory under this BackupStore instance's directory - * with a relative path corresponding to the original relative path from the backup root e.g. - * the file /A/B/C/foo.txt could be moved to /A/.p2bu_ffffff_ffffff/B/C/foo.txt when /A is the - * backup root. - * - * If a directory is first backed up, and later replaced by a regular file, and this file - * is backed up (or vice versa) - an {@link IllegalArgumentException} is thrown - * - * A backup can not be performed on a closed BackupStore. - * - * @param file - the file (or directory) to backup - * @return true if the file was backed up, false if this file (path) has already been backed up (the file is not moved to the store). - * @throws IOException - if the backup operation fails, or the file does not exist - * @throws ClosedBackupStoreException - if the BackupStore has been closed - * @throws IllegalArgumentException - on type mismatch (file vs. directory) of earlier backup, or if file is a Directory - */ - @Override - public boolean backupCopy(File file) throws IOException { - if (closed) - throw new ClosedBackupStoreException(Messages.BackupStore_backupCopy_closed_store); - if (!file.exists()) - throw new IOException(NLS.bind(Messages.BackupStore_file_not_found, file.getAbsolutePath())); - if (file.isDirectory()) - throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_can_not_copy_directory, file.getAbsolutePath())); - file = makeParentCanonical(file); - //File buRoot = backupRoot; - // File buRoot = findBackupRoot(file); - File buDir = new File(backupRoot, backupName); - // move the file - // create the relative path from root and use that in buDir - File buFile = new File(buDir, makeRelativeFromRoot(file).getPath()); - // already backed up, but was a directory = wrong usage - if (buFile.isDirectory()) - throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_directory_file_mismatch, buFile.getAbsolutePath())); - // has already been backed up - can only be done once with one BackupStore - if (buFile.exists()) - return false; - - // make sure all of the directories exist / gets created - buFile.getParentFile().getCanonicalFile().mkdirs(); - if (buFile.getParentFile().exists() && !buFile.getParentFile().isDirectory()) - throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_file_directory_mismatch, buFile.getParentFile().getAbsolutePath())); - - // just make a copy - one has to be made in one direction anyway - // A renameTo followed by a copy is preferred as it preserves file permissions on the moved file - // but it is easier to just copy and keep original. - Util.copyStream(new FileInputStream(file), true, new FileOutputStream(buFile), true); - backupCounter++; - return true; - } - - /** - * Performs backup of an empty directory. The directory must be empty before it can be backed up (i.e. - * similar to a delete of a directory). Backup the files of the directory first. - * A call to backup a directory is really only needed for empty directories as a restore - * of a file will also restore all of its parent directories. - * @param file - the (empty) directory to back up - * @return true if the directory was moved to backup. false if the directory was already backed up - * @throws IllegalArgumentException if file is not a directory, or is not empty. - * @throws IOException if directory can not be moved to the backup store, or if the directory is not writeable - */ - @Override - public boolean backupDirectory(File file) throws IOException { - if (!file.isDirectory()) - throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_not_a_directory, file.getAbsolutePath())); - file = makeParentCanonical(file); - if (file.list().length != 0) - throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_directory_not_empty, file.getAbsolutePath())); - // the easiest way is to create a dummy file and back that up (the dummy is simply ignored when restoring). - File dummy = new File(file, dummyName); - dummy = makeParentCanonical(dummy); - File buFile = getBackupFile(dummy); - boolean backedUp = buFile.exists(); - // backup only if the folder has not been already backed up; - // this can happen if, for example, two IUs unzip to the same folder and then want to delete it - if (!backedUp) { - if (closed) - throw new ClosedBackupStoreException("Can not perform backup()"); //$NON-NLS-1$ - if (!dummy.createNewFile()) - throw new IOException(NLS.bind(Messages.BackupStore_can_not_create_dummy, dummy.getAbsolutePath())); - moveToBackup(dummy, buFile); - } - // previous checks have verified that the directory exists - if (!file.delete()) - throw new IOException(NLS.bind(Messages.BackupStore_can_not_remove, dummy.getAbsolutePath())); - // will return true if the directory was already backed up at the beginning of the operation and false otherwise - return !backedUp; - } - - /** - * Restores all backup files from backup store. - * Note that restore of a (non directory) file deletes an existing file or directory found - * in the restore location. - * When the backup has been restored this BackupStore instance is closed and can not be - * used for further backup or restore. - * - * If there are unrestorable items (non writable directories, or general IO exceptions) these items - * are written to the log, and the backup copies remain in the file system and can be manually restored - * (using a simple zip of the backup directory, and an unzip to the buRoot once the problem has been corrected). - * - * @throws IOException if the backup was not fully restored - unrestored items have been logged. - * @throws ClosedBackupStoreException if the backup is already closed. - */ - @Override - public void restore() throws IOException { - if (closed) - throw new ClosedBackupStoreException(Messages.BackupStore_restore_closed_store); - // put back all files - // collect things that could not be restored (so final status can be reported) - Set<File> unrestorable = new HashSet<>(); - boolean restored = true; - if (!backupRoot.exists()) { - logError(NLS.bind(Messages.BackupStore_missing_backup_directory, backupRoot.getAbsolutePath())); - restored = false; - } else - restoreRoots(new File(backupRoot, backupName), unrestorable); - - logUnrestorables(unrestorable); - if (unrestorable.size() > 0) - restored = false; - close(restored); - closed = true; - } - - private void logUnrestorables(Set<File> unrestorable) { - // if there are unrestorable units log them - // - if (unrestorable != null && unrestorable.size() > 0) { - for (File file : unrestorable) - logError(NLS.bind(Messages.BackupStore_manual_restore_needed, file.getAbsolutePath())); - } - } - - /** - * Discards and closes this BackupStore. Does nothing if this store is already - * restored or discarded. - */ - @Override - public void discard() { - if (closed) - return; - closeSocket(); - removeBackups(); - closed = true; - } - - private void close(boolean fullyRestored) throws IOException { - closeSocket(); - // check external tampering with backup store - if (backupCounter != restoreCounter) { - if (!fullyRestored) - logError(NLS.bind(Messages.BackupStore_0_of_1_items_restored, Long.valueOf(restoreCounter), Long.valueOf(backupCounter))); - else { - logError(NLS.bind(Messages.BackupStore_externally_modified_0_of_1_restored, Long.valueOf(restoreCounter), Long.valueOf(backupCounter))); - fullyRestored = false; - } - } - if (!fullyRestored) - throw new IOException(Messages.BackupStore_errors_while_restoring_see_log); - // everything has been restored - the backup can now be removed - removeBackups(); - } - - private void closeSocket() { - if (socket != null && !socket.isClosed()) - try { - socket.close(); - } catch (IOException e) { /* ignored */ - logWarning(NLS.bind(Messages.BackupStore_can_not_close_tcp_port, Integer.valueOf(socket.getLocalPort()))); - } - } - - private void removeBackups() { - File buRoot = new File(backupRoot, backupName); - if (!fullyDelete(buRoot)) - logWarning(NLS.bind(Messages.BackupStore_can_not_remove_bu_directory, buRoot.getAbsolutePath())); - for (String newName : renamedInPlace.values()) { - File buFile = new File(newName); - if (!fullyDelete(buFile)) { - logWarning(NLS.bind(Messages.BackupStore_can_not_remove_bu_file, buRoot.getAbsolutePath())); - } - } - } - - private static void logWarning(String message) { - LogHelper.log(createWarning(message)); - } - - private static IStatus createWarning(String message) { - return new Status(IStatus.WARNING, Activator.ID, message); - } - - private static void logError(String message) { - LogHelper.log(createError(message)); - } - - private static IStatus createError(String message) { - return new Status(IStatus.ERROR, Activator.ID, message); - } - - /** - * Deletes a file, or a directory with all of it's children. - * @param file the file or directory to fully delete - * @return true if, and only if the file is deleted without errors - */ - private boolean fullyDelete(File file) { - if (file.isDirectory()) { - File[] children = file.listFiles(); - if (children != null) { - for (File child : children) { - // we will not stop even if some deletion failed - fullyDelete(new File(file, child.getName())); - } - } - } - // will attempt to delete before exists check to get rid of dead links - if (file.delete()) { - return true; - } - // will return true if files does not actually exist even delete fails - return !file.exists(); - } - - private void restore(File root, File buRoot, Set<File> unrestorable) { - File[] children = buRoot.listFiles(); - if (children == null) { // error - can't read the backup directory - unrestorable.add(buRoot); - return; - } - for (File child : children) { - File bu = new File(buRoot, child.getName()); - File target = new File(root, bu.getName()); - if (bu.isDirectory()) { - if (!target.exists() && !target.mkdir()) { - unrestorable.add(bu); - continue; // give up on this branch - } else if (target.exists() && !target.isDirectory()) { - // ouch, there is a file where we need a directory - // that must be deleted. - target.delete(); - if (!target.mkdir()) { - unrestorable.add(bu); - continue; // give up on branch - } - } - restore(target, bu, unrestorable); - } else { - // do not restore the dummies (as they are used to trigger creation of - // empty directories and are not wanted in the restored location. - if (bu.getName().equals(dummyName)) { - restoreCounter++; // count of the restored directory in this case. - continue; - } - // if the original was overwritten by something and this file was not - // removed, it needs to be deleted now. If it can't be deleted, the - // renameTo will fail, and the bu is reported as not restorable. - // fullyDelete will remove a directory completely - we are restoring a file so it can - // not be kept. - if (target.exists()) - fullyDelete(target); - - // rename if possible, but must copy if not possible to just rename - if (!bu.renameTo(target)) { - // did not work to rename, probably because of volume boundaries. Try to copy instead, - try { - Util.copyStream(new FileInputStream(bu), true, new FileOutputStream(target), true); - restoreCounter++; // consider it restored - } catch (FileNotFoundException e) { - unrestorable.add(bu); - continue; - } catch (IOException e) { - unrestorable.add(bu); - continue; - } - if (!bu.delete()) { // cleanup - // could not remove the backup after copy - log, safe to remove manually - logWarning(NLS.bind(Messages.BackupStore_can_not_delete_tmp_file, bu.getAbsolutePath())); - } - } else - restoreCounter++; - } - } - } - - /** - * Restores everything backed up in the buRoot. Responsible for decoding the specially named root - * target directories (i.e. _/, __/, C/, etc.) into the real system names. - * @param buRoot - * @param unrestorable - */ - private void restoreRoots(File buRoot, Set<File> unrestorable) { - File[] children = buRoot.listFiles(); - if (children == null) { // error - can't read the backup directory - unrestorable.add(buRoot); - return; - } - for (File child : children) { - // Names are root-chars, or drive letters in the root bu directory - String name = child.getName(); - String rName = name; - String prefix = ""; //$NON-NLS-1$ - while (rName.startsWith(ROOTCHAR)) { - prefix += File.separator; - rName = rName.substring(1); - } - if (prefix.length() < 1) { - // The name is a drive name - rName = rName + ":" + File.separator; //$NON-NLS-1$ - } else - rName = prefix + rName; - // File root = new File(rName); - File bu = new File(buRoot, name); - File target = new File(rName); - if (!bu.isDirectory()) { - // the roots should all be directories - so this can only happen if someone manually - // stored files in the backup root - mark them as unrestorable and continue. - unrestorable.add(bu); - continue; - } - // the backup roots are system roots, and can not be created - but check root is directory and exists. - // (Network drives could have gone away etc). - // - if (!(target.exists() && target.isDirectory())) { - unrestorable.add(bu); - continue; // give up on this branch - } - // then perform a recursive restore - restore(target, bu, unrestorable); - } - restoreRenamedFiles(unrestorable); - } - - private void restoreRenamedFiles(Set<File> unrestorable) { - for (Entry<String, String> entry : renamedInPlace.entrySet()) { - File bu = new File(entry.getValue()); - if (!bu.renameTo(new File(entry.getKey()))) - unrestorable.add(bu); - } - } - - private static long msCounter = 0; - - /** - * Generates a unique hex string by taking currentTimeMillis + sequence - * number at the end allowing for 32 numbers to be generated per ms. - * This is sufficient uniqueness in the same VM. (And is still just a fallback solution - * if there is no access to a TCP port) - * - * To make number unique over multiple VMs - the PID of the process would be enough, but - * it is complicated to get hold of - a separate program must be launched and its PPID - * investigated. There is no standard API in Java to get the PID. Instead, a socket port is bound - * to ensure local uniqueness. - * - * To make number unique across multiple hosts (we may be provisioning over NFS), the - * 48 LS bits of the IP address is used (this is more than enough for an IPv4 address). - * (If there is no IP address, the machine is not on a - * network) - unfortunately the MAC address can not be used as this requires Java 6 (where - * there also is a UUID that should be used instead of this method). - * - * This method needs to be modified when IPv6 addressing is the norm - at that time, the - * restriction on Java 1.4 has hopefully been lifted, and it is possible to use the MAC address, - * or the UUID provided since java 1.6 - * - * @return a unique string - */ - private String genUnique() { - // use 5 LSB bits for counter within ms - i.e. 32 instances can be created - // per millisecond. - long timePart = (System.currentTimeMillis() << 5) | (msCounter++ & 31); - // can't use the MAC address - but take IP address if provisioning across NFS - long ipPart = 0; - try { - // the returned address can be 32 bits IPv4, or 128 bits IPv6 (?) - // In any case use the LSB bits (as many as will fit - byte[] address = InetAddress.getLocalHost().getAddress(); - for (int i = 0; i < address.length; i++) - ipPart = ((ipPart << 8) | (address[i] & 0xff)); - } catch (UnknownHostException e) { - // there is no IP address, and there and hence no concurrency from other machines. - // use the default ip part 0 - } - int port = 0; - try { - // TODO: this should be replaced by InetAddress.getLoopbackAddress() when 1.7 compatibility is OK - // on a system where solely IPv6 is available this address resolution will fail: - socket = new ServerSocket(0, 1, InetAddress.getByName("127.0.0.1")); //$NON-NLS-1$ - port = socket.getLocalPort(); - } catch (IOException e) { - try { - if (socket != null) - socket.close(); - } catch (IOException e1) { // ignore failure to close - - } - // use a random number as port in this case - port = new Random().nextInt() & 0xffff; - } - // port is never > 0xffff - long aPart = (ipPart << 16) | (port & 0xffff); - return Long.toHexString(timePart) + "_" + Long.toHexString(aPart); //$NON-NLS-1$ - - } - - /** - * Turns a file into a "relativized" absolute file. - * A leading "root" is transformed to the ROOTCHAR character. On Windows, network mapped drives starts - * with two separators - and are encoded as two ROOTCHAR. - * e.g. - * \\Host\C$\File becomes __\Host\C$\File - * /users/test/file becomes _/users/test/file - * C:/somewhere/file becomes C/somewhere/file - * - * @param file - * @return a relativized absolute abstract file - */ - private File makeRelativeFromRoot(File file) { - File absolute = file.getAbsoluteFile(); - String path = absolute.getPath(); - String prefix = ""; //$NON-NLS-1$ - while (path.startsWith(File.separator)) { - prefix += ROOTCHAR; - path = path.substring(1); - } - if (prefix.length() > 0) { - path = prefix + File.separator + path; - return new File(path); - } - // it is a windows drive letter first. - // Transform C:/foo to C/foo - // - int idx = path.indexOf(":"); //$NON-NLS-1$ - if (idx < 1) - throw new InternalError("File is neither absolute nor has a drive name: " + path); //$NON-NLS-1$ - path = path.substring(0, idx) + path.substring(idx + 1); - - return new File(path); - } - - /** - * The parent path may include ".." as a directory name - this must be made canonical. But if the file itself is - * a symbolic link, it should not be resolved. - */ - private File makeParentCanonical(File file) throws IOException { - return new File(file.getParentFile().getCanonicalFile(), file.getName()); - } -} diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/LazyBackupStore.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/LazyBackupStore.java index 9ea5d5f56..f0aae9319 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/LazyBackupStore.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/LazyBackupStore.java @@ -21,7 +21,7 @@ import java.io.IOException; * when needed. */ public class LazyBackupStore implements IBackupStore { - private BackupStore delegate; + private SimpleBackupStore delegate; private final String prefix; /** @@ -61,7 +61,7 @@ public class LazyBackupStore implements IBackupStore { private void loadDelegate() { if (delegate != null) return; - delegate = new BackupStore(null, prefix); + delegate = new SimpleBackupStore(null, prefix); } @Override diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Messages.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Messages.java index 87e0a837e..9a3bd9c03 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Messages.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Messages.java @@ -26,10 +26,10 @@ public class Messages extends NLS { } public static String BackupStore_0_of_1_items_restored; - public static String BackupStore_backupCopy_closed_store; - public static String BackupStore_can_not_close_tcp_port; + public static String BackupStore_externally_modified_0_of_1_restored; + public static String BackupStore_errors_while_restoring_see_log; public static String BackupStore_can_not_copy_directory; - public static String BackupStore_can_not_create_dummy; + public static String BackupStore_can_not_create_placeholder; public static String BackupStore_can_not_delete_after_copy_0; public static String BackupStore_can_not_delete_tmp_file; public static String BackupStore_can_not_remove; @@ -37,14 +37,12 @@ public class Messages extends NLS { public static String BackupStore_can_not_remove_bu_file; public static String BackupStore_directory_file_mismatch; public static String BackupStore_directory_not_empty; - public static String BackupStore_errors_while_restoring_see_log; - public static String BackupStore_externally_modified_0_of_1_restored; public static String BackupStore_file_directory_mismatch; public static String BackupStore_file_not_found; public static String BackupStore_manual_restore_needed; public static String BackupStore_missing_backup_directory; public static String BackupStore_not_a_directory; - public static String BackupStore_restore_closed_store; + public static String BackupStore_closed_store; public static String BlockMacUpdate_0; public static String BlockMacUpdate_1; diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/SimpleBackupStore.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/SimpleBackupStore.java new file mode 100644 index 000000000..b1c0261d7 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/SimpleBackupStore.java @@ -0,0 +1,895 @@ +/******************************************************************************* + * Copyright (c) 2009, 2018 Cloudsmith Inc. and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Cloudsmith Inc. - initial API and implementation + * SAP AG - Ongoing development + *******************************************************************************/ + +package org.eclipse.equinox.internal.p2.touchpoint.natives; + +import static java.nio.file.FileVisitResult.CONTINUE; +import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; +import static java.util.stream.Collectors.joining; +import static org.eclipse.equinox.internal.p2.touchpoint.natives.Util.logError; +import static org.eclipse.equinox.internal.p2.touchpoint.natives.Util.logWarning; + +import java.io.File; +import java.io.IOException; +import java.nio.file.*; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.*; +import org.eclipse.osgi.util.NLS; + +/** + * Stores files by moving them to a uniquely named temporary directory. + * + * TheBackupStore remembers filenames and can recreate them in their original + * location. + * + * <h3>Usage</h3> The user of this class should instantiate the BackupStore with + * some prefix that is meaningful to a human. Uniqueness is obtained without the + * prefix - the prefix is used to be able to differentiate between different + * backup directories by a human (in case of crashes etc). + * + * If instantiated with a directory this directory will be used to store the + * backup root directory. If this directory is null, the users home directory is + * used by default. + * + * Once instantiated, use the {@link #backup(File)} and + * {@link #backupDirectory(File)} methods to move files to backup instead of + * deleting them. A file that is backed up should not be deleted - it is simply + * moved out of the way. Use {@link #backupCopy(File)} to move the file out of + * harms way, but keep a copy of it in the original location. The methods + * {@link #backupAll(File)} and {@link #backupCopyAll(File)} backs up an entire + * structure. + * + * When backup is finished - the user should either call {@link #restore()} to + * put all of the files back, or call {@link #discard()} to remove all of the + * backed up "copies". + * + * If {@link #restore()} or {@link #discard()} is not called the backup files + * will never be deleted. + * + * The backup store does not synchronize directories - actions that write new + * files are responsible for removing them. Overwriting existing files should be + * done by first backing up the file, and then creating a new file. Modifying a + * file, should be done by using {@link #backupCopy(File)} or first making a + * copy, then backing up the original, and then renaming the copy. + * + * <h3>Read Only and Permissions</h3> Directories that are read only (to current + * user) can not be backed up. Backup is performed using + * {@link File#renameTo(File)} and handling of permissions is operating system + * dependent. It is expected that a Un*x type system retains the permissions as + * a file is moved to the backup store and later gets restored. Backup + * directories are created as they are needed and will (at least on Un*x) + * inherit the permissions from its parent directory. + * + * If a rename can not be performed, the backup store will make a copy and + * delete the original file. This makes it possible to backup and restore across + * volume boundaries. + * + * When restoring directories they will be created with permissions in a + * platform specific way (on UN*IX they will inherit the permissions of the + * parent directory). + * + * <h3>Checkpointing</h3> Checkpointing (i.e. to be able to rollback to a + * particular point) can be implemented by using multiple instances of + * BackupStore. The client code will need to remember the individual order among + * the backup stores. + * + * <h3>Restartability</h3> Not implemented - it is possible to obtain the name + * of the backup directories, so manual restore is possible after a crash. An + * idea is to add persistence to a file, and be able to read it back in again. + * + * <h3>A note about exceptions</h3> In general {@link IllegalArgumentException} + * is thrown when attempting an operation that is considered "wrong use", and an + * {@link IllegalStateException} or subclass thereof is thrown on an overall + * wrong use of BackupStore (i.e. attempt to backup when store has been + * restored). Some cases of "wrong use" can not be differentiated from I/O + * errors (like a "file not found" as this could be caused by an entire disk + * disappearing - in these case an {@link IOException} is thrown. + * + * <h3>Implementation Note</h3> The backup root directory will contain folders + * that reflects file system roots. These are encoded using "_" for the UNI*X + * root directory, "__" for a Windows network mounted directory, and single + * "drive letter" folders corresponding to Windows drive letters. Typically, on + * UN*X there will only be a "_" directory in the backup root, and on windows + * there will typically be a single directory called "C". + */ +public class SimpleBackupStore implements IBackupStore { + public static final String BACKUP_FILE_EXTENSION = "p2bu"; //$NON-NLS-1$ + + public static final String DIR_PLACEHOLDER = "emptydir"; //$NON-NLS-1$ + + /** + * The name to use for a directory that represents leading separator (i.e. "/" + * or "\"). + */ + private static final String ROOTCHAR = "_"; //$NON-NLS-1$ + + /** + * Map of directory File to backup root (File) - the backup root has a directory + * named {@link #buStoreName} where the backup is found. + */ + private final Path buStoreRoot; + + private String buInPlaceSuffix; + + /** + * Backup files that sit next to the original rather than in the backup store. + */ + private List<Path> buInPlace; + + /** + * Counter of how many files where backed up. Used as a simple check mechanism + * if everything was restored (a guard against manual/external tampering with + * the backup directories). + */ + private long backupCounter; + + /** + * Counter of how many files where restored. See {@link #backupCounter}. + */ + private long restoreCounter; + + /** + * Flag indicating if this BackupStore has been restored or canceled. + */ + private boolean closed; + + /** + * Generates a BackupStore with a default prefix of ".p2bu" for backup directory + * and probe file. + */ + public SimpleBackupStore() { + this(null, "." + BACKUP_FILE_EXTENSION); //$NON-NLS-1$ + } + + /** + * Generates a BackupStore with a specified prefix for backup directories and + * probe file. + * + * @param buStoreParent Parent under which the backup store will be created. If + * null, java.io.tmpdir is used + * @param prefix Prefix used for human identification of backup stores. + */ + public SimpleBackupStore(File buStoreParent, String prefix) { + String unique = UUID.randomUUID().toString(); + + String buStoreName = prefix + "_" + unique; //$NON-NLS-1$ + this.buStoreRoot = (buStoreParent != null) ? buStoreParent.toPath().resolve(buStoreName) + : Paths.get(System.getProperty("java.io.tmpdir")).resolve(buStoreName); //$NON-NLS-1$ + + this.buInPlaceSuffix = String.format("-%s.%s", unique, BACKUP_FILE_EXTENSION); //$NON-NLS-1$ + this.buInPlace = new ArrayList<>(); + } + + /** + * Returns the unique backup name (this is the name of generated backup + * directories). + * + * @return the backup name. + */ + @Override + public String getBackupName() { + return buStoreRoot.getFileName().toString(); + } + + /** + * @return the parent dire under which backups are created + */ + public File getBackupRoot() { + return buStoreRoot.toFile(); + } + + /** + * Backup the file by moving it to the backup store (for later (optional) + * restore). Calling this method with a file that represents a directory is + * equivalent to calling {@link #backupDirectory(File)}. + * + * A file (path) can only be backed up once per BackupStore instance. When the + * file is backed up, it is moved to a directory under this BackupStore + * instance's directory with a relative path corresponding to the original + * relative path from the backup root e.g. the file /A/B/C/foo.txt could be + * moved to /A/.p2bu_ffffff_ffffff/B/C/foo.txt when /A is the backup root. + * + * If a directory is first backed up, and later replaced by a regular file, and + * this file is backed up (or vice versa) - an {@link IllegalArgumentException} + * is thrown + * + * A backup can not be performed on a closed BackupStore. + * + * @param file - the file (or directory) to backup + * + * @return true if the file was backed up, false if this file (path) has already + * been backed up (the file is not moved to the store). + * + * @throws IOException - if the backup operation fails, or the + * file does not exist + * @throws ClosedBackupStoreException - if the BackupStore has been closed + * @throws IllegalArgumentException - on type mismatch (file vs. directory) of + * earlier backup, or if file does not exist + */ + @Override + public boolean backup(File file) throws IOException { + assertOpen(); + + Path path = file.toPath(); + + if (Files.isDirectory(path)) { + return backupDirectory(path.toFile()); + } + + if (!Files.exists(path)) { + throw new IOException(NLS.bind(Messages.BackupStore_file_not_found, path.toAbsolutePath())); + } + + Path buPath = toBackupPath(path); + + // Already backed up, but was a directory - wrong usage + if (Files.isDirectory(buPath)) { + throw new IllegalArgumentException( + NLS.bind(Messages.BackupStore_directory_file_mismatch, buPath.toAbsolutePath())); + } + + return moveToBackup(path, buPath); + } + + /** + * Performs backup of an empty directory. + * + * The directory must be empty before it can be backed up (i.e. similar to a + * delete of a directory). The called must backup the files of the directory + * first. A call to backup a directory is really only needed for empty + * directories as a restore of a file will also restore all of its parent + * directories. + * + * @param file - the (empty) directory to back up + * + * @return true if the directory was moved to backup. false if the directory was + * already backed up. + * + * @throws IllegalArgumentException if file is not a directory, or is not empty. + * @throws IOException if directory can not be moved to the backup + * store, or if the directory is not writeable + */ + @Override + public boolean backupDirectory(File file) throws IOException { + assertOpen(); + + Path path = file.toPath(); + + if (!Files.isDirectory(path)) { + throw new IllegalArgumentException(NLS.bind(Messages.BackupStore_not_a_directory, file.getAbsolutePath())); + } + + if (Files.list(path).count() > 0) { + throw new IllegalArgumentException( + NLS.bind(Messages.BackupStore_directory_not_empty, file.getAbsolutePath())); + } + + return moveDirToBackup(path); + } + + /** + * Backs up a file, or everything under a directory. + * + * @param file - file to backup or directory + * + * @throws IOException if backup operation failed + */ + @Override + public void backupAll(File file) throws IOException { + assertOpen(); + + Path path = file.toPath().normalize(); + + Files.walkFileTree(path, new SimpleFileVisitor<Path>() { + @Override + public FileVisitResult visitFile(Path f, BasicFileAttributes attrs) throws IOException { + backup(f.toFile()); + return CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + if (exc != null) { + throw exc; + } + moveDirToBackup(dir); + return CONTINUE; + } + }); + } + + /** + * Backup the file by leaving a copy of the contents in the original location. + * + * Calling this method with a file that represents a directory throws an + * {@link IllegalArgumentException}. + * + * A file (path) can only be backed up once per BackupStore instance. When the + * file is backed up, it is moved to a directory under this BackupStore + * instance's directory with a relative path corresponding to the original + * relative path from the backup root e.g. the file /A/B/C/foo.txt could be + * moved to /A/.p2bu_ffffff_ffffff/B/C/foo.txt when /A is the backup root. + * + * If a directory is first backed up, and later replaced by a regular file, and + * this file is backed up (or vice versa) - an {@link IllegalArgumentException} + * is thrown + * + * A backup can not be performed on a closed BackupStore. + * + * @param file - the file (or directory) to backup + * + * @return true if the file was backed up, false if this file (path) has already + * been backed up (the file is not moved to the store). + * + * @throws IOException if the backup operation fails, or the file + * does not exist + * @throws ClosedBackupStoreException if the BackupStore has been closed + * @throws IllegalArgumentException on type mismatch (file vs. directory) of + * earlier backup, or if file is a Directory + */ + @Override + public boolean backupCopy(File file) throws IOException { + assertOpen(); + + Path path = file.toPath(); + + if (!Files.exists(path)) { + throw new IOException(NLS.bind(Messages.BackupStore_file_not_found, file.getAbsolutePath())); + } + + if (Files.isDirectory(path)) { + throw new IllegalArgumentException( + NLS.bind(Messages.BackupStore_can_not_copy_directory, file.getAbsolutePath())); + } + + Path buPath = toBackupPath(path); + + // Already backed up, but was a directory = wrong usage + if (Files.isDirectory(buPath)) { + throw new IllegalArgumentException( + NLS.bind(Messages.BackupStore_directory_file_mismatch, buPath.toAbsolutePath())); + } + + // Already backed up, can only be done once with one BackupStore + if (Files.exists(buPath)) { + return false; + } + + Files.createDirectories(buPath.getParent()); + Files.copy(path, buPath, REPLACE_EXISTING); + + backupCounter++; + return true; + } + + /** + * Backs up a file, or everything under a directory. + * + * A copy of the backup is left in the original place. + * + * @param file + * + * @throws IOException + */ + @Override + public void backupCopyAll(File file) throws IOException { + assertOpen(); + + Path path = file.toPath(); + if (!Files.exists(path)) { + return; + } + + path = path.normalize(); + + if (Files.isRegularFile(path, LinkOption.NOFOLLOW_LINKS)) { + backupCopy(file); + } else if (Files.isDirectory(path)) { + Files.walkFileTree(path, new SimpleFileVisitor<Path>() { + @Override + public FileVisitResult visitFile(Path f, BasicFileAttributes attrs) throws IOException { + backupCopy(f.toFile()); + return CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + if (exc != null) { + throw exc; + } + copyDirToBackup(dir); + return CONTINUE; + } + }); + } + } + + /** + * Restores all backup files from backup store. Note that restore of a (non + * directory) file deletes an existing file or directory found in the restore + * location. When the backup has been restored this BackupStore instance is + * closed and can not be used for further backup or restore. + * + * If there are unrestorable items (non writable directories, or general IO + * exceptions) these items are written to the log, and the backup copies remain + * in the file system and can be manually restored (using a simple zip of the + * backup directory, and an unzip to the buRoot once the problem has been + * corrected). + * + * @throws IOException if the backup was not fully restored - + * unrestored items have been logged. + * @throws ClosedBackupStoreException if the backup is already closed. + */ + @Override + public void restore() throws IOException { + assertOpen(); + closed = true; + + // Put back all files. + // Collect things that could not be restored + Map<Path, Throwable> unrestorable = new HashMap<>(); + + restoreBackups(unrestorable); + restoreInPlaceBackups(unrestorable); + + boolean restored = true; + + // Checked failed attempts to restore + if (!unrestorable.isEmpty()) { + restored = false; + + unrestorable.forEach((p, err) -> { + logError(NLS.bind(Messages.BackupStore_manual_restore_needed, err, p.toAbsolutePath())); + }); + } + + // Check external tampering with backup store + if (backupCounter != restoreCounter) { + restored = false; + + if (!unrestorable.isEmpty()) { + logError(NLS.bind(Messages.BackupStore_0_of_1_items_restored, restoreCounter, backupCounter)); + } else { + logError(NLS.bind(Messages.BackupStore_externally_modified_0_of_1_restored, restoreCounter, + backupCounter)); + } + } + + if (!restored) { + throw new IOException(Messages.BackupStore_errors_while_restoring_see_log); + } + } + + /** + * Discards and closes this BackupStore. Does nothing if this store is already + * restored or discarded. + */ + @Override + public void discard() { + if (closed) { + return; + } + closed = true; + + try { + deleteAll(buStoreRoot); + } catch (IOException e) { + logWarning(NLS.bind(Messages.BackupStore_can_not_remove_bu_directory, buStoreRoot.toAbsolutePath())); + } + + for (Path buFile : buInPlace) { + try { + deleteAll(buFile); + } catch (IOException e) { + logWarning(NLS.bind(Messages.BackupStore_can_not_remove_bu_file, buFile.toAbsolutePath())); + } + } + } + + private void assertOpen() { + if (closed) { + throw new ClosedBackupStoreException(Messages.BackupStore_closed_store); + } + } + + /** + * Makes sure a directory exists in the backup store without touching the original directory content + * + * @param path + * + * @return false if the directory is already created in the backup store, false if a placeholder had + * to be created and backed up. + * + * @throws IOException + */ + private boolean copyDirToBackup(Path path) throws IOException { + Path buPath = toBackupPath(path); + + if (Files.exists(buPath)) { + return false; + } + + Path placeholderPath = path.resolve(DIR_PLACEHOLDER); + try { + Files.createFile(placeholderPath); + } catch (IOException e) { + throw new IOException( + NLS.bind(Messages.BackupStore_can_not_create_placeholder, placeholderPath.toAbsolutePath()), e); + } + + Path buPlaceholderPath = buPath.resolve(DIR_PLACEHOLDER); + moveToBackup(placeholderPath, buPlaceholderPath); + return true; + } + + private boolean moveDirToBackup(Path dir) throws IOException { + boolean copied = copyDirToBackup(dir); + + try { + Files.delete(dir); + } catch (IOException e) { + throw new IOException(NLS.bind(Messages.BackupStore_can_not_remove, dir.toAbsolutePath())); + } + + return copied; + } + + /** + * Move/rename file to a backup file. + * + * Exposed for testing purposes. + * + * Callers of the method must have ensured that the source file exists and the + * backup file does not exist. + * + * @param file source file to move; should already exist and must not be + * directory + * @param buFile destination backup file to move to; should not exist and must + * be a directory + * + * @throws IOException if the backup operation fails + */ + private boolean moveToBackup(Path path, Path buPath) throws IOException { + // Already backed up. Can only be done once with one BackupStore. + if (Files.exists(buPath)) { + /* + * Although backed up, the file can be still on the file system. For example, + * two IUs may be unzipping their contents to the same location and share a few + * common files, which have to be removed twice. + */ + try { + Files.delete(path); + } catch (IOException e) { + throw new IOException(NLS.bind(Messages.BackupStore_can_not_remove, path.toAbsolutePath()), e); + } + + return false; + } + + // make sure all of the directories exist / gets created + Path buPathDir = buPath.getParent(); + try { + Files.createDirectories(buPathDir); + } catch (IOException e) { + throw new IllegalArgumentException( + NLS.bind(Messages.BackupStore_file_directory_mismatch, buPathDir.toAbsolutePath()), e); + } + + move(path, buPath); + if (isEclipseExe(path) && Files.isRegularFile(path)) { + // The original is the launcher executable and it still exists at the original + // location although the move succeeded. + // This happens when it is the Windows executable that is locked because it's + // running and we are attempting to move it to a different drive. + // In this case the target will exist as a copy, so we should delete it. + // Then backup in place which will necessarily be on the same drive. + Files.delete(buPath); + Path inPlaceBuPath = toInPlaceBackupPath(path); + move(path, inPlaceBuPath); + buInPlace.add(inPlaceBuPath); + } + + backupCounter++; + return true; + } + + /** + * Restores everything stored in the backup root + * + * Responsible for converting the root prefix of the path from backup format + * back to the original real OS names. I.e. "_/" to "//", "__/" to "///", "C/" + * to "C:", etc. + * + * @param unrestorable accumulate unrestorable paths (including the entire + * backup store). + * + * @throws IOException + */ + private void restoreBackups(Map<Path, Throwable> unrestorable) throws IOException { + if (!Files.exists(buStoreRoot)) { + unrestorable.put(buStoreRoot, new IOException( + NLS.bind(Messages.BackupStore_missing_backup_directory, buStoreRoot.toAbsolutePath()))); + return; + } + + Files.walkFileTree(buStoreRoot, new SimpleFileVisitor<Path>() { + @Override + public FileVisitResult preVisitDirectory(Path buDir, BasicFileAttributes attrs) { + try { + if (Files.isSameFile(buStoreRoot, buDir)) { + return CONTINUE; + } + + Path dir = toSourcePath(buDir); + + // There is a file where we the original directory used to be - delete it + if (Files.isRegularFile(dir)) { + Files.delete(dir); + } + + // Make the original directory if needed + Files.createDirectories(dir); + } catch (IOException e) { + unrestorable.put(buDir, e); + } + return CONTINUE; + } + + @Override + public FileVisitResult visitFile(Path buFile, BasicFileAttributes attrs) { + Path file = toSourcePath(buFile); + try { + // The first level children of buStoreRoot are always directories since they + // model file system roots + if (Files.isSameFile(buFile.getParent(), buStoreRoot)) { + unrestorable.put(buFile, new IOException("Not a directory")); //$NON-NLS-1$ + } else { + /* + * Do not restore the place-holders as they are used to trigger creation of + * empty directories and are not wanted in the restored location. + * + * They are counted as restored non the less. + */ + if (!DIR_PLACEHOLDER.equals(buFile.getFileName().toString())) { + // Clean up the site where the original used to be. + // It may be that a file or a directory now occupies it. + deleteAll(file); + + // Move the backup to the original location + move(buFile, file); + } else { + Files.delete(buFile); + } + + restoreCounter++; + } + } catch (IOException e) { + unrestorable.put(buFile, e); + } + return CONTINUE; + } + + @Override + public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { + unrestorable.put(file, exc); + throw exc; + } + + @Override + public FileVisitResult postVisitDirectory(Path buDir, IOException exc) throws IOException { + if (exc != null) { + unrestorable.put(buDir, exc); + throw exc; + } + try { + Files.delete(buDir); + } catch (DirectoryNotEmptyException e) { + String children = Files.list(buDir) + .map(p -> p.relativize(buDir)) + .map(Path::toString) + .collect(joining(",")); //$NON-NLS-1$ + unrestorable.put(buDir, new IOException(String.format( + "Directory %s not empty: %s", buDir, children, e))); //$NON-NLS-1$ + } catch (IOException e) { + unrestorable.put(buDir, e); + } + return CONTINUE; + } + }); + } + + private void restoreInPlaceBackups(Map<Path, Throwable> unrestorable) { + for (Path buPath : buInPlace) { + Path path = toInPlaceSourcePath(buPath); + + try { + move(buPath, path); + restoreCounter++; + } catch (IOException e) { + unrestorable.put(buPath, e); + } + } + } + + /** + * Converts a source path to a backup path. + * + * Exposed for testing purposes. + * + * A leading "root" is transformed to the ROOTCHAR character. On Windows, + * network mapped drives starts with two separators - and are encoded as two + * ROOTCHAR. + * + * E.g. \\Host\C$\file becomes __\Host\C$\file /users/test/file becomes + * _/users/test/file C:/file becomes C/file + * + * @param file a source file that needs to be backed up + * + * @return a file to which the original content can be backed up + * + * @throws IOException + */ + protected Path toBackupPath(Path path) throws IOException { + Path pathNormal = path.normalize(); + + String buPath = pathNormal.toAbsolutePath().toString(); + + String buPrefix = ""; //$NON-NLS-1$ + while (buPath.startsWith(File.separator)) { + buPrefix += ROOTCHAR; + buPath = buPath.substring(1); + } + + // Linux or Windows net mount + if (!buPrefix.isEmpty()) { + buPath = Paths.get(buPrefix, buPath).toString(); + } + // Windows + else { + // It is a windows drive letter first. + // Transform C:/foo to C/foo + int idx = buPath.indexOf(":"); //$NON-NLS-1$ + if (idx < 1) { + throw new IllegalArgumentException("File is neither absolute nor has a drive name: " + buPath); //$NON-NLS-1$ + } + buPath = buPath.substring(0, idx) + buPath.substring(idx + 1); + } + + Path buFile = buStoreRoot.resolve(buPath); + return buFile; + } + + /** + * Converts a backup file to the original source file. + * + * ///x/y/z -> ___x/y/z \\x\y\z c:\x\y\z -> c\x\y\z + * + * @param buPath an absolute file under {@link #buStoreRoot} to which some + * content is backed up. + * + * @return the original source file to which the content can be restored. + */ + protected Path toSourcePath(Path buPath) { + Path buPathRel = buStoreRoot.relativize(buPath); + + String pathName = buPathRel.toString(); + + String prefix = ""; //$NON-NLS-1$ + while (pathName.startsWith(ROOTCHAR)) { + prefix += File.separator; + pathName = pathName.substring(1); + } + + if (prefix.isEmpty()) { + // The first char is a windows drive name + pathName = pathName.charAt(0) + ":" + pathName.substring(1); //$NON-NLS-1$ + } else { + pathName = prefix + pathName; + } + + return Paths.get(pathName); + } + + /** + * Converts a path to an in-place backup path. + * + * Exposed for testing purposes. + * + * @param path + * + * @return a path next to the original where the original will be moved, rather + * than will be moved + */ + protected Path toInPlaceBackupPath(Path path) { + String buPathName = path.getFileName() + buInPlaceSuffix; + Path buPath = path.toAbsolutePath().resolveSibling(buPathName); + return buPath; + } + + /** + * Converts a in-place backup path to the original source path. + * + * Exposed for testing purposes. + * + * @param path + * + * @return a source path + */ + protected Path toInPlaceSourcePath(Path buPath) { + String buPathName = buPath.getFileName().toString(); + + int suffixIdx = buPathName.indexOf(buInPlaceSuffix); + if (suffixIdx <= 0) { + throw new IllegalArgumentException(); + } + + String pathName = buPathName.substring(0, suffixIdx); + Path path = buPath.resolveSibling(pathName); + return path; + } + + /** + * A generic file operation that attempts to move a file. + * + * Exposed in a separate method for testing purposes. + */ + protected void move(Path source, Path target) throws IOException { + Files.move(source, target, REPLACE_EXISTING); + } + + private static boolean isEclipseExe(Path file) { + String name = file.getFileName().toString(); + + String launcher = System.getProperty("eclipse.launcher"); //$NON-NLS-1$ + if (launcher != null) { + String launcherName = Paths.get(launcher).getFileName().toString(); + if (name.equalsIgnoreCase(launcherName)) { + return true; + } + } + + return name.equalsIgnoreCase("eclipse.exe") || name.equalsIgnoreCase("eclipsec.exe"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * Deletes a file, or a directory with all of it's children. + * + * @param path + * + * @throws IOException + */ + private static void deleteAll(Path path) throws IOException { + if (!Files.exists(path)) { + return; + } + + Files.walkFileTree(path, new SimpleFileVisitor<Path>() { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + Files.delete(file); + return CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + if (exc != null) { + throw exc; + } + Files.delete(dir); + return CONTINUE; + } + }); + } +} diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java index 3edabc078..afde945b3 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java @@ -31,10 +31,9 @@ import org.eclipse.equinox.p2.repository.artifact.*; import org.eclipse.osgi.util.NLS; public class Util { - - public static void log(String message) { - LogHelper.log(createError(message)); - } + /* + * Logging + */ public static IStatus createError(String message) { return new Status(IStatus.ERROR, Activator.ID, message); @@ -44,6 +43,34 @@ public class Util { return new Status(IStatus.ERROR, Activator.ID, message, exception); } + public static void logError(String message, Throwable exception) { + LogHelper.log(createError(message, exception)); + } + + public static void logError(String message) { + LogHelper.log(createError(message)); + } + + public static IStatus createWarning(String message) { + return new Status(IStatus.WARNING, Activator.ID, message); + } + + public static IStatus createWarning(String message, Throwable exception) { + return new Status(IStatus.WARNING, Activator.ID, message, exception); + } + + public static void logWarning(String message, Throwable exception) { + LogHelper.log(createWarning(message, exception)); + } + + public static void logWarning(String message) { + LogHelper.log(createWarning(message)); + } + + /* + * Locations and caches + */ + public static String getInstallFolder(IProfile profile) { return profile.getProperty(IProfile.PROP_INSTALL_FOLDER); } @@ -58,11 +85,13 @@ public class Util { public static IFileArtifactRepository getDownloadCacheRepo(IProvisioningAgent agent) throws ProvisionException { URI location = getDownloadCacheLocation(agent); - if (location == null) + if (location == null) { throw new IllegalStateException(Messages.could_not_obtain_download_cache); + } IArtifactRepositoryManager manager = getArtifactRepositoryManager(agent); - if (manager == null) + if (manager == null) { throw new IllegalStateException(Messages.artifact_repo_not_found); + } IArtifactRepository repository; try { repository = manager.loadRepository(location, null); @@ -76,18 +105,24 @@ public class Util { } IFileArtifactRepository downloadCache = repository.getAdapter(IFileArtifactRepository.class); - if (downloadCache == null) + if (downloadCache == null) { throw new ProvisionException(NLS.bind(Messages.download_cache_not_writeable, location)); + } return downloadCache; } - static private URI getDownloadCacheLocation(IProvisioningAgent agent) { + private static URI getDownloadCacheLocation(IProvisioningAgent agent) { IAgentLocation location = getAgentLocation(agent); - if (location == null) + if (location == null) { return null; + } return URIUtil.append(location.getDataArea("org.eclipse.equinox.p2.core"), "cache/"); //$NON-NLS-1$ //$NON-NLS-2$ } + /* + * File operations + */ + /** * Unzip from a File to an output directory, with progress indication and * backup. monitor and backup store may be null. @@ -113,9 +148,8 @@ public class Util { monitor); } catch (IOException e) { // add the file name to the message - IOException ioException = new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage())); - ioException.initCause(e); - throw ioException; + IOException ioExc = new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()), e); + throw ioExc; } } @@ -150,8 +184,9 @@ public class Util { throw new IOException(Messages.Util_Invalid_Zip_File_Format); } - if (path != null && path.trim().length() == 0) + if (path != null && path.trim().length() == 0) { path = null; + } Pattern pathRegex = path == null ? null : createAntStylePattern("(" + path + ")(*)"); //$NON-NLS-1$ //$NON-NLS-2$ Collection<Pattern> includeRegexp = new ArrayList<>(); @@ -177,8 +212,9 @@ public class Util { boolean unzip = includeRegexp.isEmpty(); for (Pattern pattern : includeRegexp) { unzip = pattern.matcher(name).matches(); - if (unzip) + if (unzip) { break; + } } if (unzip && !excludeRegexp.isEmpty()) { for (Pattern pattern : excludeRegexp) { @@ -193,8 +229,9 @@ public class Util { Matcher matcher = pathRegex.matcher(name); if (matcher.matches()) { name = matcher.group(2); - if (name.startsWith("/")) //$NON-NLS-1$ + if (name.startsWith("/")) { //$NON-NLS-1$ name = name.substring(1); + } } } File outFile = createSubPathFile(outputDir, name); @@ -203,10 +240,11 @@ public class Util { outFile.mkdirs(); } else { if (outFile.exists()) { - if (store != null) + if (store != null) { store.backup(outFile); - else + } else { outFile.delete(); + } } else { outFile.getParentFile().mkdirs(); } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java index 840c891b3..eaa8e60fc 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java @@ -40,7 +40,8 @@ public class CleanupcopyAction extends ProvisioningAction { /** * Perform a cleanup of a previously made copy action. - * @param parameters action parameters + * + * @param parameters action parameters * @param restoreable flag indicating if the operation should be backed up * @return status */ @@ -56,7 +57,7 @@ public class CleanupcopyAction extends ProvisioningAction { IInstallableUnit iu = (IInstallableUnit) parameters.get(ActionConstants.PARM_IU); IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); - String copied = profile.getInstallableUnitProperty(iu, "copied" + ActionConstants.PIPE + source + ActionConstants.PIPE + target); //$NON-NLS-1$ + String copied = profile.getInstallableUnitProperty(iu, CopyAction.buildCopiedFileIUPropertyKey(target, source)); if (copied == null) return Status.OK_STATUS; @@ -69,8 +70,8 @@ public class CleanupcopyAction extends ProvisioningAction { if (!file.exists()) continue; - //directories need to be deleted from the bottom-up, but directories are listed - //in traversal order during copy, so we need to reverse the directory list + // directories need to be deleted from the bottom-up, but directories are listed + // in traversal order during copy, so we need to reverse the directory list if (file.isDirectory()) directories.add(0, file); else { diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CopyAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CopyAction.java index 427e40bd4..94404fdf4 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CopyAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CopyAction.java @@ -26,12 +26,12 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.osgi.util.NLS; /** - * Copies from PARM_COPY_SOURCE to PARAM_COPY_TARGET - * The optional parameter PARAM_COPY_OVERWRITE overwrites and existing file if set to true, else - * and existing file with the same name is an error. The default is false. - * If the source is a directory, a merge copy to the target is performed. - * Copy will copy files and directories (recursively). - * + * Copies from PARM_COPY_SOURCE to PARAM_COPY_TARGET The optional parameter + * PARAM_COPY_OVERWRITE overwrites and existing file if set to true, else and + * existing file with the same name is an error. The default is false. If the + * source is a directory, a merge copy to the target is performed. Copy will + * copy files and directories (recursively). + * */ public class CopyAction extends ProvisioningAction { public static final String ID = "cp"; //$NON-NLS-1$ @@ -41,10 +41,11 @@ public class CopyAction extends ProvisioningAction { return copy(parameters, true); } - /** Perform the copy. + /** + * Perform the copy. * - * @param parameters action parameters - * @param restoreable flag indicating if the operation should be backed up + * @param parameters action parameters + * @param restoreable flag indicating if the operation should be backed up * @return status */ public static IStatus copy(Map<String, Object> parameters, boolean restoreable) { @@ -52,11 +53,13 @@ public class CopyAction extends ProvisioningAction { IBackupStore backupStore = restoreable ? (IBackupStore) parameters.get(NativeTouchpoint.PARM_BACKUP) : null; if (target == null) - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.param_not_set, ActionConstants.PARM_COPY_TARGET, ID), null); + return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, + NLS.bind(Messages.param_not_set, ActionConstants.PARM_COPY_TARGET, ID), null); String source = (String) parameters.get(ActionConstants.PARM_COPY_SOURCE); if (source == null) - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.param_not_set, ActionConstants.PARM_COPY_SOURCE, ID), null); + return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, + NLS.bind(Messages.param_not_set, ActionConstants.PARM_COPY_SOURCE, ID), null); String overwrite = (String) parameters.get(ActionConstants.PARM_COPY_OVERWRITE); Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE); @@ -78,7 +81,8 @@ public class CopyAction extends ProvisioningAction { try { copiedFiles = mergeCopy(sourceFile, targetFile, Boolean.parseBoolean(overwrite), backupStore); } catch (IOException e) { - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.copy_failed, sourceFile.getPath()), e); + return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, + NLS.bind(Messages.copy_failed, sourceFile.getPath()), e); } // keep copied file in the profile as memento for CleanupCopy StringBuffer copiedFileNameBuffer = new StringBuffer(); @@ -86,11 +90,16 @@ public class CopyAction extends ProvisioningAction { copiedFileNameBuffer.append(copiedFile.getAbsolutePath()).append(ActionConstants.PIPE); } - profile.setInstallableUnitProperty(iu, "copied" + ActionConstants.PIPE + originalSource + ActionConstants.PIPE + target, copiedFileNameBuffer.toString()); //$NON-NLS-1$ + profile.setInstallableUnitProperty(iu, buildCopiedFileIUPropertyKey(target, originalSource), + copiedFileNameBuffer.toString()); return Status.OK_STATUS; } + static String buildCopiedFileIUPropertyKey(String target, String originalSource) { + return "copied" + ActionConstants.PIPE + originalSource + ActionConstants.PIPE + target; //$NON-NLS-1$ + } + @Override public IStatus undo(Map<String, Object> parameters) { return CleanupcopyAction.cleanupcopy(parameters, false); @@ -98,12 +107,14 @@ public class CopyAction extends ProvisioningAction { /** * Merge-copy file or directory. + * * @param source * @param target * @param overwrite * @throws IOException */ - private static File[] mergeCopy(File source, File target, boolean overwrite, IBackupStore backupStore) throws IOException { + private static File[] mergeCopy(File source, File target, boolean overwrite, IBackupStore backupStore) + throws IOException { ArrayList<File> copiedFiles = new ArrayList<>(); xcopy(copiedFiles, source, target, overwrite, backupStore); return copiedFiles.toArray(new File[copiedFiles.size()]); @@ -111,15 +122,17 @@ public class CopyAction extends ProvisioningAction { /** * Merge-copy file or directory. + * * @param copiedFiles - ArrayList where copied files are collected * @param source * @param target * @param overwrite * @throws IOException */ - private static void xcopy(ArrayList<File> copiedFiles, File source, File target, boolean overwrite, IBackupStore backupStore) throws IOException { + private static void xcopy(ArrayList<File> copiedFiles, File source, File target, boolean overwrite, + IBackupStore backupStore) throws IOException { if (!source.exists()) - throw new IOException("Source: " + source + "does not exists"); //$NON-NLS-1$//$NON-NLS-2$ + throw new IOException("Source: " + source + " does not exists"); //$NON-NLS-1$//$NON-NLS-2$ if (source.isDirectory()) { if (target.exists() && target.isFile()) { @@ -152,7 +165,7 @@ public class CopyAction extends ProvisioningAction { } catch (IOException e) { // get the original IOException to the log e.printStackTrace(); - throw new IOException("Error while copying:" + source.getAbsolutePath()); //$NON-NLS-1$ + throw new IOException("Error while copying: " + source.getAbsolutePath()); //$NON-NLS-1$ } copiedFiles.add(target); } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/UnzipAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/UnzipAction.java index 77961095b..6dc4cf962 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/UnzipAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/UnzipAction.java @@ -44,19 +44,22 @@ public class UnzipAction extends ProvisioningAction { /** * Unzip as directed by parameters. * Record what was zipped in the profile. + * * @param parameters * @param restoreable - if the unzip should be backed up * @return status */ public IStatus unzip(Map<String, Object> parameters, boolean restoreable) { String source = (String) parameters.get(ActionConstants.PARM_SOURCE); - if (source == null) + if (source == null) { return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_SOURCE, ACTION_UNZIP)); + } String originalSource = source; String target = (String) parameters.get(ActionConstants.PARM_TARGET); - if (target == null) + if (target == null) { return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_TARGET, ACTION_UNZIP)); + } IInstallableUnit iu = (IInstallableUnit) parameters.get(ActionConstants.PARM_IU); Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE); @@ -87,7 +90,9 @@ public class UnzipAction extends ProvisioningAction { unzippedFileNameBuffer.append(unzippedFile.getAbsolutePath()).append(ActionConstants.PIPE); } - profile.setInstallableUnitProperty(iu, "unzipped" + ActionConstants.PIPE + originalSource + ActionConstants.PIPE + target, unzippedFileNameBuffer.toString()); //$NON-NLS-1$ + profile.setInstallableUnitProperty(iu, + "unzipped" + ActionConstants.PIPE + originalSource + ActionConstants.PIPE + target, //$NON-NLS-1$ + unzippedFileNameBuffer.toString()); return Status.OK_STATUS; } @@ -96,18 +101,23 @@ public class UnzipAction extends ProvisioningAction { * Unzips a source zip into the given destination. Any existing contents in the destination * are backed up in the provided backup store. */ - private static File[] unzip(String source, String destination, String path, String includePattern, String excludePattern, IBackupStore store) { + private static File[] unzip(String source, String destination, String path, String includePattern, + String excludePattern, IBackupStore store) { File zipFile = new File(source); if (zipFile == null || !zipFile.exists()) { - Util.log(UnzipAction.class.getName() + " the files to be unzipped is not here"); //$NON-NLS-1$ + Util.logError(UnzipAction.class.getName() + " the files to be unzipped is not here", null); //$NON-NLS-1$ } try { String taskName = NLS.bind(Messages.unzipping, source); String[] includes = includePattern == null ? null : includePattern.split("\\s+"); //$NON-NLS-1$ String[] excludes = excludePattern == null ? null : excludePattern.split("\\s+"); //$NON-NLS-1$ - return Util.unzipFile(zipFile, new File(destination), path, includes, excludes, store, taskName, new NullProgressMonitor()); + return Util.unzipFile(zipFile, new File(destination), path, includes, excludes, store, taskName, + new NullProgressMonitor()); } catch (IOException e) { - Util.log(UnzipAction.class.getName() + " error unzipping zipfile: " + zipFile.getAbsolutePath() + "destination: " + destination); //$NON-NLS-1$ //$NON-NLS-2$ + Util.logError( + UnzipAction.class.getName() + " error unzipping zipfile: " + zipFile.getAbsolutePath() //$NON-NLS-1$ + + "destination: " + destination, //$NON-NLS-1$ + null); } return new File[0]; } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/messages.properties b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/messages.properties index b5885bc36..298d24fa7 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/messages.properties +++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/messages.properties @@ -14,11 +14,10 @@ # SAP SE - bug 465602 ############################################################################### -BackupStore_backupCopy_closed_store=Can not perform backup on closed backup store. +BackupStore_closed_store=Can not perform operation on closed backup store. BackupStore_0_of_1_items_restored={0} items out of {1} items restored. -BackupStore_can_not_close_tcp_port=Could not close tcp socket for port: {0} BackupStore_can_not_copy_directory=Can not copy a directory: {0} -BackupStore_can_not_create_dummy=Can not create dummy file: {0} +BackupStore_can_not_create_placeholder=Can not create placeholder file: {0} BackupStore_can_not_delete_after_copy_0=File that was copied to backup could not be deleted: {0} BackupStore_can_not_delete_tmp_file=Can not delete temporary file - it is safe to delete it manually: {0} BackupStore_can_not_remove=Can not remove : {0} @@ -30,12 +29,11 @@ BackupStore_errors_while_restoring_see_log=Errors while restoring - see earlier BackupStore_externally_modified_0_of_1_restored=Backup store modified externally\! {0} items out of {1} items restored. Remaining items can not be found. BackupStore_file_directory_mismatch=File already backed up as a file - and is now required as a directory: {0} BackupStore_file_not_found=File does not exist: {0}. -BackupStore_manual_restore_needed=Manual restore of backup needed for: {0} +BackupStore_manual_restore_needed=Restore failed: {0}. Manual restore of backup needed for: {1} BackupStore_missing_backup_directory=Missing backup directory - can not restore: {0} BackupStore_not_a_directory=File is not a directory: {0} -BackupStore_restore_closed_store=Can not perform restore on closed backup store BlockMacUpdate_0=Installation impossible -BlockMacUpdate_1=The installation/update you are trying to perform can not be completed because of structural changes to Eclipse. The installation/update will stop and will leave your existing Eclipse installation intact. You need to retrieve a new version of Eclipse from http://download.eclipse.org/. +BlockMacUpdate_1=The installation/update you are trying to perform can not be completed because of structural changes to Eclipse. The installation/update will stop and will leave your existing Eclipse installation intact. You need to retrieve a new version of Eclipse from https://download.eclipse.org/. action_0_status=The action {0} was performed. action_0_failed_on_file_1_reason_2=The action {0} on file {1} failed. Reason: {2} 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 bbceef3db..31f2492ff 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,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.transport.ecf -Bundle-Version: 1.3.0.qualifier +Bundle-Version: 1.3.300.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.ecf;bundle-version="3.1.0", org.eclipse.ecf.filetransfer;bundle-version="4.0.0", diff --git a/bundles/org.eclipse.equinox.p2.transport.ecf/pom.xml b/bundles/org.eclipse.equinox.p2.transport.ecf/pom.xml index 4a2b35baa..7d8611d3e 100644 --- a/bundles/org.eclipse.equinox.p2.transport.ecf/pom.xml +++ b/bundles/org.eclipse.equinox.p2.transport.ecf/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.transport.ecf</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>1.3.300-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 d0e8b4e7b..7b6649c20 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 @@ -16,6 +16,7 @@ ******************************************************************************/ package org.eclipse.equinox.internal.p2.transport.ecf; +import java.util.Optional; import org.eclipse.ecf.filetransfer.service.IRetrieveFileTransferFactory; import org.eclipse.ecf.provider.filetransfer.IFileTransferProtocolToFactoryMapper; import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; @@ -173,4 +174,18 @@ public class Activator implements BundleActivator { return false; } + public static String getProperty(String key) { + if (context != null) { + return context.getProperty(key); + } + return System.getProperty(key); + } + + public static Optional<Version> getVersion() { + return Optional.ofNullable(context) // + .map(BundleContext::getBundle) // + .or(() -> Optional.ofNullable(FrameworkUtil.getBundle(FileReader.class)))// + .map(Bundle::getVersion); + } + } 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 8a45c5486..cfca3d832 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 @@ -163,7 +163,7 @@ public class FileInfoReader extends Job implements IRemoteFileSystemListener { try { container = ContainerFactory.getDefault().createContainer(); } catch (ContainerCreateException e) { - throw RepositoryStatusHelper.fromMessage(Messages.ecf_configuration_error); + throw RepositoryStatusHelper.fromExceptionMessage(e ,Messages.ecf_configuration_error); } IRemoteFileSystemBrowserContainerAdapter adapter = container.getAdapter(IRemoteFileSystemBrowserContainerAdapter.class); 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 6e6d6b916..7d95289f4 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 @@ -34,7 +34,7 @@ import org.eclipse.equinox.internal.p2.repository.*; import org.eclipse.equinox.internal.p2.repository.Messages; import org.eclipse.equinox.p2.core.IProvisioningAgent; import org.eclipse.osgi.util.NLS; -import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.Version; /** * FileReader is an ECF FileTransferJob implementation. @@ -64,11 +64,11 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi static Map<String, Map<String, String>> options; static private String getProperty(String key, String defaultValue) { - String value = FrameworkUtil.getBundle(FileReader.class).getBundleContext().getProperty(key); - if (value == null) { - value = defaultValue; + String value = Activator.getProperty(key); + if (value != null) { + return value; } - return value; + return defaultValue; } static { @@ -80,7 +80,7 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi String osgiArch = getProperty("org.osgi.framework.processor", "unknownArch");//$NON-NLS-1$//$NON-NLS-2$ 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(); + String p2Version = Activator.getVersion().map(Version::toString).orElse("unknownVersion"); //$NON-NLS-1$ userAgent = "p2/" + p2Version + " (Java " + javaSpec + ' ' + javaVendor + "; " + osName + ' ' + osVersion + ' ' //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + osgiArch + "; " + language + ") "; //$NON-NLS-1$ //$NON-NLS-2$ String userAgentProvided = getProperty("p2.userAgent", null); //$NON-NLS-1$ @@ -108,6 +108,8 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi private ProgressStatistics statistics; private final int connectionRetryCount; private final long connectionRetryDelay; + /** See bug 574173: allow to retry download if specified */ + private final boolean retryOnSocketTimeout; private final IConnectContext connectContext; private URI requestUri; protected IFileTransferConnectStartEvent connectEvent; @@ -130,6 +132,7 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi setUser(false); connectionRetryCount = RepositoryPreferences.getConnectionRetryCount(); connectionRetryDelay = RepositoryPreferences.getConnectionMsRetryDelay(); + retryOnSocketTimeout = RepositoryPreferences.getRetryOnSocketTimeout(); connectContext = aConnectContext; this.agent = aAgent; } @@ -512,11 +515,14 @@ public final class FileReader extends FileTransferJob implements IFileTransferLi if (t instanceof CoreException) throw RepositoryStatusHelper.unwindCoreException((CoreException) t); - // not meaningful to try 'timeout again' - if a server is that busy, we - // need to wait for quite some time before retrying- it is not likely it is - // just a temporary network thing. - if (t instanceof SocketTimeoutException) - throw RepositoryStatusHelper.wrap(t); + if (!retryOnSocketTimeout) { + // not meaningful to try 'timeout again' - if a server is that busy, we + // need to wait for quite some time before retrying- it is not likely it is + // just a temporary network thing. + if (t instanceof SocketTimeoutException) { + throw RepositoryStatusHelper.wrap(t); + } + } if (t instanceof IOException && attemptCounter < connectionRetryCount) { // TODO: Retry only certain exceptions or filter out 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 ba13b7fc4..a705ddcc0 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 @@ -192,8 +192,8 @@ public class RepositoryTransport extends Transport { // must translate this core exception as it is most likely not informative to a // user if (e.getStatus().getException() == null) - throw new CoreException(RepositoryStatus.forException(e, toDownload)); - throw new CoreException(RepositoryStatus.forStatus(e.getStatus(), toDownload)); + throw new CoreException(forException(e, toDownload)); + throw new CoreException(forStatus(e.getStatus(), toDownload)); } catch (LoginCanceledException e) { // i.e. same behavior when user cancels as when failing n attempts. throw new AuthenticationFailedException(); @@ -253,8 +253,8 @@ public class RepositoryTransport extends Transport { // must translate this core exception as it is most likely not informative to a // user if (e.getStatus().getException() == null) - throw new CoreException(RepositoryStatus.forException(e, toDownload)); - throw new CoreException(RepositoryStatus.forStatus(e.getStatus(), toDownload)); + throw new CoreException(forException(e, toDownload)); + throw new CoreException(forStatus(e.getStatus(), toDownload)); } catch (AuthenticationFailedException e) { promptUser = true; } catch (LoginCanceledException e) { @@ -278,6 +278,8 @@ public class RepositoryTransport extends Transport { return true; else if (t instanceof SocketException) return true; + else if (t instanceof IncomingFileTransferException && ((IncomingFileTransferException) t).getErrorCode() == 503) + return true; return false; } @@ -308,7 +310,7 @@ public class RepositoryTransport extends Transport { retryCount = Integer.valueOf(alreadyRetryCount.intValue() + 1); } } - if (retryCount != null) { + if (retryCount != null && retryCount.intValue() <= retry) { socketExceptionRetry.put(toDownload, retryCount); return new DownloadStatus(IStatus.ERROR, Activator.ID, IArtifactRepository.CODE_RETRY, NLS.bind(Messages.connection_to_0_failed_on_1_retry_attempt_2, new String[] { diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/META-INF/MANIFEST.MF index 8c34c1083..78f885414 100644 --- a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: %bundleName Bundle-Vendor: %providerName Bundle-Localization: plugin Bundle-SymbolicName: org.eclipse.equinox.p2.ui.admin.rcp; singleton:=true -Bundle-Version: 1.3.0.qualifier +Bundle-Version: 1.3.200.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.ui.admin.rcp.Activator Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.ui, diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/pom.xml b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/pom.xml index 78c6e3fbd..be007c637 100644 --- a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/pom.xml +++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.ui.admin.rcp</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>1.3.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/rcp.product b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/rcp.product index d5045d458..9ba3bcdc0 100644 --- a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/rcp.product +++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/rcp.product @@ -165,7 +165,7 @@ Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in t <plugin id="org.eclipse.core.filesystem.macosx" fragment="true"/> <plugin id="org.eclipse.core.jobs"/> <plugin id="org.eclipse.core.net"/> - <plugin id="org.eclipse.core.net.linux.x86_64" fragment="true"/> + <plugin id="org.eclipse.core.net.linux" fragment="true"/> <plugin id="org.eclipse.core.resources"/> <plugin id="org.eclipse.core.runtime"/> <plugin id="org.eclipse.e4.core.commands"/> @@ -211,7 +211,8 @@ Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in t <plugin id="org.eclipse.equinox.frameworkadmin"/> <plugin id="org.eclipse.equinox.frameworkadmin.equinox"/> <plugin id="org.eclipse.equinox.launcher"/> - <plugin id="org.eclipse.equinox.launcher.cocoa.macosx" fragment="true"/> + <plugin id="org.eclipse.equinox.launcher.cocoa.macosx.aarch64" fragment="true"/> + <plugin id="org.eclipse.equinox.launcher.cocoa.macosx.x86_64" fragment="true"/> <plugin id="org.eclipse.equinox.launcher.gtk.linux.x86_64" fragment="true"/> <plugin id="org.eclipse.equinox.p2.artifact.repository"/> <plugin id="org.eclipse.equinox.p2.console"/> @@ -238,7 +239,7 @@ Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in t <plugin id="org.eclipse.equinox.preferences"/> <plugin id="org.eclipse.equinox.registry"/> <plugin id="org.eclipse.equinox.security"/> - <plugin id="org.eclipse.equinox.security.linux.x86_64" fragment="true"/> + <plugin id="org.eclipse.equinox.security.linux" fragment="true"/> <plugin id="org.eclipse.equinox.security.macosx" fragment="true"/> <plugin id="org.eclipse.equinox.security.ui"/> <plugin id="org.eclipse.equinox.simpleconfigurator"/> @@ -254,7 +255,6 @@ Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in t <plugin id="org.eclipse.osgi.services"/> <plugin id="org.eclipse.osgi.util"/> <plugin id="org.eclipse.swt"/> - <plugin id="org.eclipse.swt.browser.chromium.gtk.linux.x86_64" fragment="true"/> <plugin id="org.eclipse.swt.cocoa.macosx" fragment="true"/> <plugin id="org.eclipse.swt.gtk.linux.x86_64" fragment="true"/> <plugin id="org.eclipse.text"/> diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/pom.xml b/bundles/org.eclipse.equinox.p2.ui.admin/pom.xml index 14bf88905..af1847806 100644 --- a/bundles/org.eclipse.equinox.p2.ui.admin/pom.xml +++ b/bundles/org.eclipse.equinox.p2.ui.admin/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> diff --git a/bundles/org.eclipse.equinox.p2.ui.discovery/.classpath b/bundles/org.eclipse.equinox.p2.ui.discovery/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.ui.discovery/.classpath +++ b/bundles/org.eclipse.equinox.p2.ui.discovery/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.ui.discovery/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.discovery/META-INF/MANIFEST.MF index c3173614a..7adb2a1e0 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 @@ -2,13 +2,13 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.equinox.p2.ui.discovery;singleton:=true -Bundle-Version: 1.2.0.qualifier +Bundle-Version: 1.2.300.qualifier Bundle-Vendor: %Bundle-Vendor Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.core.runtime, org.eclipse.ui;bundle-version="[3.118.0,4.0.0)", - org.eclipse.equinox.p2.discovery;bundle-version="[1.0.0,1.2.0)", + org.eclipse.equinox.p2.discovery;bundle-version="[1.0.0,1.3.0)", org.eclipse.ui.browser, org.eclipse.equinox.p2.discovery.compatibility;bundle-version="[1.0.0,1.3.0)";resolution:=optional, org.eclipse.equinox.p2.core;bundle-version="[2.0.0,3.0.0)", diff --git a/bundles/org.eclipse.equinox.p2.ui.discovery/pom.xml b/bundles/org.eclipse.equinox.p2.ui.discovery/pom.xml index 9b8ae73a2..54fa0b47d 100644 --- a/bundles/org.eclipse.equinox.p2.ui.discovery/pom.xml +++ b/bundles/org.eclipse.equinox.p2.ui.discovery/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.ui.discovery</artifactId> - <version>1.2.0-SNAPSHOT</version> + <version>1.2.300-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/wizards/CatalogViewer.java b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/wizards/CatalogViewer.java index f7ad21549..f4df92354 100644 --- a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/wizards/CatalogViewer.java +++ b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/wizards/CatalogViewer.java @@ -275,7 +275,7 @@ public class CatalogViewer extends FilteredViewer { return null; } String regex = filterText; - regex.replace("\\", "\\\\").replace("?", ".").replace("*", ".*?"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + regex = regex.replace("\\", "\\\\").replace("?", ".").replace("*", ".*?"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ return Pattern.compile(regex, Pattern.CASE_INSENSITIVE | Pattern.DOTALL); } diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF index f358f4d55..467432a6b 100755 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.ui.importexport;singleton:=true -Bundle-Version: 1.3.0.qualifier +Bundle-Version: 1.3.200.qualifier Bundle-Vendor: %providerName Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)", @@ -35,5 +35,4 @@ Import-Package: org.eclipse.equinox.internal.p2.metadata.repository.io, Service-Component: OSGI-INF/importexport.xml Export-Package: org.eclipse.equinox.internal.p2.importexport;version="1.3.0";x-friends:="org.eclipse.equinox.p2.tests", org.eclipse.equinox.internal.p2.importexport.internal;x-friends:="org.eclipse.equinox.p2.tests" -Bundle-Activator: org.eclipse.equinox.internal.p2.importexport.internal.ImportExportActivator Automatic-Module-Name: org.eclipse.equinox.p2.ui.importexport diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/forceQualifierUpdate.txt b/bundles/org.eclipse.equinox.p2.ui.importexport/forceQualifierUpdate.txt index 56f1032a8..03b2dab4b 100644 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/forceQualifierUpdate.txt +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/forceQualifierUpdate.txt @@ -1,2 +1,3 @@ # To force a version qualifier update add the bug here Bug 403352 - Update all parent versions to match our build stream +Bug 572789 - Comparator errors in I20210412-1800 after moving to compiler from 4.20 M1
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/icons/obj16/install-handler.png b/bundles/org.eclipse.equinox.p2.ui.importexport/icons/obj16/install-handler.png Binary files differnew file mode 100644 index 000000000..07986bf79 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/icons/obj16/install-handler.png diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/icons/obj16/install-handler@2x.png b/bundles/org.eclipse.equinox.p2.ui.importexport/icons/obj16/install-handler@2x.png Binary files differnew file mode 100644 index 000000000..88a3e73cf --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/icons/obj16/install-handler@2x.png diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/plugin.xml b/bundles/org.eclipse.equinox.p2.ui.importexport/plugin.xml index d3b4800bf..f67a5b6a5 100755 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/plugin.xml +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/plugin.xml @@ -10,7 +10,7 @@ <wizard category="org.eclipse.equinox.p2.category" class="org.eclipse.equinox.internal.p2.importexport.internal.wizard.ExportWizard" - icon="icons/wizban/install_wiz.png" + icon="icons/obj16/install-handler.png" id="org.eclipse.equinox.p2.replication.export" name="%export.name"> <description> @@ -27,7 +27,7 @@ <wizard category="org.eclipse.equinox.p2.category" class="org.eclipse.equinox.internal.p2.importexport.internal.wizard.ImportWizard" - icon="icons/wizban/install_wiz.png" + icon="icons/obj16/install-handler.png" id="org.eclipse.equinox.p2.replication.import" name="%import.name"> <description> @@ -37,7 +37,7 @@ <wizard category="org.eclipse.equinox.p2.category" class="org.eclipse.equinox.internal.p2.importexport.internal.wizard.ImportFromInstallationWizard" - icon="icons/wizban/install_wiz.png" + icon="icons/obj16/install-handler.png" id="org.eclipse.equinox.p2.replication.importfrominstallation" name="%importfrominstallation.name"> <description> diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/pom.xml b/bundles/org.eclipse.equinox.p2.ui.importexport/pom.xml index 1621c883d..0d01faecf 100644 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/pom.xml +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.ui.importexport</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>1.3.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportActivator.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportActivator.java deleted file mode 100644 index 0be4d6f81..000000000 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportActivator.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 WindRiver Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * WindRiver Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.p2.importexport.internal; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -public class ImportExportActivator extends AbstractUIPlugin { - - private static ImportExportActivator instance = null; - - public static ImportExportActivator getDefault() { - return instance; - } - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - - instance = this; - } -} diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportWizard.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportWizard.java index 33f7a1ee7..07e3d9654 100755 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportWizard.java +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportWizard.java @@ -15,19 +15,21 @@ package org.eclipse.equinox.internal.p2.importexport.internal.wizard; import java.io.File; import org.eclipse.core.runtime.Platform; -import org.eclipse.equinox.internal.p2.importexport.internal.*; +import org.eclipse.equinox.internal.p2.importexport.internal.Constants; +import org.eclipse.equinox.internal.p2.importexport.internal.Messages; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.IExportWizard; -import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.*; +import org.osgi.framework.FrameworkUtil; public class ExportWizard extends AbstractWizard implements IExportWizard { public ExportWizard() { - IDialogSettings workbenchSettings = ImportExportActivator.getDefault().getDialogSettings(); + IDialogSettings workbenchSettings = PlatformUI + .getDialogSettingsProvider(FrameworkUtil.getBundle(ExportWizard.class)).getDialogSettings(); String sectionName = "ExportWizard"; //$NON-NLS-1$ IDialogSettings section = workbenchSettings.getSection(sectionName); if (section == null) { @@ -46,7 +48,8 @@ public class ExportWizard extends AbstractWizard implements IExportWizard { @Override public void init(IWorkbench workbench, IStructuredSelection selection) { setWindowTitle(Messages.ExportWizard_WizardTitle); - setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(Platform.getBundle(Constants.Bundle_ID).getEntry("icons/wizban/install_wiz.png"))); //$NON-NLS-1$ + setDefaultPageImageDescriptor(ImageDescriptor + .createFromURL(Platform.getBundle(Constants.Bundle_ID).getEntry("icons/wizban/install_wiz.png"))); //$NON-NLS-1$ setNeedsProgressMonitor(true); } @@ -54,7 +57,8 @@ public class ExportWizard extends AbstractWizard implements IExportWizard { public boolean performFinish() { File file = new File(((ExportPage) mainPage).getDestinationValue()); if (file.exists()) { - if (!MessageDialog.openConfirm(this.getShell(), Messages.ExportWizard_ConfirmDialogTitle, NLS.bind(Messages.ExportWizard_OverwriteConfirm, file.getAbsolutePath()))) + if (!MessageDialog.openConfirm(this.getShell(), Messages.ExportWizard_ConfirmDialogTitle, + NLS.bind(Messages.ExportWizard_OverwriteConfirm, file.getAbsolutePath()))) return false; } return super.performFinish(); diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationPage.java index d9d68ce62..34acd48a2 100644 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationPage.java +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationPage.java @@ -418,7 +418,7 @@ public class ImportFromInstallationPage extends AbstractImportPage implements IS @Override public void setCheckedElements(Object[] elements) { - new UnsupportedOperationException(); + throw new UnsupportedOperationException(); } public ProvisioningContext getProvisioningContext() { diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationWizard.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationWizard.java index 0fb83516b..8d4568601 100644 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationWizard.java +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationWizard.java @@ -15,7 +15,8 @@ package org.eclipse.equinox.internal.p2.importexport.internal.wizard; import java.util.Collection; import org.eclipse.core.runtime.Platform; -import org.eclipse.equinox.internal.p2.importexport.internal.*; +import org.eclipse.equinox.internal.p2.importexport.internal.Constants; +import org.eclipse.equinox.internal.p2.importexport.internal.Messages; import org.eclipse.equinox.internal.p2.ui.dialogs.ISelectableIUsPage; import org.eclipse.equinox.internal.p2.ui.dialogs.InstallWizard; import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot; @@ -27,8 +28,8 @@ import org.eclipse.equinox.p2.ui.ProvisioningUI; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IImportWizard; -import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.*; +import org.osgi.framework.FrameworkUtil; public class ImportFromInstallationWizard extends InstallWizard implements IImportWizard { @@ -36,9 +37,12 @@ public class ImportFromInstallationWizard extends InstallWizard implements IImpo this(ProvisioningUI.getDefaultUI(), null, null, null); } - public ImportFromInstallationWizard(ProvisioningUI ui, InstallOperation operation, Collection<IInstallableUnit> initialSelections, LoadMetadataRepositoryJob preloadJob) { + public ImportFromInstallationWizard(ProvisioningUI ui, InstallOperation operation, + Collection<IInstallableUnit> initialSelections, LoadMetadataRepositoryJob preloadJob) { super(ui, operation, initialSelections, preloadJob); - IDialogSettings workbenchSettings = ImportExportActivator.getDefault().getDialogSettings(); + IDialogSettings workbenchSettings = PlatformUI + .getDialogSettingsProvider(FrameworkUtil.getBundle(ImportFromInstallationWizard.class)) + .getDialogSettings(); String sectionName = "ImportFromInstallationWizard"; //$NON-NLS-1$ IDialogSettings section = workbenchSettings.getSection(sectionName); if (section == null) { @@ -50,7 +54,8 @@ public class ImportFromInstallationWizard extends InstallWizard implements IImpo @Override public void init(IWorkbench workbench, IStructuredSelection selection) { setWindowTitle(Messages.ImportWizard_WINDOWTITLE); - setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(Platform.getBundle(Constants.Bundle_ID).getEntry("icons/wizban/install_wiz.png"))); //$NON-NLS-1$ + setDefaultPageImageDescriptor(ImageDescriptor + .createFromURL(Platform.getBundle(Constants.Bundle_ID).getEntry("icons/wizban/install_wiz.png"))); //$NON-NLS-1$ setNeedsProgressMonitor(true); } diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java index 63084646a..d782893bd 100644 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java @@ -367,7 +367,7 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage @Override public void setCheckedElements(Object[] elements) { - new UnsupportedOperationException(); + throw new UnsupportedOperationException(); } public ProvisioningContext getProvisioningContext() { diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportWizard.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportWizard.java index 075f603fa..22a8b1905 100644 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportWizard.java +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportWizard.java @@ -19,7 +19,8 @@ import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.importexport.internal.*; +import org.eclipse.equinox.internal.p2.importexport.internal.Constants; +import org.eclipse.equinox.internal.p2.importexport.internal.Messages; import org.eclipse.equinox.internal.p2.ui.ProvUI; import org.eclipse.equinox.internal.p2.ui.ProvUIMessages; import org.eclipse.equinox.internal.p2.ui.dialogs.ISelectableIUsPage; @@ -36,9 +37,9 @@ import org.eclipse.jface.operation.IRunnableContext; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IImportWizard; -import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.*; import org.eclipse.ui.statushandlers.StatusManager; +import org.osgi.framework.FrameworkUtil; public class ImportWizard extends InstallWizard implements IImportWizard { @@ -46,9 +47,12 @@ public class ImportWizard extends InstallWizard implements IImportWizard { this(ProvisioningUI.getDefaultUI(), null, null, null); } - public ImportWizard(ProvisioningUI ui, InstallOperation operation, Collection<IInstallableUnit> initialSelections, LoadMetadataRepositoryJob preloadJob) { + public ImportWizard(ProvisioningUI ui, InstallOperation operation, Collection<IInstallableUnit> initialSelections, + LoadMetadataRepositoryJob preloadJob) { super(ui, operation, initialSelections, preloadJob); - IDialogSettings workbenchSettings = ImportExportActivator.getDefault().getDialogSettings(); + IDialogSettings workbenchSettings = PlatformUI + .getDialogSettingsProvider(FrameworkUtil.getBundle(ImportFromInstallationWizard.class)) + .getDialogSettings(); String sectionName = "ImportWizard"; //$NON-NLS-1$ IDialogSettings section = workbenchSettings.getSection(sectionName); if (section == null) { @@ -60,7 +64,8 @@ public class ImportWizard extends InstallWizard implements IImportWizard { @Override public void init(IWorkbench workbench, IStructuredSelection selection) { setWindowTitle(Messages.ImportWizard_WINDOWTITLE); - setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(Platform.getBundle(Constants.Bundle_ID).getEntry("icons/wizban/install_wiz.png"))); //$NON-NLS-1$ + setDefaultPageImageDescriptor(ImageDescriptor + .createFromURL(Platform.getBundle(Constants.Bundle_ID).getEntry("icons/wizban/install_wiz.png"))); //$NON-NLS-1$ setNeedsProgressMonitor(true); } @@ -80,8 +85,9 @@ public class ImportWizard extends InstallWizard implements IImportWizard { } /** - * Recompute the provisioning plan based on the items in the IUElementListRoot and the given provisioning context. - * Report progress using the specified runnable context. This method may be called before the page is created. + * Recompute the provisioning plan based on the items in the IUElementListRoot + * and the given provisioning context. Report progress using the specified + * runnable context. This method may be called before the page is created. * * @param runnableContext */ @@ -98,9 +104,11 @@ public class ImportWizard extends InstallWizard implements IImportWizard { ProvisioningContext context = getProvisioningContext(); initializeResolutionModelElements(getOperationSelections()); if (planSelections.length == 0) { - operation = new InstallOperation(new ProvisioningSession(AbstractPage.agent), new ArrayList<IInstallableUnit>()) { + operation = new InstallOperation(new ProvisioningSession(AbstractPage.agent), + new ArrayList<IInstallableUnit>()) { @Override - protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor progressMonitor) { + protected void computeProfileChangeRequest(MultiStatus status, + IProgressMonitor progressMonitor) { progressMonitor.done(); } @@ -108,7 +116,8 @@ public class ImportWizard extends InstallWizard implements IImportWizard { public IStatus getResolutionResult() { if (sub.isCanceled()) return Status.CANCEL_STATUS; - return new Status(IStatus.ERROR, Constants.Bundle_ID, Messages.ImportWizard_CannotQuerySelection); + return new Status(IStatus.ERROR, Constants.Bundle_ID, + Messages.ImportWizard_CannotQuerySelection); } }; } else { @@ -129,7 +138,8 @@ public class ImportWizard extends InstallWizard implements IImportWizard { Display.getDefault().asyncExec(this::planChanged); }); } catch (InterruptedException e) { - operation = new InstallOperation(new ProvisioningSession(AbstractPage.agent), new ArrayList<IInstallableUnit>()) { + operation = new InstallOperation(new ProvisioningSession(AbstractPage.agent), + new ArrayList<IInstallableUnit>()) { @Override public IStatus getResolutionResult() { @@ -149,7 +159,8 @@ public class ImportWizard extends InstallWizard implements IImportWizard { if (message != null) { couldNotResolveStatus = new Status(IStatus.ERROR, Constants.Bundle_ID, message, null); } else { - couldNotResolveStatus = new Status(IStatus.ERROR, Constants.Bundle_ID, ProvUIMessages.ProvisioningOperationWizard_UnexpectedFailureToResolve, null); + couldNotResolveStatus = new Status(IStatus.ERROR, Constants.Bundle_ID, + ProvUIMessages.ProvisioningOperationWizard_UnexpectedFailureToResolve, null); } StatusManager.getManager().handle(couldNotResolveStatus, StatusManager.LOG); } diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF index 905c3b1d9..f6a0f04ed 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-SymbolicName: org.eclipse.equinox.p2.ui.sdk.scheduler;singleton:=true -Bundle-Version: 1.5.0.qualifier +Bundle-Version: 1.5.300.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.ui.sdk.scheduler.AutomaticUpdatePlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/pom.xml b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/pom.xml index 54f9a6208..f5f8a49f1 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/pom.xml +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.ui.sdk.scheduler</artifactId> - <version>1.5.0-SNAPSHOT</version> + <version>1.5.300-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java index 19833a9a0..6d56f31c9 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java @@ -19,8 +19,7 @@ package org.eclipse.equinox.internal.p2.ui.sdk.scheduler; import java.util.Date; import java.util.Random; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; import org.eclipse.equinox.internal.p2.garbagecollector.GarbageCollector; @@ -34,6 +33,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.query.IQuery; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.ui.IStartup; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.statushandlers.StatusManager; /** @@ -52,38 +52,59 @@ public class AutomaticUpdateScheduler implements IStartup { private static final int ONE_HOUR_IN_MS = 60 * 60 * 1000; private static final int ONE_DAY_IN_MS = 24 * ONE_HOUR_IN_MS; - private IUpdateListener listener = null; - private IUpdateChecker checker = null; - - private IProvisioningAgent agent; + private IUpdateListener listener; + private IUpdateChecker checker; @Override public void earlyStartup() { AutomaticUpdatePlugin.getDefault().setScheduler(this); - Job updateJob = Job.create("Update Job", e -> { //$NON-NLS-1$ - agent = ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), IProvisioningAgent.class); - IProfileRegistry registry = agent.getService(IProfileRegistry.class); - IProfile currentProfile = registry.getProfile(IProfileRegistry.SELF); - if (currentProfile != null && new MigrationSupport().performMigration(agent, registry, currentProfile)) { - return; + Job updateJob = new Job("Update Job") { //$NON-NLS-1$ + + @Override + protected IStatus run(IProgressMonitor monitor) { + IProvisioningAgent agent = ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), + IProvisioningAgent.class); + if (agent == null) { + String message = "No provisioning agent service found"; //$NON-NLS-1$ + AutomaticUpdatePlugin.getDefault().getLog().warn(message, new IllegalStateException(message)); + return Status.CANCEL_STATUS; + } + IProfileRegistry registry = agent.getService(IProfileRegistry.class); + IProfile currentProfile = registry.getProfile(IProfileRegistry.SELF); + if (currentProfile != null + && new MigrationSupport().performMigration(agent, registry, currentProfile)) { + return Status.OK_STATUS; + } + + removeUnusedPlugins(registry, agent); + scheduleUpdate(); + return Status.OK_STATUS; } - removeUnusedPlugins(registry); - scheduleUpdate(); - }); + @Override + public boolean belongsTo(Object family) { + return AutomaticUpdateScheduler.class == family; + } + + @Override + public boolean shouldRun() { + return PlatformUI.isWorkbenchRunning(); + } + }; + updateJob.setSystem(true); // allow the system to settle updateJob.schedule(20000); - } /** * Invokes the garbage collector to discard unused plugins, if specified by a * corresponding preference. * + * @param agent non null */ - private void removeUnusedPlugins(IProfileRegistry registry) { + private void removeUnusedPlugins(IProfileRegistry registry, IProvisioningAgent agent) { // check if gc is enabled IPreferenceStore pref = AutomaticUpdatePlugin.getDefault().getPreferenceStore(); if (!pref.getBoolean(PreferenceConstants.PREF_GC_ON_STARTUP)) { @@ -139,7 +160,14 @@ public class AutomaticUpdateScheduler implements IStartup { } }; - checker = agent.getService(IUpdateChecker.class); + IProvisioningAgent pagent = ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), + IProvisioningAgent.class); + if (pagent == null) { + String message = "No provisioning agent service found"; //$NON-NLS-1$ + AutomaticUpdatePlugin.getDefault().getLog().warn(message, new IllegalStateException(message)); + return; + } + checker = pagent.getService(IUpdateChecker.class); if (checker == null) { // Something did not initialize properly IStatus status = new Status(IStatus.ERROR, AutomaticUpdatePlugin.PLUGIN_ID, diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java index f435ef242..a87721308 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java @@ -93,6 +93,11 @@ public class PreviousConfigurationFinder { } @Override + public int hashCode() { + return Objects.hash(major, minor, service); + } + + @Override public String toString() { return "" + major + '.' + minor + '.' + service; //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java index 8a52a05e5..7cedadb2a 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java @@ -815,7 +815,7 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis @Override public void setCheckedElements(Object[] elements) { - new UnsupportedOperationException(); + throw new UnsupportedOperationException(); } // Look for update of the current selected installation units and replace the diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF index d1e640c63..4293409db 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-SymbolicName: org.eclipse.equinox.p2.ui.sdk;singleton:=true -Bundle-Version: 1.2.0.qualifier +Bundle-Version: 1.2.4.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.ui.sdk.ProvSDKUIActivator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -12,8 +12,12 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.core.runtime, org.eclipse.equinox.p2.ui;bundle-version="2.6.0" Import-Package: javax.xml.parsers, + org.bouncycastle.bcpg;version="1.69.0", + org.bouncycastle.openpgp;version="1.69.0", org.eclipse.compare;resolution:=optional, org.eclipse.compare.structuremergeviewer;resolution:=optional, + org.eclipse.equinox.internal.p2.artifact.processors.pgp, + org.eclipse.equinox.internal.p2.engine.phases, org.eclipse.equinox.p2.core;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.engine;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.engine.query;version="[2.0.0,3.0.0)", @@ -21,6 +25,7 @@ Import-Package: javax.xml.parsers, org.eclipse.equinox.p2.operations;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.planner;version="2.0.0", org.eclipse.equinox.p2.query;version="[2.0.0,3.0.0)", + org.eclipse.equinox.p2.repository.spi;version="2.0.0", org.eclipse.osgi.util;version="1.1.0", org.osgi.framework;version="1.6.0", org.w3c.dom, diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.properties b/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.properties index 672cb238d..372fe98ce 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.properties +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.properties @@ -28,5 +28,7 @@ provisioningPrefPage = Install/Update sitesPrefPage = Available Software Sites installedSoftwarePage = Installed Software installHistoryPage = Installation History +trustPrefPage = Trust preferenceKeywords.general=automatic update schedule remove download site software uninstall install import bundle +preferenceKeywords.trust=trust security keys pgp gpg preferences=Update and Install Preferences diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.xml b/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.xml index 249d78378..69e973118 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.xml +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.xml @@ -22,6 +22,14 @@ <keywordReference id="org.eclipse.equinox.p2.ui.sdk.updates.general"/> </page> + <page + name="%trustPrefPage" + category="org.eclipse.equinox.internal.p2.ui.sdk.ProvisioningPreferencePage" + class="org.eclipse.equinox.internal.p2.ui.sdk.TrustPreferencePage" + id="org.eclipse.equinox.internal.p2.ui.sdk.TrustPreferencePage"> + <keywordReference id="org.eclipse.equinox.p2.ui.sdk.updates.trust"/> + </page> + </extension> <extension @@ -29,6 +37,10 @@ <keyword label="%preferenceKeywords.general" id="org.eclipse.equinox.p2.ui.sdk.updates.general"/> + <keyword + id="org.eclipse.equinox.p2.ui.sdk.updates.trust" + label="%preferenceKeywords.trust"> + </keyword> </extension> diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/pom.xml b/bundles/org.eclipse.equinox.p2.ui.sdk/pom.xml index eb431e65b..bcca1f5ac 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/pom.xml +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.ui.sdk</artifactId> - <version>1.2.0-SNAPSHOT</version> + <version>1.2.4-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java index e985ebb74..26d979317 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java @@ -50,5 +50,32 @@ public class ProvSDKMessages extends NLS { public static String UpdateHandler_ProgressTaskName; public static String RemediationOperation_ResolveJobName; public static String RemediationOperation_ResolveJobTask; + public static String TrustPreferencePage_title; + public static String TrustPreferencePage_export; + public static String TrustPreferencePage_fileExportTitle; + public static String TrustPreferencePage_pgpIntro; + public static String TrustPreferencePage_fileImportTitle; + public static String TrustPreferencePage_addPGPKeyButtonLabel; + public static String TrustPreferencePage_Contributor; + public static String TrustPreferencePage_CopyFingerprint; + public static String TrustPreferencePage_DataValidExpires; + public static String TrustPreferencePage_DateExpired; + public static String TrustPreferencePage_DateExpiredSince; + public static String TrustPreferencePage_DateNotYetvalid; + public static String TrustPreferencePage_DateNotYetValid; + public static String TrustPreferencePage_DateValid; + public static String TrustPreferencePage_Details; + public static String TrustPreferencePage_Export; + public static String TrustPreferencePage_FingerprintIdColumn; + public static String TrustPreferencePage_NameColumn; + public static String TrustPreferencePage_PreferenceContributor; + public static String TrustPreferencePage_removePGPKeyButtonLabel; + public static String TrustPreferencePage_TrustAll; + public static String TrustPreferencePage_TrustAllConfirmationDescription; + public static String TrustPreferencePage_TrustAllConfirmationTitle; + public static String TrustPreferencePage_TrustAllNo; + public static String TrustPreferencePage_TrustAllYes; + public static String TrustPreferencePage_TypeColumn; + public static String TrustPreferencePage_ValidityColumn; } diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/SimpleLicenseManager.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/SimpleLicenseManager.java index 160fdf055..b5972a964 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/SimpleLicenseManager.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/SimpleLicenseManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 IBM Corporation and others. + * Copyright (c) 2007, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -11,17 +11,21 @@ * Contributors: * IBM Corporation - initial API and implementation * Genuitec, LLC - added license support + * Hannes Wellmann - Bug 574622: Persist remembered accepted licenses *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui.sdk; import java.util.HashSet; -import java.util.StringTokenizer; +import java.util.Set; +import java.util.regex.Pattern; +import org.eclipse.core.runtime.Platform; import org.eclipse.equinox.internal.p2.ui.sdk.prefs.PreferenceConstants; import org.eclipse.equinox.p2.core.IAgentLocation; import org.eclipse.equinox.p2.engine.IProfileRegistry; import org.eclipse.equinox.p2.engine.ProfileScope; import org.eclipse.equinox.p2.metadata.ILicense; import org.eclipse.equinox.p2.ui.LicenseManager; +import org.osgi.service.prefs.BackingStoreException; import org.osgi.service.prefs.Preferences; /** @@ -32,8 +36,8 @@ import org.osgi.service.prefs.Preferences; * @since 3.6 */ public class SimpleLicenseManager extends LicenseManager { - java.util.Set<String> accepted = new HashSet<>(); - String profileId; + private final Set<String> accepted = new HashSet<>(); + private final String profileId; public SimpleLicenseManager(String profileId) { super(); @@ -75,26 +79,25 @@ public class SimpleLicenseManager extends LicenseManager { return new ProfileScope(location, profileId).getNode(ProvSDKUIActivator.PLUGIN_ID); } + private static final Pattern DIGESTS_DELIMITER = Pattern.compile(","); //$NON-NLS-1$ + private void initializeFromPreferences() { Preferences pref = getPreferences(); if (pref != null) { String digestList = pref.get(PreferenceConstants.PREF_LICENSE_DIGESTS, ""); //$NON-NLS-1$ - StringTokenizer tokenizer = new StringTokenizer(digestList, ","); //$NON-NLS-1$ - while (tokenizer.hasMoreTokens()) { - accepted.add(tokenizer.nextToken().trim()); - } + DIGESTS_DELIMITER.splitAsStream(digestList).filter(s -> !s.isBlank()).map(String::strip) + .forEach(accepted::add); } } private void updatePreferences() { Preferences pref = getPreferences(); - StringBuilder result = new StringBuilder(); - Object[] indexedList = accepted.toArray(); - for (int i = 0; i < indexedList.length; i++) { - if (i != 0) - result.append(","); //$NON-NLS-1$ - result.append((String) indexedList[i]); + String acceptedLicenseDigests = String.join(",", accepted); //$NON-NLS-1$ + pref.put(PreferenceConstants.PREF_LICENSE_DIGESTS, acceptedLicenseDigests); + try { + pref.flush(); + } catch (BackingStoreException e) { + Platform.getLog(SimpleLicenseManager.class).error("Persisting remembered licenses failed", e); //$NON-NLS-1$ } - pref.put(PreferenceConstants.PREF_LICENSE_DIGESTS, result.toString()); } } diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/TrustPreferencePage.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/TrustPreferencePage.java new file mode 100644 index 000000000..bb0ef513e --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/TrustPreferencePage.java @@ -0,0 +1,491 @@ +/******************************************************************************* + * Copyright (c) 2021 Red Hat Inc. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.equinox.internal.p2.ui.sdk; + +import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter; + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.cert.*; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.*; +import java.util.List; +import java.util.function.Function; +import org.bouncycastle.bcpg.ArmoredOutputStream; +import org.bouncycastle.openpgp.PGPPublicKey; +import org.eclipse.core.runtime.*; +import org.eclipse.equinox.internal.p2.artifact.processors.pgp.PGPPublicKeyStore; +import org.eclipse.equinox.internal.p2.engine.phases.CertificateChecker; +import org.eclipse.equinox.internal.p2.ui.dialogs.PGPPublicKeyViewDialog; +import org.eclipse.equinox.internal.p2.ui.viewers.CertificateLabelProvider; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.engine.IProfileRegistry; +import org.eclipse.equinox.p2.repository.spi.PGPPublicKeyService; +import org.eclipse.jface.dialogs.*; +import org.eclipse.jface.layout.TableColumnLayout; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.util.Policy; +import org.eclipse.jface.viewers.*; +import org.eclipse.jface.widgets.LabelFactory; +import org.eclipse.jface.widgets.WidgetFactory; +import org.eclipse.jface.window.Window; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.*; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.*; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.osgi.framework.Bundle; +import org.osgi.framework.Constants; + +public class TrustPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + private static final String EXPORT_FILTER_PATH = "exportFilterPath"; //$NON-NLS-1$ + private static final String ADD_FILTER_PATH = "addFilterPath"; //$NON-NLS-1$ + + private CertificateChecker certificateChecker; + private Set<Certificate> trustedCertificates; + private PGPPublicKeyStore trustedKeys; + private Map<PGPPublicKey, Set<Bundle>> contributedTrustedKeys; + private boolean dirty; + private TableViewer viewer; + + public TrustPreferencePage() { + super(ProvSDKMessages.TrustPreferencePage_title); + } + + @Override + public void init(IWorkbench workbench) { + // nothing to do + } + + @Override + protected Control createContents(Composite parent) { + IProvisioningAgent provisioningAgent = ProvSDKUIActivator.getDefault().getProvisioningAgent(); + certificateChecker = new CertificateChecker(provisioningAgent); + certificateChecker + .setProfile(provisioningAgent.getService(IProfileRegistry.class).getProfile(IProfileRegistry.SELF)); + trustedCertificates = new LinkedHashSet<>(certificateChecker.getPreferenceTrustedCertificates()); + contributedTrustedKeys = certificateChecker.getContributedTrustedKeys(); + trustedKeys = certificateChecker.getPreferenceTrustedKeys(); + + Composite res = new Composite(parent, SWT.NONE); + res.setLayout(new GridLayout(2, false)); + + // Ensure that the message supports wrapping for a long text message. + GridData data = new GridData(SWT.FILL, SWT.DEFAULT, true, false, 2, 1); + data.widthHint = convertWidthInCharsToPixels(90); + LabelFactory factory = WidgetFactory.label(SWT.WRAP).text(ProvSDKMessages.TrustPreferencePage_pgpIntro) + .font(parent.getFont()).layoutData(data); + factory.create(res); + + TableColumnLayout tableColumnLayout = new TableColumnLayout(); + Composite tableComposite = WidgetFactory.composite(SWT.NONE) + .layoutData(new GridData(SWT.FILL, SWT.FILL, true, true)).layout(tableColumnLayout).create(res); + Table keyTable = WidgetFactory.table(SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION) + .headerVisible(true).linesVisible(true).font(parent.getFont()).create(tableComposite); + viewer = new TableViewer(keyTable); + keyTable.setHeaderVisible(true); + viewer.setContentProvider(new ArrayContentProvider()); + + // This column is packed later. + TableViewerColumn typeColumn = createColumn(viewer, ProvSDKMessages.TrustPreferencePage_TypeColumn, + key -> "PGP", cert -> "x509", tableColumnLayout, 1); //$NON-NLS-1$ //$NON-NLS-2$ + + createColumn(viewer, ProvSDKMessages.TrustPreferencePage_FingerprintIdColumn, + key -> PGPPublicKeyService.toHexFingerprint(key), + cert -> cert.getSerialNumber().toString(), tableColumnLayout, 10); + + createColumn(viewer, ProvSDKMessages.TrustPreferencePage_NameColumn, key -> { + List<String> userIds = new ArrayList<>(); + key.getUserIDs().forEachRemaining(userIds::add); + return String.join(", ", userIds); //$NON-NLS-1$ + }, cert -> CertificateLabelProvider.getText(cert), tableColumnLayout, 15); + + createColumn(viewer, ProvSDKMessages.TrustPreferencePage_Contributor, key -> { + { + Set<String> contributors = new LinkedHashSet<>(); + if (trustedKeys.all().contains(key)) { + contributors.add(ProvSDKMessages.TrustPreferencePage_PreferenceContributor); + } + Set<Bundle> bundles = contributedTrustedKeys.get(key); + if (bundles != null) { + Set<String> bundleContributors = new TreeSet<>(Policy.getComparator()); + bundles.stream().map(bundle -> getBundleName(bundle)).forEach(bundleContributors::add); + contributors.addAll(bundleContributors); + } + return String.join(", ", contributors); //$NON-NLS-1$ + } + }, cert -> ProvSDKMessages.TrustPreferencePage_PreferenceContributor, tableColumnLayout, + contributedTrustedKeys.isEmpty() ? 8 : 15); + + createColumn(viewer, ProvSDKMessages.TrustPreferencePage_ValidityColumn, pgp -> { + if (pgp.getCreationTime().after(Date.from(Instant.now()))) { + return NLS.bind(ProvSDKMessages.TrustPreferencePage_DateNotYetValid, pgp.getCreationTime()); + } + long validSeconds = pgp.getValidSeconds(); + if (validSeconds == 0) { + return ProvSDKMessages.TrustPreferencePage_DateValid; + } + Instant expires = pgp.getCreationTime().toInstant().plus(validSeconds, ChronoUnit.SECONDS); + return expires.isBefore(Instant.now()) + ? NLS.bind(ProvSDKMessages.TrustPreferencePage_DateExpiredSince, expires) + : NLS.bind(ProvSDKMessages.TrustPreferencePage_DataValidExpires, expires); + }, x509 -> { + try { + x509.checkValidity(); + return ProvSDKMessages.TrustPreferencePage_DateValid; + } catch (CertificateExpiredException expired) { + return ProvSDKMessages.TrustPreferencePage_DateExpired; + } catch (CertificateNotYetValidException notYetValid) { + return ProvSDKMessages.TrustPreferencePage_DateNotYetvalid; + } + }, tableColumnLayout, 8); + + updateInput(); + + Composite buttonComposite = createVerticalButtonBar(res); + buttonComposite.setLayoutData(new GridData(SWT.DEFAULT, SWT.BEGINNING, false, false)); + + Button exportButton = new Button(buttonComposite, SWT.PUSH); + exportButton.setText(ProvSDKMessages.TrustPreferencePage_export); + setVerticalButtonLayoutData(exportButton); + exportButton.setEnabled(false); + + exportButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { + Object element = viewer.getStructuredSelection().getFirstElement(); + FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); + dialog.setFilterPath(getFilterPath(EXPORT_FILTER_PATH)); + dialog.setText(ProvSDKMessages.TrustPreferencePage_fileExportTitle); + dialog.setFilterExtensions(new String[] { "*.asc" }); //$NON-NLS-1$ + FileDialog destination = new FileDialog(exportButton.getShell(), SWT.SAVE); + destination.setFilterPath(getFilterPath(EXPORT_FILTER_PATH)); + destination.setText(ProvSDKMessages.TrustPreferencePage_Export); + if (element instanceof X509Certificate) { + X509Certificate cert = (X509Certificate) element; + destination.setFilterExtensions(new String[] { "*.der" }); //$NON-NLS-1$ + destination.setFileName(cert.getSerialNumber().toString() + ".der"); //$NON-NLS-1$ + String path = destination.open(); + setFilterPath(EXPORT_FILTER_PATH, destination.getFilterPath()); + if (path == null) { + return; + } + File destinationFile = new File(path); + try (FileOutputStream output = new FileOutputStream(destinationFile)) { + output.write(cert.getEncoded()); + } catch (IOException | CertificateEncodingException ex) { + ProvSDKUIActivator.getDefault().getLog() + .log(new Status(IStatus.ERROR, ProvSDKUIActivator.PLUGIN_ID, ex.getMessage(), ex)); + } + } else { + PGPPublicKey key = (PGPPublicKey) element; + destination.setFilterExtensions(new String[] { "*.asc" }); //$NON-NLS-1$ + destination.setFileName(PGPPublicKeyService.toHexFingerprint(key) + ".asc"); //$NON-NLS-1$ + String path = destination.open(); + setFilterPath(EXPORT_FILTER_PATH, destination.getFilterPath()); + if (path == null) { + return; + } + File destinationFile = new File(path); + try (OutputStream output = new ArmoredOutputStream(new FileOutputStream(destinationFile))) { + key.encode(output); + } catch (IOException ex) { + ProvSDKUIActivator.getDefault().getLog() + .log(new Status(IStatus.ERROR, ProvSDKUIActivator.PLUGIN_ID, ex.getMessage(), ex)); + } + } + })); + + Button addButton = new Button(buttonComposite, SWT.PUSH); + addButton.setText(ProvSDKMessages.TrustPreferencePage_addPGPKeyButtonLabel); + addButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { + FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); + dialog.setFilterPath(getFilterPath(ADD_FILTER_PATH)); + dialog.setText(ProvSDKMessages.TrustPreferencePage_fileImportTitle); + dialog.setFilterExtensions(new String[] { "*.asc;*.der" }); //$NON-NLS-1$ + String path = dialog.open(); + setFilterPath(ADD_FILTER_PATH, dialog.getFilterPath()); + if (path == null) { + return; + } + + if (path.endsWith(".der")) { //$NON-NLS-1$ + try { + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); //$NON-NLS-1$ + try (InputStream input = Files.newInputStream(Paths.get(path))) { + Collection<? extends Certificate> certificates = certificateFactory.generateCertificates(input); + trustedCertificates.addAll(certificates); + updateInput(); + viewer.setSelection(new StructuredSelection(certificates.toArray()), true); + } + } catch (IOException | CertificateException ex) { + ProvSDKUIActivator.getDefault().getLog() + .log(new Status(IStatus.ERROR, ProvSDKUIActivator.PLUGIN_ID, ex.getMessage(), ex)); + } + } else { + HashSet<Object> oldKeys = new HashSet<>(trustedKeys.all()); + trustedKeys.add(new File(path)); + + HashSet<Object> newKeys = new HashSet<>(trustedKeys.all()); + newKeys.removeAll(oldKeys); + updateInput(); + viewer.setSelection(new StructuredSelection(newKeys.toArray()), true); + } + dirty = true; + })); + setVerticalButtonLayoutData(addButton); + + Button removeButton = new Button(buttonComposite, SWT.PUSH); + removeButton.setText(ProvSDKMessages.TrustPreferencePage_removePGPKeyButtonLabel); + removeButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { + for (Object key : getSelectedKeys()) { + if (key instanceof PGPPublicKey) { + trustedKeys.remove((PGPPublicKey) key); + } else { + trustedCertificates.remove(key); + } + } + updateInput(); + dirty = true; + })); + removeButton.setEnabled(false); + setVerticalButtonLayoutData(removeButton); + + Runnable details = () -> { + Object element = viewer.getStructuredSelection().getFirstElement(); + if (element instanceof X509Certificate) { + // create and open dialog for certificate chain + CertificateLabelProvider.openDialog(getShell(), (X509Certificate) element); + } else { + new PGPPublicKeyViewDialog(getShell(), (PGPPublicKey) element, + provisioningAgent.getService(PGPPublicKeyService.class)).open(); + } + }; + + Button detailsButton = new Button(buttonComposite, SWT.PUSH); + detailsButton.setText(ProvSDKMessages.TrustPreferencePage_Details); + detailsButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> details.run())); + detailsButton.setEnabled(false); + setVerticalButtonLayoutData(detailsButton); + + viewer.addPostSelectionChangedListener(e -> { + List<Object> selectedKeys = getSelectedKeys(); + exportButton.setEnabled(selectedKeys.size() == 1); + Collection<PGPPublicKey> keys = trustedKeys.all(); + removeButton.setEnabled( + selectedKeys.stream().anyMatch(o -> keys.contains(o) || trustedCertificates.contains(o))); + detailsButton.setEnabled(selectedKeys.size() == 1); + }); + + Button trustAllButton = WidgetFactory.button(SWT.CHECK).text(ProvSDKMessages.TrustPreferencePage_TrustAll) + .font(JFaceResources.getDialogFont()).create(res); + setButtonLayoutData(trustAllButton).verticalSpan = 2; + trustAllButton.setSelection(certificateChecker.isTrustAlways()); + trustAllButton.addSelectionListener(widgetSelectedAdapter(e -> { + if (trustAllButton.getSelection()) { + // Prompt the user to ensure they really understand what they've chosen, the + // risk, and where the preference is stored if they wish to change it in the + // future. Also ensure that the default button is no so that they must + // explicitly click the yes button, not just hit enter. + MessageDialog messageDialog = new MessageDialog(getShell(), + ProvSDKMessages.TrustPreferencePage_TrustAllConfirmationTitle, null, + ProvSDKMessages.TrustPreferencePage_TrustAllConfirmationDescription, MessageDialog.QUESTION, + new String[] { ProvSDKMessages.TrustPreferencePage_TrustAllYes, + ProvSDKMessages.TrustPreferencePage_TrustAllNo }, + 1) { + @Override + public Image getImage() { + return getWarningImage(); + } + }; + int result = messageDialog.open(); + if (result != Window.OK) { + certificateChecker.setTrustAlways(false); + // Restore the setting. + trustAllButton.setSelection(false); + } else { + certificateChecker.setTrustAlways(true); + } + + } + })); + + viewer.addDoubleClickListener(e -> details.run()); + + typeColumn.getColumn().pack(); + + createMenu(); + + return res; + } + + private void createMenu() { + Control control = viewer.getControl(); + Menu menu = new Menu(control); + control.setMenu(menu); + MenuItem item = new MenuItem(menu, SWT.PUSH); + item.setText(ProvSDKMessages.TrustPreferencePage_CopyFingerprint); + item.addSelectionListener(widgetSelectedAdapter(e -> { + Object element = viewer.getStructuredSelection().getFirstElement(); + if (element instanceof PGPPublicKey) { + Clipboard clipboard = new Clipboard(getShell().getDisplay()); + clipboard.setContents(new Object[] { + PGPPublicKeyService.toHexFingerprint((PGPPublicKey) element) }, + new Transfer[] { TextTransfer.getInstance() }); + clipboard.dispose(); + } + })); + + viewer.addSelectionChangedListener( + e -> item.setEnabled(viewer.getStructuredSelection().getFirstElement() instanceof PGPPublicKey)); + } + + private TableViewerColumn createColumn(TableViewer tableViewer, String text, Function<PGPPublicKey, String> pgpMap, + Function<X509Certificate, String> x509Map, TableColumnLayout tableColumnLayout, int columnWeight) { + TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.NONE); + column.getColumn().setText(text); + column.setLabelProvider(new PGPOrX509ColumnLabelProvider(pgpMap, x509Map)); + + tableColumnLayout.setColumnData(column.getColumn(), new ColumnWeightData(columnWeight)); + return column; + } + + private void updateInput() { + Set<PGPPublicKey> input = new TreeSet<>((k1, k2) -> { + return Arrays.compare(k1.getFingerprint(), k2.getFingerprint()); + }); + input = new LinkedHashSet<>(); + Collection<PGPPublicKey> all = trustedKeys.all(); + input = new TreeSet<>((k1, k2) -> { + boolean contains1 = all.contains(k1); + boolean contains2 = all.contains(k2); + if (contains1 != contains2) { + if (contains1) { + return -1; + } + return 1; + } + return PGPPublicKeyService.toHexFingerprint(k1).compareTo(PGPPublicKeyService.toHexFingerprint(k2)); + }); + input.addAll(all); + input.addAll(contributedTrustedKeys.keySet()); + + LinkedHashSet<Object> allInput = new LinkedHashSet<>(); + allInput.addAll(trustedCertificates); + allInput.addAll(input); + viewer.setInput(allInput); + } + + @SuppressWarnings("unchecked") + private List<Object> getSelectedKeys() { + return viewer.getStructuredSelection().toList(); + } + + private Composite createVerticalButtonBar(Composite parent) { + // Create composite. + Composite composite = new Composite(parent, SWT.NONE); + initializeDialogUnits(composite); + + // create a layout with spacing and margins appropriate for the font + // size. + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + layout.marginWidth = 5; + layout.marginHeight = 0; + layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + composite.setLayout(layout); + + return composite; + } + + private GridData setVerticalButtonLayoutData(Button button) { + GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); + Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + data.widthHint = Math.max(widthHint, minSize.x); + button.setLayoutData(data); + return data; + } + + private String getFilterPath(String key) { + IDialogSettings dialogSettings = DialogSettings + .getOrCreateSection(ProvSDKUIActivator.getDefault().getDialogSettings(), getClass().getName()); + String filterPath = dialogSettings.get(key); + if (filterPath == null) { + filterPath = System.getProperty("user.home"); //$NON-NLS-1$ + } + return filterPath; + } + + private void setFilterPath(String key, String filterPath) { + if (filterPath != null) { + IDialogSettings dialogSettings = DialogSettings + .getOrCreateSection(ProvSDKUIActivator.getDefault().getDialogSettings(), getClass().getName()); + dialogSettings.put(key, filterPath); + } + } + + private String getBundleName(Bundle bundle) { + String value = bundle.getHeaders().get(Constants.BUNDLE_NAME); + return value == null ? bundle.getSymbolicName() : Platform.getResourceString(bundle, value); + } + + @Override + protected void performDefaults() { + trustedCertificates = new LinkedHashSet<>(certificateChecker.getPreferenceTrustedCertificates()); + trustedKeys = certificateChecker.getPreferenceTrustedKeys(); + updateInput(); + super.performDefaults(); + } + + @Override + public boolean performOk() { + if (dirty) { + IStatus persistTrustedCertificates = certificateChecker.persistTrustedCertificates(trustedCertificates); + IStatus persistTrustedKeys = certificateChecker.persistTrustedKeys(trustedKeys); + dirty = false; + return persistTrustedKeys.isOK() && persistTrustedCertificates.isOK(); + } + return true; + } + + private static class PGPOrX509ColumnLabelProvider extends ColumnLabelProvider { + private Function<PGPPublicKey, String> pgpMap; + private Function<X509Certificate, String> x509map; + + public PGPOrX509ColumnLabelProvider(Function<PGPPublicKey, String> pgpMap, + Function<X509Certificate, String> x509map) { + this.pgpMap = pgpMap; + this.x509map = x509map; + } + + @Override + public String getText(Object element) { + if (element instanceof PGPPublicKey) { + return pgpMap.apply((PGPPublicKey) element); + } + if (element instanceof X509Certificate) { + return x509map.apply((X509Certificate) element); + } + return super.getText(element); + } + } + +} diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties index e91eb07b5..93df84f7f 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties @@ -34,4 +34,31 @@ UpdateHandler_NoSitesMessage=There are no update sites to search. Do you wish to UpdateHandler_NoSitesTitle=No Updates Found UpdateHandler_ProgressTaskName=Checking for updates... RemediationOperation_ResolveJobName=Searching alternate solutions... -RemediationOperation_ResolveJobTask=Some items cannot be at the highest version. Searching for the highest common denominator ...
\ No newline at end of file +RemediationOperation_ResolveJobTask=Some items cannot be at the highest version. Searching for the highest common denominator ... +TrustPreferencePage_title=Trust +TrustPreferencePage_export=\uD83D\uDCE5 E&xport... +TrustPreferencePage_fileExportTitle=Export PGP public key +TrustPreferencePage_fileImportTitle=Import PGP public key to trust +TrustPreferencePage_addPGPKeyButtonLabel=\u2795 &Add... +TrustPreferencePage_Contributor=Contributor +TrustPreferencePage_CopyFingerprint=Copy Fingerprint +TrustPreferencePage_DataValidExpires=\u2714\uFE0F Valid, expires {0} +TrustPreferencePage_DateExpired=\u274C Expired +TrustPreferencePage_DateExpiredSince=\u274C Expired since {0} +TrustPreferencePage_DateNotYetvalid=\u274C Not yet valid +TrustPreferencePage_DateNotYetValid=\u274C Not yet valid, starts {0} +TrustPreferencePage_DateValid=\u2714\uFE0F Valid +TrustPreferencePage_Details=\uD83D\uDD0D D&etails... +TrustPreferencePage_Export=Export... +TrustPreferencePage_FingerprintIdColumn=Fingerprint/Id +TrustPreferencePage_NameColumn=Name +TrustPreferencePage_PreferenceContributor=<preferences> +TrustPreferencePage_removePGPKeyButtonLabel=\uD83D\uDDD1\uFE0F &Remove +TrustPreferencePage_pgpIntro=Artifacts verifiably signed by the following trusted certificates and PGP public keys will be installed without confirmation. +TrustPreferencePage_TrustAll=Trust all content +TrustPreferencePage_TrustAllConfirmationDescription=Are you certain you wish to trust all content, including unsigned content of unknown origin, with no confirmation for all future operations? +TrustPreferencePage_TrustAllConfirmationTitle=Always Trust Everything Confirmation +TrustPreferencePage_TrustAllNo=No, Prompt Me Instead +TrustPreferencePage_TrustAllYes=Yes, I Accept the Risk +TrustPreferencePage_TypeColumn=Type +TrustPreferencePage_ValidityColumn=Validity Dates diff --git a/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF index 3530acb73..433d2e820 100644 --- a/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-SymbolicName: org.eclipse.equinox.p2.ui;singleton:=true -Bundle-Version: 2.7.0.qualifier +Bundle-Version: 2.7.400.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.ui.ProvUIActivator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -19,6 +19,7 @@ Export-Package: org.eclipse.equinox.internal.p2.ui; org.eclipse.equinox.internal.p2.ui.dialogs; x-friends:="org.eclipse.equinox.p2.ui.admin, org.eclipse.equinox.p2.ui.sdk.scheduler, + org.eclipse.equinox.p2.ui.sdk, org.eclipse.pde.ui, org.eclipse.equinox.p2.ui.importexport", org.eclipse.equinox.internal.p2.ui.model; @@ -28,7 +29,7 @@ Export-Package: org.eclipse.equinox.internal.p2.ui; org.eclipse.equinox.p2.ui.sdk, org.eclipse.equinox.p2.ui.importexport", org.eclipse.equinox.internal.p2.ui.query;x-friends:="org.eclipse.equinox.internal.p2.ui.analysis,org.eclipse.equinox.p2.ui.admin", - org.eclipse.equinox.internal.p2.ui.viewers;x-friends:="org.eclipse.equinox.p2.ui.admin,org.eclipse.equinox.p2.ui.sdk.scheduler,org.eclipse.equinox.p2.ui.importexport", + org.eclipse.equinox.internal.p2.ui.viewers;x-friends:="org.eclipse.equinox.p2.ui.admin,org.eclipse.equinox.p2.ui.sdk,org.eclipse.equinox.p2.ui.sdk.scheduler,org.eclipse.equinox.p2.ui.importexport", org.eclipse.equinox.p2.ui;version="2.6.0" Require-Bundle: org.eclipse.ui;bundle-version="3.107.0", org.eclipse.core.runtime;bundle-version="[3.18.0,4.0.0)", @@ -36,9 +37,14 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.107.0", org.eclipse.equinox.security.ui;bundle-version="[1.0.0,2.0.0)", org.eclipse.e4.ui.dialogs;bundle-version="1.1.600" Import-Package: javax.xml.parsers, + org.bouncycastle.bcpg;version="1.65.0", + org.bouncycastle.openpgp;version="1.65.0", + org.bouncycastle.util;version="1.65.1", + org.eclipse.equinox.internal.p2.artifact.processors.pgp, org.eclipse.equinox.internal.p2.artifact.repository, org.eclipse.equinox.internal.p2.core.helpers, org.eclipse.equinox.internal.p2.director, + org.eclipse.equinox.internal.p2.extensionlocation, org.eclipse.equinox.internal.p2.metadata, org.eclipse.equinox.internal.p2.metadata.repository, org.eclipse.equinox.internal.p2.operations, @@ -46,7 +52,7 @@ Import-Package: javax.xml.parsers, org.eclipse.equinox.internal.provisional.configurator, org.eclipse.equinox.internal.provisional.p2.core.eventbus, org.eclipse.equinox.internal.provisional.p2.repository, - org.eclipse.equinox.p2.core;version="[2.0.0,3.0.0)", + org.eclipse.equinox.p2.core;version="[2.7.0,3.0.0)", org.eclipse.equinox.p2.core.spi;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.engine;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.engine.query;version="[2.0.0,3.0.0)", @@ -57,7 +63,9 @@ Import-Package: javax.xml.parsers, org.eclipse.equinox.p2.query;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.repository;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.repository.artifact;version="[2.0.0,3.0.0)", + org.eclipse.equinox.p2.repository.artifact.spi;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.repository.metadata;version="[2.0.0,3.0.0)", + org.eclipse.equinox.p2.repository.spi;version="2.0.0", org.osgi.framework;version="1.6.0", org.osgi.service.packageadmin;version="1.2.0", org.w3c.dom, diff --git a/bundles/org.eclipse.equinox.p2.ui/forceQualifierUpdate.txt b/bundles/org.eclipse.equinox.p2.ui/forceQualifierUpdate.txt index a7d33c907..1cb35fada 100644 --- a/bundles/org.eclipse.equinox.p2.ui/forceQualifierUpdate.txt +++ b/bundles/org.eclipse.equinox.p2.ui/forceQualifierUpdate.txt @@ -1,3 +1,4 @@ # To force a version qualifier update add the bug here Bug 403352 - Update all parent versions to match our build stream Bug 509973 - Comparator errors in I20170105-0320 +Bug 572789 - Comparator errors in I20210412-1800 after moving to compiler from 4.20 M1
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.ui/plugin.xml b/bundles/org.eclipse.equinox.p2.ui/plugin.xml index 6f6031e2e..87e8645fd 100644 --- a/bundles/org.eclipse.equinox.p2.ui/plugin.xml +++ b/bundles/org.eclipse.equinox.p2.ui/plugin.xml @@ -12,6 +12,13 @@ <adapter type="org.eclipse.equinox.p2.repository.metadata.IMetadataRepository"/> <adapter type="org.eclipse.equinox.p2.repository.artifact.IArtifactRepository"/> </factory> + <factory + adaptableType="org.eclipse.ui.internal.about.AboutPluginsPage" + class="org.eclipse.equinox.internal.p2.ui.KeySigningInfoFactory"> + <adapter + type="org.eclipse.ui.internal.about.AboutBundleData$ExtendedSigningInfo"> + </adapter> + </factory> </extension> <extension diff --git a/bundles/org.eclipse.equinox.p2.ui/pom.xml b/bundles/org.eclipse.equinox.p2.ui/pom.xml index 2381fe8e1..13cace16e 100644 --- a/bundles/org.eclipse.equinox.p2.ui/pom.xml +++ b/bundles/org.eclipse.equinox.p2.ui/pom.xml @@ -14,11 +14,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.ui</artifactId> - <version>2.7.0-SNAPSHOT</version> + <version>2.7.400-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/IProvHelpContextIds.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/IProvHelpContextIds.java index cba53aa52..3c75aa5e9 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/IProvHelpContextIds.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/IProvHelpContextIds.java @@ -13,35 +13,37 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui; - /** * Help context ids for the P2 UI * <p> * This interface contains constants only; it is not intended to be implemented * or extended. * </p> + * * @since 3.4 * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. */ public interface IProvHelpContextIds { - public static final String PREFIX = ProvUIActivator.PLUGIN_ID + "."; //$NON-NLS-1$ + String PREFIX = ProvUIActivator.PLUGIN_ID + "."; //$NON-NLS-1$ + + String REVERT_CONFIGURATION_WIZARD = PREFIX + "revert_configuration_wizard_context"; //$NON-NLS-1$ - public static final String REVERT_CONFIGURATION_WIZARD = PREFIX + "revert_configuration_wizard_context"; //$NON-NLS-1$ + String UNINSTALL_WIZARD = PREFIX + "uinstall_wizard_context"; //$NON-NLS-1$ - public static final String UNINSTALL_WIZARD = PREFIX + "uinstall_wizard_context"; //$NON-NLS-1$ + String UPDATE_WIZARD = PREFIX + "update_wizard_context"; //$NON-NLS-1$ - public static final String UPDATE_WIZARD = PREFIX + "update_wizard_context"; //$NON-NLS-1$ + String ADD_REPOSITORY_DIALOG = PREFIX + "add_repository_dialog_context"; //$NON-NLS-1$ - public static final String ADD_REPOSITORY_DIALOG = PREFIX + "add_repository_dialog_context"; //$NON-NLS-1$ + String INSTALL_WIZARD = PREFIX + "install_wizard_context"; //$NON-NLS-1$ - public static final String INSTALL_WIZARD = PREFIX + "install_wizard_context"; //$NON-NLS-1$ + String REPOSITORY_MANIPULATION_DIALOG = PREFIX + "repository_manipulation_dialog_context"; //$NON-NLS-1$ - public static final String REPOSITORY_MANIPULATION_DIALOG = PREFIX + "repository_manipulation_dialog_context"; //$NON-NLS-1$ + String INSTALLED_SOFTWARE = PREFIX + "installed_software_context"; //$NON-NLS-1$ - public static final String INSTALLED_SOFTWARE = PREFIX + "installed_software_context"; //$NON-NLS-1$ + String AVAILABLE_SOFTWARE = PREFIX + "available_software_context"; //$NON-NLS-1$ - public static final String AVAILABLE_SOFTWARE = PREFIX + "available_software_context"; //$NON-NLS-1$ + String TRUST_DIALOG = PREFIX + "trust_dialog_context"; //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/KeySigningInfoFactory.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/KeySigningInfoFactory.java new file mode 100644 index 000000000..1134dbb56 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/KeySigningInfoFactory.java @@ -0,0 +1,184 @@ +/******************************************************************************* + * Copyright (c) 2022 Eclipse contributors and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.equinox.internal.p2.ui; + +import java.io.File; +import java.io.IOException; +import java.util.*; +import org.bouncycastle.openpgp.*; +import org.eclipse.core.runtime.*; +import org.eclipse.equinox.internal.p2.artifact.processors.pgp.PGPPublicKeyStore; +import org.eclipse.equinox.internal.p2.artifact.processors.pgp.PGPSignatureVerifier; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.metadata.IArtifactKey; +import org.eclipse.equinox.p2.query.IQueryResult; +import org.eclipse.equinox.p2.repository.artifact.*; +import org.eclipse.equinox.p2.repository.spi.PGPPublicKeyService; +import org.eclipse.ui.internal.about.AboutBundleData; +import org.eclipse.ui.internal.about.AboutPluginsPage; +import org.osgi.framework.Bundle; + +/** + * A factory used by the {@link AboutPluginsPage} to provide extended signing + * information, in particular information about PGP signing. + * + * @since 2.7.400 + */ +public class KeySigningInfoFactory implements IAdapterFactory { + + private static final Class<?>[] CLASSES = new Class[] { AboutBundleData.ExtendedSigningInfo.class }; + + @Override + public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { + if (adapterType == AboutBundleData.ExtendedSigningInfo.class) { + return adapterType.cast(new AboutBundleData.ExtendedSigningInfo() { + private final Map<File, Map<PGPSignature, PGPPublicKey>> bundlePoolArtficactSigningDetails = getBundlePoolArtficactPGPSigningDetails(); + + @Override + public boolean isSigned(Bundle bundle) { + return getDetails(bundle) != null; + } + + @Override + public String getSigningType(Bundle bundle) { + return ProvUIMessages.KeySigningInfoFactory_PGPSigningType; + } + + @Override + public String getSigningDetails(Bundle bundle) { + Map<PGPSignature, PGPPublicKey> details = getDetails(bundle); + if (details != null) { + PGPPublicKeyService keyService = getKeyService(); + List<String> lines = new ArrayList<>(); + for (PGPPublicKey key : details.values()) { + if (keyService != null) { + // Be sure to normalize/enhance the key so we properly don't show + // self-signatures. + key = keyService.addKey(key); + } + if (!lines.isEmpty()) { + lines.add(""); //$NON-NLS-1$ + } + addDetails(key, lines, ""); //$NON-NLS-1$ + if (keyService != null) { + Set<PGPPublicKey> verifiedCertifications = keyService.getVerifiedCertifications(key); + boolean first = true; + for (PGPPublicKey verifyingKey : verifiedCertifications) { + /// Don't show self-signatures. + if (!verifyingKey.equals(key)) { + if (first) { + lines.add(" " + ProvUIMessages.KeySigningInfoFactory_KeySignersSection); //$NON-NLS-1$ + first = false; + } + addDetails(verifyingKey, lines, " "); //$NON-NLS-1$ + } + } + } + } + return String.join("\n", lines); //$NON-NLS-1$ + } + return null; + } + + @Override + public Date getSigningTime(Bundle bundle) { + Map<PGPSignature, PGPPublicKey> details = getDetails(bundle); + return details == null ? null : details.keySet().iterator().next().getCreationTime(); + } + + private void addDetails(PGPPublicKey key, List<String> lines, String indentation) { + lines.add(indentation + ProvUIMessages.KeySigningInfoFactory_FingerprintItem + + PGPPublicKeyService.toHexFingerprint(key)); + for (Iterator<String> userIDs = key.getUserIDs(); userIDs.hasNext();) { + lines.add(indentation + ProvUIMessages.KeySigningInfoFactory_UserIDItem + userIDs.next()); + } + } + + private PGPPublicKeyService getKeyService() { + IProvisioningAgent agent = org.eclipse.equinox.internal.p2.extensionlocation.Activator + .getCurrentAgent(); + return agent == null ? null : agent.getService(PGPPublicKeyService.class); + } + + private Map<PGPSignature, PGPPublicKey> getDetails(Bundle bundle) { + try { + File bundleFile = FileLocator.getBundleFile(bundle).getCanonicalFile(); + Map<PGPSignature, PGPPublicKey> details = bundlePoolArtficactSigningDetails.get(bundleFile); + return details; + } catch (IOException | RuntimeException e) { + ProvUIActivator.getDefault().getLog() + .log(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e)); + return null; + } + } + }); + } + + return null; + } + + @Override + public Class<?>[] getAdapterList() { + return CLASSES; + } + + /** + * Returns a map from artifact files to the PGP signature/key pairs that were + * used to {@link PGPSignatureVerifier#close() verify} the artifact while it was + * being downloaded. + * + * @return a map of all the PGP signed artifact files to their signature/key + * pairs. + */ + private static Map<File, Map<PGPSignature, PGPPublicKey>> getBundlePoolArtficactPGPSigningDetails() { + Map<File, Map<PGPSignature, PGPPublicKey>> result = new LinkedHashMap<>(); + try { + // Look up artifact metadata for all the bundle pool repository of the + // installation. + IFileArtifactRepository bundlePoolRepository = org.eclipse.equinox.internal.p2.extensionlocation.Activator + .getBundlePoolRepository(); + IQueryResult<IArtifactKey> allArtifactKeys = bundlePoolRepository.query(ArtifactKeyQuery.ALL_KEYS, + new NullProgressMonitor()); + for (IArtifactKey key : allArtifactKeys) { + for (IArtifactDescriptor descriptor : bundlePoolRepository.getArtifactDescriptors(key)) { + File file = bundlePoolRepository.getArtifactFile(descriptor); + if (file != null) { + try { + Collection<PGPSignature> signatures = PGPSignatureVerifier.getSignatures(descriptor); + if (!signatures.isEmpty()) { + Map<PGPSignature, PGPPublicKey> details = new LinkedHashMap<>(); + PGPPublicKeyStore keys = PGPSignatureVerifier.getKeys(descriptor); + for (PGPSignature signature : signatures) { + Collection<PGPPublicKey> signingKeys = keys.getKeys(signature.getKeyID()); + if (!signingKeys.isEmpty()) { + // There is vanishingly small chance that two keys with colliding key IDs were + // used on two different signatures on the same artifact. + details.put(signature, signingKeys.iterator().next()); + } + } + if (!details.isEmpty()) { + result.put(file.getCanonicalFile(), details); + } + } + } catch (IOException | PGPException | RuntimeException e) { + ProvUIActivator.getDefault().getLog() + .log(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e)); + } + } + } + } + } catch (RuntimeException e) { + ProvUIActivator.getDefault().getLog() + .log(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e)); + } + return result; + } +} diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java index 05b8efc91..f79aacc0b 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java @@ -78,6 +78,7 @@ public class ProvUIMessages extends NLS { public static String IUGeneralInfoPropertyPage_VersionLabel; public static String IULicensePropertyPage_NoLicense; public static String IULicensePropertyPage_ViewLicenseLabel; + public static String PGPPublicKeyViewDialog_Title; public static String ProfileModificationAction_InvalidSelections; public static String ProfileModificationWizardPage_DetailsLabel; public static String ProfileSnapshots_Label; @@ -247,6 +248,10 @@ public class ProvUIMessages extends NLS { public static String SelectableIUsPage_Deselect_All; public static String InstallRemediationPage_Title; public static String InstallRemediationPage_Description; + public static String KeySigningInfoFactory_FingerprintItem; + public static String KeySigningInfoFactory_KeySignersSection; + public static String KeySigningInfoFactory_PGPSigningType; + public static String KeySigningInfoFactory_UserIDItem; public static String UpdateRemediationPage_Title; public static String UpdateRemediationPage_Description; public static String RemediationPage_SubDescription; @@ -271,11 +276,38 @@ public class ProvUIMessages extends NLS { public static String RemedyElementNotHighestVersion; public static String TrustCertificateDialog_Details; + public static String TrustCertificateDialog_Export; public static String TrustCertificateDialog_Title; public static String TrustCertificateDialog_Message; + public static String TrustCertificateDialog_MessageUnsigned; + public static String TrustCertificateDialog_MessageNameWarning; + public static String TrustCertificateDialog_MessagePGP; public static String TrustCertificateDialog_AcceptSelectedButtonLabel; + public static String TrustCertificateDialog_AlwaysTrust; + public static String TrustCertificateDialog_AlwaysTrustConfirmationMessage; + public static String TrustCertificateDialog_AlwaysTrustConfirmationTitle; + public static String TrustCertificateDialog_AlwaysTrustNo; + public static String TrustCertificateDialog_AlwaysTrustYes; + public static String TrustCertificateDialog_ArtifactId; public static String TrustCertificateDialog_SelectAll; public static String TrustCertificateDialog_DeselectAll; + public static String TrustCertificateDialog_ObjectType; + public static String TrustCertificateDialog_Id; + public static String TrustCertificateDialog_Name; + public static String TrustCertificateDialog_Classifier; + public static String TrustCertificateDialog_CopyFingerprint; + public static String TrustCertificateDialog_dates; + public static String TrustCertificateDialog_NotApplicable; + public static String TrustCertificateDialog_NotYetValidStartDate; + public static String TrustCertificateDialog_expiredSince; + public static String TrustCertificateDialog_validExpires; + public static String TrustCertificateDialog_valid; + public static String TrustCertificateDialog_expired; + public static String TrustCertificateDialog_notYetValid; + public static String TrustCertificateDialog_RememberSigners; + public static String TrustCertificateDialog_Unknown; + public static String TrustCertificateDialog_Unsigned; + public static String TrustCertificateDialog_Version; // Operations public static String UpdateManagerCompatibility_ExportSitesTitle; public static String UpdateManagerCompatibility_ImportSitesTitle; diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ServiceUIComponent.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ServiceUIComponent.java index fcea5da5a..cad8f35b9 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ServiceUIComponent.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ServiceUIComponent.java @@ -13,9 +13,8 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui; -import org.eclipse.equinox.p2.core.UIServices; - import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.core.UIServices; import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory; /** @@ -26,7 +25,7 @@ public class ServiceUIComponent implements IAgentServiceFactory { @Override public Object createService(IProvisioningAgent agent) { - return new ValidationDialogServiceUI(); + return new ValidationDialogServiceUI(agent); } } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java index 1c9135553..ae451f4c7 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java @@ -14,17 +14,29 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui; +import java.io.File; import java.net.URL; import java.security.cert.Certificate; +import java.util.*; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.stream.Collectors; +import org.bouncycastle.openpgp.PGPPublicKey; import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.equinox.internal.p2.ui.dialogs.TrustCertificateDialog; import org.eclipse.equinox.internal.p2.ui.dialogs.UserValidationDialog; -import org.eclipse.equinox.internal.p2.ui.viewers.CertificateLabelProvider; +import org.eclipse.equinox.p2.core.IProvisioningAgent; import org.eclipse.equinox.p2.core.UIServices; +import org.eclipse.equinox.p2.metadata.IArtifactKey; +import org.eclipse.equinox.p2.repository.artifact.spi.IArtifactUIServices; +import org.eclipse.equinox.p2.repository.spi.PGPPublicKeyService; import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; import org.eclipse.jface.dialogs.*; -import org.eclipse.jface.viewers.*; +import org.eclipse.jface.viewers.TreeNode; +import org.eclipse.jface.window.IShellProvider; import org.eclipse.jface.window.Window; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; @@ -34,18 +46,49 @@ import org.eclipse.swt.widgets.*; import org.eclipse.ui.PlatformUI; /** - * The default GUI-based implementation of {@link UIServices}. - * The service declaration is made in the serviceui_component.xml file. - + * The default GUI-based implementation of {@link UIServices}. The service + * declaration is made in the serviceui_component.xml file. + * */ -public class ValidationDialogServiceUI extends UIServices { +public class ValidationDialogServiceUI extends UIServices implements IArtifactUIServices { + + private final IProvisioningAgent agent; + + private Display display; + + private Consumer<String> linkHandler = link -> { + if (PlatformUI.isWorkbenchRunning()) { + try { + URL url = new URL(link); + PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(url); + } catch (Exception x) { + ProvUIActivator.getDefault().getLog() + .log(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, x.getMessage(), x)); + } + } + }; + + private IShellProvider shellProvider = () -> ProvUI.getDefaultParentShell(); + + public ValidationDialogServiceUI() { + this(null); + } + + public ValidationDialogServiceUI(IProvisioningAgent agent) { + this.agent = agent; + } static final class MessageDialogWithLink extends MessageDialog { private final String linkText; + private final Consumer<String> linkOpener; - MessageDialogWithLink(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex, String linkText) { - super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex); + MessageDialogWithLink(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, + int dialogImageType, String[] dialogButtonLabels, int defaultIndex, String linkText, + Consumer<String> linkOpener) { + super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, + defaultIndex); this.linkText = linkText; + this.linkOpener = linkOpener; } @Override @@ -56,13 +99,7 @@ public class ValidationDialogServiceUI extends UIServices { Link link = new Link(parent, SWT.NONE); link.setText(linkText); link.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { - try { - URL url = new URL(e.text); - PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(url); - } catch (Exception x) { - ProvUIActivator.getDefault().getLog().log(// - new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, x.getMessage(), x)); - } + linkOpener.accept(e.text); })); return link; } @@ -73,7 +110,8 @@ public class ValidationDialogServiceUI extends UIServices { */ static class OkCancelErrorDialog extends ErrorDialog { - public OkCancelErrorDialog(Shell parentShell, String dialogTitle, String message, IStatus status, int displayMask) { + public OkCancelErrorDialog(Shell parentShell, String dialogTitle, String message, IStatus status, + int displayMask) { super(parentShell, dialogTitle, message, status, displayMask); } @@ -91,10 +129,11 @@ public class ValidationDialogServiceUI extends UIServices { final AuthenticationInfo[] result = new AuthenticationInfo[1]; if (!suppressAuthentication() && !isHeadless()) { - PlatformUI.getWorkbench().getDisplay().syncExec(() -> { - Shell shell = ProvUI.getDefaultParentShell(); + getDisplay().syncExec(() -> { + Shell shell = shellProvider.getShell(); String message = NLS.bind(ProvUIMessages.ServiceUI_LoginDetails, location); - UserValidationDialog dialog = new UserValidationDialog(shell, ProvUIMessages.ServiceUI_LoginRequired, null, message); + UserValidationDialog dialog = new UserValidationDialog(shell, ProvUIMessages.ServiceUI_LoginRequired, + null, message); int dialogCode = dialog.open(); if (dialogCode == Window.OK) { result[0] = dialog.getResult(); @@ -116,23 +155,37 @@ public class ValidationDialogServiceUI extends UIServices { @Override public TrustInfo getTrustInfo(Certificate[][] untrustedChains, final String[] unsignedDetail) { + return getTrustInfo(untrustedChains, Collections.emptyList(), unsignedDetail); + } + + @Override + public TrustInfo getTrustInfo(Certificate[][] untrustedChains, Collection<PGPPublicKey> untrustedPublicKeys, + final String[] unsignedDetail) { + if (untrustedChains == null) { + untrustedChains = new Certificate[][] {}; + } boolean trustUnsigned = true; boolean persistTrust = false; - Certificate[] trusted = new Certificate[0]; - // Some day we may summarize all of this in one UI, or perhaps we'll have a preference to honor regarding - // unsigned content. For now we prompt separately first as to whether unsigned detail should be trusted + List<Certificate> trustedCertificates = new ArrayList<>(); + List<PGPPublicKey> trustedKeys = new ArrayList<>(); + // Some day we may summarize all of this in one UI, or perhaps we'll have a + // preference to honor regarding + // unsigned content. For now we prompt separately first as to whether unsigned + // detail should be trusted if (!isHeadless() && unsignedDetail != null && unsignedDetail.length > 0) { - final boolean[] result = new boolean[] {false}; - PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { + final boolean[] result = new boolean[] { false }; + getDisplay().syncExec(new Runnable() { @Override public void run() { - Shell shell = ProvUI.getDefaultParentShell(); - OkCancelErrorDialog dialog = new OkCancelErrorDialog(shell, ProvUIMessages.ServiceUI_warning_title, null, createStatus(), IStatus.WARNING); + Shell shell = shellProvider.getShell(); + OkCancelErrorDialog dialog = new OkCancelErrorDialog(shell, ProvUIMessages.ServiceUI_warning_title, + null, createStatus(), IStatus.WARNING); result[0] = dialog.open() == IDialogConstants.OK_ID; } private IStatus createStatus() { - MultiStatus parent = new MultiStatus(ProvUIActivator.PLUGIN_ID, 0, ProvUIMessages.ServiceUI_unsigned_message, null); + MultiStatus parent = new MultiStatus(ProvUIActivator.PLUGIN_ID, 0, + ProvUIMessages.ServiceUI_unsigned_message, null); for (String element : unsignedDetail) { parent.add(new Status(IStatus.WARNING, ProvUIActivator.PLUGIN_ID, element)); } @@ -141,63 +194,156 @@ public class ValidationDialogServiceUI extends UIServices { }); trustUnsigned = result[0]; } - // For now, there is no need to show certificates if there was unsigned content and we don't trust it. + // For now, there is no need to show certificates if there was unsigned content + // and we don't trust it. if (!trustUnsigned) - return new TrustInfo(trusted, persistTrust, trustUnsigned); - - // We've established trust for unsigned content, now examine the untrusted chains - if (!isHeadless() && untrustedChains != null && untrustedChains.length > 0) { - - final Object[] result = new Object[1]; - final TreeNode[] input = createTreeNodes(untrustedChains); - - PlatformUI.getWorkbench().getDisplay().syncExec(() -> { - Shell shell = ProvUI.getDefaultParentShell(); - ILabelProvider labelProvider = new CertificateLabelProvider(); - TreeNodeContentProvider contentProvider = new TreeNodeContentProvider(); - TrustCertificateDialog trustCertificateDialog = new TrustCertificateDialog(shell, input, labelProvider, contentProvider); - trustCertificateDialog.open(); - Certificate[] values = new Certificate[trustCertificateDialog.getResult() == null ? 0 : trustCertificateDialog.getResult().length]; - for (int i = 0; i < values.length; i++) { - values[i] = (Certificate) ((TreeNode) trustCertificateDialog.getResult()[i]).getValue(); + return new TrustInfo(trustedCertificates, trustedKeys, persistTrust, trustUnsigned); + + // We've established trust for unsigned content, now examine the untrusted + // chains + if (!isHeadless() && (untrustedChains.length > 0 || !untrustedPublicKeys.isEmpty())) { + return getTrustInfo( + Arrays.stream(untrustedChains).collect( + Collectors.toMap(Arrays::asList, it -> Set.of(), (e1, e2) -> e1, LinkedHashMap::new)), + untrustedPublicKeys.stream().collect( + Collectors.toMap(Function.identity(), it -> Set.of(), (e1, e2) -> e1, LinkedHashMap::new)), + null, null); + + } + + return new TrustInfo(trustedCertificates, trustedKeys, persistTrust, trustUnsigned); + } + + @Override + public TrustInfo getTrustInfo(Map<List<Certificate>, Set<IArtifactKey>> untrustedCertificates, + Map<PGPPublicKey, Set<IArtifactKey>> untrustedPGPKeys, // + Set<IArtifactKey> unsignedArtifacts, // + Map<IArtifactKey, File> artifacts) { + boolean trustUnsigned = true; + AtomicBoolean persistTrust = new AtomicBoolean(); + AtomicBoolean trustAlways = new AtomicBoolean(); + List<Certificate> trustedCertificates = new ArrayList<>(); + List<PGPPublicKey> trustedKeys = new ArrayList<>(); + if (!isHeadless()) { + TreeNode[] input = createTreeNodes(untrustedCertificates, untrustedPGPKeys, unsignedArtifacts, artifacts); + if (input.length != 0) { + trustUnsigned = unsignedArtifacts == null || unsignedArtifacts.isEmpty(); + List<Object> result = new ArrayList<>(); + getDisplay().syncExec(() -> { + Shell shell = shellProvider.getShell(); + TrustCertificateDialog trustCertificateDialog = new TrustCertificateDialog(shell, input); + if (trustCertificateDialog.open() == Window.OK) { + Object[] dialogResult = trustCertificateDialog.getResult(); + if (dialogResult != null) { + result.addAll(Arrays.asList(dialogResult)); + } + persistTrust.set(trustCertificateDialog.isRememberSelectedSigners()); + trustAlways.set(trustCertificateDialog.isTrustAlways()); + } + }); + for (Object o : result) { + if (o instanceof TreeNode) { + o = ((TreeNode) o).getValue(); + } + if (o instanceof Certificate) { + trustedCertificates.add((Certificate) o); + } else if (o instanceof PGPPublicKey) { + trustedKeys.add((PGPPublicKey) o); + } else if (o == null) { + trustUnsigned = true; + } + } + } + } + + return new TrustInfo(trustedCertificates, trustedKeys, persistTrust.get(), trustUnsigned, trustAlways.get()); + } + + private TreeNode[] createTreeNodes(Map<List<Certificate>, Set<IArtifactKey>> untrustedCertificates, + Map<PGPPublicKey, Set<IArtifactKey>> untrustedPGPKeys, // + Set<IArtifactKey> unsignedArtifacts, // + Map<IArtifactKey, File> artifacts) { + + List<ExtendedTreeNode> children = new ArrayList<>(); + if (untrustedCertificates != null && !untrustedCertificates.isEmpty()) { + for (Map.Entry<List<Certificate>, Set<IArtifactKey>> entry : untrustedCertificates.entrySet()) { + ExtendedTreeNode parent = null; + List<Certificate> key = entry.getKey(); + Set<IArtifactKey> associatedArtifacts = entry.getValue(); + for (Certificate certificate : key) { + ExtendedTreeNode node = new ExtendedTreeNode(certificate, associatedArtifacts); + if (parent == null) { + children.add(node); + } else { + node.setParent(parent); + parent.setChildren(new TreeNode[] { node }); + } + parent = node; + } + } + } + + if (untrustedPGPKeys != null && !untrustedPGPKeys.isEmpty()) { + PGPPublicKeyService keyService = agent == null ? null : agent.getService(PGPPublicKeyService.class); + for (Map.Entry<PGPPublicKey, Set<IArtifactKey>> entry : untrustedPGPKeys.entrySet()) { + PGPPublicKey key = entry.getKey(); + Set<IArtifactKey> associatedArtifacts = entry.getValue(); + ExtendedTreeNode node = new ExtendedTreeNode(key, associatedArtifacts); + children.add(node); + expandChildren(node, key, keyService, new HashSet<>(), Integer.getInteger("p2.pgp.trust.depth", 3)); //$NON-NLS-1$ + } + } + + if (unsignedArtifacts != null && !unsignedArtifacts.isEmpty()) { + ExtendedTreeNode node = new ExtendedTreeNode(null, unsignedArtifacts); + children.add(node); + + } + + return children.toArray(TreeNode[]::new); + } + + private void expandChildren(TreeNode result, PGPPublicKey key, PGPPublicKeyService keyService, + Set<PGPPublicKey> visited, int remainingDepth) { + if (keyService != null && remainingDepth > 0 && visited.add(key)) { + Set<PGPPublicKey> certifications = keyService.getVerifiedCertifications(key); + if (certifications != null && !certifications.isEmpty()) { + List<TreeNode> children = new ArrayList<>(); + for (PGPPublicKey certifyingKey : certifications) { + if (visited.add(certifyingKey)) { + TreeNode treeNode = new TreeNode(certifyingKey); + children.add(treeNode); + } + } + + if (!children.isEmpty()) { + result.setChildren(children.toArray(TreeNode[]::new)); + children.forEach(child -> { + child.setParent(result); + PGPPublicKey certifyingKey = (PGPPublicKey) child.getValue(); + visited.remove(certifyingKey); + expandChildren(child, certifyingKey, keyService, visited, remainingDepth - 1); + visited.add(certifyingKey); + }); } - result[0] = values; - }); - persistTrust = true; - trusted = (Certificate[]) result[0]; - } - return new TrustInfo(trusted, persistTrust, trustUnsigned); - } - - private TreeNode[] createTreeNodes(Certificate[][] certificates) { - TreeNode[] children = new TreeNode[certificates.length]; - for (int i = 0; i < certificates.length; i++) { - TreeNode head = new TreeNode(certificates[i][0]); - TreeNode parent = head; - children[i] = head; - for (int j = 0; j < certificates[i].length; j++) { - TreeNode node = new TreeNode(certificates[i][j]); - node.setParent(parent); - parent.setChildren(new TreeNode[] {node}); - parent = node; } } - return children; } @Override public AuthenticationInfo getUsernamePassword(final String location, final AuthenticationInfo previousInfo) { final AuthenticationInfo[] result = new AuthenticationInfo[1]; if (!suppressAuthentication() && !isHeadless()) { - PlatformUI.getWorkbench().getDisplay().syncExec(() -> { - Shell shell = ProvUI.getDefaultParentShell(); + getDisplay().syncExec(() -> { + Shell shell = shellProvider.getShell(); String message = null; if (previousInfo.saveResult()) message = NLS.bind(ProvUIMessages.ProvUIMessages_SavedNotAccepted_EnterFor_0, location); else message = NLS.bind(ProvUIMessages.ProvUIMessages_NotAccepted_EnterFor_0, location); - UserValidationDialog dialog = new UserValidationDialog(previousInfo, shell, ProvUIMessages.ServiceUI_LoginRequired, null, message); + UserValidationDialog dialog = new UserValidationDialog(previousInfo, shell, + ProvUIMessages.ServiceUI_LoginRequired, null, message); int dialogCode = dialog.open(); if (dialogCode == Window.OK) { result[0] = dialog.getResult(); @@ -215,17 +361,131 @@ public class ValidationDialogServiceUI extends UIServices { super.showInformationMessage(title, text, linkText); return; } - PlatformUI.getWorkbench().getDisplay().syncExec(() -> { - MessageDialog dialog = new MessageDialogWithLink(ProvUI.getDefaultParentShell(), title, null, text, MessageDialog.INFORMATION, new String[] {IDialogConstants.OK_LABEL}, 0, linkText); + getDisplay().syncExec(() -> { + MessageDialog dialog = new MessageDialogWithLink(shellProvider.getShell(), title, null, text, + MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0, linkText, linkHandler); dialog.open(); }); } + /** + * Returns a handler (used by + * {@link #showInformationMessage(String, String, String)}) to open a link in an + * external browser. + * + * @return a handler to open a link in an external browser. + * + * @since 2.7.400 + */ + public Consumer<String> getLinkHandler() { + return linkHandler; + } + + /** + * Sets the handler used by + * {@link #showInformationMessage(String, String, String)} to open a link in an + * external browser. + * + * @param linkHandler the handler for opening links in an external browser. + * + * @since 2.7.400 + */ + public void setLinkHandler(Consumer<String> linkHandler) { + this.linkHandler = linkHandler; + } + + /** + * Returns a shell that is appropriate to use as the parent for a modal dialog + * about to be opened. + * + * @return a shell that is appropriate to use as the parent for a modal dialog + * about to be opened. + * + * @see ProvUI#getDefaultParentShell() + * + * @since 2.7.400 + */ + public IShellProvider getShellProvider() { + return shellProvider; + } + + /** + * Set the provider that yields a shell that is appropriate to use as the parent + * for a modal dialog about to be opened. + * + * @param shellProvider the provider of a shell that is appropriate to use as + * the parent for a modal dialog about to be opened. + */ + public void setShellProvider(IShellProvider shellProvider) { + this.shellProvider = shellProvider; + } + + /** + * Returns the display of the workbench or the display set by + * {@link #setDisplay(Display)} in a non-workbench application. + * + * @since 2.7.400 + */ + public Display getDisplay() { + if (display == null && PlatformUI.isWorkbenchRunning()) { + display = PlatformUI.getWorkbench().getDisplay(); + } + return display; + } + + /** + * Can be called once to set the display in a non-workbench application. + * + * @throws IllegalStateException if there is a workbench running or the display + * has already been set differently. + * + * @since 2.7.400 + */ + public void setDisplay(Display display) { + if (this.display != null && this.display != display) { + throw new IllegalStateException("Cannot change the display"); //$NON-NLS-1$ + } + this.display = display; + } + private boolean isHeadless() { // If there is no UI available and we are still the IServiceUI, - // assume that the operation should proceed. See + // assume that the operation should proceed. See // https://bugs.eclipse.org/bugs/show_bug.cgi?id=291049 - return !PlatformUI.isWorkbenchRunning(); + // + // But we shouldn't just assume that no workbench mean no display and no head. + // It should be possible to reuse this class in an application without a + // workbench, e.g., the Eclipse Installer. + return getDisplay() == null; + } + + private static class ExtendedTreeNode extends TreeNode implements IAdaptable { + private final Set<IArtifactKey> artifacts; + + public ExtendedTreeNode(Object value) { + super(value); + artifacts = null; + } + + public ExtendedTreeNode(Object value, Set<IArtifactKey> artifacts) { + super(value); + this.artifacts = artifacts; + } + + @Override + public <T> T getAdapter(Class<T> adapter) { + if (adapter.isInstance(this)) { + return adapter.cast(this); + } + if (adapter.isInstance(getValue())) { + return adapter.cast(value); + } + if (adapter == IArtifactKey[].class && artifacts != null) { + return adapter.cast(artifacts.toArray(IArtifactKey[]::new)); + } + + return null; + } } } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PGPPublicKeyViewDialog.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PGPPublicKeyViewDialog.java new file mode 100644 index 000000000..a6cbf3be1 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PGPPublicKeyViewDialog.java @@ -0,0 +1,248 @@ +/******************************************************************************* + * Copyright (c) 2022 Eclipse contributors and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.equinox.internal.p2.ui.dialogs; + +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.List; +import org.bouncycastle.bcpg.*; +import org.bouncycastle.openpgp.PGPPublicKey; +import org.bouncycastle.openpgp.PGPSignature; +import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.equinox.internal.p2.ui.ProvUIMessages; +import org.eclipse.equinox.p2.repository.spi.PGPPublicKeyService; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.*; + +/** + * Presents information about a key in a format similar to what key servers + * display. + * + * @since 1.2.4 + */ +public class PGPPublicKeyViewDialog extends TitleAreaDialog { + + private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); //$NON-NLS-1$ + + final private PGPPublicKey originalKey; + + final private PGPPublicKeyService keyService; + + private StyledText styledText; + + public PGPPublicKeyViewDialog(Shell parentShell, PGPPublicKey key, PGPPublicKeyService keyService) { + super(parentShell); + this.originalKey = key; + this.keyService = keyService; + DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC")); //$NON-NLS-1$ + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(ProvUIMessages.PGPPublicKeyViewDialog_Title); + if (keyService != null) { + computeVerifiedCertifications(newShell); + } + } + + @Override + protected void setShellStyle(int newShellStyle) { + super.setShellStyle(newShellStyle | SWT.RESIZE | SWT.DIALOG_TRIM); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); + composite.setLayoutData(data); + + styledText = new StyledText(composite, SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); + styledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + // Create a sightly smaller text (mono-space) font. + FontData[] fontData = JFaceResources.getTextFont().getFontData(); + for (FontData fontDataElement : fontData) { + fontDataElement.setHeight(fontDataElement.getHeight() - 1); + } + Font font = new Font(styledText.getDisplay(), fontData); + styledText.setFont(font); + styledText.addDisposeListener(e -> font.dispose()); + + GC gc = new GC(styledText); + gc.setFont(font); + data.widthHint = convertWidthInCharsToPixels(gc.getFontMetrics(), 110); + gc.dispose(); + + update(originalKey, Set.of()); + return composite; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, true).setFocus(); + } + + @SuppressWarnings("nls") + protected void update(PGPPublicKey key, Set<PGPPublicKey> verifiedCertifications) { + StyledString content = new StyledString(); + String fingerprint = PGPPublicKeyService.toHexFingerprint(key); + + PublicKeyPacket publicKeyPacket = key.getPublicKeyPacket(); + publicKeyPacket.getAlgorithm(); + content.append(" "); + content.append(publicKeyPacket instanceof PublicSubkeyPacket ? "sub" : "pub", StyledString.QUALIFIER_STYLER); + content.append(" "); + + int algorithm = publicKeyPacket.getAlgorithm(); + switch (algorithm) { + case PublicKeyAlgorithmTags.RSA_GENERAL: + case PublicKeyAlgorithmTags.RSA_ENCRYPT: + case PublicKeyAlgorithmTags.RSA_SIGN: { + content.append("rsa"); + break; + } + case PublicKeyAlgorithmTags.DSA: { + content.append("dsa"); + break; + } + case PublicKeyAlgorithmTags.ELGAMAL_ENCRYPT: + case PublicKeyAlgorithmTags.ELGAMAL_GENERAL: { + content.append("elgamal"); + break; + } + default: { + content.append("["); + content.append(Integer.toString(algorithm)); + content.append("]"); + break; + } + + } + int bitStrength = key.getBitStrength(); + content.append(Integer.toString(bitStrength)); + content.append("/"); + content.append(fingerprint); + + content.append(" "); + content.append(DATE_FORMAT.format(key.getCreationTime())); + + content.append(" "); + content.append("\n"); + + List<String> users = new ArrayList<>(); + key.getUserIDs().forEachRemaining(users::add); + if (!users.isEmpty()) { + for (String user : users) { + content.append(" "); + content.append("uid", StyledString.QUALIFIER_STYLER); + content.append(" "); + content.append(user, StyledString.COUNTER_STYLER); + content.append("\n"); + } + } + + Long subKeyOf = null; + + for (Iterator<PGPSignature> signatures = key.getSignatures(); signatures.hasNext();) { + PGPSignature signature = signatures.next(); + long keyID = signature.getKeyID(); + + if (signature.getSignatureType() == PGPSignature.SUBKEY_BINDING) { + subKeyOf = keyID; + } + + content.append(" "); + content.append("sig", StyledString.QUALIFIER_STYLER); + content.append(" "); + content.append(PGPPublicKeyService.toHex(keyID)); + content.append(" "); + Date creationTime = signature.getCreationTime(); + String formattedCreationTime = DATE_FORMAT.format(creationTime); + content.append(formattedCreationTime); + long signatureExpirationTime = signature.getHashedSubPackets().getSignatureExpirationTime(); + content.append(" "); + content.append(signatureExpirationTime == 0 ? formattedCreationTime.replaceAll(".", "_") + : DATE_FORMAT.format(new Date(creationTime.getTime() + 1000 * signatureExpirationTime))); + + content.append(" "); + Optional<PGPPublicKey> resolvedKey = verifiedCertifications.stream().filter(k -> k.getKeyID() == keyID) + .findFirst(); + + long keyExpirationTime = signature.getHashedSubPackets().getKeyExpirationTime(); + content.append(keyExpirationTime == 0 || resolvedKey == null || !resolvedKey.isPresent() + ? formattedCreationTime.replaceAll(".", "_") + : DATE_FORMAT.format( + new Date(resolvedKey.get().getCreationTime().getTime() + 1000 * keyExpirationTime))); + + if (resolvedKey != null && resolvedKey.isPresent()) { + content.append(" "); + content.append(getLabel(resolvedKey.get()), StyledString.COUNTER_STYLER); + } + + content.append("\n"); + } + + styledText.setText(content.getString()); + styledText.setStyleRanges(content.getStyleRanges()); + + List<String> title = new ArrayList<>(); + if (subKeyOf != null) { + long keyID = subKeyOf; + verifiedCertifications.stream().filter(k -> k.getKeyID() == keyID).findFirst() + .ifPresentOrElse(k -> title.add(getLabel(k)), () -> title.add(PGPPublicKeyService.toHex(keyID))); + } + title.add((subKeyOf == null ? "" : "sub ") + (users.isEmpty() ? fingerprint : users.get(0))); + + setTitle(String.join("\n", title)); + } + + private String getLabel(PGPPublicKey key) { + Iterator<String> userIDs = key.getUserIDs(); + if (userIDs.hasNext()) { + return userIDs.next(); + + } + return PGPPublicKeyService.toHexFingerprint(key); + } + + private void computeVerifiedCertifications(Shell shell) { + Display display = shell.getDisplay(); + new Job(PGPPublicKeyViewDialog.class.getName()) { + { + setSystem(true); + setPriority(Job.SHORT); + } + + @Override + protected IStatus run(IProgressMonitor monitor) { + synchronized (keyService) { + PGPPublicKey enhancedKey = keyService.addKey(originalKey); + Set<PGPPublicKey> verifiedCertifications = keyService.getVerifiedCertifications(originalKey); + display.asyncExec(() -> { + if (!shell.isDisposed()) { + update(enhancedKey, verifiedCertifications); + } + }); + } + return Status.OK_STATUS; + } + }.schedule(); + } +} diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java index 71479559e..47901c652 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java @@ -204,7 +204,7 @@ public abstract class ProvisioningOperationWizard extends Wizard { if (!operation.hasResolved()) { operation.resolveModal(monitor); } - if (operation.hasResolved()) { + if (operation.getProfileChangeRequest() != null) { this.localJRECheckPlan = ProvUI.toCompabilityWithCurrentJREProvisioningPlan(operation, null); if (!compatibleWithCurrentEE()) { couldNotResolveStatus = localJRECheckPlan.getStatus(); @@ -215,6 +215,10 @@ public abstract class ProvisioningOperationWizard extends Wizard { return false; } } + if (localJRECheckPlan == null) { + return true; + } + IStatus currentEEPlanStatus = localJRECheckPlan.getStatus(); if (currentEEPlanStatus.getSeverity() != IStatus.ERROR) { return true; @@ -337,7 +341,8 @@ public abstract class ProvisioningOperationWizard extends Wizard { try { runnableContext.run(true, true, monitor -> { operation.resolveModal(monitor); - if (getPolicy().getCheckAgainstCurrentExecutionEnvironment()) { + if (operation.getProfileChangeRequest() != null + && getPolicy().getCheckAgainstCurrentExecutionEnvironment()) { this.localJRECheckPlan = ProvUI.toCompabilityWithCurrentJREProvisioningPlan(operation, monitor); if (!compatibleWithCurrentEE()) { couldNotResolveStatus = localJRECheckPlan.getStatus(); diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/TrustCertificateDialog.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/TrustCertificateDialog.java index 8ee921daa..2d6cc8237 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/TrustCertificateDialog.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/TrustCertificateDialog.java @@ -16,100 +16,256 @@ package org.eclipse.equinox.internal.p2.ui.dialogs; import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.Iterator; -import org.eclipse.equinox.internal.p2.ui.ProvUIMessages; +import java.io.*; +import java.security.cert.*; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.*; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import org.bouncycastle.bcpg.ArmoredOutputStream; +import org.bouncycastle.openpgp.PGPPublicKey; +import org.eclipse.core.runtime.*; +import org.eclipse.equinox.internal.p2.ui.*; import org.eclipse.equinox.internal.p2.ui.viewers.CertificateLabelProvider; -import org.eclipse.equinox.internal.provisional.security.ui.X509CertificateViewDialog; +import org.eclipse.equinox.internal.provisional.security.ui.X500PrincipalHelper; +import org.eclipse.equinox.p2.metadata.IArtifactKey; +import org.eclipse.equinox.p2.repository.spi.PGPPublicKeyService; +import org.eclipse.jface.dialogs.*; import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.TableColumnLayout; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.util.Policy; import org.eclipse.jface.viewers.*; +import org.eclipse.jface.widgets.LabelFactory; +import org.eclipse.jface.widgets.WidgetFactory; +import org.eclipse.jface.window.Window; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.dnd.*; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.SelectionDialog; /** - * A dialog that displays a certificate chain and asks the user if they - * trust the certificate providers. + * A dialog that displays a certificate chain and asks the user if they trust + * the certificate providers. It also supports prompting about unsigned content. */ public class TrustCertificateDialog extends SelectionDialog { + private static final String EXPORT_FILTER_PATH = "exportFilterPath"; //$NON-NLS-1$ - private Object inputElement; - private IStructuredContentProvider contentProvider; - private ILabelProvider labelProvider; + private CheckboxTableViewer certifcateViewer; - private final static int SIZING_SELECTION_WIDGET_HEIGHT = 250; - private final static int SIZING_SELECTION_WIDGET_WIDTH = 300; + private TreeViewer certificateChainViewer; - CheckboxTableViewer listViewer; + private CheckboxTableViewer artifactViewer; - private TreeViewer certificateChainViewer; private Button detailsButton; - protected TreeNode parentElement; - protected Object selectedCertificate; - public TrustCertificateDialog(Shell parentShell, Object input, ILabelProvider labelProvider, ITreeContentProvider contentProvider) { + private Button exportButton; + + private boolean rememberSelectedSigners = true; + + private boolean trustAlways; + + private final Map<TreeNode, List<IArtifactKey>> artifactMap = new LinkedHashMap<>(); + + public TrustCertificateDialog(Shell parentShell, Object input) { super(parentShell); - inputElement = input; - this.contentProvider = contentProvider; - this.labelProvider = labelProvider; + + setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS | SWT.RESIZE | SWT.MAX | getDefaultOrientation()); + + if (input instanceof TreeNode[]) { + for (TreeNode node : (TreeNode[]) input) { + IArtifactKey[] associatedArtifacts = null; + if (node instanceof IAdaptable) { + associatedArtifacts = ((IAdaptable) node).getAdapter(IArtifactKey[].class); + } + artifactMap.put(node, associatedArtifacts == null ? List.of() : Arrays.asList(associatedArtifacts)); + } + } + setTitle(ProvUIMessages.TrustCertificateDialog_Title); - setMessage(ProvUIMessages.TrustCertificateDialog_Message); - setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS | SWT.RESIZE | getDefaultOrientation()); + + boolean unsignedContent = artifactMap.keySet().stream().map(TreeNode::getValue).anyMatch(Objects::isNull); + boolean pgpContent = containsInstance(input, PGPPublicKey.class); + boolean certifcateContent = containsInstance(input, Certificate.class); + + List<String> messages = new ArrayList<>(); + if (certifcateContent || pgpContent) { + messages.add(ProvUIMessages.TrustCertificateDialog_Message); + } + if (unsignedContent) { + messages.add(ProvUIMessages.TrustCertificateDialog_MessageUnsigned); + } + if (certifcateContent || pgpContent) { + messages.add(ProvUIMessages.TrustCertificateDialog_MessageNameWarning); + } + if (pgpContent) { + messages.add(ProvUIMessages.TrustCertificateDialog_MessagePGP); + } + setMessage(String.join(" ", messages)); //$NON-NLS-1$ + + if (PlatformUI.isWorkbenchRunning()) { + PlatformUI.getWorkbench().getHelpSystem().setHelp(parentShell, IProvHelpContextIds.TRUST_DIALOG); + } + } + + public boolean isRememberSelectedSigners() { + return rememberSelectedSigners; + } + + public boolean isTrustAlways() { + return trustAlways; + } + + @Override + protected Label createMessageArea(Composite composite) { + // Ensure that the message supports wrapping for a long text message. + GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); + data.widthHint = convertWidthInCharsToPixels(120); + LabelFactory factory = WidgetFactory.label(SWT.WRAP).font(composite.getFont()).layoutData(data); + if (getMessage() != null) { + factory.text(getMessage()); + } + return factory.create(composite); } @Override protected Control createDialogArea(Composite parent) { - Composite composite = createUpperDialogArea(parent); - certificateChainViewer = new TreeViewer(composite, SWT.BORDER); - GridLayout layout = new GridLayout(); - certificateChainViewer.getTree().setLayout(layout); - GridData data = new GridData(GridData.FILL_BOTH); - data.grabExcessHorizontalSpace = true; - certificateChainViewer.getTree().setLayoutData(data); - certificateChainViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); - certificateChainViewer.setContentProvider(new TreeNodeContentProvider()); - certificateChainViewer.setLabelProvider(new CertificateLabelProvider()); - certificateChainViewer.addSelectionChangedListener(getChainSelectionListener()); - if (inputElement instanceof Object[]) { - ISelection selection = null; - Object[] nodes = (Object[]) inputElement; - if (nodes.length > 0) { - selection = new StructuredSelection(nodes[0]); - certificateChainViewer.setInput(new TreeNode[] {(TreeNode) nodes[0]}); - selectedCertificate = nodes[0]; - } - listViewer.setSelection(selection); - } - listViewer.addDoubleClickListener(getDoubleClickListener()); - listViewer.addSelectionChangedListener(getParentSelectionListener()); - createButtons(composite); - return composite; + Composite mainComposite = (Composite) super.createDialogArea(parent); + Dialog.applyDialogFont(mainComposite); + initializeDialogUnits(mainComposite); + + createMessageArea(mainComposite); + + SashForm sashForm = new SashForm(mainComposite, SWT.VERTICAL); + sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + createCertificateViewerArea(createSashFormArea(sashForm)); + + // Create this area only if we have keys or certificates. + boolean containsCertificates = containsInstance(artifactMap.keySet(), PGPPublicKey.class) + || containsInstance(artifactMap.keySet(), Certificate.class); + if (containsCertificates) { + createCertficateChainViewerArea(createSashFormArea(sashForm)); + } + + // Sort the set of all artifacts and create the lower area only if there are + // artifacts. + Comparator<Object> comparator = Policy.getComparator(); + Set<IArtifactKey> artifacts = artifactMap.values().stream().flatMap(Collection::stream) + .collect(Collectors.toCollection(() -> new TreeSet<>((a1, a2) -> { + int result = comparator.compare(a1.getId(), a2.getId()); + if (result == 0) { + result = a1.getVersion().compareTo(a2.getVersion()); + if (result == 0) { + result = a1.getClassifier().compareTo(a2.getClassifier()); + } + } + return result; + }))); + if (!artifacts.isEmpty()) { + crreateArtifactViewerArea(createSashFormArea(sashForm), artifacts); + } + + // Set weights based on the children's preferred size. + Control[] children = sashForm.getChildren(); + int[] weights = new int[children.length]; + for (int i = 0; i < children.length; ++i) { + weights[i] = children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, false).y; + } + sashForm.setWeights(weights); + + if (!getInitialElementSelections().isEmpty()) { + checkInitialSelections(); + } + + if (!artifactMap.isEmpty()) { + certifcateViewer.setSelection(new StructuredSelection(artifactMap.keySet().iterator().next())); + } + + return mainComposite; } @Override protected void createButtonsForButtonBar(Composite parent) { - createButton(parent, IDialogConstants.OK_ID, ProvUIMessages.TrustCertificateDialog_AcceptSelectedButtonLabel, true); + createButton(parent, IDialogConstants.OK_ID, ProvUIMessages.TrustCertificateDialog_AcceptSelectedButtonLabel, + true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); - super.getOkButton().setEnabled(false); + updateOkButton(); } private void createButtons(Composite composite) { - // Details button to view certificate chain - detailsButton = new Button(composite, SWT.NONE); + Composite buttonComposite = new Composite(composite, SWT.NONE); + buttonComposite.setLayout(new RowLayout()); + + detailsButton = new Button(buttonComposite, SWT.NONE); detailsButton.setText(ProvUIMessages.TrustCertificateDialog_Details); detailsButton.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent e) { - if (selectedCertificate != null) { - X509Certificate cert = (X509Certificate) ((TreeNode) selectedCertificate).getValue(); - X509CertificateViewDialog certificateDialog = new X509CertificateViewDialog(getShell(), cert); - certificateDialog.open(); + X509Certificate cert = getInstance(certificateChainViewer.getSelection(), X509Certificate.class); + if (cert != null) { + CertificateLabelProvider.openDialog(getShell(), cert); + } + } + + @Override + public void widgetSelected(SelectionEvent e) { + widgetDefaultSelected(e); + } + }); + + exportButton = new Button(buttonComposite, SWT.NONE); + exportButton.setText(ProvUIMessages.TrustCertificateDialog_Export); + exportButton.addSelectionListener(new SelectionListener() { + @Override + public void widgetDefaultSelected(SelectionEvent e) { + ISelection selection = certificateChainViewer.getSelection(); + X509Certificate cert = getInstance(selection, X509Certificate.class); + PGPPublicKey key = getInstance(selection, PGPPublicKey.class); + if (cert != null || key != null) { + FileDialog destination = new FileDialog(exportButton.getShell(), SWT.SAVE); + destination.setFilterPath(getFilterPath(EXPORT_FILTER_PATH)); + destination.setText(ProvUIMessages.TrustCertificateDialog_Export); + if (cert != null) { + destination.setFilterExtensions(new String[] { "*.der" }); //$NON-NLS-1$ + destination.setFileName(cert.getSerialNumber().toString() + ".der"); //$NON-NLS-1$ + String path = destination.open(); + setFilterPath(EXPORT_FILTER_PATH, destination.getFilterPath()); + if (path == null) { + return; + } + File destinationFile = new File(path); + try (FileOutputStream output = new FileOutputStream(destinationFile)) { + output.write(cert.getEncoded()); + } catch (IOException | CertificateEncodingException ex) { + ProvUIActivator.getDefault().getLog() + .log(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ex.getMessage(), ex)); + } + } else { + destination.setFilterExtensions(new String[] { "*.asc" }); //$NON-NLS-1$ + destination.setFileName(userFriendlyFingerPrint(key) + ".asc"); //$NON-NLS-1$ + String path = destination.open(); + setFilterPath(EXPORT_FILTER_PATH, destination.getFilterPath()); + if (path == null) { + return; + } + File destinationFile = new File(path); + try (OutputStream output = new ArmoredOutputStream(new FileOutputStream(destinationFile))) { + key.encode(output); + } catch (IOException ex) { + ProvUIActivator.getDefault().getLog() + .log(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ex.getMessage(), ex)); + } + } } } @@ -120,31 +276,274 @@ public class TrustCertificateDialog extends SelectionDialog { }); } - private Composite createUpperDialogArea(Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - initializeDialogUnits(composite); - createMessageArea(composite); + private Composite createSashFormArea(SashForm sashForm) { + Composite composite = new Composite(sashForm, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + composite.setLayout(layout); + return composite; + } - listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER); - GridData data = new GridData(GridData.FILL_BOTH); - data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT; - data.widthHint = SIZING_SELECTION_WIDGET_WIDTH; - listViewer.getTable().setLayoutData(data); + private void createCertificateViewerArea(Composite composite) { - listViewer.setLabelProvider(labelProvider); - listViewer.setContentProvider(contentProvider); + TableColumnLayout tableColumnLayout = new TableColumnLayout(true); + Composite tableComposite = WidgetFactory.composite(SWT.NONE) + .layoutData(new GridData(SWT.FILL, SWT.FILL, true, true)).layout(tableColumnLayout).create(composite); + Table table = WidgetFactory + .table(SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK) + .headerVisible(true).linesVisible(true).font(composite.getFont()).create(tableComposite); + certifcateViewer = new CheckboxTableViewer(table); + certifcateViewer.setContentProvider(new TreeNodeContentProvider()); + + GridData data = new GridData(GridData.FILL_BOTH); + data.heightHint = convertHeightInCharsToPixels(Math.min(artifactMap.keySet().size() + 1, 6)) * 3 / 2; + data.widthHint = convertWidthInCharsToPixels(120); + tableComposite.setLayoutData(data); + + // This column is packed later. + TableViewerColumn typeColumn = createColumn(certifcateViewer, ProvUIMessages.TrustCertificateDialog_ObjectType, + new PGPOrX509ColumnLabelProvider(key -> "PGP", cert -> "x509", //$NON-NLS-1$ //$NON-NLS-2$ + ProvUIMessages.TrustCertificateDialog_Unsigned), + tableColumnLayout, 1); + + createColumn(certifcateViewer, ProvUIMessages.TrustCertificateDialog_Id, + new PGPOrX509ColumnLabelProvider(TrustCertificateDialog::userFriendlyFingerPrint, + cert -> cert.getSerialNumber().toString(), ProvUIMessages.TrustCertificateDialog_NotApplicable), + tableColumnLayout, 10); + + createColumn(certifcateViewer, ProvUIMessages.TrustCertificateDialog_Name, + new PGPOrX509ColumnLabelProvider(pgp -> { + java.util.List<String> users = new ArrayList<>(); + pgp.getUserIDs().forEachRemaining(users::add); + return String.join(", ", users); //$NON-NLS-1$ + }, x509 -> { + X500PrincipalHelper principalHelper = new X500PrincipalHelper(x509.getSubjectX500Principal()); + return principalHelper.getCN() + "; " + principalHelper.getOU() + "; " //$NON-NLS-1$ //$NON-NLS-2$ + + principalHelper.getO(); + }, ProvUIMessages.TrustCertificateDialog_Unknown), tableColumnLayout, 15); + + createColumn(certifcateViewer, ProvUIMessages.TrustCertificateDialog_dates, + new PGPOrX509ColumnLabelProvider(pgp -> { + if (pgp.getCreationTime().after(Date.from(Instant.now()))) { + return NLS.bind(ProvUIMessages.TrustCertificateDialog_NotYetValidStartDate, + pgp.getCreationTime()); + } + long validSeconds = pgp.getValidSeconds(); + if (validSeconds == 0) { + return ProvUIMessages.TrustCertificateDialog_valid; + } + Instant expires = pgp.getCreationTime().toInstant().plus(validSeconds, ChronoUnit.SECONDS); + return expires.isBefore(Instant.now()) + ? NLS.bind(ProvUIMessages.TrustCertificateDialog_expiredSince, expires) + : NLS.bind(ProvUIMessages.TrustCertificateDialog_validExpires, expires); + }, x509 -> { + try { + x509.checkValidity(); + return ProvUIMessages.TrustCertificateDialog_valid; + } catch (CertificateExpiredException expired) { + return ProvUIMessages.TrustCertificateDialog_expired; + } catch (CertificateNotYetValidException notYetValid) { + return ProvUIMessages.TrustCertificateDialog_notYetValid; + } + }, ProvUIMessages.TrustCertificateDialog_NotApplicable), tableColumnLayout, 10); + + createMenu(certifcateViewer); addSelectionButtons(composite); - listViewer.setInput(inputElement); + certifcateViewer.addDoubleClickListener(e -> { + StructuredSelection selection = (StructuredSelection) e.getSelection(); + X509Certificate cert = getInstance(selection, X509Certificate.class); + if (cert != null) { + // create and open dialog for certificate chain + CertificateLabelProvider.openDialog(getShell(), cert); + } + }); - if (!getInitialElementSelections().isEmpty()) { - checkInitialSelections(); + certifcateViewer.addSelectionChangedListener(e -> { + if (certificateChainViewer != null) { + TreeNode treeNode = getInstance(e.getSelection(), TreeNode.class); + if (treeNode != null) { + certificateChainViewer.setInput(new TreeNode[] { treeNode }); + certificateChainViewer.setSelection(new StructuredSelection(treeNode)); + } else { + certificateChainViewer.setInput(new TreeNode[] {}); + } + } + + updateOkButton(); + }); + + certifcateViewer.setInput(artifactMap.keySet().toArray(TreeNode[]::new)); + + typeColumn.getColumn().pack(); + } + + private void createCertficateChainViewerArea(Composite composite) { + certificateChainViewer = new TreeViewer(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); + GridData data = new GridData(GridData.FILL_BOTH); + int treeSize = artifactMap.keySet().stream().map(TrustCertificateDialog::computeTreeSize) + .max(Integer::compareTo).orElse(0); + data.heightHint = convertHeightInCharsToPixels(Math.min(treeSize, 5)); + data.widthHint = convertWidthInCharsToPixels(120); + certificateChainViewer.getTree().setLayoutData(data); + + certificateChainViewer.setAutoExpandLevel(3); + certificateChainViewer.setContentProvider(new TreeNodeContentProvider()); + certificateChainViewer.setLabelProvider(new CertificateLabelProvider() { + @Override + public String getText(Object element) { + if (element instanceof TreeNode) { + Object o = ((TreeNode) element).getValue(); + if (o instanceof PGPPublicKey) { + PGPPublicKey key = (PGPPublicKey) o; + String userFriendlyFingerPrint = userFriendlyFingerPrint(key); + java.util.List<String> users = new ArrayList<>(); + key.getUserIDs().forEachRemaining(users::add); + String userIDs = String.join(", ", users); //$NON-NLS-1$ + if (!userIDs.isEmpty()) { + return userFriendlyFingerPrint + " [" + userIDs + "]"; //$NON-NLS-1$//$NON-NLS-2$ + } + return userFriendlyFingerPrint; + } else if (o == null) { + return ProvUIMessages.TrustCertificateDialog_Unsigned; + } + } + + return super.getText(element); + } + }); + + certificateChainViewer.addSelectionChangedListener(event -> { + ISelection selection = event.getSelection(); + boolean containsCertificate = containsInstance(selection, X509Certificate.class); + detailsButton.setEnabled(containsCertificate); + exportButton.setEnabled(containsCertificate || containsInstance(selection, PGPPublicKey.class)); + }); + + createMenu(certificateChainViewer); + + createButtons(composite); + } + + private void crreateArtifactViewerArea(Composite composite, Set<IArtifactKey> artifacts) { + TableColumnLayout tableColumnLayout = new TableColumnLayout(true); + Composite tableComposite = WidgetFactory.composite(SWT.NONE) + .layoutData(new GridData(SWT.FILL, SWT.FILL, true, true)).layout(tableColumnLayout).create(composite); + Table table = WidgetFactory.table(SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION) + .headerVisible(true).linesVisible(true).font(composite.getFont()).create(tableComposite); + artifactViewer = new CheckboxTableViewer(table); + artifactViewer.setContentProvider(ArrayContentProvider.getInstance()); + + GridData data = new GridData(GridData.FILL_BOTH); + data.heightHint = convertHeightInCharsToPixels(Math.min(artifacts.size() + 1, 10)) * 3 / 2; + data.widthHint = convertWidthInCharsToPixels(120); + tableComposite.setLayoutData(data); + + Font font = table.getFont(); + FontData[] fontDatas = font.getFontData(); + for (FontData fontData : fontDatas) { + fontData.setStyle(fontData.getStyle() | SWT.BOLD); } + Font boldFont = new Font(table.getDisplay(), fontDatas); + composite.addDisposeListener(e -> boldFont.dispose()); + + Function<IArtifactKey, Font> fontProvider = e -> { + for (Object object : certifcateViewer.getCheckedElements()) { + List<IArtifactKey> list = artifactMap.get(object); + if (list != null && list.contains(e)) { + return boldFont; + } + } + return null; + }; - Dialog.applyDialogFont(composite); + certifcateViewer.addCheckStateListener(e -> artifactViewer.refresh(true)); + + artifactViewer.addPostSelectionChangedListener(e -> { + if (table.isFocusControl()) { + List<?> selection = e.getStructuredSelection().toList(); + List<TreeNode> newSelection = new ArrayList<>(); + LOOP: for (Map.Entry<TreeNode, List<IArtifactKey>> entry : artifactMap.entrySet()) { + List<IArtifactKey> value = entry.getValue(); + if (value != null) { + for (IArtifactKey key : value) { + if (selection.contains(key)) { + newSelection.add(entry.getKey()); + continue LOOP; + } + } + } + } - return composite; + certifcateViewer.setSelection(new StructuredSelection(newSelection), true); + } + }); + + certifcateViewer.addPostSelectionChangedListener(e -> { + if (!table.isFocusControl()) { + Set<IArtifactKey> associatedArtifacts = new LinkedHashSet<>(); + for (Object object : e.getStructuredSelection()) { + List<IArtifactKey> list = artifactMap.get(object); + if (list != null) { + associatedArtifacts.addAll(list); + } + } + + artifactViewer.setSelection(new StructuredSelection(associatedArtifacts.toArray()), true); + + // Reorder the artifacts so that the selected ones are first. + LinkedHashSet<IArtifactKey> newInput = new LinkedHashSet<>(artifacts); + newInput.retainAll(associatedArtifacts); + newInput.addAll(artifacts); + artifactViewer.setInput(newInput); + + artifactViewer.setSelection(new StructuredSelection(associatedArtifacts.toArray()), true); + } + }); + + TableViewerColumn classifierColumn = createColumn(artifactViewer, + ProvUIMessages.TrustCertificateDialog_Classifier, + new ArtifactLabelProvider(a -> a.getClassifier(), fontProvider), tableColumnLayout, 1); + createColumn(artifactViewer, ProvUIMessages.TrustCertificateDialog_ArtifactId, + new ArtifactLabelProvider(a -> a.getId(), fontProvider), tableColumnLayout, 10); + createColumn(artifactViewer, ProvUIMessages.TrustCertificateDialog_Version, + new ArtifactLabelProvider(a -> a.getVersion().toString(), fontProvider), tableColumnLayout, 10); + + artifactViewer.setInput(artifacts); + + classifierColumn.getColumn().pack(); + } + + private void createMenu(StructuredViewer viewer) { + Control control = viewer.getControl(); + Menu menu = new Menu(control); + control.setMenu(menu); + MenuItem item = new MenuItem(menu, SWT.PUSH); + item.setText(ProvUIMessages.TrustCertificateDialog_CopyFingerprint); + item.addSelectionListener(widgetSelectedAdapter(e -> { + PGPPublicKey key = getInstance(viewer.getSelection(), PGPPublicKey.class); + if (key != null) { + Clipboard clipboard = new Clipboard(getShell().getDisplay()); + clipboard.setContents(new Object[] { userFriendlyFingerPrint(key) }, + new Transfer[] { TextTransfer.getInstance() }); + clipboard.dispose(); + } + })); + viewer.addSelectionChangedListener( + e -> item.setEnabled(containsInstance(e.getSelection(), PGPPublicKey.class))); + } + + private TableViewerColumn createColumn(TableViewer tableViewer, String text, ColumnLabelProvider labelProvider, + TableColumnLayout tableColumnLayout, int columnWeight) { + TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.NONE); + column.getColumn().setText(text); + column.setLabelProvider(labelProvider); + tableColumnLayout.setColumnData(column.getColumn(), new ColumnWeightData(columnWeight)); + return column; } /** @@ -154,98 +553,252 @@ public class TrustCertificateDialog extends SelectionDialog { private void checkInitialSelections() { Iterator<?> itemsToCheck = getInitialElementSelections().iterator(); while (itemsToCheck.hasNext()) { - listViewer.setChecked(itemsToCheck.next(), true); + certifcateViewer.setChecked(itemsToCheck.next(), true); + if (artifactViewer != null) { + artifactViewer.refresh(true); + } } } /** * Add the selection and deselection buttons to the dialog. + * * @param composite org.eclipse.swt.widgets.Composite */ private void addSelectionButtons(Composite composite) { - Composite buttonComposite = new Composite(composite, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 0; - layout.marginWidth = 0; - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - buttonComposite.setLayout(layout); - buttonComposite.setLayoutData(new GridData(SWT.END, SWT.TOP, true, false)); + int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + + Composite buttonArea = new Composite(composite, SWT.NONE); + GridLayout buttonAreaLayout = new GridLayout(); + buttonAreaLayout.numColumns = 2; + buttonAreaLayout.marginWidth = 0; + buttonAreaLayout.horizontalSpacing = horizontalSpacing; + buttonArea.setLayout(buttonAreaLayout); + buttonArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + + Composite leftButtonArea = new Composite(buttonArea, SWT.NONE); + GridLayout leftButtonAreaLayout = new GridLayout(); + leftButtonAreaLayout.numColumns = 0; + leftButtonAreaLayout.marginWidth = 0; + leftButtonAreaLayout.horizontalSpacing = horizontalSpacing; + leftButtonArea.setLayout(leftButtonAreaLayout); + leftButtonArea.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false)); + + if (containsInstance(artifactMap.keySet(), PGPPublicKey.class) + || containsInstance(artifactMap.keySet(), Certificate.class)) { + Button rememberSelectionButton = createCheckButton(leftButtonArea, + ProvUIMessages.TrustCertificateDialog_RememberSigners); + rememberSelectionButton.setSelection(rememberSelectedSigners); + rememberSelectionButton.addSelectionListener(widgetSelectedAdapter(e -> { + rememberSelectedSigners = rememberSelectionButton.getSelection(); + })); + } - Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, ProvUIMessages.TrustCertificateDialog_SelectAll, false); + Button trustAlwaysButton = createCheckButton(leftButtonArea, ProvUIMessages.TrustCertificateDialog_AlwaysTrust); + trustAlwaysButton.addSelectionListener(widgetSelectedAdapter(e -> { + if (trustAlwaysButton.getSelection()) { + // Prompt the user to ensure they really understand what they've chosen, the + // risk, and where the preference is stored if they wish to change it in the + // future. Also ensure that the default button is no so that they must + // explicitly click the yes button, not just hit enter. + MessageDialog messageDialog = new MessageDialog(getShell(), + ProvUIMessages.TrustCertificateDialog_AlwaysTrustConfirmationTitle, null, + ProvUIMessages.TrustCertificateDialog_AlwaysTrustConfirmationMessage, MessageDialog.QUESTION, + new String[] { ProvUIMessages.TrustCertificateDialog_AlwaysTrustYes, + ProvUIMessages.TrustCertificateDialog_AlwaysTrustNo }, + 1) { + @Override + public Image getImage() { + return getWarningImage(); + } + }; + int result = messageDialog.open(); + if (result != Window.OK) { + // Restore the checkbox state. + trustAlwaysButton.setSelection(false); + } else { + certifcateViewer.setAllChecked(true); + if (artifactViewer != null) { + artifactViewer.refresh(true); + } + updateOkButton(); + } + } + trustAlways = trustAlwaysButton.getSelection(); + })); + + Composite rightButtonArea = new Composite(buttonArea, SWT.NONE); + GridLayout rightButtonAreaLayout = new GridLayout(); + rightButtonAreaLayout.numColumns = 0; + rightButtonAreaLayout.marginWidth = 0; + rightButtonAreaLayout.horizontalSpacing = horizontalSpacing; + rightButtonArea.setLayout(rightButtonAreaLayout); + rightButtonArea.setLayoutData(new GridData(SWT.END, SWT.TOP, true, false)); + + Button selectButton = createButton(rightButtonArea, IDialogConstants.SELECT_ALL_ID, + ProvUIMessages.TrustCertificateDialog_SelectAll, false); + selectButton.addSelectionListener(widgetSelectedAdapter(e -> { + certifcateViewer.setAllChecked(true); + if (artifactViewer != null) { + artifactViewer.refresh(true); + } + updateOkButton(); + })); + + Button deselectButton = createButton(rightButtonArea, IDialogConstants.DESELECT_ALL_ID, + ProvUIMessages.TrustCertificateDialog_DeselectAll, false); + deselectButton.addSelectionListener(widgetSelectedAdapter(e -> { + certifcateViewer.setAllChecked(false); + if (artifactViewer != null) { + artifactViewer.refresh(true); + } + updateOkButton(); + })); + } - SelectionListener listener = widgetSelectedAdapter(e -> { - listViewer.setAllChecked(true); - getOkButton().setEnabled(true); - }); - selectButton.addSelectionListener(listener); + protected Button createCheckButton(Composite parent, String label) { + ((GridLayout) parent.getLayout()).numColumns++; + Button button = WidgetFactory.button(SWT.CHECK).text(label).font(JFaceResources.getDialogFont()).create(parent); + setButtonLayoutData(button); + return button; + } - Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, ProvUIMessages.TrustCertificateDialog_DeselectAll, false); + private String getFilterPath(String key) { + IDialogSettings dialogSettings = DialogSettings + .getOrCreateSection(ProvUIActivator.getDefault().getDialogSettings(), getClass().getName()); + String filterPath = dialogSettings.get(key); + if (filterPath == null) { + filterPath = System.getProperty("user.home"); //$NON-NLS-1$ + } + return filterPath; + } - listener = widgetSelectedAdapter(e -> { - listViewer.setAllChecked(false); - getOkButton().setEnabled(false); - }); - deselectButton.addSelectionListener(listener); + private void setFilterPath(String key, String filterPath) { + if (filterPath != null) { + IDialogSettings dialogSettings = DialogSettings + .getOrCreateSection(ProvUIActivator.getDefault().getDialogSettings(), getClass().getName()); + dialogSettings.put(key, filterPath); + } } - private ISelectionChangedListener getChainSelectionListener() { - return event -> { - ISelection selection = event.getSelection(); - if (selection instanceof StructuredSelection) { - selectedCertificate = ((StructuredSelection) selection).getFirstElement(); + private void updateOkButton() { + Button okButton = getOkButton(); + if (okButton != null) { + certifcateViewer.getCheckedElements(); + Object[] checkedElements = certifcateViewer.getCheckedElements(); + Set<IArtifactKey> artifacts = artifactMap.values().stream().flatMap(Collection::stream) + .collect(Collectors.toSet()); + if (artifacts.isEmpty()) { + okButton.setEnabled(checkedElements.length > 0); + } else { + for (Object checkElement : checkedElements) { + artifacts.removeAll(artifactMap.get(checkElement)); + } + okButton.setEnabled(artifacts.isEmpty()); } - }; + } } - public TreeViewer getCertificateChainViewer() { - return certificateChainViewer; + @Override + protected void okPressed() { + setResult(Arrays.asList(certifcateViewer.getCheckedElements())); + super.okPressed(); } - private IDoubleClickListener getDoubleClickListener() { - return event -> { - StructuredSelection selection = (StructuredSelection) event.getSelection(); - Object selectedElement = selection.getFirstElement(); - if (selectedElement instanceof TreeNode) { - TreeNode treeNode = (TreeNode) selectedElement; - // create and open dialog for certificate chain - X509CertificateViewDialog certificateViewDialog = new X509CertificateViewDialog(getShell(), (X509Certificate) treeNode.getValue()); - certificateViewDialog.open(); + private static class PGPOrX509ColumnLabelProvider extends ColumnLabelProvider { + private Function<PGPPublicKey, String> pgpMap; + private Function<X509Certificate, String> x509map; + private String unsignedValue; + + public PGPOrX509ColumnLabelProvider(Function<PGPPublicKey, String> pgpMap, + Function<X509Certificate, String> x509map, String unsignedValue) { + this.pgpMap = pgpMap; + this.x509map = x509map; + this.unsignedValue = unsignedValue; + } + + @Override + public String getText(Object element) { + if (element instanceof TreeNode) { + element = ((TreeNode) element).getValue(); + } + if (element instanceof PGPPublicKey) { + return pgpMap.apply((PGPPublicKey) element); + } + if (element instanceof X509Certificate) { + return x509map.apply((X509Certificate) element); } - }; - } - private ISelectionChangedListener getParentSelectionListener() { - return event -> { - ISelection selection = event.getSelection(); - if (selection instanceof StructuredSelection) { - TreeNode firstElement = (TreeNode) ((StructuredSelection) selection).getFirstElement(); - getCertificateChainViewer().setInput(new TreeNode[] {firstElement}); - getOkButton().setEnabled(listViewer.getChecked(firstElement)); - getCertificateChainViewer().refresh(); + if (element == null) { + return unsignedValue; } - }; + return super.getText(element); + } } - /** - * The <code>ListSelectionDialog</code> implementation of this - * <code>Dialog</code> method builds a list of the selected elements for later - * retrieval by the client and closes this dialog. - */ - @Override - protected void okPressed() { - // Get the input children. - Object[] children = contentProvider.getElements(inputElement); + private static class ArtifactLabelProvider extends ColumnLabelProvider { + private Function<IArtifactKey, String> labelProvider; + private Function<IArtifactKey, Font> fontProvider; - // Build a list of selected children. + public ArtifactLabelProvider(Function<IArtifactKey, String> labelProvider, + Function<IArtifactKey, Font> fontProvider) { + this.labelProvider = labelProvider; + this.fontProvider = fontProvider; + } + + @Override + public String getText(Object element) { + return labelProvider.apply((IArtifactKey) element); + } + + @Override + public Font getFont(Object element) { + return fontProvider.apply((IArtifactKey) element); + } + } + + private static int computeTreeSize(TreeNode node) { + int count = 1; + TreeNode[] children = node.getChildren(); if (children != null) { - ArrayList<Object> list = new ArrayList<>(); - for (Object element : children) { - if (listViewer.getChecked(element)) { - list.add(element); + for (TreeNode child : children) { + count += computeTreeSize(child); + } + } + return count; + } + + private static <T> T getInstance(Object element, Class<T> type) { + if (type.isInstance(element)) { + return type.cast(element); + } else if (element instanceof Iterable) { + for (Object object : ((Iterable<?>) element)) { + T instance = getInstance(object, type); + if (instance != null) { + return instance; + } + } + } else if (element instanceof TreeNode) { + return getInstance(((TreeNode) element).getValue(), type); + } else if (element instanceof TreeNode[]) { + for (TreeNode child : (TreeNode[]) element) { + T instance = getInstance(child, type); + if (instance != null) { + return instance; } } - setResult(list); } - super.okPressed(); + return null; + } + + private static boolean containsInstance(Object element, Class<?> type) { + return getInstance(element, type) != null; + } + + private static String userFriendlyFingerPrint(PGPPublicKey key) { + if (key == null) { + return null; + } + return PGPPublicKeyService.toHexFingerprint(key); } } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties index ac698381d..1d574dc40 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties @@ -12,6 +12,7 @@ # IBM Corporation - initial API and implementation ############################################################################### +PGPPublicKeyViewDialog_Title=PGP Public Key Properties ProfileModificationAction_InvalidSelections=Problem determining user request. Profile id: {0}, Selection count: {1} ProfileModificationWizardPage_DetailsLabel=Details ProfileSnapshots_Label=Installation History @@ -257,6 +258,10 @@ RepositoryElement_NotFound=This repository is currently not available. RepositoryTracker_DuplicateLocation=Duplicate location MetadataRepositoryElement_RepositoryLoadError=Error loading repository {0} IUViewQueryContext_NoCategorizedItemsDescription=You can uncheck the 'Group items by category' check box to see items without categories. +KeySigningInfoFactory_FingerprintItem=Fingerprint= +KeySigningInfoFactory_KeySignersSection=Key Signers: +KeySigningInfoFactory_PGPSigningType=PGP Public Key +KeySigningInfoFactory_UserIDItem=UserID= QueriedElementWrapper_NoCategorizedItemsExplanation=There are no categorized items QueriedElementWrapper_NoItemsExplanation=There are no items available QueriedElementWrapper_SiteNotFound=Could not find {0} @@ -276,9 +281,38 @@ RevertDialog_CancelButtonLabel=Cancel RollbackProfileElement_CurrentInstallation=Current Installation -TrustCertificateDialog_Details=Details -TrustCertificateDialog_Title=Certificates -TrustCertificateDialog_Message=Do you trust these certificates? -TrustCertificateDialog_AcceptSelectedButtonLabel=&Accept selected +TrustCertificateDialog_Details=\uD83D\uDD0D D&etails... +TrustCertificateDialog_Export=\uD83D\uDCE5 E&xport... +TrustCertificateDialog_Title=Trust +TrustCertificateDialog_Message=Do you trust these signers? +TrustCertificateDialog_MessageUnsigned=\u26A0\uFE0F\u00A0Do you trust unsigned content of unknown origin? +TrustCertificateDialog_MessageNameWarning=\u26A0\uFE0F\u00A0The displayed originator names are not necessarily a reliable certification of origin. +TrustCertificateDialog_MessagePGP=For PG keys, verification is typically achieved by querying the key\'s fingerprint against a trusted key server. +TrustCertificateDialog_AcceptSelectedButtonLabel=&Trust Selected +TrustCertificateDialog_AlwaysTrust=Always trust all content +TrustCertificateDialog_AlwaysTrustConfirmationMessage=Are you certain you wish to accept all content, including unsigned content of unknown origin, with no further confirmation now and for all future operations?\n\n\ +Use the 'Select All' button to trust all content just for this operation.\n\n\ +This preference choice will be stored on the 'Install/Update > Trust' preference page. +TrustCertificateDialog_AlwaysTrustConfirmationTitle=Always Trust Everything Confirmation +TrustCertificateDialog_AlwaysTrustNo=No, Prompt Me Instead +TrustCertificateDialog_AlwaysTrustYes=Yes, I Accept the Risk +TrustCertificateDialog_ArtifactId=Id TrustCertificateDialog_SelectAll=&Select All TrustCertificateDialog_DeselectAll=&Deselect All +TrustCertificateDialog_ObjectType=Type +TrustCertificateDialog_Id=Id/Fingerprint +TrustCertificateDialog_Name=Name +TrustCertificateDialog_Classifier=Classifier +TrustCertificateDialog_CopyFingerprint=Copy Fingerprint +TrustCertificateDialog_dates=Validity Dates +TrustCertificateDialog_NotApplicable=n/a +TrustCertificateDialog_NotYetValidStartDate=\u274C Not yet valid, starts {0} +TrustCertificateDialog_expiredSince=\u274C Expired since {0} +TrustCertificateDialog_validExpires=\u2714\uFE0F Valid, expires {0} +TrustCertificateDialog_valid=\u2714\uFE0F Valid +TrustCertificateDialog_expired=\u274C Expired +TrustCertificateDialog_notYetValid=\u274C Not yet valid +TrustCertificateDialog_RememberSigners=Remember selected signers +TrustCertificateDialog_Unknown=Unknown +TrustCertificateDialog_Unsigned=Unsigned +TrustCertificateDialog_Version=Version diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/CertificateLabelProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/CertificateLabelProvider.java index 16246ed34..39cc991d8 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/CertificateLabelProvider.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/CertificateLabelProvider.java @@ -13,11 +13,12 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui.viewers; -import java.security.cert.Certificate; import java.security.cert.X509Certificate; import org.eclipse.equinox.internal.provisional.security.ui.X500PrincipalHelper; +import org.eclipse.equinox.internal.provisional.security.ui.X509CertificateViewDialog; import org.eclipse.jface.viewers.*; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Shell; /** * A label provider that displays X509 certificates. @@ -31,13 +32,12 @@ public class CertificateLabelProvider implements ILabelProvider { @Override public String getText(Object element) { - Certificate cert = null; if (element instanceof TreeNode) { - cert = (Certificate) ((TreeNode) element).getValue(); - } - if (cert != null) { - X500PrincipalHelper principalHelper = new X500PrincipalHelper(((X509Certificate) cert).getSubjectX500Principal()); - return principalHelper.getCN() + "; " + principalHelper.getOU() + "; " + principalHelper.getO(); //$NON-NLS-1$ //$NON-NLS-2$ + Object o = ((TreeNode) element).getValue(); + if (o instanceof X509Certificate) { + X509Certificate cert = (X509Certificate) o; + return getText(cert); + } } return ""; //$NON-NLS-1$ } @@ -62,4 +62,23 @@ public class CertificateLabelProvider implements ILabelProvider { // do nothing } + /** + * Returns a string that can be used as readable label for a certificate. This + * hides the internal implementation classes needed to produce this label. + */ + public static String getText(X509Certificate cert) { + X500PrincipalHelper principalHelper = new X500PrincipalHelper(cert.getSubjectX500Principal()); + return principalHelper.getCN() + "; " + principalHelper.getOU() + "; " //$NON-NLS-1$ //$NON-NLS-2$ + + principalHelper.getO(); + } + + /** + * Opens a dialog to present detailed information about a certificate. This + * hides the internal implementation classes needed open this dialog. + */ + public static void openDialog(Shell shell, X509Certificate cert) { + // create and open dialog for certificate chain + X509CertificateViewDialog certificateViewDialog = new X509CertificateViewDialog(shell, cert); + certificateViewDialog.open(); + } } diff --git a/bundles/org.eclipse.equinox.p2.updatechecker/.classpath b/bundles/org.eclipse.equinox.p2.updatechecker/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.updatechecker/.classpath +++ b/bundles/org.eclipse.equinox.p2.updatechecker/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.updatechecker/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.updatechecker/.settings/org.eclipse.jdt.core.prefs index 20e4f5fe2..3c15076cc 100644 --- a/bundles/org.eclipse.equinox.p2.updatechecker/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.updatechecker/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -127,8 +127,8 @@ 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.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -142,7 +142,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -263,7 +262,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -334,7 +332,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -479,7 +476,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.updatechecker/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.updatechecker/META-INF/MANIFEST.MF index 3bbc7e3b1..42bc89ee1 100644 --- a/bundles/org.eclipse.equinox.p2.updatechecker/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.updatechecker/META-INF/MANIFEST.MF @@ -2,14 +2,14 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.updatechecker;singleton:=true -Bundle-Version: 1.2.300.qualifier +Bundle-Version: 1.3.0.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.equinox.internal.p2.updatechecker;x-internal:=true, org.eclipse.equinox.internal.provisional.p2.updatechecker;x-friends:="org.eclipse.equinox.p2.ui.sdk.scheduler" Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.3.0,4.0)" Service-Component: OSGI-INF/updatechecker.xml -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.equinox.internal.p2.core.helpers, org.eclipse.equinox.p2.core;version="[2.0.0,3.0.0)", diff --git a/bundles/org.eclipse.equinox.p2.updatechecker/pom.xml b/bundles/org.eclipse.equinox.p2.updatechecker/pom.xml index 65a903012..49d08db7f 100644 --- a/bundles/org.eclipse.equinox.p2.updatechecker/pom.xml +++ b/bundles/org.eclipse.equinox.p2.updatechecker/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.updatechecker</artifactId> - <version>1.2.300-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.updatesite/.classpath b/bundles/org.eclipse.equinox.p2.updatesite/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/.classpath +++ b/bundles/org.eclipse.equinox.p2.updatesite/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.updatesite/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.updatesite/.settings/org.eclipse.jdt.core.prefs index bf073244e..d3f0b63c3 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.updatesite/.settings/org.eclipse.jdt.core.prefs @@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -35,6 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -92,6 +93,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -127,7 +129,8 @@ 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -141,7 +144,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -262,7 +264,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -333,7 +334,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -478,7 +478,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF index 115a12aa3..c20fed2b9 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.updatesite;singleton:=true -Bundle-Version: 1.1.500.qualifier +Bundle-Version: 1.2.200.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.updatesite.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -12,7 +12,7 @@ Export-Package: org.eclipse.equinox.internal.p2.updatesite;x-friends:="org.eclip Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.7.0,4.0.0)", org.eclipse.equinox.p2.metadata.repository;bundle-version="0.1.0", org.eclipse.equinox.p2.artifact.repository;bundle-version="0.1.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Import-Package: javax.xml.parsers, org.eclipse.equinox.app;version="1.1.0", diff --git a/bundles/org.eclipse.equinox.p2.updatesite/build.properties b/bundles/org.eclipse.equinox.p2.updatesite/build.properties index a62667f6e..5ca611c37 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/build.properties +++ b/bundles/org.eclipse.equinox.p2.updatesite/build.properties @@ -19,4 +19,3 @@ bin.includes = META-INF/,\ plugin.properties,\ about.html src.includes = about.html -javacWarnings..=+unusedAllocation,unusedImport,unusedLocal,unusedPrivate
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.updatesite/pom.xml b/bundles/org.eclipse.equinox.p2.updatesite/pom.xml index bc731abc3..1f7c8c962 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/pom.xml +++ b/bundles/org.eclipse.equinox.p2.updatesite/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.updatesite</artifactId> - <version>1.1.500-SNAPSHOT</version> + <version>1.2.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DefaultSiteParser.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DefaultSiteParser.java index 4d299ce2c..f533dd7c5 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DefaultSiteParser.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DefaultSiteParser.java @@ -27,8 +27,8 @@ import org.xml.sax.*; import org.xml.sax.helpers.DefaultHandler; /** - * Parses a site.xml file. - * This class was initially copied from org.eclipse.update.core.model.DefaultSiteParser. + * Parses a site.xml file. This class was initially copied from + * org.eclipse.update.core.model.DefaultSiteParser. */ public class DefaultSiteParser extends DefaultHandler { @@ -155,13 +155,14 @@ public class DefaultSiteParser extends DefaultHandler { /** * Handle character text + * * @see DefaultHandler#characters(char[], int, int) * @since 2.0 */ @Override public void characters(char[] ch, int start, int length) { String text = new String(ch, start, length); - //only push if description + // only push if description int state = stateStack.peek().intValue(); if (state == STATE_DESCRIPTION_SITE || state == STATE_DESCRIPTION_CATEGORY_DEF) objectStack.push(text); @@ -170,6 +171,7 @@ public class DefaultSiteParser extends DefaultHandler { /** * Handle end of element tags + * * @see DefaultHandler#endElement(String, String, String) * @since 2.0 */ @@ -181,108 +183,109 @@ public class DefaultSiteParser extends DefaultHandler { int state = stateStack.peek().intValue(); switch (state) { - case STATE_IGNORED_ELEMENT : - case STATE_ARCHIVE : - case STATE_CATEGORY : - stateStack.pop(); - break; - - case STATE_INITIAL : - internalError(Messages.DefaultSiteParser_ParsingStackBackToInitialState); - break; - - case STATE_SITE : - stateStack.pop(); - if (objectStack.peek() instanceof String) { - text = (String) objectStack.pop(); - SiteModel site = (SiteModel) objectStack.peek(); - site.getDescription().setAnnotation(text); - } - //do not pop the object - break; - - case STATE_FEATURE : - stateStack.pop(); - objectStack.pop(); - break; - - case STATE_BUNDLE : - stateStack.pop(); - objectStack.pop(); - break; - - case STATE_CATEGORY_DEF : - stateStack.pop(); - if (objectStack.peek() instanceof String) { - text = (String) objectStack.pop(); - SiteCategory category = (SiteCategory) objectStack.peek(); - category.setDescription(text); + case STATE_IGNORED_ELEMENT: + case STATE_ARCHIVE: + case STATE_CATEGORY: + stateStack.pop(); + break; + + case STATE_INITIAL: + internalError(Messages.DefaultSiteParser_ParsingStackBackToInitialState); + break; + + case STATE_SITE: + stateStack.pop(); + if (objectStack.peek() instanceof String) { + text = (String) objectStack.pop(); + SiteModel site = (SiteModel) objectStack.peek(); + site.getDescription().setAnnotation(text); + } + // do not pop the object + break; + + case STATE_FEATURE: + stateStack.pop(); + objectStack.pop(); + break; + + case STATE_BUNDLE: + stateStack.pop(); + objectStack.pop(); + break; + + case STATE_CATEGORY_DEF: + stateStack.pop(); + if (objectStack.peek() instanceof String) { + text = (String) objectStack.pop(); + SiteCategory category = (SiteCategory) objectStack.peek(); + category.setDescription(text); + } + objectStack.pop(); + break; + + case STATE_DESCRIPTION_SITE: + stateStack.pop(); + text = ""; //$NON-NLS-1$ + while (objectStack.peek() instanceof String) { + // add text, preserving at most one space between text fragments + String newText = (String) objectStack.pop(); + if (trailingSpace(newText) && !leadingSpace(text)) { + text = " " + text; //$NON-NLS-1$ } - objectStack.pop(); - break; - - case STATE_DESCRIPTION_SITE : - stateStack.pop(); - text = ""; //$NON-NLS-1$ - while (objectStack.peek() instanceof String) { - // add text, preserving at most one space between text fragments - String newText = (String) objectStack.pop(); - if (trailingSpace(newText) && !leadingSpace(text)) { - text = " " + text; //$NON-NLS-1$ - } - text = newText.trim() + text; - if (leadingSpace(newText) && !leadingSpace(text)) { - text = " " + text; //$NON-NLS-1$ - } + text = newText.trim() + text; + if (leadingSpace(newText) && !leadingSpace(text)) { + text = " " + text; //$NON-NLS-1$ } - text = text.trim(); - - info = (URLEntry) objectStack.pop(); - if (text != null) - info.setAnnotation(text); - - SiteModel siteModel = (SiteModel) objectStack.peek(); - // override description. - // do not raise error as previous description may be default one - // when parsing site tag - if (DESCRIPTION_SITE_ALREADY_SEEN) - debug(NLS.bind(Messages.DefaultSiteParser_ElementAlreadySet, (new String[] {getState(state)}))); - siteModel.setDescription(info); - DESCRIPTION_SITE_ALREADY_SEEN = true; - break; - - case STATE_DESCRIPTION_CATEGORY_DEF : - stateStack.pop(); - text = ""; //$NON-NLS-1$ - while (objectStack.peek() instanceof String) { - // add text, preserving at most one space between text fragments - String newText = (String) objectStack.pop(); - if (trailingSpace(newText) && !leadingSpace(text)) { - text = " " + text; //$NON-NLS-1$ - } - text = newText.trim() + text; - if (leadingSpace(newText) && !leadingSpace(text)) { - text = " " + text; //$NON-NLS-1$ - } + } + text = text.trim(); + + info = (URLEntry) objectStack.pop(); + if (text != null) + info.setAnnotation(text); + + SiteModel siteModel = (SiteModel) objectStack.peek(); + // override description. + // do not raise error as previous description may be default one + // when parsing site tag + if (DESCRIPTION_SITE_ALREADY_SEEN) + debug(NLS.bind(Messages.DefaultSiteParser_ElementAlreadySet, (new String[] { getState(state) }))); + siteModel.setDescription(info); + DESCRIPTION_SITE_ALREADY_SEEN = true; + break; + + case STATE_DESCRIPTION_CATEGORY_DEF: + stateStack.pop(); + text = ""; //$NON-NLS-1$ + while (objectStack.peek() instanceof String) { + // add text, preserving at most one space between text fragments + String newText = (String) objectStack.pop(); + if (trailingSpace(newText) && !leadingSpace(text)) { + text = " " + text; //$NON-NLS-1$ } - text = text.trim(); - - info = (URLEntry) objectStack.pop(); - if (text != null) - info.setAnnotation(text); - - SiteCategory category = (SiteCategory) objectStack.peek(); - if (category.getDescription() != null) - internalError(NLS.bind(Messages.DefaultSiteParser_ElementAlreadySet, (new String[] {getState(state), category.getLabel()}))); - else { - checkTranslated(info.getAnnotation()); - category.setDescription(info.getAnnotation()); + text = newText.trim() + text; + if (leadingSpace(newText) && !leadingSpace(text)) { + text = " " + text; //$NON-NLS-1$ } - break; + } + text = text.trim(); + + info = (URLEntry) objectStack.pop(); + if (text != null) + info.setAnnotation(text); + + SiteCategory category = (SiteCategory) objectStack.peek(); + if (category.getDescription() != null) + internalError(NLS.bind(Messages.DefaultSiteParser_ElementAlreadySet, + (new String[] { getState(state), category.getLabel() }))); + else { + checkTranslated(info.getAnnotation()); + category.setDescription(info.getAnnotation()); + } + break; - default : - internalError(NLS.bind(Messages.DefaultSiteParser_UnknownEndState, (new String[] {getState(state)}))); - break; + default: + internalError(NLS.bind(Messages.DefaultSiteParser_UnknownEndState, (new String[] { getState(state) }))); + break; } if (Tracing.DEBUG_GENERATOR_PARSING) @@ -290,8 +293,8 @@ public class DefaultSiteParser extends DefaultHandler { } /* - * Handles an error state specified by the status. The collection of all logged status - * objects can be accessed using <code>getStatus()</code>. + * Handles an error state specified by the status. The collection of all logged + * status objects can be accessed using <code>getStatus()</code>. * * @param error a status detailing the error condition */ @@ -308,6 +311,7 @@ public class DefaultSiteParser extends DefaultHandler { /** * Handle errors + * * @see DefaultHandler#error(SAXParseException) * @since 2.0 */ @@ -318,6 +322,7 @@ public class DefaultSiteParser extends DefaultHandler { /** * Handle fatal errors + * * @see DefaultHandler#fatalError(SAXParseException) * @exception SAXException * @since 2.0 @@ -334,38 +339,38 @@ public class DefaultSiteParser extends DefaultHandler { private String getState(int state) { switch (state) { - case STATE_IGNORED_ELEMENT : - return "Ignored"; //$NON-NLS-1$ + case STATE_IGNORED_ELEMENT: + return "Ignored"; //$NON-NLS-1$ - case STATE_INITIAL : - return "Initial"; //$NON-NLS-1$ + case STATE_INITIAL: + return "Initial"; //$NON-NLS-1$ - case STATE_SITE : - return "Site"; //$NON-NLS-1$ + case STATE_SITE: + return "Site"; //$NON-NLS-1$ - case STATE_FEATURE : - return "Feature"; //$NON-NLS-1$ + case STATE_FEATURE: + return "Feature"; //$NON-NLS-1$ - case STATE_BUNDLE : - return "Bundle"; //$NON-NLS-1$ + case STATE_BUNDLE: + return "Bundle"; //$NON-NLS-1$ - case STATE_ARCHIVE : - return "Archive"; //$NON-NLS-1$ + case STATE_ARCHIVE: + return "Archive"; //$NON-NLS-1$ - case STATE_CATEGORY : - return "Category"; //$NON-NLS-1$ + case STATE_CATEGORY: + return "Category"; //$NON-NLS-1$ - case STATE_CATEGORY_DEF : - return "Category Def"; //$NON-NLS-1$ + case STATE_CATEGORY_DEF: + return "Category Def"; //$NON-NLS-1$ - case STATE_DESCRIPTION_CATEGORY_DEF : - return "Description / Category Def"; //$NON-NLS-1$ + case STATE_DESCRIPTION_CATEGORY_DEF: + return "Description / Category Def"; //$NON-NLS-1$ - case STATE_DESCRIPTION_SITE : - return "Description / Site"; //$NON-NLS-1$ + case STATE_DESCRIPTION_SITE: + return "Description / Site"; //$NON-NLS-1$ - default : - return Messages.DefaultSiteParser_UnknownState; + default: + return Messages.DefaultSiteParser_UnknownState; } } @@ -381,113 +386,117 @@ public class DefaultSiteParser extends DefaultHandler { private void handleCategoryDefState(String elementName, Attributes attributes) { switch (elementName) { - case FEATURE: - stateStack.push(Integer.valueOf(STATE_FEATURE)); - processFeature(attributes); - break; - case BUNDLE: - stateStack.push(Integer.valueOf(STATE_BUNDLE)); - processBundle(attributes); - break; - case ARCHIVE: - stateStack.push(Integer.valueOf(STATE_ARCHIVE)); - processArchive(attributes); - break; - case CATEGORY_DEF: - stateStack.push(Integer.valueOf(STATE_CATEGORY_DEF)); - processCategoryDef(attributes); - break; - case DESCRIPTION: - stateStack.push(Integer.valueOf(STATE_DESCRIPTION_CATEGORY_DEF)); - processInfo(attributes); - break; - default: - internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownElement, (new String[] {elementName, getState(currentState)}))); - break; + case FEATURE: + stateStack.push(Integer.valueOf(STATE_FEATURE)); + processFeature(attributes); + break; + case BUNDLE: + stateStack.push(Integer.valueOf(STATE_BUNDLE)); + processBundle(attributes); + break; + case ARCHIVE: + stateStack.push(Integer.valueOf(STATE_ARCHIVE)); + processArchive(attributes); + break; + case CATEGORY_DEF: + stateStack.push(Integer.valueOf(STATE_CATEGORY_DEF)); + processCategoryDef(attributes); + break; + case DESCRIPTION: + stateStack.push(Integer.valueOf(STATE_DESCRIPTION_CATEGORY_DEF)); + processInfo(attributes); + break; + default: + internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownElement, + (new String[] { elementName, getState(currentState) }))); + break; } } private void handleCategoryState(String elementName, Attributes attributes) { switch (elementName) { - case DESCRIPTION: - stateStack.push(Integer.valueOf(STATE_DESCRIPTION_SITE)); - processInfo(attributes); - break; - case FEATURE: - stateStack.push(Integer.valueOf(STATE_FEATURE)); - processFeature(attributes); - break; - case BUNDLE: - stateStack.push(Integer.valueOf(STATE_BUNDLE)); - processBundle(attributes); - break; - case ARCHIVE: - stateStack.push(Integer.valueOf(STATE_ARCHIVE)); - processArchive(attributes); - break; - case CATEGORY_DEF: - stateStack.push(Integer.valueOf(STATE_CATEGORY_DEF)); - processCategoryDef(attributes); - break; - case CATEGORY: - stateStack.push(Integer.valueOf(STATE_CATEGORY)); - processCategory(attributes); - break; - default: - internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownElement, (new String[] {elementName, getState(currentState)}))); - break; + case DESCRIPTION: + stateStack.push(Integer.valueOf(STATE_DESCRIPTION_SITE)); + processInfo(attributes); + break; + case FEATURE: + stateStack.push(Integer.valueOf(STATE_FEATURE)); + processFeature(attributes); + break; + case BUNDLE: + stateStack.push(Integer.valueOf(STATE_BUNDLE)); + processBundle(attributes); + break; + case ARCHIVE: + stateStack.push(Integer.valueOf(STATE_ARCHIVE)); + processArchive(attributes); + break; + case CATEGORY_DEF: + stateStack.push(Integer.valueOf(STATE_CATEGORY_DEF)); + processCategoryDef(attributes); + break; + case CATEGORY: + stateStack.push(Integer.valueOf(STATE_CATEGORY)); + processCategory(attributes); + break; + default: + internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownElement, + (new String[] { elementName, getState(currentState) }))); + break; } } private void handleFeatureState(String elementName, Attributes attributes) { switch (elementName) { - case DESCRIPTION: - stateStack.push(Integer.valueOf(STATE_DESCRIPTION_SITE)); - processInfo(attributes); - break; - case FEATURE: - stateStack.push(Integer.valueOf(STATE_FEATURE)); - processFeature(attributes); - break; - case ARCHIVE: - stateStack.push(Integer.valueOf(STATE_ARCHIVE)); - processArchive(attributes); - break; - case CATEGORY_DEF: - stateStack.push(Integer.valueOf(STATE_CATEGORY_DEF)); - processCategoryDef(attributes); - break; - case CATEGORY: - stateStack.push(Integer.valueOf(STATE_CATEGORY)); - processCategory(attributes); - break; - default: - internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownElement, (new String[] {elementName, getState(currentState)}))); - break; + case DESCRIPTION: + stateStack.push(Integer.valueOf(STATE_DESCRIPTION_SITE)); + processInfo(attributes); + break; + case FEATURE: + stateStack.push(Integer.valueOf(STATE_FEATURE)); + processFeature(attributes); + break; + case ARCHIVE: + stateStack.push(Integer.valueOf(STATE_ARCHIVE)); + processArchive(attributes); + break; + case CATEGORY_DEF: + stateStack.push(Integer.valueOf(STATE_CATEGORY_DEF)); + processCategoryDef(attributes); + break; + case CATEGORY: + stateStack.push(Integer.valueOf(STATE_CATEGORY)); + processCategory(attributes); + break; + default: + internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownElement, + (new String[] { elementName, getState(currentState) }))); + break; } } private void handleBundleState(String elementName, Attributes attributes) { switch (elementName) { - case DESCRIPTION: - stateStack.push(Integer.valueOf(STATE_DESCRIPTION_SITE)); - processInfo(attributes); - break; - case ARCHIVE: - stateStack.push(Integer.valueOf(STATE_ARCHIVE)); - processArchive(attributes); - break; - case CATEGORY_DEF: - stateStack.push(Integer.valueOf(STATE_CATEGORY_DEF)); - processCategoryDef(attributes); - break; - case CATEGORY: - stateStack.push(Integer.valueOf(STATE_CATEGORY)); - processCategory(attributes); - break; - default: - internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownElement, (new String[] {elementName, getState(currentState)}))); - break; + case DESCRIPTION: + stateStack.push(Integer.valueOf(STATE_DESCRIPTION_SITE)); + processInfo(attributes); + break; + case ARCHIVE: + stateStack.push(Integer.valueOf(STATE_ARCHIVE)); + processArchive(attributes); + break; + case CATEGORY_DEF: + stateStack.push(Integer.valueOf(STATE_CATEGORY_DEF)); + processCategoryDef(attributes); + break; + case CATEGORY: + stateStack.push(Integer.valueOf(STATE_CATEGORY)); + processCategory(attributes); + break; + default: + internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownElement, + (new String[] { elementName, getState(currentState) }))); + break; } } @@ -496,7 +505,8 @@ public class DefaultSiteParser extends DefaultHandler { stateStack.push(Integer.valueOf(STATE_SITE)); processSite(attributes); } else { - internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownElement, (new String[] {elementName, getState(currentState)}))); + internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownElement, + (new String[] { elementName, getState(currentState) }))); // what we received was not a site.xml, no need to continue throw new SAXException(Messages.DefaultSiteParser_InvalidXMLStream); } @@ -505,29 +515,30 @@ public class DefaultSiteParser extends DefaultHandler { private void handleSiteState(String elementName, Attributes attributes) { switch (elementName) { - case DESCRIPTION: - stateStack.push(Integer.valueOf(STATE_DESCRIPTION_SITE)); - processInfo(attributes); - break; - case FEATURE: - stateStack.push(Integer.valueOf(STATE_FEATURE)); - processFeature(attributes); - break; - case BUNDLE: - stateStack.push(Integer.valueOf(STATE_BUNDLE)); - processBundle(attributes); - break; - case ARCHIVE: - stateStack.push(Integer.valueOf(STATE_ARCHIVE)); - processArchive(attributes); - break; - case CATEGORY_DEF: - stateStack.push(Integer.valueOf(STATE_CATEGORY_DEF)); - processCategoryDef(attributes); - break; - default: - internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownElement, (new String[] {elementName, getState(currentState)}))); - break; + case DESCRIPTION: + stateStack.push(Integer.valueOf(STATE_DESCRIPTION_SITE)); + processInfo(attributes); + break; + case FEATURE: + stateStack.push(Integer.valueOf(STATE_FEATURE)); + processFeature(attributes); + break; + case BUNDLE: + stateStack.push(Integer.valueOf(STATE_BUNDLE)); + processBundle(attributes); + break; + case ARCHIVE: + stateStack.push(Integer.valueOf(STATE_ARCHIVE)); + processArchive(attributes); + break; + case CATEGORY_DEF: + stateStack.push(Integer.valueOf(STATE_CATEGORY_DEF)); + processCategoryDef(attributes); + break; + default: + internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownElement, + (new String[] { elementName, getState(currentState) }))); + break; } } @@ -566,14 +577,15 @@ public class DefaultSiteParser extends DefaultHandler { String msg; if (name.equals("")) //$NON-NLS-1$ name = siteLocation.toString(); - String[] values = new String[] {name, Integer.toString(ex.getLineNumber()), Integer.toString(ex.getColumnNumber()), ex.getMessage()}; + String[] values = new String[] { name, Integer.toString(ex.getLineNumber()), + Integer.toString(ex.getColumnNumber()), ex.getMessage() }; msg = NLS.bind(Messages.DefaultSiteParser_ErrorlineColumnMessage, values); error(new Status(IStatus.ERROR, PLUGIN_ID, msg, ex)); } /** - * Parses the specified input steam and constructs a site model. - * The input stream is not closed as part of this operation. + * Parses the specified input steam and constructs a site model. The input + * stream is not closed as part of this operation. * * @param in input stream * @return site model @@ -597,24 +609,26 @@ public class DefaultSiteParser extends DefaultHandler { while (iter.hasNext()) { stack = stack + iter.next().toString() + "\r\n"; //$NON-NLS-1$ } - throw new SAXException(NLS.bind(Messages.DefaultSiteParser_WrongParsingStack, (new String[] {stack}))); + throw new SAXException(NLS.bind(Messages.DefaultSiteParser_WrongParsingStack, (new String[] { stack }))); } - /* + /* * process archive info */ private void processArchive(Attributes attributes) { URLEntry archive = new URLEntry(); String id = attributes.getValue("path"); //$NON-NLS-1$ if (id == null || id.trim().equals("")) { //$NON-NLS-1$ - internalError(NLS.bind(Messages.DefaultSiteParser_Missing, (new String[] {"path", getState(currentState)}))); //$NON-NLS-1$ + internalError( + NLS.bind(Messages.DefaultSiteParser_Missing, (new String[] { "path", getState(currentState) }))); //$NON-NLS-1$ } archive.setAnnotation(id); String url = attributes.getValue("url"); //$NON-NLS-1$ if (url == null || url.trim().equals("")) { //$NON-NLS-1$ - internalError(NLS.bind(Messages.DefaultSiteParser_Missing, (new String[] {"archive", getState(currentState)}))); //$NON-NLS-1$ + internalError( + NLS.bind(Messages.DefaultSiteParser_Missing, (new String[] { "archive", getState(currentState) }))); //$NON-NLS-1$ } else { archive.setURL(url); @@ -626,8 +640,8 @@ public class DefaultSiteParser extends DefaultHandler { } - /* - * process the Category info + /* + * process the Category info */ private void processCategory(Attributes attributes) { String category = attributes.getValue("name"); //$NON-NLS-1$ @@ -644,7 +658,7 @@ public class DefaultSiteParser extends DefaultHandler { debug("End processing Category: name:" + category); //$NON-NLS-1$ } - /* + /* * process category def info */ private void processCategoryDef(Attributes attributes) { @@ -663,7 +677,7 @@ public class DefaultSiteParser extends DefaultHandler { debug("End processing CategoryDef: name:" + name + " label:" + label); //$NON-NLS-1$ //$NON-NLS-2$ } - /* + /* * process feature info */ private void processFeature(Attributes attributes) { @@ -682,10 +696,11 @@ public class DefaultSiteParser extends DefaultHandler { // We need to have id and version, or the url, or both. if (noURL) { if (noId || noVersion) - internalError(NLS.bind(Messages.DefaultSiteParser_Missing, (new String[] {"url", getState(currentState)}))); //$NON-NLS-1$ + internalError( + NLS.bind(Messages.DefaultSiteParser_Missing, (new String[] { "url", getState(currentState) }))); //$NON-NLS-1$ else // default url - urlInfo = FEATURES + id + '_' + ver; // + urlInfo = FEATURES + id + '_' + ver; // } feature.setURLString(urlInfo); @@ -695,7 +710,7 @@ public class DefaultSiteParser extends DefaultHandler { // if one is null, and not the other if (noId ^ noVersion) { - String[] values = new String[] {id, ver, getState(currentState)}; + String[] values = new String[] { id, ver, getState(currentState) }; log(NLS.bind(Messages.DefaultFeatureParser_IdOrVersionInvalid, values)); } else { feature.setFeatureIdentifier(id); @@ -727,7 +742,7 @@ public class DefaultSiteParser extends DefaultHandler { String arch = attributes.getValue("arch"); //$NON-NLS-1$ feature.setArch(arch); - //patch + // patch String patch = attributes.getValue("patch"); //$NON-NLS-1$ feature.setPatch(patch); @@ -742,7 +757,7 @@ public class DefaultSiteParser extends DefaultHandler { } - /* + /* * process feature info */ private void processBundle(Attributes attributes) { @@ -761,10 +776,11 @@ public class DefaultSiteParser extends DefaultHandler { // We need to have id and version, or the url, or both. if (noURL) { if (noId || noVersion) - internalError(NLS.bind(Messages.DefaultSiteParser_Missing, (new String[] {"url", getState(currentState)}))); //$NON-NLS-1$ + internalError( + NLS.bind(Messages.DefaultSiteParser_Missing, (new String[] { "url", getState(currentState) }))); //$NON-NLS-1$ else // default url - urlInfo = PLUGINS + id + '_' + ver; // + urlInfo = PLUGINS + id + '_' + ver; // } bundle.setURLString(urlInfo); @@ -774,7 +790,7 @@ public class DefaultSiteParser extends DefaultHandler { // if one is null, and not the other if (noId ^ noVersion) { - String[] values = new String[] {id, ver, getState(currentState)}; + String[] values = new String[] { id, ver, getState(currentState) }; log(NLS.bind(Messages.DefaultFeatureParser_IdOrVersionInvalid, values)); } else { bundle.setBundleIdentifier(id); @@ -806,7 +822,7 @@ public class DefaultSiteParser extends DefaultHandler { String arch = attributes.getValue("arch"); //$NON-NLS-1$ bundle.setArch(arch); - //patch + // patch String patch = attributes.getValue("patch"); //$NON-NLS-1$ bundle.setPatch(patch); @@ -821,7 +837,7 @@ public class DefaultSiteParser extends DefaultHandler { } - /* + /* * process URL info with element text */ private void processInfo(Attributes attributes) { @@ -835,9 +851,10 @@ public class DefaultSiteParser extends DefaultHandler { objectStack.push(inf); } - /* + /* * process site info */ + @SuppressWarnings("removal") private void processSite(Attributes attributes) { // create site map SiteModel site = new SiteModel(); @@ -853,7 +870,7 @@ public class DefaultSiteParser extends DefaultHandler { } // provide default description URL - // If <description> is specified, for the site, it takes precedence + // If <description> is specified, for the site, it takes precedence URLEntry description = new URLEntry(); description.setURL(DEFAULT_INFO_URL); site.setDescription(description); @@ -867,13 +884,13 @@ public class DefaultSiteParser extends DefaultHandler { // get mirrors, if any String mirrorsURL = attributes.getValue("mirrorsURL"); //$NON-NLS-1$ if (mirrorsURL != null && mirrorsURL.trim().length() > 0) { - // URLEntry[] mirrors = getMirrors(mirrorsURL); - // if (mirrors != null) - // site.setMirrors(mirrors); - // else + // URLEntry[] mirrors = getMirrors(mirrorsURL); + // if (mirrors != null) + // site.setMirrors(mirrors); + // else - //Since we are parsing the site at p2 generation time and the - //mirrors may change, there is no point doing the mirror expansion now + // Since we are parsing the site at p2 generation time and the + // mirrors may change, there is no point doing the mirror expansion now site.setMirrorsURIString(mirrorsURL); } @@ -887,20 +904,24 @@ public class DefaultSiteParser extends DefaultHandler { site.setDigestURIString(digestURL); // TODO: Digest locales - // if ((attributes.getValue("availableLocales") != null) && (!attributes.getValue("availableLocales").trim().equals(""))) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - // StringTokenizer locals = new StringTokenizer(attributes.getValue("availableLocales"), ","); //$NON-NLS-1$//$NON-NLS-2$ - // String[] availableLocals = new String[locals.countTokens()]; - // int i = 0; - // while (locals.hasMoreTokens()) { - // availableLocals[i++] = locals.nextToken(); - // } - // extendedSite.setAvailableLocals(availableLocals); - // } - // } + // if ((attributes.getValue("availableLocales") != null) && + // (!attributes.getValue("availableLocales").trim().equals(""))) { + // //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + // StringTokenizer locals = new + // StringTokenizer(attributes.getValue("availableLocales"), ","); + // //$NON-NLS-1$//$NON-NLS-2$ + // String[] availableLocals = new String[locals.countTokens()]; + // int i = 0; + // while (locals.hasMoreTokens()) { + // availableLocals[i++] = locals.nextToken(); + // } + // extendedSite.setAvailableLocals(availableLocals); + // } + // } // final String associateURL = attributes.getValue(ASSOCIATE_SITES_URL); if (associateURL != null) { - //resolve the URI relative to the site location + // resolve the URI relative to the site location URI resolvedLocation = siteLocation.resolve(associateURL); site.setAssociateSites(getAssociateSites(resolvedLocation.toString())); } @@ -914,6 +935,7 @@ public class DefaultSiteParser extends DefaultHandler { /** * Handle start of element tags + * * @see DefaultHandler#startElement(String, String, String, Attributes) * @since 2.0 */ @@ -926,48 +948,50 @@ public class DefaultSiteParser extends DefaultHandler { } switch (currentState) { - case STATE_IGNORED_ELEMENT : - internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownElement, (new String[] {localName, getState(currentState)}))); - break; - case STATE_INITIAL : - handleInitialState(localName, attributes); - break; - - case STATE_SITE : - handleSiteState(localName, attributes); - break; - - case STATE_FEATURE : - handleFeatureState(localName, attributes); - break; - - case STATE_BUNDLE : - handleBundleState(localName, attributes); - break; - - case STATE_ARCHIVE : - handleSiteState(localName, attributes); - break; - - case STATE_CATEGORY : - handleCategoryState(localName, attributes); - break; - - case STATE_CATEGORY_DEF : - handleCategoryDefState(localName, attributes); - break; - - case STATE_DESCRIPTION_SITE : - handleSiteState(localName, attributes); - break; - - case STATE_DESCRIPTION_CATEGORY_DEF : - handleSiteState(localName, attributes); - break; - - default : - internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownStartState, (new String[] {getState(currentState)}))); - break; + case STATE_IGNORED_ELEMENT: + internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownElement, + (new String[] { localName, getState(currentState) }))); + break; + case STATE_INITIAL: + handleInitialState(localName, attributes); + break; + + case STATE_SITE: + handleSiteState(localName, attributes); + break; + + case STATE_FEATURE: + handleFeatureState(localName, attributes); + break; + + case STATE_BUNDLE: + handleBundleState(localName, attributes); + break; + + case STATE_ARCHIVE: + handleSiteState(localName, attributes); + break; + + case STATE_CATEGORY: + handleCategoryState(localName, attributes); + break; + + case STATE_CATEGORY_DEF: + handleCategoryDefState(localName, attributes); + break; + + case STATE_DESCRIPTION_SITE: + handleSiteState(localName, attributes); + break; + + case STATE_DESCRIPTION_CATEGORY_DEF: + handleSiteState(localName, attributes); + break; + + default: + internalErrorUnknownTag( + NLS.bind(Messages.DefaultSiteParser_UnknownStartState, (new String[] { getState(currentState) }))); + break; } int newState = stateStack.peek().intValue(); if (newState != STATE_IGNORED_ELEMENT) diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteBundle.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteBundle.java index 944754e37..e783dd074 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteBundle.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteBundle.java @@ -438,7 +438,7 @@ public class SiteBundle { */ @Override public String toString() { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append(getClass().toString() + " :"); //$NON-NLS-1$ buffer.append(" at "); //$NON-NLS-1$ if (url != null) diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java index 03eb0405d..5e2b6f56f 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java @@ -62,8 +62,8 @@ public class SiteModel { } /** - * Adds an archive reference model to site. - * Throws a runtime exception if this object is marked read-only. + * Adds an archive reference model to site. Throws a runtime exception if this + * object is marked read-only. * * @param archiveReference archive reference model * @since 2.0 @@ -157,11 +157,11 @@ public class SiteModel { } /** - * Returns an array of plug-in and non-plug-in archive reference models - * on this site + * Returns an array of plug-in and non-plug-in archive reference models on this + * site * * @return an array of archive reference models, or an empty array if there are - * no archives known to this site. + * no archives known to this site. * @since 2.0 */ public URLEntry[] getArchives() { @@ -189,6 +189,7 @@ public class SiteModel { /** * Returns the category with the given name. + * * @return the category with the given name, or <code>null</code> */ public SiteCategory getCategory(String name) { @@ -280,8 +281,8 @@ public class SiteModel { } /** - * Gets the localizations for the site as a map from locale - * to the set of translated properties for that locale. + * Gets the localizations for the site as a map from locale to the set of + * translated properties for that locale. * * @return a map from locale to property set * @since 3.4 @@ -300,7 +301,7 @@ public class SiteModel { try { locationURI = new URI(locationURIString); } catch (URISyntaxException e) { - //ignore and return null + // ignore and return null } } return locationURI; @@ -333,7 +334,7 @@ public class SiteModel { return mirrorsURIString; } - /** + /** * Returns the site type. * * @return site type, or <code>null</code>. @@ -343,6 +344,11 @@ public class SiteModel { return type; } + /** + * @noreference This method is not intended to be referenced by clients. + * @deprecated See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=572043">bug</a> for details. + */ + @Deprecated(forRemoval = true, since = "1.2.0") public boolean isPack200Supported() { return supportsPack200; } @@ -358,8 +364,8 @@ public class SiteModel { } /** - * Sets the localizations for the site as a map from locale - * to the set of translated properties for that locale. + * Sets the localizations for the site as a map from locale to the set of + * translated properties for that locale. * * @param localizations as a map from locale to property set * @since 3.4 @@ -395,9 +401,9 @@ public class SiteModel { } /** - * Sets the mirrors url. Mirror sites will then be obtained from this mirror url later. - * This method is complementary to setMirrorsiteEntryModels(), and only one of these - * methods should be called. + * Sets the mirrors url. Mirror sites will then be obtained from this mirror url + * later. This method is complementary to setMirrorsiteEntryModels(), and only + * one of these methods should be called. * * @param mirrorsURI additional update site mirrors * @since 3.1 @@ -406,13 +412,14 @@ public class SiteModel { this.mirrorsURIString = mirrorsURI; } + @Deprecated(forRemoval = true, since = "1.2.0") public void setSupportsPack200(boolean value) { this.supportsPack200 = value; } /** - * Sets the site type. - * Throws a runtime exception if this object is marked read-only. + * Sets the site type. Throws a runtime exception if this object is marked + * read-only. * * @param type site type * @since 2.0 @@ -439,7 +446,7 @@ public class SiteModel { } /** - * Sets the URI of the stats repository used to track downloads. + * Sets the URI of the stats repository used to track downloads. * * @param statsURI a String describing the stats URI */ diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java index 41829a01a..0f36feaba 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java @@ -580,7 +580,7 @@ public class SiteXMLAction extends AbstractPublisherAction { categories.add(this.defaultCategory); // sort category so they are processed in reverse order of dependency // (Nested categories go first) - Comparator<SiteCategory> isNestedCategoryComparator = new Comparator<SiteCategory>() { + Comparator<SiteCategory> isNestedCategoryComparator = new Comparator<>() { @Override public int compare(SiteCategory category1, SiteCategory category2) { Set<SiteCategory> childrenOfCategory1 = categoryToNestedCategories.get(category1); diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java index 9e5eacb11..b364ab14f 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java @@ -114,6 +114,7 @@ public class UpdateSiteArtifactRepositoryFactory extends ArtifactRepositoryFacto generateArtifactDescriptors(updateSite, repository, monitor); } + @SuppressWarnings("removal") private void generateArtifactDescriptors(UpdateSite updateSite, IArtifactRepository repository, IProgressMonitor monitor) throws ProvisionException { final String PACK_EXT = ".pack.gz"; //$NON-NLS-1$ @@ -123,7 +124,7 @@ public class UpdateSiteArtifactRepositoryFactory extends ArtifactRepositoryFacto Feature[] features = updateSite.loadFeatures(monitor); for (Feature feature : features) { IArtifactKey featureKey = FeaturesAction.createFeatureArtifactKey(feature.getId(), - feature.getVersion()); + feature.getVersion()); SimpleArtifactDescriptor featureArtifactDescriptor = new SimpleArtifactDescriptor(featureKey); URI featureURL = updateSite.getFeatureURI(feature.getId(), feature.getVersion()); featureArtifactDescriptor.setRepositoryProperty(PROP_ARTIFACT_REFERENCE, featureURL.toString()); @@ -133,12 +134,12 @@ public class UpdateSiteArtifactRepositoryFactory extends ArtifactRepositoryFacto featureArtifactDescriptor = new SimpleArtifactDescriptor(featureKey); featureURL = updateSite.getFeatureURI(feature.getId(), feature.getVersion()); featureArtifactDescriptor.setRepositoryProperty(PROP_ARTIFACT_REFERENCE, - featureURL.toString() + PACK_EXT); + featureURL.toString() + PACK_EXT); IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] { new ProcessingStepDescriptor( - "org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true) }; //$NON-NLS-1$ + "org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true) }; //$NON-NLS-1$ featureArtifactDescriptor.setProcessingSteps(steps); featureArtifactDescriptor.setProperty(IArtifactDescriptor.FORMAT, - IArtifactDescriptor.FORMAT_PACKED); + IArtifactDescriptor.FORMAT_PACKED); allSiteArtifacts.add(featureArtifactDescriptor); } FeatureEntry[] featureEntries = feature.getEntries(); @@ -156,13 +157,13 @@ public class UpdateSiteArtifactRepositoryFactory extends ArtifactRepositoryFacto artifactDescriptor = new SimpleArtifactDescriptor(key); pluginURL = updateSite.getPluginURI(entry); artifactDescriptor.setRepositoryProperty(PROP_ARTIFACT_REFERENCE, - pluginURL.toString() + PACK_EXT); + pluginURL.toString() + PACK_EXT); IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] { - new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", //$NON-NLS-1$ - null, true) }; + new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", //$NON-NLS-1$ + null, true) }; artifactDescriptor.setProcessingSteps(steps); artifactDescriptor.setProperty(IArtifactDescriptor.FORMAT, - IArtifactDescriptor.FORMAT_PACKED); + IArtifactDescriptor.FORMAT_PACKED); allSiteArtifacts.add(artifactDescriptor); } } @@ -173,7 +174,7 @@ public class UpdateSiteArtifactRepositoryFactory extends ArtifactRepositoryFacto BundleDescription[] bundles = updateSite.loadBundles(monitor); for (BundleDescription bundle : bundles) { IArtifactKey bundleKey = BundlesAction.createBundleArtifactKey(bundle.getSymbolicName(), - bundle.getVersion().toString()); + bundle.getVersion().toString()); SimpleArtifactDescriptor bundleArtifactDescriptor = new SimpleArtifactDescriptor(bundleKey); URI bundleURI = updateSite.getBundleURI(bundle.getSymbolicName(), bundle.getVersion().toString()); bundleArtifactDescriptor.setRepositoryProperty(PROP_ARTIFACT_REFERENCE, bundleURI.toString()); @@ -184,9 +185,9 @@ public class UpdateSiteArtifactRepositoryFactory extends ArtifactRepositoryFacto bundleArtifactDescriptor = new SimpleArtifactDescriptor(bundleKey); bundleURI = updateSite.getBundleURI(bundle.getSymbolicName(), bundle.getVersion().toString()); bundleArtifactDescriptor.setRepositoryProperty(PROP_ARTIFACT_REFERENCE, - bundleURI.toString() + PACK_EXT); + bundleURI.toString() + PACK_EXT); IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] { new ProcessingStepDescriptor( - "org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true) }; //$NON-NLS-1$ + "org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true) }; //$NON-NLS-1$ bundleArtifactDescriptor.setProcessingSteps(steps); bundleArtifactDescriptor.setProperty(IArtifactDescriptor.FORMAT, IArtifactDescriptor.FORMAT_PACKED); allSiteArtifacts.add(bundleArtifactDescriptor); diff --git a/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/.classpath b/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/.classpath +++ b/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.simpleconfigurator.manipulator/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/.settings/org.eclipse.jdt.core.prefs index c75992293..0e7287cf7 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/.settings/org.eclipse.jdt.core.prefs @@ -9,9 +9,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul 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.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -27,6 +27,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -84,6 +85,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -120,7 +122,8 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -134,7 +137,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -255,7 +257,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -326,7 +327,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -471,7 +471,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=false org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/META-INF/MANIFEST.MF index 1654bd444..ce94697f1 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-SymbolicName: org.eclipse.equinox.simpleconfigurator.manipulator;singleton:=true -Bundle-Version: 2.1.500.qualifier +Bundle-Version: 2.2.0.qualifier Bundle-Localization: plugin Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.equinox.frameworkadmin;version="[2.0.0,3.0.0)", @@ -16,7 +16,7 @@ Import-Package: org.eclipse.equinox.frameworkadmin;version="[2.0.0,3.0.0)", Bundle-Vendor: %providerName Export-Package: org.eclipse.equinox.internal.simpleconfigurator.manipulator;x-friends:="org.eclipse.equinox.p2.touchpoint.eclipse", org.eclipse.equinox.simpleconfigurator.manipulator;version="2.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.equinox.common;bundle-version="3.5.0" Service-Component: OSGI-INF/configurator.xml Automatic-Module-Name: org.eclipse.equinox.simpleconfigurator.manipulator diff --git a/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/pom.xml b/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/pom.xml index 0650e216c..43581bbeb 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/pom.xml +++ b/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.simpleconfigurator.manipulator</artifactId> - <version>2.1.500-SNAPSHOT</version> + <version>2.2.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/.classpath b/bundles/org.eclipse.equinox.simpleconfigurator/.classpath index eca7bdba8..e801ebfb4 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/.classpath +++ b/bundles/org.eclipse.equinox.simpleconfigurator/.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/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <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.simpleconfigurator/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.simpleconfigurator/.settings/org.eclipse.jdt.core.prefs index c92cf7ace..f27603dba 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.simpleconfigurator/.settings/org.eclipse.jdt.core.prefs @@ -10,9 +10,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -28,6 +28,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -85,6 +86,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn 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.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -121,7 +123,8 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning 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.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false @@ -135,7 +138,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -256,7 +258,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -327,7 +328,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -472,7 +472,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.simpleconfigurator/META-INF/MANIFEST.MF index 43f4fd479..de39e26b8 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.simpleconfigurator/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-SymbolicName: org.eclipse.equinox.simpleconfigurator;singleton:=true -Bundle-Version: 1.3.600.qualifier +Bundle-Version: 1.4.0.qualifier Bundle-Name: %bundleName Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -26,5 +26,5 @@ Export-Package: org.eclipse.equinox.internal.provisional.configurator; org.eclipse.equinox.internal.simpleconfigurator;x-friends:="org.eclipse.equinox.simpleconfigurator.manipulator", org.eclipse.equinox.internal.simpleconfigurator.console;x-internal:=true, org.eclipse.equinox.internal.simpleconfigurator.utils;x-friends:="org.eclipse.equinox.simpleconfigurator.manipulator" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.eclipse.equinox.simpleconfigurator diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/pom.xml b/bundles/org.eclipse.equinox.simpleconfigurator/pom.xml index a0fff38a8..5a9a88217 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/pom.xml +++ b/bundles/org.eclipse.equinox.simpleconfigurator/pom.xml @@ -4,11 +4,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.simpleconfigurator</artifactId> - <version>1.3.600-SNAPSHOT</version> + <version>1.4.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/.project b/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/.project deleted file mode 100644 index 96fb3bc7a..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/.project +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.equinox.p2.examples.rcp.cloud.releng</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - </buildSpec> - <natures> - </natures> -</projectDescription> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/Build Cloud Example.launch b/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/Build Cloud Example.launch deleted file mode 100644 index c2eb88df9..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/Build Cloud Example.launch +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.ant.AntLaunchConfigurationType"> -<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> -<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> -<listEntry value="/org.eclipse.equinox.p2.examples.rcp.cloud.releng/buildProduct.xml"/> -</listAttribute> -<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> -<listEntry value="1"/> -</listAttribute> -<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> -<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.p2.examples.rcp.cloud.releng"/> -<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> -<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.equinox.p2.examples.rcp.cloud.releng/buildProduct.xml}"/> -<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/> -</launchConfiguration> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/build.properties b/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/build.properties deleted file mode 100644 index 350446e1b..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/build.properties +++ /dev/null @@ -1,123 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 2006 IBM Corporation and others. -# -# This program and the accompanying materials -# are made available under the terms of the Eclipse Public License 2.0 -# which accompanies this distribution, and is available at -# https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -product=/org.eclipse.equinox.p2.examples.rcp.cloud/cloud.product -runPackager=true - -p2.gathering=true -p2.metadata.repo=file:${builder}/repository -p2.artifact.repo=file:${builder}/repository - -#Set the name of the archive that will result from the product build. -#archiveNamePrefix= - -# The prefix that will be used in the generated archive. -archivePrefix=eclipse - -# The location underwhich all of the build output will be collected. -collectingFolder=${archivePrefix} - -# The list of {os, ws, arch} configurations to build. This -# value is a '&' separated list of ',' separate triples. For example, -# configs=win32,win32,x86 & linux,motif,x86 -# By default the value is *,*,* -configs = win32, win32, x86 & \ - linux, gtk, x86 & -#configs=win32, win32, x86 & \ -# linux, gtk, ppc &\ -# linux, gtk, x86 & \ -# linux, gtk, x86_64 & \ -# linux, motif, x86 & \ -# solaris, motif, sparc & \ -# solaris, gtk, sparc & \ -# aix, motif, ppc & \ -# hpux, motif, PA_RISC & \ -# macosx, carbon, ppc - -#Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles. -allowBinaryCycles = true - -# Type of build. Used in naming the build output. Typically this value is -# one of I, N, M, S, ... -buildType=I - -# ID of the build. Used in naming the build output. -buildId=TestBuild - -# Label for the build. Used in naming the build output -buildLabel=${buildType}.${buildId} - -# Timestamp for the build. Used in naming the build output -timestamp=007 - -#this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons) -resolution.devMode=false - -skipBase=true -skipMaps=true -skipFetch=true - - -############# JAVA COMPILER OPTIONS ############## -# For this example: -# We specify the JRE locations for CDC-1.1/Foundation-1.1 and J2SE-1.5 -# because these are the required execution environments defined for the -# bundles in the example. - -# The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE -#bootclasspath=${java.home}/lib/rt.jar - -# If using an IBM VM, use -#bootclasspath=${java.home}/lib/core.jar;${java.home}/lib/vm.jar - -# specific JRE locations to compile against. These values are used to compile bundles specifying a -# Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support -#CDC-1.0/Foundation-1.0= /path/to/rt.jar -CDC-1.1/Foundation-1.1=${java.home}/lib/rt.jar -#OSGi/Minimum-1.0= -#OSGi/Minimum-1.1= -#JRE-1.1= -#J2SE-1.2= -#J2SE-1.3= -#J2SE-1.4= -J2SE-1.5=${java.home}/lib/rt.jar -#JavaSE-1.6= -#PersonalJava-1.1= -#PersonalJava-1.2= -#CDC-1.0/PersonalBasis-1.0= -#CDC-1.0/PersonalJava-1.0= -#CDC-1.1/PersonalBasis-1.1= -#CDC-1.1/PersonalJava-1.1= - -# Specify the output format of the compiler log when eclipse jdt is used -logExtension=.log - -# Whether or not to include debug info in the output jars -javacDebugInfo=false - -# Whether or not to fail the build if there are compiler errors -javacFailOnError=true - -# Enable or disable verbose mode of the compiler -javacVerbose=true - -# Extra arguments for the compiler. These are specific to the java compiler being used. -#compilerArg= - -# Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties -#javacSource=1.3 - -# Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties. -#javacTarget=1.1 - - diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/buildProduct.xml b/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/buildProduct.xml deleted file mode 100644 index be9929d62..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/buildProduct.xml +++ /dev/null @@ -1,40 +0,0 @@ -<project default="main"> - <target name="main"> - <property name="baseLocation" value="${eclipse.home}"/> - <!-- by default, check for deltapack co-located with eclipse --> - <property name="deltapack" value="${eclipse.home}/../deltapack/eclipse"/> - - <!-- Check that we have a deltapack --> - <available property="haveDeltaPack" file="${deltapack}"/> - <fail unless="haveDeltaPack" message="The deltapack is required to build this product. Please edit buildProduct.xml or set the "deltapack" property." /> - - <property name="builder" value="${basedir}" /> - <property name="buildDirectory" value="${basedir}/buildDirectory"/> - <property name="pluginPath" value="${deltapack}" /> - <property name="buildTempFolder" value="${buildDirectory}" /> - - <!-- Clean build directory and workspace --> - <delete includeemptydirs="true" failonerror="false"> - <fileset dir="${basedir}/buildDirectory"/> - <fileset dir="${basedir}/repository"/> - </delete> - - <!-- Copy plug-ins from workspace --> - <copy todir="${buildDirectory}/plugins"> - <fileset dir="${basedir}/.."> - <include name="org.eclipse.equinox.p2.examples.rcp.cloud/**/*"/> - <exclude name="**/bin/**"/> - </fileset> - </copy> - - <ant antfile="${eclipse.pdebuild.scripts}/productBuild/productBuild.xml" /> - - <move todir="${basedir}" overwrite="true"> - <fileset dir="${buildDirectory}/I.TestBuild" includes="*.zip"/> - </move> - - <!-- refresh the workspace --> - <eclipse.convertPath fileSystemPath="${basedir}" property="resourcePath"/> - <eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/> - </target> -</project>
\ No newline at end of file diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/readme.txt b/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/readme.txt deleted file mode 100644 index eb0d08981..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud.releng/readme.txt +++ /dev/null @@ -1,16 +0,0 @@ -This project is a releng builder for the org.eclipse.equinox.p2.examples.rcp.cloud project. - -1) This build requires 3.5M6 or later - -2) This build requires the deltapack. By default it looks beside the eclipse install for "deltapack/eclipse/*". - If your deltapack is located elsewhere, set the "deltapack" property or edit the buildProduct.xml file. The - version of the deltapack used should match the version of the eclipse that is running. - -3) Due to bug 268867, if the buildDirectory/buildRepo is deleted/cleaned, then the repo must also be removed from - the workspace Available Software Sites preferences. - -4) Use the included launch config, or run buildProduct.xml as an ant build using the same JRE as the workspace - -5) The build.properties file specifically defines the JRE's for CDC-1.1/Foundation-1.1 and - J2SE-1.5 because these are the required bundle execution environments in the example. - The build should be run on a 1.5 VM.
\ No newline at end of file diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.classpath b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.classpath deleted file mode 100644 index e801ebfb4..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?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-11"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.gitignore b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.gitignore deleted file mode 100644 index c5e82d745..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bin
\ No newline at end of file diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.project b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.project deleted file mode 100644 index 9276cae55..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.equinox.p2.examples.rcp.cloud</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.settings/org.eclipse.jdt.core.prefs b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index a615ee7a9..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,115 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullable.secondary= -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=11 -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.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 -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -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=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -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=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -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=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -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.release=enabled -org.eclipse.jdt.core.compiler.source=11 diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.settings/org.eclipse.jdt.ui.prefs b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index b42c32887..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,61 +0,0 @@ -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_functional_interfaces=true -sp_cleanup.convert_to_enhanced_for_loop=true -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.insert_inferred_type_arguments=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_redundant_modifiers=true -sp_cleanup.remove_redundant_semicolons=true -sp_cleanup.remove_redundant_type_arguments=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=true -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_anonymous_class_creation=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_lambda=true -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/META-INF/MANIFEST.MF b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/META-INF/MANIFEST.MF deleted file mode 100644 index 02d86e82b..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/META-INF/MANIFEST.MF +++ /dev/null @@ -1,30 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: RCP Mail (Cloud Update Example) -Bundle-SymbolicName: org.eclipse.equinox.p2.examples.rcp.cloud; singleton:=true -Bundle-Version: 1.2.0.qualifier -Bundle-Activator: org.eclipse.equinox.p2.examples.rcp.cloud.Activator -Bundle-Localization: plugin -Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", - org.eclipse.core.runtime, - org.eclipse.equinox.p2.operations;bundle-version="2.0.0", - org.eclipse.equinox.p2.ui;bundle-version="2.0.0", - org.eclipse.equinox.p2.metadata;bundle-version="[2.4.0,3.0.0)", - org.eclipse.equinox.p2.metadata.repository;bundle-version="1.0.0", - org.eclipse.equinox.p2.artifact.repository;bundle-version="1.1.0", - org.eclipse.equinox.p2.extensionlocation;bundle-version="1.0.100", - org.eclipse.equinox.p2.updatesite;bundle-version="1.0.0", - org.eclipse.equinox.p2.director;bundle-version="2.0.0", - org.eclipse.equinox.p2.engine;bundle-version="2.0.0", - org.eclipse.equinox.p2.core;bundle-version="2.0.0", - org.eclipse.ecf;bundle-version="3.0.0", - org.eclipse.ecf.filetransfer;bundle-version="3.0.0", - org.eclipse.ecf.identity;bundle-version="3.0.0", - org.eclipse.ecf.provider.filetransfer;bundle-version="3.0.0", - org.eclipse.equinox.p2.ui.sdk.scheduler;bundle-version="1.0.0", - org.apache.felix.scr;bundle-version="2.1.14", - org.apache.httpcomponents.httpclient;bundle-version="4.2.0", - org.eclipse.ecf.provider.filetransfer.httpclient45;bundle-version="1.0.0" -Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-11 -Automatic-Module-Name: org.eclipse.equinox.p2.examples.rcp.cloud diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/build.properties b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/build.properties deleted file mode 100644 index f5ecc5c82..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/build.properties +++ /dev/null @@ -1,10 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = plugin.xml,\ - META-INF/,\ - .,\ - icons/,\ - product_lg.gif,\ - splash.bmp,\ - plugin.properties,\ - plugin_customization.ini diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/cloud.product b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/cloud.product deleted file mode 100644 index 518936061..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/cloud.product +++ /dev/null @@ -1,156 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?pde version="3.5"?> - -<product name="RCP Mail Example (Cloud Update)" id="org.eclipse.equinox.p2.examples.rcp.cloud.product" application="org.eclipse.equinox.p2.examples.rcp.cloud.application" version="1.1.0.qualifier" useFeatures="false" includeLaunchers="true"> - - <aboutInfo> - <image path="product_lg.gif"/> - <text> - RCP Mail template created by PDE - </text> - </aboutInfo> - - <configIni use="default"> - </configIni> - - <launcherArgs> - <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts - </vmArgsMac> - </launcherArgs> - - <windowImages i16="icons/sample2.gif"/> - - <splash - location="org.eclipse.equinox.p2.examples.rcp.cloud" /> - <launcher name="cloud"> - <win useIco="false"> - <bmp/> - </win> - </launcher> - - <vm> - </vm> - - <plugins> - <plugin id="com.ibm.icu"/> - <plugin id="javax.annotation"/> - <plugin id="javax.inject"/> - <plugin id="javax.xml"/> - <plugin id="org.apache.batik.constants"/> - <plugin id="org.apache.batik.css"/> - <plugin id="org.apache.batik.i18n"/> - <plugin id="org.apache.batik.util"/> - <plugin id="org.apache.commons.codec"/> - <plugin id="org.apache.commons.httpclient"/> - <plugin id="org.apache.commons.io"/> - <plugin id="org.apache.commons.jxpath"/> - <plugin id="org.apache.commons.logging"/> - <plugin id="org.apache.felix.scr"/> - <plugin id="org.apache.httpcomponents.httpclient"/> - <plugin id="org.apache.httpcomponents.httpcore"/> - <plugin id="org.apache.xmlgraphics"/> - <plugin id="org.eclipse.core.commands"/> - <plugin id="org.eclipse.core.contenttype"/> - <plugin id="org.eclipse.core.databinding"/> - <plugin id="org.eclipse.core.databinding.observable"/> - <plugin id="org.eclipse.core.databinding.property"/> - <plugin id="org.eclipse.core.expressions"/> - <plugin id="org.eclipse.core.jobs"/> - <plugin id="org.eclipse.core.runtime"/> - <plugin id="org.eclipse.e4.core.commands"/> - <plugin id="org.eclipse.e4.core.contexts"/> - <plugin id="org.eclipse.e4.core.di"/> - <plugin id="org.eclipse.e4.core.di.annotations"/> - <plugin id="org.eclipse.e4.core.di.extensions"/> - <plugin id="org.eclipse.e4.core.di.extensions.supplier"/> - <plugin id="org.eclipse.e4.core.services"/> - <plugin id="org.eclipse.e4.emf.xpath"/> - <plugin id="org.eclipse.e4.ui.bindings"/> - <plugin id="org.eclipse.e4.ui.css.core"/> - <plugin id="org.eclipse.e4.ui.css.swt"/> - <plugin id="org.eclipse.e4.ui.css.swt.theme"/> - <plugin id="org.eclipse.e4.ui.di"/> - <plugin id="org.eclipse.e4.ui.model.workbench"/> - <plugin id="org.eclipse.e4.ui.services"/> - <plugin id="org.eclipse.e4.ui.swt.gtk" fragment="true"/> - <plugin id="org.eclipse.e4.ui.widgets"/> - <plugin id="org.eclipse.e4.ui.workbench"/> - <plugin id="org.eclipse.e4.ui.workbench.addons.swt"/> - <plugin id="org.eclipse.e4.ui.workbench.renderers.swt"/> - <plugin id="org.eclipse.e4.ui.workbench.swt"/> - <plugin id="org.eclipse.e4.ui.workbench3"/> - <plugin id="org.eclipse.ecf"/> - <plugin id="org.eclipse.ecf.filetransfer"/> - <plugin id="org.eclipse.ecf.identity"/> - <plugin id="org.eclipse.ecf.provider.filetransfer"/> - <plugin id="org.eclipse.ecf.provider.filetransfer.httpclient"/> - <plugin id="org.eclipse.ecf.provider.filetransfer.httpclient.ssl" fragment="true"/> - <plugin id="org.eclipse.ecf.provider.filetransfer.httpclient45"/> - <plugin id="org.eclipse.ecf.provider.filetransfer.ssl" fragment="true"/> - <plugin id="org.eclipse.ecf.ssl" fragment="true"/> - <plugin id="org.eclipse.emf.common"/> - <plugin id="org.eclipse.emf.ecore"/> - <plugin id="org.eclipse.emf.ecore.change"/> - <plugin id="org.eclipse.emf.ecore.xmi"/> - <plugin id="org.eclipse.equinox.app"/> - <plugin id="org.eclipse.equinox.common"/> - <plugin id="org.eclipse.equinox.concurrent"/> - <plugin id="org.eclipse.equinox.event"/> - <plugin id="org.eclipse.equinox.frameworkadmin"/> - <plugin id="org.eclipse.equinox.frameworkadmin.equinox"/> - <plugin id="org.eclipse.equinox.p2.artifact.repository"/> - <plugin id="org.eclipse.equinox.p2.core"/> - <plugin id="org.eclipse.equinox.p2.director"/> - <plugin id="org.eclipse.equinox.p2.directorywatcher"/> - <plugin id="org.eclipse.equinox.p2.discovery"/> - <plugin id="org.eclipse.equinox.p2.discovery.compatibility"/> - <plugin id="org.eclipse.equinox.p2.engine"/> - <plugin id="org.eclipse.equinox.p2.examples.rcp.cloud" version="1.0.0.qualifier"/> - <plugin id="org.eclipse.equinox.p2.extensionlocation"/> - <plugin id="org.eclipse.equinox.p2.garbagecollector"/> - <plugin id="org.eclipse.equinox.p2.jarprocessor"/> - <plugin id="org.eclipse.equinox.p2.metadata"/> - <plugin id="org.eclipse.equinox.p2.metadata.repository"/> - <plugin id="org.eclipse.equinox.p2.operations"/> - <plugin id="org.eclipse.equinox.p2.publisher"/> - <plugin id="org.eclipse.equinox.p2.publisher.eclipse"/> - <plugin id="org.eclipse.equinox.p2.repository"/> - <plugin id="org.eclipse.equinox.p2.touchpoint.eclipse"/> - <plugin id="org.eclipse.equinox.p2.touchpoint.natives"/> - <plugin id="org.eclipse.equinox.p2.transport.ecf"/> - <plugin id="org.eclipse.equinox.p2.ui"/> - <plugin id="org.eclipse.equinox.p2.ui.discovery"/> - <plugin id="org.eclipse.equinox.p2.ui.sdk.scheduler"/> - <plugin id="org.eclipse.equinox.p2.updatechecker"/> - <plugin id="org.eclipse.equinox.p2.updatesite"/> - <plugin id="org.eclipse.equinox.preferences"/> - <plugin id="org.eclipse.equinox.registry"/> - <plugin id="org.eclipse.equinox.security"/> - <plugin id="org.eclipse.equinox.security.linux.x86_64" fragment="true"/> - <plugin id="org.eclipse.equinox.security.ui"/> - <plugin id="org.eclipse.equinox.simpleconfigurator"/> - <plugin id="org.eclipse.equinox.simpleconfigurator.manipulator"/> - <plugin id="org.eclipse.equinox.util"/> - <plugin id="org.eclipse.help"/> - <plugin id="org.eclipse.jface"/> - <plugin id="org.eclipse.jface.databinding"/> - <plugin id="org.eclipse.osgi"/> - <plugin id="org.eclipse.osgi.compatibility.state" fragment="true"/> - <plugin id="org.eclipse.osgi.services"/> - <plugin id="org.eclipse.osgi.util"/> - <plugin id="org.eclipse.swt"/> - <plugin id="org.eclipse.swt.gtk.linux.x86_64" fragment="true"/> - <plugin id="org.eclipse.ui"/> - <plugin id="org.eclipse.ui.browser"/> - <plugin id="org.eclipse.ui.workbench"/> - <plugin id="org.sat4j.core"/> - <plugin id="org.sat4j.pb"/> - <plugin id="org.tukaani.xz"/> - <plugin id="org.w3c.css.sac"/> - <plugin id="org.w3c.dom.events"/> - <plugin id="org.w3c.dom.smil"/> - <plugin id="org.w3c.dom.svg"/> - </plugins> - - -</product> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/cloud.product.launch b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/cloud.product.launch deleted file mode 100644 index 95ed4ca9c..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/cloud.product.launch +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench"> -<booleanAttribute key="append.args" value="true"/> -<stringAttribute key="application" value="org.eclipse.equinox.p2.examples.rcp.cloud.application"/> -<booleanAttribute key="askclear" value="true"/> -<booleanAttribute key="automaticAdd" value="false"/> -<booleanAttribute key="automaticValidate" value="false"/> -<stringAttribute key="bootstrap" value=""/> -<stringAttribute key="checked" value="[NONE]"/> -<booleanAttribute key="clearConfig" value="false"/> -<booleanAttribute key="clearws" value="false"/> -<booleanAttribute key="clearwslog" value="false"/> -<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/cloud.product"/> -<booleanAttribute key="default" value="false"/> -<booleanAttribute key="generateProfile" value="true"/> -<booleanAttribute key="includeOptional" value="true"/> -<stringAttribute key="location" value="${workspace_loc}/../runtime-cloud.product"/> -<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/> -<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> -<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx384m"/> -<stringAttribute key="pde.version" value="3.3"/> -<stringAttribute key="product" value="org.eclipse.equinox.p2.examples.rcp.cloud.product"/> -<stringAttribute key="productFile" value="\org.eclipse.equinox.p2.examples.rcp.cloud\cloud.product"/> -<stringAttribute key="selected_target_plugins" value="org.eclipse.core.variables@default:default,org.eclipse.osgi.services@default:default,org.eclipse.core.databinding.observable@default:default,org.apache.commons.codec*1.3.0.v20100106-1700@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.equinox.concurrent@default:default,org.eclipse.core.databinding@default:default,org.apache.commons.codec*1.3.0.v20080530-1600@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.equinox.ds@1:true,org.eclipse.swt.win32.win32.x86@default:false,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.ecf@default:default,org.eclipse.equinox.app@default:default,javax.servlet@default:default,org.apache.commons.httpclient@default:default,org.eclipse.core.expressions@default:default,org.eclipse.equinox.security@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.swt@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.equinox.event@default:default,org.eclipse.core.commands@default:default,org.eclipse.osgi@-1:true,org.eclipse.help@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.core.net.win32.x86@default:false,com.ibm.icu@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.ant.core@default:default,org.eclipse.equinox.util@default:default,org.eclipse.core.jobs@default:default,org.apache.commons.logging@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.preferences@default:default,org.eclipse.core.net@default:default,org.eclipse.ui.browser@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.core.runtime@default:true"/> -<stringAttribute key="selected_workspace_plugins" value="org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.eclipse.ui@default:default,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.sat4j.pb@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.equinox.p2.extensionlocation@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.eclipse.equinox.p2.examples.rcp.cloud*1.0.0.qualifier@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.repository@default:default,org.sat4j.core@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.equinox.p2.operations@default:default,org.eclipse.jface@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.equinox.p2.ui@default:default"/> -<booleanAttribute key="show_selected_only" value="false"/> -<booleanAttribute key="tracing" value="false"/> -<booleanAttribute key="useCustomFeatures" value="false"/> -<booleanAttribute key="useDefaultConfig" value="true"/> -<booleanAttribute key="useDefaultConfigArea" value="true"/> -<booleanAttribute key="useProduct" value="true"/> -<booleanAttribute key="usefeatures" value="false"/> -</launchConfiguration> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/forceQualifierUpdate.txt b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/forceQualifierUpdate.txt deleted file mode 100644 index 56f1032a8..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/forceQualifierUpdate.txt +++ /dev/null @@ -1,2 +0,0 @@ -# To force a version qualifier update add the bug here -Bug 403352 - Update all parent versions to match our build stream diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/mail.ico b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/mail.ico Binary files differdeleted file mode 100644 index b00006113..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/mail.ico +++ /dev/null diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/sample.gif b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/sample.gif Binary files differdeleted file mode 100644 index 34fb3c9d8..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/sample.gif +++ /dev/null diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/sample.icns b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/sample.icns Binary files differdeleted file mode 100644 index 1e92ccce1..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/sample.icns +++ /dev/null diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/sample2.gif b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/sample2.gif Binary files differdeleted file mode 100644 index 252d7ebcb..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/sample2.gif +++ /dev/null diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/sample3.gif b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/sample3.gif Binary files differdeleted file mode 100644 index b949ac948..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/icons/sample3.gif +++ /dev/null diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/p2.inf b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/p2.inf deleted file mode 100644 index 48f31a324..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/p2.inf +++ /dev/null @@ -1,3 +0,0 @@ -instructions.configure=\ - addRepository(type:0,location:http${#58}//www.eclipse.org/equinox/p2/testing/updateSite);\ - addRepository(type:1,location:http${#58}//www.eclipse.org/equinox/p2/testing/updateSite);
\ No newline at end of file diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/plugin.properties b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/plugin.properties deleted file mode 100644 index 8fd5402f8..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/plugin.properties +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################### -# Copyright (c) 2009 IBM Corporation and others. -# -# This program and the accompanying materials -# are made available under the terms of the Eclipse Public License 2.0 -# which accompanies this distribution, and is available at -# https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -# -# RCP Mail Plug-in Resources -# -Update.command=Check for Updates -Update.command.mnemonic=U -Install.command=Install New Software... -Install.command.mnemonic=S -installedSoftwarePage = Installed Software -installHistoryPage = Installation History diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/plugin.xml b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/plugin.xml deleted file mode 100644 index 7e1298fb6..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/plugin.xml +++ /dev/null @@ -1,159 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - - <extension - id="application" - point="org.eclipse.core.runtime.applications"> - <application> - <run - class="org.eclipse.equinox.p2.examples.rcp.cloud.Application"> - </run> - </application> - </extension> - <extension - point="org.eclipse.ui.perspectives"> - <perspective - name="RCP Perspective" - class="org.eclipse.equinox.p2.examples.rcp.cloud.Perspective" - id="org.eclipse.equinox.p2.examples.rcp.cloud.perspective"> - </perspective> - </extension> - <extension - point="org.eclipse.ui.views"> - <view - name="Message" - allowMultiple="true" - icon="icons/sample2.gif" - class="org.eclipse.equinox.p2.examples.rcp.cloud.View" - id="org.eclipse.equinox.p2.examples.rcp.cloud.view"> - </view> - <view - name="Mailboxes" - allowMultiple="true" - icon="icons/sample3.gif" - class="org.eclipse.equinox.p2.examples.rcp.cloud.NavigationView" - id="org.eclipse.equinox.p2.examples.rcp.cloud.navigationView"> - </view> - </extension> - <extension - point="org.eclipse.ui.commands"> - <category - name="Mail" - id="org.eclipse.equinox.p2.examples.rcp.cloud.category"> - </category> - <command - name="Open Mailbox" - description="Opens a mailbox" - categoryId="org.eclipse.equinox.p2.examples.rcp.cloud.category" - id="org.eclipse.equinox.p2.examples.rcp.cloud.open"> - </command> - <command - name="Open Message Dialog" - description="Open a message dialog" - categoryId="org.eclipse.equinox.p2.examples.rcp.cloud.category" - id="org.eclipse.equinox.p2.examples.rcp.cloud.openMessage"> - </command> - </extension> - <extension - point="org.eclipse.ui.bindings"> - <key - commandId="org.eclipse.equinox.p2.examples.rcp.cloud.open" - schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" - sequence="CTRL+2"> - </key> - <key - commandId="org.eclipse.equinox.p2.examples.rcp.cloud.openMessage" - schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" - sequence="CTRL+3"> - </key> - <key - commandId="org.eclipse.ui.file.exit" - schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" - sequence="CTRL+X"> - </key> - </extension> - <extension - id="product" - point="org.eclipse.core.runtime.products"> - <product - application="org.eclipse.equinox.p2.examples.rcp.cloud.application" - name="RCP Mail Example (Cloud Update)"> - <property - name="aboutText" - value="RCP Mail template created by PDE"> - </property> - <property - name="windowImages" - value="icons/sample2.gif"> - </property> - <property - name="aboutImage" - value="product_lg.gif"> - </property> - <property name="preferenceCustomization" value="plugin_customization.ini"/> - - </product> - </extension> - <extension - id="preferences" point="org.eclipse.core.runtime.preferences" name="%preferences"> - <initializer class="org.eclipse.equinox.p2.examples.rcp.cloud.p2.PreferenceInitializer"/> - </extension> - <extension - point="org.eclipse.ui.installationPages"> - <page - name="%installedSoftwarePage" - class="org.eclipse.equinox.p2.ui.InstalledSoftwarePage" - id="10.org.eclipse.equinox.p2.examples.rcp.cloud.InstalledSoftwarePage"> - </page> - <page - name="%installHistoryPage" - class="org.eclipse.equinox.p2.ui.RevertProfilePage" - id="11.org.eclipse.equinox.p2.examples.rcp.cloud.RevertProfilePage"> - </page> - - </extension> - <extension - point="org.eclipse.ui.commands"> - <command - name="%Update.command" - id="org.eclipse.equinox.p2.examples.rcp.cloud.command.update"> - </command> - <command - name="%Install.command" - id="org.eclipse.equinox.p2.examples.rcp.cloud.command.install"> - </command> - </extension> - <extension - point="org.eclipse.ui.handlers"> - <handler - commandId="org.eclipse.equinox.p2.examples.rcp.cloud.command.update" - class="org.eclipse.equinox.p2.examples.rcp.cloud.p2.UpdateHandler"> - </handler> - <handler - commandId="org.eclipse.equinox.p2.examples.rcp.cloud.command.install" - class="org.eclipse.equinox.p2.examples.rcp.cloud.p2.InstallNewSoftwareHandler"> - </handler> - </extension> - <extension - point="org.eclipse.ui.menus"> - <menuContribution - locationURI="menu:tools?after=additions"> - <command - commandId="org.eclipse.equinox.p2.examples.rcp.cloud.command.update" - mnemonic="%Update.command.mnemonic" - id="org.eclipse.equinox.p2.examples.rcp.cloud.menu.update"> - </command> - - </menuContribution> - <menuContribution - locationURI="menu:tools?after=org.eclipse.equinox.p2.examples.rcp.cloud.menu.update"> - <command - commandId="org.eclipse.equinox.p2.examples.rcp.cloud.command.install" - mnemonic="%Install.command.mnemonic" - id="org.eclipse.equinox.p2.examples.rcp.cloud.menu.install"> - </command> - </menuContribution> - </extension> - -</plugin> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/plugin_customization.ini b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/plugin_customization.ini deleted file mode 100644 index 09f694175..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/plugin_customization.ini +++ /dev/null @@ -1,40 +0,0 @@ -# we can configure the update UI by using application preferences to initialize the default UI policy - -# should user be able to see and manipulate repositories in the install wizard -org.eclipse.equinox.p2.examples.rcp.cloud/repositoriesVisible=false - -# force restart after a provisioning operation (see possible values in org.eclipse.equinox.p2.ui.Policy.restartPolicy()) -org.eclipse.equinox.p2.examples.rcp.cloud/restartPolicy=1 - -# show only latest versions when browsing for updates -org.eclipse.equinox.p2.examples.rcp.cloud/showLatestVersionOnly=true - -# software should be grouped by category by default -org.eclipse.equinox.p2.examples.rcp.cloud/groupByCategory=true - -# show only groups (features) in the available list, not every bundle -org.eclipse.equinox.p2.examples.rcp.cloud/showAllBundlesAvailable=false - -# show only the install roots in the installed software list -org.eclipse.equinox.p2.examples.rcp.cloud/showAllBundlesInstalled=true - -# do not drilldown into requirements in the wizards, just show the high level things -org.eclipse.equinox.p2.examples.rcp.cloud/showDrilldownRequirements=false - -# automatic update options are defined in org.eclipse.equinox.p2.sdk.scheduler.PreferenceConstants - -# check for updates on startup -org.eclipse.equinox.p2.ui.sdk.scheduler/enabled=true -org.eclipse.equinox.p2.ui.sdk.scheduler/schedule=on-startup - -# remind the user every 4 hours -org.eclipse.equinox.p2.ui.sdk.scheduler/remindOnSchedule=true -# see AutomaticUpdatesPopup, values can be "30 minutes", "Hour", "4 Hours" -org.eclipse.equinox.p2.ui.sdk.scheduler/remindElapsedTime=4 Hours - -# download updates before notifying the user -org.eclipse.equinox.p2.ui.sdk.scheduler/download=true -org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = false - - - diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/pom.xml b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/pom.xml deleted file mode 100644 index 302c4472d..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/pom.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.eclipse.equinox.p2</groupId> - <artifactId>org.eclipse.equinox.p2.examples</artifactId> - <version>4.19.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - <artifactId>org.eclipse.equinox.p2.examples.rcp.cloud</artifactId> - <version>1.2.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> -</project> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/product_lg.gif b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/product_lg.gif Binary files differdeleted file mode 100644 index bd95e283f..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/product_lg.gif +++ /dev/null diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/splash.bmp b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/splash.bmp Binary files differdeleted file mode 100644 index d7d2e3032..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/splash.bmp +++ /dev/null diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Activator.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Activator.java deleted file mode 100644 index b0556bed1..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Activator.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.eclipse.equinox.p2.examples.rcp.cloud; - -import org.eclipse.equinox.p2.examples.rcp.cloud.p2.CloudPolicy; -import org.eclipse.equinox.p2.ui.Policy; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.equinox.p2.examples.rcp.cloud"; - - // The shared instance - private static Activator plugin; - - ServiceRegistration<Policy> policyRegistration; - CloudPolicy policy; - IPropertyChangeListener preferenceListener; - - /** - * The constructor - */ - public Activator() { - } - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - // XXX register the p2 UI policy - registerP2Policy(context); - getPreferenceStore().addPropertyChangeListener(getPreferenceListener()); - } - - private IPropertyChangeListener getPreferenceListener() { - if (preferenceListener == null) { - preferenceListener = event -> policy.updateForPreferences(); - } - return preferenceListener; - } - - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - // XXX unregister the UI policy - policyRegistration.unregister(); - policyRegistration = null; - getPreferenceStore().removePropertyChangeListener(preferenceListener); - preferenceListener = null; - super.stop(context); - - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given plug-in relative - * path - * - * @param path the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) { - return imageDescriptorFromPlugin(PLUGIN_ID, path); - } - - private void registerP2Policy(BundleContext context) { - policy = new CloudPolicy(); - policy.updateForPreferences(); - policyRegistration = context.registerService(Policy.class, policy, null); - } -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Application.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Application.java deleted file mode 100644 index feb9901ae..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Application.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.eclipse.equinox.p2.examples.rcp.cloud; - -import org.eclipse.equinox.app.IApplication; -import org.eclipse.equinox.app.IApplicationContext; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PlatformUI; - -/** - * This class controls all aspects of the application's execution - */ -public class Application implements IApplication { - - @Override - public Object start(IApplicationContext context) { - Display display = PlatformUI.createDisplay(); - try { - int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); - if (returnCode == PlatformUI.RETURN_RESTART) { - return IApplication.EXIT_RESTART; - } - return IApplication.EXIT_OK; - } finally { - display.dispose(); - } - } - - @Override - public void stop() { - final IWorkbench workbench = PlatformUI.getWorkbench(); - if (workbench == null) - return; - final Display display = workbench.getDisplay(); - display.syncExec(() -> { - if (!display.isDisposed()) - workbench.close(); - }); - } -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationActionBarAdvisor.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationActionBarAdvisor.java deleted file mode 100644 index db33963f5..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationActionBarAdvisor.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.eclipse.equinox.p2.examples.rcp.cloud; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.GroupMarker; -import org.eclipse.jface.action.ICoolBarManager; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.action.ToolBarContributionItem; -import org.eclipse.jface.action.ToolBarManager; -import org.eclipse.swt.SWT; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.actions.ActionFactory; -import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; -import org.eclipse.ui.application.ActionBarAdvisor; -import org.eclipse.ui.application.IActionBarConfigurer; - -/** - * An action bar advisor is responsible for creating, adding, and disposing of - * the actions added to a workbench window. Each window will be populated with - * new actions. - */ -public class ApplicationActionBarAdvisor extends ActionBarAdvisor { - - // Actions - important to allocate these only in makeActions, and then use them - // in the fill methods. This ensures that the actions aren't recreated - // when fillActionBars is called with FILL_PROXY. - private IWorkbenchAction exitAction; - private IWorkbenchAction aboutAction; - private IWorkbenchAction newWindowAction; - // XXX we want to show preferences - private IWorkbenchAction preferencesAction; - private OpenViewAction openViewAction; - private Action messagePopupAction; - - public static final String M_TOOLS = "tools"; - - public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { - super(configurer); - } - - @Override - protected void makeActions(final IWorkbenchWindow window) { - // Creates the actions and registers them. - // Registering is needed to ensure that key bindings work. - // The corresponding commands keybindings are defined in the plugin.xml file. - // Registering also provides automatic disposal of the actions when - // the window is closed. - - exitAction = ActionFactory.QUIT.create(window); - register(exitAction); - - aboutAction = ActionFactory.ABOUT.create(window); - register(aboutAction); - - // XXX we want to show auto update preferences - preferencesAction = ActionFactory.PREFERENCES.create(window); - register(preferencesAction); - - newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window); - register(newWindowAction); - - openViewAction = new OpenViewAction(window, "Open Another Message View", View.ID); - register(openViewAction); - - messagePopupAction = new MessagePopupAction("Open Message", window); - register(messagePopupAction); - } - - @Override - protected void fillMenuBar(IMenuManager menuBar) { - MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE); - // XXX add a tools menu - MenuManager toolsMenu = new MenuManager("&Tools", M_TOOLS); - MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP); - - menuBar.add(fileMenu); - menuBar.add(toolsMenu); - // Add a group marker indicating where action set menus will appear. - menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - menuBar.add(helpMenu); - - // File - fileMenu.add(newWindowAction); - fileMenu.add(new Separator()); - fileMenu.add(messagePopupAction); - fileMenu.add(openViewAction); - fileMenu.add(new Separator()); - fileMenu.add(exitAction); - - // XXX add preferences to tools - toolsMenu.add(preferencesAction); - // XXX add a group for new other tools contributions - toolsMenu.add(new Separator()); - toolsMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - - // Help - helpMenu.add(aboutAction); - } - - @Override - protected void fillCoolBar(ICoolBarManager coolBar) { - IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT); - coolBar.add(new ToolBarContributionItem(toolbar, "main")); - toolbar.add(openViewAction); - toolbar.add(messagePopupAction); - } -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationWorkbenchAdvisor.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationWorkbenchAdvisor.java deleted file mode 100644 index 893d9979e..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationWorkbenchAdvisor.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.eclipse.equinox.p2.examples.rcp.cloud; - -import org.eclipse.ui.application.IWorkbenchWindowConfigurer; -import org.eclipse.ui.application.WorkbenchAdvisor; -import org.eclipse.ui.application.WorkbenchWindowAdvisor; - -/** - * This workbench advisor creates the window advisor, and specifies the - * perspective id for the initial window. - */ -public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { - - @Override - public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { - return new ApplicationWorkbenchWindowAdvisor(configurer); - } - - @Override - public String getInitialWindowPerspectiveId() { - return Perspective.ID; - } - -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationWorkbenchWindowAdvisor.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationWorkbenchWindowAdvisor.java deleted file mode 100644 index fc30c6228..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ApplicationWorkbenchWindowAdvisor.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.eclipse.equinox.p2.examples.rcp.cloud; - -import org.eclipse.swt.graphics.Point; -import org.eclipse.ui.application.ActionBarAdvisor; -import org.eclipse.ui.application.IActionBarConfigurer; -import org.eclipse.ui.application.IWorkbenchWindowConfigurer; -import org.eclipse.ui.application.WorkbenchWindowAdvisor; - -public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { - - public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { - super(configurer); - } - - @Override - public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) { - return new ApplicationActionBarAdvisor(configurer); - } - - @Override - public void preWindowOpen() { - IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); - configurer.setInitialSize(new Point(600, 400)); - configurer.setShowCoolBar(true); - // XXX Set the status line and progress indicator so that update - // information can be shown there - configurer.setShowStatusLine(true); - configurer.setShowProgressIndicator(true); - - } - -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ICommandIds.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ICommandIds.java deleted file mode 100644 index 6bf884ccb..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/ICommandIds.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.eclipse.equinox.p2.examples.rcp.cloud; - -/** - * Interface defining the application's command IDs. - * Key bindings can be defined for specific commands. - * To associate an action with a command, use IAction.setActionDefinitionId(commandId). - * - * @see org.eclipse.jface.action.IAction#setActionDefinitionId(String) - */ -public interface ICommandIds { - - public static final String CMD_OPEN = "org.eclipse.equinox.p2.examples.rcp.cloud.open"; - public static final String CMD_OPEN_MESSAGE = "org.eclipse.equinox.p2.examples.rcp.cloud.openMessage"; - -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/MessagePopupAction.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/MessagePopupAction.java deleted file mode 100644 index 347a11660..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/MessagePopupAction.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.equinox.p2.examples.rcp.cloud; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.ui.IWorkbenchWindow; - -public class MessagePopupAction extends Action { - - private final IWorkbenchWindow window; - - MessagePopupAction(String text, IWorkbenchWindow window) { - super(text); - this.window = window; - // The id is used to refer to the action in a menu or toolbar - setId(ICommandIds.CMD_OPEN_MESSAGE); - // Associate the action with a pre-defined command, to allow key bindings. - setActionDefinitionId(ICommandIds.CMD_OPEN_MESSAGE); - setImageDescriptor( - org.eclipse.equinox.p2.examples.rcp.cloud.Activator.getImageDescriptor("/icons/sample3.gif")); - } - - @Override - public void run() { - MessageDialog.openInformation(window.getShell(), "Open", "Open Message Dialog!"); - } -}
\ No newline at end of file diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/NavigationView.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/NavigationView.java deleted file mode 100644 index bd5538cca..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/NavigationView.java +++ /dev/null @@ -1,170 +0,0 @@ -package org.eclipse.equinox.p2.examples.rcp.cloud; - -import java.util.ArrayList; - -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.ViewPart; - -public class NavigationView extends ViewPart { - public static final String ID = "org.eclipse.equinox.p2.examples.rcp.cloud.navigationView"; - private TreeViewer viewer; - - class TreeObject { - private String name; - private TreeParent parent; - - public TreeObject(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setParent(TreeParent parent) { - this.parent = parent; - } - - public TreeParent getParent() { - return parent; - } - - @Override - public String toString() { - return getName(); - } - } - - class TreeParent extends TreeObject { - private ArrayList<TreeObject> children; - - public TreeParent(String name) { - super(name); - children = new ArrayList<>(); - } - - public void addChild(TreeObject child) { - children.add(child); - child.setParent(this); - } - - public void removeChild(TreeObject child) { - children.remove(child); - child.setParent(null); - } - - public TreeObject[] getChildren() { - return children.toArray(new TreeObject[children.size()]); - } - - public boolean hasChildren() { - return children.size() > 0; - } - } - - class ViewContentProvider implements IStructuredContentProvider, ITreeContentProvider { - - @Override - public void inputChanged(Viewer v, Object oldInput, Object newInput) { - } - - @Override - public void dispose() { - } - - @Override - public Object[] getElements(Object parent) { - return getChildren(parent); - } - - @Override - public Object getParent(Object child) { - if (child instanceof TreeObject) { - return ((TreeObject) child).getParent(); - } - return null; - } - - @Override - public Object[] getChildren(Object parent) { - if (parent instanceof TreeParent) { - return ((TreeParent) parent).getChildren(); - } - return new Object[0]; - } - - @Override - public boolean hasChildren(Object parent) { - if (parent instanceof TreeParent) - return ((TreeParent) parent).hasChildren(); - return false; - } - } - - class ViewLabelProvider extends LabelProvider { - - @Override - public String getText(Object obj) { - return obj.toString(); - } - - @Override - public Image getImage(Object obj) { - String imageKey = ISharedImages.IMG_OBJ_ELEMENT; - if (obj instanceof TreeParent) - imageKey = ISharedImages.IMG_OBJ_FOLDER; - return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey); - } - } - - /** - * We will set up a dummy model to initialize tree heararchy. In real code, you - * will connect to a real model and expose its hierarchy. - */ - private TreeObject createDummyModel() { - TreeObject to1 = new TreeObject("Inbox"); - TreeObject to2 = new TreeObject("Drafts"); - TreeObject to3 = new TreeObject("Sent"); - TreeParent p1 = new TreeParent("me@this.com"); - p1.addChild(to1); - p1.addChild(to2); - p1.addChild(to3); - - TreeObject to4 = new TreeObject("Inbox"); - TreeParent p2 = new TreeParent("other@aol.com"); - p2.addChild(to4); - - TreeParent root = new TreeParent(""); - root.addChild(p1); - root.addChild(p2); - return root; - } - - /** - * This is a callback that will allow us to create the viewer and initialize it. - */ - @Override - public void createPartControl(Composite parent) { - viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); - viewer.setContentProvider(new ViewContentProvider()); - viewer.setLabelProvider(new ViewLabelProvider()); - viewer.setInput(createDummyModel()); - } - - /** - * Passing the focus request to the viewer's control. - */ - @Override - public void setFocus() { - viewer.getControl().setFocus(); - } -}
\ No newline at end of file diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/OpenViewAction.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/OpenViewAction.java deleted file mode 100644 index 3c732aebd..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/OpenViewAction.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.eclipse.equinox.p2.examples.rcp.cloud; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; - -public class OpenViewAction extends Action { - - private final IWorkbenchWindow window; - private int instanceNum = 0; - private final String viewId; - - public OpenViewAction(IWorkbenchWindow window, String label, String viewId) { - this.window = window; - this.viewId = viewId; - setText(label); - // The id is used to refer to the action in a menu or toolbar - setId(ICommandIds.CMD_OPEN); - // Associate the action with a pre-defined command, to allow key bindings. - setActionDefinitionId(ICommandIds.CMD_OPEN); - setImageDescriptor( - org.eclipse.equinox.p2.examples.rcp.cloud.Activator.getImageDescriptor("/icons/sample2.gif")); - } - - @Override - public void run() { - if (window != null) { - try { - window.getActivePage().showView(viewId, Integer.toString(instanceNum++), IWorkbenchPage.VIEW_ACTIVATE); - } catch (PartInitException e) { - MessageDialog.openError(window.getShell(), "Error", "Error opening view:" + e.getMessage()); - } - } - } -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Perspective.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Perspective.java deleted file mode 100644 index caaf4ff75..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/Perspective.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.equinox.p2.examples.rcp.cloud; - -import org.eclipse.ui.IFolderLayout; -import org.eclipse.ui.IPageLayout; -import org.eclipse.ui.IPerspectiveFactory; - -public class Perspective implements IPerspectiveFactory { - - /** - * The ID of the perspective as specified in the extension. - */ - public static final String ID = "org.eclipse.equinox.p2.examples.rcp.cloud.perspective"; - - @Override - public void createInitialLayout(IPageLayout layout) { - String editorArea = layout.getEditorArea(); - layout.setEditorAreaVisible(false); - - layout.addStandaloneView(NavigationView.ID, false, IPageLayout.LEFT, 0.25f, editorArea); - IFolderLayout folder = layout.createFolder("messages", IPageLayout.TOP, 0.5f, editorArea); - folder.addPlaceholder(View.ID + ":*"); - folder.addView(View.ID); - - layout.getViewLayout(NavigationView.ID).setCloseable(false); - } -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/View.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/View.java deleted file mode 100644 index ce90d6440..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/View.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.eclipse.equinox.p2.examples.rcp.cloud; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.part.ViewPart; - -public class View extends ViewPart { - - public static final String ID = "org.eclipse.equinox.p2.examples.rcp.cloud.view"; - - @Override - public void createPartControl(Composite parent) { - Composite top = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - top.setLayout(layout); - // top banner - Composite banner = new Composite(top, SWT.NONE); - banner.setLayoutData( - new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_BEGINNING, true, false)); - layout = new GridLayout(); - layout.marginHeight = 5; - layout.marginWidth = 10; - layout.numColumns = 2; - banner.setLayout(layout); - - // setup bold font - Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); - - Label l = new Label(banner, SWT.WRAP); - l.setText("Subject:"); - l.setFont(boldFont); - l = new Label(banner, SWT.WRAP); - l.setText("This is a message about the cool Eclipse RCP!"); - - l = new Label(banner, SWT.WRAP); - l.setText("From:"); - l.setFont(boldFont); - - final Link link = new Link(banner, SWT.NONE); - link.setText("<a>nicole@mail.org</a>"); - link.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MessageDialog.openInformation(getSite().getShell(), "Not Implemented", - "Imagine the address book or a new message being created now."); - } - }); - - l = new Label(banner, SWT.WRAP); - l.setText("Date:"); - l.setFont(boldFont); - l = new Label(banner, SWT.WRAP); - l.setText("10:34 am"); - // message contents - Text text = new Text(top, SWT.MULTI | SWT.WRAP); - text.setText( - "This RCP Application was generated from the PDE Plug-in Project wizard. This sample shows how to:\n" - + "- add a top-level menu and toolbar with actions\n" + "- add keybindings to actions\n" - + "- create views that can't be closed and\n" + " multiple instances of the same view\n" - + "- perspectives with placeholders for new views\n" + "- use the default about dialog\n" - + "- create a product definition\n"); - text.setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - @Override - public void setFocus() { - } -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/CloudPolicy.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/CloudPolicy.java deleted file mode 100644 index ab7a1d5c7..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/CloudPolicy.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.examples.rcp.cloud.p2; - -import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery; -import org.eclipse.equinox.p2.examples.rcp.cloud.Activator; -import org.eclipse.equinox.p2.query.QueryUtil; -import org.eclipse.equinox.p2.ui.Policy; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.swt.graphics.Point; - -/** - * CloudPolicy defines the RCP Cloud Example policies for the p2 UI. The policy - * is registered as an OSGi service when the example bundle starts. - * - * @since 3.5 - */ -public class CloudPolicy extends Policy { - - public void updateForPreferences() { - IPreferenceStore prefs = Activator.getDefault().getPreferenceStore(); - setRepositoriesVisible(prefs - .getBoolean(PreferenceConstants.REPOSITORIES_VISIBLE)); - setRestartPolicy(prefs.getInt(PreferenceConstants.RESTART_POLICY)); - setShowLatestVersionsOnly(prefs - .getBoolean(PreferenceConstants.SHOW_LATEST_VERSION_ONLY)); - setGroupByCategory(prefs - .getBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY)); - setShowDrilldownRequirements(prefs - .getBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS)); - setFilterOnEnv(prefs.getBoolean(PreferenceConstants.FILTER_ON_ENV)); - setUpdateWizardStyle(prefs.getInt(PreferenceConstants.UPDATE_WIZARD_STYLE)); - int preferredWidth = prefs.getInt(PreferenceConstants.UPDATE_DETAILS_WIDTH); - int preferredHeight = prefs.getInt(PreferenceConstants.UPDATE_DETAILS_HEIGHT); - setUpdateDetailsPreferredSize(new Point(preferredWidth, preferredHeight)); - - if (prefs.getBoolean(PreferenceConstants.AVAILABLE_SHOW_ALL_BUNDLES)) - setVisibleAvailableIUQuery(QueryUtil.ALL_UNITS); - else - setVisibleAvailableIUQuery(QueryUtil.createIUGroupQuery()); - if (prefs.getBoolean(PreferenceConstants.INSTALLED_SHOW_ALL_BUNDLES)) - setVisibleAvailableIUQuery(QueryUtil.ALL_UNITS); - else - setVisibleAvailableIUQuery(new UserVisibleRootQuery()); - - } -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/InstallNewSoftwareHandler.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/InstallNewSoftwareHandler.java deleted file mode 100644 index a4c79edf9..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/InstallNewSoftwareHandler.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.examples.rcp.cloud.p2; - -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; - -/** - * InstallNewSoftwareHandler invokes the install wizard - * - * @since 3.5 - */ -public class InstallNewSoftwareHandler extends PreloadingRepositoryHandler { - - /** - * The constructor. - */ - public InstallNewSoftwareHandler() { - super(); - } - - @Override - protected void doExecute(LoadMetadataRepositoryJob job) { - getProvisioningUI().openInstallWizard(null, null, job); - } - - @Override - protected boolean waitForPreload() { - // If the user cannot see repositories, then we may as well wait - // for existing repos to load so that content is available. - // If the user can manipulate the repositories, then we don't wait, - // because we don't know which ones they want to work with. - return !getProvisioningUI().getPolicy().getRepositoriesVisible(); - } - - @Override - protected void setLoadJobProperties(Job loadJob) { - super.setLoadJobProperties(loadJob); - // If we are doing a background load, we do not wish to authenticate, as the - // user is unaware that loading was needed - if (!waitForPreload()) { - loadJob.setProperty(LoadMetadataRepositoryJob.SUPPRESS_AUTHENTICATION_JOB_MARKER, Boolean.toString(true)); - loadJob.setProperty(LoadMetadataRepositoryJob.SUPPRESS_REPOSITORY_EVENTS, Boolean.toString(true)); - } - } -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceConstants.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceConstants.java deleted file mode 100644 index 25ca9f707..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceConstants.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.examples.rcp.cloud.p2; - -public class PreferenceConstants { - public static final String RESTART_POLICY = "restartPolicy"; //$NON-NLS-1$ - public static final String SHOW_LATEST_VERSION_ONLY = "showLatestVersionOnly"; //$NON-NLS-1$ - public static final String AVAILABLE_GROUP_BY_CATEGORY = "groupByCategory"; //$NON-NLS-1$ - public static final String AVAILABLE_SHOW_ALL_BUNDLES = "showAllBundlesAvailable"; //$NON-NLS-1$ - public static final String INSTALLED_SHOW_ALL_BUNDLES = "showAllBundlesInstalled"; //$NON-NLS-1$ - public static final String REPOSITORIES_VISIBLE = "repositoriesVisible"; //$NON-NLS-1$ - public static final String SHOW_DRILLDOWN_REQUIREMENTS = "showDrilldownRequirements"; //$NON-NLS-1$ - public static final String UPDATE_WIZARD_STYLE = "updateWizardStyle"; //$NON-NLS-1$ - public static final String UPDATE_DETAILS_WIDTH = "updateDetailsWidth"; //$NON-NLS-1$ - public static final String UPDATE_DETAILS_HEIGHT = "updateDetailsHeight"; //$NON-NLS-1$ - public static final String FILTER_ON_ENV = "filterOnEnv"; //$NON-NLS-1$ -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceInitializer.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceInitializer.java deleted file mode 100644 index 290c765d9..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceInitializer.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2019 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.examples.rcp.cloud.p2; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.core.runtime.preferences.DefaultScope; -import org.eclipse.equinox.p2.examples.rcp.cloud.Activator; -import org.eclipse.equinox.p2.ui.Policy; -import org.eclipse.swt.SWT; -import org.osgi.service.prefs.Preferences; - -/** - * @since 3.6 - */ -public class PreferenceInitializer extends AbstractPreferenceInitializer { - - @Override - public void initializeDefaultPreferences() { - Preferences node = DefaultScope.INSTANCE.getNode(Activator.PLUGIN_ID); - // default values - node.putBoolean(PreferenceConstants.REPOSITORIES_VISIBLE, false); - node.putBoolean(PreferenceConstants.SHOW_LATEST_VERSION_ONLY, true); - node.putBoolean(PreferenceConstants.AVAILABLE_SHOW_ALL_BUNDLES, false); - node.putBoolean(PreferenceConstants.INSTALLED_SHOW_ALL_BUNDLES, false); - node.putBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY, true); - node.putBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS, false); - node.putInt(PreferenceConstants.RESTART_POLICY, Policy.RESTART_POLICY_PROMPT_RESTART_OR_APPLY); - node.putInt(PreferenceConstants.UPDATE_WIZARD_STYLE, Policy.UPDATE_STYLE_MULTIPLE_IUS); - node.putBoolean(PreferenceConstants.FILTER_ON_ENV, false); - node.putInt(PreferenceConstants.UPDATE_DETAILS_HEIGHT, SWT.DEFAULT); - node.putInt(PreferenceConstants.UPDATE_DETAILS_WIDTH, SWT.DEFAULT); - } -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreloadingRepositoryHandler.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreloadingRepositoryHandler.java deleted file mode 100644 index 5a039b53a..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreloadingRepositoryHandler.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.examples.rcp.cloud.p2; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.runtime.jobs.IJobChangeEvent; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.core.runtime.jobs.JobChangeAdapter; -import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; -import org.eclipse.equinox.p2.ui.ProvisioningUI; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; - -/** - * PreloadingRepositoryHandler provides background loading of repositories - * before executing the provisioning handler. - * - * @since 3.5 - */ -abstract class PreloadingRepositoryHandler extends AbstractHandler { - - /** - * The constructor. - */ - public PreloadingRepositoryHandler() { - // constructor - } - - /** - * Execute the command. - */ - @Override - public Object execute(ExecutionEvent event) { - doExecuteAndLoad(); - return null; - } - - void doExecuteAndLoad() { - if (preloadRepositories()) { - // cancel any load that is already running - Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY); - final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI()); - setLoadJobProperties(loadJob); - if (waitForPreload()) { - loadJob.addJobChangeListener(new JobChangeAdapter() { - @Override - public void done(IJobChangeEvent event) { - if (PlatformUI.isWorkbenchRunning()) - if (event.getResult().isOK()) { - PlatformUI.getWorkbench().getDisplay().asyncExec(() -> doExecute(loadJob)); - } - } - }); - loadJob.setUser(true); - loadJob.schedule(); - - } else { - loadJob.setSystem(true); - loadJob.setUser(false); - loadJob.schedule(); - doExecute(null); - } - } else { - doExecute(null); - } - } - - protected abstract void doExecute(LoadMetadataRepositoryJob job); - - protected boolean preloadRepositories() { - return true; - } - - protected boolean waitForPreload() { - return true; - } - - protected void setLoadJobProperties(Job loadJob) { - loadJob.setProperty(LoadMetadataRepositoryJob.ACCUMULATE_LOAD_ERRORS, Boolean.toString(true)); - } - - protected ProvisioningUI getProvisioningUI() { - return ProvisioningUI.getDefaultUI(); - } - - /** - * Return a shell appropriate for parenting dialogs of this handler. - * - * @return a Shell - */ - protected Shell getShell() { - return PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(); - } -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/UpdateHandler.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/UpdateHandler.java deleted file mode 100644 index 31bed0561..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/UpdateHandler.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.examples.rcp.cloud.p2; - -import org.eclipse.equinox.internal.p2.ui.dialogs.UpdateSingleIUWizard; -import org.eclipse.equinox.p2.operations.RepositoryTracker; -import org.eclipse.equinox.p2.operations.UpdateOperation; -import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; -import org.eclipse.jface.wizard.WizardDialog; - -/** - * UpdateHandler invokes the check for updates UI - * - * @since 3.4 - */ -public class UpdateHandler extends PreloadingRepositoryHandler { - - boolean hasNoRepos = false; - - @Override - protected void doExecute(LoadMetadataRepositoryJob job) { - if (hasNoRepos) { - return; - } - UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null); - // check for updates - operation.resolveModal(null); - if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) { - if (UpdateSingleIUWizard.validFor(operation)) { - // Special case for only updating a single root - UpdateSingleIUWizard wizard = new UpdateSingleIUWizard(getProvisioningUI(), operation); - WizardDialog dialog = new WizardDialog(getShell(), wizard); - dialog.create(); - dialog.open(); - } else { - // Open the normal version of the update wizard - getProvisioningUI().openUpdateWizard(false, operation, job); - } - } - } - - @Override - protected boolean preloadRepositories() { - hasNoRepos = false; - RepositoryTracker repoMan = getProvisioningUI().getRepositoryTracker(); - if (repoMan.getKnownRepositories(getProvisioningUI().getSession()).length == 0) { - hasNoRepos = true; - return false; - } - return super.preloadRepositories(); - } -} diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/updatenotification.png b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/updatenotification.png Binary files differdeleted file mode 100644 index d3c6f871f..000000000 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/updatenotification.png +++ /dev/null diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/META-INF/MANIFEST.MF b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/META-INF/MANIFEST.MF index 2e13bd54c..9dffe88be 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/META-INF/MANIFEST.MF +++ b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/META-INF/MANIFEST.MF @@ -26,8 +26,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.equinox.p2.discovery;bundle-version="1.0.0", org.eclipse.equinox.p2.discovery.compatibility;bundle-version="1.0.0", org.eclipse.equinox.p2.ui.discovery;bundle-version="1.0.0", - org.apache.httpcomponents.httpclient;bundle-version="4.2.0", - org.eclipse.ecf.provider.filetransfer.httpclient45;bundle-version="1.0.0" + org.apache.httpcomponents.client5.httpclient5;bundle-version="5.0.2", + org.eclipse.ecf.provider.filetransfer.httpclient5;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.eclipse.equinox.p2.examples.rcp.cloud diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/cloud.product b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/cloud.product index 0f39834a8..b7668e6ae 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/cloud.product +++ b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/cloud.product @@ -46,8 +46,8 @@ <plugin id="org.apache.commons.jxpath"/> <plugin id="org.apache.commons.logging"/> <plugin id="org.apache.felix.scr"/> - <plugin id="org.apache.httpcomponents.httpclient"/> - <plugin id="org.apache.httpcomponents.httpcore"/> + <plugin id="org.apache.httpcomponents.client5.httpclient5"/> + <plugin id="org.apache.httpcomponents.core5.httpcore5"/> <plugin id="org.apache.xmlgraphics"/> <plugin id="org.eclipse.core.commands"/> <plugin id="org.eclipse.core.contenttype"/> @@ -85,7 +85,7 @@ <plugin id="org.eclipse.ecf.provider.filetransfer"/> <plugin id="org.eclipse.ecf.provider.filetransfer.httpclient"/> <plugin id="org.eclipse.ecf.provider.filetransfer.httpclient.ssl" fragment="true"/> - <plugin id="org.eclipse.ecf.provider.filetransfer.httpclient45"/> + <plugin id="org.eclipse.ecf.provider.filetransfer.httpclient5"/> <plugin id="org.eclipse.ecf.provider.filetransfer.ssl" fragment="true"/> <plugin id="org.eclipse.ecf.ssl" fragment="true"/> <plugin id="org.eclipse.emf.common"/> @@ -126,7 +126,7 @@ <plugin id="org.eclipse.equinox.preferences"/> <plugin id="org.eclipse.equinox.registry"/> <plugin id="org.eclipse.equinox.security"/> - <plugin id="org.eclipse.equinox.security.linux.x86_64" fragment="true"/> + <plugin id="org.eclipse.equinox.security.linux" fragment="true"/> <plugin id="org.eclipse.equinox.security.ui"/> <plugin id="org.eclipse.equinox.simpleconfigurator"/> <plugin id="org.eclipse.equinox.simpleconfigurator.manipulator"/> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/plugin.xml b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/plugin.xml index bff2bb0e7..ee5676d55 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/plugin.xml +++ b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/plugin.xml @@ -178,7 +178,7 @@ <overview screenshot="icons/mail-screenshot.png" summary="In computing, the Post Office Protocol (POP) is an application-layer Internet standard protocol used by local e-mail clients to retrieve e-mail from a remote server over a TCP/IP connection. POP and IMAP (Internet Message Access Protocol) are the two most prevalent Internet standard protocols for e-mail retrieval. Virtually all modern e-mail clients and servers support both. The POP protocol has been developed through several versions, with version 3 (POP3) being the current standard." - url="http://en.wikipedia.org/wiki/Post_Office_Protocol"> + url="https://en.wikipedia.org/wiki/Post_Office_Protocol"> </overview> <icon image32="icons/mail.png"> @@ -197,11 +197,11 @@ license="EPL" name="Eclipse Marketplace Client" provider="Eclipse Packaging Project" - siteUrl="http://download.eclipse.org/releases/staging"> + siteUrl="https://download.eclipse.org/releases/staging"> <overview screenshot="icons/mpc-screenshot.png" summary="Marketplace Client is a rich client solution for installing solutions listed on Eclipse Marketplace directly from an Eclipse Installation.

The Eclipse community has hundreds, if not thousands, of third-party plugins that users can add to their Eclipse installation. Unfortunately, there is not easy way to discover and install these solutions from within Eclipse.

The Eclipse Foundation has recently launched a new website, called Eclipse Marketplace, that provides a listing of Eclipse-based solutions. The listings allow each solution provider to specify a P2 repository for their solution. Eclipse users now have a central catalog to find Eclipse solutions but the install process is still not tightly integrated with the Eclipse workspace.

MPC provides the tight install integration between the Eclipse workspace and Eclipse Marketplace, plus other third party solution listings. MPC is included in many of the EPP packages." - url="http://eclipse.org/mpc/"></overview> + url="https://eclipse.org/mpc/"></overview> <icon image32="icons/mpc.png"> </icon> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/pom.xml b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/pom.xml index 80379f55e..a833132fc 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.discovery/pom.xml +++ b/examples/org.eclipse.equinox.p2.examples.rcp.discovery/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>org.eclipse.equinox.p2.examples</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/META-INF/MANIFEST.MF b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/META-INF/MANIFEST.MF index 5207540c5..724d0234c 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/META-INF/MANIFEST.MF +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/META-INF/MANIFEST.MF @@ -13,7 +13,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ecf.filetransfer;bundle-version="3.0.0", org.eclipse.ecf.identity;bundle-version="3.0.0", org.eclipse.ecf.provider.filetransfer;bundle-version="3.0.0", - org.apache.httpcomponents.httpclient;bundle-version="4.2.0", - org.eclipse.ecf.provider.filetransfer.httpclient45;bundle-version="1.0.0" + org.apache.httpcomponents.client5.httpclient5;bundle-version="5.0.2", + org.eclipse.ecf.provider.filetransfer.httpclient5;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.eclipse.equinox.p2.examples.rcp.prestartupdate diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/pom.xml b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/pom.xml index f71d44e7c..9f13161d5 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/pom.xml +++ b/examples/org.eclipse.equinox.p2.examples.rcp.prestartupdate/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>org.eclipse.equinox.p2.examples</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>org.eclipse.equinox.p2.examples.rcp.prestartupdate</artifactId> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/META-INF/MANIFEST.MF b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/META-INF/MANIFEST.MF index bb82130a5..e2b034a24 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/META-INF/MANIFEST.MF +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/META-INF/MANIFEST.MF @@ -22,8 +22,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.ecf.filetransfer;bundle-version="3.0.0", org.eclipse.ecf.identity;bundle-version="3.0.0", org.eclipse.ecf.provider.filetransfer;bundle-version="3.0.0", - org.apache.httpcomponents.httpclient;bundle-version="4.2.0", - org.eclipse.ecf.provider.filetransfer.httpclient45;bundle-version="1.0.0" + org.apache.httpcomponents.client5.httpclient5;bundle-version="5.0.2", + org.eclipse.ecf.provider.filetransfer.httpclient5;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-11 Service-Component: OSGI-INF/policy_component.xml diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/pom.xml b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/pom.xml index 2c41c0703..7bd7d3088 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/pom.xml +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>org.eclipse.equinox.p2.examples</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility</artifactId> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/sdkbundlevisibility.product b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/sdkbundlevisibility.product index 730d77684..a1e4fc5dc 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/sdkbundlevisibility.product +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/sdkbundlevisibility.product @@ -46,8 +46,8 @@ <plugin id="org.apache.commons.jxpath"/> <plugin id="org.apache.commons.logging"/> <plugin id="org.apache.felix.scr"/> - <plugin id="org.apache.httpcomponents.httpclient"/> - <plugin id="org.apache.httpcomponents.httpcore"/> + <plugin id="org.apache.httpcomponents.client5.httpclient5"/> + <plugin id="org.apache.httpcomponents.core5.httpcore5"/> <plugin id="org.apache.xmlgraphics"/> <plugin id="org.eclipse.core.commands"/> <plugin id="org.eclipse.core.contenttype"/> @@ -83,7 +83,7 @@ <plugin id="org.eclipse.ecf.filetransfer"/> <plugin id="org.eclipse.ecf.identity"/> <plugin id="org.eclipse.ecf.provider.filetransfer"/> - <plugin id="org.eclipse.ecf.provider.filetransfer.httpclient45"/> + <plugin id="org.eclipse.ecf.provider.filetransfer.httpclient5"/> <plugin id="org.eclipse.ecf.provider.filetransfer.ssl" fragment="true"/> <plugin id="org.eclipse.ecf.ssl" fragment="true"/> <plugin id="org.eclipse.emf.common"/> @@ -119,7 +119,7 @@ <plugin id="org.eclipse.equinox.preferences"/> <plugin id="org.eclipse.equinox.registry"/> <plugin id="org.eclipse.equinox.security"/> - <plugin id="org.eclipse.equinox.security.linux.x86_64" fragment="true"/> + <plugin id="org.eclipse.equinox.security.linux" fragment="true"/> <plugin id="org.eclipse.equinox.security.macosx" fragment="true"/> <plugin id="org.eclipse.equinox.security.ui"/> <plugin id="org.eclipse.equinox.simpleconfigurator"/> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/META-INF/MANIFEST.MF b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/META-INF/MANIFEST.MF index 0ef9f7e8b..297dee540 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/META-INF/MANIFEST.MF +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/META-INF/MANIFEST.MF @@ -19,8 +19,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ecf.filetransfer;bundle-version="3.0.0", org.eclipse.ecf.identity;bundle-version="3.0.0", org.eclipse.ecf.provider.filetransfer;bundle-version="3.0.0", - org.apache.httpcomponents.httpclient;bundle-version="4.2.0", - org.eclipse.ecf.provider.filetransfer.httpclient45;bundle-version="1.0.0", + org.apache.httpcomponents.client5.httpclient5;bundle-version="5.0.2", + org.eclipse.ecf.provider.filetransfer.httpclient5;bundle-version="1.0.0", org.eclipse.equinox.p2.ui.sdk;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/pom.xml b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/pom.xml index 1dcec2b8e..024bb1e41 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/pom.xml +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdknoautoupdates/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>org.eclipse.equinox.p2.examples</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/META-INF/MANIFEST.MF b/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/META-INF/MANIFEST.MF index 8c0d5cd5b..417b58720 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/META-INF/MANIFEST.MF +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/META-INF/MANIFEST.MF @@ -21,8 +21,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ecf.provider.filetransfer;bundle-version="3.0.0", org.eclipse.equinox.p2.ui.sdk;bundle-version="1.0.0", org.eclipse.equinox.p2.ui.sdk.scheduler;bundle-version="1.0.0", - org.apache.httpcomponents.httpclient;bundle-version="4.2.0", - org.eclipse.ecf.provider.filetransfer.httpclient45;bundle-version="1.0.0" + org.apache.httpcomponents.client5.httpclient5;bundle-version="5.0.2", + org.eclipse.ecf.provider.filetransfer.httpclient5;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.eclipse.equinox.p2.examples.rcp.sdkui diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/pom.xml b/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/pom.xml index cf92102d1..409e36705 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/pom.xml +++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkui/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>org.eclipse.equinox.p2.examples</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> diff --git a/examples/pom.xml b/examples/pom.xml index 1e4ccdd45..10e519663 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>org.eclipse.equinox.p2.examples</artifactId> @@ -15,7 +15,6 @@ </properties> <modules> - <module>org.eclipse.equinox.p2.examples.rcp.cloud</module> <module>org.eclipse.equinox.p2.examples.rcp.discovery</module> <module>org.eclipse.equinox.p2.examples.rcp.prestartupdate</module> <module>org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility</module> diff --git a/features/org.eclipse.equinox.p2.core.feature/feature.xml b/features/org.eclipse.equinox.p2.core.feature/feature.xml index 8c57dd080..4b7c6ff2b 100644 --- a/features/org.eclipse.equinox.p2.core.feature/feature.xml +++ b/features/org.eclipse.equinox.p2.core.feature/feature.xml @@ -2,7 +2,7 @@ <feature id="org.eclipse.equinox.p2.core.feature" label="%featureName" - version="1.6.900.qualifier" + version="1.6.1400.qualifier" provider-name="%providerName" license-feature="org.eclipse.license" license-feature-version="0.0.0"> @@ -23,7 +23,7 @@ <import feature="org.eclipse.ecf.core.feature" version="1.4.0" match="compatible"/> <import feature="org.eclipse.ecf.core.ssl.feature" version="1.1.0" match="compatible"/> <import feature="org.eclipse.ecf.filetransfer.feature" version="3.13.7" match="compatible"/> - <import feature="org.eclipse.ecf.filetransfer.httpclient45.feature" version="1.0.0" match="compatible"/> + <import feature="org.eclipse.ecf.filetransfer.httpclient5.feature" version="1.0.0" match="compatible"/> <import feature="org.eclipse.ecf.filetransfer.ssl.feature" version="1.1.0" match="compatible"/> </requires> @@ -184,7 +184,7 @@ unpack="false"/> <plugin - id="org.eclipse.equinox.security.linux.x86_64" + id="org.eclipse.equinox.security.linux" os="linux" arch="x86_64" download-size="0" @@ -211,6 +211,20 @@ unpack="false"/> <plugin + id="org.bouncycastle.bcpg" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.bouncycastle.bcprov" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin id="org.eclipse.equinox.concurrent" download-size="0" install-size="0" diff --git a/features/org.eclipse.equinox.p2.core.feature/forceQualifierUpdate.txt b/features/org.eclipse.equinox.p2.core.feature/forceQualifierUpdate.txt index f8781482f..55820793c 100644 --- a/features/org.eclipse.equinox.p2.core.feature/forceQualifierUpdate.txt +++ b/features/org.eclipse.equinox.p2.core.feature/forceQualifierUpdate.txt @@ -20,3 +20,7 @@ Bug 542873 - IBuild I20181217-1800 failed due to unresolved project dependencies Bug 551174 - Comparator errors in 4.14 I build - I20190917-1800 Bug 553238 - Unanticipated comparator errors in I20191119-1800 Bug 477007 - Do not use whitespace in XML +Bug 574602 - Eclipse 4.21 prerequisites: Orbit +Bug 574602 - Eclipse 4.21 prerequisites: Orbit +Bug 576389 - Touch bundle for org.bouncycastle.bcprov version update +Bug 578120 - Update to latest Orbit - bouncycastle and mina sshd updates
\ No newline at end of file diff --git a/features/org.eclipse.equinox.p2.core.feature/pom.xml b/features/org.eclipse.equinox.p2.core.feature/pom.xml index d30f0646c..ebb4950cb 100644 --- a/features/org.eclipse.equinox.p2.core.feature/pom.xml +++ b/features/org.eclipse.equinox.p2.core.feature/pom.xml @@ -15,12 +15,12 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.core.feature</artifactId> - <version>1.6.900-SNAPSHOT</version> + <version>1.6.1400-SNAPSHOT</version> <packaging>eclipse-feature</packaging> diff --git a/features/org.eclipse.equinox.p2.discovery.feature/feature.xml b/features/org.eclipse.equinox.p2.discovery.feature/feature.xml index 654ee799e..49c7f0d02 100644 --- a/features/org.eclipse.equinox.p2.discovery.feature/feature.xml +++ b/features/org.eclipse.equinox.p2.discovery.feature/feature.xml @@ -2,7 +2,7 @@ <feature id="org.eclipse.equinox.p2.discovery.feature" label="%featureName" - version="1.2.800.qualifier" + version="1.2.1100.qualifier" provider-name="%providerName" license-feature="org.eclipse.license" license-feature-version="0.0.0"> diff --git a/features/org.eclipse.equinox.p2.discovery.feature/pom.xml b/features/org.eclipse.equinox.p2.discovery.feature/pom.xml index 4eee64e88..f63571e19 100644 --- a/features/org.eclipse.equinox.p2.discovery.feature/pom.xml +++ b/features/org.eclipse.equinox.p2.discovery.feature/pom.xml @@ -14,12 +14,12 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.discovery.feature</artifactId> - <version>1.2.800-SNAPSHOT</version> + <version>1.2.1100-SNAPSHOT</version> <packaging>eclipse-feature</packaging> <build> diff --git a/features/org.eclipse.equinox.p2.extras.feature/feature.xml b/features/org.eclipse.equinox.p2.extras.feature/feature.xml index d3f7798e1..8989b7e84 100644 --- a/features/org.eclipse.equinox.p2.extras.feature/feature.xml +++ b/features/org.eclipse.equinox.p2.extras.feature/feature.xml @@ -2,7 +2,7 @@ <feature id="org.eclipse.equinox.p2.extras.feature" label="%featureName" - version="1.4.1100.qualifier" + version="1.4.1600.qualifier" provider-name="%providerName" license-feature="org.eclipse.license" license-feature-version="0.0.0"> diff --git a/features/org.eclipse.equinox.p2.extras.feature/pom.xml b/features/org.eclipse.equinox.p2.extras.feature/pom.xml index cae8895e9..97e83185a 100644 --- a/features/org.eclipse.equinox.p2.extras.feature/pom.xml +++ b/features/org.eclipse.equinox.p2.extras.feature/pom.xml @@ -14,12 +14,12 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.extras.feature</artifactId> - <version>1.4.1100-SNAPSHOT</version> + <version>1.4.1600-SNAPSHOT</version> <packaging>eclipse-feature</packaging> <build> diff --git a/features/org.eclipse.equinox.p2.rcp.feature/feature.xml b/features/org.eclipse.equinox.p2.rcp.feature/feature.xml index 284d8559a..1fc40357a 100644 --- a/features/org.eclipse.equinox.p2.rcp.feature/feature.xml +++ b/features/org.eclipse.equinox.p2.rcp.feature/feature.xml @@ -2,7 +2,7 @@ <feature id="org.eclipse.equinox.p2.rcp.feature" label="%featureName" - version="1.4.1100.qualifier" + version="1.4.1600.qualifier" provider-name="%providerName" license-feature="org.eclipse.license" license-feature-version="0.0.0"> diff --git a/features/org.eclipse.equinox.p2.rcp.feature/pom.xml b/features/org.eclipse.equinox.p2.rcp.feature/pom.xml index d093624d2..c25b7dafe 100644 --- a/features/org.eclipse.equinox.p2.rcp.feature/pom.xml +++ b/features/org.eclipse.equinox.p2.rcp.feature/pom.xml @@ -14,13 +14,13 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.rcp.feature</artifactId> - <version>1.4.1100-SNAPSHOT</version> + <version>1.4.1600-SNAPSHOT</version> <packaging>eclipse-feature</packaging> <build> diff --git a/features/org.eclipse.equinox.p2.sdk/feature.xml b/features/org.eclipse.equinox.p2.sdk/feature.xml index b7b8706e4..837fb5ea1 100644 --- a/features/org.eclipse.equinox.p2.sdk/feature.xml +++ b/features/org.eclipse.equinox.p2.sdk/feature.xml @@ -2,7 +2,7 @@ <feature id="org.eclipse.equinox.p2.sdk" label="%featureName" - version="3.11.1100.qualifier" + version="3.11.1600.qualifier" provider-name="%providerName" license-feature="org.eclipse.license" license-feature-version="0.0.0"> @@ -31,7 +31,7 @@ <import feature="org.eclipse.ecf.core.feature.source" version="1.4.0" match="compatible"/> <import feature="org.eclipse.ecf.core.ssl.feature.source" version="1.1.0" match="compatible"/> <import feature="org.eclipse.ecf.filetransfer.feature.source" version="3.13.7" match="compatible"/> - <import feature="org.eclipse.ecf.filetransfer.httpclient45.feature.source" version="1.0.0" match="compatible"/> + <import feature="org.eclipse.ecf.filetransfer.httpclient5.feature.source" version="1.0.0" match="compatible"/> <import feature="org.eclipse.ecf.filetransfer.ssl.feature.source" version="1.1.0" match="compatible"/> </requires> diff --git a/features/org.eclipse.equinox.p2.sdk/pom.xml b/features/org.eclipse.equinox.p2.sdk/pom.xml index c17b4295a..6e36baf37 100644 --- a/features/org.eclipse.equinox.p2.sdk/pom.xml +++ b/features/org.eclipse.equinox.p2.sdk/pom.xml @@ -15,11 +15,11 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.sdk</artifactId> - <version>3.11.1100-SNAPSHOT</version> + <version>3.11.1600-SNAPSHOT</version> <packaging>eclipse-feature</packaging> </project> diff --git a/features/org.eclipse.equinox.p2.user.ui/feature.xml b/features/org.eclipse.equinox.p2.user.ui/feature.xml index b5a442111..8e7849ace 100644 --- a/features/org.eclipse.equinox.p2.user.ui/feature.xml +++ b/features/org.eclipse.equinox.p2.user.ui/feature.xml @@ -2,7 +2,7 @@ <feature id="org.eclipse.equinox.p2.user.ui" label="%featureName" - version="2.4.1100.qualifier" + version="2.4.1600.qualifier" provider-name="%providerName" license-feature="org.eclipse.license" license-feature-version="0.0.0"> diff --git a/features/org.eclipse.equinox.p2.user.ui/pom.xml b/features/org.eclipse.equinox.p2.user.ui/pom.xml index 7e48fccd0..e05ba4722 100644 --- a/features/org.eclipse.equinox.p2.user.ui/pom.xml +++ b/features/org.eclipse.equinox.p2.user.ui/pom.xml @@ -14,13 +14,13 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.user.ui</artifactId> - <version>2.4.1100-SNAPSHOT</version> + <version>2.4.1600-SNAPSHOT</version> <packaging>eclipse-feature</packaging> <build> diff --git a/org.eclipse.equinox.p2.releng/default.target b/org.eclipse.equinox.p2.releng/default.target index a02fdc049..5139a8a19 100644 --- a/org.eclipse.equinox.p2.releng/default.target +++ b/org.eclipse.equinox.p2.releng/default.target @@ -6,7 +6,7 @@ <unit id="org.eclipse.platform.sdk" version="0.0.0"/> <unit id="org.eclipse.core.tests.harness" version="0.0.0"/> <unit id="org.eclipse.test.feature.group" version="0.0.0"/> -<repository location="https://download.eclipse.org/eclipse/updates/4.19-I-builds"/> +<repository location="https://download.eclipse.org/eclipse/updates/4.24-I-builds"/> </location> <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit"> <unit id="org.bouncycastle.bcprov" version="0.0.0"/> diff --git a/org.eclipse.equinox.p2.releng/org.eclipse.equinox.p2.tests-parent/pom.xml b/org.eclipse.equinox.p2.releng/org.eclipse.equinox.p2.tests-parent/pom.xml index deae02ed1..d2d0472a3 100644 --- a/org.eclipse.equinox.p2.releng/org.eclipse.equinox.p2.tests-parent/pom.xml +++ b/org.eclipse.equinox.p2.releng/org.eclipse.equinox.p2.tests-parent/pom.xml @@ -14,7 +14,7 @@ <parent> <groupId>org.eclipse.equinox.p2</groupId> <artifactId>rt.equinox.p2</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <groupId>org.eclipse</groupId> @@ -15,7 +15,7 @@ <parent> <groupId>org.eclipse</groupId> <artifactId>eclipse-platform-parent</artifactId> - <version>4.19.0-SNAPSHOT</version> + <version>4.24.0-SNAPSHOT</version> <relativePath>../eclipse-platform-parent</relativePath> </parent> @@ -24,7 +24,7 @@ <packaging>pom</packaging> <properties> - <tycho.scmUrl>scm:git:git://git.eclipse.org/gitroot/equinox/rt.equinox.p2.git</tycho.scmUrl> + <tycho.scmUrl>scm:git:https://git.eclipse.org/r/equinox/rt.equinox.p2.git</tycho.scmUrl> </properties> <!-- |