469341 Not possible to use old/deprecated start properties

Improved warnings so that if both and and new properties are set a warning is still generated that says the new property was used.

Bug: 469341
This commit is contained in:
Greg Wilkins 2015-06-10 13:04:25 +10:00
parent 74d246c1a9
commit 5e8652536c
1 changed files with 31 additions and 12 deletions

View File

@ -943,18 +943,28 @@ public class XmlConfiguration
String value = properties.get(name);
// Look for a deprecated name value
if (value==null && !deprecated.isEmpty())
String alternate=null;
if (!deprecated.isEmpty())
{
for (Object d : deprecated)
{
value = properties.get(StringUtil.valueOf(d));
if (value!=null)
{
String v = properties.get(StringUtil.valueOf(d));
if (v!=null)
{
LOG.warn("Property '{}' is deprecated, use '{}' instead", d, name);
break;
if (value==null)
LOG.warn("Property '{}' is deprecated, use '{}' instead", d, name);
else
LOG.warn("Property '{}' is deprecated, value from '{}' used", d, name);
}
if (alternate==null)
alternate=v;;
}
}
// use alternate from deprecated
if (value==null)
value=alternate;
// use default value
if (value==null)
@ -985,18 +995,27 @@ public class XmlConfiguration
String value = System.getProperty(name);
// Look for a deprecated name value
if (value==null && !deprecated.isEmpty())
String alternate=null;
if (!deprecated.isEmpty())
{
for (Object d : deprecated)
{
value = System.getProperty(StringUtil.valueOf(d));
if (value!=null)
{
String v = System.getProperty(StringUtil.valueOf(d));
if (v!=null)
{
LOG.warn("Property '{}' is deprecated, use '{}' instead", d, name);
break;
if (value==null)
LOG.warn("SystemProperty '{}' is deprecated, use '{}' instead", d, name);
else
LOG.warn("SystemProperty '{}' is deprecated, value from '{}' used", d, name);
}
if (alternate==null)
alternate=v;;
}
}
// use alternate from deprecated
if (value==null)
value=alternate;
// use default value
if (value==null)