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 2014/09/03 07:47:31 UTC
[1/2] git commit: [LOG4J2-811] SimpleLogger throws
ArrayIndexOutOfBoundsException for an empty array.
Repository: logging-log4j2
Updated Branches:
refs/heads/master b5bc43857 -> 1484a9da6
[LOG4J2-811] SimpleLogger throws ArrayIndexOutOfBoundsException for an
empty array.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/82516fcd
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/82516fcd
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/82516fcd
Branch: refs/heads/master
Commit: 82516fcd8c96f67e3feda765a3fa78155365d30b
Parents: 49aaf52
Author: Gary Gregory <ga...@gmail.com>
Authored: Wed Sep 3 01:33:18 2014 -0400
Committer: Gary Gregory <ga...@gmail.com>
Committed: Wed Sep 3 01:33:18 2014 -0400
----------------------------------------------------------------------
.../org/apache/logging/log4j/TestLogger.java | 2 +-
.../logging/log4j/simple/SimpleLoggerTest.java | 49 ++++++++++++++++++++
src/changes/changes.xml | 3 ++
3 files changed, 53 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/82516fcd/log4j-api/src/test/java/org/apache/logging/log4j/TestLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/TestLogger.java b/log4j-api/src/test/java/org/apache/logging/log4j/TestLogger.java
index 2de7a53..7817292 100644
--- a/log4j-api/src/test/java/org/apache/logging/log4j/TestLogger.java
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/TestLogger.java
@@ -69,7 +69,7 @@ public class TestLogger extends AbstractLogger {
}
final Object[] params = msg.getParameters();
Throwable t;
- if (throwable == null && params != null && params[params.length -1] instanceof Throwable ) {
+ if (throwable == null && params != null && params.length > 0 && params[params.length - 1] instanceof Throwable) {
t = (Throwable) params[params.length - 1];
} else {
t = throwable;
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/82516fcd/log4j-api/src/test/java/org/apache/logging/log4j/simple/SimpleLoggerTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/simple/SimpleLoggerTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/simple/SimpleLoggerTest.java
new file mode 100644
index 0000000..4ee0e19
--- /dev/null
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/simple/SimpleLoggerTest.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.simple;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.junit.Test;
+
+public class SimpleLoggerTest {
+
+ Logger logger = LogManager.getLogger("TestError");
+
+ @Test
+ public void testString() {
+ logger.info("Hello");
+ }
+
+ @Test
+ public void testMissingMessageArg() {
+ logger.info("Hello {}");
+ }
+
+ @Test
+ public void testEmptyObjectArray() {
+ logger.info(new Object[0]);
+ }
+
+ /**
+ * Tests LOG4J2-811.
+ */
+ @Test
+ public void testMessageWithEmptyObjectArray() {
+ logger.info("Hello {} {}", new Object[0]);
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/82516fcd/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 864d52a..fd0d5bf 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,9 @@
</properties>
<body>
<release version="2.?.?" date="2014-??-??" description="Bug fixes and enhancements">
+ <action issue="LOG4J2-811" dev="ggregory" type="fix" due-to="Yogesh Rao">
+ SimpleLogger throws ArrayIndexOutOfBoundsException for an empty array.
+ </action>
<action issue="LOG4J2-663" dev="mattsicker" type="fix" due-to="Florian Brunner">
Fix OSGi Import-Package problem with the JMS API.
</action>
[2/2] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/logging-log4j2
Posted by gg...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/logging-log4j2
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/1484a9da
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/1484a9da
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/1484a9da
Branch: refs/heads/master
Commit: 1484a9da6bb625154ec7f0a0641607a5ca987dc8
Parents: 82516fc b5bc438
Author: Gary Gregory <ga...@gmail.com>
Authored: Wed Sep 3 01:35:40 2014 -0400
Committer: Gary Gregory <ga...@gmail.com>
Committed: Wed Sep 3 01:35:40 2014 -0400
----------------------------------------------------------------------
log4j-iostreams/.gitignore | Bin 0 -> 69 bytes
log4j-iostreams/pom.xml | 217 ++++++++++++++
.../logging/log4j/io/ByteStreamLogger.java | 152 ++++++++++
.../logging/log4j/io/CharStreamLogger.java | 110 +++++++
.../log4j/io/LoggerBufferedInputStream.java | 104 +++++++
.../logging/log4j/io/LoggerBufferedReader.java | 91 ++++++
.../log4j/io/LoggerFilterOutputStream.java | 100 +++++++
.../logging/log4j/io/LoggerFilterWriter.java | 98 +++++++
.../logging/log4j/io/LoggerInputStream.java | 91 ++++++
.../logging/log4j/io/LoggerOutputStream.java | 86 ++++++
.../logging/log4j/io/LoggerPrintStream.java | 284 +++++++++++++++++++
.../logging/log4j/io/LoggerPrintWriter.java | 258 +++++++++++++++++
.../apache/logging/log4j/io/LoggerReader.java | 94 ++++++
.../apache/logging/log4j/io/LoggerStreams.java | 170 +++++++++++
.../apache/logging/log4j/io/LoggerWriter.java | 89 ++++++
.../io/AbstractLoggerOutputStreamTest.java | 138 +++++++++
.../log4j/io/AbstractLoggerWriterTest.java | 138 +++++++++
.../logging/log4j/io/AbstractStreamTest.java | 66 +++++
...LoggerBufferedInputStreamCallerInfoTest.java | 66 +++++
.../log4j/io/LoggerBufferedInputStreamTest.java | 29 ++
.../io/LoggerBufferedReaderCallerInfoTest.java | 84 ++++++
.../log4j/io/LoggerBufferedReaderTest.java | 41 +++
.../log4j/io/LoggerFilterOutputStreamTest.java | 36 +++
.../log4j/io/LoggerFilterWriterTest.java | 18 ++
.../io/LoggerInputStreamCallerInfoTest.java | 54 ++++
.../logging/log4j/io/LoggerInputStreamTest.java | 127 +++++++++
.../io/LoggerOutputStreamCallerInfoTest.java | 50 ++++
.../log4j/io/LoggerOutputStreamTest.java | 36 +++
.../io/LoggerPrintStreamCallerInfoTest.java | 146 ++++++++++
.../logging/log4j/io/LoggerPrintStreamTest.java | 122 ++++++++
.../io/LoggerPrintWriterCallerInfoTest.java | 145 ++++++++++
.../logging/log4j/io/LoggerPrintWriterTest.java | 124 ++++++++
.../log4j/io/LoggerReaderCallerInfoTest.java | 57 ++++
.../logging/log4j/io/LoggerReaderTest.java | 141 +++++++++
.../io/LoggerStreamsCallerInfoTesting.java | 55 ++++
.../logging/log4j/io/LoggerWriterTest.java | 34 +++
.../resources/log4j2-streams-calling-info.xml | 30 ++
.../test/resources/log4j2-streams-unit-test.xml | 30 ++
log4j-streams/.gitignore | Bin 69 -> 0 bytes
log4j-streams/pom.xml | 212 --------------
.../logging/log4j/streams/ByteStreamLogger.java | 152 ----------
.../logging/log4j/streams/CharStreamLogger.java | 110 -------
.../streams/LoggerBufferedInputStream.java | 104 -------
.../log4j/streams/LoggerBufferedReader.java | 91 ------
.../log4j/streams/LoggerFilterOutputStream.java | 100 -------
.../log4j/streams/LoggerFilterWriter.java | 98 -------
.../log4j/streams/LoggerInputStream.java | 91 ------
.../log4j/streams/LoggerOutputStream.java | 86 ------
.../log4j/streams/LoggerPrintStream.java | 284 -------------------
.../log4j/streams/LoggerPrintWriter.java | 258 -----------------
.../logging/log4j/streams/LoggerReader.java | 94 ------
.../logging/log4j/streams/LoggerStreams.java | 170 -----------
.../logging/log4j/streams/LoggerWriter.java | 89 ------
.../streams/AbstractLoggerOutputStreamTest.java | 138 ---------
.../log4j/streams/AbstractLoggerWriterTest.java | 138 ---------
.../log4j/streams/AbstractStreamTest.java | 66 -----
...LoggerBufferedInputStreamCallerInfoTest.java | 66 -----
.../streams/LoggerBufferedInputStreamTest.java | 29 --
.../LoggerBufferedReaderCallerInfoTest.java | 84 ------
.../log4j/streams/LoggerBufferedReaderTest.java | 41 ---
.../streams/LoggerFilterOutputStreamTest.java | 36 ---
.../log4j/streams/LoggerFilterWriterTest.java | 18 --
.../LoggerInputStreamCallerInfoTest.java | 54 ----
.../log4j/streams/LoggerInputStreamTest.java | 127 ---------
.../LoggerOutputStreamCallerInfoTest.java | 50 ----
.../log4j/streams/LoggerOutputStreamTest.java | 36 ---
.../LoggerPrintStreamCallerInfoTest.java | 146 ----------
.../log4j/streams/LoggerPrintStreamTest.java | 122 --------
.../LoggerPrintWriterCallerInfoTest.java | 145 ----------
.../log4j/streams/LoggerPrintWriterTest.java | 124 --------
.../streams/LoggerReaderCallerInfoTest.java | 57 ----
.../logging/log4j/streams/LoggerReaderTest.java | 141 ---------
.../streams/LoggerStreamsCallerInfoTesting.java | 55 ----
.../logging/log4j/streams/LoggerWriterTest.java | 34 ---
.../resources/log4j2-streams-calling-info.xml | 30 --
.../test/resources/log4j2-streams-unit-test.xml | 30 --
pom.xml | 2 +-
77 files changed, 3712 insertions(+), 3707 deletions(-)
----------------------------------------------------------------------