Program: 47734
Project: 47734
Buggy source:
public void connect(){
  vfsFileChooserDialog.setRootFile(null);
  vfsFileChooserDialog.setInitialFile(null);
  vfsFileChooserDialog.openFileCombo.setText("String_Node_Str");
  vfsFileChooserDialog.vfsBrowser.fileSystemTree.removeAll();
  NamedCluster nc=namedClusterWidget.getSelectedNamedCluster();
  if (nc == null) {
    return;
  }
  loadNamedCluster();
  connectedHostname=ncHostname;
  connectedPortString=ncPort;
  try {
    ArrayList<InetSocketAddress> addressList=new ArrayList<InetSocketAddress>();
    HadoopConfiguration hadoopConfig=getHadoopConfig();
    if (hadoopConfig != null) {
      HadoopShim shim=hadoopConfig.getHadoopShim();
      Configuration conf=shim.createConfiguration();
      String haNameNodes=conf.get(HDFS_HA_CLUSTER_NAMENODES_PROP);
      if (!Const.isEmpty(haNameNodes)) {
        String[] haNameNode=haNameNodes.split(NAMENODE_LIST_DELIMITER);
        if (!Const.isEmpty(haNameNode)) {
          for (          String nameNode : haNameNode) {
            String nameNodeResolveProperty=HDFS_HA_CLUSTER_NAMENODE_RESOLVE_PREFIX + nameNode;
            String nameNodeHostAndPort=conf.get(nameNodeResolveProperty);
            if (!Const.isEmpty(nameNodeHostAndPort)) {
              String[] nameNodeParams=nameNodeHostAndPort.split(NAMENODE_HOSTNAME_PORT_DELIMITER);
              String hostname=nameNodeParams[0];
              int port=0;
              if (nameNodeParams.length > 1) {
                try {
                  port=Integer.parseInt(nameNodeParams[1]);
                }
 catch (                NumberFormatException nfe) {
                }
              }
              addressList.add(new InetSocketAddress(hostname,port));
              isHighAvailabilityCluster=true;
            }
          }
        }
      }
 else {
        String hostname=ncHostname;
        int port=0;
        try {
          port=Integer.parseInt(ncPort);
        }
 catch (        NumberFormatException nfe) {
        }
        addressList.add(new InetSocketAddress(hostname,port));
        isHighAvailabilityCluster=false;
      }
      boolean success=false;
      StringBuffer connectMessage=new StringBuffer();
      for (int i=0; !success && i < addressList.size(); i++) {
        InetSocketAddress address=addressList.get(i);
        connectMessage.append("String_Node_Str");
        connectMessage.append(address.getHostName());
        connectMessage.append(NAMENODE_HOSTNAME_PORT_DELIMITER);
        connectMessage.append(address.getPort());
        Socket testHdfsSocket=new Socket(address.getHostName(),address.getPort());
        try {
          testHdfsSocket.getOutputStream();
          testHdfsSocket.close();
          success=true;
          connectedHostname=address.getHostName();
          connectedPortString=Integer.toString(address.getPort());
          connectMessage.append("String_Node_Str");
        }
 catch (        IOException ioe) {
          connectMessage.append("String_Node_Str");
          connectMessage.append(ioe.getMessage());
          connectMessage.append(System.getProperty("String_Node_Str"));
        }
      }
      if (!success) {
        throw new IOException(connectMessage.toString());
      }
    }
 else {
      throw new Exception("String_Node_Str");
    }
  }
 catch (  Throwable t) {
    if (!activate) {
      showMessageAndLog(BaseMessages.getString(PKG,"String_Node_Str"),BaseMessages.getString(PKG,"String_Node_Str"),t.getMessage());
    }
    return;
  }
  Props.getInstance().setCustomParameter("String_Node_Str",ncHostname);
  Props.getInstance().setCustomParameter("String_Node_Str",connectedPortString);
  Props.getInstance().setCustomParameter("String_Node_Str",ncUsername);
  Props.getInstance().setCustomParameter("String_Node_Str",ncPassword);
  FileObject root=rootFile;
  try {
    root=KettleVFS.getFileObject(buildHadoopFileSystemUrlString());
  }
 catch (  KettleFileException e1) {
    if (activate) {
      return;
    }
    final String unsupportedSchemeMessage=BaseMessages.getString(HadoopConfiguration.class,"String_Node_Str","String_Node_Str","String_Node_Str");
    final String unsupportedSchemeMessagePrefix=unsupportedSchemeMessage.split("String_Node_Str")[0];
    final String message=e1.getMessage();
    if (message.contains(unsupportedSchemeMessagePrefix)) {
      try {
        HadoopConfiguration hadoopConfig=getHadoopConfig();
        String hadoopConfigName=(hadoopConfig == null) ? "String_Node_Str" : hadoopConfig.getName();
        showMessageAndLog(BaseMessages.getString(PKG,"String_Node_Str"),BaseMessages.getString(PKG,"String_Node_Str",hadoopConfigName),message);
      }
 catch (      ConfigurationException ce) {
        showMessageAndLog(BaseMessages.getString(PKG,"String_Node_Str"),BaseMessages.getString(PKG,"String_Node_Str"),ce.getMessage());
      }
    }
 else {
      showMessageAndLog(BaseMessages.getString(PKG,"String_Node_Str"),BaseMessages.getString(PKG,"String_Node_Str"),e1.getMessage());
    }
    return;
  }
  vfsFileChooserDialog.setRootFile(root);
  vfsFileChooserDialog.setSelectedFile(root);
  rootFile=root;
}

Fixed version (ground truth):
public void connect(){
  vfsFileChooserDialog.setRootFile(null);
  vfsFileChooserDialog.setInitialFile(null);
  vfsFileChooserDialog.openFileCombo.setText("String_Node_Str");
  vfsFileChooserDialog.vfsBrowser.fileSystemTree.removeAll();
  NamedCluster nc=namedClusterWidget.getSelectedNamedCluster();
  if (nc == null) {
    return;
  }
  loadNamedCluster();
  connectedHostname=ncHostname;
  connectedPortString=ncPort;
  boolean showErrors=System.currentTimeMillis() - lastConnectAttempt > 1000;
  lastConnectAttempt=System.currentTimeMillis();
  try {
    ArrayList<InetSocketAddress> addressList=new ArrayList<InetSocketAddress>();
    HadoopConfiguration hadoopConfig=getHadoopConfig();
    if (hadoopConfig != null) {
      HadoopShim shim=hadoopConfig.getHadoopShim();
      Configuration conf=shim.createConfiguration();
      String haNameNodes=conf.get(HDFS_HA_CLUSTER_NAMENODES_PROP);
      if (!Const.isEmpty(haNameNodes)) {
        String[] haNameNode=haNameNodes.split(NAMENODE_LIST_DELIMITER);
        if (!Const.isEmpty(haNameNode)) {
          for (          String nameNode : haNameNode) {
            String nameNodeResolveProperty=HDFS_HA_CLUSTER_NAMENODE_RESOLVE_PREFIX + nameNode;
            String nameNodeHostAndPort=conf.get(nameNodeResolveProperty);
            if (!Const.isEmpty(nameNodeHostAndPort)) {
              String[] nameNodeParams=nameNodeHostAndPort.split(NAMENODE_HOSTNAME_PORT_DELIMITER);
              String hostname=nameNodeParams[0];
              int port=0;
              if (nameNodeParams.length > 1) {
                try {
                  port=Integer.parseInt(nameNodeParams[1]);
                }
 catch (                NumberFormatException nfe) {
                }
              }
              addressList.add(new InetSocketAddress(hostname,port));
              isHighAvailabilityCluster=true;
            }
          }
        }
      }
 else {
        String hostname=ncHostname;
        int port=0;
        try {
          port=Integer.parseInt(ncPort);
        }
 catch (        NumberFormatException nfe) {
        }
        addressList.add(new InetSocketAddress(hostname,port));
        isHighAvailabilityCluster=false;
      }
      boolean success=false;
      StringBuffer connectMessage=new StringBuffer();
      for (int i=0; !success && i < addressList.size(); i++) {
        InetSocketAddress address=addressList.get(i);
        connectMessage.append("String_Node_Str");
        connectMessage.append(address.getHostName());
        connectMessage.append(NAMENODE_HOSTNAME_PORT_DELIMITER);
        connectMessage.append(address.getPort());
        Socket testHdfsSocket=new Socket(address.getHostName(),address.getPort());
        try {
          testHdfsSocket.getOutputStream();
          testHdfsSocket.close();
          success=true;
          connectedHostname=address.getHostName();
          connectedPortString=Integer.toString(address.getPort());
          connectMessage.append("String_Node_Str");
        }
 catch (        IOException ioe) {
          connectMessage.append("String_Node_Str");
          connectMessage.append(ioe.getMessage());
          connectMessage.append(System.getProperty("String_Node_Str"));
        }
      }
      if (!success) {
        throw new IOException(connectMessage.toString());
      }
    }
 else {
      throw new Exception("String_Node_Str");
    }
  }
 catch (  Throwable t) {
    if (showErrors) {
      showMessageAndLog(BaseMessages.getString(PKG,"String_Node_Str"),BaseMessages.getString(PKG,"String_Node_Str"),t.getMessage());
    }
    lastConnectAttempt=System.currentTimeMillis();
    return;
  }
  Props.getInstance().setCustomParameter("String_Node_Str",ncHostname);
  Props.getInstance().setCustomParameter("String_Node_Str",connectedPortString);
  Props.getInstance().setCustomParameter("String_Node_Str",ncUsername);
  Props.getInstance().setCustomParameter("String_Node_Str",ncPassword);
  FileObject root=rootFile;
  try {
    root=KettleVFS.getFileObject(buildHadoopFileSystemUrlString());
  }
 catch (  KettleFileException e1) {
    final String unsupportedSchemeMessage=BaseMessages.getString(HadoopConfiguration.class,"String_Node_Str","String_Node_Str","String_Node_Str");
    final String unsupportedSchemeMessagePrefix=unsupportedSchemeMessage.split("String_Node_Str")[0];
    final String message=e1.getMessage();
    if (message.contains(unsupportedSchemeMessagePrefix)) {
      try {
        HadoopConfiguration hadoopConfig=getHadoopConfig();
        String hadoopConfigName=(hadoopConfig == null) ? "String_Node_Str" : hadoopConfig.getName();
        showMessageAndLog(BaseMessages.getString(PKG,"String_Node_Str"),BaseMessages.getString(PKG,"String_Node_Str",hadoopConfigName),message);
      }
 catch (      ConfigurationException ce) {
        showMessageAndLog(BaseMessages.getString(PKG,"String_Node_Str"),BaseMessages.getString(PKG,"String_Node_Str"),ce.getMessage());
      }
    }
 else {
      showMessageAndLog(BaseMessages.getString(PKG,"String_Node_Str"),BaseMessages.getString(PKG,"String_Node_Str"),e1.getMessage());
    }
    return;
  }
  vfsFileChooserDialog.setRootFile(root);
  vfsFileChooserDialog.setSelectedFile(root);
  rootFile=root;
}