Skip to content

AmberFIFOChannel.getPortId throws NoSuchElementException when called before setPortId #4818

@Yicong-Huang

Description

@Yicong-Huang

What happened?

amber/src/main/scala/org/apache/texera/amber/engine/architecture/messaginglayer/AmberFIFOChannel.scala::getPortId does this.portId.get on an Option[PortIdentity] that defaults to None. Calling getPortId before setPortId therefore throws a bare NoSuchElementException with no contextual message — quite different from a guard-and-raise (require(...), assert(...)) that would point the caller at the missing setup step.

portId is also untyped at the API level (the public getter declares PortIdentity, not Option[PortIdentity]), so callers cannot pattern-match safely; their only options today are blind .get access or wrapping in a try/catch.

How to reproduce?

import org.apache.texera.amber.core.virtualidentity.{ActorVirtualIdentity, ChannelIdentity}
import org.apache.texera.amber.engine.architecture.messaginglayer.AmberFIFOChannel

val ch = new AmberFIFOChannel(
  ChannelIdentity(ActorVirtualIdentity("from"), ActorVirtualIdentity("to"), isControl = false)
)
ch.getPortId
// java.util.NoSuchElementException: None.get

Version

1.1.0-incubating (Pre-release/Master)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions