From b1713bbb0def2bdddf669b619dc11f03e4378c41 Mon Sep 17 00:00:00 2001 From: "..." Date: Sun, 18 Nov 2012 15:57:01 +0100 Subject: [PATCH] use String.format instead of MessageFormat.fomat --- .../org/nnsoft/guice/rocoto/variables/AntStyleParser.java | 8 ++++---- .../guice/rocoto/variables/VariableResolvingTestCase.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/nnsoft/guice/rocoto/variables/AntStyleParser.java b/src/main/java/org/nnsoft/guice/rocoto/variables/AntStyleParser.java index 0809bde..4f07c98 100644 --- a/src/main/java/org/nnsoft/guice/rocoto/variables/AntStyleParser.java +++ b/src/main/java/org/nnsoft/guice/rocoto/variables/AntStyleParser.java @@ -15,7 +15,7 @@ */ package org.nnsoft.guice.rocoto.variables; -import static java.text.MessageFormat.format; +import static java.lang.String.format; import java.util.ArrayList; import java.util.List; @@ -77,7 +77,7 @@ public Appender parse( String pattern ) throws IllegalArgumentException if ( endVariable < 0 ) { throw new IllegalArgumentException(format( - "Syntax error in property value ''{0}'', missing close bracket ''{1}'' for variable beginning at col {2}: ''{3}''", pattern, + "Syntax error in property value '%s', missing close bracket '%s' for variable beginning at col %s: '%s'", pattern, VAR_CLOSE, pos - VAR_START_LEN, pattern.substring(pos - VAR_START_LEN))); } @@ -94,7 +94,7 @@ public Appender parse( String pattern ) throws IllegalArgumentException if ( endVariable < 0 ) { throw new IllegalArgumentException(format( - "Syntax error in property value ''{0}'', missing close bracket ''{1}'' for variable beginning at col {2}: ''{3}''", + "Syntax error in property value '%s', missing close bracket '%s' for variable beginning at col %s: '%s'", pattern, VAR_CLOSE, nextVariable, pattern.substring(nextVariable, lastEndVariable))); } nextVariable = pattern.indexOf(VAR_START, nextVariable + VAR_START_LEN); @@ -145,7 +145,7 @@ public Appender parse( String pattern ) throws IllegalArgumentException if ( nextEndKeyVariable < 0 ) { throw new IllegalArgumentException( - format("Syntax error in property value ''{0}'', missing close bracket ''{1}'' for variable beginning at col {2}: ''{3}''", + format("Syntax error in property value '%s', missing close bracket '%s' for variable beginning at col %s: '%s'", pattern, VAR_CLOSE, nextStartKeyVariable, key.substring(nextStartKeyVariable))); } } diff --git a/src/test/java/org/nnsoft/guice/rocoto/variables/VariableResolvingTestCase.java b/src/test/java/org/nnsoft/guice/rocoto/variables/VariableResolvingTestCase.java index 0ea3101..8a47f0a 100644 --- a/src/test/java/org/nnsoft/guice/rocoto/variables/VariableResolvingTestCase.java +++ b/src/test/java/org/nnsoft/guice/rocoto/variables/VariableResolvingTestCase.java @@ -15,7 +15,7 @@ */ package org.nnsoft.guice.rocoto.variables; -import static java.text.MessageFormat.format; +import static java.lang.String.format; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -476,7 +476,7 @@ private void verifySyntaxError( String value ) try { variablesMap.put("mustFail", value); - fail(format("Expected an IllegalArgumentException for syntaxically incorrect variable value ''{0}''.", value)); + fail(format("Expected an IllegalArgumentException for syntaxically incorrect variable value '%s'.", value)); } catch (IllegalArgumentException expected) { // ok