Program: 163642
Project: 163642
Buggy source:
@Override protected Object doInBackground() throws Exception {
  String hostOs=getOsString();
  File modeFolder=new File(Base.getSketchbookModesFolder() + "String_Node_Str");
  File sdkFolder=new File(modeFolder,"String_Node_Str");
  if (!sdkFolder.exists())   sdkFolder.mkdir();
  File platformsFolder=new File(sdkFolder,"String_Node_Str");
  if (!platformsFolder.exists())   platformsFolder.mkdir();
  File buildToolsFolder=new File(sdkFolder,"String_Node_Str");
  if (!buildToolsFolder.exists())   buildToolsFolder.mkdir();
  File tempFolder=new File(modeFolder,"String_Node_Str");
  if (!tempFolder.exists())   tempFolder.mkdir();
  try {
    SDKUrlHolder downloadUrls=getDownloadUrls(URL_REPOSITORY,hostOs);
    firePropertyChange(PROPERTY_CHANGE_EVENT_TOTAL,0,downloadUrls.totalSize);
    totalSize=downloadUrls.totalSize;
    File downloadedTools=new File(tempFolder,downloadUrls.toolsFilename);
    downloadAndUnpack(downloadUrls.toolsUrl,downloadedTools,sdkFolder);
    File downloadedPlatformTools=new File(tempFolder,downloadUrls.platformToolsFilename);
    downloadAndUnpack(downloadUrls.platformToolsUrl,downloadedPlatformTools,sdkFolder);
    File downloadedBuildTools=new File(tempFolder,downloadUrls.buildToolsFilename);
    downloadAndUnpack(downloadUrls.buildToolsUrl,downloadedBuildTools,buildToolsFolder);
    File downloadedPlatform=new File(tempFolder,downloadUrls.platformFilename);
    downloadAndUnpack(downloadUrls.platformUrl,downloadedPlatform,platformsFolder);
    if (Base.isLinux() || Base.isMacOS()) {
      Runtime.getRuntime().exec("String_Node_Str" + sdkFolder.getAbsolutePath());
    }
    tempFolder.delete();
    Base.getPlatform().setenv("String_Node_Str",sdkFolder.getAbsolutePath());
    androidMode.loadSDK();
  }
 catch (  ParserConfigurationException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
catch (  SAXException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
@Override protected Object doInBackground() throws Exception {
  String hostOs=getOsString();
  File modeFolder=new File(Base.getSketchbookModesFolder() + "String_Node_Str");
  File sdkFolder=new File(modeFolder,"String_Node_Str");
  if (!sdkFolder.exists())   sdkFolder.mkdir();
  File platformsFolder=new File(sdkFolder,"String_Node_Str");
  if (!platformsFolder.exists())   platformsFolder.mkdir();
  File buildToolsFolder=new File(sdkFolder,"String_Node_Str");
  if (!buildToolsFolder.exists())   buildToolsFolder.mkdir();
  File tempFolder=new File(modeFolder,"String_Node_Str");
  if (!tempFolder.exists())   tempFolder.mkdir();
  try {
    SDKUrlHolder downloadUrls=getDownloadUrls(URL_REPOSITORY,hostOs);
    firePropertyChange(PROPERTY_CHANGE_EVENT_TOTAL,0,downloadUrls.totalSize);
    totalSize=downloadUrls.totalSize;
    File downloadedTools=new File(tempFolder,downloadUrls.toolsFilename);
    downloadAndUnpack(downloadUrls.toolsUrl,downloadedTools,sdkFolder);
    File downloadedPlatformTools=new File(tempFolder,downloadUrls.platformToolsFilename);
    downloadAndUnpack(downloadUrls.platformToolsUrl,downloadedPlatformTools,sdkFolder);
    File downloadedBuildTools=new File(tempFolder,downloadUrls.buildToolsFilename);
    downloadAndUnpack(downloadUrls.buildToolsUrl,downloadedBuildTools,buildToolsFolder);
    File downloadedPlatform=new File(tempFolder,downloadUrls.platformFilename);
    downloadAndUnpack(downloadUrls.platformUrl,downloadedPlatform,platformsFolder);
    if (Base.isLinux() || Base.isMacOS()) {
      Runtime.getRuntime().exec("String_Node_Str" + sdkFolder.getAbsolutePath());
    }
    tempFolder.delete();
    Base.getPlatform().setenv("String_Node_Str",sdkFolder.getAbsolutePath());
    Preferences.set("String_Node_Str",sdkFolder.getAbsolutePath());
    androidMode.loadSDK();
  }
 catch (  ParserConfigurationException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
catch (  SAXException e) {
    e.printStackTrace();
  }
  return null;
}