Skip to content

Commit

Permalink
Merge pull request #118 from joeshannon/stackDump-isEmpty
Browse files Browse the repository at this point in the history
#117 Check Status.getStackDump() is non-empty before use
  • Loading branch information
shroffk authored Sep 8, 2021
2 parents 3a32ca5 + 2a35937 commit 71b384b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 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,8 +288,9 @@ public PVStructure execute() throws RPCRequestException {
if (!status.isSuccess())
{
String errorMessage = "failed to fetch channel list: " + status.getMessage();
if (status.getStackDump() != null)
errorMessage += "\n" + status.getStackDump();
String stackDump = status.getStackDump();
if (stackDump != null && !stackDump.isEmpty())
errorMessage += "\n" + stackDump;
throw new RPCRequestException(StatusType.ERROR, errorMessage);
}

Expand Down

0 comments on commit 71b384b

Please sign in to comment.