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 3753177D4 for ; Sat, 3 Dec 2011 20:25:06 +0000 (UTC) Received: (qmail 8955 invoked by uid 500); 3 Dec 2011 20:25:06 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 8904 invoked by uid 500); 3 Dec 2011 20:25:05 -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 8897 invoked by uid 99); 3 Dec 2011 20:25:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Dec 2011 20:25:05 +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; Sat, 03 Dec 2011 20:25:04 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B3C5723889E2 for ; Sat, 3 Dec 2011 20:24:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1209997 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfigurationConverter.java Date: Sat, 03 Dec 2011 20:24:43 -0000 To: commits@commons.apache.org From: oheger@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111203202443.B3C5723889E2@eris.apache.org> Author: oheger Date: Sat Dec 3 20:24:43 2011 New Revision: 1209997 URL: http://svn.apache.org/viewvc?rev=1209997&view=rev Log: Java 1.5 compatibility: Javadocs, raw types, etc. Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfigurationConverter.java Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfigurationConverter.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfigurationConverter.java?rev=1209997&r1=1209996&r2=1209997&view=diff ============================================================================== --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfigurationConverter.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalConfigurationConverter.java Sat Dec 3 20:24:43 2011 @@ -34,12 +34,13 @@ import java.util.Set; * the keys in the original configuration.

*

Concrete sub classes will implement event handlers that generate SAX * events for XML processing or construct a - * HierarchicalConfiguration root node. All in all with this class + * {@code HierarchicalConfiguration} root node. All in all with this class * it is possible to treat a default configuration as if it was a hierarchical * configuration, which can be sometimes useful.

* @see HierarchicalConfiguration * - * @author Oliver Heger + * @author Commons Configuration team * @version $Id$ */ abstract class HierarchicalConfigurationConverter @@ -48,8 +49,8 @@ abstract class HierarchicalConfiguration * Processes the specified configuration object. This method implements * the iteration over the configuration's keys. All defined keys are * translated into a set of element start and end events represented by - * calls to the elementStart() and - * elementEnd() methods. + * calls to the {@code elementStart()} and + * {@code elementEnd()} methods. * * @param config the configuration to be processed */ @@ -59,11 +60,11 @@ abstract class HierarchicalConfiguration { ConfigurationKey keyEmpty = new ConfigurationKey(); ConfigurationKey keyLast = keyEmpty; - Set keySet = new HashSet(); + Set keySet = new HashSet(); - for (Iterator it = config.getKeys(); it.hasNext();) + for (Iterator it = config.getKeys(); it.hasNext();) { - String key = (String) it.next(); + String key = it.next(); if (keySet.contains(key)) { // this key has already been processed by openElements @@ -94,7 +95,7 @@ abstract class HierarchicalConfiguration /** * An event handler method that is called when an element ends. For each - * call of elementStart() there will be a corresponding call + * call of {@code elementStart()} there will be a corresponding call * of this method. Concrete sub classes must implement it to perform a * proper event handling. * @@ -115,7 +116,7 @@ abstract class HierarchicalConfiguration protected void closeElements(ConfigurationKey keyLast, ConfigurationKey keyAct) { ConfigurationKey keyDiff = keyAct.differenceKey(keyLast); - Iterator it = reverseIterator(keyDiff); + Iterator it = reverseIterator(keyDiff); if (it.hasNext()) { // Skip first because it has already been closed by fireValue() @@ -136,9 +137,9 @@ abstract class HierarchicalConfiguration * @param key the key * @return a reverse iterator for the parts of this key */ - protected Iterator reverseIterator(ConfigurationKey key) + protected Iterator reverseIterator(ConfigurationKey key) { - List list = new ArrayList(); + List list = new ArrayList(); for (ConfigurationKey.KeyIterator it = key.iterator(); it.hasNext();) { list.add(it.nextKey()); @@ -160,7 +161,7 @@ abstract class HierarchicalConfiguration * @param keySet the set with the processed keys * @return the name of the last element on the path */ - protected String openElements(ConfigurationKey keyLast, ConfigurationKey keyAct, Configuration config, Set keySet) + protected String openElements(ConfigurationKey keyLast, ConfigurationKey keyAct, Configuration config, Set keySet) { ConfigurationKey.KeyIterator it = keyLast.differenceKey(keyAct).iterator(); ConfigurationKey k = keyLast.commonKey(keyAct); @@ -184,11 +185,12 @@ abstract class HierarchicalConfiguration */ protected void fireValue(String name, Object value) { - if (value != null && value instanceof Collection) + if (value instanceof Collection) { - for (Iterator it = ((Collection) value).iterator(); it.hasNext();) + Collection valueCol = (Collection) value; + for (Object v : valueCol) { - fireValue(name, it.next()); + fireValue(name, v); } } else