"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataFactory.java" between
apache-log4j-2.11.1-src.tar.gz and apache-log4j-2.11.2-src.tar.gz

About: Apache Log4j 2 is a logging library for Java. Source distribution (Java).

ContextDataFactory.java  (apache-log4j-2.11.1-src):ContextDataFactory.java  (apache-log4j-2.11.2-src)
skipping to change at line 27 skipping to change at line 27
package org.apache.logging.log4j.core.impl; package org.apache.logging.log4j.core.impl;
import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType; import java.lang.invoke.MethodType;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.apache.logging.log4j.core.ContextDataInjector; import org.apache.logging.log4j.core.ContextDataInjector;
import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.util.Loader;
import org.apache.logging.log4j.util.IndexedStringMap; import org.apache.logging.log4j.util.IndexedStringMap;
import org.apache.logging.log4j.util.LoaderUtil;
import org.apache.logging.log4j.util.PropertiesUtil; import org.apache.logging.log4j.util.PropertiesUtil;
import org.apache.logging.log4j.util.ReadOnlyStringMap; import org.apache.logging.log4j.util.ReadOnlyStringMap;
import org.apache.logging.log4j.util.SortedArrayStringMap; import org.apache.logging.log4j.util.SortedArrayStringMap;
import org.apache.logging.log4j.util.StringMap; import org.apache.logging.log4j.util.StringMap;
/** /**
* Factory for creating the StringMap instances used to initialize LogEvents' {@ linkplain LogEvent#getContextData() * Factory for creating the StringMap instances used to initialize LogEvents' {@ linkplain LogEvent#getContextData()
* context data}. When context data is {@linkplain ContextDataInjector injected} into the log event, these StringMap * context data}. When context data is {@linkplain ContextDataInjector injected} into the log event, these StringMap
* instances may be either populated with key-value pairs from the context, or c ompletely replaced altogether. * instances may be either populated with key-value pairs from the context, or c ompletely replaced altogether.
* <p> * <p>
skipping to change at line 68 skipping to change at line 68
static { static {
EMPTY_STRING_MAP.freeze(); EMPTY_STRING_MAP.freeze();
} }
private static Class<? extends StringMap> createCachedClass(final String cla ssName) { private static Class<? extends StringMap> createCachedClass(final String cla ssName) {
if (className == null) { if (className == null) {
return null; return null;
} }
try { try {
return LoaderUtil.loadClass(className).asSubclass(IndexedStringMap.c lass); return Loader.loadClass(className).asSubclass(IndexedStringMap.class );
} catch (final Exception any) { } catch (final Exception any) {
return null; return null;
} }
} }
private static MethodHandle createDefaultConstructor(final Class<? extends S tringMap> cachedClass) { private static MethodHandle createDefaultConstructor(final Class<? extends S tringMap> cachedClass) {
if (cachedClass == null) { if (cachedClass == null) {
return null; return null;
} }
try { try {
skipping to change at line 120 skipping to change at line 120
} }
try { try {
return (IndexedStringMap) INITIAL_CAPACITY_CONSTRUCTOR.invoke(initia lCapacity); return (IndexedStringMap) INITIAL_CAPACITY_CONSTRUCTOR.invoke(initia lCapacity);
} catch (final Throwable ignored) { } catch (final Throwable ignored) {
return new SortedArrayStringMap(initialCapacity); return new SortedArrayStringMap(initialCapacity);
} }
} }
public static StringMap createContextData(final Map<String, String> context) { public static StringMap createContextData(final Map<String, String> context) {
final StringMap contextData = createContextData(context.size()); final StringMap contextData = createContextData(context.size());
for (Entry<String, String> entry : context.entrySet()) { for (final Entry<String, String> entry : context.entrySet()) {
contextData.putValue(entry.getKey(), entry.getValue()); contextData.putValue(entry.getKey(), entry.getValue());
} }
return contextData; return contextData;
} }
public static StringMap createContextData(final ReadOnlyStringMap readOnlySt ringMap) { public static StringMap createContextData(final ReadOnlyStringMap readOnlySt ringMap) {
final StringMap contextData = createContextData(readOnlyStringMap.size() ); final StringMap contextData = createContextData(readOnlyStringMap.size() );
contextData.putAll(readOnlyStringMap); contextData.putAll(readOnlyStringMap);
return contextData; return contextData;
} }
 End of changes. 4 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)