Program: 21052
Project: 21052
Buggy source:
public static boolean load(final String host2,final boolean opendir){
  try {
    final JDialog dialog=new GuiRunnable<JDialog>(){
      public JDialog runSave(){
        return new JDialog(DummyFrame.getDialogParent());
      }
    }
.getReturnValue();
    dialog.setModal(true);
    final JPanel p=new GuiRunnable<JPanel>(){
      public JPanel runSave(){
        JPanel ret=new JPanel(new GridLayout(3,2));
        ret.add(new JLabel(JDL.L("String_Node_Str","String_Node_Str") + "String_Node_Str"));
        return ret;
      }
    }
.getReturnValue();
    final JDTextField tfl=new GuiRunnable<JDTextField>(){
      public JDTextField runSave(){
        return new JDTextField();
      }
    }
.getReturnValue();
    tfl.setBorder(BorderFactory.createEtchedBorder());
    p.add(tfl);
    JSpinner sm=new GuiRunnable<JSpinner>(){
      public JSpinner runSave(){
        p.add(new JLabel(JDL.L("String_Node_Str","String_Node_Str") + "String_Node_Str"));
        return new JSpinner(new SpinnerNumberModel(100,1,4000,1));
      }
    }
.getReturnValue();
    p.add(sm);
    JButton ok=new GuiRunnable<JButton>(){
      public JButton runSave(){
        return new JButton(JDL.L("String_Node_Str","String_Node_Str"));
      }
    }
.getReturnValue();
    ok.addActionListener(new ActionListener(){
      public void actionPerformed(      ActionEvent e){
        dialog.remove(p);
        dialog.validate();
        dialog.setVisible(false);
      }
    }
);
    p.add(ok);
    WindowListener l=new WindowListener(){
      public void windowActivated(      WindowEvent e){
      }
      public void windowClosed(      WindowEvent e){
      }
      public void windowClosing(      WindowEvent e){
        tfl.setText("String_Node_Str");
        dialog.dispose();
      }
      public void windowDeactivated(      WindowEvent e){
      }
      public void windowDeiconified(      WindowEvent e){
      }
      public void windowIconified(      WindowEvent e){
      }
      public void windowOpened(      WindowEvent e){
      }
    }
;
    JButton cancel=new GuiRunnable<JButton>(){
      public JButton runSave(){
        return new JButton(JDL.L("String_Node_Str","String_Node_Str"));
      }
    }
.getReturnValue();
    cancel.addActionListener(new ActionListener(){
      public void actionPerformed(      ActionEvent e){
        tfl.setText("String_Node_Str");
        dialog.dispose();
      }
    }
);
    p.add(cancel);
    dialog.addWindowListener(l);
    dialog.add(p);
    new GuiRunnable<Object>(){
      public Object runSave(){
        dialog.setLocation(Screen.getCenterOfComponent(DummyFrame.getDialogParent(),dialog));
        dialog.pack();
        dialog.setVisible(true);
        return null;
      }
    }
.waitForEDT();
    final String link=tfl.getText();
    if (link == null || link.matches("String_Node_Str"))     return false;
    final int menge=(Integer)sm.getValue();
    final ProgressDialog pd=new GuiRunnable<ProgressDialog>(){
      public ProgressDialog runSave(){
        return new ProgressDialog(DummyFrame.getDialogParent(),JDL.L("String_Node_Str","String_Node_Str"),null,false,true);
      }
    }
.getReturnValue();
    final Browser br=new Browser();
    br.getPage(link);
    String host=host2;
    if (host == null) {
      host=br.getHost().toLowerCase();
      if (host.matches("String_Node_Str"))       host=host.substring(host.indexOf('.') + 1);
    }
    final String dir=JDUtilities.getJDHomeDirectoryFromEnvironment().getAbsolutePath() + "String_Node_Str" + host+ "String_Node_Str";
    new File(dir).mkdir();
    final String ct=br.getHttpConnection().getContentType().toLowerCase();
    if (ct != null && ct.contains("String_Node_Str")) {
      dialog.dispose();
      Runnable runnable=new Runnable(){
        public void run(){
          for (int k=0; k < menge; k++) {
            try {
              String ft="String_Node_Str";
              if (ct.equals("String_Node_Str"))               ft="String_Node_Str";
 else {
                ft=ct.replaceFirst("String_Node_Str","String_Node_Str");
              }
              File f2=new File(dir + System.currentTimeMillis() + ft);
              br.getDownload(f2,link);
              final int c=k;
              new GuiRunnable<Object>(){
                public Object runSave(){
                  pd.setValue(c);
                  return null;
                }
              }
.waitForEDT();
            }
 catch (            Exception ev) {
              ev.printStackTrace();
            }
          }
          pd.dispose();
        }
      }
;
      Thread th=new Thread(runnable);
      th.start();
      pd.setThread(th);
      pd.setVisible(true);
      if (opendir)       openDir(dir);
      return true;
    }
    dialog.setTitle(JDL.L("String_Node_Str","String_Node_Str"));
    final ArrayList<LoadImage> images=new ArrayList<LoadImage>();
    String[] imagea=getImages(br);
    for (int i=0; i < imagea.length; i++) {
      LoadImage li=new LoadImage();
      li.form=-1;
      li.location=i;
      li.br=br;
      li.imageUrl=imagea[i];
      images.add(li);
    }
    Form[] forms=getForms(br);
    for (int i=0; i < forms.length; i++) {
      Form form=forms[i];
      Browser brc=br.cloneBrowser();
      brc.submitForm(form);
      imagea=getImages(brc);
      for (int b=0; b < imagea.length; b++) {
        LoadImage li=new LoadImage();
        li.form=i;
        li.location=b;
        li.br=brc;
        li.imageUrl=imagea[b];
        if (images.contains(li))         continue;
        images.add(li);
      }
    }
    final File[] files=new File[images.size()];
    dialog.removeWindowListener(l);
    dialog.addWindowListener(new WindowListener(){
      public void windowActivated(      WindowEvent e){
      }
      public void windowClosed(      WindowEvent e){
      }
      public void windowClosing(      WindowEvent e){
        for (        File file : files) {
          file.delete();
        }
        dialog.dispose();
      }
      public void windowDeactivated(      WindowEvent e){
      }
      public void windowDeiconified(      WindowEvent e){
      }
      public void windowIconified(      WindowEvent e){
      }
      public void windowOpened(      WindowEvent e){
      }
    }
);
    final Thread th=new Thread(new Runnable(){
      public void run(){
        final Thread[] jb=new Thread[images.size()];
        for (int j=0; j < images.size(); j++) {
          final int i=j;
          jb[i]=new Thread(new Runnable(){
            public void run(){
              LoadImage image=images.get(i);
              String ft="String_Node_Str";
              if (image.toLowerCase().contains("String_Node_Str"))               ft="String_Node_Str";
 else               if (image.toLowerCase().contains("String_Node_Str"))               ft="String_Node_Str";
 else {
                try {
                  br.getPage(image.imageUrl);
                  String ct2=br.getHttpConnection().getContentType().toLowerCase();
                  if (ct2 != null && ct2.contains("String_Node_Str")) {
                    if (ct2.equals("String_Node_Str"))                     ft="String_Node_Str";
 else {
                      ft=ct2.replaceFirst("String_Node_Str","String_Node_Str");
                    }
                  }
                }
 catch (                Exception e) {
                }
              }
              final String filetype=ft;
              final File f=new File(dir,System.currentTimeMillis() + filetype);
              files[i]=f;
              try {
                image.br.getDownload(f,image.imageUrl);
                image.file=f;
              }
 catch (              Exception e) {
              }
synchronized (jb[i]) {
                jb[i].notify();
              }
            }
          }
);
          jb[i].start();
        }
        new GuiRunnable<Object>(){
          public Object runSave(){
            pd.setMaximum(images.size());
            return null;
          }
        }
.waitForEDT();
        int c=0;
        for (        Thread thread : jb) {
          while (thread.isAlive()) {
synchronized (thread) {
              try {
                thread.wait(3000);
              }
 catch (              InterruptedException e) {
                e.printStackTrace();
              }
            }
          }
          final int d=c++;
          new GuiRunnable<Object>(){
            public Object runSave(){
              pd.setValue(d);
              return null;
            }
          }
.waitForEDT();
        }
        new GuiRunnable<Object>(){
          public Object runSave(){
            pd.setVisible(false);
            return null;
          }
        }
.waitForEDT();
      }
    }
);
    th.start();
    new GuiRunnable<Object>(){
      public Object runSave(){
        pd.setThread(th);
        pd.setVisible(true);
        return null;
      }
    }
.waitForEDT();
    final LoadImage ef=new LoadImage();
    final ArrayList<JButton> bts=new ArrayList<JButton>();
    for (int j=0; j < images.size(); j++) {
      final LoadImage f=images.get(j);
      if (!f.file.exists() || f.file.length() < 100)       continue;
      final BufferedImage captchaImage=JDImage.getImage(f.file);
      int area=captchaImage.getHeight(null) * captchaImage.getHeight(null);
      if (area < 50 || area > 50000 || captchaImage.getHeight(null) > 400 || captchaImage.getWidth(null) > 400 || captchaImage.getWidth(null) < 10 || captchaImage.getHeight(null) < 5) {
        f.file.delete();
        continue;
      }
      double faktor=Math.max((double)captchaImage.getWidth(null) / 100,(double)captchaImage.getHeight(null) / 100);
      final int width=(int)(captchaImage.getWidth(null) / faktor);
      final int height=(int)(captchaImage.getHeight(null) / faktor);
      JButton ic=new GuiRunnable<JButton>(){
        public JButton runSave(){
          return new JButton(new ImageIcon(captchaImage.getScaledInstance(width,height,Image.SCALE_SMOOTH)));
        }
      }
.getReturnValue();
      ic.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent e){
          dialog.dispose();
          ef.file=f.file;
          ef.br=f.br;
          ef.location=f.location;
          ef.form=f.form;
          ef.imageUrl=f.imageUrl;
        }
      }
);
      bts.add(ic);
    }
    final JPanel panel=new GuiRunnable<JPanel>(){
      public JPanel runSave(){
        return new JPanel(new GridLayout((int)Math.ceil(((double)bts.size()) / 5),5));
      }
    }
