diff options
author | Karsten Thoms | 2019-09-30 14:21:29 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2019-10-01 08:57:14 +0000 |
commit | 50b9a13ab2a774a53ef3cbba0292fae1cfb138a9 (patch) | |
tree | 668b97ade37bc4d1f23c59f43641a6afd3eda00a | |
parent | d044e46df2cf266917feaeab7583c4d6c1acca4d (diff) | |
download | rt.equinox.p2-50b9a13ab2a774a53ef3cbba0292fae1cfb138a9.tar.gz rt.equinox.p2-50b9a13ab2a774a53ef3cbba0292fae1cfb138a9.tar.xz rt.equinox.p2-50b9a13ab2a774a53ef3cbba0292fae1cfb138a9.zip |
Bug 433402 - Guard canInstallInDestination to require 'destination'
argument
Avoid to call canWrite with a null argument when the 'destination'
program argument is missing. Instead throw a ProvisioningException.
Also fixed small typo in error message.
Change-Id: I7880ff154e783b51a9689cac33af5ea5f73571ea
Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
2 files changed, 5 insertions, 4 deletions
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 90f280269..8cc5917ed 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 @@ -506,8 +506,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener { int removalIdx = 0; boolean anyValid = false; // do we have any valid repos or did they all fail to load? artifactReposForRemoval = new URI[artifactRepositoryLocations.size()]; - for (int i = 0; i < artifactRepositoryLocations.size(); i++) { - URI location = artifactRepositoryLocations.get(i); + for (URI location : artifactRepositoryLocations) { try { if (!artifactManager.contains(location)) { artifactManager.loadRepository(location, null); @@ -1350,10 +1349,12 @@ public class DirectorApplication implements IApplication, ProvisioningListener { return IntStream.range(0, size).mapToObj(i -> "\t").collect(Collectors.joining()); //$NON-NLS-1$ } - private boolean canInstallInDestination() { + private boolean canInstallInDestination() throws CoreException { //When we are provisioning what we are running. We can always install. if (targetAgentIsSelfAndUp) return true; + if (destination == null) + missingArgument("destination"); //$NON-NLS-1$ return canWrite(destination); } diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties index e75585d74..2591ca3a1 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties +++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties @@ -79,4 +79,4 @@ File_does_not_exist=File does not exist: {0}. Cannot_set_iu_profile_property_iu_does_not_exist=Unable to set IU profile properties because the following IU does not exist: {0}. Unmatched_iu_profile_property_key_value=Unmatched IU profile property key/value pair: {0}. Bad_format=Bad format ({0}) in IU profile properties file: {1}. -Cant_write_in_destination=The operation you''ve requested can not be performed because the folder {0} is read only.
\ No newline at end of file +Cant_write_in_destination=The operation you've requested can not be performed because the folder {0} is read only.
\ No newline at end of file |