opendap/src/main/java/opendap/servlet/AbstractServlet.java
public void anyExceptionHandler(Throwable e, ReqState rs) {
    log.error("DODServlet ERROR (anyExceptionHandler): " + e);
    printThrowable(e);
    try {
        if(rs == null)
          throw new DAP2Exception("anyExceptionHandler: no request state provided");
        log.error(rs.toString());
        HttpServletResponse response = rs.getResponse();
        log.error(rs.toString());
        if (track) {
          RequestDebug reqD = (RequestDebug) rs.getUserObject();
          log.error("  request number: " + reqD.reqno + " thread: " + reqD.threadDesc);
        }
        response.setHeader("Content-Description", "dods-error");

        // This should probably be set to "plain" but this works, the
        // C++ slients don't barf as they would if I sent "plain" AND
        // the C++ don't expect compressed data if I do this...
        response.setHeader("Content-Encoding", "");

        // Strip any double quotes out of the parser error message.
        // These get stuck in auto-magically by the javacc generated parser
        // code and they break our error parser (bummer!)
        String msg = e.getMessage();
        if (msg != null)
          msg = msg.replace('\"', '\'');
        DAP2Exception de2 = new DAP2Exception(opendap.dap.DAP2Exception.UNDEFINED_ERROR, msg);
        BufferedOutputStream eOut = new BufferedOutputStream(response.getOutputStream());
        de2.print(eOut);
    } catch (Exception ioe) {
      log.error("Cannot respond to client! IO Error: " + ioe.getMessage());
    }
  }
public void anyExceptionHandler(Throwable e, ReqState rs) {
    log.error("DODServlet ERROR (anyExceptionHandler): " + e);
    printThrowable(e);
    try {
        if(rs == null)
          throw new DAP2Exception("anyExceptionHandler: no request state provided");
        log.error(rs.toString());
        HttpServletResponse response = rs.getResponse();
        log.error(rs.toString());
        if (track) {
          RequestDebug reqD = (RequestDebug) rs.getUserObject();
          log.error("  request number: " + reqD.reqno + " thread: " + reqD.threadDesc);
        }
        response.setHeader("Content-Description", "dods-error");

        // This should probably be set to "plain" but this works, the
        // C++ slients don't barf as they would if I sent "plain" AND
        // the C++ don't expect compressed data if I do this...
        response.setHeader("Content-Encoding", "");

        // Strip any double quotes out of the parser error message.
        // These get stuck in auto-magically by the javacc generated parser
        // code and they break our error parser (bummer!)
        String msg = e.getMessage();
        if (msg != null)
          msg = msg.replace('\"', '\'');
        DAP2Exception de2 = new DAP2Exception(opendap.dap.DAP2Exception.UNDEFINED_ERROR, msg);
        BufferedOutputStream eOut = new BufferedOutputStream(response.getOutputStream());
        de2.print(eOut);
    } catch (Exception ioe) {
      log.error("Cannot respond to client! IO Error: " + ioe.getMessage());
    }
  }
public void anyExceptionHandler ( Throwable e , ReqState rs ) { log . error ( "DODServlet ERROR (anyExceptionHandler): " + e ) ; printThrowable ( e ) ; try { if ( rs == null ) throw new DAP2Exception ( "anyExceptionHandler: no request state provided" ) ; log . error ( rs . toString ( ) ) ; HttpServletResponse response = rs . getResponse ( ) ; log . error ( rs . toString ( ) ) ; if ( track ) { RequestDebug reqD = ( RequestDebug ) rs . getUserObject ( ) ; log . error ( "  request number: " + reqD . reqno + " thread: " + reqD . threadDesc ) ; } response . setHeader ( "Content-Description" , "dods-error" ) ; // This should probably be set to "plain" but this works, the // C++ slients don't barf as they would if I sent "plain" AND // the C++ don't expect compressed data if I do this... response . setHeader ( "Content-Encoding" , "" ) ; // Strip any double quotes out of the parser error message. // These get stuck in auto-magically by the javacc generated parser // code and they break our error parser (bummer!) String msg = e . getMessage ( ) ; if ( msg != null ) msg = msg . replace ( ' ' , ' ' ) ; DAP2Exception de2 = new DAP2Exception ( opendap . dap . DAP2Exception . UNDEFINED_ERROR , msg ) ; BufferedOutputStream eOut = new BufferedOutputStream ( response . getOutputStream ( ) ) ; de2 . print ( eOut ) ; } catch ( Exception ioe ) { log . error ( "Cannot respond to client! IO Error: " + ioe . getMessage ( ) ) ; } }
************************************************************************
Sends an error to the client.

@param e  The exception that caused the problem.
@param rs The <code>ReqState</code> for the client.
************************************************************************ Sends an error to the client .