Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

string.equals() not working right



Hi,

I have the following function.

    public static PacketSource makePacketSource(String name) {
	if (name == null)
	    name = "sf@localhost:9002"; // default source

	ParseArgs parser = new ParseArgs(name, "@");
	String source = parser.next();
	String args = parser.next();
	PacketSource retVal = null;
	
	if (source.equals("sf"))
	    retVal =  makeArgsSF(args);
	if (source.equals("serial"))
	    retVal =  makeArgsSerial(args);
	if (source.equals("network"))
	    retVal =  makeArgsNetwork(args);
	if (source.equals("tossim-serial"))
	    retVal =  makeArgsTossimSerial(args);
	if (source.equals("tossim-radio"))
	    retVal =  makeArgsTossimRadio(args);

	return retVal;
    }

when I traced it, it failed in the first if statement. so what is wrong with the equals comparison?


-- regards;

Peizhao
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.