Skip to content

Commit aacf506

Browse files
author
Lucas Bowler
committed
spring-projectsGH-3822: Apply spring-framework code style on modified class
1 parent 452d413 commit aacf506

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/Mqttv5PahoMessageDrivenChannelAdapter.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public class Mqttv5PahoMessageDrivenChannelAdapter extends AbstractMqttMessageDr
9090
public Mqttv5PahoMessageDrivenChannelAdapter(String url, String clientId, String... topic) {
9191
super(url, clientId, topic);
9292
this.connectionOptions = new MqttConnectionOptions();
93-
this.connectionOptions.setServerURIs(new String[]{ url });
93+
this.connectionOptions.setServerURIs(new String[] {url});
9494
this.connectionOptions.setAutomaticReconnect(true);
9595
}
9696

@@ -165,14 +165,17 @@ protected void doStart() {
165165
ApplicationEventPublisher applicationEventPublisher = getApplicationEventPublisher();
166166
try {
167167
this.mqttClient.connect(this.connectionOptions).waitForCompletion(getCompletionTimeout());
168-
} catch (MqttException ex) {
168+
}
169+
catch (MqttException ex) {
169170
if (this.connectionOptions.isAutomaticReconnect()) {
170171
try {
171172
this.mqttClient.reconnect();
172-
} catch (MqttException e) {
173+
}
174+
catch (MqttException e) {
173175
logger.error(ex, "MQTT client failed to connect. Will retry.");
174176
}
175-
} else {
177+
}
178+
else {
176179
if (applicationEventPublisher != null) {
177180
applicationEventPublisher.publishEvent(new MqttConnectionFailedEvent(this, ex));
178181
}

spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/outbound/Mqttv5PahoMessageHandler.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021 the original author or authors.
2+
* Copyright 2021-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -80,7 +80,7 @@ public class Mqttv5PahoMessageHandler extends AbstractMqttMessageHandler
8080
public Mqttv5PahoMessageHandler(String url, String clientId) {
8181
super(url, clientId);
8282
this.connectionOptions = new MqttConnectionOptions();
83-
this.connectionOptions.setServerURIs(new String[]{ url });
83+
this.connectionOptions.setServerURIs(new String[] {url});
8484
this.connectionOptions.setAutomaticReconnect(true);
8585
}
8686

@@ -173,7 +173,8 @@ protected void doStart() {
173173
catch (MqttException e) {
174174
logger.error(ex, "MQTT client failed to connect. Will retry.");
175175
}
176-
} else {
176+
}
177+
else {
177178
ApplicationEventPublisher applicationEventPublisher = getApplicationEventPublisher();
178179
if (applicationEventPublisher != null) {
179180
applicationEventPublisher.publishEvent(new MqttConnectionFailedEvent(this, ex));

spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/Mqttv5BackToBackAutomaticReconnectTests.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@
1616

1717
package org.springframework.integration.mqtt;
1818

19-
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
19+
import static org.assertj.core.api.Assertions.assertThat;
20+
21+
import java.nio.charset.StandardCharsets;
22+
import java.util.ArrayList;
23+
import java.util.List;
24+
2025
import org.eclipse.paho.mqttv5.client.MqttConnectionOptions;
2126
import org.eclipse.paho.mqttv5.client.MqttConnectionOptionsBuilder;
22-
import org.jetbrains.annotations.NotNull;
23-
import org.junit.jupiter.api.Assertions;
2427
import org.junit.jupiter.api.Test;
28+
2529
import org.springframework.beans.factory.annotation.Autowired;
2630
import org.springframework.beans.factory.annotation.Qualifier;
2731
import org.springframework.context.annotation.Bean;
@@ -50,11 +54,7 @@
5054
import org.springframework.test.annotation.DirtiesContext;
5155
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
5256

53-
import java.nio.charset.StandardCharsets;
54-
import java.util.ArrayList;
55-
import java.util.List;
5657

57-
import static org.assertj.core.api.Assertions.assertThat;
5858

5959
/**
6060
* @author Lucas Bowler
@@ -80,7 +80,7 @@ public class Mqttv5BackToBackAutomaticReconnectTests implements MosquittoContain
8080

8181
@Test //GH-3822
8282
public void testReconnectionWhenFirstConnectionFails() throws InterruptedException {
83-
connectionOptions.setServerURIs(new String[]{MosquittoContainerTest.mqttUrl()});
83+
connectionOptions.setServerURIs(new String[] {MosquittoContainerTest.mqttUrl()});
8484
Thread.sleep(2_500);
8585

8686
String testPayload = "foo";
@@ -135,14 +135,14 @@ protected boolean supports(Class<?> clazz) {
135135

136136
@Override
137137
protected Object convertFromInternal(Message<?> message, Class<?> targetClass,
138-
Object conversionHint) {
138+
Object conversionHint) {
139139

140140
return message.getPayload().toString().getBytes(StandardCharsets.UTF_8);
141141
}
142142

143143
@Override
144144
protected Object convertToInternal(Object payload, MessageHeaders headers,
145-
Object conversionHint) {
145+
Object conversionHint) {
146146

147147
return new String((byte[]) payload);
148148
}
@@ -188,7 +188,6 @@ public IntegrationFlow mqttInFlow() {
188188
.get();
189189
}
190190

191-
192191
}
193192

194193
}

0 commit comments

Comments
 (0)