Fix unexpected end of input for jquery, and null pointer exception in java.