Uploaded image for project: 'Velocity Tools'
  1. Velocity Tools
  2. VELTOOLS-167

Dealing with missing keys in resource bundle

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.0
    • None
    • GenericTools
    • None

    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

      ???NON_EXISTENT_KEY???

      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?

      Attachments

        Activity

          People

            Unassigned Unassigned
            palisetti Mohan Palisetti
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: