You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/11/08 01:08:25 UTC
svn commit: r1539872 -
/tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java
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;
+ }
+ return result;
}
return cachedContentLength.longValue();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1539872 - /tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java
Posted by Mark Thomas <ma...@apache.org>.
On 08/11/2013 00:24, Cyril Bonté wrote:
> Hi Mark,
>
> I wonder if this commit is correct.
You are right, the commit isn't right.
A fix is on the way.
Thanks for the catch.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1539872 - /tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java
Posted by Cyril Bonté <cy...@free.fr>.
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