ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss MSVSS.java
Date Fri, 04 Aug 2000 13:31:00 GMT
bodewig     00/08/04 06:30:57

  Modified:    src/main/org/apache/tools/ant Project.java
               src/main/org/apache/tools/ant/taskdefs Ant.java
               src/main/org/apache/tools/ant/taskdefs/optional/vss
                        MSVSS.java
  Log:
  Removed possible NullPointerException in <vssget>. Cleaned up JDK
  version detection in Project.
  Submitted by:	Jeff Martin <jeff.martin@synamic.co.uk>
  
  Revision  Changes    Path
  1.33      +25 -22    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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- Project.java	2000/07/21 14:24:35	1.32
  +++ Project.java	2000/08/04 13:30:53	1.33
  @@ -105,6 +105,28 @@
   
       private Vector listeners = new Vector();
   
  +    static {
  +
  +        // Determine the Java version by looking at available classes
  +        // java.lang.StrictMath was introduced in JDK 1.3
  +        // java.lang.ThreadLocal was introduced in JDK 1.2
  +        // java.lang.Void was introduced in JDK 1.1
  +        // Count up version until a NoClassDefFoundError ends the try
  +
  +        try {
  +            javaVersion = JAVA_1_0;
  +            Class.forName("java.lang.Void");
  +            javaVersion = JAVA_1_1;
  +            Class.forName("java.lang.ThreadLocal");
  +            javaVersion = JAVA_1_2;
  +            Class.forName("java.lang.StrictMath");
  +            javaVersion = JAVA_1_3;
  +        } catch (ClassNotFoundException cnfe) {
  +            // swallow as we've hit the max class version that
  +            // we have
  +        }
  +    }
  +
       public Project() {
       }
   
  @@ -115,8 +137,8 @@
        * system properties.
        */
       public void init() throws BuildException {
  -        detectJavaVersion();
  -
  +        setJavaVersionProperty();
  +        
           String defs = "/org/apache/tools/ant/taskdefs/defaults.properties";
   
           try {
  @@ -280,27 +302,8 @@
       public static String getJavaVersion() {
           return javaVersion;
       }
  -
  -    public void detectJavaVersion() {
  -
  -        // Determine the Java version by looking at available classes
  -        // java.lang.StrictMath was introduced in JDK 1.3
  -        // java.lang.ThreadLocal was introduced in JDK 1.2
  -        // java.lang.Void was introduced in JDK 1.1
  -        // Count up version until a NoClassDefFoundError ends the try
   
  -        try {
  -            javaVersion = JAVA_1_0;
  -            Class.forName("java.lang.Void");
  -            javaVersion = JAVA_1_1;
  -            Class.forName("java.lang.ThreadLocal");
  -            javaVersion = JAVA_1_2;
  -            Class.forName("java.lang.StrictMath");
  -            javaVersion = JAVA_1_3;
  -        } catch (ClassNotFoundException cnfe) {
  -            // swallow as we've hit the max class version that
  -            // we have
  -        }
  +    public void setJavaVersionProperty() {
           setProperty("ant.java.version", javaVersion);
   
           // sanity check
  
  
  
  1.14      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
  
  Index: Ant.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Ant.java	2000/07/25 13:15:32	1.13
  +++ Ant.java	2000/08/04 13:30:55	1.14
  @@ -89,7 +89,7 @@
   
       public void init() {
           p1 = new Project();
  -        p1.detectJavaVersion();
  +        p1.setJavaVersionProperty();
           p1.addTaskDefinition("property", 
                                (Class)project.getTaskDefinitions().get("property"));
       }
  
  
  
  1.4       +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
  
  Index: MSVSS.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MSVSS.java	2000/08/01 13:47:03	1.3
  +++ MSVSS.java	2000/08/04 13:30:56	1.4
  @@ -146,7 +146,7 @@
        * @return m_vssPath
        */
       public String getVsspath() {
  -        return new String(m_vssPath);
  +        return m_vssPath;
       }
   
   
  
  
  

Mime
View raw message