diff options
author | Mykola Nikishov | 2016-12-24 11:18:43 +0000 |
---|---|---|
committer | Pascal Rapicault | 2017-03-30 15:06:20 +0000 |
commit | 5be3ee98548c39fa52804fbb4ce2c1d3c647a63b (patch) | |
tree | dcbfab408ed9ddcd3aa7ead7e924e43a3ad33057 | |
parent | f6f9c5732002a7bbe4a692eb55449e5c00002cbe (diff) | |
download | rt.equinox.p2-5be3ee98548c39fa52804fbb4ce2c1d3c647a63b.tar.gz rt.equinox.p2-5be3ee98548c39fa52804fbb4ce2c1d3c647a63b.tar.xz rt.equinox.p2-5be3ee98548c39fa52804fbb4ce2c1d3c647a63b.zip |
Bug 509401 - Create an artifact descriptor for a directory
When creating artifact descriptor in PublisherHelper'
createArtifactDescriptor method, the file denoted by the given path
may be a directory and not a file.
For the directory, java.io.File.length() is unspecified which makes it
pointless to set IArtifactDescriptor.ARTIFACT_SIZE and
IArtifactDescriptor.DOWNLOAD_SIZE.
Also, do not try to calculate checksum for the directory as doing this
will throw exceptions anyway.
Change-Id: I9cf1507a3195790eb3b2f244a3f66ccf125f6f97
Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
-rw-r--r-- | bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java | 4 |
1 files changed, 2 insertions, 2 deletions
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 c02dc4925..bdef4f059 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 @@ -107,8 +107,8 @@ public class PublisherHelper { private static IArtifactDescriptor createArtifactDescriptor(IPublisherInfo info, IArtifactRepository artifactRepo, IArtifactKey key, File pathOnDisk) { IArtifactDescriptor result = artifactRepo != null ? artifactRepo.createArtifactDescriptor(key) : new ArtifactDescriptor(key); if (result instanceof ArtifactDescriptor) { - ArtifactDescriptor descriptor = (ArtifactDescriptor) result; - if (pathOnDisk != null) { + if (pathOnDisk != null && pathOnDisk.isFile()) { + ArtifactDescriptor descriptor = (ArtifactDescriptor) result; descriptor.setProperty(IArtifactDescriptor.ARTIFACT_SIZE, Long.toString(pathOnDisk.length())); descriptor.setProperty(IArtifactDescriptor.DOWNLOAD_SIZE, Long.toString(pathOnDisk.length())); if (info == null || (info.getArtifactOptions() & IPublisherInfo.A_NO_MD5) == 0) { |