tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: svn commit: r1600109 - in /tomcat/trunk/java/org/apache/coyote: ./ ajp/ http11/ spdy/
Date Wed, 04 Jun 2014 11:36:11 GMT
2014-06-04 15:25 GMT+04:00  <markt@apache.org>:
> Author: markt
> Date: Wed Jun  4 11:25:51 2014
> New Revision: 1600109
>
> URL: http://svn.apache.org/r1600109
> Log:
> Refactoring.
> Switch from a boolean to an Enum for error state so we can differentiate between an error
that requires the connection is closed after the current response is completed and an error
that requires that the connection is closed immediately.
> This commit should be a NO-OP. While the different error states are set, the only the
presence of an error (or not) is tested - i.e. no change from the implementation prior to
this commit.
> Try to be consistent when an error occurs. Set the status code first (if required), then
set the error state and finally log (if required).
>
> Added:
>     tomcat/trunk/java/org/apache/coyote/ErrorState.java   (with props)
> Modified:
>     tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java
>     tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
>     tomcat/trunk/java/org/apache/coyote/ajp/AjpNio2Processor.java
>     tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
>     tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
>     tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
>     tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java
>     tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
>     tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java
>
> Modified: tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java?rev=1600109&r1=1600108&r2=1600109&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java (original)
> +++ tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java Wed Jun  4 11:25:51 2014
> @@ -40,9 +40,9 @@ public abstract class AbstractProcessor<
>      protected SocketWrapper<S> socketWrapper = null;
>
>      /**
> -     * Error flag.
> +     * Error state for the request/response currently being processed.
>       */
> -    protected boolean error;
> +    private ErrorState errorState;

You have to assign ErrorState.NONE here by default.
Otherwise I expect "setErrorState" to fail with NPE.

> +    protected void setErrorState(ErrorState errorState) {
> +        this.errorState = this.errorState.getMostSevere(errorState);
> +    }
> +
> +
> +    protected void resetErrorState() {
> +        errorState = ErrorState.NONE;
> +    }
> +
> +
> +    protected ErrorState getErrorState() {
> +        return errorState;
> +    }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message