Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56253
When listing resources that are provided by a JAR, fix possible StringIndexOutOfBoundsExceptions. Add some unit tests for this and similar scenarios and fix the additional issues those unit tests identified. Based on a patch by Larry Isaacs. 

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1577103 13f79535-47bb-0310-9956-ffa450edef68