Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Marian Koncek
32d52092a1 Avoid possible NullPointerException
Resolves: rhbz#1995022
2021-11-08 12:32:13 +01:00
2 changed files with 32 additions and 1 deletions

26
0001-Avoid-NPE.patch Normal file
View file

@ -0,0 +1,26 @@
From d94c5832e14504d44abeba47866dfa7dac5992b5 Mon Sep 17 00:00:00 2001
From: Guillaume Nodet <gnodet@gmail.com>
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

View file

@ -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/
@ -14,6 +14,7 @@ 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
@ -101,6 +102,10 @@ cp -p src/main/native/libjansi.so %{buildroot}%{_prefix}/lib/%{name}
%license license.txt
%changelog
* Mon Nov 08 2021 Marian Koncek <mkoncek@redhat.com> - 2.3.3-4
- Avoid possible NullPointerException
- Resolves: rhbz#1995022
* Fri Sep 24 2021 Marian Koncek <mkoncek@redhat.com> - 2.3.3-3
- Install native artifact into a fixed location
- Related: rhbz#1994935