Author: jdonnerstag Date: Sun Jan 23 08:34:30 2011 New Revision: 1062344 URL: http://svn.apache.org/viewvc?rev=1062344&view=rev Log: let eclipse do a final cleanup. No functional change
Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/ClassProvider.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/collections/ConcurrentHashSet.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleaningTracker.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileDeleteStrategy.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileUploadCleaner.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/io/DeferredFileOutputStream.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/io/Streams.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/AppendingStringBuffer.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/StringValue.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/DiskFileItem.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItemHeadersImpl.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileUploadBase.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileUploadException.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/LimitedInputStream.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/MultipartFormInputStream.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/ParameterParser.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/ServletFileUpload.java Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/ClassProvider.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/ClassProvider.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/ClassProvider.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/ClassProvider.java Sun Jan 23 08:34:30 2011 @@ -27,7 +27,6 @@ import java.lang.ref.WeakReference; */ public class ClassProvider<T> implements IProvider<Class<T>> { - private final WeakReference<Class<T>> classRef; /** @@ -35,11 +34,14 @@ public class ClassProvider<T> implements * * @param clazz */ - public ClassProvider(Class<T> clazz) + public ClassProvider(final Class<T> clazz) { classRef = new WeakReference<Class<T>>(clazz); } + /** + * {@inheritDoc} + */ public Class<T> get() { return classRef.get(); @@ -54,9 +56,8 @@ public class ClassProvider<T> implements * the class to provide * @return provider */ - public static <T> ClassProvider<T> of(Class<T> clazz) + public static <T> ClassProvider<T> of(final Class<T> clazz) { return new ClassProvider<T>(clazz); } - } Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/collections/ConcurrentHashSet.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/collections/ConcurrentHashSet.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/collections/ConcurrentHashSet.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/collections/ConcurrentHashSet.java Sun Jan 23 08:34:30 2011 @@ -100,8 +100,7 @@ public class ConcurrentHashSet<E> extend } /** - * - * @see java.util.AbstractCollection#iterator() + * {@inheritDoc} */ @Override public Iterator<E> iterator() @@ -110,8 +109,7 @@ public class ConcurrentHashSet<E> extend } /** - * - * @see java.util.AbstractCollection#size() + * {@inheritDoc} */ @Override public int size() @@ -120,8 +118,7 @@ public class ConcurrentHashSet<E> extend } /** - * - * @see java.util.AbstractCollection#isEmpty() + * {@inheritDoc} */ @Override public boolean isEmpty() @@ -130,8 +127,7 @@ public class ConcurrentHashSet<E> extend } /** - * - * @see java.util.AbstractCollection#contains(java.lang.Object) + * {@inheritDoc} */ @Override public boolean contains(final Object o) @@ -140,8 +136,7 @@ public class ConcurrentHashSet<E> extend } /** - * - * @see java.util.AbstractCollection#add(java.lang.Object) + * {@inheritDoc} */ @Override public boolean add(final E o) @@ -150,8 +145,7 @@ public class ConcurrentHashSet<E> extend } /** - * - * @see java.util.AbstractCollection#remove(java.lang.Object) + * {@inheritDoc} */ @Override public boolean remove(final Object o) @@ -160,8 +154,7 @@ public class ConcurrentHashSet<E> extend } /** - * - * @see java.util.AbstractCollection#clear() + * {@inheritDoc} */ @Override public void clear() @@ -170,12 +163,11 @@ public class ConcurrentHashSet<E> extend } /** - * - * @see java.lang.Object#clone() + * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override - public Object clone()throws CloneNotSupportedException + public Object clone() throws CloneNotSupportedException { try { Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleaningTracker.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleaningTracker.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleaningTracker.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleaningTracker.java Sun Jan 23 08:34:30 2011 @@ -78,7 +78,7 @@ public class FileCleaningTracker * @throws NullPointerException * if the file is null */ - public void track(File file, Object marker) + public void track(final File file, final Object marker) { track(file, marker, (FileDeleteStrategy)null); } @@ -96,7 +96,7 @@ public class FileCleaningTracker * @throws NullPointerException * if the file is null */ - public void track(File file, Object marker, FileDeleteStrategy deleteStrategy) + public void track(final File file, final Object marker, final FileDeleteStrategy deleteStrategy) { if (file == null) { @@ -117,7 +117,7 @@ public class FileCleaningTracker * @throws NullPointerException * if the path is null */ - public void track(String path, Object marker) + public void track(final String path, final Object marker) { track(path, marker, null); } @@ -135,7 +135,8 @@ public class FileCleaningTracker * @throws NullPointerException * if the path is null */ - public void track(String path, Object marker, FileDeleteStrategy deleteStrategy) + public void track(final String path, final Object marker, + final FileDeleteStrategy deleteStrategy) { if (path == null) { @@ -154,8 +155,8 @@ public class FileCleaningTracker * @param deleteStrategy * the strategy to delete the file, null means normal */ - private synchronized void addTracker(String path, Object marker, - FileDeleteStrategy deleteStrategy) + private synchronized void addTracker(final String path, final Object marker, + final FileDeleteStrategy deleteStrategy) { // synchronized block protects reaper if (exitWhenFinished) @@ -248,7 +249,7 @@ public class FileCleaningTracker public void run() { // thread exits when exitWhenFinished is true and there are no more tracked objects - while (exitWhenFinished == false || trackers.size() > 0) + while ((exitWhenFinished == false) || (trackers.size() > 0)) { try { @@ -270,12 +271,12 @@ public class FileCleaningTracker } // ----------------------------------------------------------------------- + /** * Inner class which acts as the reference for a file pending deletion. */ private static final class Tracker extends PhantomReference<Object> { - /** * The full path to the file being tracked. */ @@ -297,8 +298,8 @@ public class FileCleaningTracker * @param queue * the queue on to which the tracker will be pushed, not null */ - Tracker(String path, FileDeleteStrategy deleteStrategy, Object marker, - ReferenceQueue<? super Object> queue) + Tracker(final String path, final FileDeleteStrategy deleteStrategy, final Object marker, + final ReferenceQueue<? super Object> queue) { super(marker, queue); this.path = path; @@ -327,5 +328,4 @@ public class FileCleaningTracker return deleteStrategy.deleteQuietly(new File(path)); } } - } \ No newline at end of file Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileDeleteStrategy.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileDeleteStrategy.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileDeleteStrategy.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileDeleteStrategy.java Sun Jan 23 08:34:30 2011 @@ -33,7 +33,6 @@ import java.io.IOException; */ public class FileDeleteStrategy { - /** * The singleton instance for normal file deletion, which does not permit the deletion of * directories that are not empty. @@ -50,7 +49,7 @@ public class FileDeleteStrategy * @param name * the name by which the strategy is known */ - protected FileDeleteStrategy(String name) + protected FileDeleteStrategy(final String name) { this.name = name; } @@ -67,9 +66,9 @@ public class FileDeleteStrategy * the file to delete, null returns true * @return true if the file was deleted, or there was no such file */ - public boolean deleteQuietly(File fileToDelete) + public boolean deleteQuietly(final File fileToDelete) { - if (fileToDelete == null || fileToDelete.exists() == false) + if ((fileToDelete == null) || (fileToDelete.exists() == false)) { return true; } @@ -96,9 +95,9 @@ public class FileDeleteStrategy * @throws IOException * if an error occurs during file deletion */ - public void delete(File fileToDelete) throws IOException + public void delete(final File fileToDelete) throws IOException { - if (fileToDelete.exists() && doDelete(fileToDelete) == false) + if (fileToDelete.exists() && (doDelete(fileToDelete) == false)) { throw new IOException("Deletion failed: " + fileToDelete); } @@ -122,7 +121,7 @@ public class FileDeleteStrategy * @throws IOException * if an error occurs during file deletion */ - protected boolean doDelete(File fileToDelete) throws IOException + protected boolean doDelete(final File fileToDelete) throws IOException { return fileToDelete.delete(); } @@ -138,5 +137,4 @@ public class FileDeleteStrategy { return "FileDeleteStrategy[" + name + "]"; } - } \ No newline at end of file Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileUploadCleaner.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileUploadCleaner.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileUploadCleaner.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/file/FileUploadCleaner.java Sun Jan 23 08:34:30 2011 @@ -21,7 +21,6 @@ import java.io.File; /** * Default implementation of {@link IFileUploadCleaner} that uses Apache commons-io * {@link FileCleaningTracker} to track and clean the temporary created files. - * * <p> * Note: this implementation starts a daemon thread to do the actual work, so it may not be used in * some environments like Google AppEngine. @@ -30,20 +29,27 @@ public class FileUploadCleaner implement { private final FileCleaningTracker cleaner; - /***/ + /** + * Construct. + */ public FileUploadCleaner() { cleaner = new FileCleaningTracker(); } - public void track(File file, Object marker) + /** + * {@inheritDoc} + */ + public void track(final File file, final Object marker) { cleaner.track(file, marker); } + /** + * {@inheritDoc} + */ public void destroy() { cleaner.exitWhenFinished(); } - } Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/io/DeferredFileOutputStream.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/io/DeferredFileOutputStream.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/io/DeferredFileOutputStream.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/io/DeferredFileOutputStream.java Sun Jan 23 08:34:30 2011 @@ -21,6 +21,8 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import org.apache.wicket.util.lang.Args; + /** * <p> @@ -38,35 +40,24 @@ import java.io.OutputStream; */ public class DeferredFileOutputStream extends ThresholdingOutputStream { - - // ----------------------------------------------------------- Data members - - /** * The output stream to which data will be written at any given time. This will always be one of * <code>memoryOutputStream</code> or <code>diskOutputStream</code>. */ private OutputStream currentOutputStream; - /** * The output stream to which data will be written prior to the threshold being reached. */ private ByteArrayOutputStream memoryOutputStream; - /** * The file to which output will be directed if the threshold is exceeded. */ private File outputFile; - private final FileFactory fileFactory; - - // ----------------------------------------------------------- Constructors - - /** * Constructs an instance of this class which will trigger an event at the specified threshold, * and save data to a file beyond that point. @@ -79,9 +70,8 @@ public class DeferredFileOutputStream ex public DeferredFileOutputStream(final int threshold, final File outputFile) { super(threshold); - if (outputFile == null) - throw new IllegalArgumentException("output file must be specified"); - this.outputFile = outputFile; + + this.outputFile = Args.notNull(outputFile, "outputFile"); fileFactory = null; memoryOutputStream = new ByteArrayOutputStream(); @@ -97,21 +87,15 @@ public class DeferredFileOutputStream ex * @param fileFactory * The FileFactory to create the file. */ - public DeferredFileOutputStream(int threshold, FileFactory fileFactory) + public DeferredFileOutputStream(final int threshold, final FileFactory fileFactory) { super(threshold); - if (fileFactory == null) - throw new IllegalArgumentException("FileFactory must be specified"); - this.fileFactory = fileFactory; + this.fileFactory = Args.notNull(fileFactory, "fileFactory"); memoryOutputStream = new ByteArrayOutputStream(); currentOutputStream = memoryOutputStream; } - - // --------------------------------------- ThresholdingOutputStream methods - - /** * Returns the data for this output stream as an array of bytes, assuming that the data has been * retained in memory. If the data was written to disk, this method returns <code>null</code>. @@ -127,7 +111,6 @@ public class DeferredFileOutputStream ex return null; } - /** * Returns the data for this output stream as a <code>File</code>, assuming that the data was * written to disk. If the data was retained in memory, this method returns <code>null</code>. @@ -139,10 +122,6 @@ public class DeferredFileOutputStream ex return outputFile; } - - // --------------------------------------------------------- Public methods - - /** * Determines whether or not the data for this output stream has been retained in memory. * @@ -153,7 +132,6 @@ public class DeferredFileOutputStream ex return (!isThresholdExceeded()); } - /** * Returns the current output stream. This may be memory based or disk based, depending on the * current state with respect to the threshold. @@ -168,7 +146,6 @@ public class DeferredFileOutputStream ex return currentOutputStream; } - /** * Switches the underlying output stream from a memory based stream to one that is backed by * disk. This is the point at which we realize that too much data is being written to keep in @@ -202,5 +179,5 @@ public class DeferredFileOutputStream ex * @return the file to use for disk cache */ File createFile(); -} + } } Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/io/Streams.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/io/Streams.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/io/Streams.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/io/Streams.java Sun Jan 23 08:34:30 2011 @@ -17,7 +17,6 @@ package org.apache.wicket.util.io; import java.io.BufferedReader; -import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -34,20 +33,6 @@ import java.util.Properties; public final class Streams { /** - * - * @param closeable - * - * @deprecated - * @see IOUtils#close(Closeable) - * @throws IOException - */ - @Deprecated - public static void close(final Closeable closeable) throws IOException - { - IOUtils.close(closeable); - } - - /** * Writes the input stream to the output stream. Input is done without a Reader object, meaning * that the input is copied in its raw form. After it is copied it will close the streams. * @@ -58,7 +43,8 @@ public final class Streams * @return Number of bytes copied from one stream to the other * @throws IOException */ - public static long copyAndClose(InputStream in, OutputStream out) throws IOException + public static long copyAndClose(final InputStream in, final OutputStream out) + throws IOException { try { Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/AppendingStringBuffer.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/AppendingStringBuffer.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/AppendingStringBuffer.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/AppendingStringBuffer.java Sun Jan 23 08:34:30 2011 @@ -30,7 +30,6 @@ import java.io.IOException; * @author Johan Compagner * @see java.lang.StringBuffer */ - public final class AppendingStringBuffer implements java.io.Serializable, CharSequence { /** use serialVersionUID from JDK 1.0.2 for interoperability */ Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/StringValue.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/StringValue.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/StringValue.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/StringValue.java Sun Jan 23 08:34:30 2011 @@ -752,14 +752,20 @@ public class StringValue implements IClu return Strings.isEmpty(text); } + /** + * {@inheritDoc} + */ @Override public int hashCode() { return Objects.hashCode(locale, text); } + /** + * {@inheritDoc} + */ @Override - public boolean equals(Object obj) + public boolean equals(final Object obj) { if (obj instanceof StringValue) { Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java Sun Jan 23 08:34:30 2011 @@ -293,87 +293,85 @@ public final class Strings { return null; } - else + + int len = s.length(); + final AppendingStringBuffer buffer = new AppendingStringBuffer((int)(len * 1.1)); + + for (int i = 0; i < len; i++) { - int len = s.length(); - final AppendingStringBuffer buffer = new AppendingStringBuffer((int)(len * 1.1)); + final char c = s.charAt(i); - for (int i = 0; i < len; i++) + switch (c) { - final char c = s.charAt(i); - - switch (c) - { - case '\t' : - if (escapeSpaces) - { - // Assumption is four space tabs (sorry, but that's - // just how it is!) - buffer.append(" "); - } - else - { - buffer.append(c); - } - break; + case '\t' : + if (escapeSpaces) + { + // Assumption is four space tabs (sorry, but that's + // just how it is!) + buffer.append(" "); + } + else + { + buffer.append(c); + } + break; - case ' ' : - if (escapeSpaces) - { - buffer.append(" "); - } - else - { - buffer.append(c); - } - break; + case ' ' : + if (escapeSpaces) + { + buffer.append(" "); + } + else + { + buffer.append(c); + } + break; - case '<' : - buffer.append("<"); - break; + case '<' : + buffer.append("<"); + break; - case '>' : - buffer.append(">"); - break; + case '>' : + buffer.append(">"); + break; - case '&' : + case '&' : - buffer.append("&"); - break; + buffer.append("&"); + break; - case '"' : - buffer.append("""); - break; + case '"' : + buffer.append("""); + break; - case '\'' : - buffer.append("'"); - break; + case '\'' : + buffer.append("'"); + break; - default : + default : - int ci = 0xffff & c; + int ci = 0xffff & c; - if ( - // if this is non-printable and not whitespace (TAB, LF, CR) - (ci < 32 && ci != 9 && ci != 10 && ci != 13) || - // or non-ASCII (XXX: why 160+ ?!) and need to UNICODE escape it - (convertToHtmlUnicodeEscapes && ci > 159)) - { - buffer.append("&#"); - buffer.append(Integer.toString(ci)); - buffer.append(';'); - } - else - { - // ASCII or whitespace - buffer.append(c); - } - break; - } + if ( + // if this is non-printable and not whitespace (TAB, LF, CR) + ((ci < 32) && (ci != 9) && (ci != 10) && (ci != 13)) || + // or non-ASCII (XXX: why 160+ ?!) and need to UNICODE escape it + (convertToHtmlUnicodeEscapes && (ci > 159))) + { + buffer.append("&#"); + buffer.append(Integer.toString(ci)); + buffer.append(';'); + } + else + { + // ASCII or whitespace + buffer.append(c); + } + break; } - - return buffer; } + + return buffer; } /** @@ -1302,7 +1300,6 @@ public final class Strings { return string.getBytes().length; } - } /** Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/DiskFileItem.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/DiskFileItem.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/DiskFileItem.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/DiskFileItem.java Sun Jan 23 08:34:30 2011 @@ -73,14 +73,12 @@ import org.slf4j.LoggerFactory; public class DiskFileItem implements FileItem, FileItemHeadersSupport { private static final Logger log = LoggerFactory.getLogger(DiskFileItem.class); - // ----------------------------------------------------- Manifest constants /** * The UID to use when serializing this instance. */ private static final long serialVersionUID = 2237570099615271025L; - /** * Default content charset to be used when no explicit charset parameter is provided by the * sender. Media subtypes of the "text" type are defined to have a default charset value of @@ -108,50 +106,42 @@ public class DiskFileItem implements Fil */ private String fieldName; - /** * The content type passed by the browser, or <code>null</code> if not defined. */ private final String contentType; - /** * Whether or not this item is a simple form field. */ private boolean isFormField; - /** * The original filename in the user's filesystem. */ private final String fileName; - /** * The size of the item, in bytes. This is used to cache the size when a file item is moved from * its original location. */ private long size = -1; - /** * The threshold above which uploads will be stored on disk. */ private final int sizeThreshold; - /** * The directory in which uploaded files will be stored, if stored on disk. */ private final File repository; - /** * Cached contents of the file. */ private byte[] cachedContent; - /** * Output stream for this item. */ @@ -178,9 +168,6 @@ public class DiskFileItem implements Fil */ private transient final IFileUploadCleaner fileUploadCleaner; - // ----------------------------------------------------------- Constructors - - /** * Constructs a new <code>DiskFileItem</code> instance. * @@ -213,10 +200,6 @@ public class DiskFileItem implements Fil this.fileUploadCleaner = fileUploadCleaner; } - - // ------------------------------- Methods from javax.activation.DataSource - - /** * Returns an {@link java.io.InputStream InputStream} that can be used to retrieve the contents * of the file. @@ -241,7 +224,6 @@ public class DiskFileItem implements Fil return new ByteArrayInputStream(cachedContent); } - /** * Returns the content type passed by the agent or <code>null</code> if not defined. * @@ -252,7 +234,6 @@ public class DiskFileItem implements Fil return contentType; } - /** * Returns the content charset passed by the agent or <code>null</code> if not defined. * @@ -267,7 +248,6 @@ public class DiskFileItem implements Fil return (String)params.get("charset"); } - /** * Returns the original filename in the client's filesystem. * @@ -278,10 +258,6 @@ public class DiskFileItem implements Fil return fileName; } - - // ------------------------------------------------------- FileItem methods - - /** * Provides a hint as to whether or not the file contents will be read from memory. * @@ -297,7 +273,6 @@ public class DiskFileItem implements Fil return dfos.isInMemory(); } - /** * Returns the size of the file. * @@ -724,7 +699,7 @@ public class DiskFileItem implements Fil * @throws IOException * if an error occurs. */ - private void writeObject(ObjectOutputStream out) throws IOException + private void writeObject(final ObjectOutputStream out) throws IOException { // Read the data if (dfos.isInMemory()) @@ -752,7 +727,7 @@ public class DiskFileItem implements Fil * @throws ClassNotFoundException * if class cannot be found. */ - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException + private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { // read values in.defaultReadObject(); @@ -790,7 +765,7 @@ public class DiskFileItem implements Fil * @param pHeaders * The file items headers. */ - public void setHeaders(FileItemHeaders pHeaders) + public void setHeaders(final FileItemHeaders pHeaders) { headers = pHeaders; } Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItemHeadersImpl.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItemHeadersImpl.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItemHeadersImpl.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileItemHeadersImpl.java Sun Jan 23 08:34:30 2011 @@ -45,7 +45,7 @@ public class FileItemHeadersImpl impleme */ private final List headerNameList = new ArrayList(); - public String getHeader(String name) + public String getHeader(final String name) { String nameLower = name.toLowerCase(); List headerValueList = (List)headerNameToValueListMap.get(nameLower); @@ -61,7 +61,7 @@ public class FileItemHeadersImpl impleme return headerNameList.iterator(); } - public Iterator getHeaders(String name) + public Iterator getHeaders(final String name) { String nameLower = name.toLowerCase(); List headerValueList = (List)headerNameToValueListMap.get(nameLower); @@ -80,7 +80,7 @@ public class FileItemHeadersImpl impleme * @param value * value of this header */ - public synchronized void addHeader(String name, String value) + public synchronized void addHeader(final String name, final String value) { String nameLower = name.toLowerCase(); List headerValueList = (List)headerNameToValueListMap.get(nameLower); Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileUploadBase.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileUploadBase.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileUploadBase.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileUploadBase.java Sun Jan 23 08:34:30 2011 @@ -98,7 +98,7 @@ public abstract class FileUploadBase * @deprecated Use the method on <code>ServletFileUpload</code> instead. */ @Deprecated - public static boolean isMultipartContent(HttpServletRequest req) + public static boolean isMultipartContent(final HttpServletRequest req) { return ServletFileUpload.isMultipartContent(req); } @@ -261,7 +261,7 @@ public abstract class FileUploadBase * @param fileSizeMax * Maximum size of a single uploaded file. */ - public void setFileSizeMax(long fileSizeMax) + public void setFileSizeMax(final long fileSizeMax) { this.fileSizeMax = fileSizeMax; } @@ -312,7 +312,7 @@ public abstract class FileUploadBase * @deprecated Use the method in <code>ServletFileUpload</code> instead. */ @Deprecated - public List<FileItem> parseRequest(HttpServletRequest req) throws FileUploadException + public List<FileItem> parseRequest(final HttpServletRequest req) throws FileUploadException { return parseRequest(new ServletRequestContext(req)); } @@ -333,7 +333,7 @@ public abstract class FileUploadBase * An I/O error occurred. This may be a network error while communicating with the * client or a problem while storing the uploaded content. */ - public FileItemIterator getItemIterator(RequestContext ctx) throws FileUploadException, + public FileItemIterator getItemIterator(final RequestContext ctx) throws FileUploadException, IOException { return new FileItemIteratorImpl(ctx); @@ -460,7 +460,7 @@ public abstract class FileUploadBase * * @return The file name for the current <code>encapsulation</code>. */ - protected String getFileName(FileItemHeaders headers) + protected String getFileName(final FileItemHeaders headers) { return getFileName(headers.getHeader(CONTENT_DISPOSITION)); } @@ -472,7 +472,7 @@ public abstract class FileUploadBase * The content-disposition headers value. * @return The file name */ - private String getFileName(String pContentDisposition) + private String getFileName(final String pContentDisposition) { String fileName = null; if (pContentDisposition != null) @@ -525,10 +525,11 @@ public abstract class FileUploadBase * The content-dispositions header value. * @return The field jake */ - private String getFieldName(String pContentDisposition) + private String getFieldName(final String pContentDisposition) { String fieldName = null; - if (pContentDisposition != null && pContentDisposition.toLowerCase().startsWith(FORM_DATA)) + if ((pContentDisposition != null) && + pContentDisposition.toLowerCase().startsWith(FORM_DATA)) { ParameterParser parser = new ParameterParser(); parser.setLowerCaseNames(true); @@ -553,7 +554,7 @@ public abstract class FileUploadBase * @deprecated Use {@link #getFieldName(FileItemHeaders)}. */ @Deprecated - protected String getFieldName(Map<String, String> headers) + protected String getFieldName(final Map<String, String> headers) { return getFieldName(getHeader(headers, CONTENT_DISPOSITION)); } @@ -615,7 +616,7 @@ public abstract class FileUploadBase while (nonWs < len) { char c = headerPart.charAt(nonWs); - if (c != ' ' && c != '\t') + if ((c != ' ') && (c != '\t')) { break; } @@ -660,7 +661,7 @@ public abstract class FileUploadBase * @deprecated Use {@link #getParsedHeaders(String)} */ @Deprecated - protected Map /* String, String */parseHeaders(String headerPart) + protected Map /* String, String */parseHeaders(final String headerPart) { FileItemHeaders headers = getParsedHeaders(headerPart); Map result = new HashMap(); @@ -687,13 +688,13 @@ public abstract class FileUploadBase * Index of the last byte, which has yet been processed. * @return Index of the \r\n sequence, which indicates end of line. */ - private int parseEndOfLine(String headerPart, int end) + private int parseEndOfLine(final String headerPart, final int end) { int index = end; for (;;) { int offset = headerPart.indexOf('\r', index); - if (offset == -1 || offset + 1 >= headerPart.length()) + if ((offset == -1) || (offset + 1 >= headerPart.length())) { throw new IllegalStateException( "Expected headers to be terminated by an empty line."); @@ -714,7 +715,7 @@ public abstract class FileUploadBase * @param header * Map where to store the current header. */ - private void parseHeaderLine(FileItemHeadersImpl headers, String header) + private void parseHeaderLine(final FileItemHeadersImpl headers, final String header) { final int colonOffset = header.indexOf(':'); if (colonOffset == -1) @@ -801,8 +802,9 @@ public abstract class FileUploadBase * @throws IOException * Creating the file item failed. */ - FileItemStreamImpl(String pName, String pFieldName, String pContentType, - boolean pFormField, long pContentLength) throws IOException + FileItemStreamImpl(final String pName, final String pFieldName, + final String pContentType, final boolean pFormField, final long pContentLength) + throws IOException { name = pName; fieldName = pFieldName; @@ -812,7 +814,7 @@ public abstract class FileUploadBase InputStream istream = itemStream; if (fileSizeMax != -1) { - if (pContentLength != -1 && pContentLength > fileSizeMax) + if ((pContentLength != -1) && (pContentLength > fileSizeMax)) { FileUploadException e = new FileSizeLimitExceededException("The field " + fieldName + " exceeds its maximum permitted " + " size of " + @@ -822,7 +824,8 @@ public abstract class FileUploadBase istream = new LimitedInputStream(istream, fileSizeMax) { @Override - protected void raiseError(long pSizeMax, long pCount) throws IOException + protected void raiseError(final long pSizeMax, final long pCount) + throws IOException { itemStream.close(true); FileUploadException e = new FileSizeLimitExceededException( @@ -922,7 +925,7 @@ public abstract class FileUploadBase * @param pHeaders * The items header object */ - public void setHeaders(FileItemHeaders pHeaders) + public void setHeaders(final FileItemHeaders pHeaders) { headers = pHeaders; } @@ -971,7 +974,7 @@ public abstract class FileUploadBase * @throws IOException * An I/O error occurred. */ - FileItemIteratorImpl(RequestContext ctx) throws FileUploadException, IOException + FileItemIteratorImpl(final RequestContext ctx) throws FileUploadException, IOException { if (ctx == null) { @@ -996,7 +999,8 @@ public abstract class FileUploadBase input = new LimitedInputStream(input, sizeMax) { @Override - protected void raiseError(long pSizeMax, long pCount) throws IOException + protected void raiseError(final long pSizeMax, final long pCount) + throws IOException { FileUploadException ex = new SizeLimitExceededException( "the request was rejected because" + " its size (" + pCount + @@ -1008,7 +1012,7 @@ public abstract class FileUploadBase } else { - if (sizeMax >= 0 && requestSize > sizeMax) + if ((sizeMax >= 0) && (requestSize > sizeMax)) { throw new SizeLimitExceededException( "the request was rejected because its size (" + requestSize + @@ -1090,7 +1094,7 @@ public abstract class FileUploadBase if (fieldName != null) { String subContentType = headers.getHeader(CONTENT_TYPE); - if (subContentType != null && + if ((subContentType != null) && subContentType.toLowerCase().startsWith(MULTIPART_MIXED)) { currentFieldName = fieldName; @@ -1125,7 +1129,7 @@ public abstract class FileUploadBase } } - private long getContentLength(FileItemHeaders pHeaders) + private long getContentLength(final FileItemHeaders pHeaders) { try { @@ -1204,7 +1208,7 @@ public abstract class FileUploadBase * @param pCause * The exceptions cause, if any, or null. */ - public FileUploadIOException(FileUploadException pCause) + public FileUploadIOException(final FileUploadException pCause) { // We're not doing super(pCause) cause of 1.3 compatibility. cause = pCause; @@ -1275,7 +1279,7 @@ public abstract class FileUploadBase * @param pException * The exceptions cause. */ - public IOFileUploadException(String pMsg, IOException pException) + public IOFileUploadException(final String pMsg, final IOException pException) { super(pMsg); cause = pException; @@ -1318,7 +1322,7 @@ public abstract class FileUploadBase * @param permitted * The requests size limit, in bytes. */ - protected SizeException(String message, long actual, long permitted) + protected SizeException(final String message, final long actual, final long permitted) { super(message); this.actual = actual; @@ -1406,7 +1410,7 @@ public abstract class FileUploadBase * The exceptions detail message. */ @Deprecated - public SizeLimitExceededException(String message) + public SizeLimitExceededException(final String message) { this(message, 0, 0); } @@ -1422,7 +1426,8 @@ public abstract class FileUploadBase * @param permitted * The maximum permitted request size. */ - public SizeLimitExceededException(String message, long actual, long permitted) + public SizeLimitExceededException(final String message, final long actual, + final long permitted) { super(message, actual, permitted); } @@ -1449,7 +1454,8 @@ public abstract class FileUploadBase * @param permitted * The maximum permitted request size. */ - public FileSizeLimitExceededException(String message, long actual, long permitted) + public FileSizeLimitExceededException(final String message, final long actual, + final long permitted) { super(message, actual, permitted); } @@ -1471,7 +1477,7 @@ public abstract class FileUploadBase * @param pListener * The progress listener, if any. Defaults to null. */ - public void setProgressListener(ProgressListener pListener) + public void setProgressListener(final ProgressListener pListener) { listener = pListener; } Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileUploadException.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileUploadException.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileUploadException.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/FileUploadException.java Sun Jan 23 08:34:30 2011 @@ -64,7 +64,7 @@ public class FileUploadException extends * @param cause * The exceptions cause. */ - public FileUploadException(String msg, Throwable cause) + public FileUploadException(final String msg, final Throwable cause) { super(msg); this.cause = cause; @@ -77,15 +77,15 @@ public class FileUploadException extends * <code>PrintStream</code> to use for output */ @Override - public void printStackTrace(PrintStream stream) + public void printStackTrace(final PrintStream stream) { super.printStackTrace(stream); if (cause != null) { stream.println("Caused by:"); cause.printStackTrace(stream); + } } -} /** * Prints this throwable and its backtrace to the specified print writer. @@ -94,7 +94,7 @@ public class FileUploadException extends * <code>PrintWriter</code> to use for output */ @Override - public void printStackTrace(PrintWriter writer) + public void printStackTrace(final PrintWriter writer) { super.printStackTrace(writer); if (cause != null) Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/LimitedInputStream.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/LimitedInputStream.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/LimitedInputStream.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/LimitedInputStream.java Sun Jan 23 08:34:30 2011 @@ -49,7 +49,7 @@ public abstract class LimitedInputStream * The limit; no more than this number of bytes shall be returned by the source * stream. */ - public LimitedInputStream(InputStream pIn, long pSizeMax) + public LimitedInputStream(final InputStream pIn, final long pSizeMax) { super(pIn); sizeMax = pSizeMax; @@ -132,7 +132,7 @@ public abstract class LimitedInputStream * @see java.io.FilterInputStream#in */ @Override - public int read(byte[] b, int off, int len) throws IOException + public int read(final byte[] b, final int off, final int len) throws IOException { int res = super.read(b, off, len); if (res > 0) Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/MultipartFormInputStream.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/MultipartFormInputStream.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/MultipartFormInputStream.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/MultipartFormInputStream.java Sun Jan 23 08:34:30 2011 @@ -122,7 +122,7 @@ public class MultipartFormInputStream * @param pContentLength * The expected content length. */ - ProgressNotifier(ProgressListener pListener, long pContentLength) + ProgressNotifier(final ProgressListener pListener, final long pContentLength) { listener = pListener; contentLength = pContentLength; @@ -134,7 +134,7 @@ public class MultipartFormInputStream * @param pBytes * Number of bytes, which have been read. */ - void noteBytesRead(int pBytes) + void noteBytesRead(final int pBytes) { /* * Indicates, that the given number of bytes have been read from the input stream. @@ -328,7 +328,8 @@ public class MultipartFormInputStream * . */ @Deprecated - public MultipartFormInputStream(InputStream input, byte[] boundary, int bufSize) + public MultipartFormInputStream(final InputStream input, final byte[] boundary, + final int bufSize) { this(input, boundary, bufSize, null); } @@ -354,8 +355,8 @@ public class MultipartFormInputStream * @see #MultipartFormInputStream(InputStream, byte[], * MultipartFormInputStream.ProgressNotifier) */ - MultipartFormInputStream(InputStream input, byte[] boundary, int bufSize, - ProgressNotifier pNotifier) + MultipartFormInputStream(final InputStream input, final byte[] boundary, final int bufSize, + final ProgressNotifier pNotifier) { this.input = input; this.bufSize = bufSize; @@ -390,7 +391,8 @@ public class MultipartFormInputStream * @see #MultipartFormInputStream(InputStream, byte[], int, * MultipartFormInputStream.ProgressNotifier) */ - MultipartFormInputStream(InputStream input, byte[] boundary, ProgressNotifier pNotifier) + MultipartFormInputStream(final InputStream input, final byte[] boundary, + final ProgressNotifier pNotifier) { this(input, boundary, DEFAULT_BUFSIZE, pNotifier); } @@ -1002,7 +1004,7 @@ public class MultipartFormInputStream * An I/O error occurred. */ @Override - public int read(byte[] b, int off, int len) throws IOException + public int read(final byte[] b, final int off, final int len) throws IOException { if (closed) { @@ -1048,7 +1050,7 @@ public class MultipartFormInputStream * @throws IOException * An I/O error occurred. */ - public void close(boolean pCloseUnderlying) throws IOException + public void close(final boolean pCloseUnderlying) throws IOException { if (closed) { @@ -1088,7 +1090,7 @@ public class MultipartFormInputStream * An I/O error occurred. */ @Override - public long skip(long bytes) throws IOException + public long skip(final long bytes) throws IOException { if (closed) { @@ -1150,7 +1152,7 @@ public class MultipartFormInputStream findSeparator(); int av = available(); - if (av > 0 || pos != -1) + if ((av > 0) || (pos != -1)) { return av; } @@ -1181,17 +1183,17 @@ public class MultipartFormInputStream } @Override - public void write(byte[] b) + public void write(final byte[] b) { } @Override - public void write(byte[] b, int i, int l) + public void write(final byte[] b, final int i, final int l) { } @Override - public void write(int b) + public void write(final int b) { } } Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/ParameterParser.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/ParameterParser.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/ParameterParser.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/ParameterParser.java Sun Jan 23 08:34:30 2011 @@ -242,9 +242,9 @@ public class ParameterParser * * @return a map of name/value pairs */ - public Map<String, String> parse(final String str, char[] separators) + public Map<String, String> parse(final String str, final char[] separators) { - if (separators == null || separators.length == 0) + if ((separators == null) || (separators.length == 0)) { return new HashMap<String, String>(); } Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/ServletFileUpload.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/ServletFileUpload.java?rev=1062344&r1=1062343&r2=1062344&view=diff ============================================================================== --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/ServletFileUpload.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/upload/ServletFileUpload.java Sun Jan 23 08:34:30 2011 @@ -69,7 +69,7 @@ public class ServletFileUpload extends F if (contentType == null) { return false; - } + } if (contentType.toLowerCase().startsWith(MULTIPART)) { return true; @@ -121,8 +121,9 @@ public class ServletFileUpload extends F * they were transmitted. * * @throws FileUploadException - * if there are problems reading/parsing the request or storing files. + * if there are problems reading/parsing the request or storing files. */ + @Override public List<FileItem> parseRequest(final HttpServletRequest request) throws FileUploadException { return parseRequest(new ServletRequestContext(request)); @@ -145,9 +146,9 @@ public class ServletFileUpload extends F * An I/O error occurred. This may be a network error while communicating with the * client or a problem while storing the uploaded content. */ - public FileItemIterator getItemIterator(HttpServletRequest request) throws FileUploadException, - IOException + public FileItemIterator getItemIterator(final HttpServletRequest request) + throws FileUploadException, IOException { return super.getItemIterator(new ServletRequestContext(request)); -} + } }