Skip to content

Commit

Permalink
epics-base#117 Check Status.getStackDump() is non-empty before use
Browse files Browse the repository at this point in the history
This check is already used in methods such as
BlockingServerTCPTransport#authenticationCompleted.
  • Loading branch information
joeshannon committed Sep 6, 2021
1 parent 3a32ca5 commit b6aa5a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@ public PVStructure request(PVStructure pvArgument, double timeout)
return result;
else
{
if (status.getStackDump() == null)
throw new RPCRequestException(status.getType(), status.getMessage());
String stackDump = status.getStackDump();
if (stackDump != null && !stackDump.isEmpty())
throw new RPCRequestException(status.getType(), status.getMessage() + ", cause:\n" + stackDump);
else
throw new RPCRequestException(status.getType(), status.getMessage() + ", cause:\n" + status.getStackDump());
throw new RPCRequestException(status.getType(), status.getMessage());
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ public PVStructure execute() throws RPCRequestException {
if (!status.isSuccess())
{
String errorMessage = "failed to fetch channel list: " + status.getMessage();
if (status.getStackDump() != null)
String stackDump = status.getStackDump();
if (stackDump != null && !stackDump.isEmpty())
errorMessage += "\n" + status.getStackDump();
throw new RPCRequestException(StatusType.ERROR, errorMessage);
}
Expand Down

0 comments on commit b6aa5a8

Please sign in to comment.