.getReturnValue();
    for (    JButton button : bts) {
      panel.add(button);
    }
    new GuiRunnable<Object>(){
      public Object runSave(){
        dialog.add(new JScrollPane(panel));
        dialog.pack();
        dialog.setLocation(Screen.getCenterOfComponent(DummyFrame.getDialogParent(),dialog));
        dialog.setVisible(true);
        return null;
      }
    }
.waitForEDT();
    if (ef.file != null) {
      final Runnable runnable=new Runnable(){
        public void run(){
          try {
            for (int j=0; j < files.length; j++) {
              File file=files[j];
              if (!file.equals(ef.file))               file.delete();
            }
            String filetype="String_Node_Str";
            if (ef.file.getName().toLowerCase().contains("String_Node_Str"))             filetype="String_Node_Str";
 else             if (ef.file.getName().toLowerCase().contains("String_Node_Str"))             filetype="String_Node_Str";
            Browser brss=br.cloneBrowser();
            brss.getPage(link);
            if (ef.form != -1) {
              brss.submitForm(getForms(brss)[ef.form]);
            }
            final String[] im=getImages(brss);
            File f2=new File(dir + System.currentTimeMillis() + filetype);
            brss.getDownload(f2,im[ef.location]);
            if (im[ef.location].equals(ef.toString())) {
              for (int k=0; k < menge - 2; k++) {
                final Browser brs=brss.cloneBrowser();
                try {
                  f2=new File(dir + System.currentTimeMillis() + filetype);
                  brs.getDownload(f2,ef.imageUrl);
                }
 catch (                Exception ev) {
                  ev.printStackTrace();
                }
                final int d=k;
                new GuiRunnable<Object>(){
                  public Object runSave(){
                    pd.setValue(d);
                    return null;
                  }
                }
.waitForEDT();
              }
            }
 else {
              for (int k=0; k < menge - 2; k++) {
                final Browser brs=br.cloneBrowser();
                brs.getPage(link);
                if (ef.form != -1) {
                  brs.submitForm(getForms(brs)[ef.form]);
                }
                try {
                  f2=new File(dir + System.currentTimeMillis() + filetype);
                  brs.getDownload(f2,getImages(brs)[ef.location]);
                }
 catch (                Exception ev) {
                  ev.printStackTrace();
                }
                final int d=k;
                new GuiRunnable<Object>(){
                  public Object runSave(){
                    pd.setValue(d);
                    return null;
                  }
                }
.waitForEDT();
              }
            }
          }
 catch (          Exception e) {
            e.printStackTrace();
          }
          new GuiRunnable<Object>(){
            public Object runSave(){
              pd.dispose();
              return null;
            }
          }
.waitForEDT();
        }
      }
;
      new GuiRunnable<Object>(){
        public Object runSave(){
          Thread th2=new Thread(runnable);
          th2.start();
          pd.setMaximum(menge);
          pd.setValue(1);
          pd.setThread(th2);
          pd.setVisible(true);
          return null;
        }
      }
.waitForEDT();
    }
 else     return false;
    if (opendir)     openDir(dir);
    return dir.length() > 0;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return false;
}

