commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1746593 [1/2] - in /commons/proper/io/trunk/src: main/java/org/apache/commons/io/ main/java/org/apache/commons/io/comparator/ main/java/org/apache/commons/io/filefilter/ main/java/org/apache/commons/io/input/ main/java/org/apache/commons/i...
Date Thu, 02 Jun 2016 15:36:15 GMT
Author: krosenvold
Date: Thu Jun  2 15:36:15 2016
New Revision: 1746593

URL: http://svn.apache.org/viewvc?rev=1746593&view=rev
Log:
Updated for Java7 features

Modified:
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/Charsets.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileCleaningTracker.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/FilenameUtils.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/Java7Support.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/comparator/CompositeFileComparator.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/AndFileFilter.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/FileFilterUtils.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/OrFileFilter.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/DemuxInputStream.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileAlterationMonitor.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ByteArrayOutputStream.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/DemuxOutputStream.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/FullClassNameMatcher.java
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/DemuxTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCaseJava4.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsCleanDirectoryTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsCleanSymlinksTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsListFilesTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/FilenameUtilsTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/ComparatorAbstractTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/CompositeFileComparatorTest.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/AndFileFilterTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/ConditionalFileFilterAbstractTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/FileFilterTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/OrFileFilterTestCase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamFile.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/TailerTest.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/CollectionFileListener.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/AppendableOutputStreamTest.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/ClosedOutputStreamTest.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/ProxyWriterTest.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/serialization/ClosingBase.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/serialization/MoreComplexObject.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/testtools/TestUtils.java

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/Charsets.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/Charsets.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/Charsets.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/Charsets.java Thu Jun  2 15:36:15 2016
@@ -73,7 +73,7 @@ public class Charsets {
     public static SortedMap<String, Charset> requiredCharsets() {
         // maybe cache?
         // TODO Re-implement on Java 7 to use java.nio.charset.StandardCharsets
-        final TreeMap<String, Charset> m = new TreeMap<String, Charset>(String.CASE_INSENSITIVE_ORDER);
+        final TreeMap<String, Charset> m = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
         m.put(ISO_8859_1.name(), ISO_8859_1);
         m.put(US_ASCII.name(), US_ASCII);
         m.put(UTF_16.name(), UTF_16);

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileCleaningTracker.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileCleaningTracker.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileCleaningTracker.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileCleaningTracker.java Thu Jun  2 15:36:15 2016
@@ -48,7 +48,7 @@ public class FileCleaningTracker {
     /**
      * Queue of <code>Tracker</code> instances being watched.
      */
-    ReferenceQueue<Object> q = new ReferenceQueue<Object>();
+    ReferenceQueue<Object> q = new ReferenceQueue<>();
     /**
      * Collection of <code>Tracker</code> instances in existence.
      */

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileSystemUtils.java Thu Jun  2 15:36:15 2016
@@ -480,7 +480,7 @@ public class FileSystemUtils {
         // however, its still not perfect as the JDK support is so poor
         // (see commons-exec or Ant for a better multi-threaded multi-os solution)
 
-        final List<String> lines = new ArrayList<String>(20);
+        final List<String> lines = new ArrayList<>(20);
         Process proc = null;
         InputStream in = null;
         OutputStream out = null;

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java Thu Jun  2 15:36:15 2016
@@ -514,7 +514,7 @@ public class FileUtils {
         final IOFileFilter effDirFilter = setUpEffectiveDirFilter(dirFilter);
 
         //Find files
-        final Collection<File> files = new java.util.LinkedList<File>();
+        final Collection<File> files = new java.util.LinkedList<>();
         innerListFiles(files, directory,
                 FileFilterUtils.or(effFileFilter, effDirFilter), false);
         return files;
@@ -587,7 +587,7 @@ public class FileUtils {
         final IOFileFilter effDirFilter = setUpEffectiveDirFilter(dirFilter);
 
         //Find files
-        final Collection<File> files = new java.util.LinkedList<File>();
+        final Collection<File> files = new java.util.LinkedList<>();
         if (directory.isDirectory()) {
             files.add(directory);
         }
@@ -1085,11 +1085,8 @@ public class FileUtils {
      * @since 2.1
      */
     public static long copyFile(final File input, final OutputStream output) throws IOException {
-        final FileInputStream fis = new FileInputStream(input);
-        try {
+        try (FileInputStream fis = new FileInputStream(input)) {
             return IOUtils.copyLarge(fis, output);
-        } finally {
-            fis.close();
         }
     }
 
@@ -1354,7 +1351,7 @@ public class FileUtils {
         if (destDir.getCanonicalPath().startsWith(srcDir.getCanonicalPath())) {
             final File[] srcFiles = filter == null ? srcDir.listFiles() : srcDir.listFiles(filter);
             if (srcFiles != null && srcFiles.length > 0) {
-                exclusionList = new ArrayList<String>(srcFiles.length);
+                exclusionList = new ArrayList<>(srcFiles.length);
                 for (final File srcFile : srcFiles) {
                     final File copiedFile = new File(destDir, srcFile.getName());
                     exclusionList.add(copiedFile.getCanonicalPath());

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FilenameUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FilenameUtils.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FilenameUtils.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FilenameUtils.java Thu Jun  2 15:36:15 2016
@@ -1338,7 +1338,7 @@ public class FilenameUtils {
         boolean anyChars = false;
         int textIdx = 0;
         int wcsIdx = 0;
-        final Stack<int[]> backtrack = new Stack<int[]>();
+        final Stack<int[]> backtrack = new Stack<>();
 
         // loop around a backtrack stack, to handle complex * matching
         do {
@@ -1423,7 +1423,7 @@ public class FilenameUtils {
         }
 
         final char[] array = text.toCharArray();
-        final ArrayList<String> list = new ArrayList<String>();
+        final ArrayList<String> list = new ArrayList<>();
         final StringBuilder buffer = new StringBuilder();
         char prevChar = 0;
         for (final char ch : array) {

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java Thu Jun  2 15:36:15 2016
@@ -952,11 +952,8 @@ public class IOUtils {
      * @since 2.4
      */
     public static byte[] toByteArray(final URLConnection urlConn) throws IOException {
-        final InputStream inputStream = urlConn.getInputStream();
-        try {
+        try (InputStream inputStream = urlConn.getInputStream()) {
             return IOUtils.toByteArray(inputStream);
-        } finally {
-            inputStream.close();
         }
     }
 
@@ -1195,11 +1192,8 @@ public class IOUtils {
      * @since 2.3
      */
     public static String toString(final URL url, final Charset encoding) throws IOException {
-        final InputStream inputStream = url.openStream();
-        try {
+        try (InputStream inputStream = url.openStream()) {
             return toString(inputStream, encoding);
-        } finally {
-            inputStream.close();
         }
     }
 
@@ -1332,7 +1326,7 @@ public class IOUtils {
      */
     public static List<String> readLines(final Reader input) throws IOException {
         final BufferedReader reader = toBufferedReader(input);
-        final List<String> list = new ArrayList<String>();
+        final List<String> list = new ArrayList<>();
         String line = reader.readLine();
         while (line != null) {
             list.add(line);

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/Java7Support.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/Java7Support.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/Java7Support.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/Java7Support.java Thu Jun  2 15:36:15 2016
@@ -70,9 +70,7 @@ class Java7Support {
             exists = files.getMethod("exists", path, emptyLinkOpts.getClass());
             toPath = File.class.getMethod("toPath");
             toFile = path.getMethod("toFile");
-        } catch (ClassNotFoundException e) {
-            isJava7x = false;
-        } catch (NoSuchMethodException e) {
+        } catch (ClassNotFoundException | NoSuchMethodException e) {
             isJava7x = false;
         }
         IS_JAVA7 = isJava7x;
@@ -88,9 +86,7 @@ class Java7Support {
             Object path = toPath.invoke(file);
             Boolean result = (Boolean) isSymbolicLink.invoke(null, path);
             return result.booleanValue();
-        } catch (IllegalAccessException e) {
-            throw new RuntimeException(e);
-        } catch (InvocationTargetException e) {
+        } catch (IllegalAccessException | InvocationTargetException e) {
             throw new RuntimeException(e);
         }
     }
@@ -108,9 +104,7 @@ class Java7Support {
             Object path = toPath.invoke(symlink);
             Object resultPath = readSymlink.invoke(null, path);
             return (File) toFile.invoke(resultPath);
-        } catch (IllegalAccessException e) {
-            throw new RuntimeException(e);
-        } catch (InvocationTargetException e) {
+        } catch (IllegalAccessException | InvocationTargetException e) {
             throw new RuntimeException(e);
         }
     }

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/comparator/CompositeFileComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/comparator/CompositeFileComparator.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/comparator/CompositeFileComparator.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/comparator/CompositeFileComparator.java Thu Jun  2 15:36:15 2016
@@ -73,7 +73,7 @@ public class CompositeFileComparator ext
         if (delegates == null) {
             this.delegates = (Comparator<File>[]) NO_COMPARATORS; //1
         } else {
-            final List<Comparator<File>> list = new ArrayList<Comparator<File>>();
+            final List<Comparator<File>> list = new ArrayList<>();
             for (final Comparator<File> comparator : delegates) {
                 list.add(comparator);
             }

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/AndFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/AndFileFilter.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/AndFileFilter.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/AndFileFilter.java Thu Jun  2 15:36:15 2016
@@ -49,7 +49,7 @@ public class AndFileFilter
      * @since 1.1
      */
     public AndFileFilter() {
-        this.fileFilters = new ArrayList<IOFileFilter>();
+        this.fileFilters = new ArrayList<>();
     }
 
     /**
@@ -61,9 +61,9 @@ public class AndFileFilter
      */
     public AndFileFilter(final List<IOFileFilter> fileFilters) {
         if (fileFilters == null) {
-            this.fileFilters = new ArrayList<IOFileFilter>();
+            this.fileFilters = new ArrayList<>();
         } else {
-            this.fileFilters = new ArrayList<IOFileFilter>(fileFilters);
+            this.fileFilters = new ArrayList<>(fileFilters);
         }
     }
 
@@ -78,7 +78,7 @@ public class AndFileFilter
         if (filter1 == null || filter2 == null) {
             throw new IllegalArgumentException("The filters must not be null");
         }
-        this.fileFilters = new ArrayList<IOFileFilter>(2);
+        this.fileFilters = new ArrayList<>(2);
         addFileFilter(filter1);
         addFileFilter(filter2);
     }

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/FileFilterUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/FileFilterUtils.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/FileFilterUtils.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/FileFilterUtils.java Thu Jun  2 15:36:15 2016
@@ -80,7 +80,7 @@ public class FileFilterUtils {
         if (files == null) {
             return new File[0];
         }
-        final List<File> acceptedFiles = new ArrayList<File>();
+        final List<File> acceptedFiles = new ArrayList<>();
         for (final File file : files) {
             if (file == null) {
                 throw new IllegalArgumentException("file array contains null");
@@ -210,7 +210,7 @@ public class FileFilterUtils {
      */
     public static Set<File> filterSet(final IOFileFilter filter, final File... files) {
         final File[] acceptedFiles = filter(filter, files);
-        return new HashSet<File>(Arrays.asList(acceptedFiles));
+        return new HashSet<>(Arrays.asList(acceptedFiles));
     }
 
     /**
@@ -449,7 +449,7 @@ public class FileFilterUtils {
         if (filters == null) {
             throw new IllegalArgumentException("The filters must not be null");
         }
-        final List<IOFileFilter> list = new ArrayList<IOFileFilter>(filters.length);
+        final List<IOFileFilter> list = new ArrayList<>(filters.length);
         for (int i = 0; i < filters.length; i++) {
             if (filters[i] == null) {
                 throw new IllegalArgumentException("The filter[" + i + "] is null");

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/OrFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/OrFileFilter.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/OrFileFilter.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/OrFileFilter.java Thu Jun  2 15:36:15 2016
@@ -47,7 +47,7 @@ public class OrFileFilter
      * @since 1.1
      */
     public OrFileFilter() {
-        this.fileFilters = new ArrayList<IOFileFilter>();
+        this.fileFilters = new ArrayList<>();
     }
 
     /**
@@ -59,9 +59,9 @@ public class OrFileFilter
      */
     public OrFileFilter(final List<IOFileFilter> fileFilters) {
         if (fileFilters == null) {
-            this.fileFilters = new ArrayList<IOFileFilter>();
+            this.fileFilters = new ArrayList<>();
         } else {
-            this.fileFilters = new ArrayList<IOFileFilter>(fileFilters);
+            this.fileFilters = new ArrayList<>(fileFilters);
         }
     }
 
@@ -76,7 +76,7 @@ public class OrFileFilter
         if (filter1 == null || filter2 == null) {
             throw new IllegalArgumentException("The filters must not be null");
         }
-        this.fileFilters = new ArrayList<IOFileFilter>(2);
+        this.fileFilters = new ArrayList<>(2);
         addFileFilter(filter1);
         addFileFilter(filter2);
     }

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/DemuxInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/DemuxInputStream.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/DemuxInputStream.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/DemuxInputStream.java Thu Jun  2 15:36:15 2016
@@ -30,7 +30,7 @@ import java.io.InputStream;
 public class DemuxInputStream
     extends InputStream
 {
-    private final InheritableThreadLocal<InputStream> m_streams = new InheritableThreadLocal<InputStream>();
+    private final InheritableThreadLocal<InputStream> m_streams = new InheritableThreadLocal<>();
 
     /**
      * Bind the specified stream to the current thread.

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileAlterationMonitor.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileAlterationMonitor.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileAlterationMonitor.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileAlterationMonitor.java Thu Jun  2 15:36:15 2016
@@ -31,7 +31,7 @@ import java.util.concurrent.ThreadFactor
 public final class FileAlterationMonitor implements Runnable {
 
     private final long interval;
-    private final List<FileAlterationObserver> observers = new CopyOnWriteArrayList<FileAlterationObserver>();
+    private final List<FileAlterationObserver> observers = new CopyOnWriteArrayList<>();
     private Thread thread = null;
     private ThreadFactory threadFactory;
     private volatile boolean running = false;

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java Thu Jun  2 15:36:15 2016
@@ -122,7 +122,7 @@ import org.apache.commons.io.comparator.
 public class FileAlterationObserver implements Serializable {
 
     private static final long serialVersionUID = 1185122225658782848L;
-    private final List<FileAlterationListener> listeners = new CopyOnWriteArrayList<FileAlterationListener>();
+    private final List<FileAlterationListener> listeners = new CopyOnWriteArrayList<>();
     private final FileEntry rootEntry;
     private final FileFilter fileFilter;
     private final Comparator<File> comparator;

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ByteArrayOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ByteArrayOutputStream.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ByteArrayOutputStream.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ByteArrayOutputStream.java Thu Jun  2 15:36:15 2016
@@ -60,7 +60,7 @@ public class ByteArrayOutputStream exten
     private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
 
     /** The list of buffers, which grows and never reduces. */
-    private final List<byte[]> buffers = new ArrayList<byte[]>();
+    private final List<byte[]> buffers = new ArrayList<>();
     /** The index of the current buffer. */
     private int currentBufferIndex;
     /** The total count of bytes in all the filled buffers. */
@@ -338,7 +338,7 @@ public class ByteArrayOutputStream exten
         if (remaining == 0) {
             return new ClosedInputStream();
         }
-        final List<ByteArrayInputStream> list = new ArrayList<ByteArrayInputStream>(buffers.size());
+        final List<ByteArrayInputStream> list = new ArrayList<>(buffers.size());
         for (final byte[] buf : buffers) {
             final int c = Math.min(buf.length, remaining);
             list.add(new ByteArrayInputStream(buf, 0, c));

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/DemuxOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/DemuxOutputStream.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/DemuxOutputStream.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/DemuxOutputStream.java Thu Jun  2 15:36:15 2016
@@ -25,7 +25,7 @@ import java.io.OutputStream;
  * @version $Id$
  */
 public class DemuxOutputStream extends OutputStream {
-    private final InheritableThreadLocal<OutputStream> outputStreamThreadLocal = new InheritableThreadLocal<OutputStream>();
+    private final InheritableThreadLocal<OutputStream> outputStreamThreadLocal = new InheritableThreadLocal<>();
 
     /**
      * Binds the specified stream to the current thread.

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/FullClassNameMatcher.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/FullClassNameMatcher.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/FullClassNameMatcher.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/FullClassNameMatcher.java Thu Jun  2 15:36:15 2016
@@ -39,7 +39,7 @@ final class FullClassNameMatcher impleme
      * @param classes a list of class names
      */
     public FullClassNameMatcher(String... classes) {
-        classesSet = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(classes)));
+        classesSet = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(classes)));
     }
 
     @Override

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java Thu Jun  2 15:36:15 2016
@@ -43,8 +43,8 @@ import java.util.regex.Pattern;
  * </p>
  */
 public class ValidatingObjectInputStream extends ObjectInputStream {
-    private final List<ClassNameMatcher> acceptMatchers = new ArrayList<ClassNameMatcher>();
-    private final List<ClassNameMatcher> rejectMatchers = new ArrayList<ClassNameMatcher>();
+    private final List<ClassNameMatcher> acceptMatchers = new ArrayList<>();
+    private final List<ClassNameMatcher> rejectMatchers = new ArrayList<>();
 
     /**
      * Constructs an object to deserialize the specified input stream.

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/DemuxTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/DemuxTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/DemuxTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/DemuxTestCase.java Thu Jun  2 15:36:15 2016
@@ -46,8 +46,8 @@ public class DemuxTestCase {
     private static final String DATA4 = "Data for thread4";
 
     private static final Random c_random = new Random();
-    private final HashMap<String, ByteArrayOutputStream> m_outputMap = new HashMap<String, ByteArrayOutputStream>();
-    private final HashMap<String, Thread> m_threadMap = new HashMap<String, Thread>();
+    private final HashMap<String, ByteArrayOutputStream> m_outputMap = new HashMap<>();
+    private final HashMap<String, Thread> m_threadMap = new HashMap<>();
 
     @SuppressWarnings("deprecation") // unavoidable until Java 7
     private String getOutput(final String threadName) {

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCase.java Thu Jun  2 15:36:15 2016
@@ -240,7 +240,7 @@ public class DirectoryWalkerTestCase {
      * Extract the directories.
      */
     private List<File> directoriesOnly(final Collection<File> results) {
-        final List<File> list = new ArrayList<File>(results.size());
+        final List<File> list = new ArrayList<>(results.size());
         for (final File file : results) {
             if (file.isDirectory()) {
                 list.add(file);
@@ -253,7 +253,7 @@ public class DirectoryWalkerTestCase {
      * Extract the files.
      */
     private List<File> filesOnly(final Collection<File> results) {
-        final List<File> list = new ArrayList<File>(results.size());
+        final List<File> list = new ArrayList<>(results.size());
         for (final File file : results) {
             if (file.isFile()) {
                 list.add(file);
@@ -389,7 +389,7 @@ public class DirectoryWalkerTestCase {
 
         /** find files. */
         protected List<File> find(final File startDirectory) {
-           final List<File> results = new ArrayList<File>();
+           final List<File> results = new ArrayList<>();
            try {
                walk(startDirectory, results);
            } catch(final IOException ex) {
@@ -448,7 +448,7 @@ public class DirectoryWalkerTestCase {
 
         /** find files. */
         protected List<File> find(final File startDirectory) throws IOException {
-           final List<File> results = new ArrayList<File>();
+           final List<File> results = new ArrayList<>();
            walk(startDirectory, results);
            return results;
         }
@@ -499,7 +499,7 @@ public class DirectoryWalkerTestCase {
 
         /** find files. */
         protected List<File> find(final File startDirectory) throws IOException {
-           results = new ArrayList<File>();
+           results = new ArrayList<>();
            walk(startDirectory, results);
            return results;
         }
@@ -552,7 +552,7 @@ public class DirectoryWalkerTestCase {
 
         /** find files. */
         protected List<String> find(final File startDirectory) {
-           final List<String> results = new ArrayList<String>();
+           final List<String> results = new ArrayList<>();
            try {
                walk(startDirectory, results);
            } catch(final IOException ex) {

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCaseJava4.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCaseJava4.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCaseJava4.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/DirectoryWalkerTestCaseJava4.java Thu Jun  2 15:36:15 2016
@@ -376,7 +376,7 @@ public class DirectoryWalkerTestCaseJava
          * find files.
          */
         protected List<File> find(final File startDirectory) {
-            final List<File> results = new ArrayList<File>();
+            final List<File> results = new ArrayList<>();
             try {
                 walk(startDirectory, results);
             } catch (final IOException ex) {

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java Thu Jun  2 15:36:15 2016
@@ -69,7 +69,7 @@ public class FileCleaningTrackerTestCase
          * which we should, IMO, not.
          */
         {
-            theInstance.q = new ReferenceQueue<Object>();
+            theInstance.q = new ReferenceQueue<>();
             theInstance.trackers.clear();
             theInstance.deleteFailures.clear();
             theInstance.exitWhenFinished = false;
@@ -326,7 +326,7 @@ public class FileCleaningTrackerTestCase
         TestUtils.sleep(500);
         int count = 0;
         while(theInstance.getTrackCount() != 0 && count++ < 5) {
-            List<String> list = new ArrayList<String>();
+            List<String> list = new ArrayList<>();
             try {
                 long i = 0;
                 while (theInstance.getTrackCount() != 0) {

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsCleanDirectoryTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsCleanDirectoryTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsCleanDirectoryTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsCleanDirectoryTestCase.java Thu Jun  2 15:36:15 2016
@@ -136,7 +136,7 @@ public class FileUtilsCleanDirectoryTest
     private boolean chmod(final File file, final int mode, final boolean recurse)
             throws InterruptedException {
         // TODO: Refactor this to FileSystemUtils
-        final List<String> args = new ArrayList<String>();
+        final List<String> args = new ArrayList<>();
         args.add("chmod");
 
         if (recurse) {

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsCleanSymlinksTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsCleanSymlinksTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsCleanSymlinksTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsCleanSymlinksTestCase.java Thu Jun  2 15:36:15 2016
@@ -257,7 +257,7 @@ public class FileUtilsCleanSymlinksTestC
 
     private void setupSymlink(final File res, final File link) throws Exception {
         // create symlink
-        final List<String> args = new ArrayList<String>();
+        final List<String> args = new ArrayList<>();
         args.add("ln");
         args.add("-s");
 

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsListFilesTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsListFilesTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsListFilesTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsListFilesTestCase.java Thu Jun  2 15:36:15 2016
@@ -91,7 +91,7 @@ public class FileUtilsListFilesTestCase
     }
 
     private Collection<String> filesToFilenames(final Collection<File> files) {
-        final Collection<String> filenames = new ArrayList<String>(files.size());
+        final Collection<String> filenames = new ArrayList<>(files.size());
         for (final File file : files) {
             filenames.add(file.getName());
         }
@@ -99,7 +99,7 @@ public class FileUtilsListFilesTestCase
     }
 
     private Collection<String> filesToFilenames(final Iterator<File> files) {
-        final Collection<String> filenames = new ArrayList<String>();
+        final Collection<String> filenames = new ArrayList<>();
         while (files.hasNext()) {
             filenames.add(files.next().getName());
         }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java Thu Jun  2 15:36:15 2016
@@ -746,15 +746,12 @@ public class FileUtilsTestCase extends F
         FileUtils.copyURLToFile(getClass().getResource(resourceName), file);
 
         // Tests that resuorce was copied correctly
-        final FileInputStream fis = new FileInputStream(file);
-        try {
+        try (FileInputStream fis = new FileInputStream(file)) {
             assertTrue(
                     "Content is not equal.",
                     IOUtils.contentEquals(
                             getClass().getResourceAsStream(resourceName),
                             fis));
-        } finally {
-            fis.close();
         }
         //TODO Maybe test copy to itself like for copyFile()
     }
@@ -770,15 +767,12 @@ public class FileUtilsTestCase extends F
         FileUtils.copyURLToFile(getClass().getResource(resourceName), file, 500, 500);
 
         // Tests that resuorce was copied correctly
-        final FileInputStream fis = new FileInputStream(file);
-        try {
+        try (FileInputStream fis = new FileInputStream(file)) {
             assertTrue(
                     "Content is not equal.",
                     IOUtils.contentEquals(
                             getClass().getResourceAsStream(resourceName),
                             fis));
-        } finally {
-            fis.close();
         }
         //TODO Maybe test copy to itself like for copyFile()
     }
@@ -1692,11 +1686,8 @@ public class FileUtilsTestCase extends F
         final String filename = file1.getAbsolutePath();
 
         //Create test file on-the-fly (used to be in CVS)
-        final OutputStream out = new java.io.FileOutputStream(file1);
-        try {
+        try (OutputStream out = new FileOutputStream(file1)) {
             out.write("This is a test".getBytes("UTF-8"));
-        } finally {
-            out.close();
         }
 
         final File file2 = new File(getTestDirectory(), "test2.txt");
@@ -1779,7 +1770,7 @@ public class FileUtilsTestCase extends F
 
         assertEquals(fileNames.length, files.size());
 
-        final Map<String, String> foundFileNames = new HashMap<String, String>();
+        final Map<String, String> foundFileNames = new HashMap<>();
 
         for (int i = 0; i < count; ++i) {
             boolean found = false;
@@ -1862,7 +1853,7 @@ public class FileUtilsTestCase extends F
                 new WildcardFileFilter("*.*"),
                 new WildcardFileFilter("*"));
 
-        final Map<String, String> foundFileNames = new HashMap<String, String>();
+        final Map<String, String> foundFileNames = new HashMap<>();
 
         while (files.hasNext()) {
             boolean found = false;
@@ -3063,7 +3054,7 @@ public class FileUtilsTestCase extends F
         }
 
         List<File> list(final File startDirectory) throws IOException {
-            final ArrayList<File> files = new ArrayList<File>();
+            final ArrayList<File> files = new ArrayList<>();
             walk(startDirectory, files);
             return files;
         }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FilenameUtilsTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FilenameUtilsTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FilenameUtilsTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FilenameUtilsTestCase.java Thu Jun  2 15:36:15 2016
@@ -1073,37 +1073,37 @@ public class FilenameUtilsTestCase exten
         assertFalse(FilenameUtils.isExtension("file.txt", (Collection<String>) null));
         assertTrue(FilenameUtils.isExtension("file", (Collection<String>) null));
         assertFalse(FilenameUtils.isExtension("file.txt", new ArrayList<String>()));
-        assertTrue(FilenameUtils.isExtension("file.txt", new ArrayList<String>(Arrays.asList(new String[]{"txt"}))));
-        assertFalse(FilenameUtils.isExtension("file.txt", new ArrayList<String>(Arrays.asList(new String[]{"rtf"}))));
-        assertTrue(FilenameUtils.isExtension("file", new ArrayList<String>(Arrays.asList(new String[]{"rtf", ""}))));
-        assertTrue(FilenameUtils.isExtension("file.txt", new ArrayList<String>(Arrays.asList(new String[]{"rtf", "txt"}))));
+        assertTrue(FilenameUtils.isExtension("file.txt", new ArrayList<>(Arrays.asList(new String[]{"txt"}))));
+        assertFalse(FilenameUtils.isExtension("file.txt", new ArrayList<>(Arrays.asList(new String[]{"rtf"}))));
+        assertTrue(FilenameUtils.isExtension("file", new ArrayList<>(Arrays.asList(new String[]{"rtf", ""}))));
+        assertTrue(FilenameUtils.isExtension("file.txt", new ArrayList<>(Arrays.asList(new String[]{"rtf", "txt"}))));
 
         assertFalse(FilenameUtils.isExtension("a/b/file.txt", (Collection<String>) null));
         assertFalse(FilenameUtils.isExtension("a/b/file.txt", new ArrayList<String>()));
-        assertTrue(FilenameUtils.isExtension("a/b/file.txt", new ArrayList<String>(Arrays.asList(new String[]{"txt"}))));
-        assertFalse(FilenameUtils.isExtension("a/b/file.txt", new ArrayList<String>(Arrays.asList(new String[]{"rtf"}))));
-        assertTrue(FilenameUtils.isExtension("a/b/file.txt", new ArrayList<String>(Arrays.asList(new String[]{"rtf", "txt"}))));
+        assertTrue(FilenameUtils.isExtension("a/b/file.txt", new ArrayList<>(Arrays.asList(new String[]{"txt"}))));
+        assertFalse(FilenameUtils.isExtension("a/b/file.txt", new ArrayList<>(Arrays.asList(new String[]{"rtf"}))));
+        assertTrue(FilenameUtils.isExtension("a/b/file.txt", new ArrayList<>(Arrays.asList(new String[]{"rtf", "txt"}))));
 
         assertFalse(FilenameUtils.isExtension("a.b/file.txt", (Collection<String>) null));
         assertFalse(FilenameUtils.isExtension("a.b/file.txt", new ArrayList<String>()));
-        assertTrue(FilenameUtils.isExtension("a.b/file.txt", new ArrayList<String>(Arrays.asList(new String[]{"txt"}))));
-        assertFalse(FilenameUtils.isExtension("a.b/file.txt", new ArrayList<String>(Arrays.asList(new String[]{"rtf"}))));
-        assertTrue(FilenameUtils.isExtension("a.b/file.txt", new ArrayList<String>(Arrays.asList(new String[]{"rtf", "txt"}))));
+        assertTrue(FilenameUtils.isExtension("a.b/file.txt", new ArrayList<>(Arrays.asList(new String[]{"txt"}))));
+        assertFalse(FilenameUtils.isExtension("a.b/file.txt", new ArrayList<>(Arrays.asList(new String[]{"rtf"}))));
+        assertTrue(FilenameUtils.isExtension("a.b/file.txt", new ArrayList<>(Arrays.asList(new String[]{"rtf", "txt"}))));
 
         assertFalse(FilenameUtils.isExtension("a\\b\\file.txt", (Collection<String>) null));
         assertFalse(FilenameUtils.isExtension("a\\b\\file.txt", new ArrayList<String>()));
-        assertTrue(FilenameUtils.isExtension("a\\b\\file.txt", new ArrayList<String>(Arrays.asList(new String[]{"txt"}))));
-        assertFalse(FilenameUtils.isExtension("a\\b\\file.txt", new ArrayList<String>(Arrays.asList(new String[]{"rtf"}))));
-        assertTrue(FilenameUtils.isExtension("a\\b\\file.txt", new ArrayList<String>(Arrays.asList(new String[]{"rtf", "txt"}))));
+        assertTrue(FilenameUtils.isExtension("a\\b\\file.txt", new ArrayList<>(Arrays.asList(new String[]{"txt"}))));
+        assertFalse(FilenameUtils.isExtension("a\\b\\file.txt", new ArrayList<>(Arrays.asList(new String[]{"rtf"}))));
+        assertTrue(FilenameUtils.isExtension("a\\b\\file.txt", new ArrayList<>(Arrays.asList(new String[]{"rtf", "txt"}))));
 
         assertFalse(FilenameUtils.isExtension("a.b\\file.txt", (Collection<String>) null));
         assertFalse(FilenameUtils.isExtension("a.b\\file.txt", new ArrayList<String>()));
-        assertTrue(FilenameUtils.isExtension("a.b\\file.txt", new ArrayList<String>(Arrays.asList(new String[]{"txt"}))));
-        assertFalse(FilenameUtils.isExtension("a.b\\file.txt", new ArrayList<String>(Arrays.asList(new String[]{"rtf"}))));
-        assertTrue(FilenameUtils.isExtension("a.b\\file.txt", new ArrayList<String>(Arrays.asList(new String[]{"rtf", "txt"}))));
+        assertTrue(FilenameUtils.isExtension("a.b\\file.txt", new ArrayList<>(Arrays.asList(new String[]{"txt"}))));
+        assertFalse(FilenameUtils.isExtension("a.b\\file.txt", new ArrayList<>(Arrays.asList(new String[]{"rtf"}))));
+        assertTrue(FilenameUtils.isExtension("a.b\\file.txt", new ArrayList<>(Arrays.asList(new String[]{"rtf", "txt"}))));
 
-        assertFalse(FilenameUtils.isExtension("a.b\\file.txt", new ArrayList<String>(Arrays.asList(new String[]{"TXT"}))));
-        assertFalse(FilenameUtils.isExtension("a.b\\file.txt", new ArrayList<String>(Arrays.asList(new String[]{"TXT", "RTF"}))));
+        assertFalse(FilenameUtils.isExtension("a.b\\file.txt", new ArrayList<>(Arrays.asList(new String[]{"TXT"}))));
+        assertFalse(FilenameUtils.isExtension("a.b\\file.txt", new ArrayList<>(Arrays.asList(new String[]{"TXT", "RTF"}))));
     }
 
 }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsTestCase.java Thu Jun  2 15:36:15 2016
@@ -288,25 +288,19 @@ public class IOUtilsTestCase extends Fil
     // testing deprecated method
     @Test public void testCopy_ByteArray_OutputStream() throws Exception {
         final File destination = TestUtils.newFile(getTestDirectory(), "copy8.txt");
-        final FileInputStream fin = new FileInputStream(m_testFile);
         byte[] in;
-        try {
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
             // Create our byte[]. Rely on testInputStreamToByteArray() to make sure this is valid.
             in = IOUtils.toByteArray(fin);
-        } finally {
-            fin.close();
         }
 
-        final FileOutputStream fout = new FileOutputStream(destination);
-        try {
+        try (FileOutputStream fout = new FileOutputStream(destination)) {
             CopyUtils.copy(in, fout);
 
             fout.flush();
 
             TestUtils.checkFile(destination, m_testFile);
             TestUtils.checkWrite(fout);
-        } finally {
-            fout.close();
         }
         TestUtils.deleteFile(destination);
     }
@@ -315,23 +309,17 @@ public class IOUtilsTestCase extends Fil
     // testing deprecated method
     @Test public void testCopy_ByteArray_Writer() throws Exception {
         final File destination = TestUtils.newFile(getTestDirectory(), "copy7.txt");
-        final FileInputStream fin = new FileInputStream(m_testFile);
         byte[] in;
-        try {
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
             // Create our byte[]. Rely on testInputStreamToByteArray() to make sure this is valid.
             in = IOUtils.toByteArray(fin);
-        } finally {
-            fin.close();
         }
 
-        final FileWriter fout = new FileWriter(destination);
-        try {
+        try (FileWriter fout = new FileWriter(destination)) {
             CopyUtils.copy(in, fout);
             fout.flush();
             TestUtils.checkFile(destination, m_testFile);
             TestUtils.checkWrite(fout);
-        } finally {
-            fout.close();
         }
         TestUtils.deleteFile(destination);
     }
@@ -340,24 +328,18 @@ public class IOUtilsTestCase extends Fil
     // testing deprecated method
     @Test public void testCopy_String_Writer() throws Exception {
         final File destination = TestUtils.newFile(getTestDirectory(), "copy6.txt");
-        final FileReader fin = new FileReader(m_testFile);
         String str;
-        try {
+        try (FileReader fin = new FileReader(m_testFile)) {
             // Create our String. Rely on testReaderToString() to make sure this is valid.
             str = IOUtils.toString(fin);
-        } finally {
-            fin.close();
         }
 
-        final FileWriter fout = new FileWriter(destination);
-        try {
+        try (FileWriter fout = new FileWriter(destination)) {
             CopyUtils.copy(str, fout);
             fout.flush();
 
             TestUtils.checkFile(destination, m_testFile);
             TestUtils.checkWrite(fout);
-        } finally {
-            fout.close();
         }
         TestUtils.deleteFile(destination);
     }
@@ -774,24 +756,18 @@ public class IOUtilsTestCase extends Fil
     }
 
     @Test public void testSkip_FileReader() throws Exception {
-        final FileReader in = new FileReader(m_testFile);
-        try {
+        try (FileReader in = new FileReader(m_testFile)) {
             assertEquals(FILE_SIZE - 10, IOUtils.skip(in, FILE_SIZE - 10));
             assertEquals(10, IOUtils.skip(in, 20));
             assertEquals(0, IOUtils.skip(in, 10));
-        } finally {
-            in.close();
         }
     }
 
     @Test public void testSkip_InputStream() throws Exception {
-        final InputStream in = new FileInputStream(m_testFile);
-        try {
+        try (InputStream in = new FileInputStream(m_testFile)) {
             assertEquals(FILE_SIZE - 10, IOUtils.skip(in, FILE_SIZE - 10));
             assertEquals(10, IOUtils.skip(in, 20));
             assertEquals(0, IOUtils.skip(in, 10));
-        } finally {
-            in.close();
         }
     }
 
@@ -877,17 +853,13 @@ public class IOUtilsTestCase extends Fil
     // testing deprecated method
     @Test public void testStringToOutputStream() throws Exception {
         final File destination = TestUtils.newFile(getTestDirectory(), "copy5.txt");
-        final FileReader fin = new FileReader(m_testFile);
         String str;
-        try {
+        try (FileReader fin = new FileReader(m_testFile)) {
             // Create our String. Rely on testReaderToString() to make sure this is valid.
             str = IOUtils.toString(fin);
-        } finally {
-            fin.close();
         }
 
-        final FileOutputStream fout = new FileOutputStream(destination);
-        try {
+        try (FileOutputStream fout = new FileOutputStream(destination)) {
             CopyUtils.copy(str, fout);
             // Note: this method *does* flush. It is equivalent to:
             // OutputStreamWriter _out = new OutputStreamWriter(fout);
@@ -898,120 +870,94 @@ public class IOUtilsTestCase extends Fil
 
             TestUtils.checkFile(destination, m_testFile);
             TestUtils.checkWrite(fout);
-        } finally {
-            fout.close();
         }
         TestUtils.deleteFile(destination);
     }
 
     @Test public void testToBufferedInputStream_InputStream() throws Exception {
-        final FileInputStream fin = new FileInputStream(m_testFile);
-        try {
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
             final InputStream in = IOUtils.toBufferedInputStream(fin);
             final byte[] out = IOUtils.toByteArray(in);
             assertNotNull(out);
             assertEquals("Not all bytes were read", 0, fin.available());
             assertEquals("Wrong output size", FILE_SIZE, out.length);
             TestUtils.assertEqualContent(out, m_testFile);
-        } finally {
-            fin.close();
         }
     }
 
     @Test public void testToBufferedInputStreamWithBufferSize_InputStream() throws Exception {
-        final FileInputStream fin = new FileInputStream(m_testFile);
-        try {
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
             final InputStream in = IOUtils.toBufferedInputStream(fin, 2048);
             final byte[] out = IOUtils.toByteArray(in);
             assertNotNull(out);
             assertEquals("Not all bytes were read", 0, fin.available());
             assertEquals("Wrong output size", FILE_SIZE, out.length);
             TestUtils.assertEqualContent(out, m_testFile);
-        } finally {
-            fin.close();
         }
     }
 
     @Test public void testToByteArray_InputStream() throws Exception {
-        final FileInputStream fin = new FileInputStream(m_testFile);
-        try {
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
             final byte[] out = IOUtils.toByteArray(fin);
             assertNotNull(out);
             assertEquals("Not all bytes were read", 0, fin.available());
             assertEquals("Wrong output size", FILE_SIZE, out.length);
             TestUtils.assertEqualContent(out, m_testFile);
-        } finally {
-            fin.close();
         }
     }
 
     @Test public void testToByteArray_InputStream_NegativeSize() throws Exception {
-        final FileInputStream fin = new FileInputStream(m_testFile);
 
-        try {
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
             IOUtils.toByteArray(fin, -1);
             fail("IllegalArgumentException excepted");
         } catch (final IllegalArgumentException exc) {
             assertTrue("Exception message does not start with \"Size must be equal or greater than zero\"", exc
                     .getMessage().startsWith("Size must be equal or greater than zero"));
-        } finally {
-            fin.close();
         }
 
     }
 
     @Test public void testToByteArray_InputStream_Size() throws Exception {
-        final FileInputStream fin = new FileInputStream(m_testFile);
-        try {
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
             final byte[] out = IOUtils.toByteArray(fin, m_testFile.length());
             assertNotNull(out);
             assertEquals("Not all bytes were read", 0, fin.available());
             assertEquals("Wrong output size: out.length=" + out.length + "!=" + FILE_SIZE, FILE_SIZE, out.length);
             TestUtils.assertEqualContent(out, m_testFile);
-        } finally {
-            fin.close();
         }
     }
 
     @Test public void testToByteArray_InputStream_SizeIllegal() throws Exception {
-        final FileInputStream fin = new FileInputStream(m_testFile);
 
-        try {
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
             IOUtils.toByteArray(fin, m_testFile.length() + 1);
             fail("IOException excepted");
         } catch (final IOException exc) {
             assertTrue("Exception message does not start with \"Unexpected readed size\"",
                     exc.getMessage().startsWith("Unexpected readed size"));
-        } finally {
-            fin.close();
         }
 
     }
 
     @Test public void testToByteArray_InputStream_SizeLong() throws Exception {
-        final FileInputStream fin = new FileInputStream(m_testFile);
 
-        try {
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
             IOUtils.toByteArray(fin, (long) Integer.MAX_VALUE + 1);
             fail("IOException excepted");
         } catch (final IllegalArgumentException exc) {
             assertTrue("Exception message does not start with \"Size cannot be greater than Integer max value\"", exc
                     .getMessage().startsWith("Size cannot be greater than Integer max value"));
-        } finally {
-            fin.close();
         }
 
     }
 
     @Test public void testToByteArray_InputStream_SizeZero() throws Exception {
-        final FileInputStream fin = new FileInputStream(m_testFile);
 
-        try {
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
             final byte[] out = IOUtils.toByteArray(fin, 0);
             assertNotNull("Out cannot be null", out);
             assertEquals("Out length must be 0", 0, out.length);
-        } finally {
-            fin.close();
         }
     }
 
@@ -1028,15 +974,12 @@ public class IOUtilsTestCase extends Fil
     @SuppressWarnings("deprecation")
     // testing deprecated method
     @Test public void testToByteArray_String() throws Exception {
-        final FileReader fin = new FileReader(m_testFile);
-        try {
+        try (FileReader fin = new FileReader(m_testFile)) {
             // Create our String. Rely on testReaderToString() to make sure this is valid.
             final String str = IOUtils.toString(fin);
 
             final byte[] out = IOUtils.toByteArray(str);
             assertEqualContent(str.getBytes(), out);
-        } finally {
-            fin.close();
         }
     }
 
@@ -1065,40 +1008,31 @@ public class IOUtilsTestCase extends Fil
 
     @SuppressWarnings("deprecation") // deliberately testing deprecated method
     @Test public void testToCharArray_InputStream() throws Exception {
-        final FileInputStream fin = new FileInputStream(m_testFile);
-        try {
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
             final char[] out = IOUtils.toCharArray(fin);
             assertNotNull(out);
             assertEquals("Not all chars were read", 0, fin.available());
             assertEquals("Wrong output size", FILE_SIZE, out.length);
             TestUtils.assertEqualContent(out, m_testFile);
-        } finally {
-            fin.close();
         }
     }
 
     @Test public void testToCharArray_InputStream_CharsetName() throws Exception {
-        final FileInputStream fin = new FileInputStream(m_testFile);
-        try {
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
             final char[] out = IOUtils.toCharArray(fin, "UTF-8");
             assertNotNull(out);
             assertEquals("Not all chars were read", 0, fin.available());
             assertEquals("Wrong output size", FILE_SIZE, out.length);
             TestUtils.assertEqualContent(out, m_testFile);
-        } finally {
-            fin.close();
         }
     }
 
     @Test public void testToCharArray_Reader() throws Exception {
-        final FileReader fr = new FileReader(m_testFile);
-        try {
+        try (FileReader fr = new FileReader(m_testFile)) {
             final char[] out = IOUtils.toCharArray(fr);
             assertNotNull(out);
             assertEquals("Wrong output size", FILE_SIZE, out.length);
             TestUtils.assertEqualContent(out, m_testFile);
-        } finally {
-            fr.close();
         }
     }
 
@@ -1153,38 +1087,29 @@ public class IOUtilsTestCase extends Fil
     @SuppressWarnings("deprecation")
     // testing deprecated method
     @Test public void testToString_ByteArray() throws Exception {
-        final FileInputStream fin = new FileInputStream(m_testFile);
-        try {
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
             final byte[] in = IOUtils.toByteArray(fin);
             // Create our byte[]. Rely on testInputStreamToByteArray() to make sure this is valid.
             final String str = IOUtils.toString(in);
             assertEqualContent(in, str.getBytes());
-        } finally {
-            fin.close();
         }
     }
 
     @SuppressWarnings("deprecation") // deliberately testing deprecated method
     @Test public void testToString_InputStream() throws Exception {
-        final FileInputStream fin = new FileInputStream(m_testFile);
-        try {
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
             final String out = IOUtils.toString(fin);
             assertNotNull(out);
             assertEquals("Not all bytes were read", 0, fin.available());
             assertEquals("Wrong output size", FILE_SIZE, out.length());
-        } finally {
-            fin.close();
         }
     }
 
     @Test public void testToString_Reader() throws Exception {
-        final FileReader fin = new FileReader(m_testFile);
-        try {
+        try (FileReader fin = new FileReader(m_testFile)) {
             final String out = IOUtils.toString(fin);
             assertNotNull(out);
             assertEquals("Wrong output size", FILE_SIZE, out.length());
-        } finally {
-            fin.close();
         }
     }
 

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java Thu Jun  2 15:36:15 2016
@@ -94,7 +94,7 @@ public class LineIteratorTestCase extend
      * @return a new lines list.
      */
     private List<String> createStringLines(final int lineCount) {
-        final List<String> lines = new ArrayList<String>();
+        final List<String> lines = new ArrayList<>();
         for (int i = 0; i < lineCount; i++) {
             lines.add("LINE " + i);
         }

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/ComparatorAbstractTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/ComparatorAbstractTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/ComparatorAbstractTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/ComparatorAbstractTestCase.java Thu Jun  2 15:36:15 2016
@@ -116,7 +116,7 @@ public abstract class ComparatorAbstract
      */
     @Test
     public void testSortList() {
-        final List<File> files = new ArrayList<File>();
+        final List<File> files = new ArrayList<>();
         files.add(equalFile1);
         files.add(moreFile);
         files.add(lessFile);

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/CompositeFileComparatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/CompositeFileComparatorTest.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/CompositeFileComparatorTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/CompositeFileComparatorTest.java Thu Jun  2 15:36:15 2016
@@ -100,7 +100,7 @@ public class CompositeFileComparatorTest
      */
     @Test
     public void constructorIterable_order() {
-        final List<Comparator<File>> list = new ArrayList<Comparator<File>>();
+        final List<Comparator<File>> list = new ArrayList<>();
         list.add(SizeFileComparator.SIZE_COMPARATOR);
         list.add(ExtensionFileComparator.EXTENSION_COMPARATOR);
         final Comparator<File> c = new CompositeFileComparator(list);

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/AndFileFilterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/AndFileFilterTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/AndFileFilterTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/AndFileFilterTestCase.java Thu Jun  2 15:36:15 2016
@@ -90,11 +90,11 @@ public class AndFileFilterTestCase exten
   public void setUpTestFilters() {
     // filters
     //tests
-    this.testFilters = new ArrayList<List<IOFileFilter>>();
-    this.testTrueResults = new ArrayList<boolean[]>();
-    this.testFalseResults = new ArrayList<boolean[]>();
-    this.testFileResults = new ArrayList<Boolean>();
-    this.testFilenameResults = new ArrayList<Boolean>();
+    this.testFilters = new ArrayList<>();
+    this.testTrueResults = new ArrayList<>();
+    this.testFalseResults = new ArrayList<>();
+    this.testFileResults = new ArrayList<>();
+    this.testFilenameResults = new ArrayList<>();
 
     // test 0 - add empty elements
     {
@@ -108,7 +108,7 @@ public class AndFileFilterTestCase exten
     // test 1 - Test conditional and with all filters returning true
     {
       // test 1 filters
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(trueFilters[1]);
       filters.add(trueFilters[2]);
       filters.add(trueFilters[3]);
@@ -127,7 +127,7 @@ public class AndFileFilterTestCase exten
     // test 2 - Test conditional and with first filter returning false
     {
       // test 2 filters
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(falseFilters[1]);
       filters.add(trueFilters[1]);
       filters.add(trueFilters[2]);
@@ -149,7 +149,7 @@ public class AndFileFilterTestCase exten
     // test 3 - Test conditional and with second filter returning false
     {
       // test 3 filters
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(trueFilters[1]);
       filters.add(falseFilters[1]);
       filters.add(trueFilters[2]);
@@ -171,7 +171,7 @@ public class AndFileFilterTestCase exten
     // test 4 - Test conditional and with third filter returning false
     {
       // test 4 filters
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(trueFilters[1]);
       filters.add(trueFilters[2]);
       filters.add(falseFilters[1]);
@@ -193,7 +193,7 @@ public class AndFileFilterTestCase exten
     // test 5 - Test conditional and with first and third filters returning false
     {
       // test 5 filters
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(falseFilters[1]);
       filters.add(trueFilters[1]);
       filters.add(falseFilters[2]);
@@ -214,7 +214,7 @@ public class AndFileFilterTestCase exten
 
     // test 6 - Test conditional and with second and third filters returning false
     {
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(trueFilters[1]);
       filters.add(falseFilters[1]);
       filters.add(falseFilters[2]);
@@ -235,7 +235,7 @@ public class AndFileFilterTestCase exten
 
     // test 7 - Test conditional and with first and second filters returning false
     {
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(falseFilters[1]);
       filters.add(falseFilters[2]);
       filters.add(trueFilters[3]);
@@ -256,7 +256,7 @@ public class AndFileFilterTestCase exten
 
     // test 8 - Test conditional and with fourth filters returning false
     {
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(trueFilters[1]);
       filters.add(trueFilters[2]);
       filters.add(trueFilters[3]);
@@ -275,7 +275,7 @@ public class AndFileFilterTestCase exten
 
     // test 9 - Test conditional and with all filters returning false
     {
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(falseFilters[1]);
       filters.add(falseFilters[2]);
       filters.add(falseFilters[3]);

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/ConditionalFileFilterAbstractTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/ConditionalFileFilterAbstractTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/ConditionalFileFilterAbstractTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/ConditionalFileFilterAbstractTestCase.java Thu Jun  2 15:36:15 2016
@@ -53,7 +53,7 @@ public abstract class ConditionalFileFil
 
     @Test
     public void testAdd() {
-        final List<TesterTrueFileFilter> filters = new ArrayList<TesterTrueFileFilter>();
+        final List<TesterTrueFileFilter> filters = new ArrayList<>();
         final ConditionalFileFilter fileFilter = this.getConditionalFileFilter();
         filters.add(new TesterTrueFileFilter());
         filters.add(new TesterTrueFileFilter());
@@ -72,7 +72,7 @@ public abstract class ConditionalFileFil
 
     @Test
     public void testRemove() {
-        final List<TesterTrueFileFilter> filters = new ArrayList<TesterTrueFileFilter>();
+        final List<TesterTrueFileFilter> filters = new ArrayList<>();
         final ConditionalFileFilter fileFilter = this.getConditionalFileFilter();
         filters.add(new TesterTrueFileFilter());
         filters.add(new TesterTrueFileFilter());

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/FileFilterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/FileFilterTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/FileFilterTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/FileFilterTestCase.java Thu Jun  2 15:36:15 2016
@@ -351,7 +351,7 @@ public class FileFilterTestCase extends
         assertFiltering(filter, new File("BAR"), false);
 
         // repeat for a List
-        final java.util.ArrayList<String> list = new java.util.ArrayList<String>();
+        final java.util.ArrayList<String> list = new java.util.ArrayList<>();
         list.add("foo");
         list.add("bar");
         filter = new NameFileFilter(list);
@@ -440,7 +440,7 @@ public class FileFilterTestCase extends
         assertFiltering(new AndFileFilter(falseFilter, trueFilter), new File("foo.test"), false);
         assertFiltering(new AndFileFilter(falseFilter, falseFilter), new File("foo.test"), false);
 
-        final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+        final List<IOFileFilter> filters = new ArrayList<>();
         assertFiltering( new AndFileFilter( filters ), new File( "test" ), false );
         assertFiltering( new AndFileFilter(), new File( "test" ), false );
 
@@ -473,7 +473,7 @@ public class FileFilterTestCase extends
         assertFiltering(new OrFileFilter(falseFilter, falseFilter), testFile, false);
         assertFiltering(new OrFileFilter(), testFile, false);
 
-        final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+        final List<IOFileFilter> filters = new ArrayList<>();
         filters.add( trueFilter );
         filters.add( falseFilter );
 
@@ -1485,7 +1485,7 @@ public class FileFilterTestCase extends
     public void testFilterSet() throws Exception {
         final File fileA = TestUtils.newFile(getTestDirectory(), "A");
         final File fileB = TestUtils.newFile(getTestDirectory(), "B");
-        final Set<File> fileList = new HashSet<File>(Arrays.asList(fileA, fileB));
+        final Set<File> fileList = new HashSet<>(Arrays.asList(fileA, fileB));
 
         final IOFileFilter filter = FileFilterUtils.nameFileFilter("A");
 
@@ -1528,7 +1528,7 @@ public class FileFilterTestCase extends
 
         final IOFileFilter filter = FileFilterUtils.trueFileFilter();
         try {
-            FileFilterUtils.filterSet(filter, new HashSet<File>(Arrays.asList((File) null)));
+            FileFilterUtils.filterSet(filter, new HashSet<>(Arrays.asList((File) null)));
             fail();
         } catch (final IllegalArgumentException iae) {
             // Test passes, exception thrown for set containing null

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/OrFileFilterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/OrFileFilterTestCase.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/OrFileFilterTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/OrFileFilterTestCase.java Thu Jun  2 15:36:15 2016
@@ -90,11 +90,11 @@ public class OrFileFilterTestCase extend
   public void setUpTestFilters() {
     // filters
     //tests
-    this.testFilters = new ArrayList<List<IOFileFilter>>();
-    this.testTrueResults = new ArrayList<boolean[]>();
-    this.testFalseResults = new ArrayList<boolean[]>();
-    this.testFileResults = new ArrayList<Boolean>();
-    this.testFilenameResults = new ArrayList<Boolean>();
+    this.testFilters = new ArrayList<>();
+    this.testTrueResults = new ArrayList<>();
+    this.testFalseResults = new ArrayList<>();
+    this.testFileResults = new ArrayList<>();
+    this.testFilenameResults = new ArrayList<>();
 
     // test 0 - add empty elements
     {
@@ -108,7 +108,7 @@ public class OrFileFilterTestCase extend
     // test 1 - Test conditional or with all filters returning true
     {
       // test 1 filters
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(trueFilters[1]);
       filters.add(trueFilters[2]);
       filters.add(trueFilters[3]);
@@ -127,7 +127,7 @@ public class OrFileFilterTestCase extend
     // test 2 - Test conditional or with first filter returning false
     {
       // test 2 filters
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(falseFilters[1]);
       filters.add(trueFilters[1]);
       filters.add(trueFilters[2]);
@@ -149,7 +149,7 @@ public class OrFileFilterTestCase extend
     // test 3 - Test conditional or with second filter returning false
     {
       // test 3 filters
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(trueFilters[1]);
       filters.add(falseFilters[1]);
       filters.add(trueFilters[2]);
@@ -171,7 +171,7 @@ public class OrFileFilterTestCase extend
     // test 4 - Test conditional or with third filter returning false
     {
       // test 4 filters
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(trueFilters[1]);
       filters.add(trueFilters[2]);
       filters.add(falseFilters[1]);
@@ -193,7 +193,7 @@ public class OrFileFilterTestCase extend
     // test 5 - Test conditional or with first and third filters returning false
     {
       // test 5 filters
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(falseFilters[1]);
       filters.add(trueFilters[1]);
       filters.add(falseFilters[2]);
@@ -214,7 +214,7 @@ public class OrFileFilterTestCase extend
 
     // test 6 - Test conditional or with second and third filters returning false
     {
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(trueFilters[1]);
       filters.add(falseFilters[1]);
       filters.add(falseFilters[2]);
@@ -235,7 +235,7 @@ public class OrFileFilterTestCase extend
 
     // test 7 - Test conditional or with first and second filters returning false
     {
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(falseFilters[1]);
       filters.add(falseFilters[2]);
       filters.add(trueFilters[1]);
@@ -256,7 +256,7 @@ public class OrFileFilterTestCase extend
 
     // test 8 - Test conditional or with fourth filter returning false
     {
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(trueFilters[1]);
       filters.add(trueFilters[2]);
       filters.add(trueFilters[3]);
@@ -275,7 +275,7 @@ public class OrFileFilterTestCase extend
 
     // test 9 - Test conditional or with all filters returning false
     {
-      final List<IOFileFilter> filters = new ArrayList<IOFileFilter>();
+      final List<IOFileFilter> filters = new ArrayList<>();
       filters.add(falseFilters[1]);
       filters.add(falseFilters[2]);
       filters.add(falseFilters[3]);

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/CharSequenceInputStreamTest.java Thu Jun  2 15:36:15 2016
@@ -55,8 +55,7 @@ public class CharSequenceInputStreamTest
 
     private void testBufferedRead(final String testString, final String charsetName) throws IOException {
         final byte[] expected = testString.getBytes(charsetName);
-        final InputStream in = new CharSequenceInputStream(testString, charsetName, 512);
-        try {
+        try (InputStream in = new CharSequenceInputStream(testString, charsetName, 512)) {
             final byte[] buffer = new byte[128];
             int offset = 0;
             while (true) {
@@ -69,7 +68,8 @@ public class CharSequenceInputStreamTest
                 } else {
                     assertTrue("Read " + read + " <= " + bufferLength, read <= bufferLength);
                     while (read > 0) {
-                        assertTrue("offset for " + charsetName +" " + offset + " < " + expected.length, offset < expected.length);
+                        assertTrue("offset for " + charsetName + " " + offset + " < " + expected.length, offset <
+                                expected.length);
                         assertEquals("bytes should agree for " + charsetName, expected[offset], buffer[bufferOffset]);
                         offset++;
                         bufferOffset++;
@@ -77,8 +77,6 @@ public class CharSequenceInputStreamTest
                     }
                 }
             }
-        } finally {
-            in.close();
         }
     }
 
@@ -115,12 +113,9 @@ public class CharSequenceInputStreamTest
         // Input is UTF-8 bytes: 0xE0 0xB2 0xA0
         final char[] inputChars = new char[] { (char) 0xE0, (char) 0xB2, (char) 0xA0 };
         final Charset charset = Charset.forName(csName); // infinite loop for US-ASCII, UTF-8 OK
-        final InputStream stream = new CharSequenceInputStream(new String(inputChars), charset, 512);
-        try {
+        try (InputStream stream = new CharSequenceInputStream(new String(inputChars), charset, 512)) {
             while (stream.read() != -1) {
             }
-        } finally {
-            stream.close();
         }
     }
 
@@ -239,8 +234,7 @@ public class CharSequenceInputStreamTest
 
     // This test is broken for charsets that don't create a single byte for each char
     private void testMarkReset(final String csName) throws Exception {
-        final InputStream r = new CharSequenceInputStream("test", csName);
-        try {
+        try (InputStream r = new CharSequenceInputStream("test", csName)) {
             assertEquals(2, r.skip(2));
             r.mark(0);
             assertEquals(csName, 's', r.read());
@@ -252,8 +246,6 @@ public class CharSequenceInputStreamTest
             assertEquals(csName, -1, r.read());
             r.reset();
             r.reset();
-        } finally {
-            r.close();
         }
     }
 
@@ -277,32 +269,23 @@ public class CharSequenceInputStreamTest
 
     @Test
     public void testMarkSupported() throws Exception {
-        final InputStream r = new CharSequenceInputStream("test", "UTF-8");
-        try {
+        try (InputStream r = new CharSequenceInputStream("test", "UTF-8")) {
             assertTrue(r.markSupported());
-        } finally {
-            r.close();
         }
     }
 
     private void testReadZero(final String csName) throws Exception {
-        final InputStream r = new CharSequenceInputStream("test", csName);
-        try {
+        try (InputStream r = new CharSequenceInputStream("test", csName)) {
             final byte[] bytes = new byte[30];
             assertEquals(0, r.read(bytes, 0, 0));
-        } finally {
-            r.close();
         }
     }
 
     @Test
     public void testReadZero_EmptyString() throws Exception {
-        final InputStream r = new CharSequenceInputStream("", "UTF-8");
-        try {
+        try (InputStream r = new CharSequenceInputStream("", "UTF-8")) {
             final byte[] bytes = new byte[30];
             assertEquals(0, r.read(bytes, 0, 0));
-        } finally {
-            r.close();
         }
     }
 
@@ -315,8 +298,7 @@ public class CharSequenceInputStreamTest
 
     private void testSingleByteRead(final String testString, final String charsetName) throws IOException {
         final byte[] bytes = testString.getBytes(charsetName);
-        final InputStream in = new CharSequenceInputStream(testString, charsetName, 512);
-        try {
+        try (InputStream in = new CharSequenceInputStream(testString, charsetName, 512)) {
             for (final byte b : bytes) {
                 final int read = in.read();
                 assertTrue("read " + read + " >=0 ", read >= 0);
@@ -324,8 +306,6 @@ public class CharSequenceInputStreamTest
                 assertEquals("Should agree with input", b, (byte) read);
             }
             assertEquals(-1, in.read());
-        } finally {
-            in.close();
         }
     }
 
@@ -348,15 +328,12 @@ public class CharSequenceInputStreamTest
 
     // This is broken for charsets that don't map each char to a byte
     private void testSkip(final String csName) throws Exception {
-        final InputStream r = new CharSequenceInputStream("test", csName);
-        try {
+        try (InputStream r = new CharSequenceInputStream("test", csName)) {
             assertEquals(1, r.skip(1));
             assertEquals(2, r.skip(2));
             assertEquals(csName, 't', r.read());
             r.skip(100);
             assertEquals(csName, -1, r.read());
-        } finally {
-            r.close();
         }
     }
 
@@ -386,30 +363,24 @@ public class CharSequenceInputStreamTest
 
     private void testAvailableSkip(final String csName) throws Exception {
         final String input = "test";
-        final InputStream r = new CharSequenceInputStream(input, csName);
-        try {
+        try (InputStream r = new CharSequenceInputStream(input, csName)) {
             int available = checkAvail(r, input.length());
-            assertEquals(available - 1, r.skip(available-1)); // skip all but one
+            assertEquals(available - 1, r.skip(available - 1)); // skip all but one
             available = checkAvail(r, 1);
             assertEquals(1, r.skip(1));
             available = checkAvail(r, 0);
-        } finally {
-            r.close();
         }
     }
 
     private void testAvailableRead(final String csName) throws Exception {
         final String input = "test";
-        final InputStream r = new CharSequenceInputStream(input, csName);
-        try {
+        try (InputStream r = new CharSequenceInputStream(input, csName)) {
             int available = checkAvail(r, input.length());
             byte buff[] = new byte[available];
-            assertEquals(available - 1, r.skip(available-1)); // skip all but one
+            assertEquals(available - 1, r.skip(available - 1)); // skip all but one
             available = checkAvail(r, 1);
             buff = new byte[available];
             assertEquals(available, r.read(buff, 0, available));
-        } finally {
-            r.close();
         }
     }
 

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java?rev=1746593&r1=1746592&r2=1746593&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java Thu Jun  2 15:36:15 2016
@@ -140,12 +140,9 @@ public class ReaderInputStreamTest {
         final char[] inputChars = new char[] { (char) 0xE0, (char) 0xB2, (char) 0xA0 };
         // Charset charset = Charset.forName("UTF-8"); // works
         final Charset charset = Charset.forName("ASCII"); // infinite loop
-        final ReaderInputStream stream = new ReaderInputStream(new CharArrayReader(inputChars), charset);
-        try {
+        try (ReaderInputStream stream = new ReaderInputStream(new CharArrayReader(inputChars), charset)) {
             while (stream.read() != -1) {
             }
-        } finally {
-            stream.close();
         }
     }
 }




Mime
View raw message