@@ -224,18 +224,18 @@ public CompletableFuture<Integer> SubscribeToUpdateJobExecutionRejected(
224224 Consumer <RejectedError > handler ,
225225 Consumer <Exception > exceptionHandler ) {
226226 String topic = "$aws/things/{thingName}/jobs/{jobId}/update/rejected" ;
227- if (request .thingName == null ) {
228- CompletableFuture <Integer > result = new CompletableFuture <Integer >();
229- result .completeExceptionally (new MqttException ("UpdateJobExecutionSubscriptionRequest must have a non-null thingName" ));
230- return result ;
231- }
232- topic = topic .replace ("{thingName}" , request .thingName );
233227 if (request .jobId == null ) {
234228 CompletableFuture <Integer > result = new CompletableFuture <Integer >();
235229 result .completeExceptionally (new MqttException ("UpdateJobExecutionSubscriptionRequest must have a non-null jobId" ));
236230 return result ;
237231 }
238232 topic = topic .replace ("{jobId}" , request .jobId );
233+ if (request .thingName == null ) {
234+ CompletableFuture <Integer > result = new CompletableFuture <Integer >();
235+ result .completeExceptionally (new MqttException ("UpdateJobExecutionSubscriptionRequest must have a non-null thingName" ));
236+ return result ;
237+ }
238+ topic = topic .replace ("{thingName}" , request .thingName );
239239 Consumer <MqttMessage > messageHandler = (message ) -> {
240240 try {
241241 String payload = new String (message .getPayload (), StandardCharsets .UTF_8 );
@@ -263,18 +263,18 @@ public CompletableFuture<Integer> SubscribeToUpdateJobExecutionAccepted(
263263 Consumer <UpdateJobExecutionResponse > handler ,
264264 Consumer <Exception > exceptionHandler ) {
265265 String topic = "$aws/things/{thingName}/jobs/{jobId}/update/accepted" ;
266- if (request .thingName == null ) {
267- CompletableFuture <Integer > result = new CompletableFuture <Integer >();
268- result .completeExceptionally (new MqttException ("UpdateJobExecutionSubscriptionRequest must have a non-null thingName" ));
269- return result ;
270- }
271- topic = topic .replace ("{thingName}" , request .thingName );
272266 if (request .jobId == null ) {
273267 CompletableFuture <Integer > result = new CompletableFuture <Integer >();
274268 result .completeExceptionally (new MqttException ("UpdateJobExecutionSubscriptionRequest must have a non-null jobId" ));
275269 return result ;
276270 }
277271 topic = topic .replace ("{jobId}" , request .jobId );
272+ if (request .thingName == null ) {
273+ CompletableFuture <Integer > result = new CompletableFuture <Integer >();
274+ result .completeExceptionally (new MqttException ("UpdateJobExecutionSubscriptionRequest must have a non-null thingName" ));
275+ return result ;
276+ }
277+ topic = topic .replace ("{thingName}" , request .thingName );
278278 Consumer <MqttMessage > messageHandler = (message ) -> {
279279 try {
280280 String payload = new String (message .getPayload (), StandardCharsets .UTF_8 );
@@ -489,18 +489,18 @@ public CompletableFuture<Integer> PublishDescribeJobExecution(
489489 DescribeJobExecutionRequest request ,
490490 QualityOfService qos ) {
491491 String topic = "$aws/things/{thingName}/jobs/{jobId}/get" ;
492- if (request .jobId == null ) {
493- CompletableFuture <Integer > result = new CompletableFuture <Integer >();
494- result .completeExceptionally (new MqttException ("DescribeJobExecutionRequest must have a non-null jobId" ));
495- return result ;
496- }
497- topic = topic .replace ("{jobId}" , request .jobId );
498492 if (request .thingName == null ) {
499493 CompletableFuture <Integer > result = new CompletableFuture <Integer >();
500494 result .completeExceptionally (new MqttException ("DescribeJobExecutionRequest must have a non-null thingName" ));
501495 return result ;
502496 }
503497 topic = topic .replace ("{thingName}" , request .thingName );
498+ if (request .jobId == null ) {
499+ CompletableFuture <Integer > result = new CompletableFuture <Integer >();
500+ result .completeExceptionally (new MqttException ("DescribeJobExecutionRequest must have a non-null jobId" ));
501+ return result ;
502+ }
503+ topic = topic .replace ("{jobId}" , request .jobId );
504504 String payloadJson = gson .toJson (request );
505505 MqttMessage message = new MqttMessage (topic , payloadJson .getBytes (StandardCharsets .UTF_8 ));
506506 return connection .publish (message , qos , false );
0 commit comments