aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml2
-rw-r--r--core/src/main/java/fi/iki/elonen/NanoHTTPD.java45
-rw-r--r--markdown-plugin/src/main/java/fi/iki/elonen/MarkdownWebServerPlugin.java2
-rw-r--r--pom.xml78
-rw-r--r--samples/src/main/java/fi/iki/elonen/HelloServer.java2
-rw-r--r--src/main/checkstyle/nanohttpd-style.xml20
-rw-r--r--webserver/src/main/java/fi/iki/elonen/ServerRunner.java2
-rw-r--r--websocket/src/main/java/fi/iki/elonen/NanoWebSocketServer.java2
-rw-r--r--websocket/src/main/java/fi/iki/elonen/samples/echo/DebugWebSocketServer.java2
9 files changed, 92 insertions, 63 deletions
diff --git a/.travis.yml b/.travis.yml
index a24f7f5..b36965e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,4 +8,4 @@ install:
script: mvn test
after_success:
- - mvn clean cobertura:cobertura coveralls:report \ No newline at end of file
+ - mvn clean test jacoco:report coveralls:report \ No newline at end of file
diff --git a/core/src/main/java/fi/iki/elonen/NanoHTTPD.java b/core/src/main/java/fi/iki/elonen/NanoHTTPD.java
index 06afeb9..08b64c6 100644
--- a/core/src/main/java/fi/iki/elonen/NanoHTTPD.java
+++ b/core/src/main/java/fi/iki/elonen/NanoHTTPD.java
@@ -588,29 +588,28 @@ public abstract class NanoHTTPD {
byte[] buf = new byte[HTTPSession.BUFSIZE];
this.splitbyte = 0;
this.rlen = 0;
- {
- int read = -1;
- try {
- read = this.inputStream.read(buf, 0, HTTPSession.BUFSIZE);
- } catch (Exception e) {
- safeClose(this.inputStream);
- safeClose(this.outputStream);
- throw new SocketException("NanoHttpd Shutdown");
- }
- if (read == -1) {
- // socket was been closed
- safeClose(this.inputStream);
- safeClose(this.outputStream);
- throw new SocketException("NanoHttpd Shutdown");
- }
- while (read > 0) {
- this.rlen += read;
- this.splitbyte = findHeaderEnd(buf, this.rlen);
- if (this.splitbyte > 0) {
- break;
- }
- read = this.inputStream.read(buf, this.rlen, HTTPSession.BUFSIZE - this.rlen);
+
+ int read = -1;
+ try {
+ read = this.inputStream.read(buf, 0, HTTPSession.BUFSIZE);
+ } catch (Exception e) {
+ safeClose(this.inputStream);
+ safeClose(this.outputStream);
+ throw new SocketException("NanoHttpd Shutdown");
+ }
+ if (read == -1) {
+ // socket was been closed
+ safeClose(this.inputStream);
+ safeClose(this.outputStream);
+ throw new SocketException("NanoHttpd Shutdown");
+ }
+ while (read > 0) {
+ this.rlen += read;
+ this.splitbyte = findHeaderEnd(buf, this.rlen);
+ if (this.splitbyte > 0) {
+ break;
}
+ read = this.inputStream.read(buf, this.rlen, HTTPSession.BUFSIZE - this.rlen);
}
if (this.splitbyte < this.rlen) {
@@ -1310,7 +1309,7 @@ public abstract class NanoHTTPD {
/**
* logger to log to.
*/
- private static Logger LOG = Logger.getLogger(NanoHTTPD.class.getName());
+ private static final Logger LOG = Logger.getLogger(NanoHTTPD.class.getName());
/**
* Creates an SSLSocketFactory for HTTPS. Pass a loaded KeyStore and an
diff --git a/markdown-plugin/src/main/java/fi/iki/elonen/MarkdownWebServerPlugin.java b/markdown-plugin/src/main/java/fi/iki/elonen/MarkdownWebServerPlugin.java
index 823dd92..43d081c 100644
--- a/markdown-plugin/src/main/java/fi/iki/elonen/MarkdownWebServerPlugin.java
+++ b/markdown-plugin/src/main/java/fi/iki/elonen/MarkdownWebServerPlugin.java
@@ -53,7 +53,7 @@ public class MarkdownWebServerPlugin implements WebServerPlugin {
/**
* logger to log to.
*/
- private static Logger LOG = Logger.getLogger(MarkdownWebServerPlugin.class.getName());
+ private static final Logger LOG = Logger.getLogger(MarkdownWebServerPlugin.class.getName());
private final PegDownProcessor processor;
diff --git a/pom.xml b/pom.xml
index 38ec306..352fd73 100644
--- a/pom.xml
+++ b/pom.xml
@@ -206,11 +206,6 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.13</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
@@ -219,17 +214,43 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <version>2.7</version>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.7.4.201502262128</version>
+ <executions>
+ <execution>
+ <id>default-prepare-agent</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>default-report</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ </execution>
+<!-- <execution> -->
+<!-- <id>default-check</id> -->
+<!-- <goals> -->
+<!-- <goal>check</goal> -->
+<!-- </goals> -->
+<!-- </execution> -->
+ </executions>
<configuration>
- <formats>
- <format>html</format>
- <format>xml</format>
- </formats>
- <maxmem>256m</maxmem>
- <!-- aggregated reports for multi-module projects -->
- <aggregate>true</aggregate>
+<!-- <rules> -->
+<!-- <rule implementation="org.jacoco.maven.RuleConfiguration"> -->
+<!-- <element>BUNDLE</element> -->
+<!-- <limits> -->
+<!-- <limit implementation="org.jacoco.report.check.Limit"> -->
+<!-- <counter>COMPLEXITY</counter> -->
+<!-- <value>COVEREDRATIO</value> -->
+<!-- <minimum>0.40</minimum> -->
+<!-- </limit> -->
+<!-- </limits> -->
+<!-- </rule> -->
+<!-- </rules> -->
</configuration>
</plugin>
<plugin>
@@ -312,9 +333,9 @@
<version>3.0.0</version>
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <version>2.7</version>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.7.4.201502262128</version>
</plugin>
</plugins>
</reporting>
@@ -364,6 +385,19 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.15</version>
+ <configuration>
+ <configLocation>${project.basedir}/../src/main/checkstyle/nanohttpd-style.xml</configLocation>
+ <suppressionsLocation>${project.basedir}/../src/main/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
+ <encoding>UTF-8</encoding>
+ <consoleOutput>true</consoleOutput>
+ <failsOnError>false</failsOnError>
+ <linkXRef>true</linkXRef>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>com.googlecode.maven-java-formatter-plugin</groupId>
<artifactId>maven-java-formatter-plugin</artifactId>
<version>0.4</version>
@@ -386,14 +420,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.15</version>
- <configuration>
- <configLocation>${project.basedir}/../src/main/checkstyle/nanohttpd-style.xml</configLocation>
- <suppressionsFileExpression>${project.basedir}/../src/main/checkstyle/checkstyle-suppressions.xml</suppressionsFileExpression>
- <encoding>UTF-8</encoding>
- <consoleOutput>true</consoleOutput>
- <failsOnError>false</failsOnError>
- <linkXRef>true</linkXRef>
- </configuration>
<reportSets>
<reportSet>
<reports>
diff --git a/samples/src/main/java/fi/iki/elonen/HelloServer.java b/samples/src/main/java/fi/iki/elonen/HelloServer.java
index a01d9a8..7b8c9f0 100644
--- a/samples/src/main/java/fi/iki/elonen/HelloServer.java
+++ b/samples/src/main/java/fi/iki/elonen/HelloServer.java
@@ -44,7 +44,7 @@ public class HelloServer extends NanoHTTPD {
/**
* logger to log to.
*/
- private static Logger LOG = Logger.getLogger(HelloServer.class.getName());
+ private static final Logger LOG = Logger.getLogger(HelloServer.class.getName());
public HelloServer() {
super(8080);
diff --git a/src/main/checkstyle/nanohttpd-style.xml b/src/main/checkstyle/nanohttpd-style.xml
index f751504..038ca32 100644
--- a/src/main/checkstyle/nanohttpd-style.xml
+++ b/src/main/checkstyle/nanohttpd-style.xml
@@ -15,10 +15,6 @@
<!-- If you set the basedir property below, then all reported file names will be relative to the specified directory. See http://checkstyle.sourceforge.net/5.x/config.html#Checker
<property name="basedir" value="${basedir}"/> -->
- <!-- Checks that a package-info.java file exists for each package. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
- <module name="JavadocPackage" />
-
<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile" />
@@ -47,10 +43,18 @@
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
- <module name="JavadocMethod" />
- <module name="JavadocType" />
- <module name="JavadocVariable" />
- <module name="JavadocStyle" />
+ <module name="JavadocMethod" >
+ <property name="scope" value="protected" />
+ </module>
+ <module name="JavadocType" >
+ <property name="scope" value="protected" />
+ </module>
+ <module name="JavadocVariable" >
+ <property name="scope" value="protected" />
+ </module>
+ <module name="JavadocStyle" >
+ <property name="scope" value="protected" />
+ </module>
<!-- Checks for Naming Conventions. -->
diff --git a/webserver/src/main/java/fi/iki/elonen/ServerRunner.java b/webserver/src/main/java/fi/iki/elonen/ServerRunner.java
index bfc831c..d08eb01 100644
--- a/webserver/src/main/java/fi/iki/elonen/ServerRunner.java
+++ b/webserver/src/main/java/fi/iki/elonen/ServerRunner.java
@@ -42,7 +42,7 @@ public class ServerRunner {
/**
* logger to log to.
*/
- private static Logger LOG = Logger.getLogger(ServerRunner.class.getName());
+ private static final Logger LOG = Logger.getLogger(ServerRunner.class.getName());
public static void executeInstance(NanoHTTPD server) {
try {
diff --git a/websocket/src/main/java/fi/iki/elonen/NanoWebSocketServer.java b/websocket/src/main/java/fi/iki/elonen/NanoWebSocketServer.java
index 8fc38f7..5cac407 100644
--- a/websocket/src/main/java/fi/iki/elonen/NanoWebSocketServer.java
+++ b/websocket/src/main/java/fi/iki/elonen/NanoWebSocketServer.java
@@ -708,7 +708,7 @@ public abstract class NanoWebSocketServer extends NanoHTTPD {
/**
* logger to log to.
*/
- private static Logger LOG = Logger.getLogger(NanoWebSocketServer.class.getName());
+ private static final Logger LOG = Logger.getLogger(NanoWebSocketServer.class.getName());
public static final String HEADER_UPGRADE = "upgrade";
diff --git a/websocket/src/main/java/fi/iki/elonen/samples/echo/DebugWebSocketServer.java b/websocket/src/main/java/fi/iki/elonen/samples/echo/DebugWebSocketServer.java
index b477bb8..8f6aa78 100644
--- a/websocket/src/main/java/fi/iki/elonen/samples/echo/DebugWebSocketServer.java
+++ b/websocket/src/main/java/fi/iki/elonen/samples/echo/DebugWebSocketServer.java
@@ -47,7 +47,7 @@ public class DebugWebSocketServer extends NanoWebSocketServer {
/**
* logger to log to.
*/
- private static Logger LOG = Logger.getLogger(DebugWebSocketServer.class.getName());
+ private static final Logger LOG = Logger.getLogger(DebugWebSocketServer.class.getName());
private final boolean debug;