Program: 15816
Project: 15816
Buggy source:
/** 
 * Constructor. For example, if prefix is "/WEB-INF/cwr", then getResource("/abc") will look for "/WEB-INF/cwr/abc" first, and then "/abc". <p>Another example, if prefix is "/WEB-INF/cwr" and dir is "/subdir", then getResource("abc") will look for "/WEB-INF/cwr/subdir/abc".
 * @param dir the directory used when relative path is specified(for  {@link #getResource} and {@link #getResourceAsStream}). It must be null, empty, or starts with /.
 * @param prefix the directory to prefix each directory specified(for  {@link #getResource} and {@link #getResourceAsStream}). It must be null, empty, or starts with /.
 * @param acceptURL whether to URL (such as file:/, http:// andftp://) are accepted. In other words,  {@link Servlets#getResource}will be used.
 */
public ServletContextLocator(ServletContext ctx,String dir,String prefix,boolean acceptURL){
  if (ctx == null)   throw new IllegalArgumentException("String_Node_Str");
  if (dir != null) {
    final int len=dir.length();
    if (len == 0)     dir=null;
 else {
      if (dir.charAt(0) != '/')       throw new IllegalArgumentException("String_Node_Str" + dir);
      if (dir.charAt(len - 1) != '/')       dir+='/';
    }
  }
  if (prefix != null) {
    final int len=prefix.length();
    if (len == 0)     prefix=null;
 else {
      if (prefix.charAt(0) != '/')       throw new IllegalArgumentException("String_Node_Str" + prefix);
      if (len == 1)       prefix=null;
 else       if (prefix.charAt(len - 1) == '/')       prefix=prefix.substring(0,len - 1);
    }
  }
  _ctx=ctx;
  _dir=dir;
  _prefix=prefix;
  _acceptURL=acceptURL;
}

Fixed version (ground truth):
/** 
 * Constructor. For example, if prefix is "/WEB-INF/cwr", then getResource("/abc") will look for "/WEB-INF/cwr/abc" first, and then "/abc". <p>Another example, if prefix is "/WEB-INF/cwr" and dir is "/subdir", then getResource("abc") will look for "/WEB-INF/cwr/subdir/abc".
 * @param dir the directory used when relative path is specified(for  {@link #getResource} and {@link #getResourceAsStream}). It must be null, empty, or starts with /.
 * @param prefix the directory to prefix each directory specified(for  {@link #getResource} and {@link #getResourceAsStream}). It must be null, empty, or starts with /.
 * @param acceptURL whether to URL (such as file:/, http:// andftp://) are accepted. In other words,  {@link Servlets#getResource}will be used.
 */
public ServletContextLocator(ServletContext ctx,String dir,String prefix,boolean acceptURL,String externalPrefix){
  if (ctx == null)   throw new IllegalArgumentException("String_Node_Str");
  if (dir != null) {
    final int len=dir.length();
    if (len == 0)     dir=null;
 else {
      if (dir.charAt(0) != '/')       throw new IllegalArgumentException("String_Node_Str" + dir);
      if (dir.charAt(len - 1) != '/')       dir+='/';
    }
  }
  if (prefix != null) {
    final int len=prefix.length();
    if (len == 0)     prefix=null;
 else {
      if (prefix.charAt(0) != '/')       throw new IllegalArgumentException("String_Node_Str" + prefix);
      if (len == 1)       prefix=null;
 else       if (prefix.charAt(len - 1) == '/')       prefix=prefix.substring(0,len - 1);
    }
  }
  _ctx=ctx;
  _dir=dir;
  _prefix=prefix;
  _acceptURL=acceptURL;
  _externalPrefix=externalPrefix;
}