Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

BoxChart rejects valid List.of data with NullPointerException

Open Beginner friendly
#1,032 0 comments 0 reactions 0 assignees View on GitHub

@PHJ2000 is already working on this.

Since Oct 5, 2026.

  • #1033 by @PHJ2000 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java

Research direction

Start by reading the validation paths used by BoxChart.addSeries, series.replaceData, and chart.updateBoxSeries; the issue identifies all three entry points. Add or update tests for two- and three-element List.of inputs, replacement/update, and lists containing null. Done means null-free immutable lists are accepted and lists with null elements remain rejected.

Written by the indexing model from the issue text.

Description

Describe the bug
BoxChart rejects valid, null-free lists created with List.of(...). Both adding a series and replacing its data throw NullPointerException because the validation calls contains(null), which these lists do not support.

To Reproduce

import java.util.List;
import org.knowm.xchart.BoxChart;
import org.knowm.xchart.BoxChartBuilder;
import org.knowm.xchart.SwingWrapper;

public class ImmutableBoxData {
  public static void main(String[] args) {
    new SwingWrapper<>(getChart()).displayChart();
  }

  public static BoxChart getChart() {
    BoxChart chart = new BoxChartBuilder().width(640).height(480).build();
    chart.addSeries("sample", List.of(1, 2, 3)); // NullPointerException
    return chart;
  }
}

The same exception occurs when calling series.replaceData(List.of(4, 5)) or chart.updateBoxSeries(...) on an existing series.

Expected behavior
Accept the null-free lists while continuing to reject lists that actually contain null elements.

Reproduced on 4.0.5-SNAPSHOT, Java 11. The exception happens before rendering, so no screenshot is needed. Tests cover two- and three-element immutable lists, replacement/update, and rejection of actual null elements.

Dominant language
Java
Stars
1.6k
Forks
398
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from knowm/XChart

All issues in knowm/XChart

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.