Skip to content

Commit 7d9ed5d

Browse files
committed
Checkstyle: common coding problems.
Some hashes probably need to be reviewed.
1 parent 1fc561b commit 7d9ed5d

5 files changed

Lines changed: 28 additions & 11 deletions

File tree

src/main/java/com/github/dockerjava/api/model/Ports.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
* @see HostConfig#getPortBindings()
3434
* @see NetworkSettings#getPorts()
3535
*/
36+
@SuppressWarnings(value = "checkstyle:equalshashcode") //FIXME?
3637
@JsonDeserialize(using = Ports.Deserializer.class)
3738
@JsonSerialize(using = Ports.Serializer.class)
3839
public class Ports {

src/main/java/com/github/dockerjava/core/NameParser.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.github.dockerjava.api.model.AuthConfig;
1313
import com.github.dockerjava.core.exception.InvalidRepositoryNameException;
1414

15+
@SuppressWarnings(value = "checkstyle:equalshashcode")
1516
public class NameParser {
1617
//CHECKSTYLE:OFF
1718
private static final int RepositoryNameTotalLengthMax = 255;

src/main/java/com/github/dockerjava/jaxrs/filter/LoggingFilter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public int compare(final Map.Entry<String, List<String>> o1, final Map.Entry<Str
109109
@SuppressWarnings("NonConstantLogger")
110110
private final Logger logger;
111111

112-
private final AtomicLong id = new AtomicLong(0);
112+
private final AtomicLong aid = new AtomicLong(0);
113113

114114
private final Boolean printEntity;
115115

@@ -227,7 +227,7 @@ private InputStream logInboundEntity(final StringBuilder b, InputStream stream)
227227

228228
@Override
229229
public void filter(final ClientRequestContext context) throws IOException {
230-
final long id = this.id.incrementAndGet();
230+
final long id = aid.incrementAndGet();
231231
final StringBuilder b = new StringBuilder();
232232

233233
printRequestLine(b, "Sending client request", id, context.getMethod(), context.getUri());
@@ -246,7 +246,7 @@ public void filter(final ClientRequestContext context) throws IOException {
246246
@Override
247247
public void filter(final ClientRequestContext requestContext, final ClientResponseContext responseContext)
248248
throws IOException {
249-
final long id = this.id.incrementAndGet();
249+
final long id = aid.incrementAndGet();
250250
final StringBuilder b = new StringBuilder();
251251

252252
printResponseLine(b, "Client response received", id, responseContext.getStatus());
@@ -261,7 +261,7 @@ public void filter(final ClientRequestContext requestContext, final ClientRespon
261261

262262
@Override
263263
public void filter(final ContainerRequestContext context) throws IOException {
264-
final long id = this.id.incrementAndGet();
264+
final long id = aid.incrementAndGet();
265265
final StringBuilder b = new StringBuilder();
266266

267267
printRequestLine(b, "Server has received a request", id, context.getMethod(), context.getUriInfo()
@@ -278,7 +278,7 @@ public void filter(final ContainerRequestContext context) throws IOException {
278278
@Override
279279
public void filter(final ContainerRequestContext requestContext, final ContainerResponseContext responseContext)
280280
throws IOException {
281-
final long id = this.id.incrementAndGet();
281+
final long id = aid.incrementAndGet();
282282
final StringBuilder b = new StringBuilder();
283283

284284
printResponseLine(b, "Server responded with a response", id, responseContext.getStatus());

src/main/java/com/github/dockerjava/netty/DockerCmdExecFactoryImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,15 @@ private interface NettyInitializer {
205205
private class UnixDomainSocketInitializer implements NettyInitializer {
206206
@Override
207207
public EventLoopGroup init(Bootstrap bootstrap, DockerClientConfig dockerClientConfig) {
208-
EventLoopGroup eventLoopGroup = new EpollEventLoopGroup();
209-
bootstrap.group(eventLoopGroup).channel(EpollDomainSocketChannel.class)
208+
EventLoopGroup epollEventLoopGroup = new EpollEventLoopGroup();
209+
bootstrap.group(epollEventLoopGroup).channel(EpollDomainSocketChannel.class)
210210
.handler(new ChannelInitializer<UnixChannel>() {
211211
@Override
212212
protected void initChannel(final UnixChannel channel) throws Exception {
213213
channel.pipeline().addLast(new HttpClientCodec());
214214
}
215215
});
216-
return eventLoopGroup;
216+
return epollEventLoopGroup;
217217
}
218218

219219
@Override
@@ -225,15 +225,15 @@ public Channel connect(Bootstrap bootstrap) throws InterruptedException {
225225
private class InetSocketInitializer implements NettyInitializer {
226226
@Override
227227
public EventLoopGroup init(Bootstrap bootstrap, final DockerClientConfig dockerClientConfig) {
228-
EventLoopGroup eventLoopGroup = new NioEventLoopGroup();
228+
EventLoopGroup nioEventLoopGroup = new NioEventLoopGroup();
229229

230230
InetAddress addr = InetAddress.getLoopbackAddress();
231231

232232
final SocketAddress proxyAddress = new InetSocketAddress(addr, 8008);
233233

234234
Security.addProvider(new BouncyCastleProvider());
235235

236-
bootstrap.group(eventLoopGroup).channel(NioSocketChannel.class)
236+
bootstrap.group(nioEventLoopGroup).channel(NioSocketChannel.class)
237237
.handler(new ChannelInitializer<SocketChannel>() {
238238
@Override
239239
protected void initChannel(final SocketChannel channel) throws Exception {
@@ -243,7 +243,7 @@ protected void initChannel(final SocketChannel channel) throws Exception {
243243
}
244244
});
245245

246-
return eventLoopGroup;
246+
return nioEventLoopGroup;
247247
}
248248

249249
@Override

src/test/resources/checkstyle/checkstyle-config.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,21 @@
132132
</module>
133133
<module name="RightCurly"/>
134134

135+
<!-- Checks for common coding problems -->
136+
<!-- See http://checkstyle.sf.net/config_coding.html -->
137+
<!--<module name="AvoidInlineConditionals"/>-->
138+
<module name="EmptyStatement"/>
139+
<module name="EqualsHashCode"/>
140+
<module name="HiddenField">
141+
<property name="tokens" value="VARIABLE_DEF"/>
142+
</module>
143+
<module name="IllegalInstantiation"/>
144+
<module name="InnerAssignment"/>
145+
<!--<module name="MagicNumber"/>-->
146+
<!-- upto @marcusline -->
147+
<!--<module name="MissingSwitchDefault"/>-->
148+
<module name="SimplifyBooleanExpression"/>
149+
<module name="SimplifyBooleanReturn"/>
135150

136151
</module>
137152

0 commit comments

Comments
 (0)