hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1682616 - in /httpcomponents/httpcore/trunk/httpcore/src: main/java/org/apache/http/ main/java/org/apache/http/message/ test/java/org/apache/http/message/
Date Sat, 30 May 2015 15:44:34 GMT
Author: olegk
Date: Sat May 30 15:44:34 2015
New Revision: 1682616

URL: http://svn.apache.org/r1682616
Log:
Made ParseException checked

Modified:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ParseException.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BufferedHeader.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderValueParser.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBufferedHeader.java

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ParseException.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ParseException.java?rev=1682616&r1=1682615&r2=1682616&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ParseException.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ParseException.java
Sat May 30 15:44:34 2015
@@ -28,17 +28,11 @@
 package org.apache.http;
 
 /**
- * Signals a parse error.
- * Parse errors when receiving a message will typically trigger
- * {@link ProtocolException}. Parse errors that do not occur during
- * protocol execution may be handled differently.
- * This is an unchecked exception, since there are cases where
- * the data to be parsed has been generated and is therefore
- * known to be parseable.
+ * Signals a protocol exception due to failure to parse a message element.
  *
  * @since 4.0
  */
-public class ParseException extends RuntimeException {
+public class ParseException extends ProtocolException {
 
     private static final long serialVersionUID = -7288819855864183578L;
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BufferedHeader.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BufferedHeader.java?rev=1682616&r1=1682615&r2=1682616&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BufferedHeader.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BufferedHeader.java
Sat May 30 15:44:34 2015
@@ -99,7 +99,7 @@ public class BufferedHeader implements F
     }
 
     @Override
-    public HeaderElement[] getElements() throws ParseException {
+    public HeaderElement[] getElements() {
         final ParserCursor cursor = new ParserCursor(0, this.buffer.length());
         cursor.updatePos(this.valuePos);
         return BasicHeaderValueParser.INSTANCE.parseElements(this.buffer, cursor);

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderValueParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderValueParser.java?rev=1682616&r1=1682615&r2=1682616&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderValueParser.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderValueParser.java
Sat May 30 15:44:34 2015
@@ -29,7 +29,6 @@ package org.apache.http.message;
 
 import org.apache.http.HeaderElement;
 import org.apache.http.NameValuePair;
-import org.apache.http.ParseException;
 
 /**
  * Interface for parsing header values into elements.
@@ -48,12 +47,8 @@ public interface HeaderValueParser {
      *                  the bounds within the buffer for the parsing operation
      *
      * @return  an array holding all elements of the header value
-     *
-     * @throws ParseException        in case of a parsing error
      */
-    HeaderElement[] parseElements(
-            CharSequence buffer,
-            ParserCursor cursor) throws ParseException;
+    HeaderElement[] parseElements(CharSequence buffer, ParserCursor cursor);
 
     /**
      * Parses a single header element.
@@ -65,12 +60,8 @@ public interface HeaderValueParser {
      *                  the bounds within the buffer for the parsing operation
      *
      * @return  the parsed element
-     *
-     * @throws ParseException        in case of a parse error
      */
-    HeaderElement parseHeaderElement(
-            CharSequence buffer,
-            ParserCursor cursor) throws ParseException;
+    HeaderElement parseHeaderElement(CharSequence buffer, ParserCursor cursor);
 
     /**
      * Parses a list of name-value pairs.
@@ -82,12 +73,8 @@ public interface HeaderValueParser {
      *                  the bounds within the buffer for the parsing operation
      *
      * @return  an array holding all items of the name-value list
-     *
-     * @throws ParseException        in case of a parse error
      */
-    NameValuePair[] parseParameters(
-            CharSequence buffer,
-            ParserCursor cursor) throws ParseException;
+    NameValuePair[] parseParameters(CharSequence buffer, ParserCursor cursor);
 
 
     /**
@@ -100,9 +87,7 @@ public interface HeaderValueParser {
      * @return  the name-value pair, where the value is {@code null}
      *          if no value is specified
      */
-    NameValuePair parseNameValuePair(
-            CharSequence buffer,
-            ParserCursor cursor) throws ParseException;
+    NameValuePair parseNameValuePair(CharSequence buffer, ParserCursor cursor);
 
 }
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBufferedHeader.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBufferedHeader.java?rev=1682616&r1=1682615&r2=1682616&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBufferedHeader.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBufferedHeader.java
Sat May 30 15:44:34 2015
@@ -44,7 +44,7 @@ import org.junit.Test;
 public class TestBufferedHeader {
 
     @Test
-    public void testBasicConstructor() {
+    public void testBasicConstructor() throws Exception {
         final CharArrayBuffer buf = new CharArrayBuffer(32);
         buf.append("name: value");
         final BufferedHeader header = new BufferedHeader(buf);
@@ -55,7 +55,7 @@ public class TestBufferedHeader {
     }
 
     @Test
-    public void testInvalidName() {
+    public void testInvalidName() throws Exception {
         try {
             new BufferedHeader(null);
             Assert.fail("IllegalArgumentException should have been thrown");
@@ -65,7 +65,7 @@ public class TestBufferedHeader {
     }
 
     @Test
-    public void testHeaderElements() {
+    public void testHeaderElements()  throws Exception {
         final CharArrayBuffer buf = new CharArrayBuffer(32);
         buf.append("name: element1 = value1, element2; param1 = value1, element3");
         final BufferedHeader header = new BufferedHeader(buf);



Mime
View raw message