/**
* Proxy directory context.
*/
- protected ProxyDirContext resources = null;
+ protected transient ProxyDirContext resources = null;
/**
if (debug > 10)
log("Serving bytes:" + start + "-" + end);
+ long skipped = 0;
try {
- istream.skip(start);
+ skipped = istream.skip(start);
} catch (IOException e) {
return e;
}
-
+ if (skipped < start) {
+ return new IOException(sm.getString("defaultservlet.skipfail",
+ Long.valueOf(skipped), Long.valueOf(start)));
+ }
+
IOException exception = null;
long bytesToRead = end - start + 1;
protected IOException copyRange(Reader reader, PrintWriter writer,
long start, long end) {
+ long skipped = 0;
try {
- reader.skip(start);
+ skipped = reader.skip(start);
} catch (IOException e) {
return e;
}
+ if (skipped < start) {
+ return new IOException(sm.getString("defaultservlet.skipfail",
+ Long.valueOf(skipped), Long.valueOf(start)));
+ }
IOException exception = null;
long bytesToRead = end - start + 1;
// ------------------------------------------------------ Range Inner Class
- protected class Range {
+ protected static class Range {
public long start;
public long end;
public boolean validate() {
if (end >= length)
end = length - 1;
- return ( (start >= 0) && (end >= 0) && (start <= end)
- && (length > 0) );
+ return (start >= 0) && (end >= 0) && (start <= end) && (length > 0);
}
-
- public void recycle() {
- start = 0;
- end = 0;
- length = 0;
- }
-
}
-
-
}