cvs commit: jakarta-commons/codec/src/java/org/apache/commons/codec/net QuotedPrintableCodec.java

2004-09-09 Thread ggregory
ggregory2004/09/09 09:05:46

  Modified:codec/src/java/org/apache/commons/codec/net
QuotedPrintableCodec.java
  Log:
  Javadoc.
  
  Revision  ChangesPath
  1.12  +3 -4  
jakarta-commons/codec/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
  
  Index: QuotedPrintableCodec.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- QuotedPrintableCodec.java 27 Aug 2004 17:18:17 -  1.11
  +++ QuotedPrintableCodec.java 9 Sep 2004 16:05:46 -   1.12
  @@ -288,9 +288,8 @@
*  quoted-printable string to convert into its original form
* @return original string
* @throws DecoderException
  - *  Thrown if quoted-printable decoding is unsuccessful
  - * @throws UnsupportedEncodingException
  - *  Thrown if charset is not supported
  + *  Thrown if quoted-printable decoding is unsuccessful.
  + *  Thrown if charset is not supported.
* @see #getDefaultCharset()
*/
   public String decode(String pString) throws DecoderException {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/codec/src/java/org/apache/commons/codec/net QuotedPrintableCodec.java

2004-03-28 Thread ggregory
ggregory2004/03/28 13:21:58

  Modified:codec/src/java/org/apache/commons/codec/net
QuotedPrintableCodec.java
  Log:
  Javadoc typo.
  
  Revision  ChangesPath
  1.3   +2 -2  
jakarta-commons/codec/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
  
  Index: QuotedPrintableCodec.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- QuotedPrintableCodec.java 23 Mar 2004 19:22:34 -  1.2
  +++ QuotedPrintableCodec.java 28 Mar 2004 21:21:58 -  1.3
  @@ -56,7 +56,7 @@
* Q codec.
* /p
* 
  - * @see a href=http://http://www.ietf.org/rfc/rfc1521.txt;
  + * @see a href=http://www.ietf.org/rfc/rfc1521.txt;
* MIME (Multipurpose Internet Mail Extensions) Part One/a
* 
* @author Apache Software Foundation
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/codec/src/java/org/apache/commons/codec/net QuotedPrintableCodec.java

2004-03-28 Thread ggregory
ggregory2004/03/28 13:24:46

  Modified:codec/src/java/org/apache/commons/codec/net
QuotedPrintableCodec.java
  Log:
  Fix Copyright date. This file was added in 2004, not 2001.
  
  Revision  ChangesPath
  1.4   +2 -2  
jakarta-commons/codec/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
  
  Index: QuotedPrintableCodec.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- QuotedPrintableCodec.java 28 Mar 2004 21:21:58 -  1.3
  +++ QuotedPrintableCodec.java 28 Mar 2004 21:24:46 -  1.4
  @@ -1,5 +1,5 @@
   /*
  - * Copyright 2001-2004 The Apache Software Foundation.
  + * Copyright 2004 The Apache Software Foundation.
* 
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/codec/src/java/org/apache/commons/codec/net QuotedPrintableCodec.java

2004-03-28 Thread ggregory
ggregory2004/03/28 17:32:07

  Modified:codec/src/java/org/apache/commons/codec/net
QuotedPrintableCodec.java
  Log:
  Javadoc tweak.
  
  Revision  ChangesPath
  1.5   +5 -3  
jakarta-commons/codec/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
  
  Index: QuotedPrintableCodec.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- QuotedPrintableCodec.java 28 Mar 2004 21:24:46 -  1.4
  +++ QuotedPrintableCodec.java 29 Mar 2004 01:32:07 -  1.5
  @@ -29,7 +29,8 @@
   
   /**
* p
  - * Codec for RFC 1521 MIME (Multipurpose Internet Mail Extensions) Part One.
  + * Codec for the Quoted-Printable section of RFC 1521 MIME (Multipurpose Internet 
Mail Extensions) Part One 
  + * Mechanisms for Specifying and Describing the Format of Internet Message Bodies.
* /p
* p
* The Quoted-Printable encoding is intended to represent data that
  @@ -57,7 +58,8 @@
* /p
* 
* @see a href=http://www.ietf.org/rfc/rfc1521.txt;
  - * MIME (Multipurpose Internet Mail Extensions) Part One/a
  + * RFC 1521 MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms for 
Specifying 
  + * and Describing the Format of Internet Message Bodies/a
* 
* @author Apache Software Foundation
* @since 1.3
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/codec/src/java/org/apache/commons/codec/net QuotedPrintableCodec.java

2004-03-20 Thread ggregory
ggregory2004/03/20 18:20:25

  Added:   codec/src/test/org/apache/commons/codec/net
QuotedPrintableCodecTest.java
   codec/src/java/org/apache/commons/codec/net
QuotedPrintableCodec.java
  Log:
  

  PR: Bugzilla Bug 27789

[Codec][PATCH] Quoted-printable codec (partial implementation)

  Submitted by: Oleg Kalnichevski

  Reviewed by:  Gary Gregory

  
  Revision  ChangesPath
  1.1  
jakarta-commons/codec/src/test/org/apache/commons/codec/net/QuotedPrintableCodecTest.java
  
  Index: QuotedPrintableCodecTest.java
  ===
  /*
   * Copyright 2001-2004 The Apache Software Foundation.
   * 
   * Licensed 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.commons.codec.net;
  
  import org.apache.commons.codec.DecoderException;
  import org.apache.commons.codec.EncoderException;
  
  import junit.framework.TestCase;
  
  /**
   * Quoted-printable codec test cases
   * 
   * @author a href=mailto:[EMAIL PROTECTED]Oleg Kalnichevski/a
   */
  public class QuotedPrintableCodecTest extends TestCase {
  
  static final int SWISS_GERMAN_STUFF_UNICODE [] = {
  0x47, 0x72, 0xFC, 0x65, 0x7A, 0x69, 0x5F, 0x7A, 0xE4, 0x6D, 0xE4
  };
  
  static final int RUSSIAN_STUFF_UNICODE [] = {
  0x412, 0x441, 0x435, 0x43C, 0x5F, 0x43F, 0x440, 0x438, 
  0x432, 0x435, 0x442 
  }; 
  
  public QuotedPrintableCodecTest(String name) {
  super(name);
  }
  
  private String constructString(int [] unicodeChars) {
  StringBuffer buffer = new StringBuffer();
  if (unicodeChars != null) {
  for (int i = 0; i  unicodeChars.length; i++) {
  buffer.append((char)unicodeChars[i]); 
  }
  }
  return buffer.toString();
  }
  
  public void testUTF8RoundTrip() throws Exception {
  
  String ru_msg = constructString(RUSSIAN_STUFF_UNICODE); 
  String ch_msg = constructString(SWISS_GERMAN_STUFF_UNICODE); 
  
  QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
  
  assertEquals(
  =D0=92=D1=81=D0=B5=D0=BC_=D0=BF=D1=80=D0=B8=D0=B2=D0=B5=D1=82, 
  qpcodec.encode(ru_msg, UTF-8)
  );
  assertEquals(Gr=C3=BCezi_z=C3=A4m=C3=A4, qpcodec.encode(ch_msg, UTF-8));
  
  assertEquals(ru_msg, qpcodec.decode(qpcodec.encode(ru_msg, UTF-8), 
UTF-8));
  assertEquals(ch_msg, qpcodec.decode(qpcodec.encode(ch_msg, UTF-8), 
UTF-8));
  }
  
  public void testBasicEncodeDecode() throws Exception {
  QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
  String plain = = Hello there =\r\n;
  String encoded = qpcodec.encode(plain);
  assertEquals(Basic quoted-printable encoding test, 
  =3D Hello there =3D=0D=0A, encoded);
  assertEquals(Basic quoted-printable decoding test, 
  plain, qpcodec.decode(encoded));
  }
  
  public void testSafeCharEncodeDecode() throws Exception {
  QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
  String plain = [EMAIL PROTECTED]()+{}\\\;:`,/[];
  String encoded = qpcodec.encode(plain);
  assertEquals(Safe chars quoted-printable encoding test, 
  plain, encoded);
  assertEquals(Safe chars quoted-printable decoding test, 
  plain, qpcodec.decode(encoded));
  }
  
  
  public void testUnsafeEncodeDecode() throws Exception {
  QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
  String plain = =\r\n;
  String encoded = qpcodec.encode(plain);
  assertEquals(Unsafe chars quoted-printable encoding test, 
  =3D=0D=0A, encoded);
  assertEquals(Unsafe chars quoted-printable decoding test, 
  plain, qpcodec.decode(encoded));
  }
  
  public void testEncodeDecodeNull() throws Exception {
  QuotedPrintableCodec qpcodec = new QuotedPrintableCodec();
  assertNull(Null string quoted-printable encoding test, 
  qpcodec.encode((String)null));
  assertNull(Null string quoted-printable decoding test, 
  qpcodec.decode((String)null));
  }
  
  
  public void testDecodeInvalid() throws Exception {