- From: Antonio Ramirez <anto@MIT.EDU>
- Date: Wed, 04 Dec 1996 15:50:53 EST
- To: Scott Jewell <jewellsc@pop.mts.kpnw.org>
- Cc: www-jigsaw@w3.org
> > Enumeration e = data.keys() ; > // Parse certificate request variables: > while ( e.hasMoreElements () ) { > String name = (String) e.nextElement(); > if (name == "C") System.err.println("Saw C"); > if (name == "SP") System.err.println("Saw SP"); > if (name == "L") System.err.println("Saw L"); > if (name == "O") System.err.println("Saw O"); > if (name == "OU") System.err.println("Saw OU"); > if (name == "CN") System.err.println("Saw CN"); > if (name == "Email") System.err.println("Saw Email"); > if (name == "SPKAC") System.err.println("Saw SPKAC"); > } > > Could someone please return my sanity. Thanks. > > Scott Jewell > You should use if(name.equals("C")) ... instead of using the == operator. The reason is that the == operator tests to see if the two operands are one and the same object (i.e., they are in the same memory address). Two strings can be equal character by character without being the same string object. -- ====================================================================== Antonio Ramirez / 450 Memorial Dr. / Cambridge, MA 02139 anto@mit.edu, anto@w3.org
Received on Wednesday, 4 December 1996 15:50:31 UTC