From: <bo...@us...> - 2007-05-29 11:36:06
|
Revision: 215 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=215&view=rev Author: bodewig Date: 2007-05-29 04:35:11 -0700 (Tue, 29 May 2007) Log Message: ----------- fix FindBugs detected problems, nothing major Modified Paths: -------------- trunk/xmlunit/src/java/org/custommonkey/xmlunit/Difference.java trunk/xmlunit/src/java/org/custommonkey/xmlunit/ElementNameAndAttributeQualifier.java trunk/xmlunit/src/java/org/custommonkey/xmlunit/HTMLDocumentBuilder.java trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeDescriptor.java trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeTest.java trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeTestException.java trunk/xmlunit/src/java/org/custommonkey/xmlunit/XpathNodeTracker.java Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/Difference.java =================================================================== --- trunk/xmlunit/src/java/org/custommonkey/xmlunit/Difference.java 2007-05-25 08:07:33 UTC (rev 214) +++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/Difference.java 2007-05-29 11:35:11 UTC (rev 215) @@ -1,6 +1,6 @@ /* ****************************************************************** -Copyright (c) 2001, Jeff Martin, Tim Bacon +Copyright (c) 2001-2007, Jeff Martin, Tim Bacon All rights reserved. Redistribution and use in source and binary forms, with or without @@ -148,6 +148,13 @@ } /** + * hashcode implementation to go with equals. + */ + public int hashCode() { + return id; + } + + /** * @return a basic representation of the object state and identity * and if <code>NodeDetail</code> instances are populated append * their details also Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/ElementNameAndAttributeQualifier.java =================================================================== --- trunk/xmlunit/src/java/org/custommonkey/xmlunit/ElementNameAndAttributeQualifier.java 2007-05-25 08:07:33 UTC (rev 214) +++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/ElementNameAndAttributeQualifier.java 2007-05-29 11:35:11 UTC (rev 215) @@ -1,6 +1,6 @@ /* ****************************************************************** -Copyright (c) 2001, Jeff Martin, Tim Bacon +Copyright (c) 2001-2007, Jeff Martin, Tim Bacon All rights reserved. Redistribution and use in source and binary forms, with or without @@ -36,6 +36,7 @@ package org.custommonkey.xmlunit; +import java.util.Arrays; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -49,7 +50,7 @@ * @see Diff#overrideElementQualifier(ElementQualifier) */ public class ElementNameAndAttributeQualifier extends ElementNameQualifier { - public static final String[] ALL_ATTRIBUTES = {"*"}; + private static final String[] ALL_ATTRIBUTES = {"*"}; private final String[] qualifyingAttrNames; @@ -76,7 +77,9 @@ * elements can be compared further for differences */ public ElementNameAndAttributeQualifier(String[] attrNames) { - this.qualifyingAttrNames = attrNames; + this.qualifyingAttrNames = new String[attrNames.length]; + System.arraycopy(attrNames, 0, qualifyingAttrNames, 0, + attrNames.length); } /** @@ -109,7 +112,7 @@ String controlValue, testValue; Attr[] qualifyingAttributes; NamedNodeMap namedNodeMap = control.getAttributes(); - if (qualifyingAttrNames == ALL_ATTRIBUTES) { + if (matchesAllAttributes(qualifyingAttrNames)) { qualifyingAttributes = new Attr[namedNodeMap.getLength()]; for (int n=0; n < qualifyingAttributes.length; ++n) { qualifyingAttributes[n] = (Attr) namedNodeMap.item(n); @@ -150,4 +153,7 @@ return true; } + private static boolean matchesAllAttributes(String[] attributes) { + return Arrays.equals(attributes, ALL_ATTRIBUTES); + } } Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/HTMLDocumentBuilder.java =================================================================== --- trunk/xmlunit/src/java/org/custommonkey/xmlunit/HTMLDocumentBuilder.java 2007-05-25 08:07:33 UTC (rev 214) +++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/HTMLDocumentBuilder.java 2007-05-29 11:35:11 UTC (rev 215) @@ -1,6 +1,6 @@ /* ****************************************************************** -Copyright (c) 2001, Jeff Martin, Tim Bacon +Copyright (c) 2001-2007, Jeff Martin, Tim Bacon All rights reserved. Redistribution and use in source and binary forms, with or without @@ -121,7 +121,7 @@ * to a Sax-aware ContentHandler. */ public class SwingEvent2SaxAdapter extends HTMLEditorKit.ParserCallback { - private final boolean IGNORE_HTML_CHAR_SET = true; + private static final boolean IGNORE_HTML_CHAR_SET = true; private final AttributesImpl attributes; private final ParserDelegator delegator; private boolean lastTagWasSimpleTag; Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeDescriptor.java =================================================================== --- trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeDescriptor.java 2007-05-25 08:07:33 UTC (rev 214) +++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeDescriptor.java 2007-05-29 11:35:11 UTC (rev 215) @@ -1,6 +1,6 @@ /* ****************************************************************** -Copyright (c) 2001, Jeff Martin, Tim Bacon +Copyright (c) 2001-2007, Jeff Martin, Tim Bacon All rights reserved. Redistribution and use in source and binary forms, with or without @@ -45,7 +45,7 @@ * Class for describing Nodes */ public class NodeDescriptor implements XMLConstants { - protected static String DOCUMENT_NODE_DESCRIPTION = "Document Node "; + protected static final String DOCUMENT_NODE_DESCRIPTION = "Document Node "; /** * Convert a Node into a simple String representation Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeTest.java =================================================================== --- trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeTest.java 2007-05-25 08:07:33 UTC (rev 214) +++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeTest.java 2007-05-29 11:35:11 UTC (rev 215) @@ -1,6 +1,6 @@ /* ****************************************************************** -Copyright (c) 2001, Jeff Martin, Tim Bacon +Copyright (c) 2001-2007, Jeff Martin, Tim Bacon All rights reserved. Redistribution and use in source and binary forms, with or without @@ -160,7 +160,7 @@ * Node type specific Node Filter: accepts Nodes of those types specified * in constructor, rejects all others */ - private class NodeTypeNodeFilter implements NodeFilter { + private static class NodeTypeNodeFilter implements NodeFilter { private final short[] nodeTypes; /** Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeTestException.java =================================================================== --- trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeTestException.java 2007-05-25 08:07:33 UTC (rev 214) +++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeTestException.java 2007-05-29 11:35:11 UTC (rev 215) @@ -1,6 +1,6 @@ /* ****************************************************************** -Copyright (c) 2001, Jeff Martin, Tim Bacon +Copyright (c) 2001-2007, Jeff Martin, Tim Bacon All rights reserved. Redistribution and use in source and binary forms, with or without @@ -44,7 +44,7 @@ * @see NodeTest */ public class NodeTestException extends Exception { - private final Node node; + private transient final Node node; /** * Constructor for specific node and message Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/XpathNodeTracker.java =================================================================== --- trunk/xmlunit/src/java/org/custommonkey/xmlunit/XpathNodeTracker.java 2007-05-25 08:07:33 UTC (rev 214) +++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/XpathNodeTracker.java 2007-05-29 11:35:11 UTC (rev 215) @@ -58,8 +58,6 @@ private final List indentationList = new ArrayList(); private TrackingEntry currentEntry; - private boolean trackRepeatedVisits = false; - /** * Simple constructor */ @@ -198,7 +196,7 @@ * Wrapper class around a mutable <code>int</code> value * Avoids creation of many immutable <code>Integer</code> objects */ - private final class Int { + private static final class Int { private int value; public Int(int startAt) { @@ -222,7 +220,7 @@ * Holds node tracking details - one instance is used for each level of indentation in a DOM * Provides reference between a String-ified Node value and the xpath index of that value */ - private final class TrackingEntry { + private static final class TrackingEntry { private final Map valueMap = new HashMap(); private String currentValue, currentAttribute; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |