Some changes after running Findbugs.

This commit is contained in:
FrozenCow 2011-03-05 16:09:26 +01:00
parent b0c84234cc
commit 8d70839d3b
10 changed files with 39 additions and 22 deletions

View file

@ -115,6 +115,8 @@ public class HttpServerConnection extends Thread {
public void run() {
try {
if (socket == null)
return;
socket.setSoTimeout(5000);
InputStream in = socket.getInputStream();
BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream(), 40960);
@ -178,8 +180,10 @@ public class HttpServerConnection extends Thread {
return;
}
if (bound > 0) {
boundBody.skip(bound);
if (bound > 0 && boundBody.skip(bound) < bound) {
Debug.debug("Incoming stream was only read partially by handler '" + handler + "'.");
//socket.close();
//return;
}
String connection = response.fields.get("Connection");

View file

@ -3,8 +3,10 @@ package org.dynmap.web;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.security.KeyStore.Entry;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class Json {
public static String stringifyJson(Object o) {
@ -26,15 +28,15 @@ public class Json {
LinkedHashMap<?, ?> m = (LinkedHashMap<?, ?>) o;
s.append("{");
boolean first = true;
for (Object key : m.keySet()) {
for (Map.Entry<?, ?> entry : m.entrySet()) {
if (first)
first = false;
else
s.append(",");
appendJson(key, s);
appendJson(entry.getKey(), s);
s.append(": ");
appendJson(m.get(key), s);
appendJson(entry.getValue(), s);
}
s.append("}");
} else if (o instanceof List<?>) {

View file

@ -30,7 +30,7 @@ public class ClientUpdateHandler implements HttpHandler {
this.server = server;
}
Pattern updatePathPattern = Pattern.compile("world/([a-zA-Z0-9_-\\.]+)/([0-9]*)");
Pattern updatePathPattern = Pattern.compile("world/([a-zA-Z0-9_\\-\\.]+)/([0-9]*)");
private static final HttpStatus WorldNotFound = new HttpStatus(HttpStatus.NotFound.getCode(), "World Not Found");
@Override
public void handle(String path, HttpRequest request, HttpResponse response) throws Exception {

View file

@ -39,7 +39,7 @@ public class SendMessageHandler implements HttpHandler {
response.status = HttpStatus.OK;
response.getBody();
}
public class Message {
public static class Message {
public String name;
public String message;
}