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 4563B900F for ; Sat, 21 Jan 2012 03:12:40 +0000 (UTC) Received: (qmail 23596 invoked by uid 500); 21 Jan 2012 03:12:34 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 23225 invoked by uid 500); 21 Jan 2012 03:12:19 -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 23213 invoked by uid 99); 21 Jan 2012 03:12:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Jan 2012 03:12:16 +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, 21 Jan 2012 03:12:09 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8429C23889CB for ; Sat, 21 Jan 2012 03:11:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1234255 - in /commons/proper/jxpath/trunk: conf/ src/java/org/apache/commons/jxpath/ src/java/org/apache/commons/jxpath/ri/ src/java/org/apache/commons/jxpath/ri/model/ src/java/org/apache/commons/jxpath/ri/model/dom/ src/java/org/apache/c... Date: Sat, 21 Jan 2012 03:11:46 -0000 To: commits@commons.apache.org From: mbenson@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120121031147.8429C23889CB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mbenson Date: Sat Jan 21 03:11:46 2012 New Revision: 1234255 URL: http://svn.apache.org/viewvc?rev=1234255&view=rev Log: checkstyle/PMD/findbugs Modified: commons/proper/jxpath/trunk/conf/findbugs-exclude-filter.xml commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/FunctionLibrary.java commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContextFactory.java commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/XMLDocumentContainer.java commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/Compiler.java commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/EvalContext.java commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynabeans/StrictLazyDynaBeanPointerFactory.java commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/ClassLoaderUtil.java Modified: commons/proper/jxpath/trunk/conf/findbugs-exclude-filter.xml URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/conf/findbugs-exclude-filter.xml?rev=1234255&r1=1234254&r2=1234255&view=diff ============================================================================== --- commons/proper/jxpath/trunk/conf/findbugs-exclude-filter.xml (original) +++ commons/proper/jxpath/trunk/conf/findbugs-exclude-filter.xml Sat Jan 21 03:11:46 2012 @@ -142,6 +142,19 @@ under the License. + + + + + + + + + Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/FunctionLibrary.java URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/FunctionLibrary.java?rev=1234255&r1=1234254&r2=1234255&view=diff ============================================================================== --- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/FunctionLibrary.java (original) +++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/FunctionLibrary.java Sat Jan 21 03:11:46 2012 @@ -42,7 +42,9 @@ public class FunctionLibrary implements */ public void addFunctions(Functions functions) { allFunctions.add(functions); - byNamespace = null; + synchronized (this) { + byNamespace = null; + } } /** @@ -51,7 +53,9 @@ public class FunctionLibrary implements */ public void removeFunctions(Functions functions) { allFunctions.remove(functions); - byNamespace = null; + synchronized (this) { + byNamespace = null; + } } /** @@ -99,6 +103,7 @@ public class FunctionLibrary implements /** * Prepare the cache. + * @return cache map keyed by namespace */ private synchronized Map functionCache() { if (byNamespace == null) { @@ -112,12 +117,14 @@ public class FunctionLibrary implements Object candidates = byNamespace.get(ns); if (candidates == null) { byNamespace.put(ns, funcs); - } else if (candidates instanceof Functions) { + } + else if (candidates instanceof Functions) { List lst = new ArrayList(); lst.add(candidates); lst.add(funcs); byNamespace.put(ns, lst); - } else { + } + else { ((List) candidates).add(funcs); } } Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java?rev=1234255&r1=1234254&r2=1234255&view=diff ============================================================================== --- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java (original) +++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContext.java Sat Jan 21 03:11:46 2012 @@ -380,8 +380,8 @@ import org.apache.commons.jxpath.util.Ke * @version $Revision$ $Date$ */ public abstract class JXPathContext { - private static JXPathContextFactory contextFactory; - private static JXPathContext compilationContext; + private static volatile JXPathContextFactory contextFactory; + private static volatile JXPathContext compilationContext; private static final PackageFunctions GENERIC_FUNCTIONS = new PackageFunctions("", null); Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContextFactory.java URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContextFactory.java?rev=1234255&r1=1234254&r2=1234255&view=diff ============================================================================== --- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContextFactory.java (original) +++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathContextFactory.java Sat Jan 21 03:11:46 2012 @@ -238,8 +238,7 @@ public abstract class JXPathContextFacto if (debug) { System.err.println("JXPath: found " + serviceId); } - BufferedReader rd = - new BufferedReader(new InputStreamReader(is)); + BufferedReader rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); String factory = null; try { Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/XMLDocumentContainer.java URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/XMLDocumentContainer.java?rev=1234255&r1=1234254&r2=1234255&view=diff ============================================================================== --- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/XMLDocumentContainer.java (original) +++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/XMLDocumentContainer.java Sat Jan 21 03:11:46 2012 @@ -24,7 +24,6 @@ import javax.xml.transform.TransformerFa import javax.xml.transform.dom.DOMResult; import org.apache.commons.jxpath.xml.DocumentContainer; -import org.w3c.dom.Document; /** * An XML document container reads and parses XML only when it is Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/Compiler.java URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/Compiler.java?rev=1234255&r1=1234254&r2=1234255&view=diff ============================================================================== --- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/Compiler.java (original) +++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/Compiler.java Sat Jan 21 03:11:46 2012 @@ -96,7 +96,7 @@ public interface Compiler { public static final int FUNCTION_NULL = 28; public static final int FUNCTION_KEY = 29; public static final int FUNCTION_FORMAT_NUMBER = 30; - + public static final int FUNCTION_ENDS_WITH = 31; /** Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/EvalContext.java URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/EvalContext.java?rev=1234255&r1=1234254&r2=1234255&view=diff ============================================================================== --- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/EvalContext.java (original) +++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/EvalContext.java Sat Jan 21 03:11:46 2012 @@ -209,6 +209,7 @@ public abstract class EvalContext implem Collections.sort(l, ReverseComparator.INSTANCE); break; default: + break; } } Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java?rev=1234255&r1=1234254&r2=1234255&view=diff ============================================================================== --- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java (original) +++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java Sat Jan 21 03:11:46 2012 @@ -918,7 +918,7 @@ public abstract class NodePointer implem /** * Verify the structure of a given NodePointer. - * @param nodePointer + * @param nodePointer to check * @return nodePointer * @throws JXPathNotFoundException */ Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java?rev=1234255&r1=1234254&r2=1234255&view=diff ============================================================================== --- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java (original) +++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java Sat Jan 21 03:11:46 2012 @@ -680,7 +680,7 @@ public class DOMNodePointer extends Node if (uri == null) { String prefix = getPrefix(node); String qname = prefix == null ? "xmlns" : "xmlns:" + prefix; - + Node aNode = node; while (aNode != null) { if (aNode.getNodeType() == Node.ELEMENT_NODE) { Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynabeans/StrictLazyDynaBeanPointerFactory.java URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynabeans/StrictLazyDynaBeanPointerFactory.java?rev=1234255&r1=1234254&r2=1234255&view=diff ============================================================================== --- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynabeans/StrictLazyDynaBeanPointerFactory.java (original) +++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynabeans/StrictLazyDynaBeanPointerFactory.java Sat Jan 21 03:11:46 2012 @@ -32,10 +32,13 @@ import org.apache.commons.jxpath.ri.mode * PropertyPointers returned by these will respect * {@link LazyDynaClass#isDynaProperty(String)} when determining * {@link PropertyPointer#isActual()}. - * + * * @version $Revision$ $Date$ */ public class StrictLazyDynaBeanPointerFactory implements NodePointerFactory { + /** + * Pointer implementation. + */ private static class StrictLazyDynaBeanPointer extends DynaBeanPointer { private static final long serialVersionUID = 1L; @@ -43,10 +46,10 @@ public class StrictLazyDynaBeanPointerFa /** * Create a new StrictLazyDynaBeanPointer instance. - * - * @param parent - * @param name - * @param lazyDynaBean + * + * @param parent pointer + * @param name is the name given to the first node + * @param lazyDynaBean pointed */ public StrictLazyDynaBeanPointer(NodePointer parent, QName name, LazyDynaBean lazyDynaBean) { super(parent, name, lazyDynaBean); @@ -55,16 +58,19 @@ public class StrictLazyDynaBeanPointerFa /** * Create a new StrictLazyDynaBeanPointer instance. - * - * @param name - * @param lazyDynaBean - * @param locale + * + * @param name is the name given to the first node + * @param lazyDynaBean pointed + * @param locale Locale */ public StrictLazyDynaBeanPointer(QName name, LazyDynaBean lazyDynaBean, Locale locale) { super(name, lazyDynaBean, locale); this.lazyDynaBean = lazyDynaBean; } + /** + * {@inheritDoc} + */ public PropertyPointer getPropertyPointer() { return new DynaBeanPropertyPointer(this, lazyDynaBean) { private static final long serialVersionUID = 1L; @@ -77,15 +83,24 @@ public class StrictLazyDynaBeanPointerFa } } + /** + * {@inheritDoc} + */ public int getOrder() { return DynaBeanPointerFactory.DYNA_BEAN_POINTER_FACTORY_ORDER - 1; } + /** + * {@inheritDoc} + */ public NodePointer createNodePointer(QName name, Object object, Locale locale) { return object instanceof LazyDynaBean ? new StrictLazyDynaBeanPointer(name, (LazyDynaBean) object, locale) : null; } + /** + * {@inheritDoc} + */ public NodePointer createNodePointer(NodePointer parent, QName name, Object object) { return object instanceof LazyDynaBean ? new StrictLazyDynaBeanPointer(parent, name, (LazyDynaBean) object) : null; Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/ClassLoaderUtil.java URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/ClassLoaderUtil.java?rev=1234255&r1=1234254&r2=1234255&view=diff ============================================================================== --- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/ClassLoaderUtil.java (original) +++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/ClassLoaderUtil.java Sat Jan 21 03:11:46 2012 @@ -5,9 +5,9 @@ * 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. @@ -20,14 +20,14 @@ import java.util.HashMap; import java.util.Map; /** - * Port of class loading methods from org.apache.commons.lang.ClassUtils from - * the Apache Commons Lang Component. Some adjustments made to remove dependency on + * Port of class loading methods from org.apache.commons.lang.ClassUtils from + * the Apache Commons Lang Component. Some adjustments made to remove dependency on * org.apache.commons.lang.StringUtils. Also modified to fall back on the * current class loader when an attempt to load a class with the context class loader - * results in a java.lang.ClassNotFoundException. - * + * results in a java.lang.ClassNotFoundException. + * * @see org.apache.commons.lang.ClassUtils - * + * * @author Stephen Colebourne * @author Gary Gregory * @author Norm Deane @@ -43,7 +43,7 @@ public class ClassLoaderUtil { /** * Add primitive type abbreviation to maps of abbreviations. - * + * * @param primitive Canonical name of primitive type * @param abbreviation Corresponding abbreviation of primitive type */ @@ -84,7 +84,8 @@ public class ClassLoaderUtil { if (abbreviationMap.containsKey(className)) { String clsName = "[" + abbreviationMap.get(className); clazz = Class.forName(clsName, initialize, classLoader).getComponentType(); - } else { + } + else { clazz = Class.forName(toCanonicalName(className), initialize, classLoader); } return clazz; @@ -136,7 +137,8 @@ public class ClassLoaderUtil { if (contextCL != null) { try { return getClass(contextCL, className, initialize); - } catch (ClassNotFoundException e) { + } + catch (ClassNotFoundException e) {//NOPMD // ignore this exception and try the current class loader. } } @@ -152,7 +154,8 @@ public class ClassLoaderUtil { private static String toCanonicalName(String className) { if (className == null) { throw new RuntimeException("Argument className was null."); - } else if (className.endsWith("[]")) { + } + else if (className.endsWith("[]")) { StringBuffer classNameBuffer = new StringBuffer(); while (className.endsWith("[]")) { className = className.substring(0, className.length() - 2); @@ -161,7 +164,8 @@ public class ClassLoaderUtil { String abbreviation = (String) abbreviationMap.get(className); if (abbreviation != null) { classNameBuffer.append(abbreviation); - } else { + } + else { classNameBuffer.append("L").append(className).append(";"); } className = classNameBuffer.toString();