From: Robert Varga Date: Tue, 27 Jan 2015 10:59:50 +0000 (+0100) Subject: Fix String.format() strings X-Git-Tag: release/lithium~649 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=448bd0847750815fca81f20535014d1b08531e52 Fix String.format() strings String.format() takes %s as a placeholder. Change-Id: I1465b36b4d5ef56f25d3ee433450bbdd2ee97c3b Signed-off-by: Robert Varga --- diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java index 6e5ba1c90c..932c36fe34 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java @@ -15,6 +15,8 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Lists; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; +import java.util.Collections; +import java.util.List; import org.opendaylight.controller.cluster.datastore.messages.AbortTransaction; import org.opendaylight.controller.cluster.datastore.messages.AbortTransactionReply; import org.opendaylight.controller.cluster.datastore.messages.CanCommitTransaction; @@ -27,8 +29,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import scala.concurrent.Future; import scala.runtime.AbstractFunction1; -import java.util.Collections; -import java.util.List; /** * ThreePhaseCommitCohortProxy represents a set of remote cohort proxies @@ -133,7 +133,7 @@ public class ThreePhaseCommitCohortProxy implements DOMStoreThreePhaseCommitCoho } else { LOG.error("Unexpected response type {}", response.getClass()); returnFuture.setException(new IllegalArgumentException( - String.format("Unexpected response type {}", response.getClass()))); + String.format("Unexpected response type %s", response.getClass()))); return; } } @@ -239,7 +239,7 @@ public class ThreePhaseCommitCohortProxy implements DOMStoreThreePhaseCommitCoho for(Object response: responses) { if(!response.getClass().equals(expectedResponseClass)) { exceptionToPropagate = new IllegalArgumentException( - String.format("Unexpected response type {}", + String.format("Unexpected response type %s", response.getClass())); break; } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java index 9f48ef96cf..af1e4e92b6 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java @@ -901,7 +901,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { } else { // Throwing an exception here will fail the Future. - throw new IllegalArgumentException(String.format("Invalid reply type {}", + throw new IllegalArgumentException(String.format("Invalid reply type %s", serializedReadyReply.getClass())); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/SerializationUtils.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/SerializationUtils.java index 3f21257463..87c78bd275 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/SerializationUtils.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/SerializationUtils.java @@ -37,7 +37,7 @@ public final class SerializationUtils { NormalizedNodeWriter.forStreamWriter(streamWriter).write(node); streamWriter.writeYangInstanceIdentifier(path); } catch (IOException e) { - throw new IllegalArgumentException(String.format("Error serializing path {} and Node {}", + throw new IllegalArgumentException(String.format("Error serializing path %s and Node %s", path, node), e); } } @@ -61,7 +61,7 @@ public final class SerializationUtils { NormalizedNodeWriter.forStreamWriter(streamWriter).write(node); } } catch (IOException e) { - throw new IllegalArgumentException(String.format("Error serializing NormalizedNode {}", + throw new IllegalArgumentException(String.format("Error serializing NormalizedNode %s", node), e); } }