Program: 51321
Project: 51321
Buggy source:
private static Resource generateResource(AbstractResource r){
  Resource wadlResource=new Resource();
  if (r.isRootResource())   wadlResource.setPath(r.getUriPath().getValue());
  Map<String,Param> wadlResourceParams=new HashMap<String,Param>();
  for (  AbstractResourceMethod m : r.getResourceMethods()) {
    com.sun.research.ws.wadl.Method wadlMethod=generateMethod(wadlResourceParams,m);
    wadlResource.getMethodOrResource().add(wadlMethod);
  }
  for (  Param wadlParam : wadlResourceParams.values()) {
    wadlResource.getParam().add(wadlParam);
  }
  Map<String,Resource> wadlSubResources=new HashMap<String,Resource>();
  Map<String,Map<String,Param>> wadlSubResourcesParams=new HashMap<String,Map<String,Param>>();
  for (  AbstractSubResourceMethod m : r.getSubResourceMethods()) {
    String template=m.getUriPath().getValue();
    Resource wadlSubResource=wadlSubResources.get(template);
    Map<String,Param> wadlSubResourceParams=wadlSubResourcesParams.get(template);
    if (wadlSubResource == null) {
      wadlSubResource=new Resource();
      wadlSubResource.setPath(template);
      wadlSubResources.put(template,wadlSubResource);
      wadlSubResourceParams=new HashMap<String,Param>();
      wadlSubResourcesParams.put(template,wadlSubResourceParams);
      wadlResource.getMethodOrResource().add(wadlSubResource);
    }
    com.sun.research.ws.wadl.Method wadlMethod=generateMethod(wadlSubResourceParams,m);
    wadlSubResource.getMethodOrResource().add(wadlMethod);
  }
  for (  String template : wadlSubResources.keySet()) {
    Resource wadlSubResource=wadlSubResources.get(template);
    Map<String,Param> wadlSubResourceParams=wadlSubResourcesParams.get(template);
    for (    Param wadlParam : wadlSubResourceParams.values()) {
      wadlSubResource.getParam().add(wadlParam);
    }
  }
  for (  AbstractSubResourceLocator l : r.getSubResourceLocators()) {
    Resource wadlSubResource=new Resource();
    wadlSubResource.setPath(l.getUriPath().getValue());
    for (    Parameter p : l.getParameters()) {
      Param wadlParam=generateParam(p);
      wadlSubResource.getParam().add(wadlParam);
    }
    wadlResource.getMethodOrResource().add(wadlSubResource);
  }
  return wadlResource;
}

Fixed version (ground truth):
private static Resource generateResource(AbstractResource r){
  Resource wadlResource=new Resource();
  if (r.isRootResource())   wadlResource.setPath(r.getUriPath().getValue());
  Map<String,Param> wadlResourceParams=new HashMap<String,Param>();
  for (  AbstractResourceMethod m : r.getResourceMethods()) {
    com.sun.research.ws.wadl.Method wadlMethod=generateMethod(wadlResourceParams,m);
    wadlResource.getMethodOrResource().add(wadlMethod);
  }
  for (  Param wadlParam : wadlResourceParams.values()) {
    wadlResource.getParam().add(wadlParam);
  }
  Map<String,Resource> wadlSubResources=new HashMap<String,Resource>();
  Map<String,Map<String,Param>> wadlSubResourcesParams=new HashMap<String,Map<String,Param>>();
  for (  AbstractSubResourceMethod m : r.getSubResourceMethods()) {
    String template=m.getUriPath().getValue();
    Resource wadlSubResource=wadlSubResources.get(template);
    Map<String,Param> wadlSubResourceParams=wadlSubResourcesParams.get(template);
    if (wadlSubResource == null) {
      wadlSubResource=new Resource();
      wadlSubResource.setPath(template);
      wadlSubResources.put(template,wadlSubResource);
      wadlSubResourceParams=new HashMap<String,Param>();
      wadlSubResourcesParams.put(template,wadlSubResourceParams);
      wadlResource.getMethodOrResource().add(wadlSubResource);
    }
    com.sun.research.ws.wadl.Method wadlMethod=generateMethod(wadlSubResourceParams,m);
    wadlSubResource.getMethodOrResource().add(wadlMethod);
  }
  for (  Map.Entry<String,Resource> e : wadlSubResources.entrySet()) {
    String template=e.getKey();
    Resource wadlSubResource=e.getValue();
    Map<String,Param> wadlSubResourceParams=wadlSubResourcesParams.get(template);
    for (    Param wadlParam : wadlSubResourceParams.values()) {
      wadlSubResource.getParam().add(wadlParam);
    }
  }
  for (  AbstractSubResourceLocator l : r.getSubResourceLocators()) {
    Resource wadlSubResource=new Resource();
    wadlSubResource.setPath(l.getUriPath().getValue());
    for (    Parameter p : l.getParameters()) {
      Param wadlParam=generateParam(p);
      wadlSubResource.getParam().add(wadlParam);
    }
    wadlResource.getMethodOrResource().add(wadlSubResource);
  }
  return wadlResource;
}