Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMykola Nikishov2016-12-24 06:18:43 -0500
committerPascal Rapicault2017-03-30 11:06:20 -0400
commit5be3ee98548c39fa52804fbb4ce2c1d3c647a63b (patch)
treedcbfab408ed9ddcd3aa7ead7e924e43a3ad33057
parentf6f9c5732002a7bbe4a692eb55449e5c00002cbe (diff)
downloadrt.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.java4
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) {

Back to the top