[logback-dev] svn commit: r1613 - in logback/trunk/logback-access/src: main/java/ch/qos/logback/access/jetty main/java/ch/qos/logback/access/spi main/java/ch/qos/logback/access/tomcat test/java/ch/qos/logback/access/dummy

noreply.ceki at qos.ch noreply.ceki at qos.ch
Mon Jan 28 11:06:58 CET 2008


Author: ceki
Date: Mon Jan 28 11:06:58 2008
New Revision: 1613

Modified:
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/ServerAdapter.java
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServerAdapter.java

Log:
- applying some of the changes proposed by Joern Huxhorn in his patch dated 2008-01-26 (bug 109)

The defensive code compensating for the bug in 0.9.8 until 0.9.9 is released was not merged because it is a workaround hiding the true logic of the code.
 
  void buildResponseHeaderMap() {
    if (responseHeaderMap == null) {
      if(serverAdapter != null) {     <-- ---- not merged
        responseHeaderMap = serverAdapter.buildResponseHeaderMap();
      } else {
        responseHeaderMap = new HashMap<String, String>();
      }
     }
   }

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java	Mon Jan 28 11:06:58 2008
@@ -34,8 +34,7 @@
     return response.getStatus();
   }
 
-  
-  public Map<String, String> builResponseHeaderMap() {
+  public Map<String, String> buildResponseHeaderMap() {
     Map<String, String> responseHeaderMap = new HashMap<String, String>();
     HttpFields httpFields = response.getHttpFields();
     Enumeration e = httpFields.getFieldNames();

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java	Mon Jan 28 11:06:58 2008
@@ -205,10 +205,10 @@
     if (requestHeaderMap == null) {
       if (httpRequest != null) {
         buildRequestHeaderMap();
-        result = (String) requestHeaderMap.get(key);
+        result = requestHeaderMap.get(key);
       }
     } else {
-      result = (String) requestHeaderMap.get(key);
+      result = requestHeaderMap.get(key);
     }
 
     if (result != null) {
@@ -270,7 +270,6 @@
    * Attributes are not serialized
    * 
    * @param key
-   * @return
    */
   public String getAttribute(String key) {
     if (httpRequest != null) {
@@ -306,9 +305,9 @@
         return AccessEvent.NA;
       }
 
-      for (int i = 0; cookieArray != null && i < cookieArray.length; i++) {
-        if (key.equals(cookieArray[i].getName())) {
-          return cookieArray[i].getValue();
+      for (Cookie cookie : cookieArray) {
+        if (key.equals(cookie.getName())) {
+          return cookie.getValue();
         }
       }
     }
@@ -432,7 +431,7 @@
 
   void buildResponseHeaderMap() {
     if (responseHeaderMap == null) {
-      responseHeaderMap = serverAdapter.builResponseHeaderMap();
+      responseHeaderMap = serverAdapter.buildResponseHeaderMap();
     }
   }
 

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/ServerAdapter.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/ServerAdapter.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/ServerAdapter.java	Mon Jan 28 11:06:58 2008
@@ -17,5 +17,5 @@
 //  List<String> getResponseHeaderNameList();
 //  Map<String, String> getResponseHeaderMap();
   
-  Map<String, String> builResponseHeaderMap();
+  Map<String, String> buildResponseHeaderMap();
 }

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java	Mon Jan 28 11:06:58 2008
@@ -32,7 +32,7 @@
   }
 
   
-  public Map<String, String> builResponseHeaderMap() {
+  public Map<String, String> buildResponseHeaderMap() {
     Map<String, String> responseHeaderMap = new HashMap<String, String>();
     for (String key : response.getHeaderNames()) {
       String value = response.getHeader(key);

Modified: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServerAdapter.java
==============================================================================
--- logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServerAdapter.java	(original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServerAdapter.java	Mon Jan 28 11:06:58 2008
@@ -22,7 +22,7 @@
     return response.getStatus();
   }
   
-  public Map<String, String> builResponseHeaderMap() {
+  public Map<String, String> buildResponseHeaderMap() {
     return response.headerMap;
   }
 



More information about the logback-dev mailing list