properly validate className and return null if not possible

fix #386 

as you can see from the adjusted tests, there is indeed potential for BC breaks in this. mainly if people relied on this to load a content into an arbitrary class. but imho that has no real value.

also, we had a mess with throwing an exception when trying to get an already cached document in a different class but the same thing working if there was no cached version yet.