D
dannyDog
I've started working on a new project using Eclipse. When I do a build
I get multiple warnings stating "finally block does not complete
normally".
A sample method follows:
/**
* Property getter for destination type
* @return type
*/
public String getDestinationType()
{
String destType = "SCHOOL_DISTRICT";
try
{
destType = this.getReceiving().getDestinationType();
if (destType.length() == 0)
{
destType = "SCHOOL_DISTRICT";
}
}
catch (Exception e)
{
destType = "SCHOOL_DISTRICT";
}
finally
{
return destType;
}
}
This type of coding of returning the return value in the finally block
is in many, many, many methods over many, many, many classes.
What is the correct way to code try/catch/finally return value?
I get multiple warnings stating "finally block does not complete
normally".
A sample method follows:
/**
* Property getter for destination type
* @return type
*/
public String getDestinationType()
{
String destType = "SCHOOL_DISTRICT";
try
{
destType = this.getReceiving().getDestinationType();
if (destType.length() == 0)
{
destType = "SCHOOL_DISTRICT";
}
}
catch (Exception e)
{
destType = "SCHOOL_DISTRICT";
}
finally
{
return destType;
}
}
This type of coding of returning the return value in the finally block
is in many, many, many methods over many, many, many classes.
What is the correct way to code try/catch/finally return value?