Code example for ConcurrentModificationException

0
	} 
 
	public boolean parseContent(InputStream input, long length, String contentType, MsgHandler handler) throws IOException, MsgParseException
	{ 
		if (msgHandler != null)
			throw new ConcurrentModificationException("XMLMsgParser instance should not be used concurrently");
		if (contentType != null && !contentType.toLowerCase().startsWith("text/xml") && !contentType.toLowerCase().startsWith("application/xml")) {
			byte contents[] = new byte[2048];
			input.read(contents);
			throw new MsgParseException("Attempt to parse non-XML content type " + contentType + " with XMLMsgParser:\n" + new String(contents));
		} 
 
		try { 
			msgHandler = handler;
			parser.parse(input, this);
		} 
		catch (StopProcessingSAXException e) {
			return false; 
		} 
		catch (SAXException e) {
			throw new MsgParseException(e);