logging-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: logging-log4j2 git commit: [LOG4J2-2177] Replace use of deprecated Core API org.apache.logging.log4j.core.impl.Log4jLogEvent.Builder.setContextMap(Map<String, String>). Add non-JRE-Map ctors for our not-real-Maps: StringMap and IndexedStringMap.
Date Tue, 09 Jan 2018 01:04:28 GMT
On Mon, Jan 8, 2018 at 3:49 PM, Remko Popma <remko.popma@gmail.com> wrote:

>
>
> > On Jan 9, 2018, at 4:49, ggregory@apache.org wrote:
> >
> > Repository: logging-log4j2
> > Updated Branches:
> >  refs/heads/master 2352052d0 -> 9637dc558
> >
> >
> > [LOG4J2-2177] Replace use of deprecated Core API
> > org.apache.logging.log4j.core.impl.Log4jLogEvent.Builder.
> setContextMap(Map<String,
> > String>). Add non-JRE-Map ctors for our not-real-Maps: StringMap and
> > IndexedStringMap.
> >
> > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
> commit/9637dc55
> > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
> 9637dc55
> > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
> 9637dc55
> >
> > Branch: refs/heads/master
> > Commit: 9637dc558e338cf3db368dc0fc6bd2a76d09e2cf
> > Parents: 2352052
> > Author: Gary Gregory <ggregory@apache.org>
> > Authored: Mon Jan 8 12:49:03 2018 -0700
> > Committer: Gary Gregory <ggregory@apache.org>
> > Committed: Mon Jan 8 12:49:03 2018 -0700
> >
> > ----------------------------------------------------------------------
> > .../logging/log4j/message/MapMessage.java | 21 +++++++++++++++++++-
> > 1 file changed, 20 insertions(+), 1 deletion(-)
> > ----------------------------------------------------------------------
> >
> >
> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> 9637dc55/log4j-api/src/main/java/org/apache/logging/log4j/
> message/MapMessage.java
> > ----------------------------------------------------------------------
> > diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java
> b/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java
> > index 9f2aeeb..b48e825 100644
> > --- a/log4j-api/src/main/java/org/apache/logging/log4j/message/
> MapMessage.java
> > +++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/
> MapMessage.java
> > @@ -30,6 +30,7 @@ import org.apache.logging.log4j.util.
> PerformanceSensitive;
> > import org.apache.logging.log4j.util.ReadOnlyStringMap;
> > import org.apache.logging.log4j.util.SortedArrayStringMap;
> > import org.apache.logging.log4j.util.StringBuilders;
> > +import org.apache.logging.log4j.util.StringMap;
> > import org.apache.logging.log4j.util.Strings;
> > import org.apache.logging.log4j.util.TriConsumer;
> >
> > @@ -100,6 +101,15 @@ public class MapMessage<M extends MapMessage<M, V>,
> V> implements MultiFormatStr
> >     }
> >
> >     /**
> > +     * Constructs a new instance based on an existing {@link
> IndexedStringMap}.
> > +     * @param map The IndexedStringMap.
> > +     * @since 2.10.1
> > +     */
> > +    public MapMessage(final IndexedStringMap map) {
> > +        this.data = map;
> > +    }
> > +
> > +    /**
> >      * Constructs a new instance.
> >      *
> >      * @param  initialCapacity the initial capacity.
> > @@ -109,13 +119,22 @@ public class MapMessage<M extends MapMessage<M,
> V>, V> implements MultiFormatStr
> >     }
> >
> >     /**
> > -     * Constructs a new instance based on an existing Map.
> > +     * Constructs a new instance based on an existing {@link Map}.
> >      * @param map The Map.
> >      */
> >     public MapMessage(final Map<String, V> map) {
> >         this.data = new SortedArrayStringMap(map);
> >     }
> >
> > +    /**
> > +     * Constructs a new instance based on an existing {@link StringMap}.
> > +     * @param map The StringMap.
> > +     * @since 2.10.1
> > +     */
> > +    public MapMessage(final StringMap map) {
> > +        this.data = map instanceof IndexedStringMap ?
> (IndexedStringMap) map : new SortedArrayStringMap(map);
> > +    }
> > +
>
> The constructor should make a defensive copy of the constructor parameter
> regardless of whether it implements IndexedStringMap or not.
>

I just removed these constructors. See Mikael's comment in the Jira WRT to
scope.

Gary


>
> >     @Override
> >     public String[] getFormats() {
> >         return MapFormat.names();
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message