[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CSE494: Bug in LinkExtract.java (fwd)



Please take care of the bug given below.
Thanks Stan. 
 I will update the jar files too.

Ullas

"Well Begun is Half Done"

---------- Forwarded message ----------
Date: Tue, 27 Feb 2001 18:09:31 -0700 (MST)
From: volsung@asu.edu
To: mallu@asu.edu
Subject: CSE494: Bug in LinkExtract.java

This is a minor bug, but it took me a while to find it.  Because the hash
table in Link Extract stores a list of links in this manner, 

url -> url1, url2, url3

(note the space after each comma) the method Links() will return an ArrayList
of strings whose contents is

["url1", " url2", " url3"]

The leading space before url2 and url3 cause problems later if you hand them
back to Links().  They won't be found in the hashtable, and a null pointer
exception will be thrown.  If you change the lines in Links():

	    String tmp = list.substring(0,j); 

and 

	if (list.length() >0) 
	    retList.add(list);

to

            String tmp = list.substring(0,j).trim();       

and

        if (list.length() >0)
            retList.add(list.trim());

the problem is fixed.

---
Stan Seibert