Program: 105642
Project: 105642
Buggy source:
protected SR getNfsSR(Connection conn,String poolid,String uuid,String server,String serverpath,String pooldesc){
  Map<String,String> deviceConfig=new HashMap<String,String>();
  try {
    serverpath=serverpath.replace("String_Node_Str","String_Node_Str");
    Set<SR> srs=SR.getAll(conn);
    for (    SR sr : srs) {
      if (!SRType.NFS.equals(sr.getType(conn))) {
        continue;
      }
      Set<PBD> pbds=sr.getPBDs(conn);
      if (pbds.isEmpty()) {
        continue;
      }
      PBD pbd=pbds.iterator().next();
      Map<String,String> dc=pbd.getDeviceConfig(conn);
      if (dc == null) {
        continue;
      }
      if (dc.get("String_Node_Str") == null) {
        continue;
      }
      if (dc.get("String_Node_Str") == null) {
        continue;
      }
      if (server.equals(dc.get("String_Node_Str")) && serverpath.equals(dc.get("String_Node_Str"))) {
        throw new CloudRuntimeException("String_Node_Str" + dc.get("String_Node_Str") + "String_Node_Str"+ dc.get("String_Node_Str")+ "String_Node_Str"+ uuid+ "String_Node_Str"+ _host.uuid);
      }
    }
    deviceConfig.put("String_Node_Str",server);
    deviceConfig.put("String_Node_Str",serverpath);
    Host host=Host.getByUuid(conn,_host.uuid);
    Map<String,String> smConfig=new HashMap<String,String>();
    smConfig.put("String_Node_Str","String_Node_Str");
    SR sr=SR.create(conn,host,deviceConfig,new Long(0),uuid,poolid,SRType.NFS.toString(),"String_Node_Str",true,smConfig);
    sr.scan(conn);
    return sr;
  }
 catch (  XenAPIException e) {
    throw new CloudRuntimeException("String_Node_Str" + pooldesc,e);
  }
catch (  XmlRpcException e) {
    throw new CloudRuntimeException("String_Node_Str" + pooldesc,e);
  }
}

Fixed version (ground truth):
protected SR getNfsSR(Connection conn,String poolid,String uuid,String server,String serverpath,String pooldesc){
  Map<String,String> deviceConfig=new HashMap<String,String>();
  try {
    serverpath=serverpath.replace("String_Node_Str","String_Node_Str");
    Set<SR> srs=SR.getAll(conn);
    if (srs != null && !srs.isEmpty()) {
      for (      SR sr : srs) {
        if (!SRType.NFS.equals(sr.getType(conn))) {
          continue;
        }
        Set<PBD> pbds=sr.getPBDs(conn);
        if (pbds.isEmpty()) {
          continue;
        }
        PBD pbd=pbds.iterator().next();
        Map<String,String> dc=pbd.getDeviceConfig(conn);
        if (dc == null) {
          continue;
        }
        if (dc.get("String_Node_Str") == null) {
          continue;
        }
        if (dc.get("String_Node_Str") == null) {
          continue;
        }
        if (server.equals(dc.get("String_Node_Str")) && serverpath.equals(dc.get("String_Node_Str"))) {
          throw new CloudRuntimeException("String_Node_Str" + dc.get("String_Node_Str") + "String_Node_Str"+ dc.get("String_Node_Str")+ "String_Node_Str"+ uuid+ "String_Node_Str"+ _host.uuid);
        }
      }
    }
    deviceConfig.put("String_Node_Str",server);
    deviceConfig.put("String_Node_Str",serverpath);
    Host host=Host.getByUuid(conn,_host.uuid);
    Map<String,String> smConfig=new HashMap<String,String>();
    smConfig.put("String_Node_Str","String_Node_Str");
    SR sr=SR.create(conn,host,deviceConfig,new Long(0),uuid,poolid,SRType.NFS.toString(),"String_Node_Str",true,smConfig);
    sr.scan(conn);
    return sr;
  }
 catch (  XenAPIException e) {
    throw new CloudRuntimeException("String_Node_Str" + pooldesc,e);
  }
catch (  XmlRpcException e) {
    throw new CloudRuntimeException("String_Node_Str" + pooldesc,e);
  }
}