Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#26 CookieDAOImpl uses incorrect SQL

open
nobody
None
5
2007-02-20
2007-02-20
Anonymous
No

When using the net.javacoding.jspider.core.storage.jdbc.JdbcStorageProvider, the net.javacoding.jspider.core.storage.jdbc.CookieDAOImpl class uses incorrect SQL to find the cookie entry.

Here is the line of code that is incorrect:

61 rs = st.executeQuery("select count(*) as count from jspider_cookie where id='" + id + "' and name='" + cookie.getName() + "'");

The "where id=" should be "where site="

NOTE: id is replaced by site. In the jspider_cookie table, the 'site' column is the id of the site being indexed and the 'id' column is just a unique row identifier. With the current SQL, the existing cookie row is never found because the id column is randomly generated. So a new row is inserted every time a page is indexed. Then when the code tries to use the cookie string, it blows up after about 65 pages because the cooke string length becomes greater then 800+ characters.

Discussion