Refine search
throw new ParseException( "encoded word does not start with \"=?\": " + eword); throw new ParseException( "encoded word does not include charset: " + eword); String charset = eword.substring(start, pos); if (lpos >= 0) // yes, throw it away charset = charset.substring(0, lpos); charset = javaCharset(charset); throw new ParseException( "encoded word does not include encoding: " + eword); String encoding = eword.substring(start, pos); throw new ParseException( "encoded word does not end with \"?=\": " + eword); rest = decodeInnerWords(rest); decodedWord += rest; } catch (IOException ioex) { throw new ParseException(ioex.toString()); } catch (IllegalArgumentException iex) { throw new UnsupportedEncodingException(charset);
public String toString() { String s = super.toString(); if (ref == null) return s; s += " in string ``" + ref + "''"; if (pos < 0) return s; return s + " at position " + pos; } }
decodeBytes(vv.value, bos); } else { bos.write(ASCIIUtility.getBytes((String)v)); try { if (charset != null) charset = MimeUtility.javaCharset(charset); if (charset == null || charset.length() == 0) charset = MimeUtility.getDefaultJavaCharset(); if (charset != null) mv.value = bos.toString(charset); } catch (UnsupportedEncodingException uex) { if (decodeParametersStrict) throw new ParseException(uex.toString()); try { vv.value = decodeBytes(vv.value, vv.charset); } catch (UnsupportedEncodingException ex) { if (decodeParametersStrict) throw new ParseException(ex.toString());
Value v = extractCharset(value); try { v.value = decodeBytes(v.value, v.charset); } catch (UnsupportedEncodingException ex) { if (decodeParametersStrict) throw new ParseException(ex.toString()); v = extractCharset(value); } else { v = new Value();
throw new ParseException("Invalid RFC 2047 encoded-word: " + word); throw new ParseException("Missing charset in RFC 2047 encoded-word: " + word); throw new ParseException("Missing encoding in RFC 2047 encoded-word: " + word); throw new ParseException("Missing encoded text in RFC 2047 encoded-word: " + word); throw new UnsupportedEncodingException("Unknown RFC 2047 encoding: " + encoding); return new String(decodedData, javaCharset(charset)); } catch (IOException e) { throw new UnsupportedEncodingException("Invalid RFC 2047 encoding");
/** * Method getContent * * @param datasource * @return * @throws IOException */ public Object getContent(DataSource datasource) throws IOException { InputStream is = datasource.getInputStream(); ByteArrayOutputStream os = new ByteArrayOutputStream(); int count; byte[] buffer = new byte[1000]; try { while ((count = is.read(buffer, 0, buffer.length)) > 0) { os.write(buffer, 0, count); } } finally { is.close(); } try { return os.toString(getCharSet(datasource.getContentType())); } catch (ParseException e) { throw new UnsupportedEncodingException(e.getMessage()); } }
Value vnew = decodeValue(evalue); charset = vv.charset = vnew.charset; value = vv.value = vnew.value; break; value = vv.value = decodeBytes(evalue, charset); throw new ParseException(nex.toString()); } catch (UnsupportedEncodingException uex) { if (decodeParametersStrict) throw new ParseException(uex.toString()); } catch (StringIndexOutOfBoundsException ex) { if (decodeParametersStrict) throw new ParseException(ex.toString()); if (v instanceof Value) { Value vv = (Value)v; Value vnew = decodeValue(vv.encodedValue); vv.charset = vnew.charset; vv.value = vnew.value;
if (i <= 0) { if (decodeParametersStrict) throw new ParseException( "Missing charset in encoded value: " + value); return v; // not encoded correctly? return as is. if (li < 0) { if (decodeParametersStrict) throw new ParseException( "Missing language in encoded value: " + value); return v; // not encoded correctly? return as is. value = value.substring(li + 1); v.charset = charset; v.value = decodeBytes(value, charset); } catch (NumberFormatException nex) { if (decodeParametersStrict) throw new ParseException(nex.toString()); } catch (UnsupportedEncodingException uex) { if (decodeParametersStrict) throw new ParseException(uex.toString()); } catch (StringIndexOutOfBoundsException ex) { if (decodeParametersStrict) throw new ParseException(ex.toString());
/** * Constructor that takes a ContentDisposition string. The String * is parsed into its constituents: dispostion and parameters. * A ParseException is thrown if the parse fails. * * @param s the ContentDisposition string. * @exception ParseException if the parse fails. * @since JavaMail 1.2 */ public ContentDisposition(String s) throws ParseException { HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME); HeaderTokenizer.Token tk; // First "disposition" .. tk = h.next(); if (tk.getType() != HeaderTokenizer.Token.ATOM) throw new ParseException("Expected disposition, got " + tk.getValue()); disposition = tk.getValue(); // Then parameters .. String rem = h.getRemainder(); if (rem != null) list = new ParameterList(rem); }
/** * A special wrapper for a StringBuffer that keeps track of the * number of characters used in a line, wrapping to a new line * as necessary; for use by the toString method. */ private static class ToStringBuffer { private int used; // keep track of how much used on current line private StringBuffer sb = new StringBuffer(); public ToStringBuffer(int used) { this.used = used; } public void addNV(String name, String value) { sb.append("; "); used += 2; int len = name.length() + value.length() + 1; if (used + len > 76) { // overflows ... sb.append("\r\n\t"); // .. start new continuation line used = 8; // account for the starting <tab> char } sb.append(name).append('='); used += name.length() + 1; if (used + value.length() > 76) { // still overflows ... // have to fold value String s = MimeUtility.fold(used, value); sb.append(s); int lastlf = s.lastIndexOf('\n'); if (lastlf >= 0) // always true used += s.length() - lastlf - 1;
decodedStream = MimeUtility.decode(decodedStream, contentTransferEncoding); soapStream = MimeUtility.decode(boundaryDelimitedStream, contentTransferEncoding); } else { Messages.getMessage("mimeErrorParsing", e.getMessage())); } catch (java.io.IOException e) { throw new org.apache.axis.AxisFault(
if (i < 0) { if (decodeParametersStrict) throw new ParseException( "Missing charset in encoded value: " + value); return v; // not encoded correctly? return as is. if (li < 0) { if (decodeParametersStrict) throw new ParseException( "Missing language in encoded value: " + value); return v; // not encoded correctly? return as is. } catch (NumberFormatException nex) { if (decodeParametersStrict) throw new ParseException(nex.toString()); } catch (StringIndexOutOfBoundsException ex) { if (decodeParametersStrict) throw new ParseException(ex.toString());
throw new ParseException("In parameter list <" + s + ">" + ", expected parameter name, " + "got \"" + tk.getValue() + "\""); throw new ParseException("In parameter list <" + s + ">" + ", expected '=', " + "got \"" + tk.getValue() + "\""); throw new ParseException("In parameter list <" + s + ">" + ", expected parameter value, " + "got \"" + tk.getValue() + "\""); lastName = name; if (decodeParameters) putEncodedName(name, value); else list.put(name, value); list.put(lastName, value); } else { throw new ParseException("In parameter list <" + s + ">" + ", expected ';', got \"" + tk.getValue() + "\""); combineMultisegmentNames(false);
public ParameterList(String list) throws ParseException { getInitialProperties(); throw new ParseException("Invalid parameter name: " + token.getValue()); throw new ParseException("Missing '='"); throw new ParseException("Invalid parameter value: " + token.getValue()); throw new ParseException("Invalid RFC2231 encoded parameter"); throw new ParseException("Missing ';'");
throw new IOException("Error parsing sender address: " + pe.getMessage());
decodeBytes(vv.value, bos); } else { bos.write(ASCIIUtility.getBytes((String)v)); try { if (charset != null) charset = MimeUtility.javaCharset(charset); if (charset == null || charset.length() == 0) charset = MimeUtility.getDefaultJavaCharset(); if (charset != null) mv.value = bos.toString(charset); } catch (UnsupportedEncodingException uex) { if (decodeParametersStrict) throw new ParseException(uex.toString()); try { vv.value = decodeBytes(vv.value, vv.charset); } catch (UnsupportedEncodingException ex) { if (decodeParametersStrict) throw new ParseException(ex.toString());
Value v = extractCharset(value); try { v.value = decodeBytes(v.value, v.charset); } catch (UnsupportedEncodingException ex) { if (decodeParametersStrict) throw new ParseException(ex.toString()); v = extractCharset(value); } else { v = new Value();
throw new ParseException("Invalid RFC 2047 encoded-word: " + word); throw new ParseException("Missing charset in RFC 2047 encoded-word: " + word); throw new ParseException("Missing encoding in RFC 2047 encoded-word: " + word); throw new ParseException("Missing encoded text in RFC 2047 encoded-word: " + word); throw new UnsupportedEncodingException("Unknown RFC 2047 encoding: " + encoding); return new String(decodedData, javaCharset(charset)); } catch (IOException e) { throw new UnsupportedEncodingException("Invalid RFC 2047 encoding");
Value vnew = decodeValue(evalue); charset = vv.charset = vnew.charset; value = vv.value = vnew.value; break; value = vv.value = decodeBytes(evalue, charset); throw new ParseException(nex.toString()); } catch (UnsupportedEncodingException uex) { if (decodeParametersStrict) throw new ParseException(uex.toString()); } catch (StringIndexOutOfBoundsException ex) { if (decodeParametersStrict) throw new ParseException(ex.toString()); if (v instanceof Value) { Value vv = (Value)v; Value vnew = decodeValue(vv.encodedValue); vv.charset = vnew.charset; vv.value = vnew.value;
if (i <= 0) { if (decodeParametersStrict) throw new ParseException( "Missing charset in encoded value: " + value); return v; // not encoded correctly? return as is. if (li < 0) { if (decodeParametersStrict) throw new ParseException( "Missing language in encoded value: " + value); return v; // not encoded correctly? return as is. value = value.substring(li + 1); v.charset = charset; v.value = decodeBytes(value, charset); } catch (NumberFormatException nex) { if (decodeParametersStrict) throw new ParseException(nex.toString()); } catch (UnsupportedEncodingException uex) { if (decodeParametersStrict) throw new ParseException(uex.toString()); } catch (StringIndexOutOfBoundsException ex) { if (decodeParametersStrict) throw new ParseException(ex.toString());