Program: 66463
Project: 66463
Buggy source:
/** 
 * Build a field definition object from a database field.
 */
private FieldDefinition getFieldDefFromDBField(DatabaseField dbField,boolean isPrimaryKey){
  FieldDefinition fieldDef=this.fieldMap.get(dbField);
  if (fieldDef == null) {
    fieldDef=new FieldDefinition();
    fieldDef.setName(dbField.getNameDelimited(databasePlatform));
    if (dbField.getColumnDefinition() != null && dbField.getColumnDefinition().length() > 0) {
      fieldDef.setTypeDefinition(dbField.getColumnDefinition());
    }
 else {
      Class fieldType=dbField.getType();
      FieldTypeDefinition fieldTypeDef=(fieldType == null) ? null : databasePlatform.getFieldTypeDefinition(fieldType);
      if (fieldType != null) {
        if (fieldType.equals(ClassConstants.STRING) || fieldType.equals(ClassConstants.BLOB) || fieldType.equals(ClassConstants.CLOB)|| fieldType.equals(ClassConstants.APCHAR)|| fieldType.equals(ClassConstants.ACHAR)|| fieldType.equals(ClassConstants.ABYTE)|| fieldType.equals(ClassConstants.APBYTE)) {
          if (fieldTypeDef == null || fieldTypeDef.isSizeAllowed()) {
            fieldDef.setSize(dbField.getLength());
          }
        }
 else {
          if (dbField.getPrecision() > 0) {
            if (fieldTypeDef == null || fieldTypeDef.isSizeAllowed()) {
              fieldDef.setSize(dbField.getPrecision());
              fieldDef.setSubSize(dbField.getScale());
            }
          }
        }
      }
      if ((fieldType == null) || (!fieldType.isPrimitive() && (fieldTypeDef == null))) {
        AbstractSessionLog.getLog().log(SessionLog.FINEST,"String_Node_Str",dbField.getQualifiedName(),fieldType);
        fieldDef.setType(ClassConstants.STRING);
      }
 else {
        fieldDef.setType(ConversionManager.getObjectClass(fieldType));
      }
      fieldDef.setShouldAllowNull(dbField.isNullable());
      fieldDef.setUnique(dbField.isUnique());
    }
    fieldDef.setIsPrimaryKey(isPrimaryKey);
    fieldMap.put(dbField,fieldDef);
    databaseFields.put(dbField,dbField);
  }
  return fieldDef;
}

Fixed version (ground truth):
/** 
 * Build a field definition object from a database field.
 */
private FieldDefinition getFieldDefFromDBField(DatabaseField dbField,boolean isPrimaryKey){
  FieldDefinition fieldDef=this.fieldMap.get(dbField);
  if (fieldDef == null) {
    fieldDef=new FieldDefinition();
    fieldDef.setName(dbField.getNameDelimited(databasePlatform));
    if (dbField.getColumnDefinition() != null && dbField.getColumnDefinition().length() > 0) {
      fieldDef.setTypeDefinition(dbField.getColumnDefinition());
    }
 else {
      Class fieldType=dbField.getType();
      FieldTypeDefinition fieldTypeDef=(fieldType == null) ? null : databasePlatform.getFieldTypeDefinition(fieldType);
      if (fieldType != null) {
        if (dbField.getLength() > 0) {
          fieldDef.setSize(dbField.getLength());
        }
 else         if (dbField.getPrecision() > 0) {
          fieldDef.setSize(dbField.getPrecision());
          fieldDef.setSubSize(dbField.getScale());
        }
      }
      if ((fieldType == null) || (!fieldType.isPrimitive() && (fieldTypeDef == null))) {
        AbstractSessionLog.getLog().log(SessionLog.FINEST,"String_Node_Str",dbField.getQualifiedName(),fieldType);
        fieldDef.setType(ClassConstants.STRING);
      }
 else {
        fieldDef.setType(ConversionManager.getObjectClass(fieldType));
      }
      fieldDef.setShouldAllowNull(dbField.isNullable());
      fieldDef.setUnique(dbField.isUnique());
    }
    fieldDef.setIsPrimaryKey(isPrimaryKey);
    fieldMap.put(dbField,fieldDef);
    databaseFields.put(dbField,dbField);
  }
  return fieldDef;
}