You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Steve Cohen <sc...@javactivity.org> on 2008/12/29 01:13:35 UTC
throws Exception ??????
I must admit I am surprised to see that many key methods of Velocity
such as Velocity.init() and Velocity.mergeTemplate() have a signature
includes that includes "throws Exception" which is what I would be
tempted to consider a beginner's mistake. Certainly Joshua Bloch in
"Effective Java" indicates his distaste for the practice and it's
something I always try to avoid in my code.
Can someone explain why Velocity does it this way and an effective
strategy for wrapping this ugliness away someplace?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Re: throws Exception ??????
Posted by Byron Foster <by...@base2.cc>.
Funny, I was just looking at this because I was also bothered by the
fact that many methods throw Exception. I made the changes to remove
Exception but found that the ResourceLoader also throws Exception, and
removing it would break this plugin for existing users (Even though I
doubt it is really used that much). I plan to make the changes, but
It will have to be a 1.7, or 2.0 change.
It looks like there has already been some work that moves Velocity in
the direction of unchecked Exceptions, and removing throwing Exception
would complete it.
On Dec 28, 2008, at 17:29 , Nathan Bubna wrote:
> Suspected initial cause:
> IO code that throws Exception and unwillingness to catch, wrap
> and re-throw
>
> Relevant anecdote:
> Velocity has been around longer than "Effective Java" and is still
> doing b.c. 1.x releases
>
> Current holdup:
> no one has been bothered enough to offer a patch to fix it yet
>
> Possible fixes:
> a patch from you? a 2.x version? enough nagging from you and
> others to get one of us committers to change it? :)
>
> On Sun, Dec 28, 2008 at 4:13 PM, Steve Cohen
> <sc...@javactivity.org> wrote:
>> I must admit I am surprised to see that many key methods of
>> Velocity such as
>> Velocity.init() and Velocity.mergeTemplate() have a signature
>> includes that
>> includes "throws Exception" which is what I would be tempted to
>> consider a
>> beginner's mistake. Certainly Joshua Bloch in "Effective Java"
>> indicates
>> his distaste for the practice and it's something I always try to
>> avoid in my
>> code.
>>
>> Can someone explain why Velocity does it this way and an effective
>> strategy
>> for wrapping this ugliness away someplace?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Re: throws Exception ??????
Posted by Steve Cohen <sc...@javactivity.org>.
OK, thanks. Don't get me wrong, I think Velocity is cool technology and
I knew you guys must have a good reason for doing something like that.
Submit a patch? Maybe some day. I've been a committer before myself
for a couple of Apache projects. But I'm too much of a newbie now. I
want to first get it to work in my app. I'm close but not there yet. :-)
Nathan Bubna wrote:
> Suspected initial cause:
> IO code that throws Exception and unwillingness to catch, wrap and re-throw
>
> Relevant anecdote:
> Velocity has been around longer than "Effective Java" and is still
> doing b.c. 1.x releases
>
> Current holdup:
> no one has been bothered enough to offer a patch to fix it yet
>
> Possible fixes:
> a patch from you? a 2.x version? enough nagging from you and
> others to get one of us committers to change it? :)
>
> On Sun, Dec 28, 2008 at 4:13 PM, Steve Cohen <sc...@javactivity.org> wrote:
>
>> I must admit I am surprised to see that many key methods of Velocity such as
>> Velocity.init() and Velocity.mergeTemplate() have a signature includes that
>> includes "throws Exception" which is what I would be tempted to consider a
>> beginner's mistake. Certainly Joshua Bloch in "Effective Java" indicates
>> his distaste for the practice and it's something I always try to avoid in my
>> code.
>>
>> Can someone explain why Velocity does it this way and an effective strategy
>> for wrapping this ugliness away someplace?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Re: throws Exception ??????
Posted by Nathan Bubna <nb...@gmail.com>.
Suspected initial cause:
IO code that throws Exception and unwillingness to catch, wrap and re-throw
Relevant anecdote:
Velocity has been around longer than "Effective Java" and is still
doing b.c. 1.x releases
Current holdup:
no one has been bothered enough to offer a patch to fix it yet
Possible fixes:
a patch from you? a 2.x version? enough nagging from you and
others to get one of us committers to change it? :)
On Sun, Dec 28, 2008 at 4:13 PM, Steve Cohen <sc...@javactivity.org> wrote:
> I must admit I am surprised to see that many key methods of Velocity such as
> Velocity.init() and Velocity.mergeTemplate() have a signature includes that
> includes "throws Exception" which is what I would be tempted to consider a
> beginner's mistake. Certainly Joshua Bloch in "Effective Java" indicates
> his distaste for the practice and it's something I always try to avoid in my
> code.
>
> Can someone explain why Velocity does it this way and an effective strategy
> for wrapping this ugliness away someplace?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org