Skip to content

Commit b00f90f

Browse files
committed
Merge pull request #252 from dharkness/patch-1
# By David Harkness * patch-1: Compare Kind references before checking log levels
2 parents 12db873 + 801f196 commit b00f90f

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJWeaverMessageHandler.java

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,36 +51,32 @@ public class AspectJWeaverMessageHandler implements IMessageHandler {
5151
public boolean handleMessage(IMessage message) throws AbortException {
5252
Kind messageKind = message.getKind();
5353

54-
if (LOGGER.isDebugEnabled() || LOGGER.isTraceEnabled()) {
55-
if (messageKind == IMessage.DEBUG) {
54+
if (messageKind == IMessage.DEBUG) {
55+
if (LOGGER.isDebugEnabled() || LOGGER.isTraceEnabled()) {
5656
LOGGER.debug(makeMessageFor(message));
5757
return true;
5858
}
5959
}
60-
61-
if (LOGGER.isInfoEnabled()) {
62-
if ((messageKind == IMessage.INFO) || (messageKind == IMessage.WEAVEINFO)) {
60+
else if ((messageKind == IMessage.INFO) || (messageKind == IMessage.WEAVEINFO)) {
61+
if (LOGGER.isInfoEnabled()) {
6362
LOGGER.info(makeMessageFor(message));
6463
return true;
6564
}
6665
}
67-
68-
if (LOGGER.isWarnEnabled()) {
69-
if (messageKind == IMessage.WARNING) {
66+
else if (messageKind == IMessage.WARNING) {
67+
if (LOGGER.isWarnEnabled()) {
7068
LOGGER.warn(makeMessageFor(message));
7169
return true;
7270
}
7371
}
74-
75-
if (LOGGER.isErrorEnabled()) {
76-
if (messageKind == IMessage.ERROR) {
72+
else if (messageKind == IMessage.ERROR) {
73+
if (LOGGER.isErrorEnabled()) {
7774
LOGGER.error(makeMessageFor(message));
7875
return true;
7976
}
8077
}
81-
82-
if (LOGGER.isFatalEnabled()) {
83-
if (messageKind == IMessage.ABORT) {
78+
else if (messageKind == IMessage.ABORT) {
79+
if (LOGGER.isFatalEnabled()) {
8480
LOGGER.fatal(makeMessageFor(message));
8581
return true;
8682
}

0 commit comments

Comments
 (0)