@Test public void testParsingInvalidSyntax1() throws Exception { String s = "raw stuff;\r\n more stuff"; ByteSequence raw = ContentUtil.encode(s); try { parser.parseField(raw); org.junit.Assert.fail("MimeException should have been thrown"); } catch (MimeException expected) { } }
public RawField parseField(final ByteSequence raw) throws MimeException { if (raw == null) { return null; } ParserCursor cursor = new ParserCursor(0, raw.length()); String name = parseToken(raw, cursor, COLON); if (cursor.atEnd()) { throw new MimeException("Invalid MIME field: no name/value separator found: " + raw.toString()); } return new RawField(raw, cursor.getPos(), name, null); }
RawFieldParser { public RawField parseField(final ByteSequence raw) throws MimeException { if (raw == null) { return null; } ParserCursor cursor = new ParserCursor(0, raw.length()); String name = parseToken(raw, cursor, COLON); if (cursor.atEnd()) { throw new MimeException("Invalid MIME field: no name/value separator found: " + raw.toString()); } return new RawField(raw, cursor.getPos(), name, null); } }
RawFieldParser { public RawField parseField(final ByteSequence raw) throws MimeException { if (raw == null) { return null; } ParserCursor cursor = new ParserCursor(0, raw.length()); String name = parseToken(raw, cursor, COLON); if (cursor.atEnd()) { throw new MimeException("Invalid MIME field: no name/value separator found: " + raw.toString()); } return new RawField(raw, cursor.getPos(), name, null); }  }
RawFieldParser { public RawField parseField(final ByteSequence raw) throws MimeException { if (raw == null) { return null; } ParserCursor cursor = new ParserCursor(0, raw.length()); String name = parseToken(raw, cursor, COLON); if (cursor.atEnd()) { throw new MimeException("Invalid MIME field: no name/value separator found: " + raw.toString()); } return new RawField(raw, cursor.getPos(), name, null); }  static BitSet INIT_BITSET(int ... b); RawField parseField(final ByteSequence raw); RawBody parseRawBody(final RawField field); RawBody parseRawBody(final ByteSequence buf, final ParserCursor cursor); List<NameValuePair> parseParameters(final ByteSequence buf, final ParserCursor cursor); NameValuePair parseParameter(final ByteSequence buf, final ParserCursor cursor); String parseToken(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters); String parseValue(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters); void skipWhiteSpace(final ByteSequence buf, final ParserCursor cursor); void skipComment(final ByteSequence buf, final ParserCursor cursor); void skipAllWhiteSpace(final ByteSequence buf, final ParserCursor cursor); void copyContent(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters,
            final StringBuilder dst); void copyUnquotedContent(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters,
                            final StringBuilder dst); void copyQuotedContent(final ByteSequence buf, final ParserCursor cursor,
            final StringBuilder dst); }
RawFieldParser { public RawField parseField(final ByteSequence raw) throws MimeException { if (raw == null) { return null; } ParserCursor cursor = new ParserCursor(0, raw.length()); String name = parseToken(raw, cursor, COLON); if (cursor.atEnd()) { throw new MimeException("Invalid MIME field: no name/value separator found: " + raw.toString()); } return new RawField(raw, cursor.getPos(), name, null); }  static BitSet INIT_BITSET(int ... b); RawField parseField(final ByteSequence raw); RawBody parseRawBody(final RawField field); RawBody parseRawBody(final ByteSequence buf, final ParserCursor cursor); List<NameValuePair> parseParameters(final ByteSequence buf, final ParserCursor cursor); NameValuePair parseParameter(final ByteSequence buf, final ParserCursor cursor); String parseToken(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters); String parseValue(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters); void skipWhiteSpace(final ByteSequence buf, final ParserCursor cursor); void skipComment(final ByteSequence buf, final ParserCursor cursor); void skipAllWhiteSpace(final ByteSequence buf, final ParserCursor cursor); void copyContent(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters,
            final StringBuilder dst); void copyUnquotedContent(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters,
                            final StringBuilder dst); void copyQuotedContent(final ByteSequence buf, final ParserCursor cursor,
            final StringBuilder dst); static final RawFieldParser DEFAULT; }