|
From: Bob K. <py...@ce...> - 2004-04-01 07:37:10
|
Thanks for your suggestion. However I cannot get out the different on
adding the return statement.
The rough logic flow of MessageServer.getMessageStatus() is as following
String[] getMessageStatus() {
// ... set all things null
try {
// do some query.
if (!resultSet.next()) {
//return error status.
} else {
//set those response...
// <- where you suggest on adding the return statement.
}
} catch (MessageServerException e) {
//mark down exception
} catch (Exception e) {
//mark down exception
} finally {
//throw exception
}
return new String[] {status, timestamp, cpaid, conversationId,
service, action};
}
I cannot figure out the different if there exist/doesn't exist the
return statement, since if it flows to the else part, it will finally
flow to the last return statement.
Regards,
Bob Koon
Yerubandi Rao wrote:
>All,
>with the build from the latest cvs source code , i found out that StatusRequest is not working as intended. i think i have figured out the problem .
>i am including a patch for the fix .
>
>
>Index: MessageServer.java
>===================================================================
>retrieving revision 1.149
>diff -u -r1.149 MessageServer.java
>--- MessageServer.java 10 Feb 2004 03:12:52 -0000 1.149
>+++ MessageServer.java 1 Apr 2004 01:19:18 -0000
>@@ -1969,7 +1969,13 @@
> status = Constants.STATUS_PROCESSED;
> } else {
> status = Constants.STATUS_UN_AUTHORIZED;
>- }
>+ }
>+ // local variables ( status, timestamp, cpaId, conversationId, service, action)
>+ // are initialized in this block and a return is being made outside the block,
>+ // .. so if the below return statement is not present , always String[] of nulls will be
>+ // returned and the correct StatusResponse will not be generated
>+ return new String[]{status, timestamp, cpaId, conversationId,
>+ service, action};
> }
> } catch (MessageServerException e) {
> exception = e;
>@@ -1993,8 +1999,8 @@
> if (exception != null) {
> throw new MessageServerException(exception.getMessage());
> }
>-
>- logger.debug("<= MessageServer.getMessageStatus");
>+
>+ logger.debug("<= MessageServer.getMessageStatus");
> }
> return new String[]{status, timestamp, cpaId, conversationId,
> service, action};
> <<MessageServerPatch>>
>
>-Venkat
>
>
|