Skip to content

Commit 2a35937

Browse files
committed
#117 Check Status.getStackDump() is non-empty before use
This check is already used in methods such as BlockingServerTCPTransport#authenticationCompleted.
1 parent 3a32ca5 commit 2a35937

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

pvAccessJava/src/org/epics/pvaccess/client/rpc/RPCClientImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,11 @@ public PVStructure request(PVStructure pvArgument, double timeout)
129129
return result;
130130
else
131131
{
132-
if (status.getStackDump() == null)
133-
throw new RPCRequestException(status.getType(), status.getMessage());
132+
String stackDump = status.getStackDump();
133+
if (stackDump != null && !stackDump.isEmpty())
134+
throw new RPCRequestException(status.getType(), status.getMessage() + ", cause:\n" + stackDump);
134135
else
135-
throw new RPCRequestException(status.getType(), status.getMessage() + ", cause:\n" + status.getStackDump());
136+
throw new RPCRequestException(status.getType(), status.getMessage());
136137
}
137138
}
138139
else

pvAccessJava/src/org/epics/pvaccess/server/impl/remote/rpc/ServerRPCService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,9 @@ public PVStructure execute() throws RPCRequestException {
288288
if (!status.isSuccess())
289289
{
290290
String errorMessage = "failed to fetch channel list: " + status.getMessage();
291-
if (status.getStackDump() != null)
292-
errorMessage += "\n" + status.getStackDump();
291+
String stackDump = status.getStackDump();
292+
if (stackDump != null && !stackDump.isEmpty())
293+
errorMessage += "\n" + stackDump;
293294
throw new RPCRequestException(StatusType.ERROR, errorMessage);
294295
}
295296

0 commit comments

Comments
 (0)