Skip to content

Commit 12509b4

Browse files
Log decoding issues in DefaultPropertyFactory as errors
1 parent 5e9da20 commit 12509b4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

archaius2-core/src/main/java/com/netflix/archaius/DefaultPropertyFactory.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ public class DefaultPropertyFactory implements PropertyFactory, ConfigListener {
2828

2929
/**
3030
* Create a Property factory that is attached to a specific config
31-
* @param config
32-
* @return
31+
* @param config The source of configuration for this factory.
3332
*/
3433
public static DefaultPropertyFactory from(final Config config) {
3534
return new DefaultPropertyFactory(config);
@@ -64,6 +63,8 @@ public DefaultPropertyFactory(Config config) {
6463
}
6564

6665
@Override
66+
@Deprecated
67+
@SuppressWarnings("deprecation")
6768
public PropertyContainer getProperty(String propName) {
6869
return new PropertyContainer() {
6970
@Override
@@ -130,7 +131,7 @@ public <T> Property<T> asType(Function<String, T> mapper, String defaultValue) {
130131
try {
131132
return mapper.apply(value);
132133
} catch (Exception e) {
133-
LOG.warn("Invalid value '{}' for property '{}'", propName, value);
134+
LOG.error("Invalid value '{}' for property '{}'. Will return the default instead.", propName, value);
134135
}
135136
}
136137

@@ -216,7 +217,7 @@ public T get() {
216217
try {
217218
newValue = supplier.get();
218219
} catch (Exception e) {
219-
LOG.warn("Unable to get current version of property '{}'", keyAndType.key, e);
220+
LOG.error("Unable to get current version of property '{}'", keyAndType.key, e);
220221
}
221222

222223
if (cache.compareAndSet(currentValue, newValue, cacheVersion, latestVersion)) {
@@ -260,16 +261,18 @@ public synchronized void run() {
260261

261262
@Deprecated
262263
@Override
264+
@SuppressWarnings("deprecation")
263265
public void addListener(PropertyListener<T> listener) {
264266
oldSubscriptions.put(listener, onChange(listener));
265267
}
266268

267269
/**
268270
* Remove a listener previously registered by calling addListener
269-
* @param listener
271+
* @param listener The listener to be removed
270272
*/
271273
@Deprecated
272274
@Override
275+
@SuppressWarnings("deprecation")
273276
public void removeListener(PropertyListener<T> listener) {
274277
Subscription subscription = oldSubscriptions.remove(listener);
275278
if (subscription != null) {

0 commit comments

Comments
 (0)