Program: 20726
Project: 20726
Buggy source:
public void handle(){
  final String request=this.headers.get(null);
  final String[] requ=request.split("String_Node_Str");
  final String cPath=requ[1];
  String path, querry;
  path=cPath.substring(1);
  String[] params;
  final HashMap<String,String> requestParameter=new HashMap<String,String>();
  requestParameter.put("String_Node_Str","String_Node_Str");
  requestParameter.put("String_Node_Str","String_Node_Str");
  requestParameter.put("String_Node_Str","String_Node_Str");
  requestParameter.put("String_Node_Str","String_Node_Str");
  if (cPath.indexOf("String_Node_Str") >= 0) {
    querry=cPath.substring(cPath.indexOf("String_Node_Str") + 1);
    path=cPath.substring(1,cPath.indexOf("String_Node_Str"));
    params=querry.split("String_Node_Str");
    for (    String entry : params) {
      entry=entry.trim();
      final int index=entry.indexOf("String_Node_Str");
      String key=entry;
      String value=null;
      if (index >= 0) {
        key=entry.substring(0,index);
        value=entry.substring(index + 1);
      }
      if (requestParameter.containsKey(key) || requestParameter.containsKey(key + "String_Node_Str")) {
        if (requestParameter.containsKey(key + "String_Node_Str")) {
          Integer keycounter=0;
          keycounter=Formatter.filterInt(requestParameter.get(key + "String_Node_Str"));
          keycounter++;
          requestParameter.put(key + "String_Node_Str",keycounter.toString());
          requestParameter.put(key + "String_Node_Str" + keycounter.toString(),value);
        }
      }
 else {
        requestParameter.put(key,value);
      }
    }
  }
  String url=path.replaceAll("String_Node_Str","String_Node_Str");
  if (requestParameter.containsKey("String_Node_Str")) {
    if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      if (requestParameter.containsKey("String_Node_Str")) {
        int setspeed=Formatter.filterInt(requestParameter.get("String_Node_Str"));
        if (setspeed < 0) {
          setspeed=0;
        }
        SubConfiguration.getConfig("String_Node_Str").setProperty(Configuration.PARAM_DOWNLOAD_MAX_SPEED,setspeed);
      }
      if (requestParameter.containsKey("String_Node_Str")) {
        int maxdls=Formatter.filterInt(requestParameter.get("String_Node_Str"));
        if (maxdls < 1) {
          maxdls=1;
        }
        if (maxdls > 20) {
          maxdls=20;
        }
        SubConfiguration.getConfig("String_Node_Str").setProperty(Configuration.PARAM_DOWNLOAD_MAX_SIMULTAN,maxdls);
      }
      if (!requestParameter.containsKey("String_Node_Str")) {
        if (requestParameter.containsKey("String_Node_Str")) {
          JDUtilities.getConfiguration().setProperty(Configuration.PARAM_ALLOW_RECONNECT,true);
        }
 else {
          JDUtilities.getConfiguration().setProperty(Configuration.PARAM_ALLOW_RECONNECT,false);
        }
      }
      if (requestParameter.containsKey("String_Node_Str")) {
synchronized (LinkGrabberController.ControllerLock) {
synchronized (this.lgi.getPackages()) {
            Integer download_id=0;
            Integer package_id=0;
            String[] ids;
            final int counter_max=Formatter.filterInt(requestParameter.get("String_Node_Str"));
            int counter_index=0;
            DownloadLink link;
            ArrayList<DownloadLink> links=new ArrayList<DownloadLink>();
            final ArrayList<LinkGrabberFilePackage> packages=new ArrayList<LinkGrabberFilePackage>();
            for (counter_index=1; counter_index <= counter_max; counter_index++) {
              if (requestParameter.containsKey("String_Node_Str" + counter_index)) {
                ids=requestParameter.get("String_Node_Str" + counter_index).toString().split("String_Node_Str",2);
                package_id=Formatter.filterInt(ids[0].toString());
                download_id=Formatter.filterInt(ids[1].toString());
                links.add(this.lgi.getPackages().get(package_id).get(download_id));
                if (!packages.contains(this.lgi.getPackages().get(package_id))) {
                  packages.add(this.lgi.getPackages().get(package_id));
                }
              }
            }
            if (requestParameter.containsKey("String_Node_Str")) {
              final String dowhat=requestParameter.get("String_Node_Str");
              for (int i=0; i < this.lgi.getPackages().size(); i++) {
                if (requestParameter.containsKey("String_Node_Str" + i)) {
                  this.lgi.getPackages().get(i).setName(Encoding.htmlDecode(requestParameter.get("String_Node_Str" + i).toString()));
                }
              }
              if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
                for (                final LinkGrabberFilePackage fp : packages) {
                  fp.remove(links);
                }
              }
 else               if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
                links=new ArrayList<DownloadLink>();
                for (int i=0; i < this.lgi.getPackages().size(); i++) {
                  for (int ii=0; ii < this.lgi.getPackages().get(i).size(); ii++) {
                    links.add(this.lgi.getPackages().get(i).get(ii));
                  }
                }
                for (final Iterator<DownloadLink> it=links.iterator(); it.hasNext(); ) {
                  link=it.next();
                  if (link.isAvailabilityStatusChecked() == true && link.isAvailable() == false) {
                    link.getFilePackage().remove(link);
                  }
                }
              }
 else               if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
                for (                final LinkGrabberFilePackage fp : packages) {
                  LinkGrabberPanel.getLinkGrabber().confirmPackage(fp,null,-1);
                }
              }
            }
          }
        }
      }
      if (requestParameter.containsKey("String_Node_Str")) {
        Integer download_id=0;
        Integer package_id=0;
        String[] ids;
        final int counter_max=Formatter.filterInt(requestParameter.get("String_Node_Str"));
        int counter_index=0;
        DownloadLink link;
        final ArrayList<DownloadLink> links=new ArrayList<DownloadLink>();
        for (counter_index=1; counter_index <= counter_max; counter_index++) {
          if (requestParameter.containsKey("String_Node_Str" + counter_index)) {
            ids=requestParameter.get("String_Node_Str" + counter_index).toString().split("String_Node_Str",2);
            package_id=Formatter.filterInt(ids[0].toString());
            download_id=Formatter.filterInt(ids[1].toString());
            links.add(JDUtilities.getController().getPackages().get(package_id).getDownloadLinkList().get(download_id));
          }
        }
        if (requestParameter.containsKey("String_Node_Str")) {
          final String dowhat=requestParameter.get("String_Node_Str");
          if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
            for (final Iterator<DownloadLink> it=links.iterator(); it.hasNext(); ) {
              link=it.next();
              link.setEnabled(true);
            }
            DownloadController.getInstance().fireGlobalUpdate();
          }
          if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
            for (final Iterator<DownloadLink> it=links.iterator(); it.hasNext(); ) {
              link=it.next();
              link.setEnabled(false);
            }
            DownloadController.getInstance().fireGlobalUpdate();
          }
          if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
            for (final Iterator<DownloadLink> it=links.iterator(); it.hasNext(); ) {
              link=it.next();
              link.getLinkStatus().setStatus(LinkStatus.TODO);
              link.getLinkStatus().setStatusText("String_Node_Str");
              link.reset();
            }
            DownloadController.getInstance().fireGlobalUpdate();
          }
          if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
            for (            final DownloadLink dl : links) {
              dl.getFilePackage().remove(dl);
            }
          }
          if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
            for (final Iterator<DownloadLink> it=links.iterator(); it.hasNext(); ) {
              link=it.next();
              link.setAborted(true);
            }
            DownloadController.getInstance().fireGlobalUpdate();
          }
        }
      }
    }
 else     if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      new Thread(new Runnable(){
        public void run(){
          try {
            Thread.sleep(2000);
          }
 catch (          final InterruptedException e) {
            JDLogger.exception(e);
          }
          if (Reconnecter.getInstance().forceReconnect()) {
            JDSimpleWebserverRequestHandler.this.logger.info("String_Node_Str");
          }
 else {
            JDSimpleWebserverRequestHandler.this.logger.info("String_Node_Str");
          }
        }
      }
).start();
    }
 else     if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      new Thread(new Runnable(){
        public void run(){
          try {
            Thread.sleep(2000);
          }
 catch (          final InterruptedException e) {
            JDLogger.exception(e);
          }
          JDUtilities.getController().exit();
        }
      }
).start();
    }
 else     if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      DownloadWatchDog.getInstance().startDownloads();
    }
 else     if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      DownloadWatchDog.getInstance().stopDownloads();
    }
 else     if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      new Thread(new Runnable(){
        public void run(){
          try {
            Thread.sleep(2000);
          }
 catch (          final InterruptedException e) {
            JDLogger.exception(e);
          }
          JDUtilities.restartJD(false);
        }
      }
).start();
    }
 else     if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      if (requestParameter.containsKey("String_Node_Str")) {
        final String AddLinks=Encoding.htmlDecode(requestParameter.get("String_Node_Str"));
        final ArrayList<DownloadLink> waitingLinkList=new DistributeData(AddLinks).findLinks();
        LinkGrabberPanel.getLinkGrabber().addLinks(waitingLinkList);
      }
    }
 else     if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      if (requestParameter.containsKey("String_Node_Str")) {
        final File container=JDUtilities.getResourceFile("String_Node_Str" + requestParameter.get("String_Node_Str"));
        final ArrayList<DownloadLink> waitingLinkList=JDUtilities.getController().getContainerLinks(container);
        LinkGrabberPanel.getLinkGrabber().addLinks(waitingLinkList);
      }
    }
  }
  if (requestParameter.containsKey("String_Node_Str")) {
    if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      if (requestParameter.containsKey("String_Node_Str")) {
        final String passwordList=Encoding.htmlDecode(requestParameter.get("String_Node_Str"));
        final ArrayList<String> pws=new ArrayList<String>();
        for (        final String pw : org.appwork.utils.Regex.getLines(passwordList)) {
          pws.add(0,pw);
        }
        PasswordListController.getInstance().setPasswordList(pws);
      }
    }
  }
  File fileToRead=JDUtilities.getResourceFile("String_Node_Str" + url);
  if (!fileToRead.isFile()) {
    final String tempurl=url + "String_Node_Str";
    final File fileToRead2=JDUtilities.getResourceFile("String_Node_Str" + tempurl);
    if (fileToRead2.isFile()) {
      url=tempurl;
      fileToRead=JDUtilities.getResourceFile("String_Node_Str" + url);
    }
  }
  if (!fileToRead.exists()) {
    this.response.setNotFound(url);
  }
 else {
    if (url.endsWith("String_Node_Str")) {
      JDSimpleWebserverTemplateFileRequestHandler filerequest;
      filerequest=new JDSimpleWebserverTemplateFileRequestHandler(this.response);
      filerequest.handleRequest(url,requestParameter);
    }
 else {
      JDSimpleWebserverStaticFileRequestHandler filerequest;
      filerequest=new JDSimpleWebserverStaticFileRequestHandler(this.headers,this.response);
      filerequest.handleRequest(url,requestParameter);
    }
  }
}

