[
https://issues.apache.org/jira/browse/VELTOOLS-167?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sergiu Dumitriu updated VELTOOLS-167:
-------------------------------------
Description:
No exception is thrown when doing a template merge with a non-existent key from
the resource bundle.
eg. if the template has ${resource.NON_EXISTENT_KEY}, then we end up with the
string {noformat}???NON_EXISTENT_KEY???{noformat}
This has to do with the
org.apache.velocity.tools.generic.ResourceTool.Key.toString implementation as
shown below:
{code:java}
public String toString()
{
if (this.key == null)
{
return "";
}
if (!getExists())
{
return "???"+this.key+"???";
}
return ResourceTool.this.render(this.rawValue, this.args);
}
{code}
Any reason why we can't force a FormatException when running in strict mode?
was:
No exception is thrown when doing a template merge with a non-existent key from
the resource bundle.
eg. if the template has ${resource.NON_EXISTENT_KEY}, then we end up with the
string {noformat}???NON_EXISTENT_KEY???{noformat}
This has to do with the
org.apache.velocity.tools.generic.ResourceTool.Key.toString implementation as
shown below:
public String toString()
{
if (this.key == null)
{
return "";
}
if (!getExists())
{
return "???"+this.key+"???";
}
return ResourceTool.this.render(this.rawValue, this.args);
}
Any reason why we can't force a FormatException when running in strict mode?
> Dealing with missing keys in resource bundle
> --------------------------------------------
>
> Key: VELTOOLS-167
> URL: https://issues.apache.org/jira/browse/VELTOOLS-167
> Project: Velocity Tools
> Issue Type: Bug
> Components: GenericTools
> Affects Versions: 2.0
> Reporter: Mohan Palisetti
> Priority: Minor
>
> No exception is thrown when doing a template merge with a non-existent key
> from the resource bundle.
> eg. if the template has ${resource.NON_EXISTENT_KEY}, then we end up with the
> string {noformat}???NON_EXISTENT_KEY???{noformat}
> This has to do with the
> org.apache.velocity.tools.generic.ResourceTool.Key.toString implementation as
> shown below:
> {code:java}
> public String toString()
> {
> if (this.key == null)
> {
> return "";
> }
> if (!getExists())
> {
> return "???"+this.key+"???";
> }
> return ResourceTool.this.render(this.rawValue, this.args);
> }
> {code}
> Any reason why we can't force a FormatException when running in strict mode?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]