/*
@see
com.ibm.wsspi.channelfw.InterChannelCallback#error(com.ibm.wsspi.channelfw
.VirtualConnection, java.lang.Throwable)
9934
public void error(VirtualConnection vc, Throwable t) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "error() called: " + vc);
        }
        // can't do anything with a null VC
        if (null == vc) {
            return;
        }
        Object o = vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPICL);
        if (null == o) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "ERROR: null ICL in error()");
            }
            return;
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Error occurring while purging body: " + t);
        }
        // close the connection
        ((HttpInboundLink) o).close(vc, (Exception) t);
    }
950973
@Override
	public void error(String msg, Throwable e) {
		LoggerFactory.getLogger(from).error(msg);
	}
740860
@Override
    public void error(String msg, Throwable error) {
        try {
            if ((verbose || stacktrace) && error != null) {
                printStackTrace(msg, error);
                error(ERROR, msg);
            } else {
                error(ERROR, msg + STACKTRACE_MESSAGE);
            }
        } finally {
            postPrintMessage();
        }
    }
1089148
public static void sendError( String messageKey, Throwable cause, ServletRequest request,
                                  HttpServletResponse response, Object[] messageArgs )
            throws IOException
    {
        // TODO: the following null check will be unnecessary once the deprecated
        // FlowController.sendError(String, HttpServletResponse) is removed.
        boolean avoidDirectResponseOutput = request != null ? avoidDirectResponseOutput( request ) : false;
        sendError( messageKey, messageArgs, request, response, cause, avoidDirectResponseOutput );
    }
1210565
@Override
    protected final void onStreamError(ChannelHandlerContext ctx, boolean outbound, Throwable cause,
                                 Http2Exception.StreamException streamException) {
        int streamId = streamException.streamId();
        Http2Stream connectionStream = connection().stream(streamId);
        if (connectionStream == null) {
            onHttp2UnknownStreamError(ctx, cause, streamException);
            // Write a RST_STREAM
            super.onStreamError(ctx, outbound, cause, streamException);
            return;
        }

        Http2FrameStream stream = connectionStream.getProperty(streamKey);
        if (stream == null) {
            LOG.warn("Stream exception thrown without stream object attached.", cause);
            // Write a RST_STREAM
            super.onStreamError(ctx, outbound, cause, streamException);
            return;
        }

        if (!outbound) {
            // We only forward non outbound errors as outbound errors will already be reflected by failing the promise.
            onHttp2FrameStreamException(ctx, new Http2FrameStreamException(stream, streamException.error(), cause));
        }
    }
240071
@Override
    public void error(VirtualConnection vc, TCPReadRequestContext rsc, IOException ioe) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "error() called: " + vc);
        }

        HttpInboundLink myLink = (HttpInboundLink) (vc == null ? null : vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPICL));
        if (myLink == null)
        {

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "error: myLink is null");

            }

        }

        else {

            HttpInboundServiceContextImpl isc = myLink.getHTTPContext();
            isc.setPersistent(false);
            myLink.setFilterCloseExceptions(true);
            // if there was no data in the 2nd or later request, then just close
            // as this would be a timeout on the persist read. All other cases
            // we should send the 408 Request Timeout error page back
            if ((myLink.isFirstRequest() || myLink.isPartiallyParsed())
                && (ioe instanceof SocketTimeoutException)) {
                try {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Error, sending 408 timeout back");
                    }
                    if (isc.getHttpConfig().getDebugLog().isEnabled(DebugLog.Level.WARN)) {
                        isc.getHttpConfig().getDebugLog().log(DebugLog.Level.WARN, HttpMessages.MSG_READ_FAIL, isc);
                    }
                    isc.setHeadersParsed();
                    isc.sendError(StatusCodes.REQ_TIMEOUT.getHttpError());
                } catch (MessageSentException mse) {
                    FFDCFilter.processException(mse, getClass().getName() + ".error", "152");
                    // shouldn't be possible since we're timing out during the
                    // read for the inbound request
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "MessageSent error during ICL read error");
                    }
                    myLink.close(vc, ioe);
                }
            } else {
                // this is during the read for a secondary request message with no
                // current parse taking place.
                myLink.close(vc, ioe);
            }
        }
    }
621515
@Override
    public void error(VirtualConnection vc, TCPWriteRequestContext wsc, IOException ioe) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "error called: vc=" + vc + " ioe=" + ioe);
        }
        HttpInboundServiceContextImpl mySC = (HttpInboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPISC);

        if (mySC.getHttpConfig().getDebugLog().isEnabled(DebugLog.Level.WARN)) {
            mySC.getHttpConfig().getDebugLog().log(DebugLog.Level.WARN, HttpMessages.MSG_WRITE_FAIL, mySC);
        }
        mySC.logLegacyMessage();
        // pass on the error if possible, else just close the connection
        mySC.setPersistent(false);
        if (null != mySC.getAppWriteCallback()) {
            mySC.getAppWriteCallback().error(vc, ioe);
        } else {
            mySC.getLink().getDeviceLink().close(vc, ioe);
        }
    }
893621
@Override
    void connectionError(SibRaMessagingEngineConnection connection, SIException exception)
    {
        String methodName = "connectionError";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.entry(this, TRACE, methodName, new Object[] { connection, exception });
        }

        /*
         * We have lost our remote connection, output a warning to the
         * admin console, close the connection and schedule an attempt
         * to create a new one
         */

        SibTr.warning(TRACE, "CONNECTION_ERROR_CWSIV0776",
                      new Object[] { connection.getConnection().getMeName(),
                                    _endpointConfiguration.getBusName(), this,
                                    exception });

        dropConnection(connection, false, true, true);

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.exit(this, TRACE, methodName);
        }
    }
