Skip to content

FeatureDirectionKind#createFeatureDirectionKindFromString throws exception when initialValue is null during EMF transaction commit #652

@Orangewithsugar

Description

@Orangewithsugar

Hello SysML Team!

Description:

While working with the SysML v2 Pilot, I encountered an issue when setting the direction of a Usage element in a model.

Although the command setting the direction property executes successfully inside TransactionalCommandStack#doExecute(), an exception is thrown after the command completes—during the EMF transaction commit phase. Specifically, during the consolidation of recorded model changes, EMF internally attempts to resolve feature values via createFromString(...).

The generated factory method createFeatureDirectionKindFromString(...) is invoked with a null value for initialValue, which results in an unhandled exception:

Image
Image

Since initialValue == null, FeatureDirectionKind.get(null) returns null, which then triggers the IllegalArgumentException.

Root Cause:

During transaction commit, EMF uses ChangeRecorder to analyze and consolidate changes. As part of this, it tries to resolve feature values via EFactory.createFromString(...). When it encounters a null string for an enum value (FeatureDirectionKind in this case), the generated method fails due to missing null-check logic.

This situation is common in EMF when model attributes are optional or unset.

Is it possible to add a NONE enum for FeatureDirectionKind? So do PortionKind~
Environment:

JDK version: [17.0.1]

SysML version: [0.48.0]

Let me know if there is a workaround or if this can be addressed in a future update. Thank you for your support!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions