At the very least it should be a IllegalArgument instead of NPE.  However it may just make more sense to use assert data != null