Program: 143906
Project: 143906
Buggy source:
/** 
 * Read all parameters from the applet configuration and do initializations for the plugins and the applet.
 */
public void init(){
  if (debug > 0)   System.err.println("String_Node_Str");
  if (pluginLoader == null) {
    try {
      options.load(Applet.class.getResourceAsStream("String_Node_Str"));
    }
 catch (    Exception e) {
      try {
        URL url=new URL(getCodeBase() + "String_Node_Str");
        options.load(url.openStream());
      }
 catch (      Exception e1) {
        System.err.println("String_Node_Str");
        System.err.println("String_Node_Str");
        System.err.println("String_Node_Str" + getCodeBase() + "String_Node_Str");
      }
    }
    String value;
    if ((value=getParameter("String_Node_Str")) != null) {
      Properties appletParams=new Properties();
      URL url=null;
      try {
        url=new URL(value);
      }
 catch (      Exception e) {
        try {
          url=new URL(getCodeBase() + value);
        }
 catch (        Exception ce) {
          System.err.println("String_Node_Str" + ce);
        }
      }
      if (url != null) {
        try {
          appletParams.load(Applet.class.getResourceAsStream("String_Node_Str" + value));
          Enumeration ape=appletParams.keys();
          while (ape.hasMoreElements()) {
            String key=(String)ape.nextElement();
            options.put(key,appletParams.getProperty(key));
          }
        }
 catch (        Exception e) {
          try {
            appletParams.load(url.openStream());
            Enumeration ape=appletParams.keys();
            while (ape.hasMoreElements()) {
              String key=(String)ape.nextElement();
              options.put(key,appletParams.getProperty(key));
            }
          }
 catch (          Exception e2) {
            System.err.println("String_Node_Str" + e2);
          }
        }
      }
    }
    parameterOverride(options);
    pluginLoader=new Common(options);
    host=options.getProperty("String_Node_Str");
    if (host == null)     host=getCodeBase().getHost();
    port=options.getProperty("String_Node_Str");
    if (port == null)     port="String_Node_Str";
    if ((new Boolean(options.getProperty("String_Node_Str")).booleanValue()))     connect=true;
    if (!(new Boolean(options.getProperty("String_Node_Str")).booleanValue()))     disconnect=false;
    if (!(new Boolean(options.getProperty("String_Node_Str")).booleanValue()))     disconnectCloseWindow=false;
    frameTitle=options.getProperty("String_Node_Str");
    if ((new Boolean(options.getProperty("String_Node_Str"))).booleanValue()) {
      if (frameTitle == null) {
        appletFrame=(RootPaneContainer)new JFrame("String_Node_Str" + host + (port.equals("String_Node_Str") ? "String_Node_Str" : "String_Node_Str" + port));
      }
 else {
        appletFrame=(RootPaneContainer)new JFrame(frameTitle);
      }
    }
 else {
      appletFrame=(RootPaneContainer)this;
    }
    appletFrame.getContentPane().setLayout(new BorderLayout());
    Map componentList=pluginLoader.getComponents();
    Iterator names=componentList.keySet().iterator();
    while (names.hasNext()) {
      String name=(String)names.next();
      Component c=(Component)componentList.get(name);
      if ((value=options.getProperty("String_Node_Str" + name)) != null) {
        appletFrame.getContentPane().add(value,c);
      }
 else {
        System.err.println("String_Node_Str" + name + "String_Node_Str");
        System.err.println("String_Node_Str" + name + "String_Node_Str");
      }
    }
    pluginLoader.registerPluginListener(new SoundListener(){
      public void playSound(      URL audioClip){
        Applet.this.getAudioClip(audioClip).play();
      }
    }
);
    pluginLoader.broadcast(new AppletRequest(this));
    if (appletFrame != this) {
      final String startText=options.getProperty("String_Node_Str");
      final String stopText=options.getProperty("String_Node_Str");
      final Button close=new Button();
      Vector privileges=Common.split(options.getProperty("String_Node_Str"),',');
      Class privilegeManager=null;
      Method enable=null;
      try {
        privilegeManager=Class.forName("String_Node_Str");
        enable=privilegeManager.getMethod("String_Node_Str",new Class[]{String.class});
      }
 catch (      Exception e) {
        System.err.println("String_Node_Str");
      }
      if (privilegeManager != null && enable != null && privileges != null)       for (int i=0; i < privileges.size(); i++)       try {
        enable.invoke(privilegeManager,new Object[]{privileges.elementAt(i)});
        System.out.println("String_Node_Str" + privileges.elementAt(i) + "String_Node_Str");
      }
 catch (      Exception e) {
        System.err.println("String_Node_Str" + privileges.elementAt(i) + "String_Node_Str");
      }
      try {
        clipboard=appletFrame.getContentPane().getToolkit().getSystemClipboard();
        System.err.println("String_Node_Str" + clipboard);
      }
 catch (      Exception e) {
        System.err.println("String_Node_Str" + ((e instanceof InvocationTargetException) ? ((InvocationTargetException)e).getTargetException() : e));
      }
 finally {
        if (clipboard == null) {
          System.err.println("String_Node_Str");
          clipboard=new Clipboard("String_Node_Str");
        }
      }
      if ((new Boolean(options.getProperty("String_Node_Str")).booleanValue())) {
        if ((new Boolean(options.getProperty("String_Node_Str")).booleanValue()))         ((JFrame)appletFrame).setSize(appletFrame.getContentPane().getToolkit().getScreenSize());
 else         ((JFrame)appletFrame).pack();
        ((JFrame)appletFrame).show();
        pluginLoader.broadcast(new SocketRequest(host,Integer.parseInt(port)));
        pluginLoader.broadcast(new ReturnFocusRequest());
        close.setLabel(startText != null ? stopText : "String_Node_Str");
      }
 else       close.setLabel(startText != null ? startText : "String_Node_Str");
      close.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent evt){
          if (((JFrame)appletFrame).isVisible()) {
            pluginLoader.broadcast(new SocketRequest());
            ((JFrame)appletFrame).setVisible(false);
            close.setLabel(startText != null ? startText : "String_Node_Str");
          }
 else {
            if (frameTitle == null)             ((JFrame)appletFrame).setTitle("String_Node_Str" + host + (port.equals("String_Node_Str") ? "String_Node_Str" : "String_Node_Str" + port));
            if ((new Boolean(options.getProperty("String_Node_Str")).booleanValue()))             ((JFrame)appletFrame).setSize(appletFrame.getContentPane().getToolkit().getScreenSize());
 else             ((JFrame)appletFrame).pack();
            ((JFrame)appletFrame).show();
            if (port == null || port.length() <= 0)             port="String_Node_Str";
            getAppletContext().showStatus("String_Node_Str" + host + "String_Node_Str"+ port+ "String_Node_Str");
            pluginLoader.broadcast(new SocketRequest(host,Integer.parseInt(port)));
            pluginLoader.broadcast(new ReturnFocusRequest());
            close.setLabel(stopText != null ? stopText : "String_Node_Str");
          }
        }
      }
);
      getContentPane().setLayout(new BorderLayout());
      getContentPane().add("String_Node_Str",close);
      MenuBar mb=new MenuBar();
      Menu file=new Menu("String_Node_Str");
      file.setShortcut(new MenuShortcut(KeyEvent.VK_F,true));
      MenuItem tmp;
      file.add(tmp=new MenuItem("String_Node_Str"));
      tmp.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent evt){
          pluginLoader.broadcast(new SocketRequest(host,Integer.parseInt(port)));
        }
      }
);
      file.add(tmp=new MenuItem("String_Node_Str"));
      tmp.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent evt){
          pluginLoader.broadcast(new SocketRequest());
        }
      }
);
      file.add(new MenuItem("String_Node_Str"));
      file.add(tmp=new MenuItem("String_Node_Str"));
      tmp.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent evt){
          if (pluginLoader.getComponents().get("String_Node_Str") != null) {
            PrintJob printJob=appletFrame.getContentPane().getToolkit().getPrintJob((JFrame)appletFrame,"String_Node_Str",null);
            ((Component)pluginLoader.getComponents().get("String_Node_Str")).print(printJob.getGraphics());
            printJob.end();
          }
        }
      }
);
      file.add(new MenuItem("String_Node_Str"));
      file.add(tmp=new MenuItem("String_Node_Str"));
      tmp.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent evt){
          ((JFrame)appletFrame).setVisible(false);
          pluginLoader.broadcast(new SocketRequest());
          close.setLabel(startText != null ? startText : "String_Node_Str");
        }
      }
);
      mb.add(file);
      Menu edit=new Menu("String_Node_Str");
      edit.setShortcut(new MenuShortcut(KeyEvent.VK_E,true));
      edit.add(tmp=new MenuItem("String_Node_Str"));
      tmp.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent evt){
          if (debug > 2)           System.err.println("String_Node_Str" + focussedPlugin);
          if (focussedPlugin instanceof VisualTransferPlugin)           ((VisualTransferPlugin)focussedPlugin).copy(clipboard);
        }
      }
);
      edit.add(tmp=new MenuItem("String_Node_Str"));
      tmp.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent evt){
          if (debug > 2)           System.err.println("String_Node_Str" + focussedPlugin);
          if (focussedPlugin instanceof VisualTransferPlugin)           ((VisualTransferPlugin)focussedPlugin).paste(clipboard);
        }
      }
);
      mb.add(edit);
      Map menuList=pluginLoader.getMenus();
      names=menuList.keySet().iterator();
      while (names.hasNext()) {
        String name=(String)names.next();
        Object o=menuList.get(name);
        if (o instanceof Menu)         mb.add((Menu)o);
      }
      Menu help=new Menu("String_Node_Str");
      help.setShortcut(new MenuShortcut(KeyEvent.VK_HELP,true));
      help.add(tmp=new MenuItem("String_Node_Str"));
      tmp.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent e){
          Help.show(appletFrame.getContentPane(),options.getProperty("String_Node_Str"));
        }
      }
);
      mb.setHelpMenu(help);
      if ((new Boolean(options.getProperty("String_Node_Str")).booleanValue()))       ((JFrame)appletFrame).setMenuBar(mb);
      try {
        ((JFrame)appletFrame).addWindowListener(new WindowAdapter(){
          public void windowClosing(          WindowEvent evt){
            pluginLoader.broadcast(new SocketRequest());
            ((JFrame)appletFrame).setVisible(false);
            close.setLabel(startText != null ? startText : "String_Node_Str");
          }
        }
);
      }
 catch (      Exception e) {
        System.err.println("String_Node_Str");
        System.err.println("String_Node_Str");
      }
      pluginLoader.registerPluginListener(new OnlineStatusListener(){
        public void online(){
          if (debug > 0)           System.err.println("String_Node_Str");
          online=true;
          if (((JFrame)appletFrame).isVisible() == false)           ((JFrame)appletFrame).setVisible(true);
        }
        public void offline(){
          if (debug > 0)           System.err.println("String_Node_Str");
          online=false;
          if (disconnectCloseWindow) {
            ((JFrame)appletFrame).setVisible(false);
            close.setLabel(startText != null ? startText : "String_Node_Str");
          }
        }
      }
);
      pluginLoader.registerPluginListener(new FocusStatusListener(){
        public void pluginGainedFocus(        Plugin plugin){
          if (Applet.debug > 0)           System.err.println("String_Node_Str" + plugin + "String_Node_Str");
          focussedPlugin=plugin;
        }
        public void pluginLostFocus(        Plugin plugin){
          if (Applet.debug > 0)           System.err.println("String_Node_Str" + plugin + "String_Node_Str");
        }
      }
);
    }
 else     pluginLoader.registerPluginListener(new OnlineStatusListener(){
      public void online(){
        if (debug > 0)         System.err.println("String_Node_Str");
        online=true;
      }
      public void offline(){
        if (debug > 0)         System.err.println("String_Node_Str");
        online=false;
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * Read all parameters from the applet configuration and do initializations for the plugins and the applet.
 */
public void init(){
  if (debug > 0)   System.err.println("String_Node_Str");
  if (pluginLoader == null) {
    try {
      options.load(Applet.class.getResourceAsStream("String_Node_Str"));
    }
 catch (    Exception e) {
      try {
        URL url=new URL(getCodeBase() + "String_Node_Str");
        options.load(url.openStream());
      }
 catch (      Exception e1) {
        System.err.println("String_Node_Str");
        System.err.println("String_Node_Str");
        System.err.println("String_Node_Str" + getCodeBase() + "String_Node_Str");
      }
    }
    String value;
    if ((value=getParameter("String_Node_Str")) != null) {
      Properties appletParams=new Properties();
      URL url=null;
      try {
        url=new URL(value);
      }
 catch (      Exception e) {
        try {
          url=new URL(getCodeBase() + value);
        }
 catch (        Exception ce) {
          System.err.println("String_Node_Str" + ce);
        }
      }
      if (url != null) {
        try {
          appletParams.load(Applet.class.getResourceAsStream("String_Node_Str" + value));
          Enumeration ape=appletParams.keys();
          while (ape.hasMoreElements()) {
            String key=(String)ape.nextElement();
            options.put(key,appletParams.getProperty(key));
          }
        }
 catch (        Exception e) {
          try {
            appletParams.load(url.openStream());
            Enumeration ape=appletParams.keys();
            while (ape.hasMoreElements()) {
              String key=(String)ape.nextElement();
              options.put(key,appletParams.getProperty(key));
            }
          }
 catch (          Exception e2) {
            System.err.println("String_Node_Str" + e2);
          }
        }
      }
    }
    parameterOverride(options);
    pluginLoader=new Common(options);
    host=options.getProperty("String_Node_Str");
    if (host == null)     host=getCodeBase().getHost();
    port=options.getProperty("String_Node_Str");
    if (port == null)     port="String_Node_Str";
    if ((new Boolean(options.getProperty("String_Node_Str")).booleanValue()))     connect=true;
    if (!(new Boolean(options.getProperty("String_Node_Str")).booleanValue()))     disconnect=false;
    if (!(new Boolean(options.getProperty("String_Node_Str")).booleanValue()))     disconnectCloseWindow=false;
    frameTitle=options.getProperty("String_Node_Str");
    if ((new Boolean(options.getProperty("String_Node_Str"))).booleanValue()) {
      if (frameTitle == null) {
        appletFrame=(RootPaneContainer)new JFrame("String_Node_Str" + host + (port.equals("String_Node_Str") ? "String_Node_Str" : "String_Node_Str" + port));
      }
 else {
        appletFrame=(RootPaneContainer)new JFrame(frameTitle);
      }
    }
 else {
      appletFrame=(RootPaneContainer)this;
    }
    appletFrame.getContentPane().setLayout(new BorderLayout());
    Map componentList=pluginLoader.getComponents();
    Iterator names=componentList.keySet().iterator();
    while (names.hasNext()) {
      String name=(String)names.next();
      Component c=(Component)componentList.get(name);
      if ((value=options.getProperty("String_Node_Str" + name)) != null) {
        appletFrame.getContentPane().add(value,c);
      }
 else {
        System.err.println("String_Node_Str" + name + "String_Node_Str");
        System.err.println("String_Node_Str" + name + "String_Node_Str");
      }
    }
    pluginLoader.registerPluginListener(new SoundListener(){
      public void playSound(      URL audioClip){
        Applet.this.getAudioClip(audioClip).play();
      }
    }
);
    pluginLoader.broadcast(new AppletRequest(this));
    if (appletFrame != this) {
      final String startText=options.getProperty("String_Node_Str");
      final String stopText=options.getProperty("String_Node_Str");
      final Button close=new Button();
      Vector privileges=Common.split(options.getProperty("String_Node_Str"),',');
      Class privilegeManager=null;
      Method enable=null;
      try {
        privilegeManager=Class.forName("String_Node_Str");
        enable=privilegeManager.getMethod("String_Node_Str",new Class[]{String.class});
      }
 catch (      Exception e) {
        System.err.println("String_Node_Str");
      }
      if (privilegeManager != null && enable != null && privileges != null)       for (int i=0; i < privileges.size(); i++)       try {
        enable.invoke(privilegeManager,new Object[]{privileges.elementAt(i)});
        System.out.println("String_Node_Str" + privileges.elementAt(i) + "String_Node_Str");
      }
 catch (      Exception e) {
        System.err.println("String_Node_Str" + privileges.elementAt(i) + "String_Node_Str");
      }
      try {
        clipboard=appletFrame.getContentPane().getToolkit().getSystemClipboard();
        System.err.println("String_Node_Str" + clipboard);
      }
 catch (      Exception e) {
        System.err.println("String_Node_Str" + ((e instanceof InvocationTargetException) ? ((InvocationTargetException)e).getTargetException() : e));
      }
 finally {
        if (clipboard == null) {
          System.err.println("String_Node_Str");
          clipboard=new Clipboard("String_Node_Str");
        }
      }
      if ((new Boolean(options.getProperty("String_Node_Str")).booleanValue())) {
        if ((new Boolean(options.getProperty("String_Node_Str")).booleanValue()))         ((JFrame)appletFrame).setSize(appletFrame.getContentPane().getToolkit().getScreenSize());
 else         ((JFrame)appletFrame).pack();
        ((JFrame)appletFrame).show();
        pluginLoader.broadcast(new SocketRequest(host,Integer.parseInt(port)));
        pluginLoader.broadcast(new ReturnFocusRequest());
        close.setLabel(startText != null ? stopText : "String_Node_Str");
      }
 else       close.setLabel(startText != null ? startText : "String_Node_Str");
      close.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent evt){
          if (((JFrame)appletFrame).isVisible()) {
            pluginLoader.broadcast(new SocketRequest());
            ((JFrame)appletFrame).setVisible(false);
            close.setLabel(startText != null ? startText : "String_Node_Str");
          }
 else {
            if (frameTitle == null)             ((JFrame)appletFrame).setTitle("String_Node_Str" + host + (port.equals("String_Node_Str") ? "String_Node_Str" : "String_Node_Str" + port));
            if ((new Boolean(options.getProperty("String_Node_Str")).booleanValue()))             ((JFrame)appletFrame).setSize(appletFrame.getContentPane().getToolkit().getScreenSize());
 else             ((JFrame)appletFrame).pack();
            ((JFrame)appletFrame).show();
            if (port == null || port.length() <= 0)             port="String_Node_Str";
            getAppletContext().showStatus("String_Node_Str" + host + "String_Node_Str"+ port+ "String_Node_Str");
            pluginLoader.broadcast(new SocketRequest(host,Integer.parseInt(port)));
            pluginLoader.broadcast(new ReturnFocusRequest());
            close.setLabel(stopText != null ? stopText : "String_Node_Str");
          }
        }
      }
);
      getContentPane().setLayout(new BorderLayout());
      getContentPane().add("String_Node_Str",close);
      JMenuBar mb=new JMenuBar();
      JMenu file=new JMenu("String_Node_Str");
      file.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F,0));
      JMenuItem tmp;
      file.add(tmp=new JMenuItem("String_Node_Str"));
      tmp.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent evt){
          pluginLoader.broadcast(new SocketRequest(host,Integer.parseInt(port)));
        }
      }
);
      file.add(tmp=new JMenuItem("String_Node_Str"));
      tmp.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent evt){
          pluginLoader.broadcast(new SocketRequest());
        }
      }
);
      file.add(new JMenuItem("String_Node_Str"));
      file.add(tmp=new JMenuItem("String_Node_Str"));
      tmp.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent evt){
          if (pluginLoader.getComponents().get("String_Node_Str") != null) {
            PrintJob printJob=appletFrame.getContentPane().getToolkit().getPrintJob((JFrame)appletFrame,"String_Node_Str",null);
            ((Component)pluginLoader.getComponents().get("String_Node_Str")).print(printJob.getGraphics());
            printJob.end();
          }
        }
      }
);
      file.add(new JMenuItem("String_Node_Str"));
      file.add(tmp=new JMenuItem("String_Node_Str"));
      tmp.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent evt){
          ((JFrame)appletFrame).setVisible(false);
          pluginLoader.broadcast(new SocketRequest());
          close.setLabel(startText != null ? startText : "String_Node_Str");
        }
      }
);
      mb.add(file);
      JMenu edit=new JMenu("String_Node_Str");
      edit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E,0));
      edit.add(tmp=new JMenuItem("String_Node_Str"));
      tmp.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent evt){
          if (debug > 2)           System.err.println("String_Node_Str" + focussedPlugin);
          if (focussedPlugin instanceof VisualTransferPlugin)           ((VisualTransferPlugin)focussedPlugin).copy(clipboard);
        }
      }
);
      edit.add(tmp=new JMenuItem("String_Node_Str"));
      tmp.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent evt){
          if (debug > 2)           System.err.println("String_Node_Str" + focussedPlugin);
          if (focussedPlugin instanceof VisualTransferPlugin)           ((VisualTransferPlugin)focussedPlugin).paste(clipboard);
        }
      }
);
      mb.add(edit);
      Map menuList=pluginLoader.getMenus();
      names=menuList.keySet().iterator();
      while (names.hasNext()) {
        String name=(String)names.next();
        Object o=menuList.get(name);
        if (o instanceof JMenu)         mb.add((JMenu)o);
      }
      JMenu help=new JMenu("String_Node_Str");
      help.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_HELP,0));
      help.add(tmp=new JMenuItem("String_Node_Str"));
      tmp.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent e){
          Help.show(appletFrame.getContentPane(),options.getProperty("String_Node_Str"));
        }
      }
);
      mb.setHelpMenu(help);
      if ((new Boolean(options.getProperty("String_Node_Str")).booleanValue()))       ((JFrame)appletFrame).setJMenuBar(mb);
      try {
        ((JFrame)appletFrame).addWindowListener(new WindowAdapter(){
          public void windowClosing(          WindowEvent evt){
            pluginLoader.broadcast(new SocketRequest());
            ((JFrame)appletFrame).setVisible(false);
            close.setLabel(startText != null ? startText : "String_Node_Str");
          }
        }
);
      }
 catch (      Exception e) {
        System.err.println("String_Node_Str");
        System.err.println("String_Node_Str");
      }
      pluginLoader.registerPluginListener(new OnlineStatusListener(){
        public void online(){
          if (debug > 0)           System.err.println("String_Node_Str");
          online=true;
          if (((JFrame)appletFrame).isVisible() == false)           ((JFrame)appletFrame).setVisible(true);
        }
        public void offline(){
          if (debug > 0)           System.err.println("String_Node_Str");
          online=false;
          if (disconnectCloseWindow) {
            ((JFrame)appletFrame).setVisible(false);
            close.setLabel(startText != null ? startText : "String_Node_Str");
          }
        }
      }
);
      pluginLoader.registerPluginListener(new FocusStatusListener(){
        public void pluginGainedFocus(        Plugin plugin){
          if (Applet.debug > 0)           System.err.println("String_Node_Str" + plugin + "String_Node_Str");
          focussedPlugin=plugin;
        }
        public void pluginLostFocus(        Plugin plugin){
          if (Applet.debug > 0)           System.err.println("String_Node_Str" + plugin + "String_Node_Str");
        }
      }
);
    }
 else     pluginLoader.registerPluginListener(new OnlineStatusListener(){
      public void online(){
        if (debug > 0)         System.err.println("String_Node_Str");
        online=true;
      }
      public void offline(){
        if (debug > 0)         System.err.println("String_Node_Str");
        online=false;
      }
    }
);
  }
}