Search "soil" in metacat causes an exception
After release 1.7, we made some changes in metacat search part. I found search "datos" caused an exception:
[ERROR]: Exception in DBQuery.findDocuments: null [edu.ucsb.nceas.metacat.DBQuery]
I digged around and found the problem was that there were duplicate docids in DocumentResutlSet object and it caused to remove docid (key) from a hashtable mutiple times, which only had one key for a docid. The reason the object had duplicated docids was the back tracing process didn't get rid of the duplicated docids. I fixed the problem and search "datos" works.
However, search "soil" and other stuff still bring the exception. We need to fix it.
#1 Updated by Jing Tao about 14 years ago
This bug was caused by the new private class ResultDocumentSet. In addRelationship method, we have Iterator docidkey which is got from a Vector docid in class ResultDocumentSet. Then there is a while loop for Iterator docidkey. However, during this while loop, if there is a beta6 doc, the docid Vector will be have remove and put operation. Those operations to Vector will cause original Iterator docidkeys be invalid. So call "docidkey.next()" will cause the exception.
Solution, rather than remove and put action to the Vector, a set() method was added to ResultDocumentSet. This method would NOT cause concurrent modification to the Vector.