hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rola...@apache.org
Subject svn commit: r569843 - in /jakarta/httpcomponents/httpcore/trunk/module-main/src: main/java/org/apache/http/impl/io/ test/java/org/apache/http/impl/io/
Date Sun, 26 Aug 2007 17:05:41 GMT
Author: rolandw
Date: Sun Aug 26 10:05:40 2007
New Revision: 569843

URL: http://svn.apache.org/viewvc?rev=569843&view=rev
Log:
removed static helpers without LineParser argument from AbstractMessageParser

Modified:
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/io/TestMessageParser.java

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java?rev=569843&r1=569842&r2=569843&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
Sun Aug 26 10:05:40 2007
@@ -165,18 +165,6 @@
         return headers;
     }
 
-    public static Header[] parseHeaders(
-            final SessionInputBuffer inbuffer,
-            int maxHeaderCount,
-            int maxLineLen) throws HttpException, IOException {
-        return parseHeaders(inbuffer, maxHeaderCount, maxLineLen, null);
-    }
-
-    public static Header[] parseHeaders(final SessionInputBuffer inbuffer) 
-        throws HttpException, IOException {
-        return parseHeaders(inbuffer, -1, -1, null);
-    }
-
     protected abstract HttpMessage parseHead(SessionInputBuffer sessionBuffer) 
         throws IOException, HttpException, ParseException;
 

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java?rev=569843&r1=569842&r2=569843&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
Sun Aug 26 10:05:40 2007
@@ -239,7 +239,8 @@
      */
     private void parseTrailerHeaders() throws IOException {
         try {
-            this.footers = AbstractMessageParser.parseHeaders(in);
+            this.footers = AbstractMessageParser.parseHeaders
+                (in, -1, -1, null);
         } catch (HttpException e) {
             IOException ioe = new MalformedChunkCodingException("Invalid footer: " 
                     + e.getMessage());

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/io/TestMessageParser.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/io/TestMessageParser.java?rev=569843&r1=569842&r2=569843&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/io/TestMessageParser.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/io/TestMessageParser.java
Sun Aug 26 10:05:40 2007
@@ -67,7 +67,8 @@
 
     public void testInvalidInput() throws Exception {
         try {
-            AbstractMessageParser.parseHeaders(null);
+            // the first argument must not be null
+            AbstractMessageParser.parseHeaders(null, -1, -1, null);
             fail("IllegalArgumentException should have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected
@@ -90,7 +91,8 @@
             "     \r\n" +  
             "\r\n"; 
         SessionInputBuffer receiver = new SessionInputBufferMockup(s, "US-ASCII"); 
-        Header[] headers = AbstractMessageParser.parseHeaders(receiver);
+        Header[] headers = AbstractMessageParser.parseHeaders
+            (receiver, -1, -1, null);
         assertNotNull(headers);
         assertEquals(3, headers.length);
         assertEquals("header1", headers[0].getName());
@@ -113,7 +115,8 @@
             "header1  : stuff; param1 = value1; param2 = \"value 2\" \r\n" + 
             "\r\n"; 
         SessionInputBuffer receiver = new SessionInputBufferMockup(s, "US-ASCII"); 
-        Header[] headers = AbstractMessageParser.parseHeaders(receiver);
+        Header[] headers = AbstractMessageParser.parseHeaders
+            (receiver, -1, -1, null);
         assertNotNull(headers);
         assertEquals(1, headers.length);
         assertEquals("header1  : stuff; param1 = value1; param2 = \"value 2\" ", headers[0].toString());
@@ -137,7 +140,7 @@
             "\r\n"; 
         SessionInputBuffer receiver = new SessionInputBufferMockup(s, "US-ASCII");
         try {
-            AbstractMessageParser.parseHeaders(receiver);
+            AbstractMessageParser.parseHeaders(receiver, -1, -1, null);
             fail("ProtocolException should have been thrown");
         } catch (ProtocolException ex) {
             // expected
@@ -147,7 +150,7 @@
             "\r\n"; 
         receiver = new SessionInputBufferMockup(s, "US-ASCII");
         try {
-            AbstractMessageParser.parseHeaders(receiver);
+            AbstractMessageParser.parseHeaders(receiver, -1, -1, null);
             fail("ProtocolException should have been thrown");
         } catch (ProtocolException ex) {
             // expected
@@ -159,7 +162,8 @@
             "    header1: stuff\r\n" + 
             "header2  : stuff \r\n"; 
         SessionInputBuffer receiver = new SessionInputBufferMockup(s, "US-ASCII"); 
-        Header[] headers = AbstractMessageParser.parseHeaders(receiver);
+        Header[] headers = AbstractMessageParser.parseHeaders
+            (receiver, -1, -1, null);
         assertNotNull(headers);
         assertEquals(2, headers.length);
         assertEquals("header1", headers[0].getName());
@@ -171,7 +175,8 @@
     public void testEmptyDataStream() throws Exception {
         String s = ""; 
         SessionInputBuffer receiver = new SessionInputBufferMockup(s, "US-ASCII"); 
-        Header[] headers = AbstractMessageParser.parseHeaders(receiver);
+        Header[] headers = AbstractMessageParser.parseHeaders
+            (receiver, -1, -1, null);
         assertNotNull(headers);
         assertEquals(0, headers.length);
     }
@@ -184,7 +189,7 @@
             "\r\n"; 
         SessionInputBuffer receiver = new SessionInputBufferMockup(s, "US-ASCII");
         try {
-            AbstractMessageParser.parseHeaders(receiver, 2, -1);
+            AbstractMessageParser.parseHeaders(receiver, 2, -1, null);
             fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected
@@ -199,7 +204,7 @@
             "\r\n"; 
         SessionInputBuffer receiver = new SessionInputBufferMockup(s, "US-ASCII");
         try {
-            AbstractMessageParser.parseHeaders(receiver, 2, 15);
+            AbstractMessageParser.parseHeaders(receiver, 2, 15, null);
             fail("IOException should have been thrown");
         } catch (IOException ex) {
             // expected



Mime
View raw message