ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/util FileUtils.java
Date Tue, 23 Apr 2002 08:15:52 GMT
bodewig     02/04/23 01:15:52

  Modified:    src/main/org/apache/tools/ant Main.java Project.java
               src/main/org/apache/tools/ant/taskdefs GenerateKey.java
                        Get.java SignJar.java Touch.java
               src/main/org/apache/tools/ant/taskdefs/optional Javah.java
               src/main/org/apache/tools/ant/taskdefs/optional/metamata
                        AbstractMetamataTask.java MParse.java
               src/main/org/apache/tools/ant/taskdefs/optional/net
                        SetProxy.java
               src/main/org/apache/tools/ant/taskdefs/rmic
                        DefaultRmicAdapter.java
               src/main/org/apache/tools/ant/types Path.java
               src/main/org/apache/tools/ant/util FileUtils.java
  Log:
  spread the usage of JavaEnvUtils
  
  Revision  Changes    Path
  1.65      +3 -2      jakarta-ant/src/main/org/apache/tools/ant/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Main.java,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- Main.java	22 Apr 2002 13:22:57 -0000	1.64
  +++ Main.java	23 Apr 2002 08:15:51 -0000	1.65
  @@ -56,6 +56,7 @@
   
   import org.apache.tools.ant.input.DefaultInputHandler;
   import org.apache.tools.ant.input.InputHandler;
  +import org.apache.tools.ant.util.JavaEnvUtils;
   
   import java.io.File;
   import java.io.FileInputStream;
  @@ -558,8 +559,8 @@
               // use a system manager that prevents from System.exit()
               // only in JDK > 1.1
               SecurityManager oldsm = null;
  -            if (!Project.JAVA_1_0.equals(Project.getJavaVersion()) &&
  -                !Project.JAVA_1_1.equals(Project.getJavaVersion())){
  +            if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_0) &&
  +                !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)){
                   oldsm = System.getSecurityManager();
   
                   //SecurityManager can not be installed here for backwards
  
  
  
  1.107     +28 -8     jakarta-ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- Project.java	23 Apr 2002 07:27:20 -0000	1.106
  +++ Project.java	23 Apr 2002 08:15:51 -0000	1.107
  @@ -64,7 +64,6 @@
   import java.util.Stack;
   import java.lang.reflect.Modifier;
   
  -
   import org.apache.tools.ant.types.FilterSet; 
   import org.apache.tools.ant.types.FilterSetCollection; 
   import org.apache.tools.ant.util.FileUtils; 
  @@ -84,7 +83,7 @@
    *
    * @author duncan@x180.com
    *
  - * @version $Revision: 1.106 $
  + * @version $Revision: 1.107 $
    */
   
   public class Project {
  @@ -111,15 +110,35 @@
        */
       private static final String VISITED = "VISITED";
   
  -    /** Version constant for Java 1.0 */
  +    /** 
  +     * Version constant for Java 1.0 
  +     *
  +     * @deprecated use org.apache.tools.ant.util.JavaEnvUtils instead
  +     */
       public static final String JAVA_1_0 = JavaEnvUtils.JAVA_1_0;
  -    /** Version constant for Java 1.1 */
  +    /** 
  +     * Version constant for Java 1.1 
  +     *
  +     * @deprecated use org.apache.tools.ant.util.JavaEnvUtils instead
  +     */
       public static final String JAVA_1_1 = JavaEnvUtils.JAVA_1_1;
  -    /** Version constant for Java 1.2 */
  +    /**
  +     * Version constant for Java 1.2 
  +     *
  +     * @deprecated use org.apache.tools.ant.util.JavaEnvUtils instead
  +     */
       public static final String JAVA_1_2 = JavaEnvUtils.JAVA_1_2;
  -    /** Version constant for Java 1.3 */
  +    /** 
  +     * Version constant for Java 1.3 
  +     *
  +     * @deprecated use org.apache.tools.ant.util.JavaEnvUtils instead
  +     */
       public static final String JAVA_1_3 = JavaEnvUtils.JAVA_1_3;
  -    /** Version constant for Java 1.4 */
  +    /** 
  +     * Version constant for Java 1.4 
  +     *
  +     * @deprecated use org.apache.tools.ant.util.JavaEnvUtils instead
  +     */
       public static final String JAVA_1_4 = JavaEnvUtils.JAVA_1_4;
   
       /** Default filter start token. */
  @@ -724,6 +743,7 @@
        * Returns the version of Java this class is running under.
        * @return the version of Java as a String, e.g. "1.1"
        * @see org.apache.tools.ant.util.JavaEnvUtils#getJavaVersion
  +     * @deprecated use org.apache.tools.ant.util.JavaEnvUtils instead
        */
       public static String getJavaVersion() {
           return JavaEnvUtils.getJavaVersion();
  @@ -744,7 +764,7 @@
           setPropertyInternal("ant.java.version", javaVersion);
   
           // sanity check
  -        if (javaVersion == JavaEnvUtils.JAVA_1_0) {
  +        if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_0)) {
               throw new BuildException("Ant cannot work on Java 1.0");
           }
   
  
  
  
  1.16      +2 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java
  
  Index: GenerateKey.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- GenerateKey.java	15 Apr 2002 13:36:17 -0000	1.15
  +++ GenerateKey.java	23 Apr 2002 08:15:51 -0000	1.16
  @@ -58,6 +58,7 @@
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
  +import org.apache.tools.ant.util.JavaEnvUtils;
   import org.apache.tools.ant.types.Commandline;
   
   /**
  @@ -243,7 +244,7 @@
       } 
   
       public void execute() throws BuildException {
  -        if (Project.getJavaVersion().equals(Project.JAVA_1_1)) {
  +        if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
               throw new BuildException("The genkey task is only available on JDK"
                                        + " versions 1.2 or greater");
           }
  
  
  
  1.21      +2 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Get.java
  
  Index: Get.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Get.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Get.java	15 Apr 2002 13:36:17 -0000	1.20
  +++ Get.java	23 Apr 2002 08:15:51 -0000	1.21
  @@ -66,6 +66,7 @@
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.util.FileUtils;
  +import org.apache.tools.ant.util.JavaEnvUtils;
   
   /**
    * Get a particular file from a URL source.
  @@ -303,7 +304,7 @@
        * @param v "true" to enable file time fetching
        */
       public void setUseTimestamp(boolean v) {
  -        if (Project.getJavaVersion() != Project.JAVA_1_1) {
  +        if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
               useTimestamp = v;
           }
       }
  
  
  
  1.21      +2 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SignJar.java
  
  Index: SignJar.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SignJar.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- SignJar.java	15 Apr 2002 15:33:09 -0000	1.20
  +++ SignJar.java	23 Apr 2002 08:15:51 -0000	1.21
  @@ -65,6 +65,7 @@
   import org.apache.tools.ant.Project;
   
   import org.apache.tools.ant.types.FileSet;
  +import org.apache.tools.ant.util.JavaEnvUtils;
   
   /**
    * Sign a archive.
  @@ -194,7 +195,7 @@
   
       private void doOneJar(File jarSource, File jarTarget) 
           throws BuildException {
  -        if (Project.getJavaVersion().equals(Project.JAVA_1_1)) {
  +        if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
               throw new BuildException("The signjar task is only available on "
                                        + "JDK versions 1.2 or greater");
           }
  
  
  
  1.23      +4 -6      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Touch.java
  
  Index: Touch.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Touch.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Touch.java	14 Apr 2002 11:16:13 -0000	1.22
  +++ Touch.java	23 Apr 2002 08:15:51 -0000	1.23
  @@ -60,15 +60,12 @@
   import org.apache.tools.ant.DirectoryScanner;
   import org.apache.tools.ant.types.FileSet;
   import org.apache.tools.ant.util.FileUtils;
  +import org.apache.tools.ant.util.JavaEnvUtils;
   
   import java.io.File;
   import java.io.IOException;
  -
  -
   import java.text.DateFormat;
   import java.text.ParseException;
  -
  -
   import java.util.Locale;
   import java.util.Vector;
   
  @@ -189,7 +186,8 @@
               }
           }
   
  -        if (millis >= 0 && Project.getJavaVersion() == Project.JAVA_1_1) {
  +        if (millis >= 0 && 
  +            !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
               log("modification time of files cannot be set in JDK 1.1",
                   Project.MSG_WARN);
               return;
  @@ -234,7 +232,7 @@
                                        + "read-only file " + file);
           }
   
  -        if (Project.getJavaVersion() == Project.JAVA_1_1) {
  +        if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
               return;
           }
   
  
  
  
  1.14      +4 -4      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
  
  Index: Javah.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Javah.java	18 Apr 2002 15:03:50 -0000	1.13
  +++ Javah.java	23 Apr 2002 08:15:51 -0000	1.14
  @@ -63,7 +63,7 @@
   import org.apache.tools.ant.types.Reference;
   import org.apache.tools.ant.types.Commandline;
   
  -
  +import org.apache.tools.ant.util.JavaEnvUtils;
   
   import java.io.File;
   import java.util.Vector;
  @@ -280,8 +280,8 @@
   
           String compiler = project.getProperty("build.compiler");
           if (compiler == null) {
  -            if (Project.getJavaVersion() != Project.JAVA_1_1 &&
  -                Project.getJavaVersion() != Project.JAVA_1_2) {
  +            if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1) &&
  +                !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)) {
                   compiler = "modern";
               } else {
                   compiler = "classic";
  @@ -353,7 +353,7 @@
           }
   
           // JDK1.1 is rather simpler than JDK1.2
  -        if (Project.getJavaVersion().startsWith("1.1")) {
  +        if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
               if (verbose) {
                   cmd.createArgument().setValue("-v");
               }
  
  
  
  1.6       +1 -5      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
  
  Index: AbstractMetamataTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractMetamataTask.java	8 Feb 2002 22:06:56 -0000	1.5
  +++ AbstractMetamataTask.java	23 Apr 2002 08:15:51 -0000	1.6
  @@ -155,11 +155,7 @@
   
       /**  -mx or -Xmx depending on VM version */
       public void setMaxmemory(String max) {
  -        if (Project.getJavaVersion().startsWith("1.1")) {
  -            createJvmarg().setValue("-mx" + max);
  -        } else {
  -            createJvmarg().setValue("-Xmx" + max);
  -        }
  +        cmdl.setMaxmemory(max);
       }
   
   
  
  
  
  1.10      +1 -5      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
  
  Index: MParse.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MParse.java	15 Apr 2002 12:11:49 -0000	1.9
  +++ MParse.java	23 Apr 2002 08:15:51 -0000	1.10
  @@ -146,11 +146,7 @@
   
       /**  -mx or -Xmx depending on VM version */
       public void setMaxmemory(String max){
  -        if (Project.getJavaVersion().startsWith("1.1")) {
  -            createJvmarg().setValue("-mx" + max);
  -        } else {
  -            createJvmarg().setValue("-Xmx" + max);
  -        }
  +        cmdl.setMaxmemory(max);
       }
   
       public MParse() {
  
  
  
  1.4       +3 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java
  
  Index: SetProxy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SetProxy.java	17 Apr 2002 05:50:10 -0000	1.3
  +++ SetProxy.java	23 Apr 2002 08:15:51 -0000	1.4
  @@ -59,6 +59,7 @@
   import java.util.*;
   import java.lang.reflect.*;
   import org.apache.tools.ant.*;
  +import org.apache.tools.ant.util.JavaEnvUtils;
   
   /**
    * proxy definition task. This allows all tasks in the build file
  @@ -198,7 +199,8 @@
           
   
           //for Java1.1 we need to tell the system that the settings are new
  -        if (settingsChanged && project.getJavaVersion() == Project.JAVA_1_1) {
  +        if (settingsChanged &&
  +            JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
               legacyResetProxySettingsCall(enablingProxy);
           }
       }
  
  
  
  1.19      +2 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
  
  Index: DefaultRmicAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- DefaultRmicAdapter.java	15 Apr 2002 14:56:34 -0000	1.18
  +++ DefaultRmicAdapter.java	23 Apr 2002 08:15:51 -0000	1.19
  @@ -60,6 +60,7 @@
   import org.apache.tools.ant.types.Path;
   
   import org.apache.tools.ant.util.FileNameMapper;
  +import org.apache.tools.ant.util.JavaEnvUtils;
   
   import java.io.File;
   import java.util.Random;
  @@ -193,7 +194,7 @@
           cmd.createArgument().setFile(attributes.getBase());
   
           if (attributes.getExtdirs() != null) {
  -            if (Project.getJavaVersion().startsWith("1.1")) {
  +            if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
                   /*
                    * XXX - This doesn't mix very well with build.systemclasspath,
                    */
  
  
  
  1.37      +2 -1      jakarta-ant/src/main/org/apache/tools/ant/types/Path.java
  
  Index: Path.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/Path.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- Path.java	16 Apr 2002 07:15:18 -0000	1.36
  +++ Path.java	23 Apr 2002 08:15:52 -0000	1.37
  @@ -58,6 +58,7 @@
   import org.apache.tools.ant.DirectoryScanner;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.PathTokenizer;
  +import org.apache.tools.ant.util.JavaEnvUtils;
   
   import java.io.File;
   
  @@ -584,7 +585,7 @@
               
               kaffeJarFiles.setIncludes("*.jar");
               addFileset(kaffeJarFiles);
  -        } else if (Project.getJavaVersion() == Project.JAVA_1_1) {
  +        } else if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
               addExisting(new Path(null,
                                    System.getProperty("java.home")
                                    + File.separator + "lib"
  
  
  
  1.25      +3 -3      jakarta-ant/src/main/org/apache/tools/ant/util/FileUtils.java
  
  Index: FileUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/util/FileUtils.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- FileUtils.java	17 Apr 2002 05:50:10 -0000	1.24
  +++ FileUtils.java	23 Apr 2002 08:15:52 -0000	1.25
  @@ -95,7 +95,7 @@
    * @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a>
    * @author <a href="mailto:jtulley@novell.com">Jeff Tulley</a> 
    *
  - * @version $Revision: 1.24 $
  + * @version $Revision: 1.25 $
    */
   
   public class FileUtils {
  @@ -420,7 +420,7 @@
        * see whether we have a setLastModified method in File and return it.
        */
       protected final Method getSetLastModified() {
  -        if (Project.getJavaVersion() == Project.JAVA_1_1) {
  +        if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
               return null;
           }
           if (setLastModified == null) {
  @@ -444,7 +444,7 @@
        * Calls File.setLastModified(long time) in a Java 1.1 compatible way.
        */
       public void setFileLastModified(File file, long time) throws BuildException {
  -        if (Project.getJavaVersion() == Project.JAVA_1_1) {
  +        if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
               return;
           }
           Long[] times = new Long[1];
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message