[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v_0.9.25-32-g8c9b86f

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Tue Nov 16 18:28:53 CET 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, master has been updated
       via  8c9b86fb1553924df8ea682ca39ef336db2725ae (commit)
      from  268c89d8fe841c96df8cf6d52da12a7a1a4b3dbc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=8c9b86fb1553924df8ea682ca39ef336db2725ae
http://github.com/ceki/logback/commit/8c9b86fb1553924df8ea682ca39ef336db2725ae

commit 8c9b86fb1553924df8ea682ca39ef336db2725ae
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Tue Nov 16 18:24:54 2010 +0100

    - pom.xml clean up
    - Fix LBACCESS-10 - TeeServletInputStreamm barfs on input over 8K

diff --git a/logback-access/pom.xml b/logback-access/pom.xml
index 5b33824..b0e7ab3 100644
--- a/logback-access/pom.xml
+++ b/logback-access/pom.xml
@@ -2,17 +2,15 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
+  <modelVersion>4.0.0</modelVersion>
+
   <parent>
     <groupId>ch.qos.logback</groupId>
     <artifactId>logback-parent</artifactId>
     <version>0.9.27-SNAPSHOT</version>
   </parent>
 
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>ch.qos.logback</groupId>
   <artifactId>logback-access</artifactId>
-  <version>${parent.version}</version>
   <packaging>jar</packaging>
   <name>Logback Access Module</name>
 
diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java
index 67fcca4..c544118 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java
@@ -14,45 +14,66 @@
 package ch.qos.logback.access.servlet;
 
 import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
 
 import javax.servlet.ServletInputStream;
 import javax.servlet.http.HttpServletRequest;
 
 class TeeServletInputStream extends ServletInputStream {
 
-  InputStream in;
-  byte[] inputBuffer;
-
-  TeeServletInputStream(HttpServletRequest request) {
-    duplicateInputStream(request);
-  }
-
-  @Override
-  public int read() throws IOException {
-    return in.read();
-  }
-
-  private void duplicateInputStream(HttpServletRequest request) {
-    try {
-      int len = request.getContentLength();
-      ServletInputStream originalSIS = request.getInputStream();
-      if (len < 0) {
-        in = originalSIS;
-      } else {
-        inputBuffer = new byte[len];
-        int n = originalSIS.read(inputBuffer, 0, len);
-        assert n == len;
-        this.in = new ByteArrayInputStream(inputBuffer);       
-        originalSIS.close();
-      }
-    } catch (IOException e) {
-      e.printStackTrace();
+    InputStream in;
+    byte[] inputBuffer;
+
+    TeeServletInputStream(HttpServletRequest request) {
+        duplicateInputStream(request);
+    }
+
+    @Override
+    public int read() throws IOException {
+        return in.read();
     }
-  }
 
-  byte[] getInputBuffer() {
-    return inputBuffer;
-  }
+    private void duplicateInputStream(HttpServletRequest request) {
+        ServletInputStream originalSIS = null;
+        try {
+            originalSIS = request.getInputStream();
+            System.out.println("****************************************************");
+            System.out.println("**************SIS type="+originalSIS.getClass().getName());
+            inputBuffer = consumeBufferAndReturnAsByteArray(originalSIS);
+            this.in = new ByteArrayInputStream(inputBuffer);  
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            closeStrean(originalSIS);
+        }
+    }
+
+    byte[] consumeBufferAndReturnAsByteArray(InputStream is) throws IOException {
+        int len = 1024;
+        byte[] temp = new byte[len];
+        int c = -1;
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        while ((c = is.read(temp, 0, len)) != -1) {
+            baos.write(temp, 0, c);
+        }
+        return baos.toByteArray();
+    }
+
+
+    void closeStrean(ServletInputStream is) {
+        if (is != null) {
+            try {
+                is.close();
+            } catch (IOException e) {
+            }
+        }
+    }
+
+    byte[] getInputBuffer() {
+        return inputBuffer;
+    }
 }
diff --git a/logback-classic/pom.xml b/logback-classic/pom.xml
index c768bf4..f5dbbcb 100644
--- a/logback-classic/pom.xml
+++ b/logback-classic/pom.xml
@@ -2,17 +2,15 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
+  <modelVersion>4.0.0</modelVersion>
+
   <parent>
     <groupId>ch.qos.logback</groupId>
     <artifactId>logback-parent</artifactId>
     <version>0.9.27-SNAPSHOT</version>
   </parent>
 
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>ch.qos.logback</groupId>
   <artifactId>logback-classic</artifactId>
-  <version>${parent.version}</version>
   <packaging>jar</packaging>
   <name>Logback Classic Module</name>
 
diff --git a/logback-core/pom.xml b/logback-core/pom.xml
index 50659b0..d8b6207 100644
--- a/logback-core/pom.xml
+++ b/logback-core/pom.xml
@@ -2,17 +2,15 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
+  <modelVersion>4.0.0</modelVersion>
+  
   <parent>
     <groupId>ch.qos.logback</groupId>
     <artifactId>logback-parent</artifactId>
     <version>0.9.27-SNAPSHOT</version>
   </parent>
 
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>ch.qos.logback</groupId>
   <artifactId>logback-core</artifactId>
-  <version>${parent.version}</version>
   <packaging>jar</packaging>
   <name>Logback Core Module</name>
 

-----------------------------------------------------------------------

Summary of changes:
 logback-access/pom.xml                             |    6 +-
 .../access/servlet/TeeServletInputStream.java      |   83 ++++++++++++-------
 logback-classic/pom.xml                            |    6 +-
 logback-core/pom.xml                               |    6 +-
 4 files changed, 58 insertions(+), 43 deletions(-)


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list