currentMessage);
rawMessage);
	private SIPMessage parseMessage(String currentMessage)		throws ParseException {		// position line counter at the end of the		// sip messages.		// System.out.println("parsing " + currentMessage);		int sip_message_size = 0; // # of lines in the sip message		SIPMessage sipmsg = null;		java.util.StringTokenizer tokenizer =			new java.util.StringTokenizer(currentMessage, "\n", true);		messageHeaders = new Vector(); // A list of headers for error reporting		try {			while (tokenizer.hasMoreElements()) {				String nexttok = tokenizer.nextToken();				if (nexttok.equals("\n")) {					String nextnexttok = tokenizer.nextToken();					if (nextnexttok.equals("\n")) {						break;					} else						messageHeaders.add(nextnexttok);				} else					messageHeaders.add(nexttok);				sip_message_size++;			}		} catch (NoSuchElementException ex) {		}		currentLine = 0;		currentHeader = (String) messageHeaders.elementAt(currentLine);		String firstLine = currentHeader;		// System.out.println("first Line " + firstLine);		if (!firstLine.startsWith(SIPConstants.SIP_VERSION_STRING)) {			sipmsg = new SIPRequest();			try {				RequestLine rl =					new RequestLineParser(firstLine + "\n").parse();				((SIPRequest) sipmsg).setRequestLine(rl);			} catch (ParseException ex) {				if (this.parseExceptionListener != null)					this.parseExceptionListener.handleException(						ex,						sipmsg,						RequestLine.class,						firstLine,						currentMessage);				else					throw ex;			}		} else {			sipmsg = new SIPResponse();			try {				StatusLine sl = new StatusLineParser(firstLine + "\n").parse();				((SIPResponse) sipmsg).setStatusLine(sl);			} catch (ParseException ex) {				if (this.parseExceptionListener != null) {					this.parseExceptionListener.handleException(						ex,						sipmsg,						StatusLine.class,						firstLine,						currentMessage);				} else					throw ex;			}		}		for (int i = 1; i < messageHeaders.size(); i++) {			String hdrstring = (String) messageHeaders.elementAt(i);			if (hdrstring == null || hdrstring.trim().equals(""))				continue;			HeaderParser hdrParser = null;			try {				hdrParser = ParserFactory.createParser(hdrstring + "\n");			} catch (ParseException ex) {				this.parseExceptionListener.handleException(					ex,					sipmsg,					null,					hdrstring,					currentMessage);				continue;			}			try {				SIPHeader sipHeader = hdrParser.parse();				sipmsg.attachHeader(sipHeader, false);			} catch (ParseException ex) {				if (this.parseExceptionListener != null) {					String hdrName = Lexer.getHeaderName(hdrstring);					Class hdrClass = NameMap.getClassFromName(hdrName);					try {						if (hdrClass == null) {							hdrClass =								Class.forName(									PackageNames.SIPHEADERS_PACKAGE										+ ".ExtensionHeaderImpl");						}						this.parseExceptionListener.handleException(							ex,							sipmsg,							hdrClass,							hdrstring,							currentMessage);					} catch (ClassNotFoundException ex1) {						InternalErrorHandler.handleException(ex1);					}				}			}		}		return sipmsg;	}