Program: 127460
Project: 127460
Buggy source:
/** 
 * DOC amaumont Comment method "createNewMetadataColumn".
 * @return
 */
public MetadataColumn createNewMetadataColumn(String dbmsId){
  MetadataColumn metadataColumn=ConnectionFactory.eINSTANCE.createMetadataColumn();
  String columnName=getNextGeneratedColumnName(defaultLabel);
  metadataColumn.setLabel(columnName);
  metadataColumn.setOriginalField(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 (dbmsId != null) {
        metadataColumn.setSourceType(TypesManager.getDBTypeFromTalendType(dbmsId,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):
/** 
 * DOC amaumont Comment method "createNewMetadataColumn".
 * @return
 */
public MetadataColumn createNewMetadataColumn(String dbmsId){
  MetadataColumn metadataColumn=ConnectionFactory.eINSTANCE.createMetadataColumn();
  String columnName=getNextGeneratedColumnName(defaultLabel);
  metadataColumn.setLabel(columnName);
  metadataColumn.setOriginalField(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 (dbmsId != null) {
      metadataColumn.setSourceType(TypesManager.getDBTypeFromTalendType(dbmsId,metadataColumn.getTalendType()));
    }
  }
  return metadataColumn;
}