Skip to content

Commit 7c216c0

Browse files
committed
Migrate from deprecated APIs.
1 parent 7027577 commit 7c216c0

6 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ private <T> T convert(final Class<T> cls, final String key, final T defValue, fi
508508
*/
509509
private Object convertToArray(final Class<?> cls, final String key, final Object defaultValue) {
510510
checkDefaultValueArray(cls, defaultValue);
511-
return ObjectUtils.defaultIfNull(getConversionHandler().toArray(getProperty(key), cls, getInterpolator()), defaultValue);
511+
return ObjectUtils.getIfNull(getConversionHandler().toArray(getProperty(key), cls, getInterpolator()), defaultValue);
512512
}
513513

514514
/**
@@ -621,7 +621,7 @@ public <T> T get(final Class<T> cls, final String key, final T defaultValue) {
621621
private <T> T getAndConvertProperty(final Class<T> cls, final String key, final T defaultValue) {
622622
final Object value = getProperty(key);
623623
try {
624-
return ObjectUtils.defaultIfNull(getConversionHandler().to(value, cls, getInterpolator()), defaultValue);
624+
return ObjectUtils.getIfNull(getConversionHandler().to(value, cls, getInterpolator()), defaultValue);
625625
} catch (final ConversionException cex) {
626626
// improve error message
627627
throw new ConversionException(String.format("Key '%s' cannot be converted to class %s. Value is: '%s'.", key, cls.getName(), String.valueOf(value)),

src/main/java/org/apache/commons/configuration2/XMLConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ private Map<String, String> constructHierarchy(final ImmutableNode.Builder node,
583583
final Map<String, String> attrmap = constructHierarchy(childNode, refChildValue, child, elemRefs, trimFlag, level + 1);
584584
final boolean childTrim = Boolean.parseBoolean(attrmap.remove(ATTR_SPACE_INTERNAL));
585585
childNode.addAttributes(attrmap);
586-
final ImmutableNode newChild = createChildNodeWithValue(node, childNode, child, refChildValue.getValue(), childTrim, attrmap, elemRefs);
586+
final ImmutableNode newChild = createChildNodeWithValue(node, childNode, child, refChildValue.get(), childTrim, attrmap, elemRefs);
587587
if (elemRefs != null && !elemRefs.containsKey(newChild)) {
588588
elemRefs.put(newChild, child);
589589
}
@@ -859,7 +859,7 @@ private void initProperties(final XMLDocumentHelper docHelper, final boolean ele
859859
final Map<ImmutableNode, Object> elemRefMap = elemRefs ? new HashMap<>() : null;
860860
final Map<String, String> attributes = constructHierarchy(rootBuilder, rootValue, element, elemRefMap, true, 0);
861861
attributes.remove(ATTR_SPACE_INTERNAL);
862-
final ImmutableNode top = rootBuilder.value(rootValue.getValue()).addAttributes(attributes).create();
862+
final ImmutableNode top = rootBuilder.value(rootValue.get()).addAttributes(attributes).create();
863863
getSubConfigurationParentModel().mergeRoot(top, element.getTagName(), elemRefMap, elemRefs ? docHelper : null, this);
864864
}
865865

src/main/java/org/apache/commons/configuration2/interpol/StringLookupAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ final class StringLookupAdapter implements Lookup {
3838

3939
@Override
4040
public Object lookup(final String key) {
41-
return stringLookup.lookup(key);
41+
return stringLookup.apply(key);
4242
}
4343

4444
}

src/main/java/org/apache/commons/configuration2/io/FileLocatorUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ static String getFileName(final URL url) {
412412
* @return the {@code FileSystem} to be used for this {@code FileLocator}
413413
*/
414414
static FileSystem getFileSystem(final FileLocator locator) {
415-
return locator != null ? ObjectUtils.defaultIfNull(locator.getFileSystem(), DEFAULT_FILE_SYSTEM) : DEFAULT_FILE_SYSTEM;
415+
return locator != null ? ObjectUtils.getIfNull(locator.getFileSystem(), DEFAULT_FILE_SYSTEM) : DEFAULT_FILE_SYSTEM;
416416
}
417417

418418
/**
@@ -424,7 +424,7 @@ static FileSystem getFileSystem(final FileLocator locator) {
424424
* @return the {@code FileLocationStrategy} for this {@code FileLocator}
425425
*/
426426
static FileLocationStrategy getLocationStrategy(final FileLocator locator) {
427-
return locator != null ? ObjectUtils.defaultIfNull(locator.getLocationStrategy(), DEFAULT_LOCATION_STRATEGY) : DEFAULT_LOCATION_STRATEGY;
427+
return locator != null ? ObjectUtils.getIfNull(locator.getLocationStrategy(), DEFAULT_LOCATION_STRATEGY) : DEFAULT_LOCATION_STRATEGY;
428428
}
429429

430430
/**

src/main/java/org/apache/commons/configuration2/reloading/PeriodicReloadingTrigger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class PeriodicReloadingTrigger {
5656
* @return the default executor service
5757
*/
5858
private static ScheduledExecutorService createDefaultExecutorService() {
59-
final ThreadFactory factory = new BasicThreadFactory.Builder().namingPattern("ReloadingTrigger-%s").daemon(true).build();
59+
final ThreadFactory factory = BasicThreadFactory.builder().namingPattern("ReloadingTrigger-%s").daemon(true).build();
6060
return Executors.newScheduledThreadPool(1, factory);
6161
}
6262

src/main/java/org/apache/commons/configuration2/tree/InMemoryNodeModel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ public Collection<NodeSelector> selectAndTrackNodes(final String key, final Node
844844
}
845845
done = structure.compareAndSet(current, createSelectorsForTrackedNodes(refSelectors, nodes, current, resolver));
846846
} while (!done);
847-
return refSelectors.getValue();
847+
return refSelectors.get();
848848
}
849849

850850
/**
@@ -914,7 +914,7 @@ public Collection<NodeSelector> trackChildNodes(final String key, final NodeKeyR
914914
done = true;
915915
}
916916
} while (!done);
917-
return refSelectors.getValue();
917+
return refSelectors.get();
918918
}
919919

920920
/**
@@ -945,7 +945,7 @@ public NodeSelector trackChildNodeWithCreation(final String key, final String ch
945945
done = structure.compareAndSet(current, newData);
946946
} while (!done);
947947

948-
return refSelector.getValue();
948+
return refSelector.get();
949949
}
950950

951951
/**

0 commit comments

Comments
 (0)