Examples of MimeException


Examples of org.apache.james.mime4j.MimeException

        RawField field = RawFieldParser.DEFAULT.parseField(copy);
        String name = field.getName();
        for (int i = 0; i < name.length(); i++) {
            char ch = name.charAt(i);
            if (!FIELD_CHARS.get(ch)) {
                throw new MimeException("MIME field name contains illegal characters: "
                        + field.getName());
            }
        }
        return field;
    }
View Full Code Here

Examples of org.apache.james.mime4j.MimeException

                try {
                    contentLength = Long.parseLong(value.trim());
                } catch (NumberFormatException e) {
                    if (monitor.warn("Invalid content length: " + value,
                            "ignoring Content-Length header")) {
                        throw new MimeException("Invalid Content-Length header: " + value);
                    }
                }
            }
        } else if (name.equals("content-type") && mimeType == null) {
            parseContentType(field);
View Full Code Here

Examples of org.apache.james.mime4j.MimeException

                inbuffer.ensureCapacity(bufferSize);
                mimeStream = new MimeBoundaryInputStream(inbuffer, boundary);
            }
        } catch (IllegalArgumentException e) {
            // thrown when boundary is too long
            throw new MimeException(e.getMessage(), e);
        }
        dataStream = new LineReaderInputStreamAdaptor(mimeStream);
    }
View Full Code Here

Examples of org.apache.james.mime4j.MimeException

        final String size = (String) contentDispositionParameters.get(MimeUtil.PARAM_SIZE);
        if (size != null) {
            try {
                contentDispositionSize = Long.parseLong(size);
            } catch (NumberFormatException e) {
                this.contentDispositionSizeParseException = (MimeException) new MimeException(e.getMessage(), e).fillInStackTrace();
            }
        }
        contentDispositionParameters.remove("");
    }
View Full Code Here

Examples of org.apache.james.mime4j.MimeException

        Entity e = getParent();
       
        ContentTypeField cField = (ContentTypeField) e.getHeader().getField(
                Field.CONTENT_TYPE);
        if (cField == null || cField.getBoundary() == null) {
            throw new MimeException("Multipart boundary not specified");
        }
        String boundary = cField.getBoundary();

        Charset charset = null;
        if (mode == MessageUtils.LENIENT) {
View Full Code Here

Examples of org.apache.james.mime4j.MimeException

                new OutputStreamWriter(out, charset), 8192);
        for (Iterator it = fields.iterator(); it.hasNext();) {
            Field field = (Field) it.next();
            String fs = field.toString();
            if (mode == MessageUtils.STRICT_ERROR && !MessageUtils.isASCII(fs)) {
                throw new MimeException("Header '" + fs + "' violates RFC 822");
            }
            writer.write(fs);
            writer.write(MessageUtils.CRLF);
        }
        writer.write(MessageUtils.CRLF);
View Full Code Here

Examples of org.apache.james.mime4j.MimeException

                inbuffer.ensureCapacity(bufferSize);
                mimeStream = new MimeBoundaryInputStream(inbuffer, boundary);
            }
        } catch (IllegalArgumentException e) {
            // thrown when boundary is too long
            throw new MimeException(e.getMessage(), e);
        }
        dataStream = new LineReaderInputStreamAdaptor(
                mimeStream,
                config.getMaxLineLen());
    }
View Full Code Here

Examples of org.apache.james.mime4j.MimeException

        final String size = contentDispositionParameters.get(MimeUtil.PARAM_SIZE);
        if (size != null) {
            try {
                contentDispositionSize = Long.parseLong(size);
            } catch (NumberFormatException e) {
                this.contentDispositionSizeParseException = (MimeException) new MimeException(e.getMessage(), e).fillInStackTrace();
            }
        }
        contentDispositionParameters.remove("");
    }
View Full Code Here

Examples of org.apache.james.mime4j.MimeException

        /*
         * Split into name and value.
         */
        final Matcher fieldMatcher = FIELD_NAME_PATTERN.matcher(unfolded);
        if (!fieldMatcher.find()) {
            throw new MimeException("Invalid field in string");
        }
        final String name = fieldMatcher.group(1);

        String body = unfolded.substring(fieldMatcher.end());
        if (body.length() > 0 && body.charAt(0) == ' ') {
View Full Code Here

Examples of org.apache.james.mime4j.MimeException

                break;
            case T_START_MULTIPART:
                mimeDescriptorImpl = compositePartDescriptor(parser, headers);
                break;
            case T_END_OF_STREAM:
                throw new MimeException("Premature end of stream");
            default:
                throw new MimeException("Unexpected parse state");
        }
        return mimeDescriptorImpl;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.