Program: 172514
Project: 172514
Buggy source:
/** 
 * Attach doc to message
 * @param doc Doc link: url, from disk or already uploaded to VK as doc{owner_id}_{id}
 */
public Message doc(String doc,String... type){
  if (type.length > 0 && !type[0].contains("String_Node_Str") && !type[0].contains("String_Node_Str") && !type[0].contains("String_Node_Str")) {
    LOG.error("String_Node_Str",type[0]);
    if (type.length > 1)     LOG.error("String_Node_Str");
  }
  boolean fileFromUrl=false;
  if (Pattern.matches("String_Node_Str",doc) || Pattern.matches("String_Node_Str",doc) || Pattern.matches("String_Node_Str",doc)) {
    doc=doc.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
  }
  if (Pattern.matches("String_Node_Str",doc)) {
    File template_file;
    if (Pattern.matches("String_Node_Str",doc)) {
      int sizeOfFile=Utils.sizeOfFile(doc,"String_Node_Str");
      if (sizeOfFile > 10) {
        LOG.error("String_Node_Str",doc,sizeOfFile);
        return this;
      }
      try {
        template_file=new File(doc.substring(doc.lastIndexOf('/') + 1,doc.length()));
        template_file.createNewFile();
        Files.setPosixFilePermissions(Paths.get(template_file.getAbsolutePath()),PosixFilePermissions.fromString("String_Node_Str"));
        FileUtils.copyURLToFile(new URL(doc),template_file,5000,5000);
        fileFromUrl=true;
      }
 catch (      IOException ignored) {
        LOG.error("String_Node_Str",doc,ignored.toString());
        return this;
      }
    }
 else {
      template_file=new File(doc);
      if (!template_file.exists()) {
        LOG.error("String_Node_Str",doc);
        return this;
      }
    }
    String uploadUrl;
    int maxAttempts=5, i=0;
    boolean good=false;
    while (i < maxAttempts) {
      i++;
      String getUploadServerQuery="String_Node_Str" + (type.length > 0 ? "String_Node_Str" + type[0] : "String_Node_Str") + "String_Node_Str"+ accessToken+ "String_Node_Str"+ this.peerId+ "String_Node_Str";
      JSONObject getUploadServerResponse=Connection.getRequestResponse(getUploadServerQuery);
      uploadUrl=getUploadServerResponse.has("String_Node_Str") ? getUploadServerResponse.getJSONObject("String_Node_Str").has("String_Node_Str") ? getUploadServerResponse.getJSONObject("String_Node_Str").getString("String_Node_Str") : null : null;
      if (uploadUrl == null) {
        LOG.error("String_Node_Str",getUploadServerResponse);
        try {
          Thread.sleep(400);
        }
 catch (        InterruptedException ignored) {
        }
        continue;
      }
      String uploadingOfDocResponseString=Connection.getFileUploadAnswerOfVK(uploadUrl,"String_Node_Str",MediaType.parse("String_Node_Str"),template_file);
      uploadingOfDocResponseString=(uploadingOfDocResponseString != null && uploadingOfDocResponseString.length() > 2) ? uploadingOfDocResponseString : "String_Node_Str";
      JSONObject uploadingOfDocResponse=new JSONObject(uploadingOfDocResponseString);
      String file;
      if (uploadingOfDocResponse.has("String_Node_Str")) {
        file="String_Node_Str" + uploadingOfDocResponse.getString("String_Node_Str");
      }
 else {
        LOG.error("String_Node_Str",uploadingOfDocResponse);
        try {
          Thread.sleep(400);
        }
 catch (        InterruptedException ignored) {
        }
        continue;
      }
      String saveMessagesDocQuery="String_Node_Str" + accessToken + "String_Node_Str"+ file;
      JSONObject saveMessagesDocResponse=Connection.getRequestResponse(saveMessagesDocQuery);
      String docAsAttach=saveMessagesDocResponse.has("String_Node_Str") ? "String_Node_Str" + saveMessagesDocResponse.getJSONArray("String_Node_Str").getJSONObject(0).getInt("String_Node_Str") + "String_Node_Str"+ saveMessagesDocResponse.getJSONArray("String_Node_Str").getJSONObject(0).getInt("String_Node_Str") : "String_Node_Str";
      if (docAsAttach.length() < 2) {
        LOG.error("String_Node_Str",saveMessagesDocResponse);
        try {
          Thread.sleep(400);
        }
 catch (        InterruptedException ignored) {
        }
        continue;
      }
      if (fileFromUrl) {
        try {
          Files.delete(Paths.get(template_file.getAbsolutePath()));
        }
 catch (        IOException ignored) {
        }
      }
      if (Pattern.matches("String_Node_Str",docAsAttach)) {
        doc=docAsAttach;
        good=true;
        break;
      }
    }
    if (!good) {
      return this;
    }
  }
  this.attachments=this.attachments != null ? this.attachments : new String[]{};
  String[] attachmentsNew=new String[this.attachments.length + 1];
  attachmentsNew[attachmentsNew.length - 1]=doc;
  System.arraycopy(this.attachments,0,attachmentsNew,0,attachments.length);
  this.attachments=attachmentsNew;
  return this;
}

