Velocity
  1. Velocity
  2. VELOCITY-151

RuntimeInstance.setDefaultProperties() codepage problem

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.1-rc2
    • Fix Version/s: 1.5
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Operating System: other
      Platform: Other

      Description

      There is a bug in the RuntimeInstance setDefaultProperties method that prevents
      Velocity 1.3.1 from running on an IBM mainframe.

      The code is currently written:

      InputStream inputStream = classLoader
      .getResourceAsStream( DEFAULT_RUNTIME_PROPERTIES );

      configuration.load( inputStream );

      Which loads the default runtime properties into an ExtendedProperties
      object.
      This fails on an OS/390 which has a default codepage of Cp1047 (ebcdic),
      since:

      1) the properties resource is packaged in the Jar in codepage ISO8859_1.
      2) The ExtendedProperties class attempts to load it using the default
      codepage (Cp1047).
      3) Because of the codepage mismatch, the resulting ExtendedProperties
      object is empty and you get the error:
      "It appears that no class was specified as the ResourceManager. Please
      ensure that all configuration information is correct."

      Note that java.util.Properties.load(InputStream) ALWAYS loads using
      "8859_1", since properties files are assumed to be in ASCII.

      A workaround to this bug is to load the default properties manually, add
      your changes and pass them all to the VelocityEngine.init(Properties)
      method.

      The fix is to change the line to:

      configuration.load( inputStream, "8859_1" );

      Which is consistent with java.util.Properties.load(). Also, any other uses
      of the ExtendedProperties.load() should be changed as well. In fact,
      ExtendedProperties.load() should probably default to "8859_1", IMO.

        Activity

        Kirk Wolf created issue -
        Jeff Turner made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 17826 12315021
        Will Glass-Husain made changes -
        Fix Version/s 1.4 [ 12310249 ]
        Fix Version/s 1.5 [ 12310253 ]
        Assignee Velocity-Dev List [ velocity-dev@jakarta.apache.org ]
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Henning Schmiedehausen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12325026 ] Default workflow, editable Closed status [ 12551914 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12551914 ] jira [ 12552313 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Kirk Wolf
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development