Program: 77410
Project: 77410
Buggy source:
/** 
 * Checks if this HttpURLPermission implies the given permission. Specifically, the following checks are done as if in the following sequence: <p><ul> <li>if 'p' is not an instance of HttpURLPermission return false</li> <li>if any of p's methods are not in this's method list, and if this's method list is not equal to "*", then return false.</li> <li>if any of p's headers are not in this's request header list, and if this's request header list is not equal to "*", then return false.</li> <li>if this's url is equal to p's url , then return true</li> <li>if this's url scheme is not equal to p's url scheme return false</li> <li>if the scheme specific part of this's url is '*' return true</li> <li>if this's url authority is not equal to p's url authority return false</li> <li>if the path or paths specified by p's url are contained in the set of paths specified by this's url, then return true <li>otherwise, return false</li> </ol> <p> Some examples of how paths are matched are shown below: <p> <table border> <tr><th>this's path</th><th>p's path</th><th>match</th></tr> <tr><td>/a/b</td><td>/a/b</td><td>yes</td></tr> <tr><td>/a/b/*</td><td>/a/b/c</td><td>yes</td></tr> <tr><td>/a/b/*</td><td>/a/b/c/d</td><td>no</td></tr> <tr><td>/a/b/-</td><td>/a/b/c/d</td><td>yes</td></tr> <tr><td>/a/b/-</td><td>/a/b/c/d/e</td><td>yes</td></tr> <tr><td>/a/b/-</td><td>/a/b/c/*</td><td>yes</td></tr> <tr><td>/a/b/*</td><td>/a/b/c/-</td><td>no</td></tr> </table>
 */
public boolean implies(Permission p){
  if (!(p instanceof HttpURLPermission)) {
    return false;
  }
  HttpURLPermission that=(HttpURLPermission)p;
  if (!this.methods.get(0).equals("String_Node_Str") && Collections.indexOfSubList(this.methods,that.methods) == -1) {
    return false;
  }
  if (this.requestHeaders.isEmpty() && !that.requestHeaders.isEmpty()) {
    return false;
  }
  if (!this.requestHeaders.isEmpty() && !this.requestHeaders.get(0).equals("String_Node_Str") && Collections.indexOfSubList(this.requestHeaders,that.requestHeaders) == -1) {
    return false;
  }
  if (this.uri.equals(that.uri)) {
    return true;
  }
  if (!this.uri.getScheme().equals(that.uri.getScheme())) {
    return false;
  }
  if (this.uri.getSchemeSpecificPart().equals("String_Node_Str")) {
    return true;
  }
  String thisAuthority=this.uri.getAuthority();
  if (thisAuthority != null && !thisAuthority.equals(that.uri.getAuthority())) {
    return false;
  }
  String thispath=this.uri.getPath();
  String thatpath=that.uri.getPath();
  if (thispath.endsWith("String_Node_Str")) {
    String thisprefix=thispath.substring(0,thispath.length() - 1);
    return thatpath.startsWith(thisprefix);
  }
  if (thispath.endsWith("String_Node_Str")) {
    String thisprefix=thispath.substring(0,thispath.length() - 1);
    if (!thatpath.startsWith(thisprefix)) {
      return false;
    }
    String thatsuffix=thatpath.substring(thisprefix.length());
    if (thatsuffix.indexOf('/') != -1) {
      return false;
    }
    if (thatsuffix.equals("String_Node_Str")) {
      return false;
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if this HttpURLPermission implies the given permission. Specifically, the following checks are done as if in the following sequence: <p><ul> <li>if 'p' is not an instance of HttpURLPermission return false</li> <li>if any of p's methods are not in this's method list, and if this's method list is not equal to "*", then return false.</li> <li>if any of p's headers are not in this's request header list, and if this's request header list is not equal to "*", then return false.</li> <li>if this's url is equal to p's url , then return true</li> <li>if this's url scheme is not equal to p's url scheme return false</li> <li>if the scheme specific part of this's url is '*' return true</li> <li>if this's url authority is not equal to p's url authority return false</li> <li>if the path or paths specified by p's url are contained in the set of paths specified by this's url, then return true <li>otherwise, return false</li> </ul> <p>Some examples of how paths are matched are shown below: <p><table border> <caption>Examples of Path Matching</caption> <tr><th>this's path</th><th>p's path</th><th>match</th></tr> <tr><td>/a/b</td><td>/a/b</td><td>yes</td></tr> <tr><td>/a/b/*</td><td>/a/b/c</td><td>yes</td></tr> <tr><td>/a/b/*</td><td>/a/b/c/d</td><td>no</td></tr> <tr><td>/a/b/-</td><td>/a/b/c/d</td><td>yes</td></tr> <tr><td>/a/b/-</td><td>/a/b/c/d/e</td><td>yes</td></tr> <tr><td>/a/b/-</td><td>/a/b/c/*</td><td>yes</td></tr> <tr><td>/a/b/*</td><td>/a/b/c/-</td><td>no</td></tr> </table>
 */
public boolean implies(Permission p){
  if (!(p instanceof HttpURLPermission)) {
    return false;
  }
  HttpURLPermission that=(HttpURLPermission)p;
  if (!this.methods.get(0).equals("String_Node_Str") && Collections.indexOfSubList(this.methods,that.methods) == -1) {
    return false;
  }
  if (this.requestHeaders.isEmpty() && !that.requestHeaders.isEmpty()) {
    return false;
  }
  if (!this.requestHeaders.isEmpty() && !this.requestHeaders.get(0).equals("String_Node_Str") && Collections.indexOfSubList(this.requestHeaders,that.requestHeaders) == -1) {
    return false;
  }
  if (this.uri.equals(that.uri)) {
    return true;
  }
  if (!this.uri.getScheme().equals(that.uri.getScheme())) {
    return false;
  }
  if (this.uri.getSchemeSpecificPart().equals("String_Node_Str")) {
    return true;
  }
  String thisAuthority=this.uri.getAuthority();
  if (thisAuthority != null && !thisAuthority.equals(that.uri.getAuthority())) {
    return false;
  }
  String thispath=this.uri.getPath();
  String thatpath=that.uri.getPath();
  if (thispath.endsWith("String_Node_Str")) {
    String thisprefix=thispath.substring(0,thispath.length() - 1);
    return thatpath.startsWith(thisprefix);
  }
  if (thispath.endsWith("String_Node_Str")) {
    String thisprefix=thispath.substring(0,thispath.length() - 1);
    if (!thatpath.startsWith(thisprefix)) {
      return false;
    }
    String thatsuffix=thatpath.substring(thisprefix.length());
    if (thatsuffix.indexOf('/') != -1) {
      return false;
    }
    if (thatsuffix.equals("String_Node_Str")) {
      return false;
    }
    return true;
  }
  return false;
}