nus-yam/ex-repair huggingface dataset:
Program: 32930
Project: 32930
Buggy source:
private void saveToCache(InputStream is,File to){
  logger.info("String_Node_Str" + to.getAbsolutePath());
  FileOutputStream fs=null;
  int times=0;
  try {
    if (to.exists()) {
      to.delete();
    }
    fs=new FileOutputStream(to);
    int byteRead=0;
    byte[] buffer=new byte[1024];
    while ((byteRead=is.read(buffer)) != -1) {
      times+=byteRead;
      fs.write(buffer,0,byteRead);
      if (times >= C.getContentLength()) {
        break;
      }
    }
    if (to.length() > 1) {
      logger.info("String_Node_Str" + to.getAbsolutePath());
    }
 else {
      to.delete();
      logger.info("String_Node_Str" + to.getAbsolutePath());
    }
  }
 catch (  Exception e) {
    logger.warning(e.getMessage());
  }
 finally {
    try {
      if (fs != null)       fs.close();
      is.reset();
      logger.info("String_Node_Str" + is.available());
    }
 catch (    IOException e) {
      logger.warning(e.getMessage());
    }
    if (to.exists()) {
      to.setLastModified(C.getLastModified());
    }
  }
}

Fixed version (ground truth):
private void saveToCache(InputStream is,File to){
  logger.info("String_Node_Str" + to.getAbsolutePath());
  FileOutputStream fs=null;
  int times=0;
  try {
    if (to.exists()) {
      to.delete();
    }
    fs=new FileOutputStream(to);
    int byteRead=0;
    byte[] buffer=new byte[1024];
    while ((byteRead=is.read(buffer)) != -1) {
      times+=byteRead;
      fs.write(buffer,0,byteRead);
      if (times >= C.getContentLength()) {
        break;
      }
    }
    if (to.length() > 1) {
      to.setLastModified(C.getLastModified());
      logger.info("String_Node_Str" + to.getAbsolutePath() + "String_Node_Str"+ to.lastModified()+ "String_Node_Str"+ to.length()+ "String_Node_Str");
    }
 else {
      to.delete();
      logger.info("String_Node_Str" + to.getAbsolutePath());
    }
  }
 catch (  Exception e) {
    logger.warning(e.getMessage());
  }
 finally {
    try {
      if (fs != null)       fs.close();
      is.reset();
    }
 catch (    IOException e) {
      logger.warning(e.getMessage());
    }
  }
}
Program: 32931
Project: 32931
Buggy source:
public InputStream getPlayerSkinStream(Boolean isCloak,String playerName){
  if (skinURLs == null || cloakURLs == null || skinURLs.length <= 0 || cloakURLs.length <= 0)   refreshSkinURL();
  InputStream S=null;
  for (  String l : isCloak ? cloakURLs : skinURLs) {
    if (l == null || l.equalsIgnoreCase("String_Node_Str"))     continue;
    String loc=str_replace("String_Node_Str",playerName,l);
    logger.log(Level.INFO,"String_Node_Str" + (isCloak ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ loc);
    S=getStream(loc,true);
    if (S == null) {
      logger.log(Level.INFO,"String_Node_Str" + (isCloak ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ loc);
    }
 else {
      logger.info("String_Node_Str" + (isCloak ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ loc);
      return S;
    }
  }
  logger.log(Level.INFO,"String_Node_Str");
  return getStream(str_replace("String_Node_Str",playerName,isCloak ? DefaultCloakURL : DefaultSkinURL),true);
}

Fixed version (ground truth):
public InputStream getPlayerSkinStream(Boolean isCloak,String playerName){
  if ((skinURLs == null || skinURLs.length <= 0) && (cloakURLs == null || cloakURLs.length <= 0))   refreshSkinURL();
  InputStream S=null;
  for (  String l : isCloak ? cloakURLs : skinURLs) {
    if (l == null || l.equalsIgnoreCase("String_Node_Str"))     continue;
    String loc=str_replace("String_Node_Str",playerName,l);
    logger.log(Level.INFO,"String_Node_Str" + (isCloak ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ loc);
    S=getStream(loc,true);
    if (S == null) {
      logger.log(Level.INFO,"String_Node_Str" + (isCloak ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ loc);
    }
 else {
      logger.info("String_Node_Str" + (isCloak ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ loc);
      return S;
    }
  }
  logger.log(Level.INFO,"String_Node_Str");
  return getStream(str_replace("String_Node_Str",playerName,isCloak ? DefaultCloakURL : DefaultSkinURL),true);
}
Program: 32933
Project: 32933
Buggy source:
private void saveToCache(InputStream is,File to){
  logger.info("String_Node_Str" + to.getAbsolutePath());
  FileOutputStream fs=null;
  int times=0;
  try {
    if (to.exists()) {
      to.delete();
    }
    fs=new FileOutputStream(to);
    int byteRead=0;
    byte[] buffer=new byte[1024];
    while ((byteRead=is.read(buffer)) != -1) {
      times+=byteRead;
      fs.write(buffer,0,byteRead);
      if (times >= C.getContentLength()) {
        break;
      }
    }
    if (to.length() > 1) {
      logger.info("String_Node_Str" + to.getAbsolutePath());
    }
 else {
      to.delete();
      logger.info("String_Node_Str" + to.getAbsolutePath());
    }
  }
 catch (  Exception e) {
    logger.warning(e.getMessage());
  }
 finally {
    try {
      if (fs != null)       fs.close();
      is.reset();
      logger.info("String_Node_Str" + is.available());
      if (to.exists()) {
        to.setLastModified(C.getLastModified());
        logger.info("String_Node_Str" + to.lastModified());
      }
    }
 catch (    IOException e) {
      logger.warning(e.getMessage());
    }
  }
}

Fixed version (ground truth):
private void saveToCache(InputStream is,File to){
  logger.info("String_Node_Str" + to.getAbsolutePath());
  FileOutputStream fs=null;
  int times=0;
  try {
    if (to.exists()) {
      to.delete();
    }
    fs=new FileOutputStream(to);
    int byteRead=0;
    byte[] buffer=new byte[1024];
    while ((byteRead=is.read(buffer)) != -1) {
      times+=byteRead;
      fs.write(buffer,0,byteRead);
      if (times >= C.getContentLength()) {
        break;
      }
    }
    if (to.length() > 1) {
      to.setLastModified(C.getLastModified());
      logger.info("String_Node_Str" + to.getAbsolutePath() + "String_Node_Str"+ to.lastModified()+ "String_Node_Str"+ to.length()+ "String_Node_Str");
    }
 else {
      to.delete();
      logger.info("String_Node_Str" + to.getAbsolutePath());
    }
  }
 catch (  Exception e) {
    logger.warning(e.getMessage());
  }
 finally {
    try {
      if (fs != null)       fs.close();
      is.reset();
    }
 catch (    IOException e) {
      logger.warning(e.getMessage());
    }
  }
}
Program: 32934
Project: 32934
Buggy source:
public InputStream getPlayerSkinStream(Boolean isCloak,String playerName){
  if (skinURLs == null || cloakURLs == null || skinURLs.length <= 0 || cloakURLs.length <= 0)   refreshSkinURL();
  InputStream S=null;
  for (  String l : isCloak ? cloakURLs : skinURLs) {
    if (l == null || l.equalsIgnoreCase("String_Node_Str"))     continue;
    String loc=str_replace("String_Node_Str",playerName,l);
    logger.log(Level.INFO,"String_Node_Str" + (isCloak ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ loc);
    S=getStream(loc,true);
    if (S == null) {
      logger.log(Level.INFO,"String_Node_Str" + (isCloak ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ loc);
    }
 else {
      logger.info("String_Node_Str" + (isCloak ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ loc);
      return S;
    }
  }
  logger.log(Level.INFO,"String_Node_Str");
  return getStream(str_replace("String_Node_Str",playerName,isCloak ? DefaultCloakURL : DefaultSkinURL),true);
}

Fixed version (ground truth):
public InputStream getPlayerSkinStream(Boolean isCloak,String playerName){
  if ((skinURLs == null || skinURLs.length <= 0) && (cloakURLs == null || cloakURLs.length <= 0))   refreshSkinURL();
  InputStream S=null;
  for (  String l : isCloak ? cloakURLs : skinURLs) {
    if (l == null || l.equalsIgnoreCase("String_Node_Str"))     continue;
    String loc=str_replace("String_Node_Str",playerName,l);
    logger.log(Level.INFO,"String_Node_Str" + (isCloak ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ loc);
    S=getStream(loc,true);
    if (S == null) {
      logger.log(Level.INFO,"String_Node_Str" + (isCloak ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ loc);
    }
 else {
      logger.info("String_Node_Str" + (isCloak ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ loc);
      return S;
    }
  }
  logger.log(Level.INFO,"String_Node_Str");
  return getStream(str_replace("String_Node_Str",playerName,isCloak ? DefaultCloakURL : DefaultSkinURL),true);
}
Program: 32937
Project: 32937
Buggy source:
private static String[] readAllLines(File mcdir,String path){
  try {
    File F=new File(mcdir,path);
    logger.log(Level.INFO,"String_Node_Str" + F.getAbsolutePath());
    if (!F.exists()) {
      logger.log(Level.INFO,"String_Node_Str");
      F.createNewFile();
      return new String[0];
    }
 else     if (F.length() <= 0) {
      logger.log(Level.INFO,"String_Node_Str");
      return new String[0];
    }
 else {
      byte[] b=new byte[(int)F.length()];
      BufferedInputStream S=new BufferedInputStream(new FileInputStream(F));
      S.read(b);
      S.close();
      logger.log(Level.INFO,"String_Node_Str");
      String[] re=str_replace("String_Node_Str","String_Node_Str",str_replace("String_Node_Str","String_Node_Str",new String(b))).split("String_Node_Str");
      for (int i=0; i < re.length(); i++) {
        if (re[i].startWith('#'))         re[i]=null;
      }
    }
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,ex.getMessage());
    return new String[0];
  }
}

Fixed version (ground truth):
private static String[] readAllLines(File mcdir,String path){
  try {
    File F=new File(mcdir,path);
    logger.log(Level.INFO,"String_Node_Str" + F.getAbsolutePath());
    if (!F.exists()) {
      logger.log(Level.INFO,"String_Node_Str");
      F.createNewFile();
      return new String[0];
    }
 else     if (F.length() <= 0) {
      logger.log(Level.INFO,"String_Node_Str");
      return new String[0];
    }
 else {
      byte[] b=new byte[(int)F.length()];
      BufferedInputStream S=new BufferedInputStream(new FileInputStream(F));
      S.read(b);
      S.close();
      logger.log(Level.INFO,"String_Node_Str");
      String[] re=str_replace("String_Node_Str","String_Node_Str",str_replace("String_Node_Str","String_Node_Str",new String(b))).split("String_Node_Str");
      for (int i=0; i < re.length(); i++) {
        if (re[i].startWith('#'))         re[i]=null;
      }
      return re;
    }
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,ex.getMessage());
    return new String[0];
  }
}
Program: 32939
Project: 32939
Buggy source:
public static void showGUI(){
  File a=new File(DATA_DIR,"String_Node_Str");
  if (!a.exists() || a.length() < 1) {
    a.delete();
    logger.info("String_Node_Str" + a.getAbsolutePath());
    downloadFile("String_Node_Str",a);
  }
  try {
    String toRun="String_Node_Str" + a.getAbsolutePath() + "String_Node_Str"+ VERSION;
    logger.info("String_Node_Str" + toRun);
    Runtime.getRuntime().exec(toRun);
  }
 catch (  Exception e) {
    logger.warning(e.getMessage());
  }
}

Fixed version (ground truth):
public static void showGUI(){
  try {
    Class clazz=Class.forName("String_Node_Str");
    String[] arg={"String_Node_Str",VERSION,"String_Node_Str"};
    CustomSkinLoaderGUI.main(arg);
    return;
  }
 catch (  Exception e) {
    logger.warning(e.getMessage());
  }
  File a=new File(DATA_DIR,"String_Node_Str");
  if (!a.exists() || a.length() < 1) {
    a.delete();
    logger.info("String_Node_Str" + a.getAbsolutePath());
    downloadFile("String_Node_Str",a);
  }
  try {
    String toRun="String_Node_Str" + a.getAbsolutePath() + "String_Node_Str"+ VERSION;
    logger.info("String_Node_Str" + toRun);
    Runtime.getRuntime().exec(toRun);
  }
 catch (  Exception e) {
    logger.warning(e.getMessage());
  }
}
Program: 32940
Project: 32940
Buggy source:
private InputStream getStream(String URL,Boolean CheckPNG){
  boolean success=false;
  try {
    URL U=new URL(URL);
    C=(HttpURLConnection)U.openConnection();
    C.setDoInput(true);
    C.setDoOutput(false);
    C.connect();
    int respcode=C.getResponseCode() / 100;
    if (respcode != 4 && respcode != 5) {
      InputStream IS=new BufferedInputStream(C.getInputStream());
      if (!CheckPNG) {
        success=true;
        return IS;
      }
      byte[] ib=new byte[4];
      IS.read(ib);
      if (ib[1] == (byte)'P' && ib[2] == (byte)'N' && ib[3] == (byte)'G') {
        IS.reset();
        success=true;
        return IS;
      }
    }
  }
 catch (  Exception ex) {
    success=false;
    logger.log(Level.WARNING,ex.getMessage());
  }
 finally {
    if (!success)     disconnect();
  }
  return null;
}

Fixed version (ground truth):
private InputStream getStream(String URL,Boolean CheckPNG,long last){
  boolean success=false;
  try {
    URL U=new URL(URL);
    C=(HttpURLConnection)U.openConnection();
    C.setDoInput(true);
    C.setDoOutput(false);
    if (last > 0)     C.setIfModifiedSince(last);
    C.connect();
    logger.info("String_Node_Str" + C.getResponseCode());
    int respcode=C.getResponseCode() / 100;
    if (respcode != 4 && respcode != 5) {
      if (C.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) {
        logger.info("String_Node_Str");
        return null;
      }
      if (C.getContentLength() <= 0) {
        return null;
      }
      InputStream IS=new BufferedInputStream(C.getInputStream());
      if (!CheckPNG) {
        success=true;
        return IS;
      }
      IS.mark(C.getContentLength() + 10);
      byte[] ib=new byte[4];
      IS.read(ib);
      if (ib[1] == (byte)'P' && ib[2] == (byte)'N' && ib[3] == (byte)'G') {
        IS.reset();
        success=true;
        return IS;
      }
    }
  }
 catch (  Exception ex) {
    success=false;
    logger.log(Level.WARNING,ex.getMessage());
  }
 finally {
    if (!success)     disconnect();
  }
  return null;
}
Program: 32941
Project: 32941
Buggy source:
private static void refreshSkinURL(){
  try {
    File mcdir=Minecraft.getMinecraft().mcDataDir;
    skinURLs=readAllLines(mcdir,"String_Node_Str");
    cloakURLs=readAllLines(mcdir,"String_Node_Str");
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,ex.getMessage());
  }
 finally {
    if (skinURLs.length == 0 && cloakURLs.length == 0) {
      logger.info("String_Node_Str");
      showGUI();
    }
 else {
      logger.log(Level.INFO,"String_Node_Str" + skinURLs.length + "String_Node_Str"+ cloakURLs.length);
    }
  }
}

Fixed version (ground truth):
private static void refreshSkinURL(){
  try {
    skinURLs=readAllLines(DATA_DIR,"String_Node_Str");
    cloakURLs=readAllLines(DATA_DIR,"String_Node_Str");
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,ex.getMessage());
  }
 finally {
    if (skinURLs.length == 0 && cloakURLs.length == 0) {
      logger.info("String_Node_Str");
      showGUI();
    }
 else {
      logger.log(Level.INFO,"String_Node_Str" + skinURLs.length + "String_Node_Str"+ cloakURLs.length);
    }
  }
}
Program: 32942
Project: 32942
Buggy source:
private static String[] readAllLines(File mcdir,String path){
  try {
    File F=new File(mcdir,path);
    logger.log(Level.INFO,"String_Node_Str" + F.getAbsolutePath());
    if (!F.exists()) {
      logger.log(Level.INFO,"String_Node_Str");
      return new String[0];
    }
 else     if (F.length() <= 0) {
      logger.log(Level.INFO,"String_Node_Str");
      return new String[0];
    }
 else {
      byte[] b=new byte[(int)F.length()];
      BufferedInputStream S=new BufferedInputStream(new FileInputStream(F));
      S.read(b);
      S.close();
      logger.log(Level.INFO,"String_Node_Str");
      String[] re=str_replace("String_Node_Str","String_Node_Str",str_replace("String_Node_Str","String_Node_Str",new String(b))).split("String_Node_Str");
      for (int i=0; i < re.length; i++) {
        if (re[i].startsWith("String_Node_Str"))         re[i]=null;
 else {
          for (int g=0; g < re.length; g++) {
            if (i == g)             continue;
            if (re[i].equalsIgnoreCase(re[g])) {
              re[i]=null;
              break;
            }
          }
        }
      }
      return re;
    }
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,ex.getMessage());
    return new String[0];
  }
}

Fixed version (ground truth):
private static String[] readAllLines(File dir,String path){
  try {
    File F=new File(dir,path);
    logger.log(Level.INFO,"String_Node_Str" + F.getAbsolutePath());
    if (!F.exists()) {
      logger.log(Level.INFO,"String_Node_Str");
      return new String[0];
    }
 else     if (F.length() <= 0) {
      logger.log(Level.INFO,"String_Node_Str");
      return new String[0];
    }
 else {
      byte[] b=new byte[(int)F.length()];
      BufferedInputStream S=new BufferedInputStream(new FileInputStream(F));
      S.read(b);
      S.close();
      logger.log(Level.INFO,"String_Node_Str");
      String[] re=str_replace("String_Node_Str","String_Node_Str",str_replace("String_Node_Str","String_Node_Str",new String(b))).split("String_Node_Str");
      for (int i=0; i < re.length; i++) {
        if (re[i].startsWith("String_Node_Str"))         re[i]=null;
 else {
          for (int g=0; g < re.length; g++) {
            if (i == g)             continue;
            if (re[i].equalsIgnoreCase(re[g])) {
              re[i]=null;
              break;
            }
          }
        }
      }
      return re;
    }
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,ex.getMessage());
    return new String[0];
  }
}
Program: 32944
Project: 32944
Buggy source:
private InputStream getStream(String URL,Boolean CheckPNG,long last){
  boolean success=false;
  try {
    URL U=new URL(URL);
    C=(HttpURLConnection)U.openConnection();
    C.setDoInput(true);
    C.setDoOutput(false);
    if (last > 0)     C.setIfModifiedSince(last);
    C.connect();
    logger.info("String_Node_Str" + C.getResponseCode());
    int respcode=C.getResponseCode() / 100;
    if (respcode != 4 && respcode != 5) {
      if (C.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) {
        logger.info("String_Node_Str");
        return null;
      }
      if (C.getContentLength() <= 0) {
        return null;
      }
      InputStream IS=new BufferedInputStream(C.getInputStream());
      if (!CheckPNG) {
        success=true;
        return IS;
      }
      IS.mark(C.getContentLength() + 10);
      byte[] ib=new byte[4];
      IS.read(ib);
      if (ib[1] == (byte)'P' && ib[2] == (byte)'N' && ib[3] == (byte)'G') {
        IS.reset();
        success=true;
        return IS;
      }
    }
  }
 catch (  Exception ex) {
    success=false;
    logger.log(Level.WARNING,ex.getMessage());
  }
 finally {
    if (!success)     disconnect();
  }
  return null;
}

Fixed version (ground truth):
private InputStream getStream(String URL,Boolean CheckPNG,long last){
  boolean success=false;
  try {
    URL U=new URL(URL);
    C=(HttpURLConnection)U.openConnection();
    C.setDoInput(true);
    C.setDoOutput(false);
    if (last > 0)     C.setIfModifiedSince(last);
    C.connect();
    logger.info("String_Node_Str" + C.getResponseCode());
    int respcode=C.getResponseCode() / 100;
    if (respcode != 4 && respcode != 5) {
      if (C.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) {
        logger.info("String_Node_Str");
        loadFromCache=true;
        return null;
      }
      if (C.getContentLength() <= 0) {
        return null;
      }
      InputStream IS=new BufferedInputStream(C.getInputStream());
      if (!CheckPNG) {
        success=true;
        return IS;
      }
      IS.mark(C.getContentLength() + 10);
      byte[] ib=new byte[4];
      IS.read(ib);
      if (ib[1] == (byte)'P' && ib[2] == (byte)'N' && ib[3] == (byte)'G') {
        IS.reset();
        success=true;
        return IS;
      }
    }
  }
 catch (  Exception ex) {
    success=false;
    logger.log(Level.WARNING,ex.getMessage());
  }
 finally {
    if (!success)     disconnect();
  }
  return null;
}
Program: 32946
Project: 32946
Buggy source:
public static void showGUI(){
  File a=new File(DATA_DIR,"String_Node_Str");
  if (!a.exists() || a.length() < 1) {
    a.delete();
    logger.info("String_Node_Str" + a.getAbsolutePath());
    downloadFile("String_Node_Str",a);
  }
  try {
    String toRun="String_Node_Str" + a.getAbsolutePath() + "String_Node_Str"+ VERSION;
    logger.info("String_Node_Str" + toRun);
    Runtime.getRuntime().exec(toRun);
  }
 catch (  Exception e) {
    logger.warning(e.getMessage());
  }
}

Fixed version (ground truth):
public static void showGUI(){
  try {
    Class clazz=Class.forName("String_Node_Str");
    String[] arg={"String_Node_Str",VERSION,"String_Node_Str"};
    CustomSkinLoaderGUI.main(arg);
    return;
  }
 catch (  Exception e) {
    logger.warning(e.getMessage());
  }
  File a=new File(DATA_DIR,"String_Node_Str");
  if (!a.exists() || a.length() < 1) {
    a.delete();
    logger.info("String_Node_Str" + a.getAbsolutePath());
    downloadFile("String_Node_Str",a);
  }
  try {
    String toRun="String_Node_Str" + a.getAbsolutePath() + "String_Node_Str"+ VERSION;
    logger.info("String_Node_Str" + toRun);
    Runtime.getRuntime().exec(toRun);
  }
 catch (  Exception e) {
    logger.warning(e.getMessage());
  }
}
Program: 32947
Project: 32947
Buggy source:
private InputStream getStream(String URL,Boolean CheckPNG){
  try {
    URL U=new URL(URL);
    C=(HttpURLConnection)U.openConnection();
    C.setDoInput(true);
    C.setDoOutput(false);
    C.connect();
    int respcode=C.getResponseCode() / 100;
    if (respcode != 4 && respcode != 5) {
      BufferedInputStream IS=new BufferedInputStream(C.getInputStream());
      if (!CheckPNG)       return IS;
      IS.mark(0);
      byte[] ib=new byte[4];
      IS.read(ib);
      if (ib[1] == (byte)'P' && ib[2] == (byte)'N' && ib[3] == (byte)'G') {
        IS.reset();
        return IS;
      }
    }
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,ex.getMessage());
  }
 finally {
    disconnect();
  }
  return null;
}

Fixed version (ground truth):
private InputStream getStream(String URL,Boolean CheckPNG,long last){
  boolean success=false;
  try {
    URL U=new URL(URL);
    C=(HttpURLConnection)U.openConnection();
    C.setDoInput(true);
    C.setDoOutput(false);
    if (last > 0)     C.setIfModifiedSince(last);
    C.connect();
    logger.info("String_Node_Str" + C.getResponseCode());
    int respcode=C.getResponseCode() / 100;
    if (respcode != 4 && respcode != 5) {
      if (C.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) {
        logger.info("String_Node_Str");
        loadFromCache=true;
        return null;
      }
      if (C.getContentLength() <= 0) {
        return null;
      }
      InputStream IS=new BufferedInputStream(C.getInputStream());
      if (!CheckPNG) {
        success=true;
        return IS;
      }
      IS.mark(C.getContentLength() + 10);
      byte[] ib=new byte[4];
      IS.read(ib);
      if (ib[1] == (byte)'P' && ib[2] == (byte)'N' && ib[3] == (byte)'G') {
        IS.reset();
        success=true;
        return IS;
      }
    }
  }
 catch (  Exception ex) {
    success=false;
    logger.log(Level.WARNING,ex.getMessage());
  }
 finally {
    if (!success)     disconnect();
  }
  return null;
}
Program: 32948
Project: 32948
Buggy source:
private static void refreshSkinURL(){
  try {
    File mcdir=Minecraft.getMinecraft().mcDataDir;
    skinURLs=readAllLines(mcdir,"String_Node_Str");
    cloakURLs=readAllLines(mcdir,"String_Node_Str");
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,ex.getMessage());
  }
 finally {
    if (skinURLs.length == 0 && cloakURLs.length == 0) {
      logger.info("String_Node_Str");
      showGUI();
    }
 else {
      logger.log(Level.INFO,"String_Node_Str" + skinURLs.length + "String_Node_Str"+ cloakURLs.length);
    }
  }
}

Fixed version (ground truth):
private static void refreshSkinURL(){
  try {
    skinURLs=readAllLines(DATA_DIR,"String_Node_Str");
    cloakURLs=readAllLines(DATA_DIR,"String_Node_Str");
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,ex.getMessage());
  }
 finally {
    if (skinURLs.length == 0 && cloakURLs.length == 0) {
      logger.info("String_Node_Str");
      showGUI();
    }
 else {
      logger.log(Level.INFO,"String_Node_Str" + skinURLs.length + "String_Node_Str"+ cloakURLs.length);
    }
  }
}
Program: 32949
Project: 32949
Buggy source:
private static String[] readAllLines(File mcdir,String path){
  try {
    File F=new File(mcdir,path);
    logger.log(Level.INFO,"String_Node_Str" + F.getAbsolutePath());
    if (!F.exists()) {
      logger.log(Level.INFO,"String_Node_Str");
      return new String[0];
    }
 else     if (F.length() <= 0) {
      logger.log(Level.INFO,"String_Node_Str");
      return new String[0];
    }
 else {
      byte[] b=new byte[(int)F.length()];
      BufferedInputStream S=new BufferedInputStream(new FileInputStream(F));
      S.read(b);
      S.close();
      logger.log(Level.INFO,"String_Node_Str");
      String[] re=str_replace("String_Node_Str","String_Node_Str",str_replace("String_Node_Str","String_Node_Str",new String(b))).split("String_Node_Str");
      for (int i=0; i < re.length; i++) {
        if (re[i].startsWith("String_Node_Str"))         re[i]=null;
 else {
          for (int g=0; g < re.length; g++) {
            if (i == g)             continue;
            if (re[i].equalsIgnoreCase(re[g])) {
              re[i]=null;
              break;
            }
          }
        }
      }
      return re;
    }
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,ex.getMessage());
    return new String[0];
  }
}

Fixed version (ground truth):
private static String[] readAllLines(File dir,String path){
  try {
    File F=new File(dir,path);
    logger.log(Level.INFO,"String_Node_Str" + F.getAbsolutePath());
    if (!F.exists()) {
      logger.log(Level.INFO,"String_Node_Str");
      return new String[0];
    }
 else     if (F.length() <= 0) {
      logger.log(Level.INFO,"String_Node_Str");
      return new String[0];
    }
 else {
      byte[] b=new byte[(int)F.length()];
      BufferedInputStream S=new BufferedInputStream(new FileInputStream(F));
      S.read(b);
      S.close();
      logger.log(Level.INFO,"String_Node_Str");
      String[] re=str_replace("String_Node_Str","String_Node_Str",str_replace("String_Node_Str","String_Node_Str",new String(b))).split("String_Node_Str");
      for (int i=0; i < re.length; i++) {
        if (re[i].startsWith("String_Node_Str"))         re[i]=null;
 else {
          for (int g=0; g < re.length; g++) {
            if (i == g)             continue;
            if (re[i].equalsIgnoreCase(re[g])) {
              re[i]=null;
              break;
            }
          }
        }
      }
      return re;
    }
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,ex.getMessage());
    return new String[0];
  }
}
Program: 32950
Project: 32950
Buggy source:
public void log(Level level,String msg){
  if (level.intValue() >= LOWEST_DISPLAY_LEVEL)   System.out.println(msg);
  try {
    writer.write("String_Node_Str");
    writer.write(DATE_FORMAT.format(new Date()));
    writer.write("String_Node_Str");
    writer.write(level.getName());
    writer.write("String_Node_Str");
    writer.write(msg);
    writer.write("String_Node_Str");
    writer.flush();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void log(Level level,String msg){
  if (level.intValue() >= LOWEST_DISPLAY_LEVEL)   System.out.println(msg);
  try {
    writer.write("String_Node_Str");
    writer.write(DATE_FORMAT.format(new Date()));
    writer.write("String_Node_Str");
    writer.write(Thread.currentThread().getName());
    writer.write("String_Node_Str");
    writer.write(level.getName());
    writer.write("String_Node_Str");
    writer.write(msg);
    writer.write("String_Node_Str");
    writer.flush();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 32951
Project: 32951
Buggy source:
public void warning(String msg){
  log(Level.WARNING,msg);
}

Fixed version (ground truth):
public void warning(Exception e){
  log(Level.WARNING,"String_Node_Str" + e.getMessage());
  StackTraceElement[] stes=e.getStackTrace();
  for (  StackTraceElement ste : stes) {
    log(Level.WARNING,ste.toString());
  }
  log(Level.WARNING,"String_Node_Str");
}
Program: 32952
Project: 32952
Buggy source:
public void loadTexture(IResourceManager par1ResourceManager) throws IOException {
  if (this.bufferedImage == null && this.textureLocation != null) {
    super.loadTexture(par1ResourceManager);
  }
  if (this.imageThread == null) {
    this.imageThread=new Thread("String_Node_Str" + field_147643_d.incrementAndGet()){
      private static final String __OBFID="String_Node_Str";
      public void run(){
        try {
          BufferedImage var2=ImageIO.read(ThreadDownloadImageData.this.customSkinLoader.getPlayerSkinStream(ThreadDownloadImageData.this.imageUrl));
          if (ThreadDownloadImageData.this.imageBuffer != null) {
            var2=ThreadDownloadImageData.this.imageBuffer.parseUserSkin(var2);
          }
          ThreadDownloadImageData.this.func_147641_a(var2);
        }
 catch (        Exception var6) {
          ThreadDownloadImageData.logger.error("String_Node_Str",var6);
          return;
        }
      }
    }
;
    this.imageThread.setDaemon(true);
    this.imageThread.setName("String_Node_Str" + this.imageUrl);
    this.imageThread.start();
  }
}

Fixed version (ground truth):
public void loadTexture(IResourceManager par1ResourceManager) throws IOException {
  if (this.bufferedImage == null && this.textureLocation != null) {
    super.loadTexture(par1ResourceManager);
  }
  if (this.imageThread == null) {
    this.imageThread=new Thread("String_Node_Str" + field_147643_d.incrementAndGet()){
      private static final String __OBFID="String_Node_Str";
      public void run(){
        try {
          BufferedImage var2=ImageIO.read(ThreadDownloadImageData.this.customSkinLoader.getPlayerSkinStream(ThreadDownloadImageData.this.imageUrl));
          if (ThreadDownloadImageData.this.imageBuffer != null) {
            var2=ThreadDownloadImageData.this.imageBuffer.parseUserSkin(var2);
          }
          ThreadDownloadImageData.this.func_147641_a(var2);
          customSkinLoader.disconnect();
        }
 catch (        Exception var6) {
          ThreadDownloadImageData.logger.error("String_Node_Str",var6);
          return;
        }
      }
    }
;
    this.imageThread.setDaemon(true);
    this.imageThread.start();
  }
}
Program: 32953
Project: 32953
Buggy source:
public void run(){
  try {
    BufferedImage var2=ImageIO.read(ThreadDownloadImageData.this.customSkinLoader.getPlayerSkinStream(ThreadDownloadImageData.this.imageUrl));
    if (ThreadDownloadImageData.this.imageBuffer != null) {
      var2=ThreadDownloadImageData.this.imageBuffer.parseUserSkin(var2);
    }
    ThreadDownloadImageData.this.func_147641_a(var2);
  }
 catch (  Exception var6) {
    ThreadDownloadImageData.logger.error("String_Node_Str",var6);
    return;
  }
}

Fixed version (ground truth):
public void run(){
  try {
    BufferedImage var2=ImageIO.read(ThreadDownloadImageData.this.customSkinLoader.getPlayerSkinStream(ThreadDownloadImageData.this.imageUrl));
    if (ThreadDownloadImageData.this.imageBuffer != null) {
      var2=ThreadDownloadImageData.this.imageBuffer.parseUserSkin(var2);
    }
    ThreadDownloadImageData.this.func_147641_a(var2);
    customSkinLoader.disconnect();
  }
 catch (  Exception var6) {
    ThreadDownloadImageData.logger.error("String_Node_Str",var6);
    return;
  }
}
Program: 32954
Project: 32954
Buggy source:
@Override public void showIdentifierCreatedSuccessfully(){
  Toast.makeText(getActivity(),R.string.identifier_created_successfully,Toast.LENGTH_SHORT).show();
  getDialog().dismiss();
}

Fixed version (ground truth):
@Override public void showIdentifierCreatedSuccessfully(){
  Toast.makeText(getActivity(),R.string.identifier_created_successfully,Toast.LENGTH_SHORT).show();
  getDialog().dismiss();
  ((ClientIdentifiersFragment)getTargetFragment()).doRefresh();
}
Program: 32955
Project: 32955
Buggy source:
@Override public void showClientIdentifiers(List<Identifier> identifiers){
  this.identifiers=identifiers;
  identifierListAdapter.setIdentifiers(identifiers);
}

Fixed version (ground truth):
@Override public void showClientIdentifiers(List<Identifier> identifiers){
  if (llError.getVisibility() == View.VISIBLE) {
    llError.setVisibility(View.GONE);
  }
  this.identifiers=identifiers;
  identifierListAdapter.setIdentifiers(identifiers);
}
Program: 32956
Project: 32956
Buggy source:
@Override public void showEmptyClientIdentifier(){
  ll_error.setVisibility(View.VISIBLE);
  mNoIdentifierText.setText(getResources().getString(R.string.no_identifier_to_show));
  mNoIdentifierIcon.setImageResource(R.drawable.ic_assignment_turned_in_black_24dp);
}

Fixed version (ground truth):
@Override public void showEmptyClientIdentifier(){
  llError.setVisibility(View.VISIBLE);
  mNoIdentifierText.setText(getResources().getString(R.string.no_identifier_to_show));
  mNoIdentifierIcon.setImageResource(R.drawable.ic_assignment_turned_in_black_24dp);
}
Program: 32957
Project: 32957
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_add:
    IdentifierDialogFragment identifierDialogFragment=IdentifierDialogFragment.newInstance(clientId);
  FragmentTransaction fragmentTransaction=getActivity().getSupportFragmentManager().beginTransaction();
fragmentTransaction.addToBackStack(FragmentConstants.FRAG_DOCUMENT_LIST);
identifierDialogFragment.show(fragmentTransaction,"String_Node_Str");
break;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_add:
    IdentifierDialogFragment identifierDialogFragment=IdentifierDialogFragment.newInstance(clientId);
  identifierDialogFragment.setTargetFragment(this,1);
FragmentTransaction fragmentTransaction=getActivity().getSupportFragmentManager().beginTransaction();
fragmentTransaction.addToBackStack(FragmentConstants.FRAG_DOCUMENT_LIST);
identifierDialogFragment.show(fragmentTransaction,"String_Node_Str");
break;
}
return super.onOptionsItemSelected(item);
}
Program: 32958
Project: 32958
Buggy source:
public void loadIdentifiers(int clientId){
  checkViewAttached();
  getMvpView().showProgressbar(true);
  mSubscriptions.add(mDataManagerClient.getClientIdentifiers(clientId).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()).subscribe(new Subscriber<List<Identifier>>(){
    @Override public void onCompleted(){
      getMvpView().showProgressbar(false);
    }
    @Override public void onError(    Throwable e){
      getMvpView().showProgressbar(false);
      getMvpView().showFetchingError(R.string.failed_to_fetch_identifier);
    }
    @Override public void onNext(    List<Identifier> identifiers){
      getMvpView().showProgressbar(false);
      if (!identifiers.isEmpty()) {
        getMvpView().showClientIdentifiers(identifiers);
      }
 else {
        getMvpView().showEmptyClientIdentifier();
      }
    }
  }
));
}

Fixed version (ground truth):
public void loadIdentifiers(int clientId){
  checkViewAttached();
  getMvpView().showProgressbar(true);
  mSubscriptions.add(mDataManagerClient.getClientIdentifiers(clientId).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()).subscribe(new Subscriber<List<Identifier>>(){
    @Override public void onCompleted(){
      getMvpView().showProgressbar(false);
    }
    @Override public void onError(    Throwable e){
      getMvpView().showProgressbar(false);
      getMvpView().showFetchingError(R.string.failed_to_fetch_identifier);
    }
    @Override public void onNext(    List<Identifier> identifiers){
      getMvpView().showProgressbar(false);
      getMvpView().showClientIdentifiers(identifiers);
      if (identifiers.isEmpty()) {
        getMvpView().showEmptyClientIdentifier();
      }
    }
  }
));
}
Program: 32960
Project: 32960
Buggy source:
private String getErrorMessage(Menu menu,View view){
  String NEW_LINE=System.getProperty("String_Node_Str");
  StringBuilder errorMessage=new StringBuilder(20).append("String_Node_Str").append(NEW_LINE);
  for (int position=0; position < menu.size(); position++) {
    errorMessage.append("String_Node_Str").append(position);
    MenuItem menuItem=menu.getItem(position);
    if (menuItem != null) {
      CharSequence itemTitle=menuItem.getTitle();
      if (itemTitle != null) {
        errorMessage.append("String_Node_Str").append(itemTitle);
      }
      if (view.getResources() != null) {
        int itemId=menuItem.getItemId();
        try {
          errorMessage.append("String_Node_Str");
          String menuItemResourceName=view.getResources().getResourceName(itemId);
          errorMessage.append(menuItemResourceName);
        }
 catch (        NotFoundException nfe) {
          errorMessage.append("String_Node_Str");
        }
      }
      errorMessage.append(NEW_LINE);
    }
  }
  return errorMessage.toString();
}

Fixed version (ground truth):
private String getErrorMessage(Menu menu,View view){
  String NEW_LINE=System.getProperty("String_Node_Str");
  StringBuilder errorMessage=new StringBuilder(66).append("String_Node_Str").append(NEW_LINE);
  for (int position=0; position < menu.size(); position++) {
    errorMessage.append("String_Node_Str").append(position);
    MenuItem menuItem=menu.getItem(position);
    if (menuItem != null) {
      CharSequence itemTitle=menuItem.getTitle();
      if (itemTitle != null) {
        errorMessage.append("String_Node_Str").append(itemTitle);
      }
      if (view.getResources() != null) {
        int itemId=menuItem.getItemId();
        try {
          errorMessage.append("String_Node_Str");
          String menuItemResourceName=view.getResources().getResourceName(itemId);
          errorMessage.append(menuItemResourceName);
        }
 catch (        NotFoundException nfe) {
          errorMessage.append("String_Node_Str");
        }
      }
      errorMessage.append(NEW_LINE);
    }
  }
  return errorMessage.toString();
}
Program: 32961
Project: 32961
Buggy source:
public void loadLoanDataTables(){
  DataTableFragment loanAccountFragment=DataTableFragment.newInstance(Constants.DATA_TABLE_NAME_LOANS,loanAccountNumber);
  FragmentTransaction fragmentTransaction=getActivity().getSupportFragmentManager().beginTransaction();
  fragmentTransaction.addToBackStack(FragmentConstants.FRAG_LOAN_ACCOUNT_SUMMARY);
  fragmentTransaction.replace(R.id.container,loanAccountFragment);
  fragmentTransaction.commit();
}

Fixed version (ground truth):
public void loadLoanDataTables(){
  DataTableFragment loanAccountFragment=DataTableFragment.newInstance(Constants.DATA_TABLE_NAME_LOANS,loanAccountNumber);
  FragmentTransaction fragmentTransaction=getActivity().getSupportFragmentManager().beginTransaction();
  fragmentTransaction.addToBackStack(FragmentConstants.FRAG_LOAN_ACCOUNT_SUMMARY);
  fragmentTransaction.replace(container,loanAccountFragment);
  fragmentTransaction.commit();
}
Program: 32962
Project: 32962
Buggy source:
public boolean isRecurring(){
  return this.getDepositType() == null ? false : this.getDepositType().isRecurring();
}

Fixed version (ground truth):
public boolean isRecurring(){
  return this.getDepositType() != null && this.getDepositType().isRecurring();
}
Program: 32963
Project: 32963
Buggy source:
@Override public void showCenterDetails(CenterWithAssociations centerWithAssociations){
  setToolbarTitle(centerWithAssociations.getName());
  if (!centerWithAssociations.getActivationDate().isEmpty()) {
    tvStaffName.setText(centerWithAssociations.getStaffName());
    tvActivationDate.setText(Utils.getStringOfDate(getContext(),centerWithAssociations.getActivationDate()));
  }
}

Fixed version (ground truth):
@Override public void showCenterDetails(CenterWithAssociations centerWithAssociations){
  setToolbarTitle(centerWithAssociations.getName());
  if (!centerWithAssociations.getActivationDate().isEmpty()) {
    tvStaffName.setText(centerWithAssociations.getStaffName());
    tvActivationDate.setText(Utils.getStringOfDate(centerWithAssociations.getActivationDate()));
  }
}
Program: 32964
Project: 32964
Buggy source:
@Override public void showMeetingDetails(CenterWithAssociations centerWithAssociations){
  if (!centerWithAssociations.getActive()) {
    llBottomPanel.setVisibility(View.VISIBLE);
    showErrorMessage(R.string.error_center_inactive);
  }
  if (centerWithAssociations.getCollectionMeetingCalendar().getCalendarInstanceId() == null) {
    tvMeetingDate.setText(getString(R.string.unassigned));
    if (getView() != null) {
      getView().findViewById(R.id.row_meeting_frequency).setVisibility(View.GONE);
    }
  }
 else {
    tvMeetingDate.setText(Utils.getStringOfDate(getContext(),centerWithAssociations.getCollectionMeetingCalendar().getNextTenRecurringDates().get(0)));
    if (getView() != null) {
      getView().findViewById(R.id.row_meeting_frequency).setVisibility(View.VISIBLE);
      tvMeetingFrequency.setText(centerWithAssociations.getCollectionMeetingCalendar().getHumanReadable());
    }
  }
}

Fixed version (ground truth):
@Override public void showMeetingDetails(CenterWithAssociations centerWithAssociations){
  if (!centerWithAssociations.getActive()) {
    llBottomPanel.setVisibility(View.VISIBLE);
    showErrorMessage(R.string.error_center_inactive);
  }
  if (centerWithAssociations.getCollectionMeetingCalendar().getCalendarInstanceId() == null) {
    tvMeetingDate.setText(getString(R.string.unassigned));
    if (getView() != null) {
      getView().findViewById(R.id.row_meeting_frequency).setVisibility(View.GONE);
    }
  }
 else {
    tvMeetingDate.setText(Utils.getStringOfDate(centerWithAssociations.getCollectionMeetingCalendar().getNextTenRecurringDates().get(0)));
    if (getView() != null) {
      getView().findViewById(R.id.row_meeting_frequency).setVisibility(View.VISIBLE);
      tvMeetingFrequency.setText(centerWithAssociations.getCollectionMeetingCalendar().getHumanReadable());
    }
  }
}
Program: 32966
Project: 32966
Buggy source:
@Override public void showGroup(Group group){
  if (group != null) {
    if (!group.getActive()) {
      llBottomPanel.setVisibility(VISIBLE);
    }
    setToolbarTitle(getString(R.string.group) + "String_Node_Str" + group.getName());
    tv_fullName.setText(group.getName());
    tv_externalId.setText(group.getExternalId());
    try {
      String dateString=Utils.getStringOfDate(getActivity(),group.getActivationDate());
      tv_activationDate.setText(dateString);
      if (TextUtils.isEmpty(dateString))       rowActivation.setVisibility(GONE);
    }
 catch (    IndexOutOfBoundsException e) {
      Toast.makeText(getActivity(),getString(R.string.error_group_inactive),Toast.LENGTH_SHORT).show();
      tv_activationDate.setText("String_Node_Str");
    }
    tv_office.setText(group.getOfficeName());
    if (TextUtils.isEmpty(group.getOfficeName()))     rowOffice.setVisibility(GONE);
  }
}

Fixed version (ground truth):
@Override public void showGroup(Group group){
  if (group != null) {
    if (!group.getActive()) {
      llBottomPanel.setVisibility(VISIBLE);
    }
    setToolbarTitle(getString(R.string.group) + "String_Node_Str" + group.getName());
    tv_fullName.setText(group.getName());
    tv_externalId.setText(group.getExternalId());
    try {
      String dateString=Utils.getStringOfDate(group.getActivationDate());
      tv_activationDate.setText(dateString);
      if (TextUtils.isEmpty(dateString))       rowActivation.setVisibility(GONE);
    }
 catch (    IndexOutOfBoundsException e) {
      Toast.makeText(getActivity(),getString(R.string.error_group_inactive),Toast.LENGTH_SHORT).show();
      tv_activationDate.setText("String_Node_Str");
    }
    tv_office.setText(group.getOfficeName());
    if (TextUtils.isEmpty(group.getOfficeName()))     rowOffice.setVisibility(GONE);
  }
}
Program: 32967
Project: 32967
Buggy source:
/** 
 * This Method Converting the List<Integer> of Activation Date to String.
 * @param context Context
 * @param dateObj List<Integer> of Date
 * @return
 */
public static String getStringOfDate(Context context,List<Integer> dateObj){
  SimpleDateFormat simpleDateFormat=new SimpleDateFormat("String_Node_Str",context.getResources().getConfiguration().locale);
  Date date=null;
  try {
    date=simpleDateFormat.parse(DateHelper.getDateAsString(dateObj));
  }
 catch (  ParseException e) {
    Log.d(LOG_TAG,e.getLocalizedMessage());
  }
  DateFormat df=DateFormat.getDateInstance(DateFormat.MEDIUM);
  return df.format(date);
}

Fixed version (ground truth):
/** 
 * This Method Converting the List<Integer> of Activation Date to String.
 * @param dateObj List<Integer> of Date
 * @return
 */
public static String getStringOfDate(List<Integer> dateObj){
  Calendar calendar=Calendar.getInstance();
  calendar.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  calendar.set(Calendar.YEAR,dateObj.get(0));
  calendar.set(Calendar.MONTH,dateObj.get(1) - 1);
  calendar.set(Calendar.DAY_OF_MONTH,dateObj.get(2));
  DateFormat df=DateFormat.getDateInstance(DateFormat.MEDIUM);
  return df.format(calendar.getTime());
}
Program: 32968
Project: 32968
Buggy source:
@Override public void onScrolled(RecyclerView recyclerView,int dx,int dy){
  super.onScrolled(recyclerView,dx,dy);
  visibleItemCount=recyclerView.getChildCount();
  totalItemCount=mLinearLayoutManager.getItemCount();
  firstVisibleItem=mLinearLayoutManager.findFirstVisibleItemPosition();
  if (loading && (totalItemCount > previousTotal + 1)) {
    loading=false;
    previousTotal=totalItemCount;
  }
  if (!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold)) {
    current_page++;
    onLoadMore(current_page);
    loading=true;
  }
}

Fixed version (ground truth):
@Override public void onScrolled(RecyclerView recyclerView,int dx,int dy){
  super.onScrolled(recyclerView,dx,dy);
  visibleItemCount=recyclerView.getChildCount();
  totalItemCount=mLinearLayoutManager.getItemCount();
  if (previousTotal > totalItemCount) {
    previousTotal=0;
  }
  firstVisibleItem=mLinearLayoutManager.findFirstVisibleItemPosition();
  if (loading && (totalItemCount > previousTotal + 1)) {
    loading=false;
    previousTotal=totalItemCount;
  }
  if (!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold)) {
    current_page++;
    onLoadMore(current_page);
    loading=true;
  }
}