Patch to print a success/failure message when the api checker completes, and to
print a more useful message if the reference directory is missing.
Review by: zundel
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@3157 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java b/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java
index 631f64a..bae6c0d 100644
--- a/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java
+++ b/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java
@@ -143,13 +143,18 @@
for (ApiChange apiChange : apiDifferences) {
System.out.println(apiChange);
}
- System.out.println("\t\t\t\tApi Compatibility Checker tool, Copyright Google Inc. 2008");
+ if (apiDifferences.size() == 0) {
+ System.out.println("API compatibility check SUCCESSFUL");
+ } else {
+ System.out.println("API compatibility check FAILED");
+ }
System.exit(apiDifferences.size() == 0 ? 0 : 1);
}
} catch (Exception e) {
// intercepting all exceptions in main, because I have to exit with -1 so
// that the build breaks.
e.printStackTrace();
+ System.err.println("To view the help for this tool, execute this tool without any arguments");
System.exit(-1);
}
}
diff --git a/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiContainer.java b/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiContainer.java
index 47c8112..36776fc 100644
--- a/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiContainer.java
+++ b/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiContainer.java
@@ -80,11 +80,12 @@
public ApiContainer(String fileName, String suffix, TreeLogger logger)
throws IllegalArgumentException, UnableToCompleteException {
this.logger = logger;
+ FileInputStream fis = null;
if (fileName == null) {
throw new IllegalArgumentException("fileName is null");
}
try {
- FileInputStream fis = new FileInputStream(fileName);
+ fis = new FileInputStream(fileName);
Properties config = new Properties();
config.load(fis);
String apiName = config.getProperty("name" + suffix);
@@ -132,6 +133,11 @@
} catch (MalformedURLException e1) {
throw new IllegalArgumentException(e1);
} catch (FileNotFoundException e2) {
+ if (fis == null) {
+ System.err.println("Have you specified the path of the config file correctly?");
+ } else {
+ System.err.println("Do you have a reference version of the API checked out?");
+ }
throw new IllegalArgumentException(e2);
} catch (IOException e3) {
throw new IllegalArgumentException(e3);