List of usage examples for java.util IllegalFormatException getLocalizedMessage
public String getLocalizedMessage()
From source file:org.quattor.pan.dml.functions.Substitute.java
@Override public Element execute(Context context) { assert (ops.length == 1 || ops.length == 2); // Calculate arguments. Element[] args = calculateArgs(context); // Pull out the template string. String template = null;/* w w w . j a v a 2s . c o m*/ try { template = ((StringProperty) args[0]).getValue(); } catch (ClassCastException cce) { throw EvaluationException.create(sourceRange, context, MSG_INVALID_FIRST_ARG_SUBSTITUTE); } // Pull out the value map. HashResource valueMap = null; if (ops.length == 2) { try { valueMap = ((HashResource) args[1]); } catch (ClassCastException cce) { throw EvaluationException.create(sourceRange, context, MSG_INVALID_SECOND_ARG_SUBSTITUTE); } } StringProperty result = null; try { Resolver resolver = new Resolver(valueMap, context); StrSubstitutor sub = new StrSubstitutor(resolver); result = StringProperty.getInstance(sub.replace(template)); } catch (IllegalFormatException ife) { throw EvaluationException.create(sourceRange, context, MSG_ILLEGAL_FORMAT, ife.getLocalizedMessage()); } assert (result != null); return result; }