Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 14 additions & 19 deletions java/org/apache/catalina/servlets/DefaultServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -2028,7 +2028,7 @@ protected String getReadme(WebResource directory, String encoding) {
} else {
reader = new InputStreamReader(is);
}
IOException e = copyRange(reader, new PrintWriter(buffer));
IOException e = copyFull(reader, new PrintWriter(buffer));
if (debug > 10) {
log("readme '" + readmeFile + "' output error: " + ((e != null) ? e.getMessage() : ""));
}
Expand Down Expand Up @@ -2525,8 +2525,8 @@ protected String generateETag(WebResource resource) {


/**
* Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are
* closed before returning (even in the face of an exception).
* Copy the contents of the specified input stream to the specified output stream, and ensure that the input stream
* is closed before returning (even in the face of an exception).
*
* @param is The input stream to read the source resource from
* @param ostream The output stream to write to
Expand All @@ -2538,7 +2538,7 @@ protected void copy(InputStream is, ServletOutputStream ostream) throws IOExcept
InputStream istream = new BufferedInputStream(is, input);

// Copy the input stream to the output stream
IOException exception = copyRange(istream, ostream);
IOException exception = copyFull(istream, ostream);

// Clean up the input stream
istream.close();
Expand All @@ -2551,8 +2551,8 @@ protected void copy(InputStream is, ServletOutputStream ostream) throws IOExcept


/**
* Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are
* closed before returning (even in the face of an exception).
* Copy the contents of the specified input stream to the specified output stream, and ensure that the input stream
* is closed before returning (even in the face of an exception).
*
* @param is The input stream to read the source resource from
* @param writer The writer to write to
Expand All @@ -2570,7 +2570,7 @@ protected void copy(InputStream is, PrintWriter writer, String encoding) throws
}

// Copy the input stream to the output stream
IOException exception = copyRange(reader, writer);
IOException exception = copyFull(reader, writer);

// Clean up the reader
reader.close();
Expand All @@ -2583,8 +2583,7 @@ protected void copy(InputStream is, PrintWriter writer, String encoding) throws


/**
* Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are
* closed before returning (even in the face of an exception).
* Copy the contents of the specified resource to the specified output stream.
*
* @param resource The source resource
* @param length the resource length
Expand Down Expand Up @@ -2612,8 +2611,7 @@ protected void copy(WebResource resource, long length, ServletOutputStream ostre


/**
* Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are
* closed before returning (even in the face of an exception).
* Copy the contents of the specified resource to the specified output stream.
*
* @param resource The source resource
* @param length the resource length
Expand Down Expand Up @@ -2663,15 +2661,14 @@ protected void copy(WebResource resource, long length, ServletOutputStream ostre


/**
* Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are
* closed before returning (even in the face of an exception).
* Copy full contents of the specified input stream to the specified output stream.
*
* @param istream The input stream to read from
* @param ostream The output stream to write to
*
* @return Exception which occurred during processing
*/
protected IOException copyRange(InputStream istream, ServletOutputStream ostream) {
protected IOException copyFull(InputStream istream, ServletOutputStream ostream) {

// Copy the input stream to the output stream
IOException exception = null;
Expand All @@ -2694,15 +2691,14 @@ protected IOException copyRange(InputStream istream, ServletOutputStream ostream


/**
* Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are
* closed before returning (even in the face of an exception).
* Copy full contents of the specified input stream to the specified output stream.
*
* @param reader The reader to read from
* @param writer The writer to write to
*
* @return Exception which occurred during processing
*/
protected IOException copyRange(Reader reader, PrintWriter writer) {
protected IOException copyFull(Reader reader, PrintWriter writer) {

// Copy the input stream to the output stream
IOException exception = null;
Expand All @@ -2725,8 +2721,7 @@ protected IOException copyRange(Reader reader, PrintWriter writer) {


/**
* Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are
* closed before returning (even in the face of an exception).
* Copy the contents of the specified input stream to the specified output stream.
*
* @param istream The input stream to read from
* @param ostream The output stream to write to
Expand Down