velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nbu...@gmail.com>
Subject Re: Trouble finding velocity.properties in a jar
Date Thu, 21 Jul 2011 18:17:33 GMT
On Thu, Jul 21, 2011 at 11:04 AM, Christopher Schultz
<chris@christopherschultz.net> wrote:
> Nathan,
>
> On 7/21/2011 1:36 PM, Nathan Bubna wrote:
>> On Thu, Jul 21, 2011 at 10:31 AM, Christopher Schultz
>> <chris@christopherschultz.net> wrote:
>>> Dave,
>>>
>>> On 7/21/2011 12:37 PM, laredotornado wrote:
>>>>               final InputStream resourceStream =
>>>> Thread.currentThread().getContextClassLoader().getResourceAsStream("velocity.properties");
>>>
>>> Should that have a leading "/" in the path?
>>>
>>>> The above dies because the "resourceStream" is null.  Any ideas how I
>>>> reference this file?  Keep in mind that it is packaged within the JAR.
>>>
>>> If you have an exotic ClassLoader hierarchy, you may be getting the
>>> wrong ClassLoader -- one that isn't expecting to load yourjar.jar or
>>> have one of it's parent ClassLoaders do it.
>>>
>>> Nathan's suggestion to try CurrentClass.class.getResourceAsStream after
>>> CurrentClass.class.getClassLoader.getResourceAsStream just makes your
>>> code harder to read and doesn't add anything: Class.getResourceAsStream
>>> already delegates to Class.getClassLoader.getResourceAsStream.
>>
>> i've wondered about that, but never bothered to investigate.
>
> I just read the Javadoc, not the source.
>
>> i
>> cribbed that code from Tools' ClassUtils class, which i derived from
>> somebody else's apparently redundant code.  wanna change ClassUtils to
>> remove the redundancy? :)
>
> Sure, why not. I've had more action today in the velocity repo than my
> previous 5 years as a committer.

:)

> The diffs between 2.0 and 2.0.x are pretty thin, but 2.0 went out on
> 2010-05-10. Maybe time to think about 2.0.1?

sure.  i'd be willing to walk you through it and help where needed. :)

> -chris
>
>

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


Mime
View raw message