From 4c6d39710fd092c05b56bbf502cdc02270af48b2 Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 17 Nov 2009 21:21:41 +0000 Subject: [PATCH] Add @Override annotations git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@881533 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tomcat/util/http/fileupload/ByteArrayOutputStream.java | 4 ++++ .../apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java | 3 +++ java/org/apache/tomcat/util/http/fileupload/DiskFileItem.java | 2 ++ java/org/apache/tomcat/util/http/fileupload/FileCleaningTracker.java | 1 + java/org/apache/tomcat/util/http/fileupload/FileDeleteStrategy.java | 2 ++ java/org/apache/tomcat/util/http/fileupload/FileUpload.java | 2 ++ java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java | 4 ++++ java/org/apache/tomcat/util/http/fileupload/FileUploadException.java | 3 +++ java/org/apache/tomcat/util/http/fileupload/LimitedInputStream.java | 3 +++ java/org/apache/tomcat/util/http/fileupload/MultipartStream.java | 5 +++++ .../apache/tomcat/util/http/fileupload/ServletRequestContext.java | 1 + .../apache/tomcat/util/http/fileupload/ThresholdingOutputStream.java | 5 +++++ 12 files changed, 35 insertions(+) diff --git a/java/org/apache/tomcat/util/http/fileupload/ByteArrayOutputStream.java b/java/org/apache/tomcat/util/http/fileupload/ByteArrayOutputStream.java index b652d9dcd..21e7c15f7 100644 --- a/java/org/apache/tomcat/util/http/fileupload/ByteArrayOutputStream.java +++ b/java/org/apache/tomcat/util/http/fileupload/ByteArrayOutputStream.java @@ -136,6 +136,7 @@ public class ByteArrayOutputStream extends OutputStream { * @param off The start offset * @param len The number of bytes to write */ + @Override public void write(byte[] b, int off, int len) { if ((off < 0) || (off > b.length) @@ -167,6 +168,7 @@ public class ByteArrayOutputStream extends OutputStream { * Write a byte to byte array. * @param b the byte to write */ + @Override public synchronized void write(int b) { int inBufferPos = count - filledBufferSum; if (inBufferPos == currentBuffer.length) { @@ -221,6 +223,7 @@ public class ByteArrayOutputStream extends OutputStream { * @throws IOException never (this method should not declare this exception * but it has to now due to backwards compatability) */ + @Override public void close() throws IOException { //nop } @@ -288,6 +291,7 @@ public class ByteArrayOutputStream extends OutputStream { * @return the contents of the byte array as a String * @see java.io.ByteArrayOutputStream#toString() */ + @Override public String toString() { return new String(toByteArray()); } diff --git a/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java b/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java index bb21d4ecc..201af865c 100644 --- a/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java +++ b/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java @@ -141,6 +141,7 @@ public class DeferredFileOutputStream * * @exception IOException if an error occurs. */ + @Override protected OutputStream getStream() throws IOException { return currentOutputStream; @@ -155,6 +156,7 @@ public class DeferredFileOutputStream * * @exception IOException if an error occurs. */ + @Override protected void thresholdReached() throws IOException { if (prefix != null) { @@ -226,6 +228,7 @@ public class DeferredFileOutputStream * * @exception IOException if an error occurs. */ + @Override public void close() throws IOException { super.close(); diff --git a/java/org/apache/tomcat/util/http/fileupload/DiskFileItem.java b/java/org/apache/tomcat/util/http/fileupload/DiskFileItem.java index 719ae9368..f1e7251a6 100644 --- a/java/org/apache/tomcat/util/http/fileupload/DiskFileItem.java +++ b/java/org/apache/tomcat/util/http/fileupload/DiskFileItem.java @@ -579,6 +579,7 @@ public class DiskFileItem /** * Removes the file contents from the temporary storage. */ + @Override protected void finalize() { File outputFile = dfos.getFile(); @@ -645,6 +646,7 @@ public class DiskFileItem * * @return a string representation of this object. */ + @Override public String toString() { return "name=" + this.getName() + ", StoreLocation=" diff --git a/java/org/apache/tomcat/util/http/fileupload/FileCleaningTracker.java b/java/org/apache/tomcat/util/http/fileupload/FileCleaningTracker.java index cd64a3262..360a06b2e 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileCleaningTracker.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileCleaningTracker.java @@ -196,6 +196,7 @@ public class FileCleaningTracker { * Run the reaper thread that will delete files as their associated * marker objects are reclaimed by the garbage collector. */ + @Override public void run() { // thread exits when exitWhenFinished is true and there are no more tracked objects while (exitWhenFinished == false || trackers.size() > 0) { diff --git a/java/org/apache/tomcat/util/http/fileupload/FileDeleteStrategy.java b/java/org/apache/tomcat/util/http/fileupload/FileDeleteStrategy.java index 471532204..2c379aec6 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileDeleteStrategy.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileDeleteStrategy.java @@ -122,6 +122,7 @@ public class FileDeleteStrategy { * * @return a string describing the delete strategy */ + @Override public String toString() { return "FileDeleteStrategy[" + name + "]"; } @@ -147,6 +148,7 @@ public class FileDeleteStrategy { * @throws NullPointerException if the file is null * @throws IOException if an error occurs during file deletion */ + @Override protected boolean doDelete(File fileToDelete) throws IOException { FileUtils.forceDelete(fileToDelete); return true; diff --git a/java/org/apache/tomcat/util/http/fileupload/FileUpload.java b/java/org/apache/tomcat/util/http/fileupload/FileUpload.java index 867627307..edabd6618 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileUpload.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileUpload.java @@ -88,6 +88,7 @@ public class FileUpload * * @return The factory class for new file items. */ + @Override public FileItemFactory getFileItemFactory() { return fileItemFactory; } @@ -98,6 +99,7 @@ public class FileUpload * * @param factory The factory class for new file items. */ + @Override public void setFileItemFactory(FileItemFactory factory) { this.fileItemFactory = factory; } diff --git a/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java b/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java index 7c63b8ef6..46d20a17a 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java @@ -593,6 +593,7 @@ public abstract class FileUploadBase { throw new FileUploadIOException(e); } istream = new LimitedInputStream(istream, fileSizeMax) { + @Override protected void raiseError(long pSizeMax, long pCount) throws IOException { itemStream.close(true); @@ -750,6 +751,7 @@ public abstract class FileUploadBase { int requestSize = ctx.getContentLength(); if (requestSize == -1) { input = new LimitedInputStream(input, sizeMax) { + @Override protected void raiseError(long pSizeMax, long pCount) throws IOException { FileUploadException ex = @@ -940,6 +942,7 @@ public abstract class FileUploadBase { * Returns the exceptions cause. * @return The exceptions cause, if any, or null. */ + @Override public Throwable getCause() { return cause; } @@ -1000,6 +1003,7 @@ public abstract class FileUploadBase { * Returns the exceptions cause. * @return The exceptions cause, if any, or null. */ + @Override public Throwable getCause() { return cause; } diff --git a/java/org/apache/tomcat/util/http/fileupload/FileUploadException.java b/java/org/apache/tomcat/util/http/fileupload/FileUploadException.java index 092ee340d..8c4527aa4 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileUploadException.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileUploadException.java @@ -71,6 +71,7 @@ public class FileUploadException extends Exception { * * @param stream PrintStream to use for output */ + @Override public void printStackTrace(PrintStream stream) { super.printStackTrace(stream); if (cause != null) { @@ -85,6 +86,7 @@ public class FileUploadException extends Exception { * * @param writer PrintWriter to use for output */ + @Override public void printStackTrace(PrintWriter writer) { super.printStackTrace(writer); if (cause != null) { @@ -93,6 +95,7 @@ public class FileUploadException extends Exception { } } + @Override public Throwable getCause() { return cause; } diff --git a/java/org/apache/tomcat/util/http/fileupload/LimitedInputStream.java b/java/org/apache/tomcat/util/http/fileupload/LimitedInputStream.java index 6d0a536ae..bbef674d3 100644 --- a/java/org/apache/tomcat/util/http/fileupload/LimitedInputStream.java +++ b/java/org/apache/tomcat/util/http/fileupload/LimitedInputStream.java @@ -89,6 +89,7 @@ public abstract class LimitedInputStream * @exception IOException if an I/O error occurs. * @see java.io.FilterInputStream#in */ + @Override public int read() throws IOException { int res = super.read(); if (res != -1) { @@ -121,6 +122,7 @@ public abstract class LimitedInputStream * @exception IOException if an I/O error occurs. * @see java.io.FilterInputStream#in */ + @Override public int read(byte[] b, int off, int len) throws IOException { int res = super.read(b, off, len); if (res > 0) { @@ -148,6 +150,7 @@ public abstract class LimitedInputStream * @exception IOException if an I/O error occurs. * @see java.io.FilterInputStream#in */ + @Override public void close() throws IOException { closed = true; super.close(); diff --git a/java/org/apache/tomcat/util/http/fileupload/MultipartStream.java b/java/org/apache/tomcat/util/http/fileupload/MultipartStream.java index ec04d5252..20c28fa6e 100644 --- a/java/org/apache/tomcat/util/http/fileupload/MultipartStream.java +++ b/java/org/apache/tomcat/util/http/fileupload/MultipartStream.java @@ -779,6 +779,7 @@ public class MultipartStream { * @throws IOException An I/O error occurs. * @return Number of bytes in the buffer. */ + @Override public int available() throws IOException { if (pos == -1) { return tail - head - pad; @@ -796,6 +797,7 @@ public class MultipartStream { * integer, or -1 for EOF. * @throws IOException An I/O error occurred. */ + @Override public int read() throws IOException { if (closed) { throw new FileItemStream.ItemSkippedException(); @@ -822,6 +824,7 @@ public class MultipartStream { * or -1 for EOF. * @throws IOException An I/O error occurred. */ + @Override public int read(byte[] b, int off, int len) throws IOException { if (closed) { throw new FileItemStream.ItemSkippedException(); @@ -847,6 +850,7 @@ public class MultipartStream { * Closes the input stream. * @throws IOException An I/O error occurred. */ + @Override public void close() throws IOException { close(false); } @@ -886,6 +890,7 @@ public class MultipartStream { * skipped. * @throws IOException An I/O error occurred. */ + @Override public long skip(long bytes) throws IOException { if (closed) { throw new FileItemStream.ItemSkippedException(); diff --git a/java/org/apache/tomcat/util/http/fileupload/ServletRequestContext.java b/java/org/apache/tomcat/util/http/fileupload/ServletRequestContext.java index 7fdaedcc2..bb5460a1d 100644 --- a/java/org/apache/tomcat/util/http/fileupload/ServletRequestContext.java +++ b/java/org/apache/tomcat/util/http/fileupload/ServletRequestContext.java @@ -98,6 +98,7 @@ public class ServletRequestContext implements RequestContext { * * @return a string representation of this object. */ + @Override public String toString() { return "ContentLength=" + this.getContentLength() diff --git a/java/org/apache/tomcat/util/http/fileupload/ThresholdingOutputStream.java b/java/org/apache/tomcat/util/http/fileupload/ThresholdingOutputStream.java index 142cb4012..e93e1fa5c 100644 --- a/java/org/apache/tomcat/util/http/fileupload/ThresholdingOutputStream.java +++ b/java/org/apache/tomcat/util/http/fileupload/ThresholdingOutputStream.java @@ -88,6 +88,7 @@ public abstract class ThresholdingOutputStream * * @exception IOException if an error occurs. */ + @Override public void write(int b) throws IOException { checkThreshold(1); @@ -104,6 +105,7 @@ public abstract class ThresholdingOutputStream * * @exception IOException if an error occurs. */ + @Override public void write(byte b[]) throws IOException { checkThreshold(b.length); @@ -122,6 +124,7 @@ public abstract class ThresholdingOutputStream * * @exception IOException if an error occurs. */ + @Override public void write(byte b[], int off, int len) throws IOException { checkThreshold(len); @@ -136,6 +139,7 @@ public abstract class ThresholdingOutputStream * * @exception IOException if an error occurs. */ + @Override public void flush() throws IOException { getStream().flush(); @@ -148,6 +152,7 @@ public abstract class ThresholdingOutputStream * * @exception IOException if an error occurs. */ + @Override public void close() throws IOException { try -- 2.11.0