Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Thoms2018-03-31 14:30:14 +0000
committerAlexander Kurtakov2018-04-13 08:46:22 +0000
commit1d178b62059e90f3979721c8d151dca2d04e19fb (patch)
tree7b75bad14da517c3eee3175a0e01bf3f868069c5
parentcaf0ccfd33f9ac75d2a9fafbdc4e2d98e53bc19b (diff)
downloadrt.equinox.p2-I20180415-2000.tar.gz
rt.equinox.p2-I20180415-2000.tar.xz
rt.equinox.p2-I20180415-2000.zip
Bug 533117 - setRepositoryProperty: fixed regression when value is nullI20180416-0305I20180415-2000I20180414-1500I20180413-2000
A null value should remove the entry from the repositoryProperties. But when repositoryProperties is not initialized a null value was actually added for the key. Changed conditions to first prove wether value is null and only remove the property, when field repositoryProperties is initialized. Set field to null when the last entry was removed. Change-Id: I766094f09d24bcf3c0da093202724ab5c2f0e417 Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.java
index b811b6c9f..312eee91c 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2017 IBM Corporation and others.
+ * Copyright (c) 2009, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -36,8 +36,13 @@ public class SimpleArtifactDescriptor extends ArtifactDescriptor {
}
public void setRepositoryProperty(String key, String value) {
- if (value == null && repositoryProperties != null) {
- repositoryProperties.remove(key);
+ if (value == null) {
+ if (repositoryProperties != null) {
+ repositoryProperties.remove(key);
+ if (repositoryProperties.isEmpty()) {
+ repositoryProperties = null;
+ }
+ }
} else {
if (repositoryProperties == null) {
// first value => store in singletonMap (most repositoryProperties have at most 1 entry)

Back to the top