Skip to content

[Bug]: DefaultMigrationService uses assert instead of exceptions for validation #212

@Splatcrafter

Description

@Splatcrafter

AI REVIEWED

Module: spring-boot-starter
File: spring/service/DefaultMigrationService.java (~line 413-414)
Severity: High

Summary

Builder validation uses assert statements which are disabled by default in production JVMs:

assert from != null : "fromVersion must be set";
assert to != null : "toVersion must be set";

Expected Behavior

Validation should always execute, throwing IllegalStateException for invalid builder state.

Actual Behavior

With -ea disabled (production default), invalid builder states pass silently to the migration call, causing confusing NPEs later.

Suggested Fix

if (from == null) throw new IllegalStateException("fromVersion must be set");
if (to == null) throw new IllegalStateException("toVersion must be set");

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions