You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Gregory <gg...@seagullsoftware.com> on 2005/07/25 18:43:43 UTC
[lang] IllegalStateException in text.VariableFormatter with "empty" keys.
Oliver and all:
The text.VariableFormatter class throws an IllegalStateException for the
template "The ${} jumps over the ${}.":
java.lang.IllegalStateException: Infinite loop in property interpolation
of The ${} jumps over the ${}.: ->
at
org.apache.commons.lang.text.VariableFormatter.doReplace(VariableFormatt
er.java:380)
at
org.apache.commons.lang.text.VariableFormatter.replaceObject(VariableFor
matter.java:513)
at
org.apache.commons.lang.text.VariableFormatterTest.testReplaceNoElement(
VariableFormatterTest.java:230)
at
org.apache.commons.lang.text.VariableFormatterTest.testReplaceNoEmptyKey
s(VariableFormatterTest.java:263)
I would think that replaceObject should just return the pattern string,
which is what happens when other kinds of malformed patterns are
submitted.
Could you fix this? Or do you think this is really the proper behavior?
Thanks,
Gary
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [lang] IllegalStateException in text.VariableFormatter with "empty"
keys.
Posted by Oliver Heger <ol...@t-online.de>.
Gary Gregory wrote:
>Oliver and all:
>
>The text.VariableFormatter class throws an IllegalStateException for the
>template "The ${} jumps over the ${}.":
>
>java.lang.IllegalStateException: Infinite loop in property interpolation
>of The ${} jumps over the ${}.: ->
> at
>org.apache.commons.lang.text.VariableFormatter.doReplace(VariableFormatt
>er.java:380)
> at
>org.apache.commons.lang.text.VariableFormatter.replaceObject(VariableFor
>matter.java:513)
> at
>org.apache.commons.lang.text.VariableFormatterTest.testReplaceNoElement(
>VariableFormatterTest.java:230)
> at
>org.apache.commons.lang.text.VariableFormatterTest.testReplaceNoEmptyKey
>s(VariableFormatterTest.java:263)
>
>
>I would think that replaceObject should just return the pattern string,
>which is what happens when other kinds of malformed patterns are
>submitted.
>
>Could you fix this? Or do you think this is really the proper behavior?
>
>Thanks,
>Gary
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
>
Attached is a fix (if the list lets it through). The problem was that
variables that could not be resolved were not removed from the
priorVariables list. Good test case!
Oliver