You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by jm...@apache.org on 2007/06/18 03:00:47 UTC
svn commit: r548152 -
/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java
Author: jmsnell
Date: Sun Jun 17 18:00:46 2007
New Revision: 548152
URL: http://svn.apache.org/viewvc?view=rev&rev=548152
Log:
Fix for https://issues.apache.org/jira/browse/ABDERA-49
As suggested by Ugo
Modified:
incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java
Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java?view=diff&rev=548152&r1=548151&r2=548152
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java Sun Jun 17 18:00:46 2007
@@ -35,20 +35,32 @@
@Override
public int read() throws IOException {
- int r = super.read();
- if (r == -1) {
- method.releaseConnection();
+ try {
+ int r = super.read();
+ if (r == -1) {
+ method.releaseConnection();
+ }
+ return r;
+ } catch (IOException e) {
+ if (method != null)
+ method.releaseConnection();
+ throw e;
}
- return r;
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
- int r= super.read(b, off, len);
- if (r == -1) {
- method.releaseConnection();
+ try {
+ int r= super.read(b, off, len);
+ if (r == -1) {
+ method.releaseConnection();
+ }
+ return r;
+ } catch (IOException e) {
+ if (method != null)
+ method.releaseConnection();
+ throw e;
}
- return r;
}
}
Re: svn commit: r548152 - /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java
Posted by James M Snell <ja...@gmail.com>.
no problem. I had actually run across this myself a while back but had
completely forgotten about it. The one change I did make was to ensure
that the method was not null before attempting to release it in the
error handling. The last thing we need is a NPE in the error handling
code ;-)
- James
Ugo Cei wrote:
>
> On Jun 18, 2007, at 3:00 AM, jmsnell@apache.org wrote:
>
>> Fix for https://issues.apache.org/jira/browse/ABDERA-49
>> As suggested by Ugo
>
> Thanks for committing it. I would have done this myself but wanted some
> review first.
>
> Ugo
>
>
Re: svn commit: r548152 - /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java
Posted by Ugo Cei <u....@sourcesense.com>.
On Jun 18, 2007, at 3:00 AM, jmsnell@apache.org wrote:
> Fix for https://issues.apache.org/jira/browse/ABDERA-49
> As suggested by Ugo
Thanks for committing it. I would have done this myself but wanted
some review first.
Ugo