If you don't want surprises, you should also specify the encoding to
use. I'm guessing that the files you're reading have a known encoding
that's kept from the build into the distribution package, but you don't
always have control over the system where it's installed.

try {
    return new BufferedReader(new
InputStreamReader(servletContext.getResourceAsStream(path), "UTF-8"));
} catch (UnsupportedEncodingException e) {
    // This should never happen, UTF-8 is mandatory for a valid JVM
    return null;
}

On 11/08/2016 07:13 AM, Greg Huber wrote:
> Seems to be working OK.  Thanks.
> 
> For the ResourceLoader changes I have been doing this :
> 
> public  InputStream getResourceStream(String name)....
> 
> return result = servletContext.getResourceAsStream(path);
> 
> but now must use :
> 
> public Reader getResourceReader(String name, String encoding)....
> 
> return result = new BufferedReader(new InputStreamReader(
>                             servletContext.getResourceAsStream(path)));
> 
> Is this the most efficient way to the Reader class?  Seems a lot more
> processing than just the InputStream??
> 
> 
> 
> 
> 
> On 7 November 2016 at 10:06, Claude Brisson <cla...@renegat.net> wrote:
> 
>> The test build of Velocity Engine 2.0 is available.
>>
>> No determination as to the quality ('alpha,' 'beta,' or 'GA') of Velocity
>> Engine 2.0 has been made, and at this time it is simply a "test build". We
>> welcome any comments you may have, and will take all feedback into account
>> if a quality vote is called for this build.
>>
>> Release notes:
>>
>> * https://dist.apache.org/repos/dist/dev/velocity/velocity-eng
>> ine/2.0/release-notes.html
>>
>> Distribution:
>>
>>  * https://dist.apache.org/repos/dist/dev/velocity/velocity-engine/2.0/
>>
>> Maven 2 staging repository:
>>
>>  * https://repository.apache.org/content/repositories/orgapache
>> velocity-1010/
>>
>> A vote regarding the quality of this test build will be initiated within
>> the next couple of days.
>>
>>
>> Regards,
>>
>>   Claude
>>
>>
>>
> 


-- 
Sergiu Dumitriu
http://purl.org/net/sergiu

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
For additional commands, e-mail: user-h...@velocity.apache.org

Reply via email to