public void handleException(ParseException ex,SIPMessage sipMessage,Class hdrClass,String header,String message) throws ParseException {
  if (logger.isLoggingEnabled())   logger.logException(ex);
  if ((hdrClass != null) && (hdrClass.equals(From.class) || hdrClass.equals(To.class) || hdrClass.equals(CSeq.class)|| hdrClass.equals(Via.class)|| hdrClass.equals(CallID.class)|| hdrClass.equals(ContentLength.class)|| hdrClass.equals(RequestLine.class)|| hdrClass.equals(StatusLine.class))) {
    if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {
      logger.logDebug("Encountered Bad Message \n" + sipMessage.toString());
    }
    String msgString=sipMessage.toString();
    if (!msgString.startsWith("SIP/") && !msgString.startsWith("ACK ")) {
      if (mySock != null) {
        if (logger.isLoggingEnabled(LogWriter.TRACE_ERROR)) {
          logger.logError("Malformed mandatory headers: closing socket! :" + mySock.toString());
        }
        try {
          mySock.close();
        }
 catch (        IOException ie) {
          if (logger.isLoggingEnabled(LogWriter.TRACE_ERROR)) {
            logger.logError("Exception while closing socket! :" + mySock.toString() + ":"+ ie.toString());
          }
        }
      }
    }
    throw ex;
  }
 else {
    sipMessage.addUnparsed(header);
  }
}

public void handleException ( ParseException ex , SIPMessage sipMessage , Class hdrClass , String header , String message ) throws ParseException { if ( logger . isLoggingEnabled ( ) ) logger . logException ( ex ) ; if ( ( hdrClass != null ) && ( hdrClass . equals ( From . class ) || hdrClass . equals ( To . class ) || hdrClass . equals ( CSeq . class ) || hdrClass . equals ( Via . class ) || hdrClass . equals ( CallID . class ) || hdrClass . equals ( ContentLength . class ) || hdrClass . equals ( RequestLine . class ) || hdrClass . equals ( StatusLine . class ) ) ) { if ( logger . isLoggingEnabled ( LogWriter . TRACE_DEBUG ) ) { logger . logDebug ( "Encountered Bad Message \n" + sipMessage . toString ( ) ) ; } String msgString = sipMessage . toString ( ) ; if ( ! msgString . startsWith ( "SIP/" ) && ! msgString . startsWith ( "ACK " ) ) { if ( mySock != null ) { if ( logger . isLoggingEnabled ( LogWriter . TRACE_ERROR ) ) { logger . logError ( "Malformed mandatory headers: closing socket! :" + mySock . toString ( ) ) ; } try { mySock . close ( ) ; } catch ( IOException ie ) { if ( logger . isLoggingEnabled ( LogWriter . TRACE_ERROR ) ) { logger . logError ( "Exception while closing socket! :" + mySock . toString ( ) + ":" + ie . toString ( ) ) ; } } } } throw ex ; } else { sipMessage . addUnparsed ( header ) ; } }
exception processor for exceptions detected from the parser . ( this is invoked by the parser when an error is detected ) .
