Repository: logging-log4j2
Updated Branches:
  refs/heads/master 6cb166400 -> dec0f699d


[LOG4J2-1063] Avoid creating temporary array object in
org.apache.logging.slf4j.Log4jMarker.iterator().

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/dec0f699
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/dec0f699
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/dec0f699

Branch: refs/heads/master
Commit: dec0f699dda10d3b8cd911ea43ffd339abc10831
Parents: 6cb1664
Author: ggregory <[email protected]>
Authored: Mon Jun 22 10:26:49 2015 -0700
Committer: ggregory <[email protected]>
Committed: Mon Jun 22 10:26:49 2015 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/logging/slf4j/Log4jMarker.java     | 5 +++--
 src/changes/changes.xml                                         | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/dec0f699/log4j-slf4j-impl/src/main/java/org/apache/logging/slf4j/Log4jMarker.java
----------------------------------------------------------------------
diff --git 
a/log4j-slf4j-impl/src/main/java/org/apache/logging/slf4j/Log4jMarker.java 
b/log4j-slf4j-impl/src/main/java/org/apache/logging/slf4j/Log4jMarker.java
index aee8dcf..0e05d6e 100644
--- a/log4j-slf4j-impl/src/main/java/org/apache/logging/slf4j/Log4jMarker.java
+++ b/log4j-slf4j-impl/src/main/java/org/apache/logging/slf4j/Log4jMarker.java
@@ -79,8 +79,9 @@ public class Log4jMarker implements Marker {
 
     @Override
     public Iterator<Marker> iterator() {
-        final List<Marker> parents = new ArrayList<>();
-        for (final org.apache.logging.log4j.Marker m : 
this.marker.getParents()) {
+        org.apache.logging.log4j.Marker[] log4jParents = 
this.marker.getParents();
+        final List<Marker> parents = new ArrayList<>(log4jParents.length);
+               for (final org.apache.logging.log4j.Marker m : log4jParents) {
             parents.add(factory.getMarker(m.getName()));
         }
         return parents.iterator();

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/dec0f699/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 657f762..eb50bce 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -99,6 +99,9 @@
       <action issue="LOG4J2-1062" dev="ggregory" type="fix">
         Log4jMarker#add(Marker) does not respect org.slf4j.Marker contract.
       </action>            
+      <action issue="LOG4J2-1063" dev="ggregory" type="update">
+        Avoid creating temporary array object in 
org.apache.logging.slf4j.Log4jMarker.iterator().
+      </action>
       <action issue="LOG4J2-890" dev="ggregory" type="update" due-to="Hassan 
Kalaldeh, Robert Andersson, Remko Popma">
         log4j-web-2.1 should workaround a bug in JBOSS EAP 6.2.
       </action>

Reply via email to