Fixed version (ground truth):
public void handle(){
  final String request=this.headers.get(null);
  final String[] requ=request.split("String_Node_Str");
  final String cPath=requ[1];
  String path, querry;
  path=cPath.substring(1);
  String[] params;
  final HashMap<String,String> requestParameter=new HashMap<String,String>();
  requestParameter.put("String_Node_Str","String_Node_Str");
  requestParameter.put("String_Node_Str","String_Node_Str");
  requestParameter.put("String_Node_Str","String_Node_Str");
  requestParameter.put("String_Node_Str","String_Node_Str");
  if (cPath.indexOf("String_Node_Str") >= 0) {
    querry=cPath.substring(cPath.indexOf("String_Node_Str") + 1);
    path=cPath.substring(1,cPath.indexOf("String_Node_Str"));
    params=querry.split("String_Node_Str");
    for (    String entry : params) {
      entry=entry.trim();
      final int index=entry.indexOf("String_Node_Str");
      String key=entry;
      String value=null;
      if (index >= 0) {
        key=entry.substring(0,index);
        value=entry.substring(index + 1);
      }
      if (requestParameter.containsKey(key) || requestParameter.containsKey(key + "String_Node_Str")) {
        if (requestParameter.containsKey(key + "String_Node_Str")) {
          Integer keycounter=0;
          keycounter=Formatter.filterInt(requestParameter.get(key + "String_Node_Str"));
          keycounter++;
          requestParameter.put(key + "String_Node_Str",keycounter.toString());
          requestParameter.put(key + "String_Node_Str" + keycounter.toString(),value);
        }
      }
 else {
        requestParameter.put(key,value);
      }
    }
  }
  String url=path.replaceAll("String_Node_Str","String_Node_Str");
  if (requestParameter.containsKey("String_Node_Str")) {
    if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      if (requestParameter.containsKey("String_Node_Str")) {
        int setspeed=Formatter.filterInt(requestParameter.get("String_Node_Str"));
        if (setspeed < 0) {
          setspeed=0;
        }
        SubConfiguration.getConfig("String_Node_Str").setProperty(Configuration.PARAM_DOWNLOAD_MAX_SPEED,setspeed);
      }
      if (requestParameter.containsKey("String_Node_Str")) {
        int maxdls=Formatter.filterInt(requestParameter.get("String_Node_Str"));
        if (maxdls < 1) {
          maxdls=1;
        }
        if (maxdls > 20) {
          maxdls=20;
        }
        SubConfiguration.getConfig("String_Node_Str").setProperty(Configuration.PARAM_DOWNLOAD_MAX_SIMULTAN,maxdls);
      }
      if (!requestParameter.containsKey("String_Node_Str")) {
        if (requestParameter.containsKey("String_Node_Str")) {
          JDUtilities.getConfiguration().setProperty(Configuration.PARAM_ALLOW_RECONNECT,true);
        }
 else {
          JDUtilities.getConfiguration().setProperty(Configuration.PARAM_ALLOW_RECONNECT,false);
        }
      }
      if (requestParameter.containsKey("String_Node_Str")) {
synchronized (LinkGrabberController.ControllerLock) {
synchronized (this.lgi.getPackages()) {
            Integer download_id=0;
            Integer package_id=0;
            String[] ids;
            final int counter_max=Formatter.filterInt(requestParameter.get("String_Node_Str"));
            int counter_index=0;
            DownloadLink link;
            ArrayList<DownloadLink> links=new ArrayList<DownloadLink>();
            final ArrayList<LinkGrabberFilePackage> packages=new ArrayList<LinkGrabberFilePackage>();
            for (counter_index=1; counter_index <= counter_max; counter_index++) {
              if (requestParameter.containsKey("String_Node_Str" + counter_index)) {
                ids=requestParameter.get("String_Node_Str" + counter_index).toString().split("String_Node_Str",2);
                package_id=Formatter.filterInt(ids[0].toString());
                download_id=Formatter.filterInt(ids[1].toString());
                links.add(this.lgi.getPackages().get(package_id).get(download_id));
                if (!packages.contains(this.lgi.getPackages().get(package_id))) {
                  packages.add(this.lgi.getPackages().get(package_id));
                }
              }
            }
            if (requestParameter.containsKey("String_Node_Str")) {
              final String dowhat=requestParameter.get("String_Node_Str");
              for (int i=0; i < this.lgi.getPackages().size(); i++) {
                if (requestParameter.containsKey("String_Node_Str" + i)) {
                  this.lgi.getPackages().get(i).setName(Encoding.htmlDecode(requestParameter.get("String_Node_Str" + i).toString()));
                }
              }
              if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
                for (                final LinkGrabberFilePackage fp : packages) {
                  fp.remove(links);
                }
              }
 else               if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
                links=new ArrayList<DownloadLink>();
                for (int i=0; i < this.lgi.getPackages().size(); i++) {
                  for (int ii=0; ii < this.lgi.getPackages().get(i).size(); ii++) {
                    links.add(this.lgi.getPackages().get(i).get(ii));
                  }
                }
                for (final Iterator<DownloadLink> it=links.iterator(); it.hasNext(); ) {
                  link=it.next();
                  if (link.isAvailabilityStatusChecked() == true && link.isAvailable() == false) {
                    link.getFilePackage().remove(link);
                  }
                }
              }
 else               if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
                for (                final LinkGrabberFilePackage fp : packages) {
                  LinkGrabberPanel.getLinkGrabber().confirmPackage(fp,null,-1);
                }
              }
            }
          }
        }
      }
      if (requestParameter.containsKey("String_Node_Str")) {
        Integer download_id=0;
        Integer package_id=0;
        String[] ids;
        final int counter_max=Formatter.filterInt(requestParameter.get("String_Node_Str"));
        int counter_index=0;
        DownloadLink link;
        final ArrayList<DownloadLink> links=new ArrayList<DownloadLink>();
        for (counter_index=1; counter_index <= counter_max; counter_index++) {
          if (requestParameter.containsKey("String_Node_Str" + counter_index)) {
            ids=requestParameter.get("String_Node_Str" + counter_index).toString().split("String_Node_Str",2);
            package_id=Formatter.filterInt(ids[0].toString());
            download_id=Formatter.filterInt(ids[1].toString());
            links.add(JDUtilities.getController().getPackages().get(package_id).getDownloadLinkList().get(download_id));
          }
        }
        if (requestParameter.containsKey("String_Node_Str")) {
          final String dowhat=requestParameter.get("String_Node_Str");
          if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
            for (final Iterator<DownloadLink> it=links.iterator(); it.hasNext(); ) {
              link=it.next();
              link.setEnabled(true);
            }
            DownloadController.getInstance().fireGlobalUpdate();
          }
          if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
            for (final Iterator<DownloadLink> it=links.iterator(); it.hasNext(); ) {
              link=it.next();
              link.setEnabled(false);
            }
            DownloadController.getInstance().fireGlobalUpdate();
          }
          if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
            for (final Iterator<DownloadLink> it=links.iterator(); it.hasNext(); ) {
              link=it.next();
              link.getLinkStatus().setStatus(LinkStatus.TODO);
              link.getLinkStatus().setStatusText("String_Node_Str");
              link.reset();
            }
            DownloadController.getInstance().fireGlobalUpdate();
          }
          if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
            for (            final DownloadLink dl : links) {
              dl.getFilePackage().remove(dl);
            }
          }
          if (dowhat.compareToIgnoreCase("String_Node_Str") == 0) {
            for (final Iterator<DownloadLink> it=links.iterator(); it.hasNext(); ) {
              link=it.next();
              link.setAborted(true);
            }
            DownloadController.getInstance().fireGlobalUpdate();
          }
        }
      }
    }
 else     if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      new Thread(new Runnable(){
        public void run(){
          try {
            Thread.sleep(2000);
          }
 catch (          final InterruptedException e) {
            JDLogger.exception(e);
          }
          if (Reconnecter.getInstance().forceReconnect()) {
            JDSimpleWebserverRequestHandler.this.logger.info("String_Node_Str");
          }
 else {
            JDSimpleWebserverRequestHandler.this.logger.info("String_Node_Str");
          }
        }
      }
).start();
    }
 else     if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      new Thread(new Runnable(){
        public void run(){
          try {
            Thread.sleep(2000);
          }
 catch (          final InterruptedException e) {
            JDLogger.exception(e);
          }
          JDUtilities.getController().exit();
        }
      }
).start();
    }
 else     if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      DownloadWatchDog.getInstance().startDownloads();
    }
 else     if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      DownloadWatchDog.getInstance().stopDownloads();
    }
 else     if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      new Thread(new Runnable(){
        public void run(){
          try {
            Thread.sleep(2000);
          }
 catch (          final InterruptedException e) {
            JDLogger.exception(e);
          }
          JDUtilities.restartJD(false);
        }
      }
).start();
    }
 else     if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      if (requestParameter.containsKey("String_Node_Str")) {
        final String AddLinks=Encoding.htmlDecode(requestParameter.get("String_Node_Str"));
        final ArrayList<DownloadLink> waitingLinkList=new DistributeData(AddLinks).findLinks();
        LinkGrabberPanel.getLinkGrabber().addLinks(waitingLinkList);
      }
    }
 else     if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      if (requestParameter.containsKey("String_Node_Str")) {
        final File container=JDUtilities.getResourceFile("String_Node_Str" + requestParameter.get("String_Node_Str"));
        final ArrayList<DownloadLink> waitingLinkList=JDUtilities.getController().getContainerLinks(container);
        LinkGrabberPanel.getLinkGrabber().addLinks(waitingLinkList);
      }
    }
  }
  if (requestParameter.containsKey("String_Node_Str")) {
    if (requestParameter.get("String_Node_Str").compareToIgnoreCase("String_Node_Str") == 0) {
      if (requestParameter.containsKey("String_Node_Str")) {
        final String passwordList=Encoding.htmlDecode(requestParameter.get("String_Node_Str"));
        final ArrayList<String> pws=new ArrayList<String>();
        for (        final String pw : org.appwork.utils.Regex.getLines(passwordList)) {
          pws.add(0,pw);
        }
        PasswordListController.getInstance().setPasswordList(pws);
      }
    }
  }
  File fileToRead=JDUtilities.getResourceFile("String_Node_Str" + url);
  if (!fileToRead.isFile()) {
    final String tempurl=url + "String_Node_Str";
    final File fileToRead2=JDUtilities.getResourceFile("String_Node_Str" + tempurl);
    if (fileToRead2.isFile()) {
      url=tempurl;
      fileToRead=JDUtilities.getResourceFile("String_Node_Str" + url);
    }
  }
  if (!fileToRead.exists()) {
    this.response.setNotFound(url);
  }
 else {
    if (new Regex(url,"String_Node_Str").matches()) {
      JDSimpleWebserverTemplateFileRequestHandler filerequest;
      filerequest=new JDSimpleWebserverTemplateFileRequestHandler(this.response);
      filerequest.handleRequest(url,requestParameter);
    }
 else {
      JDSimpleWebserverStaticFileRequestHandler filerequest;
      filerequest=new JDSimpleWebserverStaticFileRequestHandler(this.headers,this.response);
      filerequest.handleRequest(url,requestParameter);
    }
  }
}