Program: 127461
Project: 127461
Buggy source:
public IMetadataColumn createNewMetadataColumn(){
  MetadataColumn metadataColumn=new MetadataColumn();
  String columnName=getNextGeneratedColumnName();
  metadataColumn.setLabel(columnName);
  metadataColumn.setNullable(true);
  metadataColumn.setOriginalDbColumnName(columnName);
  ECodeLanguage codeLanguage=LanguageManager.getCurrentLanguage();
  if (codeLanguage == ECodeLanguage.JAVA) {
    if (CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore().getString(MetadataTypeLengthConstants.FIELD_DEFAULT_TYPE) != null && !CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore().getString(MetadataTypeLengthConstants.FIELD_DEFAULT_TYPE).equals("String_Node_Str")) {
      metadataColumn.setTalendType(CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore().getString(MetadataTypeLengthConstants.FIELD_DEFAULT_TYPE));
      if (CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore().getString(MetadataTypeLengthConstants.FIELD_DEFAULT_LENGTH) != null && !CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore().getString(MetadataTypeLengthConstants.FIELD_DEFAULT_LENGTH).equals("String_Node_Str")) {
        metadataColumn.setLength(Integer.parseInt(CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore().getString(MetadataTypeLengthConstants.FIELD_DEFAULT_LENGTH)));
      }
    }
 else {
      metadataColumn.setTalendType(JavaTypesManager.getDefaultJavaType().getId());
      if (metadataTable.getDbms() != null) {
        metadataColumn.setType(TypesManager.getDBTypeFromTalendType(metadataTable.getDbms(),metadataColumn.getTalendType()));
      }
    }
  }
 else {
    if (CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore().getString(MetadataTypeLengthConstants.PERL_FIELD_DEFAULT_TYPE) != null && !CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore().getString(MetadataTypeLengthConstants.PERL_FIELD_DEFAULT_TYPE).equals("String_Node_Str")) {
      metadataColumn.setTalendType(CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore().getString(MetadataTypeLengthConstants.PERL_FIELD_DEFAULT_TYPE));
      if (CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore().getString(MetadataTypeLengthConstants.PERL_FIELD_DEFAULT_LENGTH) != null && !CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore().getString(MetadataTypeLengthConstants.PERL_FIELD_DEFAULT_LENGTH).equals("String_Node_Str")) {
        metadataColumn.setLength(Integer.parseInt(CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore().getString(MetadataTypeLengthConstants.PERL_FIELD_DEFAULT_LENGTH)));
      }
    }
  }
  return metadataColumn;
}

Fixed version (ground truth):
public IMetadataColumn createNewMetadataColumn(){
  MetadataColumn metadataColumn=new MetadataColumn();
  String columnName=getNextGeneratedColumnName();
  metadataColumn.setLabel(columnName);
  metadataColumn.setNullable(true);
  metadataColumn.setOriginalDbColumnName(columnName);
  IPreferenceStore preferenceStore=null;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreUIService.class)) {
    IDesignerCoreUIService designerCoreUiService=(IDesignerCoreUIService)GlobalServiceRegister.getDefault().getService(IDesignerCoreUIService.class);
    preferenceStore=designerCoreUiService.getPreferenceStore();
  }
  if (preferenceStore != null && preferenceStore.getString(MetadataTypeLengthConstants.FIELD_DEFAULT_TYPE) != null && !preferenceStore.getString(MetadataTypeLengthConstants.FIELD_DEFAULT_TYPE).equals("String_Node_Str")) {
    metadataColumn.setTalendType(preferenceStore.getString(MetadataTypeLengthConstants.FIELD_DEFAULT_TYPE));
    if (preferenceStore.getString(MetadataTypeLengthConstants.FIELD_DEFAULT_LENGTH) != null && !preferenceStore.getString(MetadataTypeLengthConstants.FIELD_DEFAULT_LENGTH).equals("String_Node_Str")) {
      metadataColumn.setLength(Integer.parseInt(preferenceStore.getString(MetadataTypeLengthConstants.FIELD_DEFAULT_LENGTH)));
    }
  }
 else {
    metadataColumn.setTalendType(JavaTypesManager.getDefaultJavaType().getId());
    if (metadataTable.getDbms() != null) {
      metadataColumn.setType(TypesManager.getDBTypeFromTalendType(metadataTable.getDbms(),metadataColumn.getTalendType()));
    }
  }
  return metadataColumn;
}