Author: fmui
Date: Thu Nov 15 14:10:05 2012
New Revision: 1409797
URL: http://svn.apache.org/viewvc?rev=1409797&view=rev
Log:
Corrected InputStream behavior
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.java
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.java
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.java?rev=1409797&r1=1409796&r2=1409797&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.java
Thu Nov 15 14:10:05 2012
@@ -322,6 +322,10 @@ public class ThresholdOutputStream exten
@Override
public int available() {
+ if (buf == null) {
+ return 0;
+ }
+
return bufSize - pos;
}
@@ -353,6 +357,10 @@ public class ThresholdOutputStream exten
@Override
public long skip(long n) {
+ if (buf == null) {
+ return -1;
+ }
+
if ((pos + n) > bufSize) {
n = bufSize - pos;
}
@@ -408,7 +416,7 @@ public class ThresholdOutputStream exten
@Override
public int available() throws IOException {
if (isClosed) {
- throw new IOException("Stream is already closed!");
+ return 0;
}
return stream.available();
@@ -438,7 +446,7 @@ public class ThresholdOutputStream exten
@Override
public long skip(long n) throws IOException {
if (isClosed) {
- throw new IOException("Stream is already closed!");
+ return -1;
}
return stream.skip(n);