hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ossf...@dubioso.net>
Subject Re: svn commit: r554367 - in /jakarta/httpcomponents/httpcore/trunk: ./ module-main/src/main/java/org/apache/http/protocol/ module-main/src/test/java/org/apache/http/protocol/
Date Sun, 08 Jul 2007 13:51:30 GMT
Sorry, I hadn't reviewed that patch before...

> +    // non-Javadoc, see interface HttpRequestInterceptorList
> +    public void addRequestInterceptor(final HttpRequestInterceptor itcp, int index)
{
> +        
> +        if (itcp == null) {
> +            return;
> +        }
> +        if (this.requestInterceptors == null) {
> +            this.requestInterceptors = new ArrayList();
> +        }
> +        
> +        if (index == Integer.MAX_VALUE) {
> +            // Add last
> +            this.requestInterceptors.add(this.requestInterceptors.size() - 1, itcp);
> +        } else {
> +            // Insert at preferred index
> +            this.requestInterceptors.add(index, itcp);
> +        }
> +    }

This does leave room for IndexOutOfRangeExceptions, which is not
what I had in mind. Can you please change that to...

  if ((index < 0) || (index > this.requestInterceptors.size())
     index = this.requestInterceptors.size();
  this.requestInterceptors.add(index, itcp);

and likewise for the response interceptors?

cheers,
  Roland

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


Mime
View raw message