Using == on strings 2004-07-07 - By Dave Brosius
I ran across this in org.apache.xerces.dom.DeferredDocumentImpl
Shouldn't this be
if (getChunkValue(fNodeName, achunk, aindex).equals( name)) {
?
public String getAttribute(int elemIndex, String name) { if (elemIndex == -1 || name == null) { return null; } int echunk = elemIndex >> CHUNK_SHIFT; int eindex = elemIndex & CHUNK_MASK; int attrIndex = getChunkIndex(fNodeExtra, echunk, eindex); while (attrIndex != -1) { int achunk = attrIndex >> CHUNK_SHIFT; int aindex = attrIndex & CHUNK_MASK; if (getChunkValue(fNodeName, achunk, aindex) == name) { return getChunkValue(fNodeValue, achunk, aindex); } attrIndex = getChunkIndex(fNodePrevSib, achunk, aindex); } return null; } <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 6.00.2800.1400" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>I ran across this in org.apache.xerces.dom.DeferredDocumentImpl</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Shouldn't this be </FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2> if (getChunkValue(fNodeName, achunk, aindex).equals( name)) {</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>?</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2> </DIV> <DIV><BR></DIV></FONT><FONT face=Arial size=2></FONT> <DIV><FONT face=Arial size=2> public String getAttribute(int elemIndex, String name) {<BR> if (elemIndex == -1 || name == null) {<BR> return null;<BR> }<BR> int echunk = elemIndex >> CHUNK_SHIFT;<BR> int eindex = elemIndex & CHUNK_MASK;<BR> int attrIndex = getChunkIndex(fNodeExtra, echunk, eindex);<BR> while (attrIndex != -1) {<BR> int achunk = attrIndex >> CHUNK_SHIFT;<BR> int aindex = attrIndex & CHUNK_MASK;<BR> if (getChunkValue(fNodeName, achunk, aindex) == name) {<BR> return getChunkValue(fNodeValue, achunk, aindex);<BR> }<BR> attrIndex = getChunkIndex(fNodePrevSib, achunk, aindex);<BR> }<BR> return null;<BR> }</FONT></DIV></BODY></HTML>
|
|