commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 21800] New: - because The OutputStreamWriter not flush, so short String will encoded error...
Date Tue, 22 Jul 2003 15:06:27 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21800>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21800

because The OutputStreamWriter not flush, so short String will  encoded error...

           Summary: because The OutputStreamWriter not flush, so short
                    String will  encoded error...
           Product: Commons
           Version: Nightly Builds
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Codec
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: cn_liujie@yahoo.com.cn


because The OutputStreamWriter not flush, so short String will  encoded error...


org.apache.commons.codec.base64 bug, i coreect,anyone can notify the committer 

public static String encode(String data, String
charEncoding)
        throws UnsupportedEncodingException {

        // Check arguments
        if (data == null) {
            data = "";
        }
        if (charEncoding == null) {
            charEncoding = DEFAULT_CHAR_ENCODING;
        }

        // Convert to byte[]
        ByteArrayOutputStream bos = new
ByteArrayOutputStream();
        OutputStreamWriter osw = new
OutputStreamWriter(bos, charEncoding);
        try {
            osw.write(data);
//*****should add start*********
            osw.flush()
//*****should add end*********

        } catch (IOException ioe) {
            throw new
RuntimeException(ioe.toString());
        }

        // Encode
        byte[] encodedData =
encode(bos.toByteArray());

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