8013900: More warnings compiling jaxp

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
This commit is contained in:
Daniel Fuchs 2013-05-17 10:40:21 +02:00
parent 8620b1e2d7
commit 98c17c258e
18 changed files with 1496 additions and 974 deletions

View file

@ -97,8 +97,14 @@ public final class BasicType extends Type {
/** @return true if both type objects refer to the same type /** @return true if both type objects refer to the same type
*/ */
@Override
public boolean equals(Object type) { public boolean equals(Object type) {
return (type instanceof BasicType)? return (type instanceof BasicType)?
((BasicType)type).type == this.type : false; ((BasicType)type).type == this.type : false;
} }
@Override
public int hashCode() {
return type;
}
} }

View file

@ -93,6 +93,7 @@ public abstract class BranchInstruction extends Instruction implements Instructi
* Dump instruction as byte code to stream out. * Dump instruction as byte code to stream out.
* @param out Output stream * @param out Output stream
*/ */
@Override
public void dump(DataOutputStream out) throws IOException { public void dump(DataOutputStream out) throws IOException {
out.writeByte(opcode); out.writeByte(opcode);
@ -153,6 +154,7 @@ public abstract class BranchInstruction extends Instruction implements Instructi
* @param verbose long/short format switch * @param verbose long/short format switch
* @return mnemonic for instruction * @return mnemonic for instruction
*/ */
@Override
public String toString(boolean verbose) { public String toString(boolean verbose) {
String s = super.toString(verbose); String s = super.toString(verbose);
String t = "null"; String t = "null";
@ -184,6 +186,7 @@ public abstract class BranchInstruction extends Instruction implements Instructi
* @param wide wide prefix? * @param wide wide prefix?
* @see InstructionList * @see InstructionList
*/ */
@Override
protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException
{ {
length = 3; length = 3;
@ -204,26 +207,41 @@ public abstract class BranchInstruction extends Instruction implements Instructi
* Set branch target * Set branch target
* @param target branch target * @param target branch target
*/ */
public void setTarget(InstructionHandle target) { public final void setTarget(InstructionHandle target) {
notifyTarget(this.target, target, this); notifyTargetChanging(this.target, this);
this.target = target; 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) { InstructionTargeter t) {
if(old_ih != null) if(old_ih != null) {
old_ih.removeTargeter(t); 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); new_ih.addTargeter(t);
}
} }
/** /**
* @param old_ih old target * @param old_ih old target
* @param new_ih new target * @param new_ih new target
*/ */
@Override
public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) { public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
if(target == old_ih) if(target == old_ih)
setTarget(new_ih); setTarget(new_ih);
@ -234,6 +252,7 @@ public abstract class BranchInstruction extends Instruction implements Instructi
/** /**
* @return true, if ih is target of this instruction * @return true, if ih is target of this instruction
*/ */
@Override
public boolean containsTarget(InstructionHandle ih) { public boolean containsTarget(InstructionHandle ih) {
return (target == ih); return (target == ih);
} }
@ -241,6 +260,7 @@ public abstract class BranchInstruction extends Instruction implements Instructi
/** /**
* Inform target that it's not targeted anymore. * Inform target that it's not targeted anymore.
*/ */
@Override
void dispose() { void dispose() {
setTarget(null); setTarget(null);
index=-1; index=-1;

View file

@ -58,7 +58,6 @@ package com.sun.org.apache.bcel.internal.generic;
* <http://www.apache.org/>. * <http://www.apache.org/>.
*/ */
import com.sun.org.apache.bcel.internal.Constants;
import com.sun.org.apache.bcel.internal.classfile.*; import com.sun.org.apache.bcel.internal.classfile.*;
/** /**
@ -118,31 +117,35 @@ public final class CodeExceptionGen
/* Set start of handler /* Set start of handler
* @param start_pc Start of handled region (inclusive) * @param start_pc Start of handled region (inclusive)
*/ */
public void setStartPC(InstructionHandle start_pc) { public final void setStartPC(InstructionHandle start_pc) {
BranchInstruction.notifyTarget(this.start_pc, start_pc, this); BranchInstruction.notifyTargetChanging(this.start_pc, this);
this.start_pc = start_pc; this.start_pc = start_pc;
BranchInstruction.notifyTargetChanged(this.start_pc, this);
} }
/* Set end of handler /* Set end of handler
* @param end_pc End of handled region (inclusive) * @param end_pc End of handled region (inclusive)
*/ */
public void setEndPC(InstructionHandle end_pc) { public final void setEndPC(InstructionHandle end_pc) {
BranchInstruction.notifyTarget(this.end_pc, end_pc, this); BranchInstruction.notifyTargetChanging(this.end_pc, this);
this.end_pc = end_pc; this.end_pc = end_pc;
BranchInstruction.notifyTargetChanged(this.end_pc, this);
} }
/* Set handler code /* Set handler code
* @param handler_pc Start of handler * @param handler_pc Start of handler
*/ */
public void setHandlerPC(InstructionHandle handler_pc) { public final void setHandlerPC(InstructionHandle handler_pc) {
BranchInstruction.notifyTarget(this.handler_pc, handler_pc, this); BranchInstruction.notifyTargetChanging(this.handler_pc, this);
this.handler_pc = handler_pc; this.handler_pc = handler_pc;
BranchInstruction.notifyTargetChanged(this.handler_pc, this);
} }
/** /**
* @param old_ih old target, either start or end * @param old_ih old target, either start or end
* @param new_ih new target * @param new_ih new target
*/ */
@Override
public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) { public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
boolean targeted = false; boolean targeted = false;
@ -169,6 +172,7 @@ public final class CodeExceptionGen
/** /**
* @return true, if ih is target of this handler * @return true, if ih is target of this handler
*/ */
@Override
public boolean containsTarget(InstructionHandle ih) { public boolean containsTarget(InstructionHandle ih) {
return (start_pc == ih) || (end_pc == ih) || (handler_pc == ih); return (start_pc == ih) || (end_pc == ih) || (handler_pc == ih);
} }
@ -190,10 +194,12 @@ public final class CodeExceptionGen
*/ */
public InstructionHandle getHandlerPC() { return handler_pc; } public InstructionHandle getHandlerPC() { return handler_pc; }
@Override
public String toString() { public String toString() {
return "CodeExceptionGen(" + start_pc + ", " + end_pc + ", " + handler_pc + ")"; return "CodeExceptionGen(" + start_pc + ", " + end_pc + ", " + handler_pc + ")";
} }
@Override
public Object clone() { public Object clone() {
try { try {
return super.clone(); return super.clone();

View file

@ -58,7 +58,6 @@ package com.sun.org.apache.bcel.internal.generic;
* <http://www.apache.org/>. * <http://www.apache.org/>.
*/ */
import com.sun.org.apache.bcel.internal.Constants;
import com.sun.org.apache.bcel.internal.classfile.*; import com.sun.org.apache.bcel.internal.classfile.*;
/** /**
@ -88,6 +87,7 @@ public class LineNumberGen
/** /**
* @return true, if ih is target of this line number * @return true, if ih is target of this line number
*/ */
@Override
public boolean containsTarget(InstructionHandle ih) { public boolean containsTarget(InstructionHandle ih) {
return this.ih == ih; return this.ih == ih;
} }
@ -96,6 +96,7 @@ public class LineNumberGen
* @param old_ih old target * @param old_ih old target
* @param new_ih new target * @param new_ih new target
*/ */
@Override
public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) { public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
if(old_ih != ih) if(old_ih != ih)
throw new ClassGenException("Not targeting " + old_ih + ", but " + ih + "}"); throw new ClassGenException("Not targeting " + old_ih + ", but " + ih + "}");
@ -113,12 +114,13 @@ public class LineNumberGen
return new LineNumber(ih.getPosition(), src_line); return new LineNumber(ih.getPosition(), src_line);
} }
public void setInstruction(InstructionHandle ih) { public final void setInstruction(InstructionHandle ih) {
BranchInstruction.notifyTarget(this.ih, ih, this); BranchInstruction.notifyTargetChanging(this.ih, this);
this.ih = ih; this.ih = ih;
BranchInstruction.notifyTargetChanged(this.ih, this);
} }
@Override
public Object clone() { public Object clone() {
try { try {
return super.clone(); return super.clone();

View file

@ -60,6 +60,7 @@ package com.sun.org.apache.bcel.internal.generic;
import com.sun.org.apache.bcel.internal.Constants; import com.sun.org.apache.bcel.internal.Constants;
import com.sun.org.apache.bcel.internal.classfile.*; import com.sun.org.apache.bcel.internal.classfile.*;
import java.util.Objects;
/** /**
* This class represents a local variable within a method. It contains its * This class represents a local variable within a method. It contains its
@ -75,7 +76,7 @@ public class LocalVariableGen
implements InstructionTargeter, NamedAndTyped, Cloneable, implements InstructionTargeter, NamedAndTyped, Cloneable,
java.io.Serializable java.io.Serializable
{ {
private int index; private final int index;
private String name; private String name;
private Type type; private Type type;
private InstructionHandle start, end; private InstructionHandle start, end;
@ -131,30 +132,96 @@ public class LocalVariableGen
signature_index, index, cp.getConstantPool()); 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; } public void setName(String name) { this.name = name; }
@Override
public String getName() { return name; } public String getName() { return name; }
@Override
public void setType(Type type) { this.type = type; } public void setType(Type type) { this.type = type; }
@Override
public Type getType() { return type; } public Type getType() { return type; }
public InstructionHandle getStart() { return start; } public InstructionHandle getStart() { return start; }
public InstructionHandle getEnd() { return end; } public InstructionHandle getEnd() { return end; }
public void setStart(InstructionHandle start) { /**
BranchInstruction.notifyTarget(this.start, start, this); * Remove this from any known HashSet in which it might be registered.
this.start = start; */
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; 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 old_ih old target, either start or end
* @param new_ih new target * @param new_ih new target
*/ */
@Override
public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) { public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
boolean targeted = false; boolean targeted = false;
@ -176,15 +243,20 @@ public class LocalVariableGen
/** /**
* @return true, if ih is target of this variable * @return true, if ih is target of this variable
*/ */
@Override
public boolean containsTarget(InstructionHandle ih) { public boolean containsTarget(InstructionHandle ih) {
return (start == ih) || (end == 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. * are valid in the same range.
*/ */
@Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (o==this)
return true;
if(!(o instanceof LocalVariableGen)) if(!(o instanceof LocalVariableGen))
return false; return false;
@ -192,10 +264,21 @@ public class LocalVariableGen
return (l.index == index) && (l.start == start) && (l.end == end); 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() { public String toString() {
return "LocalVariableGen(" + name + ", " + type + ", " + start + ", " + end + ")"; return "LocalVariableGen(" + name + ", " + type + ", " + start + ", " + end + ")";
} }
@Override
public Object clone() { public Object clone() {
try { try {
return super.clone(); return super.clone();

View file

@ -58,7 +58,7 @@ package com.sun.org.apache.bcel.internal.generic;
* <http://www.apache.org/>. * <http://www.apache.org/>.
*/ */
import com.sun.org.apache.bcel.internal.Constants; 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. * Returnaddress, the type JSR or JSR_W instructions push upon the stack.
@ -86,9 +86,15 @@ public class ReturnaddressType extends Type {
this.returnTarget = returnTarget; this.returnTarget = returnTarget;
} }
@Override
public int hashCode() {
return Objects.hashCode(this.returnTarget);
}
/** /**
* Returns if the two Returnaddresses refer to the same target. * Returns if the two Returnaddresses refer to the same target.
*/ */
@Override
public boolean equals(Object rat){ public boolean equals(Object rat){
if(!(rat instanceof ReturnaddressType)) if(!(rat instanceof ReturnaddressType))
return false; return false;

View file

@ -97,8 +97,9 @@ public abstract class Select extends BranchInstruction
super(opcode, target); super(opcode, target);
this.targets = targets; this.targets = targets;
for(int i=0; i < targets.length; i++) for(int i=0; i < targets.length; i++) {
notifyTarget(null, targets[i], this); BranchInstruction.notifyTargetChanged(targets[i], this);
}
this.match = match; this.match = match;
@ -121,6 +122,7 @@ public abstract class Select extends BranchInstruction
* @param max_offset the maximum offset that may be caused by these instructions * @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 * @return additional offset caused by possible change of this instruction's length
*/ */
@Override
protected int updatePosition(int offset, int max_offset) { protected int updatePosition(int offset, int max_offset) {
position += offset; // Additional offset caused by preceding SWITCHs, GOTOs, etc. position += offset; // Additional offset caused by preceding SWITCHs, GOTOs, etc.
@ -138,6 +140,7 @@ public abstract class Select extends BranchInstruction
* Dump instruction as byte code to stream out. * Dump instruction as byte code to stream out.
* @param out Output stream * @param out Output stream
*/ */
@Override
public void dump(DataOutputStream out) throws IOException { public void dump(DataOutputStream out) throws IOException {
out.writeByte(opcode); out.writeByte(opcode);
@ -151,6 +154,7 @@ public abstract class Select extends BranchInstruction
/** /**
* Read needed data (e.g. index) from file. * Read needed data (e.g. index) from file.
*/ */
@Override
protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException
{ {
padding = (4 - (bytes.getIndex() % 4)) % 4; // Compute number of pad bytes padding = (4 - (bytes.getIndex() % 4)) % 4; // Compute number of pad bytes
@ -166,8 +170,9 @@ public abstract class Select extends BranchInstruction
/** /**
* @return mnemonic for instruction * @return mnemonic for instruction
*/ */
@Override
public String toString(boolean verbose) { public String toString(boolean verbose) {
StringBuffer buf = new StringBuffer(super.toString(verbose)); final StringBuilder buf = new StringBuilder(super.toString(verbose));
if(verbose) { if(verbose) {
for(int i=0; i < match_length; i++) { for(int i=0; i < match_length; i++) {
@ -176,7 +181,8 @@ public abstract class Select extends BranchInstruction
if(targets[i] != null) if(targets[i] != null)
s = targets[i].getInstruction().toString(); 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 else
@ -188,15 +194,17 @@ public abstract class Select extends BranchInstruction
/** /**
* Set branch target for `i'th case * Set branch target for `i'th case
*/ */
public void setTarget(int i, InstructionHandle target) { public final void setTarget(int i, InstructionHandle target) {
notifyTarget(targets[i], target, this); notifyTargetChanging(targets[i], this);
targets[i] = target; targets[i] = target;
notifyTargetChanged(targets[i], this);
} }
/** /**
* @param old_ih old target * @param old_ih old target
* @param new_ih new target * @param new_ih new target
*/ */
@Override
public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) { public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
boolean targeted = false; boolean targeted = false;
@ -219,6 +227,7 @@ public abstract class Select extends BranchInstruction
/** /**
* @return true, if ih is target of this instruction * @return true, if ih is target of this instruction
*/ */
@Override
public boolean containsTarget(InstructionHandle ih) { public boolean containsTarget(InstructionHandle ih) {
if(target == ih) if(target == ih)
return true; return true;
@ -233,6 +242,7 @@ public abstract class Select extends BranchInstruction
/** /**
* Inform targets that they're not targeted anymore. * Inform targets that they're not targeted anymore.
*/ */
@Override
void dispose() { void dispose() {
super.dispose(); super.dispose();

View file

@ -54,6 +54,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ReferenceType;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; 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.xsltc.compiler.util.TypeCheckError;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory; import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import java.util.Objects;
/** /**
* @author Jacek Ambroziak * @author Jacek Ambroziak
@ -156,8 +157,15 @@ class FunctionCall extends Expression {
this.type = type; this.type = type;
this.distance = distance; this.distance = distance;
} }
@Override
public int hashCode() {
return Objects.hashCode(this.type);
}
@Override
public boolean equals(Object query){ public boolean equals(Object query){
return query.equals(type); return query != null && query.equals(type);
} }
} }
@ -277,6 +285,7 @@ class FunctionCall extends Expression {
return(_fname.toString()); return(_fname.toString());
} }
@Override
public void setParser(Parser parser) { public void setParser(Parser parser) {
super.setParser(parser); super.setParser(parser);
if (_arguments != null) { if (_arguments != null) {
@ -319,6 +328,7 @@ class FunctionCall extends Expression {
* Type check a function call. Since different type conversions apply, * Type check a function call. Since different type conversions apply,
* type checking is different for standard and external (Java) functions. * type checking is different for standard and external (Java) functions.
*/ */
@Override
public Type typeCheck(SymbolTable stable) public Type typeCheck(SymbolTable stable)
throws TypeCheckError throws TypeCheckError
{ {
@ -680,6 +690,7 @@ class FunctionCall extends Expression {
* Compile the function call and treat as an expression * Compile the function call and treat as an expression
* Update true/false-lists. * Update true/false-lists.
*/ */
@Override
public void translateDesynthesized(ClassGenerator classGen, public void translateDesynthesized(ClassGenerator classGen,
MethodGenerator methodGen) MethodGenerator methodGen)
{ {
@ -700,6 +711,7 @@ class FunctionCall extends Expression {
* Translate a function call. The compiled code will leave the function's * Translate a function call. The compiled code will leave the function's
* return value on the JVM's stack. * return value on the JVM's stack.
*/ */
@Override
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final int n = argumentCount(); final int n = argumentCount();
final ConstantPoolGen cpg = classGen.getConstantPool(); final ConstantPoolGen cpg = classGen.getConstantPool();
@ -857,6 +869,7 @@ class FunctionCall extends Expression {
} }
} }
@Override
public String toString() { public String toString() {
return "funcall(" + _fname + ", " + _arguments + ')'; return "funcall(" + _fname + ", " + _arguments + ')';
} }
@ -1069,7 +1082,7 @@ class FunctionCall extends Expression {
protected static String replaceDash(String name) protected static String replaceDash(String name)
{ {
char dash = '-'; char dash = '-';
StringBuffer buff = new StringBuffer(""); final StringBuilder buff = new StringBuilder("");
for (int i = 0; i < name.length(); i++) { for (int i = 0; i < name.length(); i++) {
if (i > 0 && name.charAt(i-1) == dash) if (i > 0 && name.charAt(i-1) == dash)
buff.append(Character.toUpperCase(name.charAt(i))); buff.append(Character.toUpperCase(name.charAt(i)));

View file

@ -25,6 +25,7 @@ package com.sun.org.apache.xalan.internal.xsltc.compiler;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; 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.xsltc.compiler.util.TypeCheckError;
import java.util.Objects;
/** /**
* @author Morten Jorgensen * @author Morten Jorgensen
@ -97,13 +98,15 @@ class VariableRefBase extends Expression {
* Two variable references are deemed equal if they refer to the * Two variable references are deemed equal if they refer to the
* same variable. * same variable.
*/ */
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
try { return obj == this || (obj instanceof VariableRefBase)
return (_variable == ((VariableRefBase) obj)._variable); && (_variable == ((VariableRefBase) obj)._variable);
} }
catch (ClassCastException e) {
return false; @Override
} public int hashCode() {
return Objects.hashCode(this._variable);
} }
/** /**
@ -111,10 +114,12 @@ class VariableRefBase extends Expression {
* format 'variable-ref(<var-name>)'. * format 'variable-ref(<var-name>)'.
* @return Variable reference description * @return Variable reference description
*/ */
@Override
public String toString() { public String toString() {
return "variable-ref("+_variable.getName()+'/'+_variable.getType()+')'; return "variable-ref("+_variable.getName()+'/'+_variable.getType()+')';
} }
@Override
public Type typeCheck(SymbolTable stable) public Type typeCheck(SymbolTable stable)
throws TypeCheckError throws TypeCheckError
{ {

View file

@ -26,6 +26,7 @@ import java.math.BigInteger;
import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException; 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.impl.dv.ValidationContext;
import com.sun.org.apache.xerces.internal.xs.datatypes.XSDecimal; import com.sun.org.apache.xerces.internal.xs.datatypes.XSDecimal;
import java.util.Objects;
/** /**
* Represent the schema type "decimal" * Represent the schema type "decimal"
@ -38,10 +39,12 @@ import com.sun.org.apache.xerces.internal.xs.datatypes.XSDecimal;
*/ */
public class DecimalDV extends TypeValidator { public class DecimalDV extends TypeValidator {
@Override
public final short getAllowedFacets(){ 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); 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 { public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
try { try {
return new XDecimal(content); return new XDecimal(content);
@ -50,20 +53,23 @@ public class DecimalDV extends TypeValidator {
} }
} }
@Override
public final int compare(Object value1, Object value2){ public final int compare(Object value1, Object value2){
return ((XDecimal)value1).compareTo((XDecimal)value2); return ((XDecimal)value1).compareTo((XDecimal)value2);
} }
@Override
public final int getTotalDigits(Object value){ public final int getTotalDigits(Object value){
return ((XDecimal)value).totalDigits; return ((XDecimal)value).totalDigits;
} }
@Override
public final int getFractionDigits(Object value){ public final int getFractionDigits(Object value){
return ((XDecimal)value).fracDigits; return ((XDecimal)value).fracDigits;
} }
// Avoid using the heavy-weight java.math.BigDecimal // 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 // sign: 0 for vlaue 0; 1 for positive values; -1 for negative values
int sign = 1; int sign = 1;
// total digits. >= 1 // total digits. >= 1
@ -216,6 +222,8 @@ public class DecimalDV extends TypeValidator {
integer = true; integer = true;
} }
@Override
public boolean equals(Object val) { public boolean equals(Object val) {
if (val == this) if (val == this)
return true; return true;
@ -232,6 +240,19 @@ public class DecimalDV extends TypeValidator {
return intDigits == oval.intDigits && fracDigits == oval.fracDigits && return intDigits == oval.intDigits && fracDigits == oval.fracDigits &&
ivalue.equals(oval.ivalue) && fvalue.equals(oval.fvalue); 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) { public int compareTo(XDecimal val) {
if (sign != val.sign) if (sign != val.sign)
return sign > val.sign ? 1 : -1; return sign > val.sign ? 1 : -1;
@ -248,7 +269,9 @@ public class DecimalDV extends TypeValidator {
ret = fvalue.compareTo(val.fvalue); ret = fvalue.compareTo(val.fvalue);
return ret == 0 ? 0 : (ret > 0 ? 1 : -1); return ret == 0 ? 0 : (ret > 0 ? 1 : -1);
} }
private String canonical; private String canonical;
@Override
public synchronized String toString() { public synchronized String toString() {
if (canonical == null) { if (canonical == null) {
makeCanonical(); makeCanonical();
@ -269,7 +292,7 @@ public class DecimalDV extends TypeValidator {
return; return;
} }
// for -0.1, total digits is 1, so we need 3 extra spots // 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) if (sign == -1)
buffer.append('-'); buffer.append('-');
if (intDigits != 0) if (intDigits != 0)
@ -288,6 +311,7 @@ public class DecimalDV extends TypeValidator {
canonical = buffer.toString(); canonical = buffer.toString();
} }
@Override
public BigDecimal getBigDecimal() { public BigDecimal getBigDecimal() {
if (sign == 0) { if (sign == 0) {
return new BigDecimal(BigInteger.ZERO); return new BigDecimal(BigInteger.ZERO);
@ -295,6 +319,7 @@ public class DecimalDV extends TypeValidator {
return new BigDecimal(toString()); return new BigDecimal(toString());
} }
@Override
public BigInteger getBigInteger() throws NumberFormatException { public BigInteger getBigInteger() throws NumberFormatException {
if (fracDigits != 0) { if (fracDigits != 0) {
throw new NumberFormatException(); throw new NumberFormatException();
@ -308,6 +333,7 @@ public class DecimalDV extends TypeValidator {
return new BigInteger("-" + ivalue); return new BigInteger("-" + ivalue);
} }
@Override
public long getLong() throws NumberFormatException { public long getLong() throws NumberFormatException {
if (fracDigits != 0) { if (fracDigits != 0) {
throw new NumberFormatException(); throw new NumberFormatException();
@ -321,6 +347,7 @@ public class DecimalDV extends TypeValidator {
return Long.parseLong("-" + ivalue); return Long.parseLong("-" + ivalue);
} }
@Override
public int getInt() throws NumberFormatException { public int getInt() throws NumberFormatException {
if (fracDigits != 0) { if (fracDigits != 0) {
throw new NumberFormatException(); throw new NumberFormatException();
@ -334,6 +361,7 @@ public class DecimalDV extends TypeValidator {
return Integer.parseInt("-" + ivalue); return Integer.parseInt("-" + ivalue);
} }
@Override
public short getShort() throws NumberFormatException { public short getShort() throws NumberFormatException {
if (fracDigits != 0) { if (fracDigits != 0) {
throw new NumberFormatException(); throw new NumberFormatException();
@ -347,6 +375,7 @@ public class DecimalDV extends TypeValidator {
return Short.parseShort("-" + ivalue); return Short.parseShort("-" + ivalue);
} }
@Override
public byte getByte() throws NumberFormatException { public byte getByte() throws NumberFormatException {
if (fracDigits != 0) { if (fracDigits != 0) {
throw new NumberFormatException(); throw new NumberFormatException();

View file

@ -32,7 +32,7 @@ import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext;
*/ */
class PrecisionDecimalDV extends TypeValidator { 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) // sign: 0 for absent; 1 for positive values; -1 for negative values (except in case of INF, -INF)
int sign = 1; int sign = 1;
@ -144,7 +144,71 @@ class PrecisionDecimalDV extends TypeValidator {
totalDigits = intDigits + fracDigits; 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) { public boolean equals(Object val) {
if (val == this) if (val == this)
return true; return true;
@ -156,6 +220,20 @@ class PrecisionDecimalDV extends TypeValidator {
return this.compareTo(oval) == EQUAL; 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 * @return
*/ */
@ -295,6 +373,7 @@ class PrecisionDecimalDV extends TypeValidator {
private String canonical; private String canonical;
@Override
public synchronized String toString() { public synchronized String toString() {
if (canonical == null) { if (canonical == null) {
makeCanonical(); makeCanonical();
@ -325,6 +404,7 @@ class PrecisionDecimalDV extends TypeValidator {
/* (non-Javadoc) /* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.impl.dv.xs.TypeValidator#getAllowedFacets() * @see com.sun.org.apache.xerces.internal.impl.dv.xs.TypeValidator#getAllowedFacets()
*/ */
@Override
public short getAllowedFacets() { 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); 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 @@ class PrecisionDecimalDV extends TypeValidator {
/* (non-Javadoc) /* (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) * @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) public Object getActualValue(String content, ValidationContext context)
throws InvalidDatatypeValueException { throws InvalidDatatypeValueException {
try { try {
@ -341,18 +422,22 @@ class PrecisionDecimalDV extends TypeValidator {
} }
} }
@Override
public int compare(Object value1, Object value2) { public int compare(Object value1, Object value2) {
return ((XPrecisionDecimal)value1).compareTo((XPrecisionDecimal)value2); return ((XPrecisionDecimal)value1).compareTo((XPrecisionDecimal)value2);
} }
@Override
public int getFractionDigits(Object value) { public int getFractionDigits(Object value) {
return ((XPrecisionDecimal)value).fracDigits; return ((XPrecisionDecimal)value).fracDigits;
} }
@Override
public int getTotalDigits(Object value) { public int getTotalDigits(Object value) {
return ((XPrecisionDecimal)value).totalDigits; return ((XPrecisionDecimal)value).totalDigits;
} }
@Override
public boolean isIdentical(Object value1, Object value2) { public boolean isIdentical(Object value1, Object value2) {
if(!(value2 instanceof XPrecisionDecimal) || !(value1 instanceof XPrecisionDecimal)) if(!(value2 instanceof XPrecisionDecimal) || !(value1 instanceof XPrecisionDecimal))
return false; return false;

View file

@ -22,6 +22,7 @@ package com.sun.org.apache.xerces.internal.util;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects;
/********************************************************************** /**********************************************************************
* A class to represent a Uniform Resource Identifier (URI). This class * A class to represent a Uniform Resource Identifier (URI). This class
@ -1212,7 +1213,7 @@ import java.io.Serializable;
* @return the scheme-specific part for this URI * @return the scheme-specific part for this URI
*/ */
public String getSchemeSpecificPart() { public String getSchemeSpecificPart() {
StringBuffer schemespec = new StringBuffer(); final StringBuilder schemespec = new StringBuilder();
if (m_host != null || m_regAuthority != null) { if (m_host != null || m_regAuthority != null) {
schemespec.append("//"); schemespec.append("//");
@ -1297,7 +1298,7 @@ import java.io.Serializable;
* @return the authority * @return the authority
*/ */
public String getAuthority() { public String getAuthority() {
StringBuffer authority = new StringBuffer(); final StringBuilder authority = new StringBuilder();
if (m_host != null || m_regAuthority != null) { if (m_host != null || m_regAuthority != null) {
authority.append("//"); authority.append("//");
@ -1340,7 +1341,7 @@ import java.io.Serializable;
*/ */
public String getPath(boolean p_includeQueryString, public String getPath(boolean p_includeQueryString,
boolean p_includeFragment) { boolean p_includeFragment) {
StringBuffer pathString = new StringBuffer(m_path); final StringBuilder pathString = new StringBuilder(m_path);
if (p_includeQueryString && m_queryString != null) { if (p_includeQueryString && m_queryString != null) {
pathString.append('?'); pathString.append('?');
@ -1683,6 +1684,7 @@ import java.io.Serializable;
* @return true if p_test is a URI with all values equal to this * @return true if p_test is a URI with all values equal to this
* URI, false otherwise * URI, false otherwise
*/ */
@Override
public boolean equals(Object p_test) { public boolean equals(Object p_test) {
if (p_test instanceof URI) { if (p_test instanceof URI) {
URI testURI = (URI) p_test; URI testURI = (URI) p_test;
@ -1711,13 +1713,27 @@ import java.io.Serializable;
return false; 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. * Get the URI as a string specification. See RFC 2396 Section 5.2.
* *
* @return the URI string specification * @return the URI string specification
*/ */
@Override
public String toString() { public String toString() {
StringBuffer uriSpecString = new StringBuffer(); final StringBuilder uriSpecString = new StringBuilder();
if (m_scheme != null) { if (m_scheme != null) {
uriSpecString.append(m_scheme); uriSpecString.append(m_scheme);

View file

@ -68,6 +68,7 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
import com.sun.org.apache.xerces.internal.xpointer.XPointerHandler; 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.xpointer.XPointerProcessor;
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; import com.sun.org.apache.xerces.internal.utils.ObjectFactory;
import java.util.Objects;
/** /**
* <p> * <p>
@ -390,6 +391,7 @@ public class XIncludeHandler
// XMLComponent methods // XMLComponent methods
@Override
public void reset(XMLComponentManager componentManager) public void reset(XMLComponentManager componentManager)
throws XNIException { throws XNIException {
fNamespaceContext = null; fNamespaceContext = null;
@ -597,6 +599,7 @@ public class XIncludeHandler
* this component. This method may return null if no features * this component. This method may return null if no features
* are recognized by this component. * are recognized by this component.
*/ */
@Override
public String[] getRecognizedFeatures() { public String[] getRecognizedFeatures() {
return (String[])(RECOGNIZED_FEATURES.clone()); return (String[])(RECOGNIZED_FEATURES.clone());
} // getRecognizedFeatures():String[] } // getRecognizedFeatures():String[]
@ -616,6 +619,7 @@ public class XIncludeHandler
* @throws SAXNotSupportedException The component should not throw * @throws SAXNotSupportedException The component should not throw
* this exception. * this exception.
*/ */
@Override
public void setFeature(String featureId, boolean state) public void setFeature(String featureId, boolean state)
throws XMLConfigurationException { throws XMLConfigurationException {
if (featureId.equals(ALLOW_UE_AND_NOTATION_EVENTS)) { if (featureId.equals(ALLOW_UE_AND_NOTATION_EVENTS)) {
@ -632,6 +636,7 @@ public class XIncludeHandler
* this component. This method may return null if no properties * this component. This method may return null if no properties
* are recognized by this component. * are recognized by this component.
*/ */
@Override
public String[] getRecognizedProperties() { public String[] getRecognizedProperties() {
return (String[])(RECOGNIZED_PROPERTIES.clone()); return (String[])(RECOGNIZED_PROPERTIES.clone());
} // getRecognizedProperties():String[] } // getRecognizedProperties():String[]
@ -651,6 +656,7 @@ public class XIncludeHandler
* @throws SAXNotSupportedException The component should not throw * @throws SAXNotSupportedException The component should not throw
* this exception. * this exception.
*/ */
@Override
public void setProperty(String propertyId, Object value) public void setProperty(String propertyId, Object value)
throws XMLConfigurationException { throws XMLConfigurationException {
if (propertyId.equals(SYMBOL_TABLE)) { if (propertyId.equals(SYMBOL_TABLE)) {
@ -719,6 +725,7 @@ public class XIncludeHandler
* *
* @since Xerces 2.2.0 * @since Xerces 2.2.0
*/ */
@Override
public Boolean getFeatureDefault(String featureId) { public Boolean getFeatureDefault(String featureId) {
for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) { for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {
if (RECOGNIZED_FEATURES[i].equals(featureId)) { if (RECOGNIZED_FEATURES[i].equals(featureId)) {
@ -737,6 +744,7 @@ public class XIncludeHandler
* *
* @since Xerces 2.2.0 * @since Xerces 2.2.0
*/ */
@Override
public Object getPropertyDefault(String propertyId) { public Object getPropertyDefault(String propertyId) {
for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) { for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) {
if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) { if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) {
@ -746,10 +754,12 @@ public class XIncludeHandler
return null; return null;
} // getPropertyDefault(String):Object } // getPropertyDefault(String):Object
@Override
public void setDocumentHandler(XMLDocumentHandler handler) { public void setDocumentHandler(XMLDocumentHandler handler) {
fDocumentHandler = handler; fDocumentHandler = handler;
} }
@Override
public XMLDocumentHandler getDocumentHandler() { public XMLDocumentHandler getDocumentHandler() {
return fDocumentHandler; return fDocumentHandler;
} }
@ -764,6 +774,7 @@ public class XIncludeHandler
* *
* This event is only passed on to the document handler if this is the root document. * This event is only passed on to the document handler if this is the root document.
*/ */
@Override
public void startDocument( public void startDocument(
XMLLocator locator, XMLLocator locator,
String encoding, String encoding,
@ -811,6 +822,7 @@ public class XIncludeHandler
} }
} }
@Override
public void xmlDecl( public void xmlDecl(
String version, String version,
String encoding, String encoding,
@ -823,6 +835,7 @@ public class XIncludeHandler
} }
} }
@Override
public void doctypeDecl( public void doctypeDecl(
String rootElement, String rootElement,
String publicId, String publicId,
@ -834,6 +847,7 @@ public class XIncludeHandler
} }
} }
@Override
public void comment(XMLString text, Augmentations augs) public void comment(XMLString text, Augmentations augs)
throws XNIException { throws XNIException {
if (!fInDTD) { if (!fInDTD) {
@ -850,6 +864,7 @@ public class XIncludeHandler
} }
} }
@Override
public void processingInstruction( public void processingInstruction(
String target, String target,
XMLString data, XMLString data,
@ -870,6 +885,7 @@ public class XIncludeHandler
} }
} }
@Override
public void startElement( public void startElement(
QName element, QName element,
XMLAttributes attributes, XMLAttributes attributes,
@ -940,6 +956,7 @@ public class XIncludeHandler
} }
} }
@Override
public void emptyElement( public void emptyElement(
QName element, QName element,
XMLAttributes attributes, XMLAttributes attributes,
@ -1021,6 +1038,7 @@ public class XIncludeHandler
fDepth--; fDepth--;
} }
@Override
public void endElement(QName element, Augmentations augs) public void endElement(QName element, Augmentations augs)
throws XNIException { throws XNIException {
@ -1066,6 +1084,7 @@ public class XIncludeHandler
fDepth--; fDepth--;
} }
@Override
public void startGeneralEntity( public void startGeneralEntity(
String name, String name,
XMLResourceIdentifier resId, XMLResourceIdentifier resId,
@ -1084,6 +1103,7 @@ public class XIncludeHandler
} }
} }
@Override
public void textDecl(String version, String encoding, Augmentations augs) public void textDecl(String version, String encoding, Augmentations augs)
throws XNIException { throws XNIException {
if (fDocumentHandler != null if (fDocumentHandler != null
@ -1092,6 +1112,7 @@ public class XIncludeHandler
} }
} }
@Override
public void endGeneralEntity(String name, Augmentations augs) public void endGeneralEntity(String name, Augmentations augs)
throws XNIException { throws XNIException {
if (fDocumentHandler != null if (fDocumentHandler != null
@ -1101,6 +1122,7 @@ public class XIncludeHandler
} }
} }
@Override
public void characters(XMLString text, Augmentations augs) public void characters(XMLString text, Augmentations augs)
throws XNIException { throws XNIException {
if (getState() == STATE_NORMAL_PROCESSING) { if (getState() == STATE_NORMAL_PROCESSING) {
@ -1117,6 +1139,7 @@ public class XIncludeHandler
} }
} }
@Override
public void ignorableWhitespace(XMLString text, Augmentations augs) public void ignorableWhitespace(XMLString text, Augmentations augs)
throws XNIException { throws XNIException {
if (fDocumentHandler != null if (fDocumentHandler != null
@ -1126,6 +1149,7 @@ public class XIncludeHandler
} }
} }
@Override
public void startCDATA(Augmentations augs) throws XNIException { public void startCDATA(Augmentations augs) throws XNIException {
if (fDocumentHandler != null if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING && getState() == STATE_NORMAL_PROCESSING
@ -1134,6 +1158,7 @@ public class XIncludeHandler
} }
} }
@Override
public void endCDATA(Augmentations augs) throws XNIException { public void endCDATA(Augmentations augs) throws XNIException {
if (fDocumentHandler != null if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING && getState() == STATE_NORMAL_PROCESSING
@ -1142,6 +1167,7 @@ public class XIncludeHandler
} }
} }
@Override
public void endDocument(Augmentations augs) throws XNIException { public void endDocument(Augmentations augs) throws XNIException {
if (isRootDocument()) { if (isRootDocument()) {
if (!fSeenRootElement) { if (!fSeenRootElement) {
@ -1153,10 +1179,12 @@ public class XIncludeHandler
} }
} }
@Override
public void setDocumentSource(XMLDocumentSource source) { public void setDocumentSource(XMLDocumentSource source) {
fDocumentSource = source; fDocumentSource = source;
} }
@Override
public XMLDocumentSource getDocumentSource() { public XMLDocumentSource getDocumentSource() {
return fDocumentSource; return fDocumentSource;
} }
@ -1168,6 +1196,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (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) * @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( public void attributeDecl(
String elementName, String elementName,
String attributeName, String attributeName,
@ -1194,6 +1223,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (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) * @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( public void elementDecl(
String name, String name,
String contentModel, String contentModel,
@ -1207,6 +1237,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endAttlist(com.sun.org.apache.xerces.internal.xni.Augmentations) * @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 { public void endAttlist(Augmentations augmentations) throws XNIException {
if (fDTDHandler != null) { if (fDTDHandler != null) {
fDTDHandler.endAttlist(augmentations); fDTDHandler.endAttlist(augmentations);
@ -1216,6 +1247,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endConditional(com.sun.org.apache.xerces.internal.xni.Augmentations) * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endConditional(com.sun.org.apache.xerces.internal.xni.Augmentations)
*/ */
@Override
public void endConditional(Augmentations augmentations) public void endConditional(Augmentations augmentations)
throws XNIException { throws XNIException {
if (fDTDHandler != null) { if (fDTDHandler != null) {
@ -1226,6 +1258,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endDTD(com.sun.org.apache.xerces.internal.xni.Augmentations) * @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 { public void endDTD(Augmentations augmentations) throws XNIException {
if (fDTDHandler != null) { if (fDTDHandler != null) {
fDTDHandler.endDTD(augmentations); fDTDHandler.endDTD(augmentations);
@ -1236,6 +1269,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endExternalSubset(com.sun.org.apache.xerces.internal.xni.Augmentations) * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endExternalSubset(com.sun.org.apache.xerces.internal.xni.Augmentations)
*/ */
@Override
public void endExternalSubset(Augmentations augmentations) public void endExternalSubset(Augmentations augmentations)
throws XNIException { throws XNIException {
if (fDTDHandler != null) { if (fDTDHandler != null) {
@ -1246,6 +1280,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endParameterEntity(java.lang.String, com.sun.org.apache.xerces.internal.xni.Augmentations) * @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) public void endParameterEntity(String name, Augmentations augmentations)
throws XNIException { throws XNIException {
if (fDTDHandler != null) { if (fDTDHandler != null) {
@ -1256,6 +1291,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (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) * @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( public void externalEntityDecl(
String name, String name,
XMLResourceIdentifier identifier, XMLResourceIdentifier identifier,
@ -1269,6 +1305,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#getDTDSource() * @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#getDTDSource()
*/ */
@Override
public XMLDTDSource getDTDSource() { public XMLDTDSource getDTDSource() {
return fDTDSource; return fDTDSource;
} }
@ -1276,6 +1313,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (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) * @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) public void ignoredCharacters(XMLString text, Augmentations augmentations)
throws XNIException { throws XNIException {
if (fDTDHandler != null) { if (fDTDHandler != null) {
@ -1286,6 +1324,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (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) * @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( public void internalEntityDecl(
String name, String name,
XMLString text, XMLString text,
@ -1304,6 +1343,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (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) * @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( public void notationDecl(
String name, String name,
XMLResourceIdentifier identifier, XMLResourceIdentifier identifier,
@ -1318,6 +1358,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#setDTDSource(com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource) * @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) { public void setDTDSource(XMLDTDSource source) {
fDTDSource = source; fDTDSource = source;
} }
@ -1325,6 +1366,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#startAttlist(java.lang.String, com.sun.org.apache.xerces.internal.xni.Augmentations) * @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) public void startAttlist(String elementName, Augmentations augmentations)
throws XNIException { throws XNIException {
if (fDTDHandler != null) { if (fDTDHandler != null) {
@ -1335,6 +1377,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#startConditional(short, com.sun.org.apache.xerces.internal.xni.Augmentations) * @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) public void startConditional(short type, Augmentations augmentations)
throws XNIException { throws XNIException {
if (fDTDHandler != null) { if (fDTDHandler != null) {
@ -1345,6 +1388,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (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) * @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) public void startDTD(XMLLocator locator, Augmentations augmentations)
throws XNIException { throws XNIException {
fInDTD = true; fInDTD = true;
@ -1356,6 +1400,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (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) * @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( public void startExternalSubset(
XMLResourceIdentifier identifier, XMLResourceIdentifier identifier,
Augmentations augmentations) Augmentations augmentations)
@ -1368,6 +1413,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (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) * @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( public void startParameterEntity(
String name, String name,
XMLResourceIdentifier identifier, XMLResourceIdentifier identifier,
@ -1386,6 +1432,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (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) * @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( public void unparsedEntityDecl(
String name, String name,
XMLResourceIdentifier identifier, XMLResourceIdentifier identifier,
@ -1405,6 +1452,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource#getDTDHandler() * @see com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource#getDTDHandler()
*/ */
@Override
public XMLDTDHandler getDTDHandler() { public XMLDTDHandler getDTDHandler() {
return fDTDHandler; return fDTDHandler;
} }
@ -1412,6 +1460,7 @@ public class XIncludeHandler
/* (non-Javadoc) /* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource#setDTDHandler(com.sun.org.apache.xerces.internal.xni.XMLDTDHandler) * @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) { public void setDTDHandler(XMLDTDHandler handler) {
fDTDHandler = handler; fDTDHandler = handler;
} }
@ -1641,11 +1690,10 @@ public class XIncludeHandler
fNamespaceContext); fNamespaceContext);
((XPointerHandler)fXPtrProcessor).setProperty(XINCLUDE_FIXUP_BASE_URIS, ((XPointerHandler)fXPtrProcessor).setProperty(XINCLUDE_FIXUP_BASE_URIS,
new Boolean(fFixupBaseURIs)); fFixupBaseURIs);
((XPointerHandler)fXPtrProcessor).setProperty( ((XPointerHandler)fXPtrProcessor).setProperty(
XINCLUDE_FIXUP_LANGUAGE, XINCLUDE_FIXUP_LANGUAGE, fFixupLanguage);
new Boolean (fFixupLanguage));
if (fErrorReporter != null) if (fErrorReporter != null)
((XPointerHandler)fXPtrProcessor).setProperty(ERROR_REPORTER, fErrorReporter); ((XPointerHandler)fXPtrProcessor).setProperty(ERROR_REPORTER, fErrorReporter);
@ -2119,14 +2167,14 @@ public class XIncludeHandler
/** Check whether the scheme components are equal. */ /** Check whether the scheme components are equal. */
final String baseScheme = base.getScheme(); final String baseScheme = base.getScheme();
final String literalScheme = uri.getScheme(); final String literalScheme = uri.getScheme();
if (!isEqual(baseScheme, literalScheme)) { if (!Objects.equals(baseScheme, literalScheme)) {
return relativeURI; return relativeURI;
} }
/** Check whether the authority components are equal. */ /** Check whether the authority components are equal. */
final String baseAuthority = base.getAuthority(); final String baseAuthority = base.getAuthority();
final String literalAuthority = uri.getAuthority(); final String literalAuthority = uri.getAuthority();
if (!isEqual(baseAuthority, literalAuthority)) { if (!Objects.equals(baseAuthority, literalAuthority)) {
return uri.getSchemeSpecificPart(); return uri.getSchemeSpecificPart();
} }
@ -2139,7 +2187,7 @@ public class XIncludeHandler
final String literalQuery = uri.getQueryString(); final String literalQuery = uri.getQueryString();
final String literalFragment = uri.getFragment(); final String literalFragment = uri.getFragment();
if (literalQuery != null || literalFragment != null) { if (literalQuery != null || literalFragment != null) {
StringBuffer buffer = new StringBuffer(); final StringBuilder buffer = new StringBuilder();
if (literalPath != null) { if (literalPath != null) {
buffer.append(literalPath); buffer.append(literalPath);
} }
@ -2650,15 +2698,15 @@ public class XIncludeHandler
// equals() returns true if two Notations have the same name. // equals() returns true if two Notations have the same name.
// Useful for searching Vectors for notations with the same name // Useful for searching Vectors for notations with the same name
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null) { return obj == this || obj instanceof Notation
return false; && Objects.equals(name, ((Notation)obj).name);
} }
if (obj instanceof Notation) {
Notation other = (Notation)obj; @Override
return name.equals(other.name); public int hashCode() {
} return Objects.hashCode(name);
return false;
} }
// from 4.5.2 // from 4.5.2
@ -2671,16 +2719,12 @@ public class XIncludeHandler
public boolean isDuplicate(Object obj) { public boolean isDuplicate(Object obj) {
if (obj != null && obj instanceof Notation) { if (obj != null && obj instanceof Notation) {
Notation other = (Notation)obj; Notation other = (Notation)obj;
return name.equals(other.name) return Objects.equals(name, other.name)
&& isEqual(publicId, other.publicId) && Objects.equals(publicId, other.publicId)
&& isEqual(expandedSystemId, other.expandedSystemId); && Objects.equals(expandedSystemId, other.expandedSystemId);
} }
return false; 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. // This is a storage class to hold information about the unparsed entities.
@ -2696,15 +2740,15 @@ public class XIncludeHandler
// equals() returns true if two UnparsedEntities have the same name. // equals() returns true if two UnparsedEntities have the same name.
// Useful for searching Vectors for entities with the same name // Useful for searching Vectors for entities with the same name
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null) { return obj == this || obj instanceof UnparsedEntity
return false; && Objects.equals(name, ((UnparsedEntity)obj).name);
} }
if (obj instanceof UnparsedEntity) {
UnparsedEntity other = (UnparsedEntity)obj; @Override
return name.equals(other.name); public int hashCode() {
} return Objects.hashCode(name);
return false;
} }
// from 4.5.1: // from 4.5.1:
@ -2717,17 +2761,13 @@ public class XIncludeHandler
public boolean isDuplicate(Object obj) { public boolean isDuplicate(Object obj) {
if (obj != null && obj instanceof UnparsedEntity) { if (obj != null && obj instanceof UnparsedEntity) {
UnparsedEntity other = (UnparsedEntity)obj; UnparsedEntity other = (UnparsedEntity)obj;
return name.equals(other.name) return Objects.equals(name, other.name)
&& isEqual(publicId, other.publicId) && Objects.equals(publicId, other.publicId)
&& isEqual(expandedSystemId, other.expandedSystemId) && Objects.equals(expandedSystemId, other.expandedSystemId)
&& isEqual(notation, other.notation); && Objects.equals(notation, other.notation);
} }
return false; 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 // The following methods are used for XML Base processing
@ -2917,17 +2957,13 @@ public class XIncludeHandler
return httpSource; return httpSource;
} }
private boolean isEqual(String one, String two) {
return (one == two || (one != null && one.equals(two)));
}
// which ASCII characters need to be escaped // 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 // 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 // the second hex character if a character needs to be escaped
private static char gAfterEscaping2[] = new char[128]; private static final char gAfterEscaping2[] = new char[128];
private static char[] gHexChs = {'0', '1', '2', '3', '4', '5', '6', '7', private static final char[] gHexChs = {'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
// initialize the above 3 arrays // initialize the above 3 arrays
static { static {
@ -2957,7 +2993,7 @@ public class XIncludeHandler
private String escapeHref(String href) { private String escapeHref(String href) {
int len = href.length(); int len = href.length();
int ch; int ch;
StringBuffer buffer = new StringBuffer(len*3); final StringBuilder buffer = new StringBuilder(len*3);
// for each character in the href // for each character in the href
int i = 0; int i = 0;

View file

@ -27,6 +27,7 @@ import java.util.Vector;
import com.sun.org.apache.xml.internal.dtm.DTM; import com.sun.org.apache.xml.internal.dtm.DTM;
import com.sun.org.apache.xml.internal.dtm.DTMDOMException; import com.sun.org.apache.xml.internal.dtm.DTMDOMException;
import com.sun.org.apache.xpath.internal.NodeSet; import com.sun.org.apache.xpath.internal.NodeSet;
import java.util.Objects;
import org.w3c.dom.Attr; import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection; import org.w3c.dom.CDATASection;
@ -141,21 +142,21 @@ public class DTMNodeProxy
* *
* @return true if the given node has the same handle as this node. * @return true if the given node has the same handle as this node.
*/ */
@Override
public final boolean equals(Object node) public final boolean equals(Object node)
{ {
try
{
// DTMNodeProxy dtmp = (DTMNodeProxy)node; // DTMNodeProxy dtmp = (DTMNodeProxy)node;
// return (dtmp.node == this.node); // return (dtmp.node == this.node);
// Patch attributed to Gary L Peskin <garyp@firstech.com> // Patch attributed to Gary L Peskin <garyp@firstech.com>
return equals((Node) node); return node instanceof Node && equals((Node) node);
} }
catch (ClassCastException cce)
{ @Override
return false; public int hashCode() {
} int hash = 7;
hash = 29 * hash + Objects.hashCode(this.dtm);
hash = 29 * hash + this.node;
return hash;
} }
/** /**
@ -181,6 +182,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Node * @see org.w3c.dom.Node
*/ */
@Override
public final String getNodeName() public final String getNodeName()
{ {
return dtm.getNodeName(node); return dtm.getNodeName(node);
@ -199,6 +201,7 @@ public class DTMNodeProxy
* *
* *
*/ */
@Override
public final String getTarget() public final String getTarget()
{ {
return dtm.getNodeName(node); return dtm.getNodeName(node);
@ -209,6 +212,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Node as of DOM Level 2 * @see org.w3c.dom.Node as of DOM Level 2
*/ */
@Override
public final String getLocalName() public final String getLocalName()
{ {
return dtm.getLocalName(node); return dtm.getLocalName(node);
@ -218,6 +222,7 @@ public class DTMNodeProxy
* @return The prefix for this node. * @return The prefix for this node.
* @see org.w3c.dom.Node as of DOM Level 2 * @see org.w3c.dom.Node as of DOM Level 2
*/ */
@Override
public final String getPrefix() public final String getPrefix()
{ {
return dtm.getPrefix(node); return dtm.getPrefix(node);
@ -230,6 +235,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Node as of DOM Level 2 -- DTMNodeProxy is read-only * @see org.w3c.dom.Node as of DOM Level 2 -- DTMNodeProxy is read-only
*/ */
@Override
public final void setPrefix(String prefix) throws DOMException public final void setPrefix(String prefix) throws DOMException
{ {
throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
@ -240,6 +246,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Node as of DOM Level 2 * @see org.w3c.dom.Node as of DOM Level 2
*/ */
@Override
public final String getNamespaceURI() public final String getNamespaceURI()
{ {
return dtm.getNamespaceURI(node); return dtm.getNamespaceURI(node);
@ -277,6 +284,7 @@ public class DTMNodeProxy
* @return false * @return false
* @see org.w3c.dom.Node as of DOM Level 2 * @see org.w3c.dom.Node as of DOM Level 2
*/ */
@Override
public final boolean isSupported(String feature, String version) public final boolean isSupported(String feature, String version)
{ {
return implementation.hasFeature(feature,version); return implementation.hasFeature(feature,version);
@ -290,6 +298,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Node * @see org.w3c.dom.Node
*/ */
@Override
public final String getNodeValue() throws DOMException public final String getNodeValue() throws DOMException
{ {
return dtm.getNodeValue(node); return dtm.getNodeValue(node);
@ -312,6 +321,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Node -- DTMNodeProxy is read-only * @see org.w3c.dom.Node -- DTMNodeProxy is read-only
*/ */
@Override
public final void setNodeValue(String nodeValue) throws DOMException public final void setNodeValue(String nodeValue) throws DOMException
{ {
throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
@ -322,6 +332,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Node * @see org.w3c.dom.Node
*/ */
@Override
public final short getNodeType() public final short getNodeType()
{ {
return (short) dtm.getNodeType(node); return (short) dtm.getNodeType(node);
@ -332,6 +343,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Node * @see org.w3c.dom.Node
*/ */
@Override
public final Node getParentNode() public final Node getParentNode()
{ {
@ -361,6 +373,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Node * @see org.w3c.dom.Node
*/ */
@Override
public final NodeList getChildNodes() public final NodeList getChildNodes()
{ {
@ -377,6 +390,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Node * @see org.w3c.dom.Node
*/ */
@Override
public final Node getFirstChild() public final Node getFirstChild()
{ {
@ -390,6 +404,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Node * @see org.w3c.dom.Node
*/ */
@Override
public final Node getLastChild() public final Node getLastChild()
{ {
@ -403,6 +418,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Node * @see org.w3c.dom.Node
*/ */
@Override
public final Node getPreviousSibling() public final Node getPreviousSibling()
{ {
@ -416,6 +432,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Node * @see org.w3c.dom.Node
*/ */
@Override
public final Node getNextSibling() public final Node getNextSibling()
{ {
@ -435,6 +452,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Node * @see org.w3c.dom.Node
*/ */
@Override
public final NamedNodeMap getAttributes() public final NamedNodeMap getAttributes()
{ {
@ -448,6 +466,7 @@ public class DTMNodeProxy
* @param name * @param name
* *
*/ */
@Override
public boolean hasAttribute(String name) public boolean hasAttribute(String name)
{ {
return DTM.NULL != dtm.getAttributeNode(node,null,name); return DTM.NULL != dtm.getAttributeNode(node,null,name);
@ -462,6 +481,7 @@ public class DTMNodeProxy
* *
* *
*/ */
@Override
public boolean hasAttributeNS(String namespaceURI, String localName) public boolean hasAttributeNS(String namespaceURI, String localName)
{ {
return DTM.NULL != dtm.getAttributeNode(node,namespaceURI,localName); return DTM.NULL != dtm.getAttributeNode(node,namespaceURI,localName);
@ -472,6 +492,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Node * @see org.w3c.dom.Node
*/ */
@Override
public final Document getOwnerDocument() public final Document getOwnerDocument()
{ {
// Note that this uses the DOM-compatable version of the call // Note that this uses the DOM-compatable version of the call
@ -488,6 +509,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Node -- DTMNodeProxy is read-only * @see org.w3c.dom.Node -- DTMNodeProxy is read-only
*/ */
@Override
public final Node insertBefore(Node newChild, Node refChild) public final Node insertBefore(Node newChild, Node refChild)
throws DOMException throws DOMException
{ {
@ -504,6 +526,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Node -- DTMNodeProxy is read-only * @see org.w3c.dom.Node -- DTMNodeProxy is read-only
*/ */
@Override
public final Node replaceChild(Node newChild, Node oldChild) public final Node replaceChild(Node newChild, Node oldChild)
throws DOMException throws DOMException
{ {
@ -519,6 +542,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Node -- DTMNodeProxy is read-only * @see org.w3c.dom.Node -- DTMNodeProxy is read-only
*/ */
@Override
public final Node removeChild(Node oldChild) throws DOMException public final Node removeChild(Node oldChild) throws DOMException
{ {
throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
@ -533,6 +557,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Node -- DTMNodeProxy is read-only * @see org.w3c.dom.Node -- DTMNodeProxy is read-only
*/ */
@Override
public final Node appendChild(Node newChild) throws DOMException public final Node appendChild(Node newChild) throws DOMException
{ {
throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
@ -543,6 +568,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Node * @see org.w3c.dom.Node
*/ */
@Override
public final boolean hasChildNodes() public final boolean hasChildNodes()
{ {
return (DTM.NULL != dtm.getFirstChild(node)); return (DTM.NULL != dtm.getFirstChild(node));
@ -555,6 +581,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Node -- DTMNodeProxy is read-only * @see org.w3c.dom.Node -- DTMNodeProxy is read-only
*/ */
@Override
public final Node cloneNode(boolean deep) public final Node cloneNode(boolean deep)
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -565,6 +592,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Document * @see org.w3c.dom.Document
*/ */
@Override
public final DocumentType getDoctype() public final DocumentType getDoctype()
{ {
return null; return null;
@ -575,6 +603,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Document * @see org.w3c.dom.Document
*/ */
@Override
public final DOMImplementation getImplementation() public final DOMImplementation getImplementation()
{ {
return implementation; return implementation;
@ -587,6 +616,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Document * @see org.w3c.dom.Document
*/ */
@Override
public final Element getDocumentElement() public final Element getDocumentElement()
{ {
int dochandle=dtm.getDocument(); int dochandle=dtm.getDocument();
@ -634,6 +664,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Document * @see org.w3c.dom.Document
*/ */
@Override
public final Element createElement(String tagName) throws DOMException public final Element createElement(String tagName) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -644,6 +675,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Document * @see org.w3c.dom.Document
*/ */
@Override
public final DocumentFragment createDocumentFragment() public final DocumentFragment createDocumentFragment()
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -656,6 +688,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Document * @see org.w3c.dom.Document
*/ */
@Override
public final Text createTextNode(String data) public final Text createTextNode(String data)
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -668,6 +701,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Document * @see org.w3c.dom.Document
*/ */
@Override
public final Comment createComment(String data) public final Comment createComment(String data)
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -682,6 +716,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Document * @see org.w3c.dom.Document
*/ */
@Override
public final CDATASection createCDATASection(String data) public final CDATASection createCDATASection(String data)
throws DOMException throws DOMException
{ {
@ -698,8 +733,9 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Document * @see org.w3c.dom.Document
*/ */
@Override
public final ProcessingInstruction createProcessingInstruction( public final ProcessingInstruction createProcessingInstruction(
String target, String data) throws DOMException String target, String data) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} }
@ -713,6 +749,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Document * @see org.w3c.dom.Document
*/ */
@Override
public final Attr createAttribute(String name) throws DOMException public final Attr createAttribute(String name) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -727,6 +764,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Document * @see org.w3c.dom.Document
*/ */
@Override
public final EntityReference createEntityReference(String name) public final EntityReference createEntityReference(String name)
throws DOMException throws DOMException
{ {
@ -739,6 +777,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Document * @see org.w3c.dom.Document
*/ */
@Override
public final NodeList getElementsByTagName(String tagname) public final NodeList getElementsByTagName(String tagname)
{ {
Vector listVector = new Vector(); Vector listVector = new Vector();
@ -819,6 +858,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Document as of DOM Level 2 -- DTMNodeProxy is read-only * @see org.w3c.dom.Document as of DOM Level 2 -- DTMNodeProxy is read-only
*/ */
@Override
public final Node importNode(Node importedNode, boolean deep) public final Node importNode(Node importedNode, boolean deep)
throws DOMException throws DOMException
{ {
@ -835,8 +875,9 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Document as of DOM Level 2 * @see org.w3c.dom.Document as of DOM Level 2
*/ */
@Override
public final Element createElementNS( public final Element createElementNS(
String namespaceURI, String qualifiedName) throws DOMException String namespaceURI, String qualifiedName) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} }
@ -851,8 +892,9 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Document as of DOM Level 2 * @see org.w3c.dom.Document as of DOM Level 2
*/ */
@Override
public final Attr createAttributeNS( public final Attr createAttributeNS(
String namespaceURI, String qualifiedName) throws DOMException String namespaceURI, String qualifiedName) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} }
@ -865,6 +907,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Document as of DOM Level 2 * @see org.w3c.dom.Document as of DOM Level 2
*/ */
@Override
public final NodeList getElementsByTagNameNS(String namespaceURI, public final NodeList getElementsByTagNameNS(String namespaceURI,
String localName) String localName)
{ {
@ -952,6 +995,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Document as of DOM Level 2 * @see org.w3c.dom.Document as of DOM Level 2
*/ */
@Override
public final Element getElementById(String elementId) public final Element getElementById(String elementId)
{ {
return (Element) dtm.getNode(dtm.getElementById(elementId)); return (Element) dtm.getNode(dtm.getElementById(elementId));
@ -966,6 +1010,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Text * @see org.w3c.dom.Text
*/ */
@Override
public final Text splitText(int offset) throws DOMException public final Text splitText(int offset) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -978,6 +1023,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.CharacterData * @see org.w3c.dom.CharacterData
*/ */
@Override
public final String getData() throws DOMException public final String getData() throws DOMException
{ {
return dtm.getNodeValue(node); return dtm.getNodeValue(node);
@ -990,6 +1036,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.CharacterData * @see org.w3c.dom.CharacterData
*/ */
@Override
public final void setData(String data) throws DOMException public final void setData(String data) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -1000,6 +1047,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.CharacterData * @see org.w3c.dom.CharacterData
*/ */
@Override
public final int getLength() public final int getLength()
{ {
// %OPT% This should do something smarter? // %OPT% This should do something smarter?
@ -1016,6 +1064,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.CharacterData * @see org.w3c.dom.CharacterData
*/ */
@Override
public final String substringData(int offset, int count) throws DOMException public final String substringData(int offset, int count) throws DOMException
{ {
return getData().substring(offset,offset+count); return getData().substring(offset,offset+count);
@ -1028,6 +1077,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.CharacterData * @see org.w3c.dom.CharacterData
*/ */
@Override
public final void appendData(String arg) throws DOMException public final void appendData(String arg) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -1041,6 +1091,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.CharacterData * @see org.w3c.dom.CharacterData
*/ */
@Override
public final void insertData(int offset, String arg) throws DOMException public final void insertData(int offset, String arg) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -1054,6 +1105,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.CharacterData * @see org.w3c.dom.CharacterData
*/ */
@Override
public final void deleteData(int offset, int count) throws DOMException public final void deleteData(int offset, int count) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -1068,6 +1120,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.CharacterData * @see org.w3c.dom.CharacterData
*/ */
@Override
public final void replaceData(int offset, int count, String arg) public final void replaceData(int offset, int count, String arg)
throws DOMException throws DOMException
{ {
@ -1079,6 +1132,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Element * @see org.w3c.dom.Element
*/ */
@Override
public final String getTagName() public final String getTagName()
{ {
return dtm.getNodeName(node); return dtm.getNodeName(node);
@ -1091,12 +1145,13 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Element * @see org.w3c.dom.Element
*/ */
@Override
public final String getAttribute(String name) public final String getAttribute(String name)
{ {
DTMNamedNodeMap map = new DTMNamedNodeMap(dtm, node); DTMNamedNodeMap map = new DTMNamedNodeMap(dtm, node);
Node node = map.getNamedItem(name); Node n = map.getNamedItem(name);
return (null == node) ? EMPTYSTRING : node.getNodeValue(); } return (null == n) ? EMPTYSTRING : n.getNodeValue();
}
/** /**
* *
@ -1106,6 +1161,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Element * @see org.w3c.dom.Element
*/ */
@Override
public final void setAttribute(String name, String value) public final void setAttribute(String name, String value)
throws DOMException throws DOMException
{ {
@ -1119,6 +1175,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Element * @see org.w3c.dom.Element
*/ */
@Override
public final void removeAttribute(String name) throws DOMException public final void removeAttribute(String name) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -1131,9 +1188,9 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Element * @see org.w3c.dom.Element
*/ */
@Override
public final Attr getAttributeNode(String name) public final Attr getAttributeNode(String name)
{ {
DTMNamedNodeMap map = new DTMNamedNodeMap(dtm, node); DTMNamedNodeMap map = new DTMNamedNodeMap(dtm, node);
return (Attr)map.getNamedItem(name); return (Attr)map.getNamedItem(name);
} }
@ -1147,6 +1204,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Element * @see org.w3c.dom.Element
*/ */
@Override
public final Attr setAttributeNode(Attr newAttr) throws DOMException public final Attr setAttributeNode(Attr newAttr) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -1161,6 +1219,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Element * @see org.w3c.dom.Element
*/ */
@Override
public final Attr removeAttributeNode(Attr oldAttr) throws DOMException public final Attr removeAttributeNode(Attr oldAttr) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -1171,12 +1230,14 @@ public class DTMNodeProxy
* *
* *
*/ */
@Override
public boolean hasAttributes() public boolean hasAttributes()
{ {
return DTM.NULL != dtm.getFirstAttribute(node); return DTM.NULL != dtm.getFirstAttribute(node);
} }
/** @see org.w3c.dom.Element */ /** @see org.w3c.dom.Element */
@Override
public final void normalize() public final void normalize()
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -1190,6 +1251,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Element * @see org.w3c.dom.Element
*/ */
@Override
public final String getAttributeNS(String namespaceURI, String localName) public final String getAttributeNS(String namespaceURI, String localName)
{ {
Node retNode = null; Node retNode = null;
@ -1208,6 +1270,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Element * @see org.w3c.dom.Element
*/ */
@Override
public final void setAttributeNS( public final void setAttributeNS(
String namespaceURI, String qualifiedName, String value) String namespaceURI, String qualifiedName, String value)
throws DOMException throws DOMException
@ -1223,6 +1286,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Element * @see org.w3c.dom.Element
*/ */
@Override
public final void removeAttributeNS(String namespaceURI, String localName) public final void removeAttributeNS(String namespaceURI, String localName)
throws DOMException throws DOMException
{ {
@ -1237,6 +1301,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Element * @see org.w3c.dom.Element
*/ */
@Override
public final Attr getAttributeNodeNS(String namespaceURI, String localName) public final Attr getAttributeNodeNS(String namespaceURI, String localName)
{ {
Attr retAttr = null; Attr retAttr = null;
@ -1256,6 +1321,7 @@ public class DTMNodeProxy
* @throws DOMException * @throws DOMException
* @see org.w3c.dom.Element * @see org.w3c.dom.Element
*/ */
@Override
public final Attr setAttributeNodeNS(Attr newAttr) throws DOMException public final Attr setAttributeNodeNS(Attr newAttr) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -1266,6 +1332,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Attr * @see org.w3c.dom.Attr
*/ */
@Override
public final String getName() public final String getName()
{ {
return dtm.getNodeName(node); return dtm.getNodeName(node);
@ -1276,6 +1343,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Attr * @see org.w3c.dom.Attr
*/ */
@Override
public final boolean getSpecified() public final boolean getSpecified()
{ {
// We really don't know which attributes might have come from the // We really don't know which attributes might have come from the
@ -1290,6 +1358,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Attr * @see org.w3c.dom.Attr
*/ */
@Override
public final String getValue() public final String getValue()
{ {
return dtm.getNodeValue(node); return dtm.getNodeValue(node);
@ -1300,6 +1369,7 @@ public class DTMNodeProxy
* @param value * @param value
* @see org.w3c.dom.Attr * @see org.w3c.dom.Attr
*/ */
@Override
public final void setValue(String value) public final void setValue(String value)
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -1311,6 +1381,7 @@ public class DTMNodeProxy
* *
* @see org.w3c.dom.Attr as of DOM Level 2 * @see org.w3c.dom.Attr as of DOM Level 2
*/ */
@Override
public final Element getOwnerElement() public final Element getOwnerElement()
{ {
if (getNodeType() != Node.ATTRIBUTE_NODE) if (getNodeType() != Node.ATTRIBUTE_NODE)
@ -1331,9 +1402,9 @@ public class DTMNodeProxy
* *
* @throws DOMException * @throws DOMException
*/ */
@Override
public Node adoptNode(Node source) throws DOMException public Node adoptNode(Node source) throws DOMException
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} }
@ -1348,9 +1419,9 @@ public class DTMNodeProxy
* *
* NEEDSDOC ($objectName$) @return * NEEDSDOC ($objectName$) @return
*/ */
@Override
public String getInputEncoding() public String getInputEncoding()
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} }
@ -1383,7 +1454,6 @@ public class DTMNodeProxy
*/ */
public boolean getStandalone() public boolean getStandalone()
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} }
@ -1418,9 +1488,9 @@ public class DTMNodeProxy
* *
* NEEDSDOC ($objectName$) @return * NEEDSDOC ($objectName$) @return
*/ */
@Override
public boolean getStrictErrorChecking() public boolean getStrictErrorChecking()
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} }
@ -1439,6 +1509,7 @@ public class DTMNodeProxy
* *
* NEEDSDOC @param strictErrorChecking * NEEDSDOC @param strictErrorChecking
*/ */
@Override
public void setStrictErrorChecking(boolean strictErrorChecking) public void setStrictErrorChecking(boolean strictErrorChecking)
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
@ -1457,7 +1528,6 @@ public class DTMNodeProxy
*/ */
public String getVersion() public String getVersion()
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} }
@ -1482,10 +1552,12 @@ public class DTMNodeProxy
*/ */
static class DTMNodeProxyImplementation implements DOMImplementation static class DTMNodeProxyImplementation implements DOMImplementation
{ {
@Override
public DocumentType createDocumentType(String qualifiedName,String publicId, String systemId) public DocumentType createDocumentType(String qualifiedName,String publicId, String systemId)
{ {
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} }
@Override
public Document createDocument(String namespaceURI,String qualfiedName,DocumentType doctype) public Document createDocument(String namespaceURI,String qualfiedName,DocumentType doctype)
{ {
// Could create a DTM... but why, when it'd have to be permanantly empty? // Could create a DTM... but why, when it'd have to be permanantly empty?
@ -1500,6 +1572,7 @@ public class DTMNodeProxy
* methods we can't support. I'm not sure which would be more useful * methods we can't support. I'm not sure which would be more useful
* to the caller. * to the caller.
*/ */
@Override
public boolean hasFeature(String feature,String version) public boolean hasFeature(String feature,String version)
{ {
if( ("CORE".equals(feature.toUpperCase()) || "XML".equals(feature.toUpperCase())) if( ("CORE".equals(feature.toUpperCase()) || "XML".equals(feature.toUpperCase()))
@ -1530,6 +1603,7 @@ public class DTMNodeProxy
* childNodes, etc. * childNodes, etc.
* @since DOM Level 3 * @since DOM Level 3
*/ */
@Override
public Object getFeature(String feature, String version) { public Object getFeature(String feature, String version) {
// we don't have any alternate node, either this node does the job // we don't have any alternate node, either this node does the job
// or we don't have anything that does // or we don't have anything that does
@ -1542,6 +1616,7 @@ public class DTMNodeProxy
//RAMESH : Pending proper implementation of DOM Level 3 //RAMESH : Pending proper implementation of DOM Level 3
@Override
public Object setUserData(String key, public Object setUserData(String key,
Object data, Object data,
UserDataHandler handler) { UserDataHandler handler) {
@ -1557,6 +1632,7 @@ public class DTMNodeProxy
* on this node, or <code>null</code> if there was none. * on this node, or <code>null</code> if there was none.
* @since DOM Level 3 * @since DOM Level 3
*/ */
@Override
public Object getUserData(String key) { public Object getUserData(String key) {
return getOwnerDocument().getUserData( key); return getOwnerDocument().getUserData( key);
} }
@ -1581,6 +1657,7 @@ public class DTMNodeProxy
* childNodes, etc. * childNodes, etc.
* @since DOM Level 3 * @since DOM Level 3
*/ */
@Override
public Object getFeature(String feature, String version) { public Object getFeature(String feature, String version) {
// we don't have any alternate node, either this node does the job // we don't have any alternate node, either this node does the job
// or we don't have anything that does // or we don't have anything that does
@ -1629,6 +1706,7 @@ public class DTMNodeProxy
* <code>true</code> otherwise <code>false</code>. * <code>true</code> otherwise <code>false</code>.
* @since DOM Level 3 * @since DOM Level 3
*/ */
@Override
public boolean isEqualNode(Node arg) { public boolean isEqualNode(Node arg) {
if (arg == this) { if (arg == this) {
return true; return true;
@ -1705,6 +1783,7 @@ public class DTMNodeProxy
* @return th URI for the namespace * @return th URI for the namespace
* @since DOM Level 3 * @since DOM Level 3
*/ */
@Override
public String lookupNamespaceURI(String specifiedPrefix) { public String lookupNamespaceURI(String specifiedPrefix) {
short type = this.getNodeType(); short type = this.getNodeType();
switch (type) { switch (type) {
@ -1797,6 +1876,7 @@ public class DTMNodeProxy
* is the default namespace, <code>false</code> otherwise. * is the default namespace, <code>false</code> otherwise.
* @since DOM Level 3 * @since DOM Level 3
*/ */
@Override
public boolean isDefaultNamespace(String namespaceURI){ public boolean isDefaultNamespace(String namespaceURI){
/* /*
// REVISIT: remove casts when DOM L3 becomes REC. // REVISIT: remove casts when DOM L3 becomes REC.
@ -1871,6 +1951,7 @@ public class DTMNodeProxy
* @param namespaceURI * @param namespaceURI
* @return the prefix for the namespace * @return the prefix for the namespace
*/ */
@Override
public String lookupPrefix(String namespaceURI){ public String lookupPrefix(String namespaceURI){
// REVISIT: When Namespaces 1.1 comes out this may not be true // REVISIT: When Namespaces 1.1 comes out this may not be true
@ -1932,6 +2013,7 @@ public class DTMNodeProxy
* <code>false</code> otherwise. * <code>false</code> otherwise.
* @since DOM Level 3 * @since DOM Level 3
*/ */
@Override
public boolean isSameNode(Node other) { public boolean isSameNode(Node other) {
// we do not use any wrapper so the answer is obvious // we do not use any wrapper so the answer is obvious
return this == other; return this == other;
@ -1980,8 +2062,9 @@ public class DTMNodeProxy
* DOMSTRING_SIZE_ERR: Raised when it would return more characters than * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
* fit in a <code>DOMString</code> variable on the implementation * fit in a <code>DOMString</code> variable on the implementation
* platform. * platform.
* @since DOM Level 3 * @since DOM Level 3
*/ */
@Override
public void setTextContent(String textContent) public void setTextContent(String textContent)
throws DOMException { throws DOMException {
setNodeValue(textContent); setNodeValue(textContent);
@ -2031,6 +2114,7 @@ public class DTMNodeProxy
* platform. * platform.
* @since DOM Level 3 * @since DOM Level 3
*/ */
@Override
public String getTextContent() throws DOMException { public String getTextContent() throws DOMException {
return getNodeValue(); // overriden in some subclasses return getNodeValue(); // overriden in some subclasses
} }
@ -2043,6 +2127,7 @@ public class DTMNodeProxy
* node. * node.
* @since DOM Level 3 * @since DOM Level 3
*/ */
@Override
public short compareDocumentPosition(Node other) throws DOMException { public short compareDocumentPosition(Node other) throws DOMException {
return 0; return 0;
} }
@ -2071,14 +2156,16 @@ public class DTMNodeProxy
* Yes. (F2F 26 Sep 2001) * Yes. (F2F 26 Sep 2001)
* @since DOM Level 3 * @since DOM Level 3
*/ */
@Override
public String getBaseURI() { public String getBaseURI() {
return null; return null;
} }
/** /**
* DOM Level 3 * DOM Level 3
* Renaming node * Renaming node
*/ */
@Override
public Node renameNode(Node n, public Node renameNode(Node n,
String namespaceURI, String namespaceURI,
String name) String name)
@ -2091,14 +2178,16 @@ public class DTMNodeProxy
* DOM Level 3 * DOM Level 3
* Normalize document. * Normalize document.
*/ */
@Override
public void normalizeDocument(){ public void normalizeDocument(){
} }
/** /**
* The configuration used when <code>Document.normalizeDocument</code> is * The configuration used when <code>Document.normalizeDocument</code> is
* invoked. * invoked.
* @since DOM Level 3 * @since DOM Level 3
*/ */
@Override
public DOMConfiguration getDomConfig(){ public DOMConfiguration getDomConfig(){
return null; return null;
} }
@ -2110,8 +2199,8 @@ public class DTMNodeProxy
/** /**
* DOM Level 3 * DOM Level 3
*/ */
@Override
public void setDocumentURI(String documentURI){ public void setDocumentURI(String documentURI){
fDocumentURI= documentURI; fDocumentURI= documentURI;
} }
@ -2123,6 +2212,7 @@ public class DTMNodeProxy
* over this attribute. * over this attribute.
* @since DOM Level 3 * @since DOM Level 3
*/ */
@Override
public String getDocumentURI(){ public String getDocumentURI(){
return fDocumentURI; return fDocumentURI;
} }
@ -2154,9 +2244,10 @@ public class DTMNodeProxy
actualEncoding = value; actualEncoding = value;
} }
/** /**
* DOM Level 3 * DOM Level 3
*/ */
@Override
public Text replaceWholeText(String content) public Text replaceWholeText(String content)
throws DOMException{ throws DOMException{
/* /*
@ -2210,6 +2301,7 @@ public class DTMNodeProxy
* nodes to this node, concatenated in document order. * nodes to this node, concatenated in document order.
* @since DOM Level 3 * @since DOM Level 3
*/ */
@Override
public String getWholeText(){ public String getWholeText(){
/* /*
@ -2235,13 +2327,11 @@ public class DTMNodeProxy
* Returns whether this text node contains whitespace in element content, * Returns whether this text node contains whitespace in element content,
* often abusively called "ignorable whitespace". * often abusively called "ignorable whitespace".
*/ */
@Override
public boolean isElementContentWhitespace(){ public boolean isElementContentWhitespace(){
return false; return false;
} }
/** /**
* NON-DOM: set the type of this attribute to be ID type. * NON-DOM: set the type of this attribute to be ID type.
* *
@ -2254,6 +2344,7 @@ public class DTMNodeProxy
/** /**
* DOM Level 3: register the given attribute node as an ID attribute * DOM Level 3: register the given attribute node as an ID attribute
*/ */
@Override
public void setIdAttribute(String name, boolean makeId) { public void setIdAttribute(String name, boolean makeId) {
//PENDING //PENDING
} }
@ -2262,6 +2353,7 @@ public class DTMNodeProxy
/** /**
* DOM Level 3: register the given attribute node as an ID attribute * DOM Level 3: register the given attribute node as an ID attribute
*/ */
@Override
public void setIdAttributeNode(Attr at, boolean makeId) { public void setIdAttributeNode(Attr at, boolean makeId) {
//PENDING //PENDING
} }
@ -2269,6 +2361,7 @@ public class DTMNodeProxy
/** /**
* DOM Level 3: register the given attribute node as an ID attribute * DOM Level 3: register the given attribute node as an ID attribute
*/ */
@Override
public void setIdAttributeNS(String namespaceURI, String localName, public void setIdAttributeNS(String namespaceURI, String localName,
boolean makeId) { boolean makeId) {
//PENDING //PENDING
@ -2277,16 +2370,19 @@ public class DTMNodeProxy
* Method getSchemaTypeInfo. * Method getSchemaTypeInfo.
* @return TypeInfo * @return TypeInfo
*/ */
@Override
public TypeInfo getSchemaTypeInfo(){ public TypeInfo getSchemaTypeInfo(){
return null; //PENDING return null; //PENDING
} }
@Override
public boolean isId() { public boolean isId() {
return false; //PENDING return false; //PENDING
} }
private String xmlEncoding; private String xmlEncoding;
@Override
public String getXmlEncoding( ) { public String getXmlEncoding( ) {
return xmlEncoding; return xmlEncoding;
} }
@ -2295,23 +2391,25 @@ public class DTMNodeProxy
} }
private boolean xmlStandalone; private boolean xmlStandalone;
@Override
public boolean getXmlStandalone() { public boolean getXmlStandalone() {
return xmlStandalone; return xmlStandalone;
} }
@Override
public void setXmlStandalone(boolean xmlStandalone) throws DOMException { public void setXmlStandalone(boolean xmlStandalone) throws DOMException {
this.xmlStandalone = xmlStandalone; this.xmlStandalone = xmlStandalone;
} }
private String xmlVersion; private String xmlVersion;
@Override
public String getXmlVersion() { public String getXmlVersion() {
return xmlVersion; return xmlVersion;
} }
@Override
public void setXmlVersion(String xmlVersion) throws DOMException { public void setXmlVersion(String xmlVersion) throws DOMException {
this.xmlVersion = xmlVersion; this.xmlVersion = xmlVersion;
} }
} }

View file

@ -23,7 +23,7 @@
package com.sun.org.apache.xml.internal.serializer.utils; package com.sun.org.apache.xml.internal.serializer.utils;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable; import java.util.Objects;
/** /**
@ -863,7 +863,7 @@ final class URI
public String getSchemeSpecificPart() public String getSchemeSpecificPart()
{ {
StringBuffer schemespec = new StringBuffer(); final StringBuilder schemespec = new StringBuilder();
if (m_userinfo != null || m_host != null || m_port != -1) if (m_userinfo != null || m_host != null || m_port != -1)
{ {
@ -955,7 +955,7 @@ final class URI
boolean p_includeFragment) boolean p_includeFragment)
{ {
StringBuffer pathString = new StringBuffer(m_path); final StringBuilder pathString = new StringBuilder(m_path);
if (p_includeQueryString && m_queryString != null) if (p_includeQueryString && m_queryString != null)
{ {
@ -1321,6 +1321,7 @@ final class URI
* @return true if p_test is a URI with all values equal to this * @return true if p_test is a URI with all values equal to this
* URI, false otherwise * URI, false otherwise
*/ */
@Override
public boolean equals(Object p_test) public boolean equals(Object p_test)
{ {
@ -1343,15 +1344,29 @@ final class URI
return false; 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. * Get the URI as a string specification. See RFC 2396 Section 5.2.
* *
* @return the URI string specification * @return the URI string specification
*/ */
@Override
public String toString() public String toString()
{ {
StringBuffer uriSpecString = new StringBuffer(); final StringBuilder uriSpecString = new StringBuilder();
if (m_scheme != null) if (m_scheme != null)
{ {
@ -1543,7 +1558,7 @@ final class URI
* *
* *
* @param p_char the character to check * @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 * or 'A' and 'F', false otherwise
*/ */
private static boolean isHex(char p_char) private static boolean isHex(char p_char)

View file

@ -27,6 +27,7 @@ import java.io.Serializable;
import com.sun.org.apache.xml.internal.res.XMLErrorResources; import com.sun.org.apache.xml.internal.res.XMLErrorResources;
import com.sun.org.apache.xml.internal.res.XMLMessages; import com.sun.org.apache.xml.internal.res.XMLMessages;
import java.util.Objects;
/** /**
* A class to represent a Uniform Resource Identifier (URI). This class * A class to represent a Uniform Resource Identifier (URI). This class
@ -883,7 +884,7 @@ public class URI implements Serializable
public String getSchemeSpecificPart() public String getSchemeSpecificPart()
{ {
StringBuffer schemespec = new StringBuffer(); final StringBuilder schemespec = new StringBuilder();
if (m_userinfo != null || m_host != null || m_port != -1) if (m_userinfo != null || m_host != null || m_port != -1)
{ {
@ -975,7 +976,7 @@ public class URI implements Serializable
boolean p_includeFragment) boolean p_includeFragment)
{ {
StringBuffer pathString = new StringBuffer(m_path); final StringBuilder pathString = new StringBuilder(m_path);
if (p_includeQueryString && m_queryString != null) if (p_includeQueryString && m_queryString != null)
{ {
@ -1341,6 +1342,7 @@ public class URI implements Serializable
* @return true if p_test is a URI with all values equal to this * @return true if p_test is a URI with all values equal to this
* URI, false otherwise * URI, false otherwise
*/ */
@Override
public boolean equals(Object p_test) public boolean equals(Object p_test)
{ {
@ -1363,15 +1365,29 @@ public class URI implements Serializable
return false; 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. * Get the URI as a string specification. See RFC 2396 Section 5.2.
* *
* @return the URI string specification * @return the URI string specification
*/ */
@Override
public String toString() public String toString()
{ {
StringBuffer uriSpecString = new StringBuffer(); final StringBuilder uriSpecString = new StringBuilder();
if (m_scheme != null) if (m_scheme != null)
{ {

View file

@ -24,6 +24,7 @@ package com.sun.org.apache.xpath.internal;
import com.sun.org.apache.xml.internal.utils.QName; import com.sun.org.apache.xml.internal.utils.QName;
import com.sun.org.apache.xpath.internal.objects.XObject; import com.sun.org.apache.xpath.internal.objects.XObject;
import java.util.Objects;
/** /**
* This class holds an instance of an argument on * This class holds an instance of an argument on
@ -182,7 +183,7 @@ public class Arg
{ {
m_qname = new QName(""); m_qname = new QName("");
; // so that string compares can be done. // so that string compares can be done.
m_val = null; m_val = null;
m_expression = null; m_expression = null;
m_isVisible = true; m_isVisible = true;
@ -223,6 +224,11 @@ public class Arg
m_expression = null; m_expression = null;
} }
@Override
public int hashCode() {
return Objects.hashCode(this.m_qname);
}
/** /**
* Equality function specialized for the variable name. If the argument * Equality function specialized for the variable name. If the argument
* is not a qname, it will deligate to the super class. * is not a qname, it will deligate to the super class.
@ -231,6 +237,7 @@ public class Arg
* @return <code>true</code> if this object is the same as the obj * @return <code>true</code> if this object is the same as the obj
* argument; <code>false</code> otherwise. * argument; <code>false</code> otherwise.
*/ */
@Override
public boolean equals(Object obj) public boolean equals(Object obj)
{ {
if(obj instanceof QName) if(obj instanceof QName)