Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2012-11-12 12:46:00 +0000
committerGlyn Normington2012-11-12 12:46:00 +0000
commit65e3e13071568882c2b56ab2cc34b738a466ac90 (patch)
tree21ffda27f237a35d8f3fcc2dc6415bec306d66fb /org.eclipse.virgo.kernel.model/src
parentab54f56dcc43d9ac6729ccd28fc84dc2c6d5a5bf (diff)
downloadorg.eclipse.virgo.kernel-65e3e13071568882c2b56ab2cc34b738a466ac90.tar.gz
org.eclipse.virgo.kernel-65e3e13071568882c2b56ab2cc34b738a466ac90.tar.xz
org.eclipse.virgo.kernel-65e3e13071568882c2b56ab2cc34b738a466ac90.zip
393857: fix NPE
Diffstat (limited to 'org.eclipse.virgo.kernel.model/src')
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DefaultRuntimeArtifactModelObjectNameCreator.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DefaultRuntimeArtifactModelObjectNameCreator.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DefaultRuntimeArtifactModelObjectNameCreator.java
index a4b7933d..141aa1c1 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DefaultRuntimeArtifactModelObjectNameCreator.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DefaultRuntimeArtifactModelObjectNameCreator.java
@@ -46,6 +46,8 @@ public final class DefaultRuntimeArtifactModelObjectNameCreator implements Runti
private static final String KEY_VERSION = "version";
private static final String KEY_REGION = "region";
+
+ private static final String NULL_REGION_NAME = "global";
private final String domain;
@@ -64,7 +66,11 @@ public final class DefaultRuntimeArtifactModelObjectNameCreator implements Runti
* {@inheritDoc}
*/
public ObjectName createArtifactModel(String type, String name, Version version, Region region) {
- return createObjectName(String.format(ARTIFACT_FORMAT, this.domain, this.quoteValueIfNeeded(type), this.quoteValueIfNeeded(name), this.quoteValueIfNeeded(version.toString()), this.quoteValueIfNeeded(region.getName())));
+ return createObjectName(String.format(ARTIFACT_FORMAT, this.domain, this.quoteValueIfNeeded(type), this.quoteValueIfNeeded(name), this.quoteValueIfNeeded(version.toString()), this.quoteValueIfNeeded(getRegionName(region))));
+ }
+
+ private String getRegionName(Region region) {
+ return region == null ? NULL_REGION_NAME : region.getName();
}
/**

Back to the top