Author: olegk
Date: Sat Sep 20 12:12:27 2008
New Revision: 697414
URL: http://svn.apache.org/viewvc?rev=697414&view=rev
Log:
MIME4J-57: Added a special IOException class to signal a line exceeding the
maximum line length limit
Added:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/MaxLineLimitException.java
(with props)
Modified:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/stream/BufferedLineReaderInputStreamTest.java
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/stream/LineReaderInputStreamAdaptorTest.java
Modified:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java
URL:
http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java?rev=697414&r1=697413&r2=697414&view=diff
==============================================================================
---
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java
(original)
+++
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/BufferedLineReaderInputStream.java
Sat Sep 20 12:12:27 2008
@@ -172,7 +172,7 @@
total += chunk;
}
if (this.maxLineLen > 0 && dst.length() >= this.maxLineLen) {
- throw new IOException("Maximum line length limit exceeded");
+ throw new MaxLineLimitException("Maximum line length limit
exceeded");
}
}
if (total == 0 && bytesRead == -1) {
Modified:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java
URL:
http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java?rev=697414&r1=697413&r2=697414&view=diff
==============================================================================
---
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java
(original)
+++
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/LineReaderInputStreamAdaptor.java
Sat Sep 20 12:12:27 2008
@@ -89,7 +89,7 @@
dst.append(ch);
total++;
if (this.maxLineLen > 0 && dst.length() >= this.maxLineLen) {
- throw new IOException("Maximum line length limit exceeded");
+ throw new MaxLineLimitException("Maximum line length limit
exceeded");
}
if (ch == '\n') {
break;
Added:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/MaxLineLimitException.java
URL:
http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/MaxLineLimitException.java?rev=697414&view=auto
==============================================================================
---
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/MaxLineLimitException.java
(added)
+++
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/MaxLineLimitException.java
Sat Sep 20 12:12:27 2008
@@ -0,0 +1,36 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mime4j.io;
+
+import java.io.IOException;
+
+/**
+ * Signals a I/O error due to a line exceeding the limit on the
+ * maximum line length.
+ */
+public class MaxLineLimitException extends IOException {
+
+ private static final long serialVersionUID = 8039001187837730773L;
+
+ public MaxLineLimitException(final String message) {
+ super(message);
+ }
+
+}
Propchange:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/MaxLineLimitException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/MaxLineLimitException.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/io/MaxLineLimitException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified:
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/stream/BufferedLineReaderInputStreamTest.java
URL:
http://svn.apache.org/viewvc/james/mime4j/trunk/src/test/java/org/apache/james/mime4j/stream/BufferedLineReaderInputStreamTest.java?rev=697414&r1=697413&r2=697414&view=diff
==============================================================================
---
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/stream/BufferedLineReaderInputStreamTest.java
(original)
+++
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/stream/BufferedLineReaderInputStreamTest.java
Sat Sep 20 12:12:27 2008
@@ -21,11 +21,11 @@
import org.apache.james.mime4j.io.BufferedLineReaderInputStream;
import org.apache.james.mime4j.io.LineReaderInputStream;
+import org.apache.james.mime4j.io.MaxLineLimitException;
import org.apache.james.mime4j.util.ByteArrayBuffer;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.IOException;
import junit.framework.TestCase;
@@ -158,8 +158,8 @@
linebuf.clear();
try {
instream2.readLine(linebuf);
- fail("IOException should have been thrown");
- } catch (IOException ex) {
+ fail("MaxLineLimitException should have been thrown");
+ } catch (MaxLineLimitException ex) {
}
}
Modified:
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/stream/LineReaderInputStreamAdaptorTest.java
URL:
http://svn.apache.org/viewvc/james/mime4j/trunk/src/test/java/org/apache/james/mime4j/stream/LineReaderInputStreamAdaptorTest.java?rev=697414&r1=697413&r2=697414&view=diff
==============================================================================
---
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/stream/LineReaderInputStreamAdaptorTest.java
(original)
+++
james/mime4j/trunk/src/test/java/org/apache/james/mime4j/stream/LineReaderInputStreamAdaptorTest.java
Sat Sep 20 12:12:27 2008
@@ -20,11 +20,11 @@
package org.apache.james.mime4j.stream;
import org.apache.james.mime4j.io.LineReaderInputStreamAdaptor;
+import org.apache.james.mime4j.io.MaxLineLimitException;
import org.apache.james.mime4j.util.ByteArrayBuffer;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.IOException;
import junit.framework.TestCase;
@@ -161,8 +161,8 @@
linebuf.clear();
try {
instream2.readLine(linebuf);
- fail("IOException should have been thrown");
- } catch (IOException ex) {
+ fail("MaxLineLimitException should have been thrown");
+ } catch (MaxLineLimitException ex) {
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]