Program: 54961
Project: 54961
Buggy source:
public List<DavResource> getResources(String url) throws SardineException {
  HttpPropFind propFind=new HttpPropFind(url);
  propFind.setEntity(SardineUtil.getResourcesEntity());
  HttpResponse response=this.executeWrapper(propFind);
  StatusLine statusLine=response.getStatusLine();
  if (!SardineUtil.isGoodResponse(statusLine.getStatusCode()))   throw new SardineException("String_Node_Str",url,statusLine.getStatusCode(),statusLine.getReasonPhrase());
  Multistatus multistatus=SardineUtil.getMulitstatus(this.factory.getUnmarshaller(),response,url);
  List<Response> responses=multistatus.getResponse();
  List<DavResource> resources=new ArrayList<DavResource>(responses.size());
  int firstSlash=url.indexOf('/',8);
  String baseUrl=null;
  if (url.endsWith("String_Node_Str"))   baseUrl=url.substring(firstSlash);
  String hostPart=url.substring(0,firstSlash);
  for (  Response resp : responses) {
    boolean currentDirectory=false;
    boolean isDirectory=false;
    String href=resp.getHref().get(0);
    String name=null;
    if (baseUrl != null) {
      if ((href.length() == baseUrl.length() - 1) && baseUrl.endsWith("String_Node_Str")) {
        href+="String_Node_Str";
      }
      if (href.startsWith(hostPart)) {
        name=href.substring(hostPart.length() + baseUrl.length());
      }
 else       name=href.substring(baseUrl.length());
      if ("String_Node_Str".equals(name) || (name.length() == 0)) {
        isDirectory=true;
        currentDirectory=true;
      }
    }
 else {
      int last=href.lastIndexOf("String_Node_Str") + 1;
      name=href.substring(last);
      baseUrl=href.substring(0,last);
    }
    if (name.equals("String_Node_Str"))     continue;
    if (name.endsWith("String_Node_Str")) {
      name=name.substring(0,name.length() - 1);
      isDirectory=true;
    }
    Prop prop=resp.getPropstat().get(0).getProp();
    String creationdate=null;
    Creationdate gcd=prop.getCreationdate();
    if ((gcd != null) && (gcd.getContent().size() == 1))     creationdate=gcd.getContent().get(0);
    String modifieddate=null;
    Getlastmodified glm=prop.getGetlastmodified();
    if ((glm != null) && (glm.getContent().size() == 1))     modifieddate=glm.getContent().get(0);
 else     modifieddate=creationdate;
    String contentType=null;
    Getcontenttype gtt=prop.getGetcontenttype();
    if ((gtt != null) && (gtt.getContent().size() == 1))     contentType=gtt.getContent().get(0);
    if (isDirectory && (contentType == null)) {
      contentType="String_Node_Str";
    }
    String contentLength="String_Node_Str";
    Getcontentlength gcl=prop.getGetcontentlength();
    if ((gcl != null) && (gcl.getContent().size() == 1))     contentLength=gcl.getContent().get(0);
    DavResource dr=new DavResource(hostPart + baseUrl,name,SardineUtil.parseDate(creationdate),SardineUtil.parseDate(modifieddate),contentType,Long.valueOf(contentLength),currentDirectory);
    resources.add(dr);
  }
  return resources;
}

Fixed version (ground truth):
public List<DavResource> getResources(String url) throws SardineException {
  HttpPropFind propFind=new HttpPropFind(url);
  propFind.setEntity(SardineUtil.getResourcesEntity());
  HttpResponse response=this.executeWrapper(propFind);
  StatusLine statusLine=response.getStatusLine();
  if (!SardineUtil.isGoodResponse(statusLine.getStatusCode())) {
    propFind.abort();
    throw new SardineException("String_Node_Str",url,statusLine.getStatusCode(),statusLine.getReasonPhrase());
  }
  Multistatus multistatus=SardineUtil.getMulitstatus(this.factory.getUnmarshaller(),response,url);
  List<Response> responses=multistatus.getResponse();
  List<DavResource> resources=new ArrayList<DavResource>(responses.size());
  int firstSlash=url.indexOf('/',8);
  String baseUrl=null;
  if (url.endsWith("String_Node_Str"))   baseUrl=url.substring(firstSlash);
  String hostPart=url.substring(0,firstSlash);
  for (  Response resp : responses) {
    boolean currentDirectory=false;
    boolean isDirectory=false;
    String href=resp.getHref().get(0);
    String name=null;
    if (baseUrl != null) {
      if ((href.length() == baseUrl.length() - 1) && baseUrl.endsWith("String_Node_Str")) {
        href+="String_Node_Str";
      }
      if (href.startsWith(hostPart)) {
        name=href.substring(hostPart.length() + baseUrl.length());
      }
 else       name=href.substring(baseUrl.length());
      if ("String_Node_Str".equals(name) || (name.length() == 0)) {
        isDirectory=true;
        currentDirectory=true;
      }
    }
 else {
      int last=href.lastIndexOf("String_Node_Str") + 1;
      name=href.substring(last);
      baseUrl=href.substring(0,last);
    }
    if (name.equals("String_Node_Str"))     continue;
    if (name.endsWith("String_Node_Str")) {
      name=name.substring(0,name.length() - 1);
      isDirectory=true;
    }
    Prop prop=resp.getPropstat().get(0).getProp();
    String creationdate=null;
    Creationdate gcd=prop.getCreationdate();
    if ((gcd != null) && (gcd.getContent().size() == 1))     creationdate=gcd.getContent().get(0);
    String modifieddate=null;
    Getlastmodified glm=prop.getGetlastmodified();
    if ((glm != null) && (glm.getContent().size() == 1))     modifieddate=glm.getContent().get(0);
 else     modifieddate=creationdate;
    String contentType=null;
    Getcontenttype gtt=prop.getGetcontenttype();
    if ((gtt != null) && (gtt.getContent().size() == 1))     contentType=gtt.getContent().get(0);
    if (isDirectory && (contentType == null)) {
      contentType="String_Node_Str";
    }
    String contentLength="String_Node_Str";
    Getcontentlength gcl=prop.getGetcontentlength();
    if ((gcl != null) && (gcl.getContent().size() == 1))     contentLength=gcl.getContent().get(0);
    DavResource dr=new DavResource(hostPart + baseUrl,name,SardineUtil.parseDate(creationdate),SardineUtil.parseDate(modifieddate),contentType,Long.valueOf(contentLength),currentDirectory);
    resources.add(dr);
  }
  return resources;
}