[FIXED JENKINS-15380]. Add some length checking before trying to substring names in ClassResult.

My first pull request. Any feedback is welcome!