From 49a82dec690a9ea7420ebd6560b714888c3de4da Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Mon, 12 Jan 2015 12:55:15 +0100 Subject: [PATCH] Remove string concatenation in preconditions Preconditions support String.format()-style arguments, the use of which actually makes them faster, as the singular string need not be constructed if it's not used. Change-Id: Ib60bf458e2ef57df71fa6d2820af0110632cb37f Signed-off-by: Robert Varga --- .../config/yangjmxgenerator/RuntimeBeanEntry.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeBeanEntry.java b/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeBeanEntry.java index 74981a9582..34e3c2e071 100644 --- a/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeBeanEntry.java +++ b/opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeBeanEntry.java @@ -9,7 +9,6 @@ package org.opendaylight.controller.config.yangjmxgenerator; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; - import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.base.Optional; @@ -95,7 +94,7 @@ public class RuntimeBeanEntry { final List children, final Set rpcs) { checkArgument(isRoot == false || keyYangName.isPresent() == false, - "Root RuntimeBeanEntry must not have key " + "set"); + "Root RuntimeBeanEntry must not have key set"); this.packageName = packageName; this.isRoot = isRoot; this.yangName = yangName; @@ -108,16 +107,14 @@ public class RuntimeBeanEntry { for (AttributeIfc a : attributes) { checkState(map.containsKey(a.getAttributeYangName()) == false, - "Attribute already defined: " + a.getAttributeYangName() - + " in " + nodeForReporting); + "Attribute already defined: %s in %s", a.getAttributeYangName(), nodeForReporting); map.put(a.getAttributeYangName(), a); } if (keyYangName.isPresent()) { AttributeIfc keyJavaName = map.get(keyYangName.get()); - checkArgument(keyJavaName != null, "Key " + keyYangName.get() - + " not found in attribute " + "list " + attributes - + " in " + nodeForReporting); + checkArgument(keyJavaName != null, "Key %s not found in attribute list %s in %s", keyYangName.get(), + attributes, nodeForReporting); this.keyJavaName = Optional .of(keyJavaName.getUpperCaseCammelCase()); } else { -- 2.36.6