1162746
@Override
    protected void throwExceptionForError(final int errorCode) {
        try {
            m_connection.throwException(errorCode);
        } catch (final IOException e) {
            throw new RuntimeException(e);
        }
    }
1099540
@Override
	protected void onOutboundError(Throwable err) {

		if (!channel().isActive()) {
			super.onOutboundError(err);
			return;
		}

		if (markSentHeaders()) {
			log.error(format(channel(), "Error starting response. Replying error status"), err);

			HttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
					HttpResponseStatus.INTERNAL_SERVER_ERROR);
			response.headers()
			        .setInt(HttpHeaderNames.CONTENT_LENGTH, 0)
			        .set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE);
			channel().writeAndFlush(response)
			         .addListener(ChannelFutureListener.CLOSE);
			return;
		}

		markSentBody();
		log.error(format(channel(), "Error finishing response. Closing connection"), err);
		channel().writeAndFlush(EMPTY_BUFFER)
		         .addListener(ChannelFutureListener.CLOSE);
	}
160406
public boolean error(final Object socketOrChannel)
    {
        final PollItem it = filter(socketOrChannel, ERR);
        if (it == null) {
            return false;
        }
        return it.isError();
    }
42571
public void error(Throwable t) {
        if (isEnabled() && isErrorEnabled()) {
            dispatchLogException(new LogEvent(this, LogEvent.ERROR_TYPE, t));
        }
    }
825168
@Override
    public void sendError(int code, String message) throws IOException {
        if (isCommitted()) {
            throw new IllegalStateException("Response already committed");
        }
        resetBuffer();
        this.response.setStatus(code);
        commit();
        if (null != message) {
            if (null != this.outWriter) {
                this.outWriter.print(message);
            } else {
                this.outStream.print(message);
            }
            flushBuffer();
        }
    }
1169627
public void handleError(SelectableChannel channel) {
    SocketAddress channelAddress = ((SocketChannel) channel).socket().getRemoteSocketAddress();
    LOG.info("Handling error from channel: " + channelAddress);
    SocketChannelHelper helper = activeConnections.get(channel);
    if (helper == null) {
      LOG.severe("Inactive channel had error?");
      return;
    }
    helper.clear();
    LOG.info("Removing all interest on channel: " + channelAddress);
    nioLooper.removeAllInterest(channel);
    try {
      channel.close();
    } catch (IOException e) {
      LOG.severe("Error closing connection in handleError");
    }
    activeConnections.remove(channel);
    onClose((SocketChannel) channel);
  }
1185474
@Override
    public void onError(ChannelHandlerContext ctx, boolean outbound, Throwable cause) {
        Http2Exception embedded = getEmbeddedHttp2Exception(cause);
        if (isStreamError(embedded)) {
            onStreamError(ctx, outbound, cause, (StreamException) embedded);
        } else if (embedded instanceof CompositeStreamException) {
            CompositeStreamException compositException = (CompositeStreamException) embedded;
            for (StreamException streamException : compositException) {
                onStreamError(ctx, outbound, cause, streamException);
            }
        } else {
            onConnectionError(ctx, outbound, cause, embedded);
        }
        ctx.flush();
    }
411444
public void error(VirtualConnection vc, TCPReadRequestContext rsc, IOException ioe) {

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "error() called: vc=" + vc + " ioe=" + ioe);
        }
        HttpOutboundServiceContextImpl mySC = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC);
        mySC.setPersistent(false);
        mySC.reConnect(vc, ioe);
    }
801937
void sessionError(final SibRaMessagingEngineConnection connection,
            final ConsumerSession session, final Throwable throwable) {

        /*
         * Do nothing - sessions are only used synchronously so the caller will
         * be notified
         */

        final String methodName = "sessionError";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName, new Object[] { connection,
                    session, throwable });
            SibTr.exit(this, TRACE, methodName);
        }

    }