Program: 121401
Project: 121401
Buggy source:
/** 
 * qzhang Comment method "openDbTableSelectorJob".
 * @param openListTable
 */
private void openDbTableSelectorJob(final Button openListTable){
  Job job=new Job(Messages.getString("String_Node_Str")){
    @Override protected IStatus run(    final IProgressMonitor monitor){
      monitor.beginTask(Messages.getString("String_Node_Str"),IProgressMonitor.UNKNOWN);
      DatabaseConnection existConnection=getExistConnection();
      if (existConnection == null) {
        if (connParameters == null) {
          initConnectionParameters();
        }
        existConnection=TracesConnectionUtils.createConnection(connParameters);
      }
      final DatabaseConnection con=existConnection;
      IMetadataConnection iMetadataConnection=null;
      final IMetadataConnection[] iMetadata=new IMetadataConnection[1];
      boolean isStatus=false;
      if (existConnection != null) {
        Display.getDefault().syncExec(new Runnable(){
          @Override public void run(){
            IMetadataConnection convert=ConvertionHelper.convert(con);
            iMetadata[0]=convert;
          }
        }
);
        iMetadataConnection=iMetadata[0];
        if (EDatabaseTypeName.HIVE.getProduct().equalsIgnoreCase(con.getDatabaseType())) {
          if (EDatabaseVersion4Drivers.HIVE_EMBEDDED.getVersionValue().equalsIgnoreCase(con.getDbVersionString())) {
            try {
              HiveConnectionManager.getInstance().checkConnection(iMetadataConnection);
              isStatus=true;
            }
 catch (            ClassNotFoundException e) {
              isStatus=false;
              ExceptionHandler.process(e);
            }
catch (            InstantiationException e) {
              isStatus=false;
              ExceptionHandler.process(e);
            }
catch (            IllegalAccessException e) {
              isStatus=false;
              ExceptionHandler.process(e);
            }
catch (            SQLException e) {
              isStatus=false;
              ExceptionHandler.process(e);
            }
          }
        }
 else {
          isStatus=checkConnection(iMetadataConnection);
        }
      }
      final String dbType=iMetadataConnection.getDbType();
      if (!monitor.isCanceled()) {
        try {
          if (isStatus) {
            if (EDatabaseTypeName.HIVE.getProduct().equalsIgnoreCase(con.getDatabaseType())) {
              if (EDatabaseVersion4Drivers.HIVE_EMBEDDED.getVersionValue().equalsIgnoreCase(con.getDbVersionString())) {
                JavaSqlFactory.doHivePreSetup(con);
                returnTablesFormConnection=ExtractMetaDataFromDataBase.fetchAllTablesForHiveEmbeddedModel(iMetadataConnection);
                JavaSqlFactory.doHiveConfigurationClear();
              }
            }
 else {
              returnTablesFormConnection=ExtractMetaDataFromDataBase.returnTablesFormConnection(iMetadataConnection);
            }
            Display.getDefault().asyncExec(new Runnable(){
              @Override public void run(){
                final DbTableSelectorObject object=new DbTableSelectorObject();
                DbTableSelectorObject connO=new DbTableSelectorObject();
                if (dbType != null && dbType.equals(EDatabaseTypeName.ORACLE_OCI.getDisplayName())) {
                  connO.setLabel(connParameters.getLocalServiceName());
                }
 else                 if ("String_Node_Str".equals(connParameters.getDbName())) {
                  connO.setLabel(connParameters.getDatasource());
                }
 else {
                  connO.setLabel(connParameters.getDbName());
                }
                if (connO.getLabel() == null || connO.getLabel().equals("String_Node_Str")) {
                  if (elem instanceof INode) {
                    connO.setLabel(elem.getElementName());
                  }
 else {
                    connO.setLabel("String_Node_Str");
                  }
                }
                connO.setType(ObjectType.DB);
                if (monitor.isCanceled()) {
                  monitor.done();
                  return;
                }
                for (                String string : returnTablesFormConnection) {
                  DbTableSelectorObject tableO=new DbTableSelectorObject();
                  tableO.setLabel(string);
                  tableO.setType(ObjectType.TABLE);
                  connO.addChildren(tableO);
                }
                object.addChildren(connO);
                String propertyName=(String)openListTable.getData(PARAMETER_NAME);
                DbTableSelectorDialog selectorDialog=new DbTableSelectorDialog(composite.getShell(),object);
                if (selectorDialog.open() == DbTableSelectorDialog.OK) {
                  String name=selectorDialog.getSelectName();
                  if (name != null) {
                    Command dbSelectorCommand=new PropertyChangeCommand(elem,propertyName,TalendTextUtils.addQuotes(name));
                    executeCommand(dbSelectorCommand);
                    Text labelText=(Text)hashCurControls.get(propertyName);
                    labelText.setText(TalendTextUtils.addQuotes(name));
                  }
                }
              }
            }
);
          }
 else {
            Display.getDefault().asyncExec(new Runnable(){
              @Override public void run(){
                String pid="String_Node_Str";
                String mainMsg="String_Node_Str";
                ErrorDialogWithDetailAreaAndContinueButton dialog=new ErrorDialogWithDetailAreaAndContinueButton(composite.getShell(),pid,mainMsg,connParameters.getConnectionComment());
                if (dialog.getCodeOfButton() == Window.OK) {
                  openParamemerDialog(openListTable,part.getProcess().getContextManager());
                }
              }
            }
);
          }
        }
 catch (        SQLException e) {
          JavaSqlFactory.doHiveConfigurationClear();
          ExceptionHandler.process(e);
          Display.getDefault().asyncExec(new Runnable(){
            @Override public void run(){
              MessageDialog.openError(openListTable.getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
            }
          }
);
        }
catch (        ClassNotFoundException e) {
          e.printStackTrace();
        }
catch (        InstantiationException e) {
          e.printStackTrace();
        }
catch (        IllegalAccessException e) {
          e.printStackTrace();
        }
      }
      monitor.done();
      return Status.OK_STATUS;
    }
  }
;
  if (part != null) {
    IWorkbenchSiteProgressService siteps=(IWorkbenchSiteProgressService)part.getSite().getAdapter(IWorkbenchSiteProgressService.class);
    siteps.showInDialog(composite.getShell(),job);
  }
 else {
    PlatformUI.getWorkbench().getProgressService().showInDialog(composite.getShell(),job);
  }
  job.setUser(true);
  job.schedule();
}

Fixed version (ground truth):
/** 
 * qzhang Comment method "openDbTableSelectorJob".
 * @param openListTable
 */
private void openDbTableSelectorJob(final Button openListTable){
  Job job=new Job(Messages.getString("String_Node_Str")){
    @Override protected IStatus run(    final IProgressMonitor monitor){
      monitor.beginTask(Messages.getString("String_Node_Str"),IProgressMonitor.UNKNOWN);
      DatabaseConnection existConnection=getExistConnection();
      if (existConnection == null) {
        if (connParameters == null) {
          initConnectionParameters();
        }
        existConnection=TracesConnectionUtils.createConnection(connParameters);
      }
      final DatabaseConnection con=existConnection;
      IMetadataConnection iMetadataConnection=null;
      final IMetadataConnection[] iMetadata=new IMetadataConnection[1];
      boolean isStatus=false;
      if (existConnection != null) {
        Display.getDefault().syncExec(new Runnable(){
          @Override public void run(){
            IMetadataConnection convert=ConvertionHelper.convert(con);
            iMetadata[0]=convert;
          }
        }
);
        iMetadataConnection=iMetadata[0];
        if (EDatabaseTypeName.HIVE.getProduct().equalsIgnoreCase(con.getDatabaseType())) {
          if (EDatabaseVersion4Drivers.HIVE_EMBEDDED.getVersionValue().equalsIgnoreCase(con.getDbVersionString())) {
            try {
              HiveConnectionManager.getInstance().checkConnection(iMetadataConnection);
              isStatus=true;
            }
 catch (            ClassNotFoundException e) {
              isStatus=false;
              ExceptionHandler.process(e);
            }
catch (            InstantiationException e) {
              isStatus=false;
              ExceptionHandler.process(e);
            }
catch (            IllegalAccessException e) {
              isStatus=false;
              ExceptionHandler.process(e);
            }
catch (            SQLException e) {
              isStatus=false;
              ExceptionHandler.process(e);
            }
          }
        }
 else {
          isStatus=checkConnection(iMetadataConnection);
        }
      }
      final String dbType=iMetadataConnection.getDbType();
      if (!monitor.isCanceled()) {
        try {
          if (isStatus) {
            if (EDatabaseTypeName.HIVE.getProduct().equalsIgnoreCase(con.getDatabaseType())) {
              if (EDatabaseVersion4Drivers.HIVE_EMBEDDED.getVersionValue().equalsIgnoreCase(con.getDbVersionString())) {
                JavaSqlFactory.doHivePreSetup((DatabaseConnection)iMetadataConnection.getCurrentConnection());
                returnTablesFormConnection=ExtractMetaDataFromDataBase.fetchAllTablesForHiveEmbeddedModel(iMetadataConnection);
                JavaSqlFactory.doHiveConfigurationClear();
              }
            }
 else {
              returnTablesFormConnection=ExtractMetaDataFromDataBase.returnTablesFormConnection(iMetadataConnection);
            }
            Display.getDefault().asyncExec(new Runnable(){
              @Override public void run(){
                final DbTableSelectorObject object=new DbTableSelectorObject();
                DbTableSelectorObject connO=new DbTableSelectorObject();
                if (dbType != null && dbType.equals(EDatabaseTypeName.ORACLE_OCI.getDisplayName())) {
                  connO.setLabel(connParameters.getLocalServiceName());
                }
 else                 if ("String_Node_Str".equals(connParameters.getDbName())) {
                  connO.setLabel(connParameters.getDatasource());
                }
 else {
                  connO.setLabel(connParameters.getDbName());
                }
                if (connO.getLabel() == null || connO.getLabel().equals("String_Node_Str")) {
                  if (elem instanceof INode) {
                    connO.setLabel(elem.getElementName());
                  }
 else {
                    connO.setLabel("String_Node_Str");
                  }
                }
                connO.setType(ObjectType.DB);
                if (monitor.isCanceled()) {
                  monitor.done();
                  return;
                }
                for (                String string : returnTablesFormConnection) {
                  DbTableSelectorObject tableO=new DbTableSelectorObject();
                  tableO.setLabel(string);
                  tableO.setType(ObjectType.TABLE);
                  connO.addChildren(tableO);
                }
                object.addChildren(connO);
                String propertyName=(String)openListTable.getData(PARAMETER_NAME);
                DbTableSelectorDialog selectorDialog=new DbTableSelectorDialog(composite.getShell(),object);
                if (selectorDialog.open() == DbTableSelectorDialog.OK) {
                  String name=selectorDialog.getSelectName();
                  if (name != null) {
                    Command dbSelectorCommand=new PropertyChangeCommand(elem,propertyName,TalendTextUtils.addQuotes(name));
                    executeCommand(dbSelectorCommand);
                    Text labelText=(Text)hashCurControls.get(propertyName);
                    labelText.setText(TalendTextUtils.addQuotes(name));
                  }
                }
              }
            }
);
          }
 else {
            Display.getDefault().asyncExec(new Runnable(){
              @Override public void run(){
                String pid="String_Node_Str";
                String mainMsg="String_Node_Str";
                ErrorDialogWithDetailAreaAndContinueButton dialog=new ErrorDialogWithDetailAreaAndContinueButton(composite.getShell(),pid,mainMsg,connParameters.getConnectionComment());
                if (dialog.getCodeOfButton() == Window.OK) {
                  openParamemerDialog(openListTable,part.getProcess().getContextManager());
                }
              }
            }
);
          }
        }
 catch (        SQLException e) {
          JavaSqlFactory.doHiveConfigurationClear();
          ExceptionHandler.process(e);
          Display.getDefault().asyncExec(new Runnable(){
            @Override public void run(){
              MessageDialog.openError(openListTable.getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
            }
          }
);
        }
catch (        ClassNotFoundException e) {
          e.printStackTrace();
        }
catch (        InstantiationException e) {
          e.printStackTrace();
        }
catch (        IllegalAccessException e) {
          e.printStackTrace();
        }
      }
      monitor.done();
      return Status.OK_STATUS;
    }
  }
;
  if (part != null) {
    IWorkbenchSiteProgressService siteps=(IWorkbenchSiteProgressService)part.getSite().getAdapter(IWorkbenchSiteProgressService.class);
    siteps.showInDialog(composite.getShell(),job);
  }
 else {
    PlatformUI.getWorkbench().getProgressService().showInDialog(composite.getShell(),job);
  }
  job.setUser(true);
  job.schedule();
}