Skip to content

Commit

Permalink
Log decoding issues in DefaultPropertyFactory as errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rgallardo-netflix committed Sep 25, 2024
1 parent 5e9da20 commit 12509b4
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public class DefaultPropertyFactory implements PropertyFactory, ConfigListener {

/**
* Create a Property factory that is attached to a specific config
* @param config
* @return
* @param config The source of configuration for this factory.
*/
public static DefaultPropertyFactory from(final Config config) {
return new DefaultPropertyFactory(config);
Expand Down Expand Up @@ -64,6 +63,8 @@ public DefaultPropertyFactory(Config config) {
}

@Override
@Deprecated
@SuppressWarnings("deprecation")
public PropertyContainer getProperty(String propName) {
return new PropertyContainer() {
@Override
Expand Down Expand Up @@ -130,7 +131,7 @@ public <T> Property<T> asType(Function<String, T> mapper, String defaultValue) {
try {
return mapper.apply(value);
} catch (Exception e) {
LOG.warn("Invalid value '{}' for property '{}'", propName, value);
LOG.error("Invalid value '{}' for property '{}'. Will return the default instead.", propName, value);
}
}

Expand Down Expand Up @@ -216,7 +217,7 @@ public T get() {
try {
newValue = supplier.get();
} catch (Exception e) {
LOG.warn("Unable to get current version of property '{}'", keyAndType.key, e);
LOG.error("Unable to get current version of property '{}'", keyAndType.key, e);
}

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

@Deprecated
@Override
@SuppressWarnings("deprecation")
public void addListener(PropertyListener<T> listener) {
oldSubscriptions.put(listener, onChange(listener));
}

/**
* Remove a listener previously registered by calling addListener
* @param listener
* @param listener The listener to be removed
*/
@Deprecated
@Override
@SuppressWarnings("deprecation")
public void removeListener(PropertyListener<T> listener) {
Subscription subscription = oldSubscriptions.remove(listener);
if (subscription != null) {
Expand Down

0 comments on commit 12509b4

Please sign in to comment.