mirror of https://github.com/apache/poi.git
bug 59933: demote accessibility of POILogger implementations of log(int, Object) and log(int, Object, Throwable) to be consistent with the POILogger abstract class
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1761665 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
705938741b
commit
af39a06544
|
@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory;
|
||||||
*/
|
*/
|
||||||
public class CommonsLogger extends POILogger
|
public class CommonsLogger extends POILogger
|
||||||
{
|
{
|
||||||
private static LogFactory _creator = LogFactory.getFactory();
|
private static final LogFactory _creator = LogFactory.getFactory();
|
||||||
private Log log = null;
|
private Log log = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,8 +46,10 @@ public class CommonsLogger extends POILogger
|
||||||
* @param obj1 The object to log.
|
* @param obj1 The object to log.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void log(final int level, final Object obj1)
|
protected void log(final int level, final Object obj1)
|
||||||
{
|
{
|
||||||
|
// FIXME: What happens if level is in between two levels (an even number)?
|
||||||
|
// Should this be `if (level >= FATAL) ...`?
|
||||||
if(level==FATAL)
|
if(level==FATAL)
|
||||||
{
|
{
|
||||||
if(log.isFatalEnabled())
|
if(log.isFatalEnabled())
|
||||||
|
@ -100,9 +102,11 @@ public class CommonsLogger extends POILogger
|
||||||
* @param exception An exception to be logged
|
* @param exception An exception to be logged
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void log(final int level, final Object obj1,
|
protected void log(final int level, final Object obj1,
|
||||||
final Throwable exception)
|
final Throwable exception)
|
||||||
{
|
{
|
||||||
|
// FIXME: What happens if level is in between two levels (an even number)?
|
||||||
|
// Should this be `if (level >= FATAL) ...`?
|
||||||
if(level==FATAL)
|
if(level==FATAL)
|
||||||
{
|
{
|
||||||
if(log.isFatalEnabled())
|
if(log.isFatalEnabled())
|
||||||
|
@ -174,6 +178,8 @@ public class CommonsLogger extends POILogger
|
||||||
@Override
|
@Override
|
||||||
public boolean check(final int level)
|
public boolean check(final int level)
|
||||||
{
|
{
|
||||||
|
// FIXME: What happens if level is in between two levels (an even number)?
|
||||||
|
// Should this be `if (level >= FATAL) ...`?
|
||||||
if(level==FATAL)
|
if(level==FATAL)
|
||||||
{
|
{
|
||||||
if(log.isFatalEnabled())
|
if(log.isFatalEnabled())
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class NullLogger extends POILogger {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void log(final int level, final Object obj1) {
|
protected void _log(final int level, final Object obj1) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class NullLogger extends POILogger {
|
||||||
* @param exception An exception to be logged
|
* @param exception An exception to be logged
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void log(int level, Object obj1, final Throwable exception) {
|
protected void _log(int level, Object obj1, final Throwable exception) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public abstract class POILogger {
|
||||||
* @param level One of DEBUG, INFO, WARN, ERROR, FATAL
|
* @param level One of DEBUG, INFO, WARN, ERROR, FATAL
|
||||||
* @param obj1 The object to log. This is converted to a string.
|
* @param obj1 The object to log. This is converted to a string.
|
||||||
*/
|
*/
|
||||||
abstract protected void log(int level, Object obj1);
|
abstract protected void _log(int level, Object obj1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a message
|
* Log a message
|
||||||
|
@ -63,7 +63,7 @@ public abstract class POILogger {
|
||||||
* @param obj1 The object to log. This is converted to a string.
|
* @param obj1 The object to log. This is converted to a string.
|
||||||
* @param exception An exception to be logged
|
* @param exception An exception to be logged
|
||||||
*/
|
*/
|
||||||
abstract protected void log(int level, Object obj1, final Throwable exception);
|
abstract protected void _log(int level, Object obj1, final Throwable exception);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,9 +107,9 @@ public abstract class POILogger {
|
||||||
// somehow this ambiguity works and doesn't lead to a loop,
|
// somehow this ambiguity works and doesn't lead to a loop,
|
||||||
// but it's confusing ...
|
// but it's confusing ...
|
||||||
if (lastEx == null) {
|
if (lastEx == null) {
|
||||||
log(level, msg);
|
_log(level, msg);
|
||||||
} else {
|
} else {
|
||||||
log(level, msg, lastEx);
|
_log(level, msg, lastEx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,9 @@ public class SystemOutLogger extends POILogger
|
||||||
* @param obj1 The object to log.
|
* @param obj1 The object to log.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void log(final int level, final Object obj1)
|
protected void _log(final int level, final Object obj1)
|
||||||
{
|
{
|
||||||
log(level, obj1, null);
|
_log(level, obj1, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +56,7 @@ public class SystemOutLogger extends POILogger
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressForbidden("uses printStackTrace")
|
@SuppressForbidden("uses printStackTrace")
|
||||||
public void log(final int level, final Object obj1,
|
protected void _log(final int level, final Object obj1,
|
||||||
final Throwable exception) {
|
final Throwable exception) {
|
||||||
if (check(level)) {
|
if (check(level)) {
|
||||||
System.out.println("[" + _cat + "]" + LEVEL_STRINGS_SHORT[Math.min(LEVEL_STRINGS_SHORT.length-1, level)] + " " + obj1);
|
System.out.println("[" + _cat + "]" + LEVEL_STRINGS_SHORT[Math.min(LEVEL_STRINGS_SHORT.length-1, level)] + " " + obj1);
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||||
* POILogger which logs into an ArrayList, so that
|
* POILogger which logs into an ArrayList, so that
|
||||||
* tests can see what got logged
|
* tests can see what got logged
|
||||||
*/
|
*/
|
||||||
|
@Internal
|
||||||
public class DummyPOILogger extends POILogger {
|
public class DummyPOILogger extends POILogger {
|
||||||
public List<String>logged = new ArrayList<String>();
|
public List<String>logged = new ArrayList<String>();
|
||||||
|
|
||||||
|
@ -39,12 +40,12 @@ public class DummyPOILogger extends POILogger {
|
||||||
public void initialize(String cat) {}
|
public void initialize(String cat) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void log(int level, Object obj1) {
|
protected void _log(int level, Object obj1) {
|
||||||
logged.add(level + " - " + obj1);
|
logged.add(level + " - " + obj1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void log(int level, Object obj1, Throwable exception) {
|
protected void _log(int level, Object obj1, Throwable exception) {
|
||||||
logged.add(level + " - " + obj1 + " - " + exception);
|
logged.add(level + " - " + obj1 + " - " + exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,13 +65,13 @@ public final class TestPOILogger extends POILogger {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void log(int level, Object obj1) {
|
protected void _log(int level, Object obj1) {
|
||||||
lastLog = (obj1 == null) ? "" : obj1.toString();
|
lastLog = (obj1 == null) ? "" : obj1.toString();
|
||||||
lastEx = null;
|
lastEx = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void log(int level, Object obj1, Throwable exception) {
|
protected void _log(int level, Object obj1, Throwable exception) {
|
||||||
lastLog = (obj1 == null) ? "" : obj1.toString();
|
lastLog = (obj1 == null) ? "" : obj1.toString();
|
||||||
lastEx = exception;
|
lastEx = exception;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue