[Swoop] Java question

Bijan Parsia bparsia at isr.umd.edu
Sun Oct 24 22:37:47 EDT 2004


Ok, I hate java.

I just tweaked SwoopFrame to trim() the uri so that leading or trailing 
blanks don't cause the system to barf. essentially:

                         String uri = (String) 
addrCombo.getSelectedItem();
                         uri = uri.trim();
                         if ((uri==null) || uri.equals("")) return;

But I got a bit confused by the first disjunct. How could the uri be a 
null? If it *could* be a null, will my uri.trim() barf in some case? 
Are nulls legal in any type of variable? with getSelectedItem() every 
return a null?

It seems either I can eliminate the first disjunct (which seemed to be 
guarding the second, actually) or I should write a couple of (or 
nested) ifs.

Given that the disjunct exists, I figured that I should take that as a 
warning that there could be a null, and rearranged things. But I would 
like to know if there really could be a null :)

Minutae are us.

While I'm at it, could I have pointer to the code that intercepts a 
hyperlink click?

Cheers,
Bijan.



More information about the Swoop mailing list