Bug 533117 - setRepositoryProperty: fixed regression when value is null

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>
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 b811b6c..312eee9 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 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)