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

Patch to add escaping for property values and property keys in java properties files.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.3
    • 1.x, 1.4, 2.x, 3.0
    • GenericTools
    • None

    Description

      Special escaping is required when writing keys and values into java properties files.

      I have simply taken the escaping routines from java.util.Properties in the private method saveConvert(String, boolean) and have added two new methods to propertyKey and propertyValue used in the same way as the other escaping routines.

      This is useful for example when trying to templatize an install path, say.

      Suppose I have a velocity variable available at runtime $INSTALL_PATH

      I could templatize the following properties thus.
      ----before
      #Policy Director properties file
      #Wed Mar 28 16:26:19 BST 2007
      mgmt_domain=Default
      config_type=standalone
      tcd_enabled=false
      pd-home=C\:\\IBMTest1\\WebSphere
      AppServer/java/jre/PolicyDirector
      pdvar-home=C\:\\IBMTest1\\WebSphere
      AppServer/java/jre/PolicyDirector
      — templatized
      #Policy Director properties file
      #Wed Mar 28 16:26:19 BST 2007
      mgmt_domain=Default
      config_type=standalone
      tcd_enabled=false
      pd-home=$enc.propertyValue(${INSTALL_PATH})WebSphere
      AppServer/java/jre/PolicyDirector
      pdvar-home=$enc.propertyValue(${INSTALL_PATH})WebSphere
      AppServer/java/jre/PolicyDirector

      Attachments

        1. escape_harmony.patch
          7 kB
          Phil Cornelius
        2. escape.patch
          7 kB
          Phil Cornelius

        Activity

          People

            Unassigned Unassigned
            smapjb Phil Cornelius
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: