Thanks Peter,,
i made a bug report for it, hope that OK: 
https://jira.duraspace.org/browse/DS-3296

Ari

On Friday, 19 August 2016 17:30:04 UTC+3, Peter Dietz wrote:
>
> Hi Ari,
>
> Lets walk through:
> GET /items/{itemID}
>
> That will try to find an item with an ID of "something_invalid". 
>
> The code for that lookup is:
> item = itemService.findByIdOrLegacyId(context, id);
> if (item == null)
> {
>         context.abort();
>         log.warn("Item(id=" + id + ") was not found!");
>         throw new WebApplicationException(Response.Status.NOT_FOUND);
> }
>
> So, it does have some logic that if the item isn't found you should get 
> the 404.
> However, it looks like some of the logic inside of the findByIdOrLegacyId 
> is:
> UUID.fromString(id)
>
> Parsing UUID.fromString("something_invalid") is probably what causes the 
> exception that gets thrown, which gets back to REST, and passed along as a 
> 500 server exception, as opposed to 404 not found. I'm guessing that before 
> it tries to parse the UUID, it should ensure that it is a UUID. Otherwise 
> that method should return the null. So, I think this issue resides in 
> ItemServiceImpl, as opposed to REST.
>
> Thanks for the discovery.
>
>
> ________________
> Peter Dietz
> Longsight
> www.longsight.com
> [email protected] <javascript:>
> p: 740-599-5005 x809
>
> On Fri, Aug 19, 2016 at 6:08 AM, Ari <[email protected] <javascript:>> wrote:
>
>> Hi,
>> I'm writing a tool for metadata editing using DSpace's REST API. I wonder 
>> if there will be change in REST API return codes in final release.
>>
>>
>> For example this
>> https://demo.dspace.org/rest/items/something_invalid
>> returns 500 (internal server error) but AFAIK the correct code would be 
>> 404 (not found)
>>
>> Ari
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "DSpace Technical Support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/dspace-tech.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

Reply via email to