tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyril Bonté <cyril.bo...@free.fr>
Subject Re: svn commit: r1539872 - /tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java
Date Fri, 08 Nov 2013 00:24:49 GMT
Hi Mark,

I wonder if this commit is correct.
See below,

Le 08/11/2013 01:08, markt@apache.org a écrit :
> Author: markt
> Date: Fri Nov  8 00:08:25 2013
> New Revision: 1539872
>
> URL: http://svn.apache.org/r1539872
> Log:
> Protect against possible NPE
>
> Modified:
>      tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java
>
> Modified: tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java?rev=1539872&r1=1539871&r2=1539872&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java Fri Nov  8
00:08:25 2013
> @@ -170,8 +170,12 @@ public class CachedResource implements W
>       public long getContentLength() {
>           Long cachedContentLength = this.cachedContentLength;
>           if (cachedContentLength == null) {
> -            cachedContentLength = Long.valueOf(webResource.getContentLength());
> -            this.cachedContentLength = cachedContentLength;
> +            long result = 0;
> +            if (webResource != null) {
> +                cachedContentLength = Long.valueOf(webResource.getContentLength());
> +                this.cachedContentLength = cachedContentLength;

Here, don't we want to modify the "return" value in order to return the 
webResource content length ?

> +            }
> +            return result;
>           }
>           return cachedContentLength.longValue();
>       }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>


-- 
Cyril Bonté

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


Mime
View raw message