More descriptive NPE and javadocs. [1859]

This throws an NPE with a “pattern can’t be null” message.