Merge "Fix parsing SDK Tools in ant tasks."
diff --git a/anttasks/src/com/android/ant/CheckEnvTask.java b/anttasks/src/com/android/ant/CheckEnvTask.java
index d6b6cc4..e8e1a89 100644
--- a/anttasks/src/com/android/ant/CheckEnvTask.java
+++ b/anttasks/src/com/android/ant/CheckEnvTask.java
@@ -42,7 +42,7 @@
         Project antProject = getProject();
 
         // check the Ant version
-        DeweyDecimal version = getVersion(antProject);
+        DeweyDecimal version = getAntVersion(antProject);
         DeweyDecimal atLeast = new DeweyDecimal(ANT_MIN_VERSION);
         if (atLeast.isGreaterThan(version)) {
             throw new BuildException(
@@ -67,8 +67,8 @@
         }
 
         // display SDK Tools revision
-        int toolsRevison = TaskHelper.getToolsRevision(sdkDir);
-        if (toolsRevison != -1) {
+        DeweyDecimal toolsRevison = TaskHelper.getToolsRevision(sdkDir);
+        if (toolsRevison != null) {
             System.out.println("Android SDK Tools Revision " + toolsRevison);
             System.out.println("Installed at " + sdkDir.getAbsolutePath());
         }
@@ -83,7 +83,7 @@
      * @param antProject the current ant project.
      * @return the ant version.
      */
-    private DeweyDecimal getVersion(Project antProject) {
+    private DeweyDecimal getAntVersion(Project antProject) {
         char[] versionString = antProject.getProperty("ant.version").toCharArray();
         StringBuilder sb = new StringBuilder();
         boolean foundFirstDigit = false;
diff --git a/anttasks/src/com/android/ant/TaskHelper.java b/anttasks/src/com/android/ant/TaskHelper.java
index 3a372a1..35de033 100644
--- a/anttasks/src/com/android/ant/TaskHelper.java
+++ b/anttasks/src/com/android/ant/TaskHelper.java
@@ -17,6 +17,7 @@
 package com.android.ant;
 
 import com.android.annotations.NonNull;
+import com.android.annotations.Nullable;
 import com.android.sdklib.SdkConstants;
 import com.android.sdklib.internal.project.ProjectProperties;
 import com.android.sdklib.internal.project.ProjectProperties.PropertyType;
@@ -25,6 +26,7 @@
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.util.DeweyDecimal;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -68,7 +70,8 @@
      * @param sdkFile the {@link File} for the root folder of the SDK
      * @return the tools revision or -1 if not found.
      */
-    static int getToolsRevision(File sdkFile) {
+    @Nullable
+    static DeweyDecimal getToolsRevision(File sdkFile) {
         Properties p = new Properties();
         try{
             // tools folder must exist, or this custom task wouldn't run!
@@ -90,7 +93,7 @@
 
             String value = p.getProperty("Pkg.Revision"); //$NON-NLS-1$
             if (value != null) {
-                return Integer.parseInt(value);
+                return new DeweyDecimal(value);
             }
         } catch (FileNotFoundException e) {
             // couldn't find the file? return -1 below.
@@ -98,7 +101,7 @@
             // couldn't find the file? return -1 below.
         }
 
-        return -1;
+        return null;
     }
 
     static String checkSinglePath(String attribute, Path path) {