Re: finally block does not complete normally - Eclipse



"JaMess" <JaMess@xxxxxxxxx> wrote in
news:1117570533.9c81424faa7c755ad6ba49b3a5932f58@xxxxxxxxxxx
> Anyway, I would write it like this:
>
> /**
> * Property getter for destination type
> * @return type
> */
> public String getDestinationType() {
> String destType = null;
> try {
> destType = this.getReceiving().getDestinationType();
> }catch (Exception e){}
> if(destType == null || destType.length() == 0) {
> destType = "SCHOOL_DISTRICT";
> }
> return destType;
> }

A general exception thrown has usually a reason behind it.
At least you should do something to inform the user, that
something bad did just happen. The snippet

catch( Exception e ) {
e.printStackTrace();
}

is the minimum I would do here. Anyway, if the called code
could throw a specific (and thus a wanted) exception (such
as IOException) I would try to catch it.

Just my 2 cents.


Erik.


.