Program: 129459
Project: 129459
Buggy source:
private static TdColumn addColumnAttribute(String label,String columnName,String typeName,int columnSize,int decimalDigits,String columnRemark,ResultSet resutSet,TdColumn column,java.sql.Connection conn,boolean isMssql) throws SQLException {
  boolean isIBMDB2ZOS=false;
  boolean isTeradataSqlModel=false;
  boolean isSAS=false;
  if (databaseconnection != null) {
    String dbMetaData=databaseconnection.getDatabaseType();
    if (dbMetaData != null && dbMetaData.equals(EDatabaseTypeName.IBMDB2ZOS.getDisplayName())) {
      isIBMDB2ZOS=true;
    }
    if (dbMetaData != null && dbMetaData.equals(EDatabaseTypeName.TERADATA.getDisplayName()) && databaseconnection.isSQLMode()) {
      isTeradataSqlModel=true;
    }
    if (dbMetaData != null && dbMetaData.equals(EDatabaseTypeName.SAS.getDisplayName())) {
      isSAS=true;
    }
  }
  if (column == null) {
    column=RelationalFactory.eINSTANCE.createTdColumn();
  }
  Object defaultvalue=null;
  try {
    defaultvalue=resutSet.getObject(GetColumn.COLUMN_DEF.name());
  }
 catch (  Exception e1) {
    log.warn(e1,e1);
  }
  String defaultStr=(defaultvalue != null) ? String.valueOf(defaultvalue) : null;
  TdExpression defExpression=createTdExpression(GetColumn.COLUMN_DEF.name(),defaultStr);
  if (columnName == null || "String_Node_Str".equals(columnName)) {
    try {
      columnName=resutSet.getString(GetColumn.COLUMN_NAME.name());
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
      if (columnName == null) {
        columnName=e1.getMessage();
      }
    }
  }
  column.setName(columnName);
  column.setLabel(label);
  int dataType=0;
  try {
    if (isIBMDB2ZOS || isTeradataSqlModel || isSAS) {
      dataType=resutSet.getInt(GetColumn.TYPE_NAME.name());
    }
 else {
      dataType=resutSet.getInt(GetColumn.DATA_TYPE.name());
    }
  }
 catch (  Exception e) {
    log.warn(e,e);
  }
  if (typeName == null || "String_Node_Str".equals(typeName)) {
    try {
      typeName=resutSet.getString(GetColumn.TYPE_NAME.name());
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
    }
  }
  if (typeName != null && isMssql()) {
    if (typeName.toLowerCase().equals("String_Node_Str")) {
      dataType=91;
    }
 else     if (typeName.toLowerCase().equals("String_Node_Str")) {
      dataType=92;
    }
  }
  if (columnSize < 0) {
    try {
      columnSize=resutSet.getInt(GetColumn.COLUMN_SIZE.name());
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
    }
  }
  column.setLength(columnSize);
  if (decimalDigits < 0) {
    try {
      decimalDigits=resutSet.getInt(GetColumn.DECIMAL_DIGITS.name());
    }
 catch (    Exception e) {
      log.warn(e);
    }
  }
  int numPrecRadix=0;
  try {
    if (!isIBMDB2ZOS && !isTeradataSqlModel && !isSAS) {
      numPrecRadix=resutSet.getInt(GetColumn.NUM_PREC_RADIX.name());
    }
  }
 catch (  Exception e) {
    log.warn(e);
  }
  if (columnRemark == null || "String_Node_Str".equals(columnRemark)) {
    try {
      columnRemark=resutSet.getString(GetColumn.REMARKS.name());
    }
 catch (    Exception e) {
      log.warn(e,e);
    }
    if (columnRemark == null) {
      columnRemark="String_Node_Str";
    }
  }
  ColumnHelper.setComment(columnRemark,column);
  TdSqlDataType sqlDataType=createDataType(dataType,typeName,decimalDigits,numPrecRadix);
  column.setSqlDataType(sqlDataType);
  try {
    if (isIBMDB2ZOS || isTeradataSqlModel || isSAS) {
      column.getSqlDataType().setNullable(NullableType.get(resutSet.getInt(GetColumn.IS_NULLABLE.name())));
    }
 else {
      column.getSqlDataType().setNullable(NullableType.get(resutSet.getInt(GetColumn.NULLABLE.name())));
    }
  }
 catch (  Exception e1) {
    log.warn(e1,e1);
  }
  column.setInitialValue(defExpression);
  String mapping=databaseconnection == null ? null : databaseconnection.getDbmsId();
  if (databaseconnection != null && mapping != null) {
    MappingTypeRetriever mappingTypeRetriever=MetadataTalendType.getMappingTypeRetriever(mapping);
    String talendType=mappingTypeRetriever.getDefaultSelectedTalendType(typeName,ExtractMetaDataUtils.getIntMetaDataInfo(resutSet,"String_Node_Str"),ExtractMetaDataUtils.getIntMetaDataInfo(resutSet,"String_Node_Str"));
    column.setTalendType(talendType);
  }
  try {
    column.setNullable("String_Node_Str".equals(resutSet.getString(GetColumn.IS_NULLABLE.name())));
  }
 catch (  Exception e) {
    column.setNullable(false);
  }
  return column;
}

