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