diff --git a/src/main/java/teetime/framework/MonitoringThread.java b/src/main/java/teetime/framework/MonitoringThread.java index 85246bed6d0784cc3b2f9c23d0a72bbf2fe71f2e..45687f8ea0a109fbb8d7f44b3d5574ef138153d7 100644 --- a/src/main/java/teetime/framework/MonitoringThread.java +++ b/src/main/java/teetime/framework/MonitoringThread.java @@ -37,12 +37,12 @@ public class MonitoringThread extends Thread { while (!terminated) { for (final AbstractPort<?> port : monitoredPorts) { - IMonitorablePipe pipe = (IMonitorablePipe) port.getPipe(); - final long pushThroughput = pipe.getPushThroughput(); - final long pullThroughput = pipe.getPullThroughput(); - final double ratio = (double) pushThroughput / pullThroughput; if (LOGGER.isInfoEnabled()) { + IMonitorablePipe pipe = (IMonitorablePipe) port.getPipe(); + final long pushThroughput = pipe.getPushThroughput(); + final long pullThroughput = pipe.getPullThroughput(); + final double ratio = (double) pushThroughput / pullThroughput; LOGGER.info("pipe: " + "size=" + pipe.size() + ", " + "ratio: " + String.format("%.1f", ratio)); LOGGER.info("pushes: " + pushThroughput); LOGGER.info("pulls: " + pullThroughput); diff --git a/src/main/java/teetime/framework/exceptionHandling/AbstractExceptionListener.java b/src/main/java/teetime/framework/exceptionHandling/AbstractExceptionListener.java index 80ff5314ecbbca89b39a5703ed7eda8db3b5a83e..696aaef91791f52fca16013d87932b9c107f79a8 100644 --- a/src/main/java/teetime/framework/exceptionHandling/AbstractExceptionListener.java +++ b/src/main/java/teetime/framework/exceptionHandling/AbstractExceptionListener.java @@ -41,7 +41,7 @@ public abstract class AbstractExceptionListener { /** * The default logger, which can be used by all subclasses */ - protected final Logger logger; + protected final Logger logger; // NOPMD can't be static as it needs to be initialized in cstr protected AbstractExceptionListener(final boolean shouldLogExceptions) { this.logger = LoggerFactory.getLogger(this.getClass().getCanonicalName()); diff --git a/src/main/java/teetime/stage/io/AbstractTcpReaderStage.java b/src/main/java/teetime/stage/io/AbstractTcpReaderStage.java index dc4c4348584ba1d1f08c5284e7d017a0be8762a6..2547c2e4ecda02184c7585c488d681e2fac786ac 100644 --- a/src/main/java/teetime/stage/io/AbstractTcpReaderStage.java +++ b/src/main/java/teetime/stage/io/AbstractTcpReaderStage.java @@ -37,12 +37,13 @@ public abstract class AbstractTcpReaderStage<T> extends AbstractProducerStage<T> @Override protected void execute() { - ServerSocketChannel serversocket = null; + ServerSocketChannel serversocket = null; // NOPMD try { serversocket = ServerSocketChannel.open(); serversocket.socket().bind(new InetSocketAddress(this.port)); - logger.debug("Listening on port " + this.port); - + if (logger.isDebugEnabled()) { + logger.debug("Listening on port " + this.port); + } final SocketChannel socketChannel = serversocket.accept(); try { final ByteBuffer buffer = ByteBuffer.allocateDirect(bufferCapacity); @@ -55,7 +56,7 @@ public abstract class AbstractTcpReaderStage<T> extends AbstractProducerStage<T> } catch (final IOException ex) { logger.error("Error while reading.", ex); } finally { - if (null != serversocket) { + if (serversocket != null) { try { serversocket.close(); } catch (final IOException e) { @@ -90,7 +91,8 @@ public abstract class AbstractTcpReaderStage<T> extends AbstractProducerStage<T> /** * @param buffer * to be read from - * @return <ul> + * @return + * <ul> * <li><code>true</code> when there were enough bytes to perform the read operation * <li><code>false</code> otherwise. In this case, the buffer is reset, compacted, and filled with new content. * </ul> diff --git a/src/main/java/teetime/stage/xml/LoadXMLToDocumentStage.java b/src/main/java/teetime/stage/xml/LoadXMLToDocumentStage.java index 219ad7d5b45bacd9498a339154042874228d7769..ded2189eb2e19db20ea544b0060427886c8b77f4 100644 --- a/src/main/java/teetime/stage/xml/LoadXMLToDocumentStage.java +++ b/src/main/java/teetime/stage/xml/LoadXMLToDocumentStage.java @@ -41,11 +41,11 @@ public class LoadXMLToDocumentStage extends AbstractTransformation<String, Docum @Override protected void execute(final String filename) { File file = new File(filename); - Document document = null; + Document document; try { DocumentBuilder documentBuilder = factory.newDocumentBuilder(); - document = documentBuilder.parse(file); + document = documentBuilder.parse(file); // NOPMD DU-Anomaly: must remain in try-scope } catch (ParserConfigurationException e) { // parser cannot be build throw new IllegalStateException(e);