Menu

#1 Change to warning messages with broken REFID.

open
nobody
None
5
2003-04-04
2003-04-04
Eli Tucker
No

After spending a good portion of the afternoon looking at
this, I've only come up with more questions. It looks
like the broken REFID error message is generated when
the weak reference to the search task has been
garbage collected. (See Z3950Origin.java, lines 845 and
913.) http://cvs.sourceforge.net/cgi-
bin/viewcvs.cgi/jzjkit/jzkit/src/com/k_int/z3950/IRClient/Z
3950Origin.java?rev=HEAD&content-
type=text/vnd.viewcvs-markup

This is misleading because if the server had a broken
REFID, the weak reference wouldn't be found at all in
the active_searches hashtable. Here's a snippet of the
code:

// We need to split refid down into task-id : Srch
StringTokenizer st = new StringTokenizer(new String
(search_response.referenceId),":");

if ( st.hasMoreTokens() )
{
String taskid = st.nextToken();
WeakReference wr = (WeakReference)
active_searches.get(taskid);

if ( wr != null )
{
Z3950SearchTask tsk = (Z3950SearchTask)wr.get
();

if ( null != tsk )
{
// ... bunch of code here ...
}
else
{
cat.warn("Unable to locate a search for that
REFID. REFID processing at the target may be
BROKEN!");
// The task is no longer refereced and the object
has been GC'd, remove it from
// the active_searches map. The task should
have arranged for itself to be removed from the
// map... Never mind...
active_searches.remove(taskid);
}
} // ### BROKEN REFID ERROR SHOULD BE IN
ELSE STATEMENT HERE ###
}
else
{
cat.fatal("Unable to parse refid for search
response");
}

The cat.warn message should be moved to where I have
indicated, and the existing cat.warn message should be
changed to something more similar to the comments
currently below the message, namely that the
SearchTask was no longer referenced and was garbage
collected.

- Eli Tucker

Discussion


Log in to post a comment.