Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BEANUTILS-562 replace commons-logging with slf4j #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@

<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import java.lang.reflect.InvocationTargetException;
import java.util.function.Predicate;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* <p>Predicate implementation that applies the given {@code Predicate}
Expand All @@ -32,7 +32,7 @@
*/
public class BeanPredicate<T> implements Predicate<T> {

private final Log log = LogFactory.getLog(this.getClass());
private final Logger log = LoggerFactory.getLogger(this.getClass());

/** Name of the property whose value will be predicated */
private String propertyName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import java.lang.reflect.InvocationTargetException;
import java.util.function.Consumer;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
Expand Down Expand Up @@ -82,7 +82,7 @@
public class BeanPropertyValueChangeConsumer<T, V> implements Consumer<T> {

/** For logging. Each subclass gets its own log instance. */
private final Log log = LogFactory.getLog(this.getClass());
private final Logger log = LoggerFactory.getLogger(this.getClass());

/**
* The name of the property which will be updated when this {@code Closure} executes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import java.util.Objects;
import java.util.function.Predicate;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* <p>{@code Predicate} that evaluates a property value against a specified value.</p>
Expand Down Expand Up @@ -113,7 +113,7 @@
public class BeanPropertyValueEqualsPredicate<T, V> implements Predicate<T> {

/** For logging. Each subclass gets its own log instance. */
private final Log log = LogFactory.getLog(this.getClass());
private final Logger log = LoggerFactory.getLogger(this.getClass());

/**
* The name of the property which will be evaluated when this {@code Predicate} is executed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import java.lang.reflect.InvocationTargetException;
import java.util.function.Function;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
Expand Down Expand Up @@ -74,7 +74,7 @@
public class BeanToPropertyValueTransformer<T, R> implements Function<T, R> {

/** For logging. Each subclass gets its own log instance. */
private final Log log = LogFactory.getLog(this.getClass());
private final Logger log = LoggerFactory.getLogger(this.getClass());

/** The name of the property that will be used in the transformation of the object. */
private final String propertyName;
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/apache/commons/beanutils2/BeanUtilsBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import java.util.Map;

import org.apache.commons.beanutils2.expression.Resolver;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* <p>JavaBean property population methods.</p>
Expand Down Expand Up @@ -59,7 +59,7 @@ protected BeanUtilsBean initialValue() {
/**
* Logging for this instance
*/
private static final Log LOG = LogFactory.getLog(BeanUtilsBean.class);
private static final Logger LOG = LoggerFactory.getLogger(BeanUtilsBean.class);

/** A reference to Throwable's initCause method, or null if it's not there in this JVM */
private static final Method INIT_CAUSE_METHOD = getInitCauseMethod();
Expand Down Expand Up @@ -94,13 +94,13 @@ private static Method getInitCauseMethod() {
final Class<?>[] paramsClasses = { Throwable.class };
return Throwable.class.getMethod("initCause", paramsClasses);
} catch (final NoSuchMethodException e) {
final Log log = LogFactory.getLog(BeanUtils.class);
final Logger log = LoggerFactory.getLogger(BeanUtils.class);
if (log.isWarnEnabled()) {
log.warn("Throwable does not have initCause() method in JDK 1.3");
}
return null;
} catch (final Throwable e) {
final Log log = LogFactory.getLog(BeanUtils.class);
final Logger log = LoggerFactory.getLogger(BeanUtils.class);
if (log.isWarnEnabled()) {
log.warn("Error getting the Throwable initCause() method", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
import org.apache.commons.beanutils2.sql.converters.SqlDateConverter;
import org.apache.commons.beanutils2.sql.converters.SqlTimeConverter;
import org.apache.commons.beanutils2.sql.converters.SqlTimestampConverter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* <p>Utility methods for converting String scalar values to objects of the
Expand Down Expand Up @@ -175,9 +175,9 @@ public class ConvertUtilsBean {
private static final Character SPACE = Character.valueOf(' ');

/**
* The {@code Log} instance for this class.
* The {@code Logger} instance for this class.
*/
private static final Log LOG = LogFactory.getLog(ConvertUtilsBean.class);
private static final Logger LOG = LoggerFactory.getLogger(ConvertUtilsBean.class);

/**
* Get singleton instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import java.lang.reflect.Method;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* <p>
Expand Down Expand Up @@ -54,7 +54,7 @@ public class DefaultBeanIntrospector implements BeanIntrospector {
private static final Class<?>[] LIST_CLASS_PARAMETER = new Class[] { java.util.List.class };

/** For logging. Each subclass gets its own log instance. */
private final Log log = LogFactory.getLog(getClass());
private final Logger log = LoggerFactory.getLogger(getClass());

/**
* Private constructor so that no instances can be created.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import java.lang.reflect.Method;
import java.util.Locale;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* <p>
Expand Down Expand Up @@ -80,7 +80,7 @@ public class FluentPropertyBeanIntrospector implements BeanIntrospector {
public static final String DEFAULT_WRITE_METHOD_PREFIX = "set";

/** The logger. */
private final Log log = LogFactory.getLog(getClass());
private final Logger log = LoggerFactory.getLogger(getClass());

/** The prefix of write methods to search for. */
private final String writeMethodPrefix;
Expand Down
15 changes: 6 additions & 9 deletions src/main/java/org/apache/commons/beanutils2/LazyDynaBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* <p>DynaBean which automatically adds properties to the {@code DynaClass}
Expand Down Expand Up @@ -124,10 +124,7 @@ public class LazyDynaBean implements DynaBean, Serializable {

private static final long serialVersionUID = 1L;

/**
* Commons Logging
*/
private static transient Log LOG = LogFactory.getLog(LazyDynaBean.class);
private static Logger LOG = LoggerFactory.getLogger(LazyDynaBean.class);

/** BigInteger Zero */
protected static final BigInteger BigInteger_ZERO = new BigInteger("0");
Expand Down Expand Up @@ -699,11 +696,11 @@ protected boolean isDynaProperty(final String name) {
}

/**
* <p>Returns the {@code Log}.
* <p>Returns the {@code Logger}.
*/
private Log logger() {
private Logger logger() {
if (LOG == null) {
LOG = LogFactory.getLog(LazyDynaBean.class);
LOG = LoggerFactory.getLogger(LazyDynaBean.class);
}
return LOG;
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/apache/commons/beanutils2/MethodUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import java.util.Map;
import java.util.WeakHashMap;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* <p>Utility reflection methods focused on methods in general rather than properties in particular.</p>
Expand Down Expand Up @@ -113,7 +113,7 @@ public int hashCode() {
}
}

private static final Log LOG = LogFactory.getLog(MethodUtils.class);
private static final Logger LOG = LoggerFactory.getLogger(MethodUtils.class);

/**
* Only log warning about accessibility work around once.
Expand Down Expand Up @@ -480,7 +480,7 @@ public static Method getMatchingAccessibleMethod(
// log some trace information
if (LOG.isTraceEnabled()) {
LOG.trace("Found matching name:");
LOG.trace(method2);
LOG.trace(method2.toString());
}

// compare parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

import org.apache.commons.beanutils2.expression.DefaultResolver;
import org.apache.commons.beanutils2.expression.Resolver;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Utility methods for using Java Reflection APIs to facilitate generic
Expand Down Expand Up @@ -89,8 +89,8 @@
*/
public class PropertyUtilsBean {

/** Log instance */
private static final Log LOG = LogFactory.getLog(PropertyUtilsBean.class);
/** Logger instance */
private static final Logger LOG = LoggerFactory.getLogger(PropertyUtilsBean.class);

/**
* Gets the PropertyUtils bean instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import org.apache.commons.beanutils2.ConversionException;
import org.apache.commons.beanutils2.ConvertUtils;
import org.apache.commons.beanutils2.Converter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Base {@link Converter} implementation that provides the structure
Expand Down Expand Up @@ -101,7 +101,7 @@ protected static String toTrim(final Object value) {
/**
* Logging for this instance.
*/
private transient Log log;
private transient Logger log;

/**
* Should we return the default value on conversion errors?
Expand Down Expand Up @@ -405,18 +405,18 @@ public boolean isUseDefault() {
}

/**
* Accessor method for Log instance.
* Accessor method for Logger instance.
* <p>
* The Log instance variable is transient and
* The Logger instance variable is transient and
* accessing it through this method ensures it
* is re-initialized when this instance is
* de-serialized.
*
* @return The Log instance.
* @return The Logger instance.
*/
Log log() {
Logger log() {
if (log == null) {
log = LogFactory.getLog(getClass());
log = LoggerFactory.getLogger(getClass());
}
return log;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

import org.apache.commons.beanutils2.ConversionException;
import org.apache.commons.beanutils2.ConvertUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* The base class for all standard type locale-sensitive converters. It has {@link LocaleConverter} and {@link org.apache.commons.beanutils2.Converter}
Expand Down Expand Up @@ -132,7 +132,7 @@ public B setUseDefault(final boolean useDefault) {
}

/** All logging goes through this logger */
private static final Log LOG = LogFactory.getLog(BaseLocaleConverter.class);
private static final Logger LOG = LoggerFactory.getLogger(BaseLocaleConverter.class);

/**
* Checks whether the result of a conversion is conform to the specified target type. If this is the case, the passed in result object is cast to the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import org.apache.commons.beanutils2.MappedPropertyDescriptor;
import org.apache.commons.beanutils2.PropertyUtilsBean;
import org.apache.commons.beanutils2.expression.Resolver;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* <p>Utility methods for populating JavaBeans properties
Expand All @@ -56,7 +56,7 @@ protected LocaleBeanUtilsBean initialValue() {
};

/** All logging goes through this logger */
private static final Log LOG = LogFactory.getLog(LocaleBeanUtilsBean.class);
private static final Logger LOG = LoggerFactory.getLogger(LocaleBeanUtilsBean.class);

/**
* Gets singleton instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
import org.apache.commons.beanutils2.sql.converters.locale.SqlDateLocaleConverter;
import org.apache.commons.beanutils2.sql.converters.locale.SqlTimeLocaleConverter;
import org.apache.commons.beanutils2.sql.converters.locale.SqlTimestampLocaleConverter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* <p>Utility methods for converting locale-sensitive String scalar values to objects of the
Expand Down Expand Up @@ -81,8 +81,8 @@
*/
public class LocaleConvertUtilsBean {

/** The {@code Log} instance for this class. */
private static final Log LOG = LogFactory.getLog(LocaleConvertUtilsBean.class);
/** The {@code Logger} instance for this class. */
private static final Logger LOG = LoggerFactory.getLogger(LocaleConvertUtilsBean.class);

/**
* Gets singleton instance.
Expand Down
Loading