Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 61DDC10815 for ; Mon, 21 Oct 2013 08:45:20 +0000 (UTC) Received: (qmail 25403 invoked by uid 500); 21 Oct 2013 08:45:13 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 24532 invoked by uid 500); 21 Oct 2013 08:45:01 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 24495 invoked by uid 99); 21 Oct 2013 08:44:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Oct 2013 08:44:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Oct 2013 08:44:54 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 27F0723889FA; Mon, 21 Oct 2013 08:44:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1534064 - in /commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE: ./ src/main/java/org/apache/commons/configuration/ src/test/java/org/apache/commons/configuration/ Date: Mon, 21 Oct 2013 08:44:33 -0000 To: commits@commons.apache.org From: henning@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131021084434.27F0723889FA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: henning Date: Mon Oct 21 08:44:33 2013 New Revision: 1534064 URL: http://svn.apache.org/r1534064 Log: [CONFIGURATION-558] Configuration no longer accepts List as default for getList() Similar to CONFIGURATION-557, the getList(String, List) method was generified to be getList(String, List) but needs to be getList(String, List) so that code that used a more specific list (such as a List) still compiles against the new API. Added: commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/test/java/org/apache/commons/configuration/TestConfiguration.java (with props) Modified: commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/RELEASE-NOTES.txt commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/CompositeConfiguration.java commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/Configuration.java commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java Modified: commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/RELEASE-NOTES.txt?rev=1534064&r1=1534063&r2=1534064&view=diff ============================================================================== --- commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/RELEASE-NOTES.txt (original) +++ commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/RELEASE-NOTES.txt Mon Oct 21 08:44:33 2013 @@ -47,6 +47,13 @@ BUG FIXES IN 1.10 All of this is purely a compiler issue, the runtime itself does not see any of the generics due to the Java type erasure. +* [CONFIGURATION-558] Configuration no longer accepts List as default for getList() + + Similar to CONFIGURATION-557, the getList(String, List) method was generified to be + getList(String, List) but needs to be getList(String, List) so that code that + used a more specific list (such as a List) still compiles against the new API. + + IMPROVEMENTS AND NEW FEATURES IN 1.10 ===================================== Modified: commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java?rev=1534064&r1=1534063&r2=1534064&view=diff ============================================================================== --- commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java (original) +++ commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java Mon Oct 21 08:44:33 2013 @@ -1117,7 +1117,7 @@ public abstract class AbstractConfigurat return getList(key, new ArrayList()); } - public List getList(String key, List defaultValue) + public List getList(String key, List defaultValue) { Object value = getProperty(key); List list; @@ -1140,7 +1140,7 @@ public abstract class AbstractConfigurat } else if (value == null) { - list = defaultValue; + list = (List) defaultValue; } else if (value.getClass().isArray()) { Modified: commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/CompositeConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/CompositeConfiguration.java?rev=1534064&r1=1534063&r2=1534064&view=diff ============================================================================== --- commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/CompositeConfiguration.java (original) +++ commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/CompositeConfiguration.java Mon Oct 21 08:44:33 2013 @@ -339,7 +339,7 @@ implements Cloneable } @Override - public List getList(String key, List defaultValue) + public List getList(String key, List defaultValue) { List list = new ArrayList(); @@ -359,7 +359,7 @@ implements Cloneable if (list.isEmpty()) { - return defaultValue; + return (List) defaultValue; } ListIterator lit = list.listIterator(); Modified: commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/Configuration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/Configuration.java?rev=1534064&r1=1534063&r2=1534064&view=diff ============================================================================== --- commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/Configuration.java (original) +++ commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/Configuration.java Mon Oct 21 08:44:33 2013 @@ -594,5 +594,5 @@ public interface Configuration * @throws ConversionException is thrown if the key maps to an * object that is not a List. */ - List getList(String key, List defaultValue); + List getList(String key, List defaultValue); } Modified: commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java?rev=1534064&r1=1534063&r2=1534064&view=diff ============================================================================== --- commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java (original) +++ commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java Mon Oct 21 08:44:33 2013 @@ -481,7 +481,7 @@ public class DynamicCombinedConfiguratio } @Override - public List getList(String key, List defaultValue) + public List getList(String key, List defaultValue) { return this.getCurrentConfig().getList(key, defaultValue); } Modified: commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java?rev=1534064&r1=1534063&r2=1534064&view=diff ============================================================================== --- commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java (original) +++ commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java Mon Oct 21 08:44:33 2013 @@ -357,7 +357,7 @@ public class MultiFileHierarchicalConfig } @Override - public List getList(String key, List defaultValue) + public List getList(String key, List defaultValue) { return this.getConfiguration().getList(key, defaultValue); } Modified: commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java?rev=1534064&r1=1534063&r2=1534064&view=diff ============================================================================== --- commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java (original) +++ commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java Mon Oct 21 08:44:33 2013 @@ -236,7 +236,7 @@ public class PatternSubtreeConfiguration } @Override - public List getList(String key, List defaultValue) + public List getList(String key, List defaultValue) { return config.getList(makePath(key), defaultValue); } Added: commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/test/java/org/apache/commons/configuration/TestConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/test/java/org/apache/commons/configuration/TestConfiguration.java?rev=1534064&view=auto ============================================================================== --- commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/test/java/org/apache/commons/configuration/TestConfiguration.java (added) +++ commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/test/java/org/apache/commons/configuration/TestConfiguration.java Mon Oct 21 08:44:33 2013 @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.configuration; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.junit.Assert; +import org.junit.Test; + +public class TestConfiguration +{ + @Test + public void testConfigurationGetList() + { + final List defaults = new ArrayList(); + + String key = UUID.randomUUID().toString(); + for (int i = 0; i < 10; i++) { + defaults.add(UUID.randomUUID().toString()); + } + + final Configuration c = new MapConfiguration(Collections.emptyMap()); + + final List values = c.getList(key, defaults); + + Assert.assertEquals(defaults, values); + } +} Propchange: commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/test/java/org/apache/commons/configuration/TestConfiguration.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: commons/proper/configuration/branches/CONFIGURATION_1_X_MAINTENANCE/src/test/java/org/apache/commons/configuration/TestConfiguration.java ------------------------------------------------------------------------------ svn:keywords = Id Author Date Revision