Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE
apache-commons-configuration
0001-CONFIGURATION-840-Fix-StackOverflowError-a...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-CONFIGURATION-840-Fix-StackOverflowError-adding-Path.patch of Package apache-commons-configuration
From 0a972546fcf7884e061c055ad87290d78dac6502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch> Date: Thu, 28 Mar 2024 10:35:59 +0100 Subject: [PATCH 1/2] [CONFIGURATION-840] Fix StackOverflowError adding Path object to configuration --- .../commons/configuration/PropertyConverter.java | 8 +++++++- .../commons/configuration/TestPropertyConverter.java | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/configuration/PropertyConverter.java b/src/main/java/org/apache/commons/configuration/PropertyConverter.java index d133c97c..650c55b5 100644 --- a/src/main/java/org/apache/commons/configuration/PropertyConverter.java +++ b/src/main/java/org/apache/commons/configuration/PropertyConverter.java @@ -27,6 +27,7 @@ import java.net.InetAddress; import java.net.MalformedURLException; import java.net.URL; import java.net.UnknownHostException; +import java.nio.file.Path; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -981,7 +982,12 @@ public final class PropertyConverter } Collection<Object> result = new LinkedList<Object>(); - if (value instanceof Iterable) + if (value instanceof Path) + { + // Don't handle as an Iterable. + result.add(value); + } + else if (value instanceof Iterable) { flattenIterator(result, ((Iterable<?>) value).iterator(), delimiter); } diff --git a/src/test/java/org/apache/commons/configuration/TestPropertyConverter.java b/src/test/java/org/apache/commons/configuration/TestPropertyConverter.java index 44ee278d..c1e7bbf1 100644 --- a/src/test/java/org/apache/commons/configuration/TestPropertyConverter.java +++ b/src/test/java/org/apache/commons/configuration/TestPropertyConverter.java @@ -24,6 +24,8 @@ import static org.junit.Assert.assertTrue; import java.lang.annotation.ElementType; import java.math.BigDecimal; +import java.nio.file.FileSystems; +import java.nio.file.Path; import java.util.Iterator; import java.util.List; @@ -152,6 +154,14 @@ public class TestPropertyConverter assertEquals("3rd element", new Integer(3), it.next()); } + @Test + public void testPath() + { + PropertiesConfiguration config = new PropertiesConfiguration(); + Path path = FileSystems.getDefault().getPath("bar"); + config.addProperty("foo", path); + } + /** * Tests the interpolation features. */ -- 2.44.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor