Return-Path: Delivered-To: apmail-commons-commits-archive@locus.apache.org Received: (qmail 17848 invoked from network); 15 Feb 2008 09:46:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Feb 2008 09:46:53 -0000 Received: (qmail 51324 invoked by uid 500); 15 Feb 2008 09:46:46 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 50870 invoked by uid 500); 15 Feb 2008 09:46:46 -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 50861 invoked by uid 99); 15 Feb 2008 09:46:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Feb 2008 01:46:45 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Feb 2008 09:46:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 87D1F1A983A; Fri, 15 Feb 2008 01:46:25 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r627984 [2/2] - in /commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2: ./ beanutils/ plist/ tree/ tree/xpath/ web/ Date: Fri, 15 Feb 2008 09:46:14 -0000 To: commits@commons.apache.org From: ebourg@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080215094626.87D1F1A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorAttribute.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorAttribute.java?rev=627984&r1=627983&r2=627984&view=diff ============================================================================== --- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorAttribute.java (original) +++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorAttribute.java Fri Feb 15 01:46:09 2008 @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.commons.configuration2.tree.xpath; import java.util.ArrayList; @@ -44,8 +45,7 @@ public ConfigurationNodeIteratorAttribute(NodePointer parent, QName name) { super(parent, false); - initSubNodeList(createSubNodeList((ConfigurationNode) parent.getNode(), - name)); + initSubNodeList(createSubNodeList((ConfigurationNode) parent.getNode(), name)); } /** @@ -55,15 +55,15 @@ * @param name the name of the selected attribute * @return a list with the selected attributes */ - protected List createSubNodeList(ConfigurationNode node, QName name) + protected List createSubNodeList(ConfigurationNode node, QName name) { if (name.getPrefix() != null) { // namespace prefixes are not supported - return Collections.EMPTY_LIST; + return Collections.emptyList(); } - List result = new ArrayList(); + List result = new ArrayList(); if (!WILDCARD.equals(name.getName())) { result.addAll(node.getAttributes(name.getName())); Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorBase.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorBase.java?rev=627984&r1=627983&r2=627984&view=diff ============================================================================== --- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorBase.java (original) +++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorBase.java Fri Feb 15 01:46:09 2008 @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.commons.configuration2.tree.xpath; import java.util.List; @@ -42,7 +43,7 @@ private NodePointer parent; /** Stores the list with the sub nodes. */ - private List subNodes; + private List subNodes; /** Stores the current position. */ private int position; @@ -100,8 +101,7 @@ return null; } - return createNodePointer((ConfigurationNode) subNodes - .get(positionToIndex(getPosition()))); + return createNodePointer(subNodes.get(positionToIndex(getPosition()))); } /** @@ -149,7 +149,7 @@ * * @param nodes the list with the sub nodes */ - protected void initSubNodeList(List nodes) + protected void initSubNodeList(List nodes) { subNodes = nodes; if (reverse) @@ -165,8 +165,7 @@ */ protected int getMaxPosition() { - return reverse ? getStartOffset() + 1 : subNodes.size() - - getStartOffset(); + return reverse ? getStartOffset() + 1 : subNodes.size() - getStartOffset(); } /** Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorChildren.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorChildren.java?rev=627984&r1=627983&r2=627984&view=diff ============================================================================== --- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorChildren.java (original) +++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorChildren.java Fri Feb 15 01:46:09 2008 @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.commons.configuration2.tree.xpath; import java.util.ArrayList; import java.util.Collections; -import java.util.Iterator; import java.util.List; import org.apache.commons.configuration2.tree.ConfigurationNode; @@ -49,17 +49,15 @@ * @param reverse the reverse flag * @param startsWith the first element of the iteration */ - public ConfigurationNodeIteratorChildren(NodePointer parent, - NodeTest nodeTest, boolean reverse, NodePointer startsWith) + public ConfigurationNodeIteratorChildren(NodePointer parent, NodeTest nodeTest, boolean reverse, NodePointer startsWith) { super(parent, reverse); ConfigurationNode root = (ConfigurationNode) parent.getNode(); - List childNodes = createSubNodeList(root, nodeTest); + List childNodes = createSubNodeList(root, nodeTest); initSubNodeList(childNodes); if (startsWith != null) { - setStartOffset(findStartIndex(root, - (ConfigurationNode) startsWith.getNode())); + setStartOffset(findStartIndex(root, (ConfigurationNode) startsWith.getNode())); } } @@ -72,9 +70,9 @@ * @param test the test object * @return a list with the matching nodes */ - protected List createSubNodeList(ConfigurationNode node, NodeTest test) + protected List createSubNodeList(ConfigurationNode node, NodeTest test) { - List children = node.getChildren(); + List children = node.getChildren(); if (test == null) { @@ -93,10 +91,9 @@ return children; } - List result = new ArrayList(); - for (Iterator it = children.iterator(); it.hasNext();) + List result = new ArrayList(); + for (ConfigurationNode child : children) { - ConfigurationNode child = (ConfigurationNode) it.next(); if (StringUtils.equals(name.getName(), child.getName())) { result.add(child); @@ -117,7 +114,7 @@ } } - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointer.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointer.java?rev=627984&r1=627983&r2=627984&view=diff ============================================================================== --- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointer.java (original) +++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointer.java Fri Feb 15 01:46:09 2008 @@ -14,9 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.commons.configuration2.tree.xpath; -import java.util.Iterator; import java.util.List; import java.util.Locale; @@ -175,8 +175,7 @@ * @param pointer2 another pointer * @return a flag, which pointer should be sorted first */ - public int compareChildNodePointers(NodePointer pointer1, - NodePointer pointer2) + public int compareChildNodePointers(NodePointer pointer1, NodePointer pointer2) { ConfigurationNode node1 = (ConfigurationNode) pointer1.getBaseValue(); ConfigurationNode node2 = (ConfigurationNode) pointer2.getBaseValue(); @@ -194,11 +193,9 @@ else { // sort based on the occurrence in the sub node list - List subNodes = node1.isAttribute() ? node.getAttributes() : node - .getChildren(); - for (Iterator it = subNodes.iterator(); it.hasNext();) + List subNodes = node1.isAttribute() ? node.getAttributes() : node.getChildren(); + for (ConfigurationNode child : subNodes) { - ConfigurationNode child = (ConfigurationNode) it.next(); if (child == node1) { return -1; @@ -231,11 +228,9 @@ * @param reverse the reverse flag * @param startWith the start value of the iteration */ - public NodeIterator childIterator(NodeTest test, boolean reverse, - NodePointer startWith) + public NodeIterator childIterator(NodeTest test, boolean reverse, NodePointer startWith) { - return new ConfigurationNodeIteratorChildren(this, test, reverse, - startWith); + return new ConfigurationNodeIteratorChildren(this, test, reverse, startWith); } /** Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointerFactory.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointerFactory.java?rev=627984&r1=627983&r2=627984&view=diff ============================================================================== --- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointerFactory.java (original) +++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointerFactory.java Fri Feb 15 01:46:09 2008 @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.commons.configuration2.tree.xpath; import java.util.Locale; @@ -59,8 +60,7 @@ { if (bean instanceof ConfigurationNode) { - return new ConfigurationNodePointer((ConfigurationNode) bean, - locale); + return new ConfigurationNodePointer((ConfigurationNode) bean, locale); } return null; } @@ -74,13 +74,11 @@ * @param bean the bean * @return a pointer for a configuration node if the bean is such a node */ - public NodePointer createNodePointer(NodePointer parent, QName name, - Object bean) + public NodePointer createNodePointer(NodePointer parent, QName name, Object bean) { if (bean instanceof ConfigurationNode) { - return new ConfigurationNodePointer(parent, - (ConfigurationNode) bean); + return new ConfigurationNodePointer(parent, (ConfigurationNode) bean); } return null; } Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java?rev=627984&r1=627983&r2=627984&view=diff ============================================================================== --- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java (original) +++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java Fri Feb 15 01:46:09 2008 @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.commons.configuration2.tree.xpath; import java.util.ArrayList; @@ -110,8 +111,7 @@ static final String ATTR_DELIMITER = "@"; /** Constant for the delimiters for splitting node paths. */ - private static final String NODE_PATH_DELIMITERS = PATH_DELIMITER - + ATTR_DELIMITER; + private static final String NODE_PATH_DELIMITERS = PATH_DELIMITER + ATTR_DELIMITER; /** * Executes a query. The passed in property key is directly passed to a @@ -121,19 +121,26 @@ * @param key the query to be executed * @return a list with the nodes that are selected by the query */ - public List query(ConfigurationNode root, String key) + public List query(ConfigurationNode root, String key) { if (StringUtils.isEmpty(key)) { - List result = new ArrayList(1); + List result = new ArrayList(1); result.add(root); return result; } else { JXPathContext context = createContext(root, key); - List result = context.selectNodes(key); - return (result != null) ? result : Collections.EMPTY_LIST; + List result = context.selectNodes(key); + if (result != null) + { + return result; + } + else + { + return Collections.emptyList(); + } } } @@ -205,19 +212,17 @@ } if (index < 0) { - throw new IllegalArgumentException( - "prepareAdd: Passed in key must contain a whitespace!"); + throw new IllegalArgumentException("prepareAdd: Passed in key must contain a whitespace!"); } - List nodes = query(root, key.substring(0, index).trim()); + List nodes = query(root, key.substring(0, index).trim()); if (nodes.size() != 1) { - throw new IllegalArgumentException( - "prepareAdd: key must select exactly one target node!"); + throw new IllegalArgumentException("prepareAdd: key must select exactly one target node!"); } NodeAddData data = new NodeAddData(); - data.setParent((ConfigurationNode) nodes.get(0)); + data.setParent(nodes.get(0)); initNodeAddData(data, key.substring(index).trim()); return data; } Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/web/BaseWebConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/web/BaseWebConfiguration.java?rev=627984&r1=627983&r2=627984&view=diff ============================================================================== --- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/web/BaseWebConfiguration.java (original) +++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/web/BaseWebConfiguration.java Fri Feb 15 01:46:09 2008 @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.commons.configuration2.web; import java.util.List; @@ -99,8 +100,7 @@ { if (!isDelimiterParsingDisabled() && value instanceof String) { - List list = PropertyConverter.split((String) value, - getListDelimiter()); + List list = PropertyConverter.split((String) value, getListDelimiter()); value = list.size() > 1 ? list : list.get(0); }