Issue #4084 make deprecated warnings only with debug in jetty-9

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2019-09-18 15:58:46 +10:00
parent f85382aa9d
commit 157910d79a
1 changed files with 12 additions and 8 deletions

View File

@ -737,6 +737,7 @@ public class XmlConfiguration
private Object invokeConstructor(Constructor<?> constructor, Object... args) throws IllegalAccessException, InvocationTargetException, InstantiationException private Object invokeConstructor(Constructor<?> constructor, Object... args) throws IllegalAccessException, InvocationTargetException, InstantiationException
{ {
Object result = constructor.newInstance(args); Object result = constructor.newInstance(args);
if (LOG.isDebugEnabled())
if (constructor.getAnnotation(Deprecated.class) != null) if (constructor.getAnnotation(Deprecated.class) != null)
LOG.warn("Deprecated constructor {} in {}", constructor, _configuration); LOG.warn("Deprecated constructor {} in {}", constructor, _configuration);
return result; return result;
@ -745,6 +746,7 @@ public class XmlConfiguration
private Object invokeMethod(Method method, Object obj, Object... args) throws IllegalAccessException, InvocationTargetException private Object invokeMethod(Method method, Object obj, Object... args) throws IllegalAccessException, InvocationTargetException
{ {
Object result = method.invoke(obj, args); Object result = method.invoke(obj, args);
if (LOG.isDebugEnabled())
if (method.getAnnotation(Deprecated.class) != null) if (method.getAnnotation(Deprecated.class) != null)
LOG.warn("Deprecated method {} in {}", method, _configuration); LOG.warn("Deprecated method {} in {}", method, _configuration);
return result; return result;
@ -753,6 +755,7 @@ public class XmlConfiguration
private Object getField(Field field, Object object) throws IllegalAccessException private Object getField(Field field, Object object) throws IllegalAccessException
{ {
Object result = field.get(object); Object result = field.get(object);
if (LOG.isDebugEnabled())
if (field.getAnnotation(Deprecated.class) != null) if (field.getAnnotation(Deprecated.class) != null)
LOG.warn("Deprecated field {} in {}", field, _configuration); LOG.warn("Deprecated field {} in {}", field, _configuration);
return result; return result;
@ -761,6 +764,7 @@ public class XmlConfiguration
private void setField(Field field, Object obj, Object arg) throws IllegalAccessException private void setField(Field field, Object obj, Object arg) throws IllegalAccessException
{ {
field.set(obj, arg); field.set(obj, arg);
if (LOG.isDebugEnabled())
if (field.getAnnotation(Deprecated.class) != null) if (field.getAnnotation(Deprecated.class) != null)
LOG.warn("Deprecated field {} in {}", field, _configuration); LOG.warn("Deprecated field {} in {}", field, _configuration);
} }