Fixed version (ground truth):
public static boolean load(final String host2,final boolean opendir){
  try {
    final JDialog dialog=new GuiRunnable<JDialog>(){
      public JDialog runSave(){
        return new JDialog(DummyFrame.getDialogParent());
      }
    }
.getReturnValue();
    dialog.setModal(true);
    final JPanel p=new GuiRunnable<JPanel>(){
      public JPanel runSave(){
        JPanel ret=new JPanel(new GridLayout(3,2));
        ret.add(new JLabel(JDL.L("String_Node_Str","String_Node_Str") + "String_Node_Str"));
        return ret;
      }
    }
.getReturnValue();
    final JDTextField tfl=new GuiRunnable<JDTextField>(){
      public JDTextField runSave(){
        return new JDTextField();
      }
    }
.getReturnValue();
    tfl.setBorder(BorderFactory.createEtchedBorder());
    p.add(tfl);
    JSpinner sm=new GuiRunnable<JSpinner>(){
      public JSpinner runSave(){
        p.add(new JLabel(JDL.L("String_Node_Str","String_Node_Str") + "String_Node_Str"));
        return new JSpinner(new SpinnerNumberModel(100,1,4000,1));
      }
    }
.getReturnValue();
    p.add(sm);
    JButton ok=new GuiRunnable<JButton>(){
      public JButton runSave(){
        return new JButton(JDL.L("String_Node_Str","String_Node_Str"));
      }
    }
.getReturnValue();
    ok.addActionListener(new ActionListener(){
      public void actionPerformed(      ActionEvent e){
        dialog.remove(p);
        dialog.validate();
        dialog.setVisible(false);
      }
    }
);
    p.add(ok);
    WindowListener l=new WindowListener(){
      public void windowActivated(      WindowEvent e){
      }
      public void windowClosed(      WindowEvent e){
      }
      public void windowClosing(      WindowEvent e){
        tfl.setText("String_Node_Str");
        dialog.dispose();
      }
      public void windowDeactivated(      WindowEvent e){
      }
      public void windowDeiconified(      WindowEvent e){
      }
      public void windowIconified(      WindowEvent e){
      }
      public void windowOpened(      WindowEvent e){
      }
    }
;
    JButton cancel=new GuiRunnable<JButton>(){
      public JButton runSave(){
        return new JButton(JDL.L("String_Node_Str","String_Node_Str"));
      }
    }
.getReturnValue();
    cancel.addActionListener(new ActionListener(){
      public void actionPerformed(      ActionEvent e){
        tfl.setText("String_Node_Str");
        dialog.dispose();
      }
    }
);
    p.add(cancel);
    dialog.addWindowListener(l);
    dialog.add(p);
    new GuiRunnable<Object>(){
      public Object runSave(){
        dialog.setLocation(Screen.getCenterOfComponent(DummyFrame.getDialogParent(),dialog));
        dialog.pack();
        dialog.setVisible(true);
        return null;
      }
    }
.waitForEDT();
    final String link=tfl.getText();
    if (link == null || link.matches("String_Node_Str"))     return false;
    final int menge=(Integer)sm.getValue();
    final ProgressDialog pd=new GuiRunnable<ProgressDialog>(){
      public ProgressDialog runSave(){
        return new ProgressDialog(DummyFrame.getDialogParent(),JDL.L("String_Node_Str","String_Node_Str"),null,false,true);
      }
    }
.getReturnValue();
    final Browser br=new Browser();
    br.getPage(link);
    String host=host2;
    if (host == null) {
      host=br.getHost().toLowerCase();
      if (host.matches("String_Node_Str"))       host=host.substring(host.indexOf('.') + 1);
    }
    final String dir=JDUtilities.getJDHomeDirectoryFromEnvironment().getAbsolutePath() + "String_Node_Str" + host+ "String_Node_Str";
    new File(dir).mkdir();
    final String ct=br.getHttpConnection().getContentType().toLowerCase();
    if (ct != null && ct.contains("String_Node_Str")) {
      dialog.dispose();
      Runnable runnable=new Runnable(){
        public void run(){
          for (int k=0; k < menge; k++) {
            try {
              String ft="String_Node_Str";
              if (ct.equals("String_Node_Str"))               ft="String_Node_Str";
 else {
                ft=ct.replaceFirst("String_Node_Str","String_Node_Str");
              }
              File f2=new File(dir + System.currentTimeMillis() + ft);
              br.getDownload(f2,link);
              final int c=k;
              new GuiRunnable<Object>(){
                public Object runSave(){
                  pd.setValue(c);
                  return null;
                }
              }
.waitForEDT();
            }
 catch (            Exception ev) {
              ev.printStackTrace();
            }
          }
          pd.dispose();
        }
      }
;
      Thread th=new Thread(runnable);
      th.start();
      pd.setThread(th);
      pd.setVisible(true);
      if (opendir)       openDir(dir);
      return true;
    }
    dialog.setTitle(JDL.L("String_Node_Str","String_Node_Str"));
    final ArrayList<LoadImage> images=new ArrayList<LoadImage>();
    String[] imagea=getImages(br);
    for (int i=0; i < imagea.length; i++) {
      LoadImage li=new LoadImage();
      li.form=-1;
      li.location=i;
      li.br=br;
      li.imageUrl=imagea[i];
      images.add(li);
    }
    Form[] forms=getForms(br);
    for (int i=0; i < forms.length; i++) {
      Form form=forms[i];
      Browser brc=br.cloneBrowser();
      brc.submitForm(form);
      imagea=getImages(brc);
      for (int b=0; b < imagea.length; b++) {
        LoadImage li=new LoadImage();
        li.form=i;
        li.location=b;
        li.br=brc;
        li.imageUrl=imagea[b];
        if (images.contains(li))         continue;
        images.add(li);
      }
    }
    final File[] files=new File[images.size()];
    dialog.removeWindowListener(l);
    dialog.addWindowListener(new WindowListener(){
      public void windowActivated(      WindowEvent e){
      }
      public void windowClosed(      WindowEvent e){
      }
      public void windowClosing(      WindowEvent e){
        for (        File file : files) {
          file.delete();
        }
        dialog.dispose();
      }
      public void windowDeactivated(      WindowEvent e){
      }
      public void windowDeiconified(      WindowEvent e){
      }
      public void windowIconified(      WindowEvent e){
      }
      public void windowOpened(      WindowEvent e){
      }
    }
);
    final Thread th=new Thread(new Runnable(){
      public void run(){
        final Thread[] jb=new Thread[images.size()];
        for (int j=0; j < images.size(); j++) {
          final int i=j;
          jb[i]=new Thread(new Runnable(){
            public void run(){
              LoadImage image=images.get(i);
              String ft="String_Node_Str";
              if (image.toLowerCase().contains("String_Node_Str"))               ft="String_Node_Str";
 else               if (image.toLowerCase().contains("String_Node_Str"))               ft="String_Node_Str";
 else {
                try {
                  br.getPage(image.imageUrl);
                  String ct2=br.getHttpConnection().getContentType().toLowerCase();
                  if (ct2 != null && ct2.contains("String_Node_Str")) {
                    if (ct2.equals("String_Node_Str"))                     ft="String_Node_Str";
 else {
                      ft=ct2.replaceFirst("String_Node_Str","String_Node_Str");
                    }
                  }
                }
 catch (                Exception e) {
                }
              }
              final String filetype=ft;
              final File f=new File(dir,System.currentTimeMillis() + filetype);
              files[i]=f;
              try {
                image.br.getDownload(f,image.imageUrl);
                image.file=f;
              }
 catch (              Exception e) {
              }
synchronized (jb[i]) {
                jb[i].notify();
              }
            }
          }
);
          jb[i].start();
        }
        new GuiRunnable<Object>(){
          public Object runSave(){
            pd.setMaximum(images.size());
            return null;
          }
        }
.waitForEDT();
        int c=0;
        for (        Thread thread : jb) {
          while (thread.isAlive()) {
synchronized (thread) {
              try {
                thread.wait(3000);
              }
 catch (              InterruptedException e) {
                e.printStackTrace();
              }
            }
          }
          final int d=c++;
          new GuiRunnable<Object>(){
            public Object runSave(){
              pd.setValue(d);
              return null;
            }
          }
.waitForEDT();
        }
        new GuiRunnable<Object>(){
          public Object runSave(){
            pd.setVisible(false);
            return null;
          }
        }
.waitForEDT();
      }
    }
);
    th.start();
    new GuiRunnable<Object>(){
      public Object runSave(){
        pd.setThread(th);
        pd.setVisible(true);
        return null;
      }
    }
.waitForEDT();
    final LoadImage ef=new LoadImage();
    final ArrayList<JButton> bts=new ArrayList<JButton>();
    for (int j=0; j < images.size(); j++) {
      final LoadImage f=images.get(j);
      if (!f.file.exists() || f.file.length() < 100)       continue;
      final BufferedImage captchaImage=JDImage.getImage(f.file);
      if (captchaImage == null) {
        f.file.delete();
        continue;
      }
      int area=captchaImage.getHeight(null) * captchaImage.getHeight(null);
      if (area < 50 || area > 50000 || captchaImage.getHeight(null) > 400 || captchaImage.getWidth(null) > 400 || captchaImage.getWidth(null) < 10 || captchaImage.getHeight(null) < 5) {
        f.file.delete();
        continue;
      }
      double faktor=Math.max((double)captchaImage.getWidth(null) / 100,(double)captchaImage.getHeight(null) / 100);
      final int width=(int)(captchaImage.getWidth(null) / faktor);
      final int height=(int)(captchaImage.getHeight(null) / faktor);
      JButton ic=new GuiRunnable<JButton>(){
        public JButton runSave(){
          return new JButton(new ImageIcon(captchaImage.getScaledInstance(width,height,Image.SCALE_SMOOTH)));
        }
      }
.getReturnValue();
      ic.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent e){
          dialog.dispose();
          ef.file=f.file;
          ef.br=f.br;
          ef.location=f.location;
          ef.form=f.form;
          ef.imageUrl=f.imageUrl;
        }
      }
);
      bts.add(ic);
    }
    final JPanel panel=new GuiRunnable<JPanel>(){
      public JPanel runSave(){
        return new JPanel(new GridLayout((int)Math.ceil(((double)bts.size()) / 5),5));
      }
    }
