james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r895032 - in /james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/io: BufferedLineReaderInputStream.java LineReaderInputStream.java
Date Fri, 01 Jan 2010 16:11:50 GMT
Author: bago
Date: Fri Jan  1 16:11:50 2010
New Revision: 895032

URL: http://svn.apache.org/viewvc?rev=895032&view=rev
Log:
No need to throw an exception as the contract allow us to refuse unreading. So simply return
false to a new unread and added comment to the unread javadoc to explain the contract. (MIME4J-58)

Modified:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/io/LineReaderInputStream.java

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java?rev=895032&r1=895031&r2=895032&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java
Fri Jan  1 16:11:50 2010
@@ -362,9 +362,7 @@
 
 	@Override
 	public boolean unread(ByteArrayBuffer buf) {
-	    if (tempBuffer) {
-	        throw new IllegalStateException("A previous unreaded buffer has not yet been consumed.");
-	    }
+	    if (tempBuffer) return false;
 		origBuffer = buffer;
 		origBuflen = buflen;
 		origBufpos = bufpos;

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/io/LineReaderInputStream.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/io/LineReaderInputStream.java?rev=895032&r1=895031&r2=895032&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/io/LineReaderInputStream.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/io/LineReaderInputStream.java
Fri Jan  1 16:11:50 2010
@@ -51,6 +51,12 @@
     /**
      * Tries to unread the last read line.
      * 
+     * Implementation may refuse to unread a new buffer until the previous
+     * unread one has been competely consumed.
+     * 
+     * Implementations will directly use the byte array backed by buf, so
+     * make sure to not alter it anymore once this method has been called.
+     * 
      * @return true if the unread has been succesfull.
      */
     public abstract boolean unread(ByteArrayBuffer buf);



Mime
View raw message