You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2022/02/19 16:53:01 UTC

[logging-log4j2] 02/02: Merge catch clauses.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit b0ea2adb5eed8d041f89ce6a233d5121ff83709b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Feb 19 11:52:57 2022 -0500

    Merge catch clauses.
---
 .../main/java/org/apache/log4j/xml/XmlConfiguration.java | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfiguration.java b/log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfiguration.java
index 3821188..88a4c3d 100644
--- a/log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfiguration.java
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfiguration.java
@@ -638,17 +638,15 @@ public class XmlConfiguration extends Log4j1Configuration {
 
             propSetter.activate();
             return layout;
-        } catch (ConsumerException ce) {
-            Throwable cause = ce.getCause();
-            if (cause instanceof InterruptedException || cause instanceof InterruptedIOException) {
-                Thread.currentThread().interrupt();
-            }
-            LOGGER.error("Could not create the Layout. Reported error follows.", cause);
-        } catch (Exception oops) {
-            if (oops instanceof InterruptedException || oops instanceof InterruptedIOException) {
+        } catch (Exception e) {
+            Throwable cause = e.getCause();
+            if (e instanceof InterruptedException 
+                || e instanceof InterruptedIOException 
+                || cause instanceof InterruptedException
+                || cause instanceof InterruptedIOException) {
                 Thread.currentThread().interrupt();
             }
-            LOGGER.error("Could not create the Layout. Reported error follows.", oops);
+            LOGGER.error("Could not create the Layout. Reported error follows.", e);
         }
         return null;
     }