You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Will Glass-Husain (JIRA)" <ji...@apache.org> on 2005/09/18 22:17:54 UTC

[jira] Resolved: (VELOCITY-151) RuntimeInstance.setDefaultProperties() codepage problem

     [ http://issues.apache.org/jira/browse/VELOCITY-151?page=all ]
     
Will Glass-Husain resolved VELOCITY-151:
----------------------------------------

    Fix Version: 1.5
                     (was: 1.4)
     Resolution: Fixed
      Assign To:     (was: Velocity-Dev List)

Updated to latest commons collection jar (3.1) so that this works.  Would have switched to commons configuration except that bug still exists in that code base.  submitted bugzilla issue 36699 for commons configuration.  ( http://issues.apache.org/bugzilla/show_bug.cgi?id=36699 )

> RuntimeInstance.setDefaultProperties() codepage problem
> -------------------------------------------------------
>
>          Key: VELOCITY-151
>          URL: http://issues.apache.org/jira/browse/VELOCITY-151
>      Project: Velocity
>         Type: Bug
>   Components: Source
>     Versions: 1.3.1-rc2
>  Environment: Operating System: other
> Platform: Other
>     Reporter: Kirk Wolf
>      Fix For: 1.5

>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org