8013900: More warnings compiling jaxp.
authordfuchs
Fri, 17 May 2013 10:40:21 +0200
changeset 17538 d8d911c4e5d4
parent 17537 50528ec0ea37
child 17539 e4e0796ef6c5
child 17786 4471252c40b4
8013900: More warnings compiling jaxp. Summary: Some internal implementation classes in Jaxp were redefining equals() without redefining hashCode(). This patch adds hashCode() methods that are consistent with equals(). Reviewed-by: chegar, joehw
jaxp/src/com/sun/org/apache/bcel/internal/generic/BasicType.java
jaxp/src/com/sun/org/apache/bcel/internal/generic/BranchInstruction.java
jaxp/src/com/sun/org/apache/bcel/internal/generic/CodeExceptionGen.java
jaxp/src/com/sun/org/apache/bcel/internal/generic/LineNumberGen.java
jaxp/src/com/sun/org/apache/bcel/internal/generic/LocalVariableGen.java
jaxp/src/com/sun/org/apache/bcel/internal/generic/ReturnaddressType.java
jaxp/src/com/sun/org/apache/bcel/internal/generic/Select.java
jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java
jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/VariableRefBase.java
jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/xs/AbstractDateTimeDV.java
jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/xs/DecimalDV.java
jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/xs/PrecisionDecimalDV.java
jaxp/src/com/sun/org/apache/xerces/internal/util/URI.java
jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java
jaxp/src/com/sun/org/apache/xml/internal/dtm/ref/DTMNodeProxy.java
jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/URI.java
jaxp/src/com/sun/org/apache/xml/internal/utils/URI.java
jaxp/src/com/sun/org/apache/xpath/internal/Arg.java
--- a/jaxp/src/com/sun/org/apache/bcel/internal/generic/BasicType.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/bcel/internal/generic/BasicType.java	Fri May 17 10:40:21 2013 +0200
@@ -97,8 +97,14 @@
 
   /** @return true if both type objects refer to the same type
    */
+  @Override
   public boolean equals(Object type) {
     return (type instanceof BasicType)?
       ((BasicType)type).type == this.type : false;
   }
+
+  @Override
+  public int hashCode() {
+      return type;
+  }
 }
--- a/jaxp/src/com/sun/org/apache/bcel/internal/generic/BranchInstruction.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/bcel/internal/generic/BranchInstruction.java	Fri May 17 10:40:21 2013 +0200
@@ -93,6 +93,7 @@
    * Dump instruction as byte code to stream out.
    * @param out Output stream
    */
