Fixed the issues that FindBugs raised

This commit is contained in:
Trustin Lee 2008-11-19 09:15:19 +00:00
parent 4ac032c657
commit c6ce2c3984
5 changed files with 26 additions and 16 deletions

View File

@ -24,6 +24,7 @@ package org.jboss.netty.example.http;
import java.nio.charset.Charset;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
@ -51,8 +52,9 @@ public class HttpRequestHandler extends SimpleChannelHandler {
System.out.println(request.getContent().toString(Charset.defaultCharset().name()));
QueryStringDecoder queryStringDecoder = new QueryStringDecoder(request.getURI());
Map<String, List<String>> params = queryStringDecoder.getParameters();
for (String key : params.keySet()) {
List<String> vals = params.get(key);
for (Entry<String, List<String>> p: params.entrySet()) {
String key = p.getKey();
List<String> vals = p.getValue();
for (String val : vals) {
System.out.println("param: " + key + "=" + val);
}

View File

@ -21,6 +21,7 @@
*/
package org.jboss.netty.handler.codec.http;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@ -113,7 +114,10 @@ public class DefaultHttpMessage implements HttpMessage {
return content;
}
private static class CaseIgnoringComparator implements Comparator<String> {
private static class CaseIgnoringComparator
implements Comparator<String>, Serializable {
private static final long serialVersionUID = 4582133183775373862L;
CaseIgnoringComparator() {
super();

View File

@ -25,35 +25,39 @@ package org.jboss.netty.handler.codec.http;
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Andy Taylor (andy.taylor@jboss.org)
*/
public class HttpCodecUtil {
class HttpCodecUtil {
//space ' '
public static final byte SP = 32;
static final byte SP = 32;
//tab ' '
public static final byte HT = 9;
static final byte HT = 9;
/**
* Carriage return
*/
public static final byte CR = 13;
static final byte CR = 13;
/**
* Equals '='
*/
public static final byte EQUALS = 61;
static final byte EQUALS = 61;
/**
* Line feed character
*/
public static final byte LF = 10;
static final byte LF = 10;
/**
* carriage return line feed
*/
public static final byte[] CRLF = new byte[] { CR, LF };
static final byte[] CRLF = new byte[] { CR, LF };
/**
* Colon ':'
*/
public static final byte COLON = 58;
static final byte COLON = 58;
private HttpCodecUtil() {
super();
}
}

View File

@ -71,12 +71,12 @@ public class QueryStringEncoder {
return s.replaceAll(" ", "%20");
}
class Param {
final String name;
private static class Param {
final String name;
final String value;
public Param(String name, String value) {
Param(String name, String value) {
this.value = value;
this.name = name;
}

View File

@ -128,8 +128,8 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E> implements Blocking
private static final class QNode extends AtomicReference<Object> {
private static final long serialVersionUID = 5925596372370723938L;
volatile QNode next;
volatile Thread waiter; // to control park/unpark
transient volatile QNode next;
transient volatile Thread waiter; // to control park/unpark
final boolean isData;
QNode(Object item, boolean isData) {
super(item);