.getReturnValue();
    for (    JButton button : bts) {
      panel.add(button);
    }
    new GuiRunnable<Object>(){
      public Object runSave(){
        dialog.add(new JScrollPane(panel));
        dialog.pack();
        dialog.setLocation(Screen.getCenterOfComponent(DummyFrame.getDialogParent(),dialog));
        dialog.setVisible(true);
        return null;
      }
    }
.waitForEDT();
    if (ef.file != null) {
      final Runnable runnable=new Runnable(){
        public void run(){
          try {
            for (int j=0; j < files.length; j++) {
              File file=files[j];
              if (!file.equals(ef.file))               file.delete();
            }
            String filetype="String_Node_Str";
            if (ef.file.getName().toLowerCase().contains("String_Node_Str"))             filetype="String_Node_Str";
 else             if (ef.file.getName().toLowerCase().contains("String_Node_Str"))             filetype="String_Node_Str";
            Browser brss=br.cloneBrowser();
            brss.getPage(link);
            if (ef.form != -1) {
              brss.submitForm(getForms(brss)[ef.form]);
            }
            final String[] im=getImages(brss);
            File f2=new File(dir + System.currentTimeMillis() + filetype);
            brss.getDownload(f2,im[ef.location]);
            if (im[ef.location].equals(ef.toString())) {
              for (int k=0; k < menge - 2; k++) {
                final Browser brs=brss.cloneBrowser();
                try {
                  f2=new File(dir + System.currentTimeMillis() + filetype);
                  brs.getDownload(f2,ef.imageUrl);
                }
 catch (                Exception ev) {
                  ev.printStackTrace();
                }
                final int d=k;
                new GuiRunnable<Object>(){
                  public Object runSave(){
                    pd.setValue(d);
                    return null;
                  }
                }
.waitForEDT();
              }
            }
 else {
              for (int k=0; k < menge - 2; k++) {
                final Browser brs=br.cloneBrowser();
                brs.getPage(link);
                if (ef.form != -1) {
                  brs.submitForm(getForms(brs)[ef.form]);
                }
                try {
                  f2=new File(dir + System.currentTimeMillis() + filetype);
                  brs.getDownload(f2,getImages(brs)[ef.location]);
                }
 catch (                Exception ev) {
                  ev.printStackTrace();
                }
                final int d=k;
                new GuiRunnable<Object>(){
                  public Object runSave(){
                    pd.setValue(d);
                    return null;
                  }
                }
.waitForEDT();
              }
            }
          }
 catch (          Exception e) {
            e.printStackTrace();
          }
          new GuiRunnable<Object>(){
            public Object runSave(){
              pd.dispose();
              return null;
            }
          }
.waitForEDT();
        }
      }
;
      new GuiRunnable<Object>(){
        public Object runSave(){
          Thread th2=new Thread(runnable);
          th2.start();
          pd.setMaximum(menge);
          pd.setValue(1);
          pd.setThread(th2);
          pd.setVisible(true);
          return null;
        }
      }
.waitForEDT();
    }
 else     return false;
    if (opendir)     openDir(dir);
    return dir.length() > 0;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return false;
}