|
20 | 20 | * Thread-Safety: Single thread. |
21 | 21 | */ |
22 | 22 | public class JavaWorkerClient implements AutoCloseable { |
| 23 | + private static final Logger logger = Logger.getLogger(JavaWorkerClient.class.getName()); |
| 24 | + |
23 | 25 | public JavaWorkerClient(IApplication app) { |
24 | 26 | WorkerLogManager.initialize(this, app.logToConsole()); |
25 | 27 | ManagedChannelBuilder<?> chanBuilder = ManagedChannelBuilder.forAddress(app.getHost(), app.getPort()).usePlaintext(); |
@@ -101,18 +103,23 @@ public void onNext(StreamingMessage message) { |
101 | 103 |
|
102 | 104 | @Override |
103 | 105 | public void onError(Throwable t) { |
104 | | - Logger logger = Logger.getLogger(JavaWorkerClient.class.getName()); |
105 | 106 | String statusCode = "Unknown"; |
106 | 107 | String statusDescription = t.getMessage(); |
107 | 108 |
|
108 | 109 | if (t instanceof io.grpc.StatusRuntimeException) { |
109 | 110 | io.grpc.StatusRuntimeException sre = (io.grpc.StatusRuntimeException) t; |
110 | 111 | statusCode = sre.getStatus().getCode().name(); |
111 | | - statusDescription = sre.getStatus().getDescription(); |
| 112 | + String description = sre.getStatus().getDescription(); |
| 113 | + if (description != null) { |
| 114 | + statusDescription = description; |
| 115 | + } |
112 | 116 | } else if (t instanceof io.grpc.StatusException) { |
113 | 117 | io.grpc.StatusException se = (io.grpc.StatusException) t; |
114 | 118 | statusCode = se.getStatus().getCode().name(); |
115 | | - statusDescription = se.getStatus().getDescription(); |
| 119 | + String description = se.getStatus().getDescription(); |
| 120 | + if (description != null) { |
| 121 | + statusDescription = description; |
| 122 | + } |
116 | 123 | } |
117 | 124 |
|
118 | 125 | logger.severe(String.format( |
|
0 commit comments