From 5f13dce508297008bc8ddfc5911788372dd88cdf Mon Sep 17 00:00:00 2001 From: Marian Koncek Date: Wed, 18 Aug 2021 17:48:47 +0200 Subject: [PATCH] Avoid possible NullPointerException Resolves: rhbz#1993889 --- 0001-Avoid-NPE.patch | 26 ++++++++++++++++++++++++++ jansi.spec | 8 +++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 0001-Avoid-NPE.patch diff --git a/0001-Avoid-NPE.patch b/0001-Avoid-NPE.patch new file mode 100644 index 0000000..1aaa967 --- /dev/null +++ b/0001-Avoid-NPE.patch @@ -0,0 +1,26 @@ +From d94c5832e14504d44abeba47866dfa7dac5992b5 Mon Sep 17 00:00:00 2001 +From: Guillaume Nodet +Date: Fri, 23 Jul 2021 09:22:19 +0200 +Subject: [PATCH] Avoid possible NPE, fixes #214 + +--- + src/main/java/org/fusesource/jansi/AnsiPrintStream.java | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/main/java/org/fusesource/jansi/AnsiPrintStream.java b/src/main/java/org/fusesource/jansi/AnsiPrintStream.java +index e153c43..df6e5a6 100644 +--- a/src/main/java/org/fusesource/jansi/AnsiPrintStream.java ++++ b/src/main/java/org/fusesource/jansi/AnsiPrintStream.java +@@ -76,7 +76,11 @@ public void install() throws IOException { + } + + public void uninstall() throws IOException { +- getOut().uninstall(); ++ // If the system output stream has been closed, out should be null, so avoid a NPE ++ AnsiOutputStream out = getOut(); ++ if (out != null) { ++ out.uninstall(); ++ } + } + + @Override diff --git a/jansi.spec b/jansi.spec index 882c7ea..541c186 100644 --- a/jansi.spec +++ b/jansi.spec @@ -2,7 +2,7 @@ Name: jansi Version: 2.3.3 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Generate and interpret ANSI escape sequences in Java License: ASL 2.0 URL: http://fusesource.github.io/jansi/ @@ -15,6 +15,8 @@ Source1: generate-tarball.sh # Change the location of the native artifact to where Fedora wants it Patch0: %{name}-jni.patch +Patch1: 0001-Avoid-NPE.patch + BuildRequires: gcc BuildRequires: maven-local %if %{with bootstrap} @@ -101,6 +103,10 @@ cp -p src/main/native/libjansi.so %{buildroot}%{_libdir}/%{name} %license license.txt %changelog +* Wed Aug 18 2021 Marian Koncek - 2.3.3-4 +- Avoid possible NullPointerException +- Resolves: rhbz#1993889 + * Mon Aug 09 2021 Mohan Boddu - 2.3.3-3 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688