Fix NPE in DevMode if the war directory doesn't exist.

Patch by: jat
Review by: rdayal


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7471 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/DevMode.java b/dev/core/src/com/google/gwt/dev/DevMode.java
index 255759f..57b9c32 100644
--- a/dev/core/src/com/google/gwt/dev/DevMode.java
+++ b/dev/core/src/com/google/gwt/dev/DevMode.java
@@ -383,6 +383,14 @@
 
   @Override
   protected int doStartUpServer() {
+    // Create the war directory if it doesn't exist
+    File warDir = options.getWarDir();
+    if (!warDir.exists() && !warDir.mkdirs()) {
+      getTopLogger().log(TreeLogger.ERROR, "Unable to create war directory "
+          + warDir);
+      return -1;
+    }
+
     boolean clearCallback = true;
     try {
       ui.setCallback(RestartServerEvent.getType(), this);
@@ -438,6 +446,10 @@
   protected void inferStartupUrls() {
     // Look for launchable files directly under war
     File warDir = options.getWarDir();
+    if (!warDir.exists()) {
+      // if the war directory doesn't exist, there are no startup files there
+      return;
+    }
     for (File htmlFile : warDir.listFiles(new FilenameFilter() {
       public boolean accept(File dir, String name) {
         return STARTUP_FILE_PATTERN.matcher(name).matches();
diff --git a/dev/core/src/com/google/gwt/dev/DevModeBase.java b/dev/core/src/com/google/gwt/dev/DevModeBase.java
index da8fc37..f186b77 100644
--- a/dev/core/src/com/google/gwt/dev/DevModeBase.java
+++ b/dev/core/src/com/google/gwt/dev/DevModeBase.java
@@ -1040,13 +1040,21 @@
       getTopLogger().log(TreeLogger.TRACE,
           "Started web server on port " + resultPort);
     }
-    
+
     if (options.getStartupURLs().isEmpty()) {
+      // if no URLs were supplied, try and find plausible ones
       inferStartupUrls();
     }
 
-    setStartupUrls(topLogger);
-    
+    if (options.getStartupURLs().isEmpty()) {
+      // TODO(jat): we could walk public resources to find plausible URLs
+      // after the module(s) are loaded
+      getTopLogger().log(TreeLogger.WARN, "No startup URLs supplied or found "
+          + "-- supply them on the command line");
+    }
+
+    setStartupUrls(getTopLogger());
+
     if (!doSlowStartup()) {
       return false;
     }