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.
<Class
name="org.apache.commons.jxpath.util.BasicTypeConverter$ValuePointer" />
<Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS" />
</Match>
+ <Match>
+ <Class name="org.apache.commons.jxpath.ri.InfoSetUtil" />
+ <Bug pattern="RpC_REPEATED_CONDITIONAL_TEST" />
+ </Match>
+ <!-- suppress NullElementPointer/EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC because:
+ - none but the RI should create RI pointer instances
+ - .equal() CollectionPointers' collection members must be ==
+ - any CollectionPointer with a null collection is a NullElementPointer
+ -->
+ <Match>
+ <Class name="org.apache.commons.jxpath.ri.model.beans.NullElementPointer"
/>
+ <Bug pattern="EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC" />
+ </Match>
<!-- if/when we go to Java 1.4, use Double.compare(double, double) and
remove this -->
<Bug pattern="FE_FLOATING_POINT_EQUALITY" />
</FindBugsFilter>
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
* <code>PropertyPointer</code>s 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
<code>org.apache.commons.lang.ClassUtils</code> from
- * the Apache Commons Lang Component. Some adjustments made to remove
dependency on
+ * Port of class loading methods from
<code>org.apache.commons.lang.ClassUtils</code> from
+ * the Apache Commons Lang Component. Some adjustments made to remove
dependency on
* <code>org.apache.commons.lang.StringUtils</code>. 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 <code>java.lang.ClassNotFoundException</code>.
- *
+ * results in a <code>java.lang.ClassNotFoundException</code>.
+ *
* @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();