title: Issue Using Scanner in Java
body: <p>I am writing a program that needs to read data from an input text file, and save a variables upon going through the date. I am using Htmlunit, and am running into the error:</p>
  
  <pre><code>com.gargoylesoftware.htmlunit.ScriptException: Exception invoking open
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:684)
      at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:602)
      at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:616)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:591)
      at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:985)
      at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:210)
      at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:230)
      at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:804)
      at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:738)
      at com.gargoylesoftware.htmlunit.html.HtmlElement$1.run(HtmlElement.java:869)
      at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:602)
      at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:874)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.doClickFireClickEvent(HtmlElement.java:1311)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1253)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1205)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1160)
      at Docketscraper.scrapeWebsite(Docketscraper.java:58)
      at Docketscraper.starter(Docketscraper.java:40)
  </code></pre>
  
  <p>My code to do this is:</p>
  
  <pre><code>  private static String startingMonth;
    private static String startingDay;
    private static String startingYear;
    private static String endingMonth;
    private static String endingDay;
    private static String endingYear;
  
    public static void starter() throws IOException{
      Scanner sc = new Scanner("inputfile.txt").useDelimiter("\\s*|/");
      while(sc.hasNext()) {
        startingMonth = sc.next();
        startingDay = sc.next();
        startingYear = sc.next();
        // skip "to"
        sc.next();
          endingMonth = sc.next();
        endingDay = sc.next();
        endingYear = sc.next();
        scrapeWebsite();
      }
    }
  </code></pre>
  
  <p>where scrapeWebsite runs the htmlunit method. The scrapeWebsite method is as follows which calls a method to parse through the data:</p>
  
  <pre><code>public static void scrapeWebsite() throws IOException {
  
  
      final WebClient webClient = new WebClient();
      final HtmlPage page = webClient.getPage(url);
      final HtmlForm form = page.getForms().get(0);
      final HtmlElement button = form.getElementById("SheetContentPlaceHolder_C_searchresults_lbPrint");
      final HtmlPage page2 = button.click();
      try {
        synchronized (page2) {
          page2.wait(10000);
        }
      }
      catch(InterruptedException e)
      {
        System.out.println("error");
      }
      originalHtml = page2.getWebResponse().getContentAsString();
      obtainInformation();  
      originalHtml = "";
    }
  </code></pre>
  
  <p>The input variables create the url to search based upon the code: </p>
  
  <pre><code>private static String url = "http://cpdocket.cp.cuyahogacounty.us/SheriffSearch/results.aspx?q=searchType%3dCity%26searchString%3d%26foreclosureType%3d%26dateFrom%3d" + startingMonth + "%2f" + startingDay + "%2f" + startingYear + "+12%3a00%3a00+AM%26dateTo%3d" + endingMonth + "%2f" + endingDay + "%2f" + endingYear + "+11%3a59%3a59+PM";
  </code></pre>
  
  <p>which is the url specific to the website. I believe it is a an issue with the scanner method because when I manually input numbers for the 6 variables and run "scrapeWebsite", the correct output occurs. I can not get even one input set of dates to run which are in the format:</p>
  
  <pre><code>1/1/2013 to 1/7/2013
  </code></pre>
  
  <p>I am not sure what is the problem with the "starter" method</p>