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

ResourceTool work not propertly when change the bundle property

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0
    • 3.0
    • GenericTools
    • None
    • windows xp sp3(Chinese simplified), ibm jdk 1.6, eclipse 3.6.0

    Description

      when i use the ResourceTool in a standalone situation, i found that when i configured the toolbox.xml as below(my resource files is study/velocity/resources/resource(_XXX).properties in my classpath)
      <tools>
      <toolbox scope="request">
      <tool class="org.apache.velocity.tools.generic.ResourceTool"
      bundles="study.velocity.resources.resource"
      locale="en_US" />
      </toolbox>
      </tools>

      it will not work properly, and throw an exception as below:

      java.util.MissingResourceException: Can't find resource for bundle resources, key zh_CN

      my template is as below:

      Hi! My name is $text.test.user.name.
      Oh! How are you $text.test.user.name? Where are you from?
      I'm from $text.test.user.addr.
      ok, $text.test.user.name. If I want to have a message with you, how do I contact you?
      You can send me an email. My email address is $text.test.user.email.

      but when i changed the toolbox.xml as below:
      <tools>
      <toolbox scope="request">
      <tool key="res"
      class="org.apache.velocity.tools.generic.ResourceTool"
      bundles="study.velocity.resources.resource"
      locale="en_US"/>
      </toolbox>
      </tools>

      and changed the template as below:

      Hi! My name is $res.test.user.name.
      Oh! How are you $res.test.user.name? Where are you from?
      I'm from $res.test.user.addr.
      ok, $res.test.user.name. If I want to have a message with you, how do I contact you?
      You can send me an email. My email address is $res.test.user.email.

      It worked correctly.

      so i don't know if it is a bug or some configuration error in my enviroment?

      Attachments

        1. restool-ok.zip
          12 kB
          Claude Brisson
        2. restool.zip
          27 kB
          Lee Gang

        Activity

          People

            cbrisson Claude Brisson
            ligangty@gmail.com Lee Gang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: