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

Re: [Handle-info] resovleHandle method query



Hi Sean,

Good thinking - we use the SQL database backend, so looking in the SQLHandleStorage class, it appears that an empty ResultSet (i.e. the handle not being found) and no values matching the type(s) are not differentiated within the getRawHandleValues method. In both instances "null" is returned and so the doResolution method of HandleServer class creates an RC_HANDLE_NOT_FOUND error response.

I added a flag in getRawHandleValues to indicate whether at least the handle was found and used this to determine whether "null" or an empty values array should be returned and this resulted in better behaviour in that an error response of RC_VALUES_NOT_FOUND was set. Although this improves the situation I'm not sure that this case should be treated as an error, and I don't think an exception should be thrown since if applying type/index filters this would seem a likely and sometimes expected outcome. Since doResolution is a generic method, removing the code which throws an exception when no values are found may have side effects; I did make a change in the code just to check my assumptions but I'm not sure it is the correct fix (basically I altered doResolution to not throw an exception in the case where no handle values are returned and req.RequestedTypes is not empty).

For now I'll stick with a post-resolve filter of values rather than use a customised version of handle.jar, but I think a fix to SQLHandleStorage class would be good for the next API release as that at least allows differentiation between the handle not being found and no values being found. As to the doResolution exception throwing that probably needs someone with more experience across the entire code base to advise whether the fix outlined above is safe.

Scott.

Sean Reilly wrote:
Hi Scott,

You are right that that method is supposed to return an empty array if the handle exists but has no values of the specified types. This might be related to the server since they list of types are sent along with the resolution method. Can you examine your access log to see what response code is being returned for that query? That should indicate whether the server is responsible for the "handle not found" response or if it is a bug in the client. I suspect that it is something on the server side, especially if your server is using something other than the default handle storage component.

Thanks,
Sean

On Aug 20, 2009, at 9:58 PM, Scott Yeadon wrote:

Hi,

Just a question on the handle API. If I use the following Resolver class resolveHandle method:
public HandleValue[] resolveHandle(String handle, String typeList[], boolean secure)


and the handle does not contain any values of the type(s) in typeList, a HandleException with an error of HANDLE_DOES_NOT_EXIST is thrown. The hdl6.2.5_02 API docs state "The requested handle values are then extracted from the response and returned (or an exception is thrown if there was an error). " When a value with a type in typeList is present it behaves as I would expect.

Is this a bug or the expected behaviour? I was hoping for a null or empty array to be returned if the handle actually existed. It's no biggie since I can use one of the other methods and post-filter but if it's not me doing something dumb it might be good to either log as a bug for a future release or provide clarification in the API docs.

Thanks.

Scott.


_______________________________________________ Handle-Info mailing list Handle-Info@cnri.reston.va.us http://www.handle.net/mailman/listinfo/handle-info






_______________________________________________ Handle-Info mailing list Handle-Info@cnri.reston.va.us http://www.handle.net/mailman/listinfo/handle-info