You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by gg...@apache.org on 2004/09/21 04:07:20 UTC

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

ggregory    2004/09/20 19:07:20

  Modified:    codec/src/test/org/apache/commons/codec/net
                        URLCodecTest.java
  Log:
  PR: Bugzilla Bug 31161
  	  	URLCodec.decode() corrupts characters > 127 in unencoded strings
  Obtained from: Bugzilla Bug 31161
  Submitted by:	Oleg Kalnichevski
  Reviewed by:	Gary Gregory
  
  Revision  Changes    Path
  1.15      +14 -0     jakarta-commons/codec/src/test/org/apache/commons/codec/net/URLCodecTest.java
  
  Index: URLCodecTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/codec/src/test/org/apache/commons/codec/net/URLCodecTest.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- URLCodecTest.java	5 Aug 2004 20:39:39 -0000	1.14
  +++ URLCodecTest.java	21 Sep 2004 02:07:20 -0000	1.15
  @@ -16,6 +16,8 @@
   
   package org.apache.commons.codec.net;
   
  +import java.io.UnsupportedEncodingException;
  +
   import junit.framework.TestCase;
   
   import org.apache.commons.codec.DecoderException;
  @@ -139,6 +141,18 @@
               fail("DecoderException should have been thrown");
           } catch(DecoderException e) {
               // Expected. Move on
  +        }
  +        this.validateState(urlCodec);
  +    }
  +
  +    public void testDecodeInvalidContent() throws UnsupportedEncodingException, DecoderException {
  +        String ch_msg = constructString(SWISS_GERMAN_STUFF_UNICODE); 
  +        URLCodec urlCodec = new URLCodec();
  +        byte[] input = ch_msg.getBytes("ISO-8859-1");
  +        byte[] output = urlCodec.decode(input);
  +        assertEquals(input.length, output.length);
  +        for (int i = 0; i < input.length; i++) {
  +            assertEquals(input[i], output[i]);
           }
           this.validateState(urlCodec);
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org