Fixed version (ground truth):
private static TdColumn addColumnAttribute(String label,String columnName,String typeName,int columnSize,int decimalDigits,String columnRemark,ResultSet resutSet,TdColumn column,java.sql.Connection conn,boolean isMssql) throws SQLException {
  boolean isIBMDB2ZOS=false;
  boolean isTeradataSqlModel=false;
  boolean isSAS=false;
  if (databaseconnection != null) {
    String dbMetaData=databaseconnection.getDatabaseType();
    if (dbMetaData != null && dbMetaData.equals(EDatabaseTypeName.IBMDB2ZOS.getDisplayName())) {
      isIBMDB2ZOS=true;
    }
    if (dbMetaData != null && dbMetaData.equals(EDatabaseTypeName.TERADATA.getDisplayName()) && databaseconnection.isSQLMode()) {
      isTeradataSqlModel=true;
    }
    if (dbMetaData != null && dbMetaData.equals(EDatabaseTypeName.SAS.getDisplayName())) {
      isSAS=true;
    }
  }
  if (column == null) {
    column=RelationalFactory.eINSTANCE.createTdColumn();
  }
  Object defaultvalue=null;
  try {
    defaultvalue=resutSet.getObject(GetColumn.COLUMN_DEF.name());
  }
 catch (  Exception e1) {
    log.warn(e1,e1);
  }
  String defaultStr=(defaultvalue != null) ? String.valueOf(defaultvalue) : null;
  TdExpression defExpression=createTdExpression(GetColumn.COLUMN_DEF.name(),defaultStr);
  if (columnName == null || "String_Node_Str".equals(columnName)) {
    try {
      columnName=resutSet.getString(GetColumn.COLUMN_NAME.name());
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
      if (columnName == null) {
        columnName=e1.getMessage();
      }
    }
  }
  column.setName(columnName);
  column.setLabel(label);
  int dataType=0;
  try {
    if (isIBMDB2ZOS || isTeradataSqlModel || isSAS) {
      dataType=resutSet.getInt(GetColumn.TYPE_NAME.name());
    }
 else {
      dataType=resutSet.getInt(GetColumn.DATA_TYPE.name());
    }
  }
 catch (  Exception e) {
    log.warn(e,e);
  }
  if (typeName == null || "String_Node_Str".equals(typeName)) {
    try {
      typeName=resutSet.getString(GetColumn.TYPE_NAME.name());
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
    }
  }
  if (typeName != null && isMssql()) {
    if (typeName.toLowerCase().equals("String_Node_Str")) {
      dataType=91;
    }
 else     if (typeName.toLowerCase().equals("String_Node_Str")) {
      dataType=92;
    }
  }
  if (columnSize < 0) {
    try {
      columnSize=resutSet.getInt(GetColumn.COLUMN_SIZE.name());
    }
 catch (    Exception e1) {
      log.warn(e1,e1);
    }
  }
  column.setLength(columnSize);
  if (decimalDigits < 0) {
    try {
      decimalDigits=resutSet.getInt(GetColumn.DECIMAL_DIGITS.name());
    }
 catch (    Exception e) {
      log.warn(e);
    }
  }
  int numPrecRadix=0;
  try {
    if (!isIBMDB2ZOS && !isTeradataSqlModel && !isSAS) {
      numPrecRadix=resutSet.getInt(GetColumn.NUM_PREC_RADIX.name());
    }
  }
 catch (  Exception e) {
    log.warn(e);
  }
  if (columnRemark == null || "String_Node_Str".equals(columnRemark)) {
    try {
      columnRemark=resutSet.getString(GetColumn.REMARKS.name());
    }
 catch (    Exception e) {
      log.warn(e,e);
    }
    if (columnRemark == null) {
      columnRemark="String_Node_Str";
    }
    columnRemark=ManagementTextUtils.filterSpecialChar(columnRemark);
  }
  ColumnHelper.setComment(columnRemark,column);
  TdSqlDataType sqlDataType=createDataType(dataType,typeName,decimalDigits,numPrecRadix);
  column.setSqlDataType(sqlDataType);
  try {
    if (isIBMDB2ZOS || isTeradataSqlModel || isSAS) {
      column.getSqlDataType().setNullable(NullableType.get(resutSet.getInt(GetColumn.IS_NULLABLE.name())));
    }
 else {
      column.getSqlDataType().setNullable(NullableType.get(resutSet.getInt(GetColumn.NULLABLE.name())));
    }
  }
 catch (  Exception e1) {
    log.warn(e1,e1);
  }
  column.setInitialValue(defExpression);
  String mapping=databaseconnection == null ? null : databaseconnection.getDbmsId();
  if (databaseconnection != null && mapping != null) {
    MappingTypeRetriever mappingTypeRetriever=MetadataTalendType.getMappingTypeRetriever(mapping);
    String talendType=mappingTypeRetriever.getDefaultSelectedTalendType(typeName,ExtractMetaDataUtils.getIntMetaDataInfo(resutSet,"String_Node_Str"),ExtractMetaDataUtils.getIntMetaDataInfo(resutSet,"String_Node_Str"));
    column.setTalendType(talendType);
  }
  try {
    column.setNullable("String_Node_Str".equals(resutSet.getString(GetColumn.IS_NULLABLE.name())));
  }
 catch (  Exception e) {
    column.setNullable(false);
  }
  return column;
}