From e61dc89bff1f6dcc55672dda425425f2e62b3cfd Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sun, 19 Dec 2021 16:35:31 +0000 Subject: possible npes git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896163 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/poi/examples/xslf/BarChartDemo.java | 3 ++- .../src/main/java/org/apache/poi/examples/xslf/ChartFromScratch.java | 3 ++- .../java/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java | 3 ++- .../java/org/apache/poi/examples/xwpf/usermodel/BarChartExample.java | 3 ++- .../java/org/apache/poi/examples/xwpf/usermodel/ChartFromScratch.java | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) (limited to 'poi-examples/src/main') diff --git a/poi-examples/src/main/java/org/apache/poi/examples/xslf/BarChartDemo.java b/poi-examples/src/main/java/org/apache/poi/examples/xslf/BarChartDemo.java index 2c159fbb59..3a54f75ced 100644 --- a/poi-examples/src/main/java/org/apache/poi/examples/xslf/BarChartDemo.java +++ b/poi-examples/src/main/java/org/apache/poi/examples/xslf/BarChartDemo.java @@ -67,7 +67,8 @@ public final class BarChartDemo { BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[1]), StandardCharsets.UTF_8)) { String chartTitle = modelReader.readLine(); // first line is chart title - String[] series = modelReader.readLine().split(","); + String seriesText = modelReader.readLine(); + String[] series = seriesText == null ? new String[0] : seriesText.split(","); // Category Axis Data List listLanguages = new ArrayList<>(10); diff --git a/poi-examples/src/main/java/org/apache/poi/examples/xslf/ChartFromScratch.java b/poi-examples/src/main/java/org/apache/poi/examples/xslf/ChartFromScratch.java index bdfc3ea498..121b642a0c 100644 --- a/poi-examples/src/main/java/org/apache/poi/examples/xslf/ChartFromScratch.java +++ b/poi-examples/src/main/java/org/apache/poi/examples/xslf/ChartFromScratch.java @@ -75,7 +75,8 @@ public final class ChartFromScratch { try (BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[0]), StandardCharsets.UTF_8)) { String chartTitle = modelReader.readLine(); // first line is chart title - String[] series = modelReader.readLine().split(","); + String seriesText = modelReader.readLine(); + String[] series = seriesText == null ? new String[0] : seriesText.split(","); // Category Axis Data List listLanguages = new ArrayList<>(10); diff --git a/poi-examples/src/main/java/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java b/poi-examples/src/main/java/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java index 77a438967f..dba07cedd9 100644 --- a/poi-examples/src/main/java/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java +++ b/poi-examples/src/main/java/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java @@ -73,7 +73,8 @@ public final class DoughnutChartFromScratch { try (BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[0]), StandardCharsets.UTF_8)) { String chartTitle = modelReader.readLine(); // first line is chart title - String[] series = modelReader.readLine().split(","); + String seriesText = modelReader.readLine(); + String[] series = seriesText == null ? new String[0] : seriesText.split(","); // Category Axis Data List listLanguages = new ArrayList<>(10); diff --git a/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/BarChartExample.java b/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/BarChartExample.java index d26907c30e..df79c5199b 100644 --- a/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/BarChartExample.java +++ b/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/BarChartExample.java @@ -66,7 +66,8 @@ public final class BarChartExample { BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[1]), StandardCharsets.UTF_8)) { String chartTitle = modelReader.readLine(); // first line is chart title - String[] series = modelReader.readLine().split(","); + String seriesText = modelReader.readLine(); + String[] series = seriesText == null ? new String[0] : seriesText.split(","); // Category Axis Data List listLanguages = new ArrayList<>(10); diff --git a/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/ChartFromScratch.java b/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/ChartFromScratch.java index 889ff30fb1..0625204699 100644 --- a/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/ChartFromScratch.java +++ b/poi-examples/src/main/java/org/apache/poi/examples/xwpf/usermodel/ChartFromScratch.java @@ -70,7 +70,8 @@ public final class ChartFromScratch { try (BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[0]), StandardCharsets.UTF_8)) { String chartTitle = modelReader.readLine(); // first line is chart title - String[] series = modelReader.readLine().split(","); + String seriesText = modelReader.readLine(); + String[] series = seriesText == null ? new String[0] : seriesText.split(","); // Category Axis Data List listLanguages = new ArrayList<>(10); -- cgit v1.2.3