Changeset 75c20c9


Ignore:
Timestamp:
Apr 18, 2018 3:45:43 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
9fcddbb
Parents:
ea9a332
Message:

SusiMail?: Fix unhandled decoding exception
Trim leading whitespace from charset

Location:
apps/susimail/src/src/i2p/susi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/susimail/src/src/i2p/susi/util/DecodingOutputStream.java

    rea9a332 r75c20c9  
    33import java.io.IOException;
    44import java.io.OutputStream;
     5import java.io.UnsupportedEncodingException;
    56import java.io.Writer;
    67import java.nio.ByteBuffer;
     
    2930    /**
    3031     *  @param out UTF-8
     32     *  @throws UnsupportedEncodingException (an IOException) on unknown charset
    3133     */
    32     public DecodingOutputStream(Writer out, String charset) {
     34    public DecodingOutputStream(Writer out, String charset) throws UnsupportedEncodingException {
    3335        super();
    3436        _out = out;
    35         _dc = Charset.forName(charset).newDecoder();
     37        try {
     38            _dc = Charset.forName(charset).newDecoder();
     39        } catch (IllegalArgumentException iae) {
     40            UnsupportedEncodingException uee = new UnsupportedEncodingException("Unsupported charset \"" + charset + '"');
     41            uee.initCause(iae);
     42            throw uee;
     43        }
    3644        _bb = ByteBuffer.allocate(1024);
    3745        _cb = CharBuffer.allocate(1024);
  • apps/susimail/src/src/i2p/susi/webmail/MailPart.java

    rea9a332 r75c20c9  
    473473                                         * no " found and no ;
    474474                                         */
    475                                         result = line.substring( j + 1 );
     475                                        result = line.substring( j + 1 ).trim();
    476476                                }
    477477                        }
  • apps/susimail/src/src/i2p/susi/webmail/WebMail.java

    rea9a332 r75c20c9  
    28992899                                bcc = arrayToCSV(draft.getBcc());
    29002900                                StringWriter body = new StringWriter(1024);
    2901                                 Buffer ob = new OutputStreamBuffer(new DecodingOutputStream(body, "UTF-8"));
    29022901                                try {
     2902                                        Buffer ob = new OutputStreamBuffer(new DecodingOutputStream(body, "UTF-8"));
    29032903                                        draft.getPart().decode(0, ob);
    29042904                                } catch (IOException ioe) {
Note: See TracChangeset for help on using the changeset viewer.