java lang nullpointerexception cannot invoke string length () because spec is null