Mark, On 8/27/14, 12:12 PM, Mark Thomas wrote: > On 27/08/2014 17:05, [email protected] wrote: >> Author: schultz >> Date: Wed Aug 27 16:05:38 2014 >> New Revision: 1620923 >> >> URL: http://svn.apache.org/r1620923 >> Log: >> Added missing hashCode method. > > Two questions. > > 1. Why do you think this method is missing? I'm pretty sure (although > I'm going to need to install it to check) that FindBugs is now going > complain about a missing equals(XMLString) method.
You're right. I was looking at equals(String) and jumping to the wrong conclusion. What is your preference, here? Remove hashCode() or add equals(Object)? > 2. Why were length and offset (both part of XMLString's state) not > included in the hashcode calculation? Whoops. Depending upon your response to the above, I'll either correct it or remove the method. Thanks, -chris >> Modified: >> tomcat/trunk/java/org/apache/jasper/xmlparser/XMLString.java >> >> Modified: tomcat/trunk/java/org/apache/jasper/xmlparser/XMLString.java >> URL: >> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/xmlparser/XMLString.java?rev=1620923&r1=1620922&r2=1620923&view=diff >> ============================================================================== >> --- tomcat/trunk/java/org/apache/jasper/xmlparser/XMLString.java (original) >> +++ tomcat/trunk/java/org/apache/jasper/xmlparser/XMLString.java Wed Aug 27 >> 16:05:38 2014 >> @@ -25,6 +25,8 @@ >> >> package org.apache.jasper.xmlparser; >> >> +import java.util.Arrays; >> + >> /** >> * This class is used as a structure to pass text contained in the >> underlying >> * character buffer of the scanner. The offset and length fields allow the >> @@ -138,6 +140,11 @@ public class XMLString { >> // >> // Object methods >> // >> + @Override >> + public int hashCode() >> + { >> + return Arrays.hashCode(ch); >> + } >> >> /** Returns a string representation of this object. */ >> @Override >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] >
signature.asc
Description: OpenPGP digital signature
