commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject cvs commit: jakarta-commons/codec/src/test/org/apache/commons/codec/net URLCodecTest.java
Date Tue, 21 Sep 2004 02:07:20 GMT
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


Mime
View raw message