noel 2003/02/20 17:54:17
Modified: src/java/org/apache/james/util Tag: branch_2_1_fcs
ExtraDotOutputStream.java
Log:
Merged changes from HEAD: Changed dot stuff per bug #14396 so CRCR. and LFLF. will
not trigger dot-stuffing
Revision Changes Path
No revision
No revision
1.2.4.1 +22 -15
jakarta-james/src/java/org/apache/james/util/ExtraDotOutputStream.java
Index: ExtraDotOutputStream.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/util/ExtraDotOutputStream.java,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- ExtraDotOutputStream.java 16 Aug 2002 21:06:32 -0000 1.2
+++ ExtraDotOutputStream.java 21 Feb 2003 01:54:17 -0000 1.2.4.1
@@ -14,8 +14,6 @@
/**
* Adds extra dot if dot occurs in message body at beginning of line (according to
RFC1939)
* Compare also org.apache.james.smtpserver.SMTPInputStream
- *
- * @author Stephan Schiessling <[EMAIL PROTECTED]>
*/
public class ExtraDotOutputStream extends FilterOutputStream {
@@ -43,20 +41,29 @@
*/
public void write(int b) throws IOException {
out.write(b);
- if (b == '.') {
- if (countLast0A0D > 1) {
- // add extra dot
- out.write('.');
- }
- countLast0A0D = 0;
- } else {
- if (b == '\r' || b == '\n') {
- countLast0A0D++;
- } else {
+
+ switch (b) {
+ case '.':
+ if (countLast0A0D == 2) {
+ // add extra dot
+ out.write('.');
+ }
+ countLast0A0D = 0;
+ break;
+ case '\r':
+ countLast0A0D = 1;
+ break;
+ case '\n':
+ if (countLast0A0D == 1) {
+ countLast0A0D = 2;
+ } else {
+ countLast0A0D = 0;
+ }
+ break;
+ default:
+ // we're no longer at the start of a line
countLast0A0D = 0;
- }
+ break;
}
}
-
}
-
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]