Fixed ArrayIndexOutOfBoundsException issue at Parsing.java:109 and added corresponding unit test method

Hi Dhanji,

Thanks for your quick response.

I did the following:

1) I got a null issue in a test method:

java.lang.NullPointerException
	at com.google.sitebricks.compiler.CompiledToken.render(CompiledToken.java:46)
	at com.google.sitebricks.rendering.control.XmlWidget.writeOpenTag(XmlWidget.java:105)
	at com.google.sitebricks.rendering.control.XmlWidget.render(XmlWidget.java:72)
	at com.google.sitebricks.rendering.control.ProceedingWidgetChain.render(ProceedingWidgetChain.java:21)
	at com.google.sitebricks.rendering.control.XmlWidget.render(XmlWidget.java:79)
	at com.google.sitebricks.rendering.control.ProceedingWidgetChain.render(ProceedingWidgetChain.java:21)
	at com.google.sitebricks.rendering.control.XmlWidget.render(XmlWidget.java:79)
	at com.google.sitebricks.rendering.control.ProceedingWidgetChain.render(ProceedingWidgetChain.java:21)
	at com.google.sitebricks.compiler.HtmlTemplateCompilerTest.readTextWidgetValues(HtmlTemplateCompilerTest.java:192)

So I temporarily disable the test method:

  //TODO: Fix NullPointerException in this test
  @Test(enabled = false)
  public final void readTextWidgetValues() {
  ... ...

2) Added a new test method in HtmlTemplateCompilerTest:

  @Test
  public final void parseNormalDollarSign() {

    Renderable widget = compiler()
        .compile(Object.class, new Template("<html><span class=\"price\">$<span>14</span><span>/month</span></span></html>"));

    assert null != widget : " null ";
    final Respond mockRespond = RespondersForTesting.newRespond();
    widget.render(new Object(), mockRespond);
    final String value = mockRespond.toString();
    assert "<html><span class=\"price\">$<span>14</span><span>/month</span></span></html>".equals(value) : "Did not write expected output, instead: " + value;
  }

This test could reproduce the ArrayIndexOutOfBoundsException error.


3) Added fixes at line 109 of com.google.sitebricks.compiler.Parsing class: 

  if ('$' == characters[i] && characters.length > 1) {
  ... ...
  
  After that the test passed.

I've submitted a pull request, please review and let me know if anything else that I can help with.

Thanks,
Jake