Reviewers: rice+legacy, Description: This patch gives a better error message for providing an incorrect argument to -runStyle. In particular, it provides better errors for typos in the runstyle class name and for using an initial lowercase letter for a GWT-supplied runstyle.
After the patch, -runStyle manual will produce the following: [ERROR] Unable to create runStyle "manual" - did you mean "Manual"? Please review this at http://gwt-code-reviews.appspot.com/130804 Affected files: user/src/com/google/gwt/junit/JUnitShell.java Index: user/src/com/google/gwt/junit/JUnitShell.java =================================================================== --- user/src/com/google/gwt/junit/JUnitShell.java (revision 7391) +++ user/src/com/google/gwt/junit/JUnitShell.java (working copy) @@ -1014,7 +1014,18 @@ runStyle = ctor.newInstance(JUnitShell.this); return runStyle.initialize(args); } catch (ClassNotFoundException e) { - caught = e; + // special error message for CNFE since it is likely a typo + String msg = "Unable to create runStyle \"" + runStyleName + "\""; + if (runStyleName.indexOf('.') < 0 && runStyleName.length() > 0 + && Character.isLowerCase(runStyleName.charAt(0))) { + msg += " - did you mean \"" + + Character.toUpperCase(runStyleName.charAt(0)) + + runStyleName.substring(1) + "\"?"; + } else { + msg += " -- is it spelled correctly?"; + } + getTopLogger().log(TreeLogger.ERROR, msg); + return -1; } catch (SecurityException e) { caught = e; } catch (NoSuchMethodException e) { @@ -1028,8 +1039,9 @@ } catch (InvocationTargetException e) { caught = e; } - throw new RuntimeException("Unable to create runStyle " + runStyleName, - caught); + getTopLogger().log(TreeLogger.ERROR, "Unable to create runStyle \"" + + runStyleName + "\"", caught); + return -1; } private boolean mustNotExecuteTest(Set<Platform> bannedPlatforms) {
-- http://groups.google.com/group/Google-Web-Toolkit-Contributors
