Skip to content

getStatus() throws InternalError if called for an Investigation having no datasets #173

@RKrahl

Description

@RKrahl

Best explained by an example that reproduces the issue:

>>> from icat.ids import DataSelection
>>> sel = DataSelection(dict(investigationIds=[8860]))
>>> client.ids.getStatus(sel)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/site-packages/icat/ids.py", line 332, in getStatus
    return self.opener.open(req).read().decode('ascii')
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/urllib/request.py", line 525, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/urllib/request.py", line 634, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/urllib/request.py", line 563, in error
    return self._call_chain(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/urllib/request.py", line 496, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/icat/ids.py", line 78, in http_error_default
    raise err
icat.exception.IDSInternalError: class javax.ejb.EJBTransactionRolledbackException Exception thrown from bean: java.lang.ClassCastException: class javax.json.JsonValueImpl cannot be cast to class javax.json.JsonNumber (javax.json.JsonValueImpl and javax.json.JsonNumber are in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @6a38b53d)

In this case, 8860 is either the id of an investigation that has no datasets or no investigation with that id exists.

This has been observed with icat.server 5.0.3 and ids.server 1.12.2. Still need to verify whether it happens with up-to-date versions as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions