Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use String.format instead of MessageFormat.fomat #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
use String.format instead of MessageFormat.fomat
picpoc committed Nov 18, 2012
commit b1713bbb0def2bdddf669b619dc11f03e4378c41
Original file line number Diff line number Diff line change
@@ -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)));
}
}
Original file line number Diff line number Diff line change
@@ -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