Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Grunberg2018-11-06 19:11:23 +0000
committerRoland Grunberg2018-11-06 19:15:07 +0000
commit9cb07ab09800c7a0e041a45ffbcb08b752a6978e (patch)
treea0e7379e3b66d005989a373da3de5b6634a57c6d
parent01e47a783fe110929107d78302c5b51b8d3fb9dd (diff)
downloadrt.equinox.p2-9cb07ab09800c7a0e041a45ffbcb08b752a6978e.tar.gz
rt.equinox.p2-9cb07ab09800c7a0e041a45ffbcb08b752a6978e.tar.xz
rt.equinox.p2-9cb07ab09800c7a0e041a45ffbcb08b752a6978e.zip
Bug 531166 - Prevent NPE on artifact download when URI scheme is null.I20181112-1800I20181112-0435I20181112-0320I20181109-0350I20181108-1800
Under certain circumstances, the mirror resolution requests return just the absolute file path for a resource with no scheme or host specified. (eg. /path/to/resource). This causes an NPE when getScheme() is called and used for comparison. Change-Id: Ic64323b44a9a1df7fad3a09da2f07a0a3d1a5a10 Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java2
1 files changed, 1 insertions, 1 deletions
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 cde8a99a2..6a1b96495 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
@@ -714,7 +714,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
private IStatus downloadArtifact(IArtifactDescriptor descriptor, URI mirrorLocation, OutputStream destination, IProgressMonitor monitor) {
//Bug 340352: transport has performance overhead of 100ms and more, bypass it for local copies
IStatus result = Status.OK_STATUS;
- if (mirrorLocation.getScheme().equals(SimpleArtifactRepositoryFactory.PROTOCOL_FILE))
+ if (SimpleArtifactRepositoryFactory.PROTOCOL_FILE.equals(mirrorLocation.getScheme()))
result = copyFileToStream(new File(mirrorLocation), destination, monitor);
else
result = getTransport().download(mirrorLocation, destination, monitor);

Back to the top