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/java/org/apache/commons/codec/net RFC1522Codec.java
Date Fri, 09 Apr 2004 22:21:43 GMT
ggregory    2004/04/09 15:21:43

  Modified:    codec/src/java/org/apache/commons/codec/net
                        RFC1522Codec.java
  Log:
  Make this class package private for now.
  
  Revision  Changes    Path
  1.2       +7 -7      jakarta-commons/codec/src/java/org/apache/commons/codec/net/RFC1522Codec.java
  
  Index: RFC1522Codec.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/net/RFC1522Codec.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RFC1522Codec.java	29 Mar 2004 07:59:57 -0000	1.1
  +++ RFC1522Codec.java	9 Apr 2004 22:21:43 -0000	1.2
  @@ -99,19 +99,22 @@
               return null;
           }
           if ((!text.startsWith("=?")) || (!text.endsWith("?="))) {
  -            throw new DecoderException("RFC 1521 violation: malformed encoded content");
  +            throw new DecoderException("RFC 1522 violation: malformed encoded content");
           }
           int termnator = text.length() - 2;
           int from = 2;
           int to = text.indexOf("?", from);
           if ((to == -1) || (to == termnator)) {
  -            throw new DecoderException("RFC 1521 violation: charset token not found");
  +            throw new DecoderException("RFC 1522 violation: charset token not found");
           }
           String charset = text.substring(from, to);
  +        if (charset.equals("")) {
  +            throw new DecoderException("RFC 1522 violation: charset not specified");
  +        }
           from = to + 1;
           to = text.indexOf("?", from);
           if ((to == -1) || (to == termnator)) {
  -            throw new DecoderException("RFC 1521 violation: encoding token not found");
  +            throw new DecoderException("RFC 1522 violation: encoding token not found");
           }
           String encoding = text.substring(from, to);
           if (!getEncoding().equalsIgnoreCase(encoding)) {
  @@ -120,9 +123,6 @@
           }
           from = to + 1;
           to = text.indexOf("?", from);
  -        if ((to == -1) || (to != termnator)) {
  -            throw new DecoderException("RFC 1521 violation: encoded content not found");
  -        }
           byte[] data = text.substring(from, to).getBytes(StringEncodings.US_ASCII);
           data = doDecoding(data); 
           return new String(data, charset);
  
  
  

---------------------------------------------------------------------
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