+  @Override
   public void dump(DataOutputStream out) throws IOException {
     out.writeByte(opcode);
 
@@ -153,6 +154,7 @@
    * @param verbose long/short format switch
    * @return mnemonic for instruction
    */
+  @Override
   public String toString(boolean verbose) {
     String s = super.toString(verbose);
     String t = "null";
@@ -184,6 +186,7 @@
    * @param wide wide prefix?
    * @see InstructionList
    */
+  @Override
   protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException
   {
     length = 3;
@@ -204,26 +207,41 @@
    * Set branch target
    * @param target branch target
    */
-  public void setTarget(InstructionHandle target) {
-    notifyTarget(this.target, target, this);
+  public final void setTarget(InstructionHandle target) {
+    notifyTargetChanging(this.target, this);
     this.target = target;
+    notifyTargetChanged(this.target, this);
   }
 
   /**
-   * Used by BranchInstruction, LocalVariableGen, CodeExceptionGen
+   * Used by BranchInstruction, LocalVariableGen, CodeExceptionGen.
+   * Must be called before the target is actually changed in the
+   * InstructionTargeter.
    */
-  static final void notifyTarget(InstructionHandle old_ih, InstructionHandle new_ih,
+  static void notifyTargetChanging(InstructionHandle old_ih,
                                  InstructionTargeter t) {
-    if(old_ih != null)
+    if(old_ih != null) {
       old_ih.removeTargeter(t);
-    if(new_ih != null)
+    }
+  }
+
+  /**
+   * Used by BranchInstruction, LocalVariableGen, CodeExceptionGen.
+   * Must be called after the target is actually changed in the
+   * InstructionTargeter.
+   */
+  static void notifyTargetChanged(InstructionHandle new_ih,
+                                 InstructionTargeter t) {
+    if(new_ih != null) {
       new_ih.addTargeter(t);
+    }
   }
 
   /**
    * @param old_ih old target
    * @param new_ih new target
    */
+  @Override
   public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
     if(target == old_ih)
       setTarget(new_ih);
@@ -234,6 +252,7 @@
   /**
    * @return true, if ih is target of this instruction
    */
+  @Override
   public boolean containsTarget(InstructionHandle ih) {
     return (target == ih);
   }
@@ -241,6 +260,7 @@
   /**
    * Inform target that it's not targeted anymore.
    */
+  @Override
   void dispose() {
     setTarget(null);
     index=-1;
--- a/jaxp/src/com/sun/org/apache/bcel/internal/generic/CodeExceptionGen.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/bcel/internal/generic/CodeExceptionGen.java	Fri May 17 10:40:21 2013 +0200
@@ -58,7 +58,6 @@
  * <http://www.apache.org/>.
  */
 
-import com.sun.org.apache.bcel.internal.Constants;
 import com.sun.org.apache.bcel.internal.classfile.*;
 
 /**
@@ -118,31 +117,35 @@
   /* Set start of handler
    * @param start_pc Start of handled region (inclusive)
    */
-  public void setStartPC(InstructionHandle start_pc) {
-    BranchInstruction.notifyTarget(this.start_pc, start_pc, this);
+  public final void setStartPC(InstructionHandle start_pc) {
+    BranchInstruction.notifyTargetChanging(this.start_pc, this);
     this.start_pc = start_pc;
+    BranchInstruction.notifyTargetChanged(this.start_pc, this);
   }
 
   /* Set end of handler
    * @param end_pc End of handled region (inclusive)
    */
-  public void setEndPC(InstructionHandle end_pc) {
-    BranchInstruction.notifyTarget(this.end_pc, end_pc, this);
+  public final void setEndPC(InstructionHandle end_pc) {
+    BranchInstruction.notifyTargetChanging(this.end_pc, this);
     this.end_pc = end_pc;
+    BranchInstruction.notifyTargetChanged(this.end_pc, this);
   }
 
   /* Set handler code
    * @param handler_pc Start of handler
    */
-  public void setHandlerPC(InstructionHandle handler_pc) {
-    BranchInstruction.notifyTarget(this.handler_pc, handler_pc, this);
+  public final void setHandlerPC(InstructionHandle handler_pc) {
+    BranchInstruction.notifyTargetChanging(this.handler_pc, this);
     this.handler_pc = handler_pc;
+    BranchInstruction.notifyTargetChanged(this.handler_pc, this);
   }
 
   /**
    * @param old_ih old target, either start or end
    * @param new_ih new target
    */
+  @Override
   public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
     boolean targeted = false;
 
@@ -169,6 +172,7 @@
   /**
    * @return true, if ih is target of this handler
    */
+  @Override
   public boolean containsTarget(InstructionHandle ih) {
     return (start_pc == ih) || (end_pc == ih) || (handler_pc == ih);
   }
@@ -190,10 +194,12 @@
    */
   public InstructionHandle getHandlerPC()                             { return handler_pc; }
 
+  @Override
   public String toString() {
     return "CodeExceptionGen(" + start_pc + ", " + end_pc + ", " + handler_pc + ")";
   }
 
+  @Override
   public Object clone() {
     try {
       return super.clone();
--- a/jaxp/src/com/sun/org/apache/bcel/internal/generic/LineNumberGen.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/bcel/internal/generic/LineNumberGen.java	Fri May 17 10:40:21 2013 +0200
@@ -58,7 +58,6 @@
  * <http://www.apache.org/>.
  */
 
-import com.sun.org.apache.bcel.internal.Constants;
 import com.sun.org.apache.bcel.internal.classfile.*;
 
 /**
@@ -88,6 +87,7 @@
   /**
    * @return true, if ih is target of this line number
    */
+  @Override
   public boolean containsTarget(InstructionHandle ih) {
     return this.ih == ih;
   }
@@ -96,6 +96,7 @@
    * @param old_ih old target
    * @param new_ih new target
    */
+  @Override
   public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
     if(old_ih != ih)
       throw new ClassGenException("Not targeting " + old_ih + ", but " + ih + "}");
@@ -113,12 +114,13 @@
     return new LineNumber(ih.getPosition(), src_line);
   }
 
-  public void setInstruction(InstructionHandle ih) {
-    BranchInstruction.notifyTarget(this.ih, ih, this);
-
+  public final void setInstruction(InstructionHandle ih) {
+    BranchInstruction.notifyTargetChanging(this.ih, this);
     this.ih = ih;
+    BranchInstruction.notifyTargetChanged(this.ih, this);
   }
 
+  @Override
   public Object clone() {
     try {
       return super.clone();
--- a/jaxp/src/com/sun/org/apache/bcel/internal/generic/LocalVariableGen.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/bcel/internal/generic/LocalVariableGen.java	Fri May 17 10:40:21 2013 +0200
@@ -60,6 +60,7 @@
 
 import com.sun.org.apache.bcel.internal.Constants;
 import com.sun.org.apache.bcel.internal.classfile.*;
+import java.util.Objects;
 
 /**
  * This class represents a local variable within a method. It contains its
@@ -75,7 +76,7 @@
   implements InstructionTargeter, NamedAndTyped, Cloneable,
              java.io.Serializable
 {
-  private int         index;
+  private final int   index;
   private String      name;
   private Type        type;
   private InstructionHandle start, end;
@@ -131,30 +132,96 @@
                              signature_index, index, cp.getConstantPool());
   }
 
-  public void        setIndex(int index)           { this.index = index; }
-  public int         getIndex()                   { return index; }
+  public int         getIndex()                  { return index; }
+  @Override
   public void        setName(String name)        { this.name = name; }
+  @Override
   public String      getName()                   { return name; }
+  @Override
   public void        setType(Type type)          { this.type = type; }
+  @Override
   public Type        getType()                   { return type; }
 
   public InstructionHandle getStart()                  { return start; }
   public InstructionHandle getEnd()                    { return end; }
 
-  public void setStart(InstructionHandle start) {
-    BranchInstruction.notifyTarget(this.start, start, this);
-    this.start = start;
+  /**
+   * Remove this from any known HashSet in which it might be registered.
+   */
+  void notifyTargetChanging() {
+    // hashCode depends on 'index', 'start', and 'end'.
+    // Therefore before changing any of these values we
+    // need to unregister 'this' from any HashSet where
+    // this is registered, and then we need to add it
+    // back...
+
+    // Unregister 'this' from the HashSet held by 'start'.
+    BranchInstruction.notifyTargetChanging(this.start, this);
+    if (this.end != this.start) {
+        // Since hashCode() is going to change we need to unregister
+        // 'this' both form 'start' and 'end'.
+        // Unregister 'this' from the HashSet held by 'end'.
+        BranchInstruction.notifyTargetChanging(this.end, this);
+    }
   }
 
-  public void setEnd(InstructionHandle end) {
-    BranchInstruction.notifyTarget(this.end, end, this);
+  /**
+   * Add back 'this' in all HashSet in which it should be registered.
+   **/
+  void notifyTargetChanged() {
+    // hashCode depends on 'index', 'start', and 'end'.
+    // Therefore before changing any of these values we
+    // need to unregister 'this' from any HashSet where
+    // this is registered, and then we need to add it
+    // back...
+
+    // Register 'this' in the HashSet held by start.
+    BranchInstruction.notifyTargetChanged(this.start, this);
+    if (this.end != this.start) {
+        // Since hashCode() has changed we need to register
+        // 'this' again in 'end'.
+        // Add back 'this' in the HashSet held by 'end'.
+        BranchInstruction.notifyTargetChanged(this.end, this);
+    }
+  }
+
+  public final void setStart(InstructionHandle start) {
+
+    // Call notifyTargetChanging *before* modifying this,
+    // as the code triggered by notifyTargetChanging
+    // depends on this pointing to the 'old' start.
+    notifyTargetChanging();
+
+    this.start = start;
+
+    // call notifyTargetChanged *after* modifying this,
+    // as the code triggered by notifyTargetChanged
+    // depends on this pointing to the 'new' start.
+    notifyTargetChanged();
+  }
+
+  public final void setEnd(InstructionHandle end) {
+    // call notifyTargetChanging *before* modifying this,
+    // as the code triggered by notifyTargetChanging
+    // depends on this pointing to the 'old' end.
+    // Unregister 'this' from the HashSet held by the 'old' end.
+    notifyTargetChanging();
+
     this.end = end;
+
+    // call notifyTargetChanged *after* modifying this,
+    // as the code triggered by notifyTargetChanged
+    // depends on this pointing to the 'new' end.
+    // Register 'this' in the HashSet held by the 'new' end.
+    notifyTargetChanged();
+
   }
 
   /**
    * @param old_ih old target, either start or end
    * @param new_ih new target
    */
+  @Override
   public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
     boolean targeted = false;
 
@@ -176,15 +243,20 @@
   /**
    * @return true, if ih is target of this variable
    */
+  @Override
   public boolean containsTarget(InstructionHandle ih) {
     return (start == ih) || (end == ih);
   }
 
   /**
-   * We consider to local variables to be equal, if the use the same index and
+   * We consider two local variables to be equal, if they use the same index and
    * are valid in the same range.
    */
+  @Override
   public boolean equals(Object o) {
+    if (o==this)
+      return true;
+
     if(!(o instanceof LocalVariableGen))
       return false;
 
@@ -192,10 +264,21 @@
     return (l.index == index) && (l.start == start) && (l.end == end);
   }
 
+  @Override
+  public int hashCode() {
+    int hash = 7;
+    hash = 59 * hash + this.index;
+    hash = 59 * hash + Objects.hashCode(this.start);
+    hash = 59 * hash + Objects.hashCode(this.end);
+    return hash;
+  }
+
+  @Override
   public String toString() {
     return "LocalVariableGen(" + name +  ", " + type +  ", " + start + ", " + end + ")";
   }
 
+  @Override
   public Object clone() {
     try {
       return super.clone();
--- a/jaxp/src/com/sun/org/apache/bcel/internal/generic/ReturnaddressType.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/bcel/internal/generic/ReturnaddressType.java	Fri May 17 10:40:21 2013 +0200
@@ -58,7 +58,7 @@
  * <http://www.apache.org/>.
  */
 import com.sun.org.apache.bcel.internal.Constants;
-import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
+import java.util.Objects;
 
 /**
  * Returnaddress, the type JSR or JSR_W instructions push upon the stack.
@@ -86,9 +86,15 @@
         this.returnTarget = returnTarget;
   }
 
+  @Override
+  public int hashCode() {
+      return Objects.hashCode(this.returnTarget);
+  }
+
   /**
    * Returns if the two Returnaddresses refer to the same target.
    */
+  @Override
   public boolean equals(Object rat){
     if(!(rat instanceof ReturnaddressType))
       return false;
--- a/jaxp/src/com/sun/org/apache/bcel/internal/generic/Select.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/bcel/internal/generic/Select.java	Fri May 17 10:40:21 2013 +0200
@@ -97,8 +97,9 @@
     super(opcode, target);
 
     this.targets = targets;
-    for(int i=0; i < targets.length; i++)
-      notifyTarget(null, targets[i], this);
+    for(int i=0; i < targets.length; i++) {
+      BranchInstruction.notifyTargetChanged(targets[i], this);
+    }
 
     this.match = match;
 
@@ -121,6 +122,7 @@
    * @param max_offset the maximum offset that may be caused by these instructions
    * @return additional offset caused by possible change of this instruction's length
    */
+  @Override
   protected int updatePosition(int offset, int max_offset) {
     position += offset; // Additional offset caused by preceding SWITCHs, GOTOs, etc.
 
@@ -138,6 +140,7 @@
    * Dump instruction as byte code to stream out.
    * @param out Output stream
    */
+  @Override
   public void dump(DataOutputStream out) throws IOException {
     out.writeByte(opcode);
 
@@ -151,6 +154,7 @@
   /**
    * Read needed data (e.g. index) from file.
    */
+  @Override
   protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException
   {
     padding = (4 - (bytes.getIndex() % 4)) % 4; // Compute number of pad bytes
@@ -166,8 +170,9 @@
   /**
    * @return mnemonic for instruction
    */
+  @Override
   public String toString(boolean verbose) {
-    StringBuffer buf = new StringBuffer(super.toString(verbose));
+    final StringBuilder buf = new StringBuilder(super.toString(verbose));
 
     if(verbose) {
       for(int i=0; i < match_length; i++) {
@@ -176,7 +181,8 @@
         if(targets[i] != null)
           s = targets[i].getInstruction().toString();
 
-        buf.append("(" + match[i] + ", " + s + " = {" + indices[i] + "})");
+          buf.append("(").append(match[i]).append(", ")
+             .append(s).append(" = {").append(indices[i]).append("})");
       }
     }
     else
@@ -188,15 +194,17 @@
   /**
    * Set branch target for `i'th case
    */
-  public void setTarget(int i, InstructionHandle target) {
-    notifyTarget(targets[i], target, this);
+  public final void setTarget(int i, InstructionHandle target) {
+    notifyTargetChanging(targets[i], this);
     targets[i] = target;
+    notifyTargetChanged(targets[i], this);
   }
 
   /**
    * @param old_ih old target
    * @param new_ih new target
    */
+  @Override
   public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
     boolean targeted = false;
 
@@ -219,6 +227,7 @@
   /**
    * @return true, if ih is target of this instruction
    */
+  @Override
   public boolean containsTarget(InstructionHandle ih) {
     if(target == ih)
       return true;
@@ -233,6 +242,7 @@
   /**
    * Inform targets that they're not targeted anymore.
    */
+  @Override
   void dispose() {
     super.dispose();
 
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java	Fri May 17 10:40:21 2013 +0200
@@ -54,6 +54,7 @@
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
 import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
+import java.util.Objects;
 
 /**
  * @author Jacek Ambroziak
@@ -156,8 +157,15 @@
             this.type = type;
             this.distance = distance;
         }
+
+        @Override
+        public int hashCode() {
+            return Objects.hashCode(this.type);
+        }
+
+        @Override
         public boolean equals(Object query){
-            return query.equals(type);
+            return query != null && query.equals(type);
         }
     }
 
@@ -277,6 +285,7 @@
         return(_fname.toString());
     }
 
+    @Override
     public void setParser(Parser parser) {
         super.setParser(parser);
         if (_arguments != null) {
@@ -319,6 +328,7 @@
      * Type check a function call. Since different type conversions apply,
      * type checking is different for standard and external (Java) functions.
      */
+    @Override
     public Type typeCheck(SymbolTable stable)
         throws TypeCheckError
     {
@@ -680,6 +690,7 @@
      * Compile the function call and treat as an expression
      * Update true/false-lists.
      */
+    @Override
     public void translateDesynthesized(ClassGenerator classGen,
                                        MethodGenerator methodGen)
     {
@@ -700,6 +711,7 @@
      * Translate a function call. The compiled code will leave the function's
      * return value on the JVM's stack.
      */
+    @Override
     public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
         final int n = argumentCount();
         final ConstantPoolGen cpg = classGen.getConstantPool();
@@ -857,6 +869,7 @@
         }
     }
 
+    @Override
     public String toString() {
         return "funcall(" + _fname + ", " + _arguments + ')';
     }
@@ -1069,7 +1082,7 @@
     protected static String replaceDash(String name)
     {
         char dash = '-';
-        StringBuffer buff = new StringBuffer("");
+        final StringBuilder buff = new StringBuilder("");
         for (int i = 0; i < name.length(); i++) {
         if (i > 0 && name.charAt(i-1) == dash)
             buff.append(Character.toUpperCase(name.charAt(i)));
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/VariableRefBase.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/VariableRefBase.java	Fri May 17 10:40:21 2013 +0200
@@ -25,6 +25,7 @@
 
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
+import java.util.Objects;
 
 /**
  * @author Morten Jorgensen
@@ -97,13 +98,15 @@
      * Two variable references are deemed equal if they refer to the
      * same variable.
      */
+    @Override
     public boolean equals(Object obj) {
-        try {
-            return (_variable == ((VariableRefBase) obj)._variable);
-        }
-        catch (ClassCastException e) {
-            return false;
-        }
+        return obj == this || (obj instanceof VariableRefBase)
+            && (_variable == ((VariableRefBase) obj)._variable);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(this._variable);
     }
 
     /**
@@ -111,10 +114,12 @@
      * format 'variable-ref(<var-name>)'.
      * @return Variable reference description
      */
+    @Override
     public String toString() {
         return "variable-ref("+_variable.getName()+'/'+_variable.getType()+')';
     }
 
+    @Override
     public Type typeCheck(SymbolTable stable)
         throws TypeCheckError
     {
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/xs/AbstractDateTimeDV.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/xs/AbstractDateTimeDV.java	Fri May 17 10:40:21 2013 +0200
@@ -51,456 +51,471 @@
  */
 public abstract class AbstractDateTimeDV extends TypeValidator {
 
-        //debugging
-        private static final boolean DEBUG=false;
-
-        //define shared variables for date/time
-
-
-        //define constants to be used in assigning default values for
-        //all date/time excluding duration
-        protected final static int YEAR=2000;
-        protected final static int MONTH=01;
-        protected final static int DAY = 01;
-
+    //debugging
+    private static final boolean DEBUG = false;
+    //define shared variables for date/time
+    //define constants to be used in assigning default values for
+    //all date/time excluding duration
+    protected final static int YEAR = 2000;
+    protected final static int MONTH = 01;
+    protected final static int DAY = 01;
     protected static final DatatypeFactory datatypeFactory = new DatatypeFactoryImpl();
 
-        public short getAllowedFacets(){
-                return ( XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_WHITESPACE | XSSimpleTypeDecl.FACET_ENUMERATION |XSSimpleTypeDecl.FACET_MAXINCLUSIVE |XSSimpleTypeDecl.FACET_MININCLUSIVE | XSSimpleTypeDecl.FACET_MAXEXCLUSIVE  | XSSimpleTypeDecl.FACET_MINEXCLUSIVE  );
-        }//getAllowedFacets()
+    @Override
+    public short getAllowedFacets() {
+        return (XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_WHITESPACE | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_MAXINCLUSIVE | XSSimpleTypeDecl.FACET_MININCLUSIVE | XSSimpleTypeDecl.FACET_MAXEXCLUSIVE | XSSimpleTypeDecl.FACET_MINEXCLUSIVE);
+    }//getAllowedFacets()
+
+    // distinguishes between identity and equality for date/time values
+    // ie: two values representing the same "moment in time" but with different
+    // remembered timezones are now equal but not identical.
+    @Override
+    public boolean isIdentical(Object value1, Object value2) {
+        if (!(value1 instanceof DateTimeData) || !(value2 instanceof DateTimeData)) {
+            return false;
+        }
+
+        DateTimeData v1 = (DateTimeData) value1;
+        DateTimeData v2 = (DateTimeData) value2;
+
+        // original timezones must be the same in addition to date/time values
+        // being 'equal'
+        if ((v1.timezoneHr == v2.timezoneHr) && (v1.timezoneMin == v2.timezoneMin)) {
+            return v1.equals(v2);
+        }
+
+        return false;
+    }//isIdentical()
+
+    // the parameters are in compiled form (from getActualValue)
+    @Override
+    public int compare(Object value1, Object value2) {
+        return compareDates(((DateTimeData) value1),
+                ((DateTimeData) value2), true);
+    }//compare()
 
+    /**
+     * Compare algorithm described in dateDime (3.2.7). Duration datatype
+     * overwrites this method
+     *
+     * @param date1 normalized date representation of the first value
+     * @param date2 normalized date representation of the second value
+     * @param strict
+     * @return less, greater, less_equal, greater_equal, equal
+     */
+    protected short compareDates(DateTimeData date1, DateTimeData date2, boolean strict) {
+        if (date1.utc == date2.utc) {
+            return compareOrder(date1, date2);
+        }
+        short c1, c2;
+
+        DateTimeData tempDate = new DateTimeData(null, this);
+
+        if (date1.utc == 'Z') {
+
+            //compare date1<=date1<=(date2 with time zone -14)
+            //
+            cloneDate(date2, tempDate); //clones date1 value to global temporary storage: fTempDate
+            tempDate.timezoneHr = 14;
+            tempDate.timezoneMin = 0;
+            tempDate.utc = '+';
+            normalize(tempDate);
+            c1 = compareOrder(date1, tempDate);
+            if (c1 == LESS_THAN) {
+                return c1;
+            }
+
+            //compare date1>=(date2 with time zone +14)
+            //
+            cloneDate(date2, tempDate); //clones date1 value to global temporary storage: tempDate
+            tempDate.timezoneHr = -14;
+            tempDate.timezoneMin = 0;
+            tempDate.utc = '-';
+            normalize(tempDate);
+            c2 = compareOrder(date1, tempDate);
+            if (c2 == GREATER_THAN) {
+                return c2;
+            }
+
+            return INDETERMINATE;
+        } else if (date2.utc == 'Z') {
 
-        // distinguishes between identity and equality for date/time values
-        // ie: two values representing the same "moment in time" but with different
-        // remembered timezones are now equal but not identical.
-        public boolean isIdentical (Object value1, Object value2) {
-                if (!(value1 instanceof DateTimeData) || !(value2 instanceof DateTimeData)) {
-                        return false;
-                }
+            //compare (date1 with time zone -14)<=date2
+            //
+            cloneDate(date1, tempDate); //clones date1 value to global temporary storage: tempDate
+            tempDate.timezoneHr = -14;
+            tempDate.timezoneMin = 0;
+            tempDate.utc = '-';
+            if (DEBUG) {
+                System.out.println("tempDate=" + dateToString(tempDate));
+            }
+            normalize(tempDate);
+            c1 = compareOrder(tempDate, date2);
+            if (DEBUG) {
+                System.out.println("date=" + dateToString(date2));
+                System.out.println("tempDate=" + dateToString(tempDate));
+            }
+            if (c1 == LESS_THAN) {
+                return c1;
+            }
+
+            //compare (date1 with time zone +14)<=date2
+            //
+            cloneDate(date1, tempDate); //clones date1 value to global temporary storage: tempDate
+            tempDate.timezoneHr = 14;
+            tempDate.timezoneMin = 0;
+            tempDate.utc = '+';
+            normalize(tempDate);
+            c2 = compareOrder(tempDate, date2);
+            if (DEBUG) {
+                System.out.println("tempDate=" + dateToString(tempDate));
+            }
+            if (c2 == GREATER_THAN) {
+                return c2;
+            }
+
+            return INDETERMINATE;
+        }
+        return INDETERMINATE;
+
+    }
+
+    /**
+     * Given normalized values, determines order-relation between give date/time
+     * objects.
+     *
+     * @param date1 date/time object
+     * @param date2 date/time object
+     * @return 0 if date1 and date2 are equal, a value less than 0 if date1 is
+     * less than date2, a value greater than 0 if date1 is greater than date2
+     */
+    protected short compareOrder(DateTimeData date1, DateTimeData date2) {
+        if (date1.position < 1) {
+            if (date1.year < date2.year) {
+                return -1;
+            }
+            if (date1.year > date2.year) {
+                return 1;
+            }
+        }
+        if (date1.position < 2) {
+            if (date1.month < date2.month) {
+                return -1;
+            }
+            if (date1.month > date2.month) {
+                return 1;
+            }
+        }
+        if (date1.day < date2.day) {
+            return -1;
+        }
+        if (date1.day > date2.day) {
+            return 1;
+        }
+        if (date1.hour < date2.hour) {
+            return -1;
+        }
+        if (date1.hour > date2.hour) {
+            return 1;
+        }
+        if (date1.minute < date2.minute) {
+            return -1;
+        }
+        if (date1.minute > date2.minute) {
+            return 1;
+        }
+        if (date1.second < date2.second) {
+            return -1;
+        }
+        if (date1.second > date2.second) {
+            return 1;
+        }
+        if (date1.utc < date2.utc) {
+            return -1;
+        }
+        if (date1.utc > date2.utc) {
+            return 1;
+        }
+        return 0;
+    }
 
-                DateTimeData v1 = (DateTimeData)value1;
-                DateTimeData v2 = (DateTimeData)value2;
+    /**
+     * Parses time hh:mm:ss.sss and time zone if any
+     *
+     * @param start
+     * @param end
+     * @param data
+     * @exception RuntimeException
+     */
+    protected void getTime(String buffer, int start, int end, DateTimeData data) throws RuntimeException {
+
+        int stop = start + 2;
+
+        //get hours (hh)
+        data.hour = parseInt(buffer, start, stop);
+
+        //get minutes (mm)
+
+        if (buffer.charAt(stop++) != ':') {
+            throw new RuntimeException("Error in parsing time zone");
+        }
+        start = stop;
+        stop = stop + 2;
+        data.minute = parseInt(buffer, start, stop);
+
+        //get seconds (ss)
+        if (buffer.charAt(stop++) != ':') {
+            throw new RuntimeException("Error in parsing time zone");
+        }
+
+        //find UTC sign if any
+        int sign = findUTCSign(buffer, start, end);
+
+        //get seconds (ms)
+        start = stop;
+        stop = sign < 0 ? end : sign;
+        data.second = parseSecond(buffer, start, stop);
 
-                // original timezones must be the same in addition to date/time values
-                // being 'equal'
-                if ((v1.timezoneHr == v2.timezoneHr) && (v1.timezoneMin == v2.timezoneMin)) {
-                        return v1.equals(v2);
-                }
+        //parse UTC time zone (hh:mm)
+        if (sign > 0) {
+            getTimeZone(buffer, data, sign, end);
+        }
+    }
+
+    /**
+     * Parses date CCYY-MM-DD
+     *
+     * @param buffer
+     * @param start start position
+     * @param end end position
+     * @param date
+     * @exception RuntimeException
+     */
+    protected int getDate(String buffer, int start, int end, DateTimeData date) throws RuntimeException {
+
+        start = getYearMonth(buffer, start, end, date);
+
+        if (buffer.charAt(start++) != '-') {
+            throw new RuntimeException("CCYY-MM must be followed by '-' sign");
+        }
+        int stop = start + 2;
+        date.day = parseInt(buffer, start, stop);
+        return stop;
+    }
+
+    /**
+     * Parses date CCYY-MM
+     *
+     * @param buffer
+     * @param start start position
+     * @param end end position
+     * @param date
+     * @exception RuntimeException
+     */
+    protected int getYearMonth(String buffer, int start, int end, DateTimeData date) throws RuntimeException {
 
-                return false;
-        }//isIdentical()
+        if (buffer.charAt(0) == '-') {
+            // REVISIT: date starts with preceding '-' sign
+            //          do we have to do anything with it?
+            //
+            start++;
+        }
+        int i = indexOf(buffer, start, end, '-');
+        if (i == -1) {
+            throw new RuntimeException("Year separator is missing or misplaced");
+        }
+        int length = i - start;
+        if (length < 4) {
+            throw new RuntimeException("Year must have 'CCYY' format");
+        } else if (length > 4 && buffer.charAt(start) == '0') {
+            throw new RuntimeException("Leading zeros are required if the year value would otherwise have fewer than four digits; otherwise they are forbidden");
+        }
+        date.year = parseIntYear(buffer, i);
+        if (buffer.charAt(i) != '-') {
+            throw new RuntimeException("CCYY must be followed by '-' sign");
+        }
+        start = ++i;
+        i = start + 2;
+        date.month = parseInt(buffer, start, i);
+        return i; //fStart points right after the MONTH
+    }
+
+    /**
+     * Shared code from Date and YearMonth datatypes. Finds if time zone sign is
+     * present
+     *
+     * @param end
+     * @param date
+     * @exception RuntimeException
+     */
+    protected void parseTimeZone(String buffer, int start, int end, DateTimeData date) throws RuntimeException {
+
+        //fStart points right after the date
+
+        if (start < end) {
+            if (!isNextCharUTCSign(buffer, start, end)) {
+                throw new RuntimeException("Error in month parsing");
+            } else {
+                getTimeZone(buffer, date, start, end);
+            }
+        }
+    }
+
+    /**
+     * Parses time zone: 'Z' or {+,-} followed by hh:mm
+     *
+     * @param data
+     * @param sign
+     * @exception RuntimeException
+     */
+    protected void getTimeZone(String buffer, DateTimeData data, int sign, int end) throws RuntimeException {
+        data.utc = buffer.charAt(sign);
 
-        // the parameters are in compiled form (from getActualValue)
-        public int compare (Object value1, Object value2) {
-                return compareDates(((DateTimeData)value1),
-                                ((DateTimeData)value2), true);
-        }//compare()
+        if (buffer.charAt(sign) == 'Z') {
+            if (end > (++sign)) {
+                throw new RuntimeException("Error in parsing time zone");
+            }
+            return;
+        }
+        if (sign <= (end - 6)) {
+
+            int negate = buffer.charAt(sign) == '-' ? -1 : 1;
+            //parse hr
+            int stop = ++sign + 2;
+            data.timezoneHr = negate * parseInt(buffer, sign, stop);
+            if (buffer.charAt(stop++) != ':') {
+                throw new RuntimeException("Error in parsing time zone");
+            }
+
+            //parse min
+            data.timezoneMin = negate * parseInt(buffer, stop, stop + 2);
+
+            if (stop + 2 != end) {
+                throw new RuntimeException("Error in parsing time zone");
+            }
+            if (data.timezoneHr != 0 || data.timezoneMin != 0) {
+                data.normalized = false;
+            }
+        } else {
+            throw new RuntimeException("Error in parsing time zone");
+        }
+        if (DEBUG) {
+            System.out.println("time[hh]=" + data.timezoneHr + " time[mm]=" + data.timezoneMin);
+        }
+    }
+
+    /**
+     * Computes index of given char within StringBuffer
+     *
+     * @param start
+     * @param end
+     * @param ch character to look for in StringBuffer
+     * @return index of ch within StringBuffer
+     */
+    protected int indexOf(String buffer, int start, int end, char ch) {
+        for (int i = start; i < end; i++) {
+            if (buffer.charAt(i) == ch) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Validates given date/time object accoring to W3C PR Schema [D.1 ISO 8601
+     * Conventions]
+     *
+     * @param data
+     */
+    protected void validateDateTime(DateTimeData data) {
+
+        //REVISIT: should we throw an exception for not valid dates
+        //          or reporting an error message should be sufficient?
 
         /**
-         * Compare algorithm described in dateDime (3.2.7).
-         * Duration datatype overwrites this method
-         *
-         * @param date1  normalized date representation of the first value
-         * @param date2  normalized date representation of the second value
-         * @param strict
-         * @return less, greater, less_equal, greater_equal, equal
+         * XML Schema 1.1 - RQ-123: Allow year 0000 in date related types.
          */
-        protected short compareDates(DateTimeData date1, DateTimeData date2, boolean strict) {
-                if (date1.utc == date2.utc) {
-                        return compareOrder(date1, date2);
-                }
-                short c1, c2;
-
-                DateTimeData tempDate = new DateTimeData(null, this);
-
-                if ( date1.utc=='Z' ) {
-
-                        //compare date1<=date1<=(date2 with time zone -14)
-                        //
-                        cloneDate(date2, tempDate); //clones date1 value to global temporary storage: fTempDate
-                        tempDate.timezoneHr=14;
-                        tempDate.timezoneMin = 0;
-                        tempDate.utc='+';
-                        normalize(tempDate);
-                        c1 = compareOrder(date1, tempDate);
-                        if (c1 == LESS_THAN)
-                                return c1;
-
-                        //compare date1>=(date2 with time zone +14)
-                        //
-                        cloneDate(date2, tempDate); //clones date1 value to global temporary storage: tempDate
-                        tempDate.timezoneHr = -14;
-                        tempDate.timezoneMin = 0;
-                        tempDate.utc='-';
-                        normalize(tempDate);
-                        c2 = compareOrder(date1, tempDate);
-                        if (c2 == GREATER_THAN)
-                                return c2;
-
-                        return INDETERMINATE;
-                }
-                else if ( date2.utc=='Z' ) {
-
-                        //compare (date1 with time zone -14)<=date2
-                        //
-                        cloneDate(date1, tempDate); //clones date1 value to global temporary storage: tempDate
-                        tempDate.timezoneHr = -14;
-                        tempDate.timezoneMin = 0;
-                        tempDate.utc='-';
-                        if (DEBUG) {
-                                System.out.println("tempDate=" + dateToString(tempDate));
-                        }
-                        normalize(tempDate);
-                        c1 = compareOrder(tempDate, date2);
-                        if (DEBUG) {
-                                System.out.println("date=" + dateToString(date2));
-                                System.out.println("tempDate=" + dateToString(tempDate));
-                        }
-                        if (c1 == LESS_THAN)
-                                return c1;
-
-                        //compare (date1 with time zone +14)<=date2
-                        //
-                        cloneDate(date1, tempDate); //clones date1 value to global temporary storage: tempDate
-                        tempDate.timezoneHr = 14;
-                        tempDate.timezoneMin = 0;
-                        tempDate.utc='+';
-                        normalize(tempDate);
-                        c2 = compareOrder(tempDate, date2);
-                        if (DEBUG) {
-                                System.out.println("tempDate=" + dateToString(tempDate));
-                        }
-                        if (c2 == GREATER_THAN)
-                                return c2;
-
-                        return INDETERMINATE;
-                }
-                return INDETERMINATE;
+        if (!Constants.SCHEMA_1_1_SUPPORT && data.year == 0) {
+            throw new RuntimeException("The year \"0000\" is an illegal year value");
 
         }
 
-        /**
-         * Given normalized values, determines order-relation
-         * between give date/time objects.
-         *
-         * @param date1  date/time object
-         * @param date2  date/time object
-         * @return 0 if date1 and date2 are equal, a value less than 0 if date1 is less than date2, a value greater than 0 if date1 is greater than date2
-         */
-        protected short compareOrder(DateTimeData date1, DateTimeData date2) {
-                if(date1.position < 1) {
-                        if (date1.year < date2.year)
-                                return -1;
-                        if (date1.year > date2.year)
-                                return 1;
-                }
-                if(date1.position < 2) {
-                        if (date1.month < date2.month)
-                                return -1;
-                        if (date1.month > date2.month)
-                                return 1;
-                }
-                if (date1.day < date2.day)
-                        return -1;
-                if (date1.day > date2.day)
-                        return 1;
-                if (date1.hour < date2.hour)
-                        return -1;
-                if (date1.hour > date2.hour)
-                        return 1;
-                if (date1.minute < date2.minute)
-                        return -1;
-                if (date1.minute > date2.minute)
-                        return 1;
-                if (date1.second < date2.second)
-                        return -1;
-                if (date1.second > date2.second)
-                        return 1;
-                if (date1.utc < date2.utc)
-                        return -1;
-                if (date1.utc > date2.utc)
-                        return 1;
-                return 0;
-        }
-
-        /**
-         * Parses time hh:mm:ss.sss and time zone if any
-         *
-         * @param start
-         * @param end
-         * @param data
-         * @exception RuntimeException
-         */
-        protected  void getTime (String buffer, int start, int end, DateTimeData data) throws RuntimeException{
-
-                int stop = start+2;
-
-                //get hours (hh)
-                data.hour=parseInt(buffer, start,stop);
-
-                //get minutes (mm)
-
-                if (buffer.charAt(stop++)!=':') {
-                        throw new RuntimeException("Error in parsing time zone" );
-                }
-                start = stop;
-                stop = stop+2;
-                data.minute=parseInt(buffer, start,stop);
-
-                //get seconds (ss)
-                if (buffer.charAt(stop++)!=':') {
-                        throw new RuntimeException("Error in parsing time zone" );
-                }
-
-                //find UTC sign if any
-                int sign = findUTCSign(buffer, start, end);
-
-                //get seconds (ms)
-                start = stop;
-                stop = sign < 0 ? end : sign;
-                data.second = parseSecond(buffer, start, stop);
-
-                //parse UTC time zone (hh:mm)
-                if (sign > 0) {
-                        getTimeZone(buffer, data, sign, end);
-                }
-        }
-
-        /**
-         * Parses date CCYY-MM-DD
-         *
-         * @param buffer
-         * @param start start position
-         * @param end end position
-         * @param date
-         * @exception RuntimeException
-         */
-        protected int getDate (String buffer, int start, int end, DateTimeData date) throws RuntimeException{
-
-                start = getYearMonth(buffer, start, end, date);
-
-                if (buffer.charAt(start++) !='-') {
-                        throw new RuntimeException("CCYY-MM must be followed by '-' sign");
-                }
-                int stop = start + 2;
-                date.day=parseInt(buffer, start, stop);
-                return stop;
-        }
-
-        /**
-         * Parses date CCYY-MM
-         *
-         * @param buffer
-         * @param start start position
-         * @param end end position
-         * @param date
-         * @exception RuntimeException
-         */
-        protected int getYearMonth (String buffer, int start, int end, DateTimeData date) throws RuntimeException{
-
-                if ( buffer.charAt(0)=='-' ) {
-                        // REVISIT: date starts with preceding '-' sign
-                        //          do we have to do anything with it?
-                        //
-                        start++;
-                }
-                int i = indexOf(buffer, start, end, '-');
-                if ( i==-1 ) throw new RuntimeException("Year separator is missing or misplaced");
-                int length = i-start;
-                if (length<4) {
-                        throw new RuntimeException("Year must have 'CCYY' format");
-                }
-                else if (length > 4 && buffer.charAt(start)=='0'){
-                        throw new RuntimeException("Leading zeros are required if the year value would otherwise have fewer than four digits; otherwise they are forbidden");
-                }
-                date.year= parseIntYear(buffer, i);
-                if (buffer.charAt(i)!='-') {
-                        throw new RuntimeException("CCYY must be followed by '-' sign");
-                }
-                start = ++i;
-                i = start +2;
-                date.month=parseInt(buffer, start, i);
-                return i; //fStart points right after the MONTH
-        }
-
-        /**
-         * Shared code from Date and YearMonth datatypes.
-         * Finds if time zone sign is present
-         *
-         * @param end
-         * @param date
-         * @exception RuntimeException
-         */
-        protected void parseTimeZone (String buffer, int start, int end, DateTimeData date) throws RuntimeException{
-
-                //fStart points right after the date
-
-                if ( start < end ) {
-                        if (!isNextCharUTCSign(buffer, start, end)) {
-                                throw new RuntimeException ("Error in month parsing");
-                        }
-                        else {
-                                getTimeZone(buffer, date, start, end);
-                        }
-                }
-        }
-
-        /**
-         * Parses time zone: 'Z' or {+,-} followed by  hh:mm
-         *
-         * @param data
-         * @param sign
-         * @exception RuntimeException
-         */
-        protected void getTimeZone (String buffer, DateTimeData data, int sign, int end) throws RuntimeException{
-                data.utc=buffer.charAt(sign);
-
-                if ( buffer.charAt(sign) == 'Z' ) {
-                        if (end>(++sign)) {
-                                throw new RuntimeException("Error in parsing time zone");
-                        }
-                        return;
-                }
-                if ( sign<=(end-6) ) {
-
-                        int negate = buffer.charAt(sign) == '-'?-1:1;
-                        //parse hr
-                        int stop = ++sign+2;
-                        data.timezoneHr = negate*parseInt(buffer, sign, stop);
-                        if (buffer.charAt(stop++)!=':') {
-                                throw new RuntimeException("Error in parsing time zone" );
-                        }
-
-                        //parse min
-                        data.timezoneMin = negate*parseInt(buffer, stop, stop+2);
-
-                        if ( stop+2!=end ) {
-                                throw new RuntimeException("Error in parsing time zone");
-                        }
-            if(data.timezoneHr != 0 || data.timezoneMin != 0)
-                data.normalized = false;
-                }
-                else {
-                        throw new RuntimeException("Error in parsing time zone");
-                }
-                if ( DEBUG ) {
-                        System.out.println("time[hh]="+data.timezoneHr + " time[mm]=" +data.timezoneMin);
-                }
-        }
-
-        /**
-         * Computes index of given char within StringBuffer
-         *
-         * @param start
-         * @param end
-         * @param ch     character to look for in StringBuffer
-         * @return index of ch within StringBuffer
-         */
-        protected  int indexOf (String buffer, int start, int end, char ch) {
-                for ( int i=start;i<end;i++ ) {
-                        if ( buffer.charAt(i) == ch ) {
-                                return i;
-                        }
-                }
-                return -1;
-        }
-
-        /**
-         * Validates given date/time object accoring to W3C PR Schema
-         * [D.1 ISO 8601 Conventions]
-         *
-         * @param data
-         */
-        protected void validateDateTime (DateTimeData data) {
-
-                //REVISIT: should we throw an exception for not valid dates
-                //          or reporting an error message should be sufficient?
-
-                /**
-                 * XML Schema 1.1 - RQ-123: Allow year 0000 in date related types.
-                 */
-                if (!Constants.SCHEMA_1_1_SUPPORT && data.year==0 ) {
-                        throw new RuntimeException("The year \"0000\" is an illegal year value");
-
-                }
-
-                if ( data.month<1 || data.month>12 ) {
-                        throw new RuntimeException("The month must have values 1 to 12");
-
-                }
-
-                //validate days
-                if ( data.day>maxDayInMonthFor(data.year, data.month) || data.day<1 ) {
-                        throw new RuntimeException("The day must have values 1 to 31");
-                }
-
-                //validate hours
-                if ( data.hour>23 || data.hour<0 ) {
-                        if (data.hour == 24 && data.minute == 0 && data.second == 0) {
-                                data.hour = 0;
-                                if (++data.day > maxDayInMonthFor(data.year, data.month)) {
-                                        data.day = 1;
-                                        if (++data.month > 12) {
-                                                data.month = 1;
-                                                if (Constants.SCHEMA_1_1_SUPPORT) {
-                                                        ++data.year;
-                                                }
-                                                else if (++data.year == 0) {
-                                                        data.year = 1;
-                                                }
-                                        }
-                                }
-                        }
-                        else {
-                                throw new RuntimeException("Hour must have values 0-23, unless 24:00:00");
-                        }
-                }
-
-                //validate
-                if ( data.minute>59 || data.minute<0 ) {
-                        throw new RuntimeException("Minute must have values 0-59");
-                }
-
-                //validate
-                if ( data.second>=60 || data.second<0 ) {
-                        throw new RuntimeException("Second must have values 0-59");
-
-                }
-
-                //validate
-                if ( data.timezoneHr>14 || data.timezoneHr<-14 ) {
-                        throw new RuntimeException("Time zone should have range -14:00 to +14:00");
-                }
-                else {
-                        if((data.timezoneHr == 14 || data.timezoneHr == -14) && data.timezoneMin != 0)
-                                throw new RuntimeException("Time zone should have range -14:00 to +14:00");
-                        else if(data.timezoneMin > 59 || data.timezoneMin < -59)
-                                throw new RuntimeException("Minute must have values 0-59");
-                }
+        if (data.month < 1 || data.month > 12) {
+            throw new RuntimeException("The month must have values 1 to 12");
 
         }
 
-        /**
-         * Return index of UTC char: 'Z', '+', '-'
-         *
-         * @param start
-         * @param end
-         * @return index of the UTC character that was found
-         */
-        protected int findUTCSign (String buffer, int start, int end) {
-                int c;
-                for ( int i=start;i<end;i++ ) {
-                        c=buffer.charAt(i);
-                        if ( c == 'Z' || c=='+' || c=='-' ) {
-                                return i;
+        //validate days
+        if (data.day > maxDayInMonthFor(data.year, data.month) || data.day < 1) {
+            throw new RuntimeException("The day must have values 1 to 31");
+        }
+
+        //validate hours
+        if (data.hour > 23 || data.hour < 0) {
+            if (data.hour == 24 && data.minute == 0 && data.second == 0) {
+                data.hour = 0;
+                if (++data.day > maxDayInMonthFor(data.year, data.month)) {
+                    data.day = 1;
+                    if (++data.month > 12) {
+                        data.month = 1;
+                        if (Constants.SCHEMA_1_1_SUPPORT) {
+                            ++data.year;
+                        } else if (++data.year == 0) {
+                            data.year = 1;
                         }
-
+                    }
                 }
-                return -1;
+            } else {
+                throw new RuntimeException("Hour must have values 0-23, unless 24:00:00");
+            }
+        }
+
+        //validate
+        if (data.minute > 59 || data.minute < 0) {
+            throw new RuntimeException("Minute must have values 0-59");
+        }
+
+        //validate
+        if (data.second >= 60 || data.second < 0) {
+            throw new RuntimeException("Second must have values 0-59");
+
         }
 
+        //validate
+        if (data.timezoneHr > 14 || data.timezoneHr < -14) {
+            throw new RuntimeException("Time zone should have range -14:00 to +14:00");
+        } else {
+            if ((data.timezoneHr == 14 || data.timezoneHr == -14) && data.timezoneMin != 0) {
+                throw new RuntimeException("Time zone should have range -14:00 to +14:00");
+            } else if (data.timezoneMin > 59 || data.timezoneMin < -59) {
+                throw new RuntimeException("Minute must have values 0-59");
+            }
+        }
+
+    }
+
     /**
-     * Returns <code>true</code> if the character at start is 'Z', '+' or '-'.
+     * Return index of UTC char: 'Z', '+', '-'
+     *
+     * @param start
+     * @param end
+     * @return index of the UTC character that was found
+     */
+    protected int findUTCSign(String buffer, int start, int end) {
+        int c;
+        for (int i = start; i < end; i++) {
+            c = buffer.charAt(i);
+            if (c == 'Z' || c == '+' || c == '-') {
+                return i;
+            }
+
+        }
+        return -1;
+    }
+
+    /**
+     * Returns
+     * <code>true</code> if the character at start is 'Z', '+' or '-'.
      */
     protected final boolean isNextCharUTCSign(String buffer, int start, int end) {
         if (start < end) {
@@ -510,135 +525,145 @@
         return false;
     }
 
-        /**
-         * Given start and end position, parses string value
-         *
-         * @param buffer string to parse
-         * @param start  start position
-         * @param end    end position
-         * @return  return integer representation of characters
-         */
-        protected  int parseInt (String buffer, int start, int end)
-        throws NumberFormatException{
-                //REVISIT: more testing on this parsing needs to be done.
-                int radix=10;
-                int result = 0;
-                int digit=0;
-                int limit = -Integer.MAX_VALUE;
-                int multmin = limit / radix;
-                int i = start;
-                do {
-                        digit = getDigit(buffer.charAt(i));
-                        if ( digit < 0 ) throw new NumberFormatException("'" + buffer + "' has wrong format");
-                        if ( result < multmin ) throw new NumberFormatException("'" + buffer + "' has wrong format");
-                        result *= radix;
-                        if ( result < limit + digit ) throw new NumberFormatException("'" + buffer + "' has wrong format");
-                        result -= digit;
+    /**
+     * Given start and end position, parses string value
+     *
+     * @param buffer string to parse
+     * @param start start position
+     * @param end end position
+     * @return return integer representation of characters
+     */
+    protected int parseInt(String buffer, int start, int end)
+            throws NumberFormatException {
+        //REVISIT: more testing on this parsing needs to be done.
+        int radix = 10;
+        int result = 0;
+        int digit = 0;
+        int limit = -Integer.MAX_VALUE;
+        int multmin = limit / radix;
+        int i = start;
+        do {
+            digit = getDigit(buffer.charAt(i));
+            if (digit < 0) {
+                throw new NumberFormatException("'" + buffer + "' has wrong format");
+            }
+            if (result < multmin) {
+                throw new NumberFormatException("'" + buffer + "' has wrong format");
+            }
+            result *= radix;
+            if (result < limit + digit) {
+                throw new NumberFormatException("'" + buffer + "' has wrong format");
+            }
+            result -= digit;
 
-                }while ( ++i < end );
-                return -result;
+        } while (++i < end);
+        return -result;
+    }
+
+    // parse Year differently to support negative value.
+    protected int parseIntYear(String buffer, int end) {
+        int radix = 10;
+        int result = 0;
+        boolean negative = false;
+        int i = 0;
+        int limit;
+        int multmin;
+        int digit = 0;
+
+        if (buffer.charAt(0) == '-') {
+            negative = true;
+            limit = Integer.MIN_VALUE;
+            i++;
+
+        } else {
+            limit = -Integer.MAX_VALUE;
+        }
+        multmin = limit / radix;
+        while (i < end) {
+            digit = getDigit(buffer.charAt(i++));
+            if (digit < 0) {
+                throw new NumberFormatException("'" + buffer + "' has wrong format");
+            }
+            if (result < multmin) {
+                throw new NumberFormatException("'" + buffer + "' has wrong format");
+            }
+            result *= radix;
+            if (result < limit + digit) {
+                throw new NumberFormatException("'" + buffer + "' has wrong format");
+            }
+            result -= digit;
         }
 
-        // parse Year differently to support negative value.
-        protected int parseIntYear (String buffer, int end){
-                int radix=10;
-                int result = 0;
-                boolean negative = false;
-                int i=0;
-                int limit;
-                int multmin;
-                int digit=0;
+        if (negative) {
+            if (i > 1) {
+                return result;
+            } else {
+                throw new NumberFormatException("'" + buffer + "' has wrong format");
+            }
+        }
+        return -result;
 
-                if (buffer.charAt(0) == '-'){
-                        negative = true;
-                        limit = Integer.MIN_VALUE;
-                        i++;
+    }
+
+    /**
+     * If timezone present - normalize dateTime [E Adding durations to
+     * dateTimes]
+     *
+     * @param date CCYY-MM-DDThh:mm:ss+03
+     */
+    protected void normalize(DateTimeData date) {
 
-                }
-                else{
-                        limit = -Integer.MAX_VALUE;
-                }
-                multmin = limit / radix;
-                while (i < end)
-                {
-                        digit = getDigit(buffer.charAt(i++));
-                        if (digit < 0) throw new NumberFormatException("'" + buffer + "' has wrong format");
-                        if (result < multmin) throw new NumberFormatException("'" + buffer + "' has wrong format");
-                        result *= radix;
-                        if (result < limit + digit) throw new NumberFormatException("'" + buffer + "' has wrong format");
-                        result -= digit;
-                }
+        // REVISIT: we have common code in addDuration() for durations
+        //          should consider reorganizing it.
+        //
+
+        //add minutes (from time zone)
+        int negate = -1;
 
-                if (negative)
-                {
-                        if (i > 1) return result;
-                        else throw new NumberFormatException("'" + buffer + "' has wrong format");
-                }
-                return -result;
+        if (DEBUG) {
+            System.out.println("==>date.minute" + date.minute);
+            System.out.println("==>date.timezoneMin" + date.timezoneMin);
+        }
+        int temp = date.minute + negate * date.timezoneMin;
+        int carry = fQuotient(temp, 60);
+        date.minute = mod(temp, 60, carry);
 
+        if (DEBUG) {
+            System.out.println("==>carry: " + carry);
+        }
+        //add hours
+        temp = date.hour + negate * date.timezoneHr + carry;
+        carry = fQuotient(temp, 24);
+        date.hour = mod(temp, 24, carry);
+        if (DEBUG) {
+            System.out.println("==>date.hour" + date.hour);
+            System.out.println("==>carry: " + carry);
         }
 
-        /**
-         * If timezone present - normalize dateTime  [E Adding durations to dateTimes]
-         *
-         * @param date   CCYY-MM-DDThh:mm:ss+03
-         */
-        protected void normalize(DateTimeData date) {
-
-                // REVISIT: we have common code in addDuration() for durations
-                //          should consider reorganizing it.
-                //
-
-                //add minutes (from time zone)
-                int negate = -1;
-
-                if ( DEBUG ) {
-                        System.out.println("==>date.minute"+date.minute);
-                        System.out.println("==>date.timezoneMin" +date.timezoneMin);
-                }
-                int temp = date.minute + negate * date.timezoneMin;
-                int carry = fQuotient (temp, 60);
-                date.minute= mod(temp, 60, carry);
+        date.day = date.day + carry;
 
-                if ( DEBUG ) {
-                        System.out.println("==>carry: " + carry);
-                }
-                //add hours
-                temp = date.hour + negate * date.timezoneHr + carry;
-                carry = fQuotient(temp, 24);
-                date.hour=mod(temp, 24, carry);
-                if ( DEBUG ) {
-                        System.out.println("==>date.hour"+date.hour);
-                        System.out.println("==>carry: " + carry);
-                }
-
-                date.day=date.day+carry;
+        while (true) {
+            temp = maxDayInMonthFor(date.year, date.month);
+            if (date.day < 1) {
+                date.day = date.day + maxDayInMonthFor(date.year, date.month - 1);
+                carry = -1;
+            } else if (date.day > temp) {
+                date.day = date.day - temp;
+                carry = 1;
+            } else {
+                break;
+            }
+            temp = date.month + carry;
+            date.month = modulo(temp, 1, 13);
+            date.year = date.year + fQuotient(temp, 1, 13);
+            if (date.year == 0 && !Constants.SCHEMA_1_1_SUPPORT) {
+                date.year = (date.timezoneHr < 0 || date.timezoneMin < 0) ? 1 : -1;
+            }
+        }
+        date.utc = 'Z';
+    }
 
-                while ( true ) {
-                        temp=maxDayInMonthFor(date.year, date.month);
-                        if (date.day<1) {
-                                date.day = date.day + maxDayInMonthFor(date.year, date.month-1);
-                                carry=-1;
-                        }
-                        else if ( date.day>temp ) {
-                                date.day=date.day-temp;
-                                carry=1;
-                        }
-                        else {
-                                break;
-                        }
-                        temp=date.month+carry;
-                        date.month=modulo(temp, 1, 13);
-                        date.year=date.year+fQuotient(temp, 1, 13);
-            if(date.year == 0 && !Constants.SCHEMA_1_1_SUPPORT) {
-                date.year = (date.timezoneHr < 0 || date.timezoneMin < 0)?1:-1;
-            }
-                }
-                date.utc='Z';
-        }
-
-
-        /**
+    /**
      * @param date
      */
     protected void saveUnnormalized(DateTimeData date) {
@@ -651,154 +676,149 @@
     }
 
     /**
-         * Resets object representation of date/time
-         *
-         * @param data   date/time object
-         */
-        protected void resetDateObj(DateTimeData data) {
-                data.year = 0;
-                data.month = 0;
-                data.day = 0;
-                data.hour = 0;
-                data.minute = 0;
-                data.second = 0;
-                data.utc = 0;
-                data.timezoneHr = 0;
-                data.timezoneMin = 0;
-        }
+     * Resets object representation of date/time
+     *
+     * @param data date/time object
+     */
+    protected void resetDateObj(DateTimeData data) {
+        data.year = 0;
+        data.month = 0;
+        data.day = 0;
+        data.hour = 0;
+        data.minute = 0;
+        data.second = 0;
+        data.utc = 0;
+        data.timezoneHr = 0;
+        data.timezoneMin = 0;
+    }
 
-        /**
-         * Given {year,month} computes maximum
-         * number of days for given month
-         *
-         * @param year
-         * @param month
-         * @return integer containg the number of days in a given month
-         */
-        protected int maxDayInMonthFor(int year, int month) {
-                //validate days
-                if ( month==4 || month==6 || month==9 || month==11 ) {
-                        return 30;
-                }
-                else if ( month==2 ) {
-                        if ( isLeapYear(year) ) {
-                                return 29;
-                        }
-                        else {
-                                return 28;
-                        }
-                }
-                else {
-                        return 31;
-                }
+    /**
+     * Given {year,month} computes maximum number of days for given month
+     *
+     * @param year
+     * @param month
+     * @return integer containg the number of days in a given month
+     */
+    protected int maxDayInMonthFor(int year, int month) {
+        //validate days
+        if (month == 4 || month == 6 || month == 9 || month == 11) {
+            return 30;
+        } else if (month == 2) {
+            if (isLeapYear(year)) {
+                return 29;
+            } else {
+                return 28;
+            }
+        } else {
+            return 31;
         }
+    }
 
-        private boolean isLeapYear(int year) {
+    private boolean isLeapYear(int year) {
 
-                //REVISIT: should we take care about Julian calendar?
-                return((year%4 == 0) && ((year%100 != 0) || (year%400 == 0)));
-        }
+        //REVISIT: should we take care about Julian calendar?
+        return ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)));
+    }
 
-        //
-        // help function described in W3C PR Schema [E Adding durations to dateTimes]
-        //
-        protected int mod (int a, int b, int quotient) {
-                //modulo(a, b) = a - fQuotient(a,b)*b
-                return (a - quotient*b) ;
-        }
+    //
+    // help function described in W3C PR Schema [E Adding durations to dateTimes]
+    //
+    protected int mod(int a, int b, int quotient) {
+        //modulo(a, b) = a - fQuotient(a,b)*b
+        return (a - quotient * b);
+    }
 
-        //
-        // help function described in W3C PR Schema [E Adding durations to dateTimes]
-        //
-        protected int fQuotient (int a, int b) {
+    //
+    // help function described in W3C PR Schema [E Adding durations to dateTimes]
+    //
+    protected int fQuotient(int a, int b) {
 
-                //fQuotient(a, b) = the greatest integer less than or equal to a/b
-                return (int)Math.floor((float)a/b);
-        }
+        //fQuotient(a, b) = the greatest integer less than or equal to a/b
+        return (int) Math.floor((float) a / b);
+    }
 
-        //
-        // help function described in W3C PR Schema [E Adding durations to dateTimes]
-        //
-        protected int modulo (int temp, int low, int high) {
-                //modulo(a - low, high - low) + low
-                int a = temp - low;
-                int b = high - low;
-                return (mod (a, b, fQuotient(a, b)) + low) ;
-        }
+    //
+    // help function described in W3C PR Schema [E Adding durations to dateTimes]
+    //
+    protected int modulo(int temp, int low, int high) {
+        //modulo(a - low, high - low) + low
+        int a = temp - low;
+        int b = high - low;
+        return (mod(a, b, fQuotient(a, b)) + low);
+    }
 
-        //
-        // help function described in W3C PR Schema [E Adding durations to dateTimes]
-        //
-        protected int fQuotient (int temp, int low, int high) {
-                //fQuotient(a - low, high - low)
+    //
+    // help function described in W3C PR Schema [E Adding durations to dateTimes]
+    //
+    protected int fQuotient(int temp, int low, int high) {
+        //fQuotient(a - low, high - low)
 
-                return fQuotient(temp - low, high - low);
-        }
-
+        return fQuotient(temp - low, high - low);
+    }
 
-        protected String dateToString(DateTimeData date) {
-                StringBuffer message = new StringBuffer(25);
-                append(message, date.year, 4);
-                message.append('-');
-                append(message, date.month, 2);
-                message.append('-');
-                append(message, date.day, 2);
-                message.append('T');
-                append(message, date.hour, 2);
-                message.append(':');
-                append(message, date.minute, 2);
-                message.append(':');
-                append(message, date.second);
-                append(message, (char)date.utc, 0);
-                return message.toString();
-        }
+    protected String dateToString(DateTimeData date) {
+        StringBuffer message = new StringBuffer(25);
+        append(message, date.year, 4);
+        message.append('-');
+        append(message, date.month, 2);
+        message.append('-');
+        append(message, date.day, 2);
+        message.append('T');
+        append(message, date.hour, 2);
+        message.append(':');
+        append(message, date.minute, 2);
+        message.append(':');
+        append(message, date.second);
+        append(message, (char) date.utc, 0);
+        return message.toString();
+    }
 
-        protected final void append(StringBuffer message, int value, int nch) {
+    protected final void append(StringBuffer message, int value, int nch) {
         if (value == Integer.MIN_VALUE) {
             message.append(value);
             return;
         }
-                if (value < 0) {
-                        message.append('-');
-                        value = -value;
-                }
-                if (nch == 4) {
-                        if (value < 10)
-                                message.append("000");
-                        else if (value < 100)
-                                message.append("00");
-                        else if (value < 1000)
-                                message.append('0');
-                        message.append(value);
-                }
-                else if (nch == 2) {
-                        if (value < 10)
-                                message.append('0');
-                        message.append(value);
-                }
-                else {
-                        if (value != 0)
-                                message.append((char)value);
-                }
+        if (value < 0) {
+            message.append('-');
+            value = -value;
         }
-
-        protected final void append(StringBuffer message, double value) {
-            if (value < 0) {
-                message.append('-');
-                value = -value;
+        if (nch == 4) {
+            if (value < 10) {
+                message.append("000");
+            } else if (value < 100) {
+                message.append("00");
+            } else if (value < 1000) {
+                message.append('0');
             }
+            message.append(value);
+        } else if (nch == 2) {
             if (value < 10) {
                 message.append('0');
             }
-            append2(message, value);
+            message.append(value);
+        } else {
+            if (value != 0) {
+                message.append((char) value);
+            }
         }
+    }
+
+    protected final void append(StringBuffer message, double value) {
+        if (value < 0) {
+            message.append('-');
+            value = -value;
+        }
+        if (value < 10) {
+            message.append('0');
+        }
+        append2(message, value);
+    }
 
     protected final void append2(StringBuffer message, double value) {
         final int intValue = (int) value;
         if (value == intValue) {
             message.append(intValue);
-        }
-        else {
+        } else {
             append3(message, value);
         }
     }
@@ -815,9 +835,8 @@
             // Need to convert from scientific notation of the form
             // n.nnn...E-N (N >= 4) to a normal decimal value.
             try {
-                exp = parseInt(d, eIndex+2, d.length());
-            }
-            // This should never happen.
+                exp = parseInt(d, eIndex + 2, d.length());
+            } // This should never happen.
             // It's only possible if String.valueOf(double) is broken.
             catch (Exception e) {
                 message.append(d);
@@ -843,14 +862,12 @@
                     message.append(c);
                 }
             }
-        }
-        else {
+        } else {
             // Need to convert from scientific notation of the form
             // n.nnn...EN (N >= 7) to a normal decimal value.
             try {
-                exp = parseInt(d, eIndex+1, d.length());
-            }
-            // This should never happen.
+                exp = parseInt(d, eIndex + 1, d.length());
+            } // This should never happen.
             // It's only possible if String.valueOf(double) is broken.
             catch (Exception e) {
                 message.append(d);
@@ -873,174 +890,220 @@
         }
     }
 
-        protected double parseSecond(String buffer, int start, int end)
-        throws NumberFormatException {
-                int dot = -1;
-                for (int i = start; i < end; i++) {
-                        char ch = buffer.charAt(i);
-                        if (ch == '.')
-                                dot = i;
-                        else if (ch > '9' || ch < '0')
-                                throw new NumberFormatException("'" + buffer + "' has wrong format");
-                }
-                if (dot == -1) {
-                        if (start+2 != end)
-                                throw new NumberFormatException("'" + buffer + "' has wrong format");
-                }
-                else if (start+2 != dot || dot+1 == end) {
-                        throw new NumberFormatException("'" + buffer + "' has wrong format");
-                }
-                return Double.parseDouble(buffer.substring(start, end));
+    protected double parseSecond(String buffer, int start, int end)
+            throws NumberFormatException {
+        int dot = -1;
+        for (int i = start; i < end; i++) {
+            char ch = buffer.charAt(i);
+            if (ch == '.') {
+                dot = i;
+            } else if (ch > '9' || ch < '0') {
+                throw new NumberFormatException("'" + buffer + "' has wrong format");
+            }
         }
+        if (dot == -1) {
+            if (start + 2 != end) {
+                throw new NumberFormatException("'" + buffer + "' has wrong format");
+            }
+        } else if (start + 2 != dot || dot + 1 == end) {
+            throw new NumberFormatException("'" + buffer + "' has wrong format");
+        }
+        return Double.parseDouble(buffer.substring(start, end));
+    }
 
-        //
-        //Private help functions
-        //
+    //
+    //Private help functions
+    //
+    private void cloneDate(DateTimeData finalValue, DateTimeData tempDate) {
+        tempDate.year = finalValue.year;
+        tempDate.month = finalValue.month;
+        tempDate.day = finalValue.day;
+        tempDate.hour = finalValue.hour;
+        tempDate.minute = finalValue.minute;
+        tempDate.second = finalValue.second;
+        tempDate.utc = finalValue.utc;
+        tempDate.timezoneHr = finalValue.timezoneHr;
+        tempDate.timezoneMin = finalValue.timezoneMin;
+    }
 
-        private void cloneDate (DateTimeData finalValue, DateTimeData tempDate) {
-                tempDate.year = finalValue.year;
-                tempDate.month = finalValue.month;
-                tempDate.day = finalValue.day;
-                tempDate.hour = finalValue.hour;
-                tempDate.minute = finalValue.minute;
-                tempDate.second = finalValue.second;
-                tempDate.utc = finalValue.utc;
-                tempDate.timezoneHr = finalValue.timezoneHr;
-                tempDate.timezoneMin = finalValue.timezoneMin;
-        }
+    /**
+     * Represents date time data
+     */
+    static final class DateTimeData implements XSDateTime {
 
-        /**
-         * Represents date time data
-         */
-        static final class DateTimeData implements XSDateTime {
-                int year, month, day, hour, minute, utc;
-                double second;
-                int timezoneHr, timezoneMin;
+        int year, month, day, hour, minute, utc;
+        double second;
+        int timezoneHr, timezoneMin;
         private String originalValue;
         boolean normalized = true;
-
         int unNormYear;
         int unNormMonth;
         int unNormDay;
         int unNormHour;
         int unNormMinute;
         double unNormSecond;
+        // used for comparisons - to decide the 'interesting' portions of
+        // a date/time based data type.
+        int position;
+        // a pointer to the type that was used go generate this data
+        // note that this is not the actual simple type, but one of the
+        // statically created XXXDV objects, so this won't cause any GC problem.
+        final AbstractDateTimeDV type;
+        private volatile String canonical;
 
-                // used for comparisons - to decide the 'interesting' portions of
-                // a date/time based data type.
-                int position;
-                // a pointer to the type that was used go generate this data
-                // note that this is not the actual simple type, but one of the
-                // statically created XXXDV objects, so this won't cause any GC problem.
-                final AbstractDateTimeDV type;
-                private String canonical;
-                public DateTimeData(String originalValue, AbstractDateTimeDV type) {
+        public DateTimeData(String originalValue, AbstractDateTimeDV type) {
             this.originalValue = originalValue;
-                        this.type = type;
-                }
-                public DateTimeData(int year, int month, int day, int hour, int minute,
-                                double second, int utc, String originalValue, boolean normalized, AbstractDateTimeDV type) {
-                        this.year = year;
-                        this.month = month;
-                        this.day = day;
-                        this.hour = hour;
-                        this.minute = minute;
-                        this.second = second;
-                        this.utc = utc;
-                        this.type = type;
+            this.type = type;
+        }
+
+        public DateTimeData(int year, int month, int day, int hour, int minute,
+                double second, int utc, String originalValue, boolean normalized, AbstractDateTimeDV type) {
+            this.year = year;
+            this.month = month;
+            this.day = day;
+            this.hour = hour;
+            this.minute = minute;
+            this.second = second;
+            this.utc = utc;
+            this.type = type;
             this.originalValue = originalValue;
-                }
-                public boolean equals(Object obj) {
-                        if (!(obj instanceof DateTimeData))
-                                return false;
-                        return type.compareDates(this, (DateTimeData)obj, true)==0;
-                }
-                public synchronized String toString() {
-                        if (canonical == null) {
-                                canonical = type.dateToString(this);
-                        }
-                        return canonical;
-                }
-                /* (non-Javadoc)
-                 * @see org.apache.xerces.xs.datatypes.XSDateTime#getYear()
-                 */
-                public int getYears() {
-            if(type instanceof DurationDV)
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (!(obj instanceof DateTimeData)) {
+                return false;
+            }
+            return type.compareDates(this, (DateTimeData) obj, true) == 0;
+        }
+
+        // If two DateTimeData are equals - then they should have the same
+        // hashcode. This means we need to convert the date to UTC before
+        // we return its hashcode.
+        // The DateTimeData is unfortunately mutable - so we cannot
+        // cache the result of the conversion...
+        //
+        @Override
+        public int hashCode() {
+            final DateTimeData tempDate = new DateTimeData(null, type);
+            type.cloneDate(this, tempDate);
+            type.normalize(tempDate);
+            return type.dateToString(tempDate).hashCode();
+        }
+
+        @Override
+        public String toString() {
+            if (canonical == null) {
+                canonical = type.dateToString(this);
+            }
+            return canonical;
+        }
+        /* (non-Javadoc)
+         * @see org.apache.xerces.xs.datatypes.XSDateTime#getYear()
+         */
+
+        @Override
+        public int getYears() {
+            if (type instanceof DurationDV) {
                 return 0;
-                        return normalized?year:unNormYear;
-                }
-                /* (non-Javadoc)
-                 * @see org.apache.xerces.xs.datatypes.XSDateTime#getMonth()
-                 */
-                public int getMonths() {
-            if(type instanceof DurationDV) {
-                return year*12 + month;
             }
-                        return normalized?month:unNormMonth;
-                }
-                /* (non-Javadoc)
-                 * @see org.apache.xerces.xs.datatypes.XSDateTime#getDay()
-                 */
-                public int getDays() {
-            if(type instanceof DurationDV)
+            return normalized ? year : unNormYear;
+        }
+        /* (non-Javadoc)
+         * @see org.apache.xerces.xs.datatypes.XSDateTime#getMonth()
+         */
+
+        @Override
+        public int getMonths() {
+            if (type instanceof DurationDV) {
+                return year * 12 + month;
+            }
+            return normalized ? month : unNormMonth;
+        }
+        /* (non-Javadoc)
+         * @see org.apache.xerces.xs.datatypes.XSDateTime#getDay()
+         */
+
+        @Override
+        public int getDays() {
+            if (type instanceof DurationDV) {
                 return 0;
-                        return normalized?day:unNormDay;
-                }
-                /* (non-Javadoc)
-                 * @see org.apache.xerces.xs.datatypes.XSDateTime#getHour()
-                 */
-                public int getHours() {
-            if(type instanceof DurationDV)
-                return 0;
-                        return normalized?hour:unNormHour;
-                }
-                /* (non-Javadoc)
-                 * @see org.apache.xerces.xs.datatypes.XSDateTime#getMinutes()
-                 */
-                public int getMinutes() {
-            if(type instanceof DurationDV)
+            }
+            return normalized ? day : unNormDay;
+        }
+        /* (non-Javadoc)
+         * @see org.apache.xerces.xs.datatypes.XSDateTime#getHour()
+         */
+
+        @Override
+        public int getHours() {
+            if (type instanceof DurationDV) {
                 return 0;
-                        return normalized?minute:unNormMinute;
-                }
-                /* (non-Javadoc)
-                 * @see org.apache.xerces.xs.datatypes.XSDateTime#getSeconds()
-                 */
-                public double getSeconds() {
-            if(type instanceof DurationDV) {
-                return day*24*60*60 + hour*60*60 + minute*60 + second;
+            }
+            return normalized ? hour : unNormHour;
+        }
+        /* (non-Javadoc)
+         * @see org.apache.xerces.xs.datatypes.XSDateTime#getMinutes()
+         */
+
+        @Override
+        public int getMinutes() {
+            if (type instanceof DurationDV) {
+                return 0;
+            }
+            return normalized ? minute : unNormMinute;
+        }
+        /* (non-Javadoc)
+         * @see org.apache.xerces.xs.datatypes.XSDateTime#getSeconds()
+         */
+
+        @Override
+        public double getSeconds() {
+            if (type instanceof DurationDV) {
+                return day * 24 * 60 * 60 + hour * 60 * 60 + minute * 60 + second;
             }
-                        return normalized?second:unNormSecond;
-                }
-                /* (non-Javadoc)
-                 * @see org.apache.xerces.xs.datatypes.XSDateTime#hasTimeZone()
-                 */
-                public boolean hasTimeZone() {
-                        return utc != 0;
-                }
-                /* (non-Javadoc)
-                 * @see org.apache.xerces.xs.datatypes.XSDateTime#getTimeZoneHours()
-                 */
-                public int getTimeZoneHours() {
-                        return timezoneHr;
-                }
-                /* (non-Javadoc)
-                 * @see org.apache.xerces.xs.datatypes.XSDateTime#getTimeZoneMinutes()
-                 */
-                public int getTimeZoneMinutes() {
-                        return timezoneMin;
-                }
+            return normalized ? second : unNormSecond;
+        }
+        /* (non-Javadoc)
+         * @see org.apache.xerces.xs.datatypes.XSDateTime#hasTimeZone()
+         */
+
+        @Override
+        public boolean hasTimeZone() {
+            return utc != 0;
+        }
+        /* (non-Javadoc)
+         * @see org.apache.xerces.xs.datatypes.XSDateTime#getTimeZoneHours()
+         */
+
+        @Override
+        public int getTimeZoneHours() {
+            return timezoneHr;
+        }
+        /* (non-Javadoc)
+         * @see org.apache.xerces.xs.datatypes.XSDateTime#getTimeZoneMinutes()
+         */
+
+        @Override
+        public int getTimeZoneMinutes() {
+            return timezoneMin;
+        }
         /* (non-Javadoc)
          * @see org.apache.xerces.xs.datatypes.XSDateTime#getLexicalValue()
          */
+
+        @Override
         public String getLexicalValue() {
             return originalValue;
         }
         /* (non-Javadoc)
          * @see org.apache.xerces.xs.datatypes.XSDateTime#normalize()
          */
+
+        @Override
         public XSDateTime normalize() {
-            if(!normalized) {
-                DateTimeData dt = (DateTimeData)this.clone();
+            if (!normalized) {
+                DateTimeData dt = (DateTimeData) this.clone();
                 dt.normalized = true;
                 return dt;
             }
@@ -1049,13 +1112,16 @@
         /* (non-Javadoc)
          * @see org.apache.xerces.xs.datatypes.XSDateTime#isNormalized()
          */
+
+        @Override
         public boolean isNormalized() {
             return normalized;
         }
 
+        @Override
         public Object clone() {
             DateTimeData dt = new DateTimeData(this.year, this.month, this.day, this.hour,
-                        this.minute, this.second, this.utc, this.originalValue, this.normalized, this.type);
+                    this.minute, this.second, this.utc, this.originalValue, this.normalized, this.type);
             dt.canonical = this.canonical;
             dt.position = position;
             dt.timezoneHr = this.timezoneHr;
@@ -1072,16 +1138,19 @@
         /* (non-Javadoc)
          * @see org.apache.xerces.xs.datatypes.XSDateTime#getXMLGregorianCalendar()
          */
+        @Override
         public XMLGregorianCalendar getXMLGregorianCalendar() {
             return type.getXMLGregorianCalendar(this);
         }
         /* (non-Javadoc)
          * @see org.apache.xerces.xs.datatypes.XSDateTime#getDuration()
          */
+
+        @Override
         public Duration getDuration() {
             return type.getDuration(this);
         }
-        }
+    }
 
     protected XMLGregorianCalendar getXMLGregorianCalendar(DateTimeData data) {
         return null;
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/xs/DecimalDV.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/xs/DecimalDV.java	Fri May 17 10:40:21 2013 +0200
@@ -26,6 +26,7 @@
 import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException;
 import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext;
 import com.sun.org.apache.xerces.internal.xs.datatypes.XSDecimal;
+import java.util.Objects;
 
 /**
  * Represent the schema type "decimal"
@@ -38,10 +39,12 @@
  */
 public class DecimalDV extends TypeValidator {
 
+    @Override
     public final short getAllowedFacets(){
         return ( XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_WHITESPACE | XSSimpleTypeDecl.FACET_ENUMERATION |XSSimpleTypeDecl.FACET_MAXINCLUSIVE |XSSimpleTypeDecl.FACET_MININCLUSIVE | XSSimpleTypeDecl.FACET_MAXEXCLUSIVE  | XSSimpleTypeDecl.FACET_MINEXCLUSIVE | XSSimpleTypeDecl.FACET_TOTALDIGITS | XSSimpleTypeDecl.FACET_FRACTIONDIGITS);
     }
 
+    @Override
     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
         try {
             return new XDecimal(content);
@@ -50,20 +53,23 @@
         }
     }
 
+    @Override
     public final int compare(Object value1, Object value2){
         return ((XDecimal)value1).compareTo((XDecimal)value2);
     }
 
+    @Override
     public final int getTotalDigits(Object value){
         return ((XDecimal)value).totalDigits;
     }
 
+    @Override
     public final int getFractionDigits(Object value){
         return ((XDecimal)value).fracDigits;
     }
 
     // Avoid using the heavy-weight java.math.BigDecimal
-    static class XDecimal implements XSDecimal {
+    static final class XDecimal implements XSDecimal {
         // sign: 0 for vlaue 0; 1 for positive values; -1 for negative values
         int sign = 1;
         // total digits. >= 1
@@ -216,6 +222,8 @@
 
             integer = true;
         }
+
+        @Override
         public boolean equals(Object val) {
             if (val == this)
                 return true;
@@ -232,6 +240,19 @@
             return intDigits == oval.intDigits && fracDigits == oval.fracDigits &&
                    ivalue.equals(oval.ivalue) && fvalue.equals(oval.fvalue);
         }
+
+        @Override
+        public int hashCode() {
+            int hash = 7;
+            hash = 17 * hash + this.sign;
+            if (this.sign == 0) return hash;
+            hash = 17 * hash + this.intDigits;
+            hash = 17 * hash + this.fracDigits;
+            hash = 17 * hash + Objects.hashCode(this.ivalue);
+            hash = 17 * hash + Objects.hashCode(this.fvalue);
+            return hash;
+        }
+
         public int compareTo(XDecimal val) {
             if (sign != val.sign)
                 return sign > val.sign ? 1 : -1;
@@ -248,7 +269,9 @@
             ret = fvalue.compareTo(val.fvalue);
             return ret == 0 ? 0 : (ret > 0 ? 1 : -1);
         }
+
         private String canonical;
+        @Override
         public synchronized String toString() {
             if (canonical == null) {
                 makeCanonical();
@@ -269,7 +292,7 @@
                 return;
             }
             // for -0.1, total digits is 1, so we need 3 extra spots
-            StringBuffer buffer = new StringBuffer(totalDigits+3);
+            final StringBuilder buffer = new StringBuilder(totalDigits+3);
             if (sign == -1)
                 buffer.append('-');
             if (intDigits != 0)
@@ -288,6 +311,7 @@
             canonical = buffer.toString();
         }
 
+        @Override
         public BigDecimal getBigDecimal() {
             if (sign == 0) {
                 return new BigDecimal(BigInteger.ZERO);
@@ -295,6 +319,7 @@
             return new BigDecimal(toString());
         }
 
+        @Override
         public BigInteger getBigInteger() throws NumberFormatException {
             if (fracDigits != 0) {
                 throw new NumberFormatException();
@@ -308,6 +333,7 @@
             return new BigInteger("-" + ivalue);
         }
 
+        @Override
         public long getLong() throws NumberFormatException {
             if (fracDigits != 0) {
                 throw new NumberFormatException();
@@ -321,6 +347,7 @@
             return Long.parseLong("-" + ivalue);
         }
 
+        @Override
         public int getInt() throws NumberFormatException {
             if (fracDigits != 0) {
                 throw new NumberFormatException();
@@ -334,6 +361,7 @@
             return Integer.parseInt("-" + ivalue);
         }
 
+        @Override
         public short getShort() throws NumberFormatException {
             if (fracDigits != 0) {
                 throw new NumberFormatException();
@@ -347,6 +375,7 @@
             return Short.parseShort("-" + ivalue);
         }
 
+        @Override
         public byte getByte() throws NumberFormatException {
             if (fracDigits != 0) {
                 throw new NumberFormatException();
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/xs/PrecisionDecimalDV.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/xs/PrecisionDecimalDV.java	Fri May 17 10:40:21 2013 +0200
@@ -32,7 +32,7 @@
  */
 class PrecisionDecimalDV extends TypeValidator {
 
-    static class XPrecisionDecimal {
+    static final class XPrecisionDecimal {
 
         // sign: 0 for absent; 1 for positive values; -1 for negative values (except in case of INF, -INF)
         int sign = 1;
@@ -144,7 +144,71 @@
             totalDigits = intDigits + fracDigits;
         }
 
+        // Construct a canonical String representation of this number
+        // for the purpose of deriving a hashCode value compliant with
+        // equals.
+        // The toString representation will be:
+        // NaN for NaN, INF for +infinity, -INF for -infinity, 0 for zero,
+        // and [1-9].[0-9]*[1-9]?(E[1-9][0-9]*)? for other numbers.
+        private static String canonicalToStringForHashCode(String ivalue, String fvalue, int sign, int pvalue) {
+            if ("NaN".equals(ivalue)) {
+                return "NaN";
+            }
+            if ("INF".equals(ivalue)) {
+                return sign < 0 ? "-INF" : "INF";
+            }
+            final StringBuilder builder = new StringBuilder();
+            final int ilen = ivalue.length();
+            final int flen0 = fvalue.length();
+            int lastNonZero;
+            for (lastNonZero = flen0; lastNonZero > 0 ; lastNonZero--) {
+                if (fvalue.charAt(lastNonZero -1 ) != '0') break;
+            }
+            final int flen = lastNonZero;
+            int iStart;
+            int exponent = pvalue;
+            for (iStart = 0; iStart < ilen; iStart++) {
+                if (ivalue.charAt(iStart) != '0') break;
+            }
+            int fStart = 0;
+            if (iStart < ivalue.length()) {
+                builder.append(sign == -1 ? "-" : "");
+                builder.append(ivalue.charAt(iStart));
+                iStart++;
+            } else {
+                if (flen > 0) {
+                    for (fStart = 0; fStart < flen; fStart++) {
+                        if (fvalue.charAt(fStart) != '0') break;
+                    }
+                    if (fStart < flen) {
+                        builder.append(sign == -1 ? "-" : "");
+                        builder.append(fvalue.charAt(fStart));
+                        exponent -= ++fStart;
+                    } else {
+                        return "0";
+                    }
+                } else {
+                    return "0";
+                }
+            }
 
+            if (iStart < ilen || fStart < flen) {
+                builder.append('.');
+            }
+            while (iStart < ilen) {
+                builder.append(ivalue.charAt(iStart++));
+                exponent++;
+            }
+            while (fStart < flen) {
+                builder.append(fvalue.charAt(fStart++));
+            }
+            if (exponent != 0) {
+                builder.append("E").append(exponent);
+            }
+            return builder.toString();
+        }
+
+        @Override
         public boolean equals(Object val) {
             if (val == this)
                 return true;
@@ -156,6 +220,20 @@
             return this.compareTo(oval) == EQUAL;
         }
 
+        @Override
+        public int hashCode() {
+            // There's nothing else we can use easily, because equals could
+            // return true for widely different representation of the
+            // same number - and we don't have any canonical representation.
+            // The problem here is that we must ensure that if two numbers
+            // are equals then their hash code must also be equals.
+            // hashCode for 1.01E1 should be the same as hashCode for 0.101E2
+            // So we call cannonicalToStringForHashCode - which implements an
+            // algorithm that invents a normalized string representation
+            // for this number, and we return a hash for that.
+            return canonicalToStringForHashCode(ivalue, fvalue, sign, pvalue).hashCode();
+        }
+
         /**
          * @return
          */
@@ -295,6 +373,7 @@
 
         private String canonical;
 
+        @Override
         public synchronized String toString() {
             if (canonical == null) {
                 makeCanonical();
@@ -325,6 +404,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.impl.dv.xs.TypeValidator#getAllowedFacets()
      */
+    @Override
     public short getAllowedFacets() {
         return ( XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_WHITESPACE | XSSimpleTypeDecl.FACET_ENUMERATION |XSSimpleTypeDecl.FACET_MAXINCLUSIVE |XSSimpleTypeDecl.FACET_MININCLUSIVE | XSSimpleTypeDecl.FACET_MAXEXCLUSIVE  | XSSimpleTypeDecl.FACET_MINEXCLUSIVE | XSSimpleTypeDecl.FACET_TOTALDIGITS | XSSimpleTypeDecl.FACET_FRACTIONDIGITS);
     }
@@ -332,6 +412,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.impl.dv.xs.TypeValidator#getActualValue(java.lang.String, com.sun.org.apache.xerces.internal.impl.dv.ValidationContext)
      */
+    @Override
     public Object getActualValue(String content, ValidationContext context)
     throws InvalidDatatypeValueException {
         try {
@@ -341,18 +422,22 @@
         }
     }
 
+    @Override
     public int compare(Object value1, Object value2) {
         return ((XPrecisionDecimal)value1).compareTo((XPrecisionDecimal)value2);
     }
 
+    @Override
     public int getFractionDigits(Object value) {
         return ((XPrecisionDecimal)value).fracDigits;
     }
 
+    @Override
     public int getTotalDigits(Object value) {
         return ((XPrecisionDecimal)value).totalDigits;
     }
 
+    @Override
     public boolean isIdentical(Object value1, Object value2) {
         if(!(value2 instanceof XPrecisionDecimal) || !(value1 instanceof XPrecisionDecimal))
             return false;
--- a/jaxp/src/com/sun/org/apache/xerces/internal/util/URI.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/util/URI.java	Fri May 17 10:40:21 2013 +0200
@@ -22,6 +22,7 @@
 
 import java.io.IOException;
 import java.io.Serializable;
+import java.util.Objects;
 
 /**********************************************************************
 * A class to represent a Uniform Resource Identifier (URI). This class
@@ -1212,7 +1213,7 @@
   * @return the scheme-specific part for this URI
   */
   public String getSchemeSpecificPart() {
-    StringBuffer schemespec = new StringBuffer();
+    final StringBuilder schemespec = new StringBuilder();
 
     if (m_host != null || m_regAuthority != null) {
       schemespec.append("//");
@@ -1297,7 +1298,7 @@
    * @return the authority
    */
   public String getAuthority() {
-      StringBuffer authority = new StringBuffer();
+      final StringBuilder authority = new StringBuilder();
       if (m_host != null || m_regAuthority != null) {
           authority.append("//");
 
@@ -1340,7 +1341,7 @@
   */
   public String getPath(boolean p_includeQueryString,
                         boolean p_includeFragment) {
-    StringBuffer pathString = new StringBuffer(m_path);
+    final StringBuilder pathString = new StringBuilder(m_path);
 
     if (p_includeQueryString && m_queryString != null) {
       pathString.append('?');
@@ -1683,6 +1684,7 @@
   * @return true if p_test is a URI with all values equal to this
   *         URI, false otherwise
   */
+  @Override
   public boolean equals(Object p_test) {
     if (p_test instanceof URI) {
       URI testURI = (URI) p_test;
@@ -1711,13 +1713,27 @@
     return false;
   }
 
+    @Override
+    public int hashCode() {
+        int hash = 5;
+        hash = 47 * hash + Objects.hashCode(this.m_scheme);
+        hash = 47 * hash + Objects.hashCode(this.m_userinfo);
+        hash = 47 * hash + Objects.hashCode(this.m_host);
+        hash = 47 * hash + this.m_port;
+        hash = 47 * hash + Objects.hashCode(this.m_path);
+        hash = 47 * hash + Objects.hashCode(this.m_queryString);
+        hash = 47 * hash + Objects.hashCode(this.m_fragment);
+        return hash;
+    }
+
  /**
   * Get the URI as a string specification. See RFC 2396 Section 5.2.
   *
   * @return the URI string specification
   */
+  @Override
   public String toString() {
-    StringBuffer uriSpecString = new StringBuffer();
+    final StringBuilder uriSpecString = new StringBuilder();
 
     if (m_scheme != null) {
       uriSpecString.append(m_scheme);
--- a/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java	Fri May 17 10:40:21 2013 +0200
@@ -68,6 +68,7 @@
 import com.sun.org.apache.xerces.internal.xpointer.XPointerHandler;
 import com.sun.org.apache.xerces.internal.xpointer.XPointerProcessor;
 import com.sun.org.apache.xerces.internal.utils.ObjectFactory;
+import java.util.Objects;
 
 /**
  * <p>
@@ -390,6 +391,7 @@
 
     // XMLComponent methods
 
+    @Override
     public void reset(XMLComponentManager componentManager)
         throws XNIException {
         fNamespaceContext = null;
@@ -597,6 +599,7 @@
      * this component. This method may return null if no features
      * are recognized by this component.
      */
+    @Override
     public String[] getRecognizedFeatures() {
         return (String[])(RECOGNIZED_FEATURES.clone());
     } // getRecognizedFeatures():String[]
@@ -616,6 +619,7 @@
      * @throws SAXNotSupportedException The component should not throw
      *                                  this exception.
      */
+    @Override
     public void setFeature(String featureId, boolean state)
         throws XMLConfigurationException {
         if (featureId.equals(ALLOW_UE_AND_NOTATION_EVENTS)) {
@@ -632,6 +636,7 @@
      * this component. This method may return null if no properties
      * are recognized by this component.
      */
+    @Override
     public String[] getRecognizedProperties() {
         return (String[])(RECOGNIZED_PROPERTIES.clone());
     } // getRecognizedProperties():String[]
@@ -651,6 +656,7 @@
      * @throws SAXNotSupportedException The component should not throw
      *                                  this exception.
      */
+    @Override
     public void setProperty(String propertyId, Object value)
         throws XMLConfigurationException {
         if (propertyId.equals(SYMBOL_TABLE)) {
@@ -719,6 +725,7 @@
      *
      * @since Xerces 2.2.0
      */
+    @Override
     public Boolean getFeatureDefault(String featureId) {
         for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {
             if (RECOGNIZED_FEATURES[i].equals(featureId)) {
@@ -737,6 +744,7 @@
      *
      * @since Xerces 2.2.0
      */
+    @Override
     public Object getPropertyDefault(String propertyId) {
         for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) {
             if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) {
@@ -746,10 +754,12 @@
         return null;
     } // getPropertyDefault(String):Object
 
+    @Override
     public void setDocumentHandler(XMLDocumentHandler handler) {
         fDocumentHandler = handler;
     }
 
+    @Override
     public XMLDocumentHandler getDocumentHandler() {
         return fDocumentHandler;
     }
@@ -764,6 +774,7 @@
      *
      * This event is only passed on to the document handler if this is the root document.
      */
+    @Override
     public void startDocument(
         XMLLocator locator,
         String encoding,
@@ -811,6 +822,7 @@
         }
     }
 
+    @Override
     public void xmlDecl(
         String version,
         String encoding,
@@ -823,6 +835,7 @@
         }
     }
 
+    @Override
     public void doctypeDecl(
         String rootElement,
         String publicId,
@@ -834,6 +847,7 @@
         }
     }
 
+    @Override
     public void comment(XMLString text, Augmentations augs)
         throws XNIException {
         if (!fInDTD) {
@@ -850,6 +864,7 @@
         }
     }
 
+    @Override
     public void processingInstruction(
         String target,
         XMLString data,
@@ -870,6 +885,7 @@
         }
     }
 
+    @Override
     public void startElement(
         QName element,
         XMLAttributes attributes,
@@ -940,6 +956,7 @@
         }
     }
 
+    @Override
     public void emptyElement(
         QName element,
         XMLAttributes attributes,
@@ -1021,6 +1038,7 @@
         fDepth--;
     }
 
+    @Override
     public void endElement(QName element, Augmentations augs)
         throws XNIException {
 
@@ -1066,6 +1084,7 @@
         fDepth--;
     }
 
+    @Override
     public void startGeneralEntity(
         String name,
         XMLResourceIdentifier resId,
@@ -1084,6 +1103,7 @@
         }
     }
 
+    @Override
     public void textDecl(String version, String encoding, Augmentations augs)
         throws XNIException {
         if (fDocumentHandler != null
@@ -1092,6 +1112,7 @@
         }
     }
 
+    @Override
     public void endGeneralEntity(String name, Augmentations augs)
         throws XNIException {
         if (fDocumentHandler != null
@@ -1101,6 +1122,7 @@
         }
     }
 
+    @Override
     public void characters(XMLString text, Augmentations augs)
         throws XNIException {
         if (getState() == STATE_NORMAL_PROCESSING) {
@@ -1117,6 +1139,7 @@
         }
     }
 
+    @Override
     public void ignorableWhitespace(XMLString text, Augmentations augs)
         throws XNIException {
         if (fDocumentHandler != null
@@ -1126,6 +1149,7 @@
         }
     }
 
+    @Override
     public void startCDATA(Augmentations augs) throws XNIException {
         if (fDocumentHandler != null
             && getState() == STATE_NORMAL_PROCESSING
@@ -1134,6 +1158,7 @@
         }
     }
 
+    @Override
     public void endCDATA(Augmentations augs) throws XNIException {
         if (fDocumentHandler != null
             && getState() == STATE_NORMAL_PROCESSING
@@ -1142,6 +1167,7 @@
         }
     }
 
+    @Override
     public void endDocument(Augmentations augs) throws XNIException {
         if (isRootDocument()) {
             if (!fSeenRootElement) {
@@ -1153,10 +1179,12 @@
         }
     }
 
+    @Override
     public void setDocumentSource(XMLDocumentSource source) {
         fDocumentSource = source;
     }
 
+    @Override
     public XMLDocumentSource getDocumentSource() {
         return fDocumentSource;
     }
@@ -1168,6 +1196,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#attributeDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String[], java.lang.String, com.sun.org.apache.xerces.internal.xni.XMLString, com.sun.org.apache.xerces.internal.xni.XMLString, com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void attributeDecl(
         String elementName,
         String attributeName,
@@ -1194,6 +1223,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#elementDecl(java.lang.String, java.lang.String, com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void elementDecl(
         String name,
         String contentModel,
@@ -1207,6 +1237,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endAttlist(com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void endAttlist(Augmentations augmentations) throws XNIException {
         if (fDTDHandler != null) {
             fDTDHandler.endAttlist(augmentations);
@@ -1216,6 +1247,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endConditional(com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void endConditional(Augmentations augmentations)
         throws XNIException {
         if (fDTDHandler != null) {
@@ -1226,6 +1258,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endDTD(com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void endDTD(Augmentations augmentations) throws XNIException {
         if (fDTDHandler != null) {
             fDTDHandler.endDTD(augmentations);
@@ -1236,6 +1269,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endExternalSubset(com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void endExternalSubset(Augmentations augmentations)
         throws XNIException {
         if (fDTDHandler != null) {
@@ -1246,6 +1280,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endParameterEntity(java.lang.String, com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void endParameterEntity(String name, Augmentations augmentations)
         throws XNIException {
         if (fDTDHandler != null) {
@@ -1256,6 +1291,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#externalEntityDecl(java.lang.String, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier, com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void externalEntityDecl(
         String name,
         XMLResourceIdentifier identifier,
@@ -1269,6 +1305,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#getDTDSource()
      */
+    @Override
     public XMLDTDSource getDTDSource() {
         return fDTDSource;
     }
@@ -1276,6 +1313,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#ignoredCharacters(com.sun.org.apache.xerces.internal.xni.XMLString, com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void ignoredCharacters(XMLString text, Augmentations augmentations)
         throws XNIException {
         if (fDTDHandler != null) {
@@ -1286,6 +1324,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#internalEntityDecl(java.lang.String, com.sun.org.apache.xerces.internal.xni.XMLString, com.sun.org.apache.xerces.internal.xni.XMLString, com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void internalEntityDecl(
         String name,
         XMLString text,
@@ -1304,6 +1343,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#notationDecl(java.lang.String, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier, com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void notationDecl(
         String name,
         XMLResourceIdentifier identifier,
@@ -1318,6 +1358,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#setDTDSource(com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource)
      */
+    @Override
     public void setDTDSource(XMLDTDSource source) {
         fDTDSource = source;
     }
@@ -1325,6 +1366,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#startAttlist(java.lang.String, com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void startAttlist(String elementName, Augmentations augmentations)
         throws XNIException {
         if (fDTDHandler != null) {
@@ -1335,6 +1377,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#startConditional(short, com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void startConditional(short type, Augmentations augmentations)
         throws XNIException {
         if (fDTDHandler != null) {
@@ -1345,6 +1388,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#startDTD(com.sun.org.apache.xerces.internal.xni.XMLLocator, com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void startDTD(XMLLocator locator, Augmentations augmentations)
         throws XNIException {
         fInDTD = true;
@@ -1356,6 +1400,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#startExternalSubset(com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier, com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void startExternalSubset(
         XMLResourceIdentifier identifier,
         Augmentations augmentations)
@@ -1368,6 +1413,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#startParameterEntity(java.lang.String, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier, java.lang.String, com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void startParameterEntity(
         String name,
         XMLResourceIdentifier identifier,
@@ -1386,6 +1432,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#unparsedEntityDecl(java.lang.String, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier, java.lang.String, com.sun.org.apache.xerces.internal.xni.Augmentations)
      */
+    @Override
     public void unparsedEntityDecl(
         String name,
         XMLResourceIdentifier identifier,
@@ -1405,6 +1452,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource#getDTDHandler()
      */
+    @Override
     public XMLDTDHandler getDTDHandler() {
         return fDTDHandler;
     }
@@ -1412,6 +1460,7 @@
     /* (non-Javadoc)
      * @see com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource#setDTDHandler(com.sun.org.apache.xerces.internal.xni.XMLDTDHandler)
      */
+    @Override
     public void setDTDHandler(XMLDTDHandler handler) {
         fDTDHandler = handler;
     }
@@ -1641,11 +1690,10 @@
                         fNamespaceContext);
 
                     ((XPointerHandler)fXPtrProcessor).setProperty(XINCLUDE_FIXUP_BASE_URIS,
-                            new Boolean(fFixupBaseURIs));
+                            fFixupBaseURIs);
 
                     ((XPointerHandler)fXPtrProcessor).setProperty(
-                            XINCLUDE_FIXUP_LANGUAGE,
-                            new Boolean (fFixupLanguage));
+                            XINCLUDE_FIXUP_LANGUAGE, fFixupLanguage);
 
                     if (fErrorReporter != null)
                         ((XPointerHandler)fXPtrProcessor).setProperty(ERROR_REPORTER, fErrorReporter);
@@ -2119,14 +2167,14 @@
                 /** Check whether the scheme components are equal. */
                 final String baseScheme = base.getScheme();
                 final String literalScheme = uri.getScheme();
-                if (!isEqual(baseScheme, literalScheme)) {
+                if (!Objects.equals(baseScheme, literalScheme)) {
                     return relativeURI;
                 }
 
                 /** Check whether the authority components are equal. */
                 final String baseAuthority = base.getAuthority();
                 final String literalAuthority = uri.getAuthority();
-                if (!isEqual(baseAuthority, literalAuthority)) {
+                if (!Objects.equals(baseAuthority, literalAuthority)) {
                     return uri.getSchemeSpecificPart();
                 }
 
@@ -2139,7 +2187,7 @@
                 final String literalQuery = uri.getQueryString();
                 final String literalFragment = uri.getFragment();
                 if (literalQuery != null || literalFragment != null) {
-                    StringBuffer buffer = new StringBuffer();
+                    final StringBuilder buffer = new StringBuilder();
                     if (literalPath != null) {
                         buffer.append(literalPath);
                     }
@@ -2650,15 +2698,15 @@
 
         // equals() returns true if two Notations have the same name.
         // Useful for searching Vectors for notations with the same name
+        @Override
         public boolean equals(Object obj) {
-            if (obj == null) {
-                return false;
-            }
-            if (obj instanceof Notation) {
-                Notation other = (Notation)obj;
-                return name.equals(other.name);
-            }
-            return false;
+            return obj == this || obj instanceof Notation
+                    && Objects.equals(name, ((Notation)obj).name);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hashCode(name);
         }
 
         // from 4.5.2
@@ -2671,16 +2719,12 @@
         public boolean isDuplicate(Object obj) {
             if (obj != null && obj instanceof Notation) {
                 Notation other = (Notation)obj;
-                return name.equals(other.name)
-                && isEqual(publicId, other.publicId)
-                && isEqual(expandedSystemId, other.expandedSystemId);
+                return Objects.equals(name, other.name)
+                && Objects.equals(publicId, other.publicId)
+                && Objects.equals(expandedSystemId, other.expandedSystemId);
             }
             return false;
         }
-
-        private boolean isEqual(String one, String two) {
-            return (one == two || (one != null && one.equals(two)));
-        }
     }
 
     // This is a storage class to hold information about the unparsed entities.
@@ -2696,15 +2740,15 @@
 
         // equals() returns true if two UnparsedEntities have the same name.
         // Useful for searching Vectors for entities with the same name
+        @Override
         public boolean equals(Object obj) {
-            if (obj == null) {
-                return false;
-            }
-            if (obj instanceof UnparsedEntity) {
-                UnparsedEntity other = (UnparsedEntity)obj;
-                return name.equals(other.name);
-            }
-            return false;
+            return obj == this || obj instanceof UnparsedEntity
+                    && Objects.equals(name, ((UnparsedEntity)obj).name);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hashCode(name);
         }
 
         // from 4.5.1:
@@ -2717,17 +2761,13 @@
         public boolean isDuplicate(Object obj) {
             if (obj != null && obj instanceof UnparsedEntity) {
                 UnparsedEntity other = (UnparsedEntity)obj;
-                return name.equals(other.name)
-                && isEqual(publicId, other.publicId)
-                && isEqual(expandedSystemId, other.expandedSystemId)
-                && isEqual(notation, other.notation);
+                return Objects.equals(name, other.name)
+                && Objects.equals(publicId, other.publicId)
+                && Objects.equals(expandedSystemId, other.expandedSystemId)
+                && Objects.equals(notation, other.notation);
             }
             return false;
         }
-
-        private boolean isEqual(String one, String two) {
-            return (one == two || (one != null && one.equals(two)));
-        }
     }
 
     // The following methods are used for XML Base processing
@@ -2917,17 +2957,13 @@
         return httpSource;
     }
 
-    private boolean isEqual(String one, String two) {
-        return (one == two || (one != null && one.equals(two)));
-    }
-
     // which ASCII characters need to be escaped
-    private static boolean gNeedEscaping[] = new boolean[128];
+    private static final boolean gNeedEscaping[] = new boolean[128];
     // the first hex character if a character needs to be escaped
-    private static char gAfterEscaping1[] = new char[128];
+    private static final char gAfterEscaping1[] = new char[128];
     // the second hex character if a character needs to be escaped
-    private static char gAfterEscaping2[] = new char[128];
-    private static char[] gHexChs = {'0', '1', '2', '3', '4', '5', '6', '7',
+    private static final char gAfterEscaping2[] = new char[128];
+    private static final char[] gHexChs = {'0', '1', '2', '3', '4', '5', '6', '7',
                                      '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
     // initialize the above 3 arrays
     static {
@@ -2957,7 +2993,7 @@
     private String escapeHref(String href) {
         int len = href.length();
         int ch;
-        StringBuffer buffer = new StringBuffer(len*3);
+        final StringBuilder buffer = new StringBuilder(len*3);
 
         // for each character in the href
         int i = 0;
--- a/jaxp/src/com/sun/org/apache/xml/internal/dtm/ref/DTMNodeProxy.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xml/internal/dtm/ref/DTMNodeProxy.java	Fri May 17 10:40:21 2013 +0200
@@ -27,6 +27,7 @@
 import com.sun.org.apache.xml.internal.dtm.DTM;
 import com.sun.org.apache.xml.internal.dtm.DTMDOMException;
 import com.sun.org.apache.xpath.internal.NodeSet;
+import java.util.Objects;
 
 import org.w3c.dom.Attr;
 import org.w3c.dom.CDATASection;
@@ -141,21 +142,21 @@
    *
    * @return true if the given node has the same handle as this node.
    */
+  @Override
   public final boolean equals(Object node)
   {
-
-    try
-    {
-
       // DTMNodeProxy dtmp = (DTMNodeProxy)node;
       // return (dtmp.node == this.node);
       // Patch attributed to Gary L Peskin <garyp@firstech.com>
-      return equals((Node) node);
-    }
-    catch (ClassCastException cce)
-    {
-      return false;
-    }
+      return node instanceof Node && equals((Node) node);
+  }
+
+  @Override
+  public int hashCode() {
+      int hash = 7;
+      hash = 29 * hash + Objects.hashCode(this.dtm);
+      hash = 29 * hash + this.node;
+      return hash;
   }
 
   /**
@@ -181,6 +182,7 @@
    *
    * @see org.w3c.dom.Node
    */
+  @Override
   public final String getNodeName()
   {
     return dtm.getNodeName(node);
@@ -199,6 +201,7 @@
    *
    *
    */
+  @Override
   public final String getTarget()
   {
     return dtm.getNodeName(node);
@@ -209,6 +212,7 @@
    *
    * @see org.w3c.dom.Node as of DOM Level 2
    */
+  @Override
   public final String getLocalName()
   {
     return dtm.getLocalName(node);
@@ -218,6 +222,7 @@
    * @return The prefix for this node.
    * @see org.w3c.dom.Node as of DOM Level 2
    */
+  @Override
   public final String getPrefix()
   {
     return dtm.getPrefix(node);
@@ -230,6 +235,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Node as of DOM Level 2 -- DTMNodeProxy is read-only
    */
+  @Override
   public final void setPrefix(String prefix) throws DOMException
   {
     throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
@@ -240,6 +246,7 @@
    *
    * @see org.w3c.dom.Node as of DOM Level 2
    */
+  @Override
   public final String getNamespaceURI()
   {
     return dtm.getNamespaceURI(node);
@@ -277,6 +284,7 @@
    * @return false
    * @see org.w3c.dom.Node as of DOM Level 2
    */
+  @Override
   public final boolean isSupported(String feature, String version)
   {
     return implementation.hasFeature(feature,version);
@@ -290,6 +298,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Node
    */
+  @Override
   public final String getNodeValue() throws DOMException
   {
     return dtm.getNodeValue(node);
@@ -312,6 +321,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Node -- DTMNodeProxy is read-only
    */
+  @Override
   public final void setNodeValue(String nodeValue) throws DOMException
   {
     throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
@@ -322,6 +332,7 @@
    *
    * @see org.w3c.dom.Node
    */
+  @Override
   public final short getNodeType()
   {
     return (short) dtm.getNodeType(node);
@@ -332,6 +343,7 @@
    *
    * @see org.w3c.dom.Node
    */
+  @Override
   public final Node getParentNode()
   {
 
@@ -361,6 +373,7 @@
    *
    * @see org.w3c.dom.Node
    */
+  @Override
   public final NodeList getChildNodes()
   {
 
@@ -377,6 +390,7 @@
    *
    * @see org.w3c.dom.Node
    */
+  @Override
   public final Node getFirstChild()
   {
 
@@ -390,6 +404,7 @@
    *
    * @see org.w3c.dom.Node
    */
+  @Override
   public final Node getLastChild()
   {
 
@@ -403,6 +418,7 @@
    *
    * @see org.w3c.dom.Node
    */
+  @Override
   public final Node getPreviousSibling()
   {
 
@@ -416,6 +432,7 @@
    *
    * @see org.w3c.dom.Node
    */
+  @Override
   public final Node getNextSibling()
   {
 
@@ -435,6 +452,7 @@
    *
    * @see org.w3c.dom.Node
    */
+  @Override
   public final NamedNodeMap getAttributes()
   {
 
@@ -448,6 +466,7 @@
    * @param name
    *
    */
+  @Override
   public boolean hasAttribute(String name)
   {
     return DTM.NULL != dtm.getAttributeNode(node,null,name);
@@ -462,6 +481,7 @@
    *
    *
    */
+  @Override
   public boolean hasAttributeNS(String namespaceURI, String localName)
   {
     return DTM.NULL != dtm.getAttributeNode(node,namespaceURI,localName);
@@ -472,6 +492,7 @@
    *
    * @see org.w3c.dom.Node
    */
+  @Override
   public final Document getOwnerDocument()
   {
         // Note that this uses the DOM-compatable version of the call
@@ -488,6 +509,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Node -- DTMNodeProxy is read-only
    */
+  @Override
   public final Node insertBefore(Node newChild, Node refChild)
     throws DOMException
   {
@@ -504,6 +526,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Node -- DTMNodeProxy is read-only
    */
+  @Override
   public final Node replaceChild(Node newChild, Node oldChild)
     throws DOMException
   {
@@ -519,6 +542,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Node -- DTMNodeProxy is read-only
    */
+  @Override
   public final Node removeChild(Node oldChild) throws DOMException
   {
     throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
@@ -533,6 +557,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Node -- DTMNodeProxy is read-only
    */
+  @Override
   public final Node appendChild(Node newChild) throws DOMException
   {
     throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
@@ -543,6 +568,7 @@
    *
    * @see org.w3c.dom.Node
    */
+  @Override
   public final boolean hasChildNodes()
   {
     return (DTM.NULL != dtm.getFirstChild(node));
@@ -555,6 +581,7 @@
    *
    * @see org.w3c.dom.Node -- DTMNodeProxy is read-only
    */
+  @Override
   public final Node cloneNode(boolean deep)
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -565,6 +592,7 @@
    *
    * @see org.w3c.dom.Document
    */
+  @Override
   public final DocumentType getDoctype()
   {
     return null;
@@ -575,6 +603,7 @@
    *
    * @see org.w3c.dom.Document
    */
+  @Override
   public final DOMImplementation getImplementation()
   {
     return implementation;
@@ -587,6 +616,7 @@
    *
    * @see org.w3c.dom.Document
    */
+  @Override
   public final Element getDocumentElement()
   {
                 int dochandle=dtm.getDocument();
@@ -634,6 +664,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Document
    */
+  @Override
   public final Element createElement(String tagName) throws DOMException
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -644,6 +675,7 @@
    *
    * @see org.w3c.dom.Document
    */
+  @Override
   public final DocumentFragment createDocumentFragment()
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -656,6 +688,7 @@
    *
    * @see org.w3c.dom.Document
    */
+  @Override
   public final Text createTextNode(String data)
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -668,6 +701,7 @@
    *
    * @see org.w3c.dom.Document
    */
+  @Override
   public final Comment createComment(String data)
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -682,6 +716,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Document
    */
+  @Override
   public final CDATASection createCDATASection(String data)
     throws DOMException
   {
@@ -698,8 +733,9 @@
    * @throws DOMException
    * @see org.w3c.dom.Document
    */
+  @Override
   public final ProcessingInstruction createProcessingInstruction(
-                                                                 String target, String data) throws DOMException
+                                String target, String data) throws DOMException
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
   }
@@ -713,6 +749,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Document
    */
+  @Override
   public final Attr createAttribute(String name) throws DOMException
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -727,6 +764,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Document
    */
+  @Override
   public final EntityReference createEntityReference(String name)
     throws DOMException
   {
@@ -739,6 +777,7 @@
    *
    * @see org.w3c.dom.Document
    */
+  @Override
   public final NodeList getElementsByTagName(String tagname)
   {
        Vector listVector = new Vector();
@@ -819,6 +858,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Document as of DOM Level 2 -- DTMNodeProxy is read-only
    */
+  @Override
   public final Node importNode(Node importedNode, boolean deep)
     throws DOMException
   {
@@ -835,8 +875,9 @@
    * @throws DOMException
    * @see org.w3c.dom.Document as of DOM Level 2
    */
+  @Override
   public final Element createElementNS(
-                                       String namespaceURI, String qualifiedName) throws DOMException
+                 String namespaceURI, String qualifiedName) throws DOMException
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
   }
@@ -851,8 +892,9 @@
    * @throws DOMException
    * @see org.w3c.dom.Document as of DOM Level 2
    */
+  @Override
   public final Attr createAttributeNS(
-                                      String namespaceURI, String qualifiedName) throws DOMException
+                  String namespaceURI, String qualifiedName) throws DOMException
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
   }
@@ -865,6 +907,7 @@
    *
    * @see org.w3c.dom.Document as of DOM Level 2
    */
+  @Override
   public final NodeList getElementsByTagNameNS(String namespaceURI,
                                                String localName)
   {
@@ -952,6 +995,7 @@
    *
    * @see org.w3c.dom.Document as of DOM Level 2
    */
+  @Override
   public final Element getElementById(String elementId)
   {
        return (Element) dtm.getNode(dtm.getElementById(elementId));
@@ -966,6 +1010,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Text
    */
+  @Override
   public final Text splitText(int offset) throws DOMException
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -978,6 +1023,7 @@
    * @throws DOMException
    * @see org.w3c.dom.CharacterData
    */
+  @Override
   public final String getData() throws DOMException
   {
     return dtm.getNodeValue(node);
@@ -990,6 +1036,7 @@
    * @throws DOMException
    * @see org.w3c.dom.CharacterData
    */
+  @Override
   public final void setData(String data) throws DOMException
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -1000,6 +1047,7 @@
    *
    * @see org.w3c.dom.CharacterData
    */
+  @Override
   public final int getLength()
   {
     // %OPT% This should do something smarter?
@@ -1016,6 +1064,7 @@
    * @throws DOMException
    * @see org.w3c.dom.CharacterData
    */
+  @Override
   public final String substringData(int offset, int count) throws DOMException
   {
     return getData().substring(offset,offset+count);
@@ -1028,6 +1077,7 @@
    * @throws DOMException
    * @see org.w3c.dom.CharacterData
    */
+  @Override
   public final void appendData(String arg) throws DOMException
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -1041,6 +1091,7 @@
    * @throws DOMException
    * @see org.w3c.dom.CharacterData
    */
+  @Override
   public final void insertData(int offset, String arg) throws DOMException
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -1054,6 +1105,7 @@
    * @throws DOMException
    * @see org.w3c.dom.CharacterData
    */
+  @Override
   public final void deleteData(int offset, int count) throws DOMException
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -1068,6 +1120,7 @@
    * @throws DOMException
    * @see org.w3c.dom.CharacterData
    */
+  @Override
   public final void replaceData(int offset, int count, String arg)
     throws DOMException
   {
@@ -1079,6 +1132,7 @@
    *
    * @see org.w3c.dom.Element
    */
+  @Override
   public final String getTagName()
   {
     return dtm.getNodeName(node);
@@ -1091,12 +1145,13 @@
    *
    * @see org.w3c.dom.Element
    */
+  @Override
   public final String getAttribute(String name)
   {
-
     DTMNamedNodeMap  map = new DTMNamedNodeMap(dtm, node);
-    Node node = map.getNamedItem(name);
-    return (null == node) ? EMPTYSTRING : node.getNodeValue();  }
+    Node n = map.getNamedItem(name);
+    return (null == n) ? EMPTYSTRING : n.getNodeValue();
+  }
 
   /**
    *
@@ -1106,6 +1161,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Element
    */
+  @Override
   public final void setAttribute(String name, String value)
     throws DOMException
   {
@@ -1119,6 +1175,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Element
    */
+  @Override
   public final void removeAttribute(String name) throws DOMException
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -1131,9 +1188,9 @@
    *
    * @see org.w3c.dom.Element
    */
+  @Override
   public final Attr getAttributeNode(String name)
   {
-
     DTMNamedNodeMap  map = new DTMNamedNodeMap(dtm, node);
     return (Attr)map.getNamedItem(name);
   }
@@ -1147,6 +1204,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Element
    */
+  @Override
   public final Attr setAttributeNode(Attr newAttr) throws DOMException
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -1161,6 +1219,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Element
    */
+  @Override
   public final Attr removeAttributeNode(Attr oldAttr) throws DOMException
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -1171,12 +1230,14 @@
    *
    *
    */
+  @Override
   public boolean hasAttributes()
   {
     return DTM.NULL != dtm.getFirstAttribute(node);
   }
 
   /** @see org.w3c.dom.Element */
+  @Override
   public final void normalize()
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -1190,6 +1251,7 @@
    *
    * @see org.w3c.dom.Element
    */
+  @Override
   public final String getAttributeNS(String namespaceURI, String localName)
   {
     Node retNode = null;
@@ -1208,6 +1270,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Element
    */
+  @Override
   public final void setAttributeNS(
                                    String namespaceURI, String qualifiedName, String value)
     throws DOMException
@@ -1223,6 +1286,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Element
    */
+  @Override
   public final void removeAttributeNS(String namespaceURI, String localName)
     throws DOMException
   {
@@ -1237,6 +1301,7 @@
    *
    * @see org.w3c.dom.Element
    */
+  @Override
   public final Attr getAttributeNodeNS(String namespaceURI, String localName)
   {
        Attr retAttr = null;
@@ -1256,6 +1321,7 @@
    * @throws DOMException
    * @see org.w3c.dom.Element
    */
+  @Override
   public final Attr setAttributeNodeNS(Attr newAttr) throws DOMException
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -1266,6 +1332,7 @@
    *
    * @see org.w3c.dom.Attr
    */
+  @Override
   public final String getName()
   {
     return dtm.getNodeName(node);
@@ -1276,6 +1343,7 @@
    *
    * @see org.w3c.dom.Attr
    */
+  @Override
   public final boolean getSpecified()
   {
     // We really don't know which attributes might have come from the
@@ -1290,6 +1358,7 @@
    *
    * @see org.w3c.dom.Attr
    */
+  @Override
   public final String getValue()
   {
     return dtm.getNodeValue(node);
@@ -1300,6 +1369,7 @@
    * @param value
    * @see org.w3c.dom.Attr
    */
+  @Override
   public final void setValue(String value)
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -1311,6 +1381,7 @@
    *
    * @see org.w3c.dom.Attr as of DOM Level 2
    */
+  @Override
   public final Element getOwnerElement()
   {
     if (getNodeType() != Node.ATTRIBUTE_NODE)
@@ -1331,9 +1402,9 @@
    *
    * @throws DOMException
    */
+  @Override
   public Node adoptNode(Node source) throws DOMException
   {
-
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
   }
 
@@ -1348,9 +1419,9 @@
    *
    * NEEDSDOC ($objectName$) @return
    */
+  @Override
   public String getInputEncoding()
   {
-
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
   }
 
@@ -1383,7 +1454,6 @@
    */
   public boolean getStandalone()
   {
-
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
   }
 
@@ -1418,9 +1488,9 @@
    *
    * NEEDSDOC ($objectName$) @return
    */
+  @Override
   public boolean getStrictErrorChecking()
   {
-
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
   }
 
@@ -1439,6 +1509,7 @@
    *
    * NEEDSDOC @param strictErrorChecking
    */
+  @Override
   public void setStrictErrorChecking(boolean strictErrorChecking)
   {
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@@ -1457,7 +1528,6 @@
    */
   public String getVersion()
   {
-
     throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
   }
 
@@ -1482,10 +1552,12 @@
    */
   static class DTMNodeProxyImplementation implements DOMImplementation
   {
+    @Override
     public DocumentType createDocumentType(String qualifiedName,String publicId, String systemId)
     {
       throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
     }
+    @Override
     public Document createDocument(String namespaceURI,String qualfiedName,DocumentType doctype)
     {
       // Could create a DTM... but why, when it'd have to be permanantly empty?
@@ -1500,6 +1572,7 @@
      * methods we can't support. I'm not sure which would be more useful
      * to the caller.
      */
+    @Override
     public boolean hasFeature(String feature,String version)
     {
       if( ("CORE".equals(feature.toUpperCase()) || "XML".equals(feature.toUpperCase()))
@@ -1530,6 +1603,7 @@
      *   childNodes, etc.
      * @since DOM Level 3
      */
+    @Override
     public Object getFeature(String feature, String version) {
         // we don't have any alternate node, either this node does the job
         // or we don't have anything that does
@@ -1542,6 +1616,7 @@
 
 //RAMESH : Pending proper implementation of DOM Level 3
 
+    @Override
     public Object setUserData(String key,
                               Object data,
                               UserDataHandler handler) {
@@ -1557,6 +1632,7 @@
      *   on this node, or <code>null</code> if there was none.
      * @since DOM Level 3
      */
+    @Override
     public Object getUserData(String key) {
         return getOwnerDocument().getUserData( key);
     }
@@ -1581,6 +1657,7 @@
      *   childNodes, etc.
      * @since DOM Level 3
      */
+    @Override
     public Object getFeature(String feature, String version) {
         // we don't have any alternate node, either this node does the job
         // or we don't have anything that does
@@ -1629,6 +1706,7 @@
      *   <code>true</code> otherwise <code>false</code>.
      * @since DOM Level 3
      */
+    @Override
     public boolean isEqualNode(Node arg) {
         if (arg == this) {
             return true;
@@ -1705,6 +1783,7 @@
      * @return th URI for the namespace
      * @since DOM Level 3
      */
+    @Override
     public String lookupNamespaceURI(String specifiedPrefix) {
         short type = this.getNodeType();
         switch (type) {
@@ -1797,6 +1876,7 @@
      *   is the default namespace, <code>false</code> otherwise.
      * @since DOM Level 3
      */
+    @Override
     public boolean isDefaultNamespace(String namespaceURI){
        /*
         // REVISIT: remove casts when DOM L3 becomes REC.
@@ -1871,6 +1951,7 @@
      * @param namespaceURI
      * @return the prefix for the namespace
      */
+    @Override
     public String lookupPrefix(String namespaceURI){
 
         // REVISIT: When Namespaces 1.1 comes out this may not be true
@@ -1932,6 +2013,7 @@
      *   <code>false</code> otherwise.
      * @since DOM Level 3
      */
+    @Override
     public boolean isSameNode(Node other) {
         // we do not use any wrapper so the answer is obvious
         return this == other;
@@ -1980,8 +2062,9 @@
      *   DOMSTRING_SIZE_ERR: Raised when it would return more characters than
      *   fit in a <code>DOMString</code> variable on the implementation
      *   platform.
-       * @since DOM Level 3
+     * @since DOM Level 3
      */
+    @Override
     public void setTextContent(String textContent)
         throws DOMException {
         setNodeValue(textContent);
@@ -2031,6 +2114,7 @@
      *   platform.
      * @since DOM Level 3
      */
+    @Override
     public String getTextContent() throws DOMException {
         return getNodeValue();  // overriden in some subclasses
     }
@@ -2043,6 +2127,7 @@
      *   node.
      * @since DOM Level 3
      */
+    @Override
     public short compareDocumentPosition(Node other) throws DOMException {
         return 0;
     }
@@ -2071,14 +2156,16 @@
      * Yes. (F2F 26 Sep 2001)
      * @since DOM Level 3
      */
+    @Override
     public String getBaseURI() {
         return null;
     }
 
-        /**
+    /**
      * DOM Level 3
      * Renaming node
      */
+    @Override
     public Node renameNode(Node n,
                            String namespaceURI,
                            String name)
@@ -2091,14 +2178,16 @@
      *  DOM Level 3
      *  Normalize document.
      */
+    @Override
     public void normalizeDocument(){
 
     }
     /**
-     *  The configuration used when <code>Document.normalizeDocument</code> is
+     * The configuration used when <code>Document.normalizeDocument</code> is
      * invoked.
      * @since DOM Level 3
      */
+    @Override
     public DOMConfiguration getDomConfig(){
        return null;
     }
@@ -2110,8 +2199,8 @@
     /**
      * DOM Level 3
      */
+    @Override
     public void setDocumentURI(String documentURI){
-
         fDocumentURI= documentURI;
     }
 
@@ -2123,6 +2212,7 @@
      * over this attribute.
      * @since DOM Level 3
      */
+    @Override
     public String getDocumentURI(){
         return fDocumentURI;
     }
@@ -2154,9 +2244,10 @@
         actualEncoding = value;
     }
 
-     /**
+   /**
     * DOM Level 3
     */
+    @Override
     public Text replaceWholeText(String content)
                                  throws DOMException{
 /*
@@ -2210,6 +2301,7 @@
      * nodes to this node, concatenated in document order.
      * @since DOM Level 3
      */
+    @Override
     public String getWholeText(){
 
 /*
@@ -2235,13 +2327,11 @@
      * Returns whether this text node contains whitespace in element content,
      * often abusively called "ignorable whitespace".
      */
+    @Override
     public boolean isElementContentWhitespace(){
         return false;
     }
 
-
-
-
      /**
      * NON-DOM: set the type of this attribute to be ID type.
      *
@@ -2254,6 +2344,7 @@
      /**
      * DOM Level 3: register the given attribute node as an ID attribute
      */
+    @Override
     public void setIdAttribute(String name, boolean makeId) {
         //PENDING
     }
@@ -2262,6 +2353,7 @@
     /**
      * DOM Level 3: register the given attribute node as an ID attribute
      */
+    @Override
     public void setIdAttributeNode(Attr at, boolean makeId) {
         //PENDING
     }
@@ -2269,6 +2361,7 @@
     /**
      * DOM Level 3: register the given attribute node as an ID attribute
      */
+    @Override
     public void setIdAttributeNS(String namespaceURI, String localName,
                                     boolean makeId) {
         //PENDING
@@ -2277,16 +2370,19 @@
          * Method getSchemaTypeInfo.
          * @return TypeInfo
          */
+    @Override
     public TypeInfo getSchemaTypeInfo(){
       return null; //PENDING
     }
 
+    @Override
     public boolean isId() {
         return false; //PENDING
     }
 
 
     private String xmlEncoding;
+    @Override
     public String getXmlEncoding( ) {
         return xmlEncoding;
     }
@@ -2295,23 +2391,25 @@
     }
 
     private boolean xmlStandalone;
+    @Override
     public boolean getXmlStandalone() {
         return xmlStandalone;
     }
 
+    @Override
     public void setXmlStandalone(boolean xmlStandalone) throws DOMException {
         this.xmlStandalone = xmlStandalone;
     }
 
     private String xmlVersion;
+    @Override
     public String getXmlVersion() {
         return xmlVersion;
     }
 
+    @Override
     public void setXmlVersion(String xmlVersion) throws DOMException {
         this.xmlVersion = xmlVersion;
     }
 
-
-
 }
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/URI.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/URI.java	Fri May 17 10:40:21 2013 +0200
@@ -23,7 +23,7 @@
 package com.sun.org.apache.xml.internal.serializer.utils;
 
 import java.io.IOException;
-import java.io.Serializable;
+import java.util.Objects;
 
 
 /**
@@ -863,7 +863,7 @@
   public String getSchemeSpecificPart()
   {
 
-    StringBuffer schemespec = new StringBuffer();
+    final StringBuilder schemespec = new StringBuilder();
 
     if (m_userinfo != null || m_host != null || m_port != -1)
     {
@@ -955,7 +955,7 @@
                         boolean p_includeFragment)
   {
 
-    StringBuffer pathString = new StringBuffer(m_path);
+    final StringBuilder pathString = new StringBuilder(m_path);
 
     if (p_includeQueryString && m_queryString != null)
     {
@@ -1321,6 +1321,7 @@
    * @return true if p_test is a URI with all values equal to this
    *         URI, false otherwise
    */
+  @Override
   public boolean equals(Object p_test)
   {
 
@@ -1343,15 +1344,29 @@
     return false;
   }
 
+  @Override
+  public int hashCode() {
+    int hash = 5;
+    hash = 41 * hash + Objects.hashCode(this.m_scheme);
+    hash = 41 * hash + Objects.hashCode(this.m_userinfo);
+    hash = 41 * hash + Objects.hashCode(this.m_host);
+    hash = 41 * hash + this.m_port;
+    hash = 41 * hash + Objects.hashCode(this.m_path);
+    hash = 41 * hash + Objects.hashCode(this.m_queryString);
+    hash = 41 * hash + Objects.hashCode(this.m_fragment);
+    return hash;
+  }
+
   /**
    * Get the URI as a string specification. See RFC 2396 Section 5.2.
    *
    * @return the URI string specification
    */
+  @Override
   public String toString()
   {
 
-    StringBuffer uriSpecString = new StringBuffer();
+    final StringBuilder uriSpecString = new StringBuilder();
 
     if (m_scheme != null)
     {
@@ -1543,7 +1558,7 @@
    *
    *
    * @param p_char the character to check
-   * @return true if the char is betweeen '0' and '9', 'a' and 'f'
+   * @return true if the char is between '0' and '9', 'a' and 'f'
    *         or 'A' and 'F', false otherwise
    */
   private static boolean isHex(char p_char)
--- a/jaxp/src/com/sun/org/apache/xml/internal/utils/URI.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xml/internal/utils/URI.java	Fri May 17 10:40:21 2013 +0200
@@ -27,6 +27,7 @@
 
 import com.sun.org.apache.xml.internal.res.XMLErrorResources;
 import com.sun.org.apache.xml.internal.res.XMLMessages;
+import java.util.Objects;
 
 /**
  * A class to represent a Uniform Resource Identifier (URI). This class
@@ -883,7 +884,7 @@
   public String getSchemeSpecificPart()
   {
 
-    StringBuffer schemespec = new StringBuffer();
+    final StringBuilder schemespec = new StringBuilder();
 
     if (m_userinfo != null || m_host != null || m_port != -1)
     {
@@ -975,7 +976,7 @@
                         boolean p_includeFragment)
   {
 
-    StringBuffer pathString = new StringBuffer(m_path);
+    final StringBuilder pathString = new StringBuilder(m_path);
 
     if (p_includeQueryString && m_queryString != null)
     {
@@ -1341,6 +1342,7 @@
    * @return true if p_test is a URI with all values equal to this
    *         URI, false otherwise
    */
+  @Override
   public boolean equals(Object p_test)
   {
 
@@ -1363,15 +1365,29 @@
     return false;
   }
 
+  @Override
+  public int hashCode() {
+    int hash = 7;
+    hash = 59 * hash + Objects.hashCode(this.m_scheme);
+    hash = 59 * hash + Objects.hashCode(this.m_userinfo);
+    hash = 59 * hash + Objects.hashCode(this.m_host);
+    hash = 59 * hash + this.m_port;
+    hash = 59 * hash + Objects.hashCode(this.m_path);
+    hash = 59 * hash + Objects.hashCode(this.m_queryString);
+    hash = 59 * hash + Objects.hashCode(this.m_fragment);
+    return hash;
+  }
+
   /**
    * Get the URI as a string specification. See RFC 2396 Section 5.2.
    *
    * @return the URI string specification
    */
+  @Override
   public String toString()
   {
 
-    StringBuffer uriSpecString = new StringBuffer();
+    final StringBuilder uriSpecString = new StringBuilder();
 
     if (m_scheme != null)
     {
--- a/jaxp/src/com/sun/org/apache/xpath/internal/Arg.java	Fri May 10 09:23:22 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/Arg.java	Fri May 17 10:40:21 2013 +0200
@@ -24,6 +24,7 @@
 
 import com.sun.org.apache.xml.internal.utils.QName;
 import com.sun.org.apache.xpath.internal.objects.XObject;
+import java.util.Objects;
 
 /**
  * This class holds an instance of an argument on
@@ -182,7 +183,7 @@
   {
 
     m_qname = new QName("");
-    ;  // so that string compares can be done.
+       // so that string compares can be done.
     m_val = null;
     m_expression = null;
     m_isVisible = true;
@@ -223,6 +224,11 @@
     m_expression = null;
   }
 
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(this.m_qname);
+    }
+
   /**
    * Equality function specialized for the variable name.  If the argument
    * is not a qname, it will deligate to the super class.
@@ -231,6 +237,7 @@
    * @return  <code>true</code> if this object is the same as the obj
    *          argument; <code>false</code> otherwise.
    */
+  @Override
   public boolean equals(Object obj)
   {
     if(obj instanceof QName)