Force SLF4J SimpleLogger re-initialization

- Resolves: rhbz#1324832
This commit is contained in:
Mikolaj Izdebski 2016-04-08 01:06:18 +02:00
parent ccbf3ee282
commit d0a8fbfe89
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,44 @@
From 623fb2bd14731aac8fdc29e3544d765e953707fc Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Fri, 8 Apr 2016 01:05:29 +0200
Subject: [PATCH] Force SLF4J SimpleLogger re-initialization
---
.../main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java b/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java
index bffd18c..5af6a68 100644
--- a/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java
+++ b/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java
@@ -1,5 +1,7 @@
package org.slf4j.impl;
+import java.lang.reflect.Field;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -30,6 +32,19 @@
{
public static void init()
{
+ // Force SimpleLogger re-initialization
+ // See https://bugzilla.redhat.com/show_bug.cgi?id=1324832
+ try
+ {
+ Field initializedField = SimpleLogger.class.getDeclaredField( "INITIALIZED" );
+ initializedField.setAccessible( true );
+ initializedField.set( null, false );
+ }
+ catch ( ReflectiveOperationException e )
+ {
+ throw new RuntimeException( e );
+ }
+
SimpleLogger.init();
ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
if ( loggerFactory instanceof SimpleLoggerFactory )
--
2.5.0

View File

@ -1,6 +1,6 @@
Name: maven
Version: 3.3.9
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Java project management and project comprehension tool
License: ASL 2.0
URL: http://maven.apache.org/
@ -11,6 +11,8 @@ Source1: maven-bash-completion
Source2: mvn.1
Source200: %{name}-script
Patch0: 0001-Force-SLF4J-SimpleLogger-re-initialization.patch
# If XMvn is part of the same RPM transaction then it should be
# installed first to avoid triggering rhbz#1014355.
OrderWithRequires: xmvn
@ -137,6 +139,7 @@ Group: Documentation
%prep
%setup -q -n apache-%{name}-%{version}%{?ver_add}
%patch0 -p1
# not really used during build, but a precaution
rm maven-ant-tasks-*.jar
@ -269,6 +272,10 @@ ln -sf $(build-classpath plexus/classworlds) \
%changelog
* Thu Apr 7 2016 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.3.9-4
- Force SLF4J SimpleLogger re-initialization
- Resolves: rhbz#1324832
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.9-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild