commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien Aymé <julien.a...@gmail.com>
Subject Re: svn commit: r934041 - in /commons/proper/io/trunk/src/java/org/apache/commons/io: input/ProxyInputStream.java output/ProxyOutputStream.java
Date Thu, 15 Apr 2010 06:05:10 GMT
Hi,

I think that the ProxyOutputStream can still throw a NPE:
->  afterWrite(bts.length);
will throw a NPE whenever bts is null.

Regards,
Julien

2010/4/14  <jukka@apache.org>:
> Author: jukka
> Date: Wed Apr 14 17:37:24 2010
> New Revision: 934041
>
> URL: http://svn.apache.org/viewvc?rev=934041&view=rev
> Log:
> IO-211: Pre- and post-processing support for proxied streams
>
> Add null protection as pointed out in IO-242
>
> Modified:
>    commons/proper/io/trunk/src/java/org/apache/commons/io/input/ProxyInputStream.java
>    commons/proper/io/trunk/src/java/org/apache/commons/io/output/ProxyOutputStream.java
>
> Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/input/ProxyInputStream.java
> URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/input/ProxyInputStream.java?rev=934041&r1=934040&r2=934041&view=diff
> ==============================================================================
> --- commons/proper/io/trunk/src/java/org/apache/commons/io/input/ProxyInputStream.java
(original)
> +++ commons/proper/io/trunk/src/java/org/apache/commons/io/input/ProxyInputStream.java
Wed Apr 14 17:37:24 2010
> @@ -74,7 +74,7 @@ public abstract class ProxyInputStream e
>     @Override
>     public int read(byte[] bts) throws IOException {
>         try {
> -            beforeRead(bts.length);
> +            beforeRead(bts != null ? bts.length : 0);
>             int n = in.read(bts);
>             afterRead(n);
>             return n;
>
> Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/output/ProxyOutputStream.java
> URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/output/ProxyOutputStream.java?rev=934041&r1=934040&r2=934041&view=diff
> ==============================================================================
> --- commons/proper/io/trunk/src/java/org/apache/commons/io/output/ProxyOutputStream.java
(original)
> +++ commons/proper/io/trunk/src/java/org/apache/commons/io/output/ProxyOutputStream.java
Wed Apr 14 17:37:24 2010
> @@ -68,7 +68,7 @@ public class ProxyOutputStream extends F
>     @Override
>     public void write(byte[] bts) throws IOException {
>         try {
> -            beforeWrite(bts.length);
> +            beforeWrite(bts != null ? bts.length : 0);
>             out.write(bts);
>             afterWrite(bts.length);
>         } catch (IOException e) {
>
>
>

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


Mime
View raw message