diff options
author | Xavier Ducrohet <xav@android.com> | 2011-10-14 17:57:35 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2011-10-14 17:57:35 -0700 |
commit | a5613f269c976916f7125f58fa1dcb4f365e54b4 (patch) | |
tree | 4117e2282b7a2c2b0de544fa30a923e3eaeb3bbe /anttasks | |
parent | def6f0d2e24d6dd96d6265fcf05fd9a1e10c789c (diff) | |
download | sdk-a5613f269c976916f7125f58fa1dcb4f365e54b4.zip sdk-a5613f269c976916f7125f58fa1dcb4f365e54b4.tar.gz sdk-a5613f269c976916f7125f58fa1dcb4f365e54b4.tar.bz2 |
Fix NPE when building project with no code.
The lack of dex file made the Ant package task throw an NPE.
Also some minor typo fix.
Change-Id: Ic617ee66017c402f211f5400baf5a00eb7e6cff5
Diffstat (limited to 'anttasks')
-rw-r--r-- | anttasks/src/com/android/ant/ApkBuilderTask.java | 4 | ||||
-rw-r--r-- | anttasks/src/com/android/ant/BuildTypedTask.java | 2 | ||||
-rw-r--r-- | anttasks/src/com/android/ant/InputPath.java | 3 |
3 files changed, 7 insertions, 2 deletions
diff --git a/anttasks/src/com/android/ant/ApkBuilderTask.java b/anttasks/src/com/android/ant/ApkBuilderTask.java index 1cf1c0d..5b3654f 100644 --- a/anttasks/src/com/android/ant/ApkBuilderTask.java +++ b/anttasks/src/com/android/ant/ApkBuilderTask.java @@ -233,7 +233,9 @@ public class ApkBuilderTask extends SingleDependencyTask { inputPaths.add(resourceInputPath); // dex file - inputPaths.add(new InputPath(dexFile)); + if (dexFile != null) { + inputPaths.add(new InputPath(dexFile)); + } // zip input files List<File> zipFiles = new ArrayList<File>(); diff --git a/anttasks/src/com/android/ant/BuildTypedTask.java b/anttasks/src/com/android/ant/BuildTypedTask.java index c697bac..3f4b64a 100644 --- a/anttasks/src/com/android/ant/BuildTypedTask.java +++ b/anttasks/src/com/android/ant/BuildTypedTask.java @@ -41,7 +41,7 @@ public abstract class BuildTypedTask extends Task { } /** - * Returns if it is a new build. If the built type is not input + * Returns if it is a new build. If the build type is not input * from the XML, this always returns true. * A build type is defined by having an empty previousBuildType. */ diff --git a/anttasks/src/com/android/ant/InputPath.java b/anttasks/src/com/android/ant/InputPath.java index b1a98b5..905e7bc 100644 --- a/anttasks/src/com/android/ant/InputPath.java +++ b/anttasks/src/com/android/ant/InputPath.java @@ -34,6 +34,9 @@ public class InputPath { } public InputPath(File file, Set<String> extensionsToCheck) { + if (file == null) { + throw new RuntimeException("File in InputPath(File) can't be null"); + } mFile = file; mTouchedExtensions = extensionsToCheck; } |