Fixed version (ground truth):
/** 
 * Attach doc to message
 * @param doc Doc link: url, from disk or already uploaded to VK as doc{owner_id}_{id}
 */
public Message doc(String doc,String... type){
  if (type.length > 0 && !type[0].contains("String_Node_Str") && !type[0].contains("String_Node_Str") && !type[0].contains("String_Node_Str")) {
    LOG.error("String_Node_Str",type[0]);
    if (type.length > 1)     LOG.error("String_Node_Str");
  }
  boolean fileFromUrl=false;
  if (Pattern.matches("String_Node_Str",doc) || Pattern.matches("String_Node_Str",doc) || Pattern.matches("String_Node_Str",doc)) {
    doc=doc.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
  }
 else {
    File template_file;
    if (Pattern.matches("String_Node_Str",doc)) {
      int sizeOfFile=Utils.sizeOfFile(doc,"String_Node_Str");
      if (sizeOfFile > 10) {
        LOG.error("String_Node_Str",doc,sizeOfFile);
        return this;
      }
      try {
        String tmpName=doc.substring(doc.lastIndexOf('/') + 1,doc.length());
        if (templateFileName != null && templateFileName.length() > 2) {
          tmpName=templateFileName;
        }
        template_file=new File(tmpName);
        template_file.createNewFile();
        Files.setPosixFilePermissions(Paths.get(template_file.getAbsolutePath()),PosixFilePermissions.fromString("String_Node_Str"));
        FileUtils.copyURLToFile(new URL(doc),template_file,5000,5000);
        fileFromUrl=true;
      }
 catch (      IOException ignored) {
        LOG.error("String_Node_Str",doc,ignored.toString());
        return this;
      }
    }
 else {
      template_file=new File(doc);
      if (!template_file.exists()) {
        LOG.error("String_Node_Str",doc);
        return this;
      }
    }
    String uploadUrl;
    int maxAttempts=5, i=0;
    boolean good=false;
    while (i < maxAttempts) {
      i++;
      String getUploadServerQuery="String_Node_Str" + (type.length > 0 ? "String_Node_Str" + type[0] : "String_Node_Str") + "String_Node_Str"+ accessToken+ "String_Node_Str"+ this.peerId+ "String_Node_Str";
      JSONObject getUploadServerResponse=Connection.getRequestResponse(getUploadServerQuery);
      uploadUrl=getUploadServerResponse.has("String_Node_Str") ? getUploadServerResponse.getJSONObject("String_Node_Str").has("String_Node_Str") ? getUploadServerResponse.getJSONObject("String_Node_Str").getString("String_Node_Str") : null : null;
      if (uploadUrl == null) {
        LOG.error("String_Node_Str",getUploadServerResponse);
        try {
          Thread.sleep(400);
        }
 catch (        InterruptedException ignored) {
        }
        continue;
      }
      String uploadingOfDocResponseString=Connection.getFileUploadAnswerOfVK(uploadUrl,"String_Node_Str",MediaType.parse("String_Node_Str"),template_file);
      uploadingOfDocResponseString=(uploadingOfDocResponseString != null && uploadingOfDocResponseString.length() > 2) ? uploadingOfDocResponseString : "String_Node_Str";
      JSONObject uploadingOfDocResponse=new JSONObject(uploadingOfDocResponseString);
      String file;
      if (uploadingOfDocResponse.has("String_Node_Str")) {
        file="String_Node_Str" + uploadingOfDocResponse.getString("String_Node_Str");
      }
 else {
        LOG.error("String_Node_Str",uploadingOfDocResponse);
        try {
          Thread.sleep(400);
        }
 catch (        InterruptedException ignored) {
        }
        continue;
      }
      String saveMessagesDocQuery="String_Node_Str" + accessToken + "String_Node_Str"+ file;
      JSONObject saveMessagesDocResponse=Connection.getRequestResponse(saveMessagesDocQuery);
      String docAsAttach=saveMessagesDocResponse.has("String_Node_Str") ? "String_Node_Str" + saveMessagesDocResponse.getJSONArray("String_Node_Str").getJSONObject(0).getInt("String_Node_Str") + "String_Node_Str"+ saveMessagesDocResponse.getJSONArray("String_Node_Str").getJSONObject(0).getInt("String_Node_Str") : "String_Node_Str";
      if (docAsAttach.length() < 2) {
        LOG.error("String_Node_Str",saveMessagesDocResponse);
        try {
          Thread.sleep(400);
        }
 catch (        InterruptedException ignored) {
        }
        continue;
      }
      if (fileFromUrl) {
        try {
          Files.delete(Paths.get(template_file.getAbsolutePath()));
        }
 catch (        IOException ignored) {
        }
      }
      if (Pattern.matches("String_Node_Str",docAsAttach)) {
        doc=docAsAttach;
        good=true;
        break;
      }
    }
    if (!good) {
      return this;
    }
  }
  this.attachments=this.attachments != null ? this.attachments : new String[]{};
  String[] attachmentsNew=new String[this.attachments.length + 1];
  attachmentsNew[attachmentsNew.length - 1]=doc;
  System.arraycopy(this.attachments,0,attachmentsNew,0,attachments.length);
  this.attachments=attachmentsNew;
  return this;
}