Index: src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java =================================================================== --- src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java (revision 1612) +++ src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java (working copy) @@ -1,14 +1,13 @@ package ch.qos.logback.access.jetty; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; - +import ch.qos.logback.access.spi.ServerAdapter; import org.mortbay.jetty.HttpFields; import org.mortbay.jetty.Request; import org.mortbay.jetty.Response; -import ch.qos.logback.access.spi.ServerAdapter; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; /** * A jetty specific implementation of the {@link ServerAdapter} interface. @@ -35,7 +34,7 @@ } - public Map builResponseHeaderMap() { + public Map buildResponseHeaderMap() { Map responseHeaderMap = new HashMap(); HttpFields httpFields = response.getHttpFields(); Enumeration e = httpFields.getFieldNames(); Index: src/main/java/ch/qos/logback/access/spi/AccessEvent.java =================================================================== --- src/main/java/ch/qos/logback/access/spi/AccessEvent.java (revision 1612) +++ src/main/java/ch/qos/logback/access/spi/AccessEvent.java (working copy) @@ -340,50 +340,52 @@ return requestContent; } - if (Util.isFormUrlEncoded(httpRequest)) { - StringBuffer buf = new StringBuffer(); + if(httpRequest != null) { + if (Util.isFormUrlEncoded(httpRequest)) { + StringBuffer buf = new StringBuffer(); - Enumeration pramEnumeration = httpRequest.getParameterNames(); + Enumeration pramEnumeration = httpRequest.getParameterNames(); - // example: id=1234&user=cgu - // number=1233&x=1 - int count = 0; - try { - while (pramEnumeration.hasMoreElements()) { + // example: id=1234&user=cgu + // number=1233&x=1 + int count = 0; + try { + while (pramEnumeration.hasMoreElements()) { - String key = (String) pramEnumeration.nextElement(); - if (count++ != 0) { - buf.append("&"); + String key = (String) pramEnumeration.nextElement(); + if (count++ != 0) { + buf.append("&"); + } + buf.append(key); + buf.append("="); + String val = httpRequest.getParameter(key); + if (val != null) { + buf.append(val); + } else { + buf.append(""); + } } - buf.append(key); - buf.append("="); - String val = httpRequest.getParameter(key); - if (val != null) { - buf.append(val); - } else { - buf.append(""); - } + } catch (Exception e) { + // FIXME Why is try/catch required? + e.printStackTrace(); } - } catch (Exception e) { - // FIXME Why is try/catch required? - e.printStackTrace(); - } - requestContent = buf.toString(); - } else { + requestContent = buf.toString(); + } else { - // retreive the byte array placed by TeeFilter - byte[] inputBuffer = (byte[]) httpRequest - .getAttribute(Constants.LB_INPUT_BUFFER); + // retreive the byte array placed by TeeFilter + byte[] inputBuffer = (byte[]) httpRequest + .getAttribute(Constants.LB_INPUT_BUFFER); - if (inputBuffer != null) { - requestContent = new String(inputBuffer); - } + if (inputBuffer != null) { + requestContent = new String(inputBuffer); + } - if (requestContent == null || requestContent.length() == 0) { - requestContent = EMPTY; + if (requestContent == null || requestContent.length() == 0) { + requestContent = EMPTY; + } } } - + return requestContent; } @@ -432,7 +434,9 @@ void buildResponseHeaderMap() { if (responseHeaderMap == null) { - responseHeaderMap = serverAdapter.builResponseHeaderMap(); + if(serverAdapter!=null) { + responseHeaderMap = serverAdapter.buildResponseHeaderMap(); + } } } Index: src/main/java/ch/qos/logback/access/spi/ServerAdapter.java =================================================================== --- src/main/java/ch/qos/logback/access/spi/ServerAdapter.java (revision 1612) +++ src/main/java/ch/qos/logback/access/spi/ServerAdapter.java (working copy) @@ -17,5 +17,5 @@ // List getResponseHeaderNameList(); // Map getResponseHeaderMap(); - Map builResponseHeaderMap(); + Map buildResponseHeaderMap(); } Index: src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java =================================================================== --- src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java (revision 1612) +++ src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java (working copy) @@ -1,12 +1,11 @@ package ch.qos.logback.access.tomcat; -import java.util.HashMap; -import java.util.Map; - +import ch.qos.logback.access.spi.ServerAdapter; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; -import ch.qos.logback.access.spi.ServerAdapter; +import java.util.HashMap; +import java.util.Map; /** * A tomcat specific implementation of the {@link ServerAdapter} interface. @@ -32,7 +31,7 @@ } - public Map builResponseHeaderMap() { + public Map buildResponseHeaderMap() { Map responseHeaderMap = new HashMap(); for (String key : response.getHeaderNames()) { String value = response.getHeader(key); Index: src/test/java/ch/qos/logback/access/dummy/DummyServerAdapter.java =================================================================== --- src/test/java/ch/qos/logback/access/dummy/DummyServerAdapter.java (revision 1612) +++ src/test/java/ch/qos/logback/access/dummy/DummyServerAdapter.java (working copy) @@ -22,7 +22,7 @@ return response.getStatus(); } - public Map builResponseHeaderMap() { + public Map buildResponseHeaderMap() { return response.headerMap; }