commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r584823 - in /commons/proper/io/trunk: build-check-jdk13.xml src/java/org/apache/commons/io/filefilter/FileFilterUtils.java src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
Date Mon, 15 Oct 2007 17:02:38 GMT
Author: niallp
Date: Mon Oct 15 10:02:38 2007
New Revision: 584823

URL: http://svn.apache.org/viewvc?rev=584823&view=rev
Log:
IO-127 - add ant build script to check JDK 1.3 compatibility and remove references to JDK
1.4 dependant class from FileFilterUtils

Added:
    commons/proper/io/trunk/build-check-jdk13.xml   (with props)
Modified:
    commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
    commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java

Added: commons/proper/io/trunk/build-check-jdk13.xml
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/build-check-jdk13.xml?rev=584823&view=auto
==============================================================================
--- commons/proper/io/trunk/build-check-jdk13.xml (added)
+++ commons/proper/io/trunk/build-check-jdk13.xml Mon Oct 15 10:02:38 2007
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+<!--
+   This script compiles using JDK 1.3 all classes except those that
+   use JDK 1.4 features.
+
+   Commons IO should be built as normal using the maven build and
+   JDK 1.4 or higher. This script should be run before a release to
+   check that the majority of Commons IO is still JDK 1.3 compatible.
+
+   Switch the default JDK to 1.3 and then run this script
+   (using "ant -f build-check-jdk13.xml") - it will fail if the JDK
+    version is not 1.3 or any of the classes use features from a later
+   JDK version.
+
+ -->
+<project default="compile" name="commons-io-jdk13" basedir=".">
+
+    <!-- The base directory for compilation targets -->
+    <property name="build.home"  value="target"/>
+    <property name="test.jdk13"  value="${build.home}/test-classes-jdk13"/>
+
+    <target name="init">
+        <delete dir="${test.jdk13}"/>
+        <mkdir  dir="${test.jdk13}"/>
+    </target>
+
+    <!-- Check JDK is 1.3 -->
+    <target name="check-jdk">
+        <echo message="*** JDK=${ant.java.version} ***" />
+        <fail message="switch to JDK 1.3">
+            <condition>
+                <not>
+                    <equals arg1="${ant.java.version}" arg2="1.3" />
+                </not>
+            </condition>
+        </fail>
+    </target>
+   
+    <!-- Compile JDK 1.3 compatible classes -->
+    <target name="compile" depends="init, check-jdk">
+
+        <javac srcdir="src/java"
+               destdir="${test.jdk13}"
+               sourcepath="">
+
+            <include name="**/*.java"/>
+            <exclude name="**/RegexFileFilter.java"/>
+
+        </javac>
+
+    </target>
+
+</project>

Propchange: commons/proper/io/trunk/build-check-jdk13.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/io/trunk/build-check-jdk13.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java?rev=584823&r1=584822&r2=584823&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
(original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
Mon Oct 15 10:02:38 2007
@@ -281,43 +281,6 @@
         return new AndFileFilter(minimumFilter, maximumFilter);
     }
 
-    /**
-     * Returns a filter that uses a regular expression to filter file names.
-     *
-     * @param pattern the regular expression pattern
-     * @return an appropriately configured IOFileFilter
-     * @since Commons IO 1.4
-     */
-    public static IOFileFilter regex(String pattern) {
-        return new RegexFileFilter(pattern);
-    }
-
-    /**
-     * Returns a filter that uses a regular expression to filter file names with
-     * the specified case sensitivity.
-     *
-     * @param pattern the regular expression pattern
-     * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
-     * @return an appropriately configured IOFileFilter
-     * @since Commons IO 1.4
-     */
-    public static IOFileFilter regex(String pattern, IOCase caseSensitivity) {
-        return new RegexFileFilter(pattern, caseSensitivity);
-    }
-
-    /**
-     * Returns a filter that uses a regular expression to filter file names with
-     * the specified flags.
-     *
-     * @param pattern the regular expression pattern
-     * @param flags pattern flags (e.g. {@link java.util.regex.Pattern#CASE_INSENSITIVE})
-     * @return an appropriately configured IOFileFilter
-     * @since Commons IO 1.4
-     */
-    public static IOFileFilter regex(String pattern, int flags) {
-        return new RegexFileFilter(pattern, flags);
-    }
-
     //-----------------------------------------------------------------------
     /* Constructed on demand and then cached */
     private static IOFileFilter cvsFilter;

Modified: commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java?rev=584823&r1=584822&r2=584823&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
(original)
+++ commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
Mon Oct 15 10:02:38 2007
@@ -823,12 +823,12 @@
     }
 
     public void testRegex() throws Exception {
-        IOFileFilter filter = FileFilterUtils.regex("^.*[tT]est(-\\d+)?\\.java$");
+        IOFileFilter filter = new RegexFileFilter("^.*[tT]est(-\\d+)?\\.java$");
         assertFiltering(filter, new File("Test.java"), true);
         assertFiltering(filter, new File("test-10.java"), true);
         assertFiltering(filter, new File("test-.java"), false);
 
-        filter = FileFilterUtils.regex("^[Tt]est.java$");
+        filter = new RegexFileFilter("^[Tt]est.java$");
         assertFiltering(filter, new File("Test.java"), true);
         assertFiltering(filter, new File("test.java"), true);
         assertFiltering(filter, new File("tEST.java"), false);
@@ -838,32 +838,32 @@
         assertFiltering(filter, new File("test.java"), true);
         assertFiltering(filter, new File("tEST.java"), true);
 
-        filter = FileFilterUtils.regex("^test.java$", Pattern.CASE_INSENSITIVE);
+        filter = new RegexFileFilter("^test.java$", Pattern.CASE_INSENSITIVE);
         assertFiltering(filter, new File("Test.java"), true);
         assertFiltering(filter, new File("test.java"), true);
         assertFiltering(filter, new File("tEST.java"), true);
 
-        filter = FileFilterUtils.regex("^test.java$", IOCase.INSENSITIVE);
+        filter = new RegexFileFilter("^test.java$", IOCase.INSENSITIVE);
         assertFiltering(filter, new File("Test.java"), true);
         assertFiltering(filter, new File("test.java"), true);
         assertFiltering(filter, new File("tEST.java"), true);
 
         try {
-            FileFilterUtils.regex((String)null);
+            new RegexFileFilter((String)null);
             fail();
         } catch (IllegalArgumentException ex) {
             // expected
         }
 
         try {
-            FileFilterUtils.regex((String)null, Pattern.CASE_INSENSITIVE);
+            new RegexFileFilter((String)null, Pattern.CASE_INSENSITIVE);
             fail();
         } catch (IllegalArgumentException ex) {
             // expected
         }
 
         try {
-            FileFilterUtils.regex((String)null, IOCase.INSENSITIVE);
+            new RegexFileFilter((String)null, IOCase.INSENSITIVE);
             fail();
         } catch (IllegalArgumentException ex) {
             // expected



Mime
View raw message