Skip to content

LineChartOpDesc.generatePythonCode throws NPE when lines is null (the default) #4811

@Yicong-Huang

Description

@Yicong-Huang

What happened?

common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/lineChart/LineChartOpDesc.scala declares var lines: util.List[LineConfig] = _, which defaults to null. createPlotlyFigure then calls lines.asScala.map(...) without a null check, so generatePythonCode on a freshly constructed LineChartOpDesc raises java.lang.NullPointerException at LineChartOpDesc.scala:68 — quite different from the explicit AssertionError paths used by sibling visualizers (e.g. HeatMapOpDesc, BarChartOpDesc).

The fix is either to default lines to an empty list, or to null-guard / assert nonEmpty before the .asScala.map(...) call.

How to reproduce?

import org.apache.texera.amber.operator.visualization.lineChart.LineChartOpDesc

new LineChartOpDesc().generatePythonCode()
// java.lang.NullPointerException
//   at LineChartOpDesc.createPlotlyFigure(LineChartOpDesc.scala:68)
//   at LineChartOpDesc.generatePythonCode(LineChartOpDesc.scala:122)

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