ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1033587 - in /ant/core/trunk/src/main/org/apache/tools/ant: Diagnostics.java util/JavaEnvUtils.java
Date Wed, 10 Nov 2010 16:53:36 GMT
Author: bodewig
Date: Wed Nov 10 16:53:35 2010
New Revision: 1033587

URL: http://svn.apache.org/viewvc?rev=1033587&view=rev
Log:
detect Apache Harmony

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java?rev=1033587&r1=1033586&r2=1033587&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java Wed Nov 10 16:53:35 2010
@@ -399,6 +399,8 @@ public final class Diagnostics {
         out.println(MagicNames.ANT_VERSION + ": " + p.getProperty(MagicNames.ANT_VERSION));
         out.println(MagicNames.ANT_JAVA_VERSION + ": "
                 + p.getProperty(MagicNames.ANT_JAVA_VERSION));
+        out.println("Is this the Apache Harmony VM? "
+                    + (JavaEnvUtils.isApacheHarmony() ? "yes" : "no"));
         out.println("Is this the Kaffe VM? "
                     + (JavaEnvUtils.isKaffe() ? "yes" : "no"));
         out.println("Is this gij/gcj? "

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java?rev=1033587&r1=1033586&r2=1033587&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java Wed Nov 10 16:53:35
2010
@@ -94,6 +94,9 @@ public final class JavaEnvUtils {
     /** Whether this is the GNU VM (gcj/gij) */
     private static boolean gijDetected;
 
+    /** Whether this is Apache Harmony */
+    private static boolean harmonyDetected;
+
     /** array of packages in the runtime */
     private static Vector jrePackages;
 
@@ -147,6 +150,13 @@ public final class JavaEnvUtils {
         } catch (Throwable t) {
             // swallow as this simply doesn't seem to be gcj/gij
         }
+        harmonyDetected = false;
+        try {
+            Class.forName("org.apache.harmony.luni.util.Base64");
+            harmonyDetected = true;
+        } catch (Throwable t) {
+            // swallow as this simply doesn't seem to be Apache Harmony
+        }
     }
 
     /**
@@ -218,6 +228,15 @@ public final class JavaEnvUtils {
     }
 
     /**
+     * Checks whether the current VM is Apache Harmony.
+     * @since Ant 1.8.2
+     * @return true if the current VM is Apache Harmony.
+     */
+    public static boolean isApacheHarmony() {
+        return harmonyDetected;
+    }
+
+    /**
      * Finds an executable that is part of a JRE installation based on
      * the java.home system property.
      *



Mime
View raw message