Project

General

Profile

Actions

bug #8426

closed

IndexOutOfBoundsException during serialization of RegistrationWorkingSet

Added by Andreas Kohlbecker over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
New
Category:
cdmlib
Target version:
Start date:
07/30/2019
Due date:
% Done:

100%

Estimated time:
Severity:
normal
Found in Version:
Tags:

Description

IndexOutOfBoundsException during serialization of RegistrationWorkingSet:

[flora-central-africa] 2019-07-30 15:34:41,493 INFO [qtp532445947-4972] [eu.etaxonomy.cdm.remote.controller.BaseController] - doGetMethod()[doGetAnnotations] GET: /flora-central-africa/reference/c2585e9d-b1c1-4bb1-b40b-f53ae6bc89c4/annotations
[flora-central-africa] 2019-07-30 15:34:41,516 INFO [qtp532445947-4977] [eu.etaxonomy.cdm.remote.controller.RegistrationDTOController] - doGetRegistrationWorkingSet() GET: /flora-central-africa/registrationWorkingSetDTO/c2585e9d-b1c1-4bb1-b40b-f53ae6bc89c4
2019-07-30 15:34:41,540 WARN [qtp532445947-4977] [org.eclipse.jetty.servlet.ServletHandler] - 
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is net.sf.json.JSONException: java.lang.reflect.InvocationTargetException
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:981)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:860)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)

...

Caused by: net.sf.json.JSONException: java.lang.reflect.InvocationTargetException
        at net.sf.json.JSONObject.defaultBeanProcessing(JSONObject.java:818)
        at net.sf.json.JSONObject._fromBean(JSONObject.java:699)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:172)
        at eu.etaxonomy.cdm.remote.view.JsonView.render(JsonView.java:128)
        at eu.etaxonomy.cdm.remote.view.JsonView.render(JsonView.java:188)
        at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1243)
        at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
        ... 61 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor59692.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2116)
        at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1267)
        at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:808)
        at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:884)
        at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:464)
        at net.sf.json.JSONObject.defaultBeanProcessing(JSONObject.java:749)
        ... 70 more
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.rangeCheck(ArrayList.java:657)
        at java.util.ArrayList.get(ArrayList.java:433)
        at eu.etaxonomy.cdm.api.service.dto.RegistrationWorkingSet.getRegistrationDate(RegistrationWorkingSet.java:202)
        ... 79 more
Actions #1

Updated by Andreas Müller over 2 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 50
Actions #2

Updated by Andreas Müller over 2 years ago

  • Target version changed from Release 5.10 to Release 5.9

isn't this very easy to fix? Therefore I put it to 5.9 (and also tried to fix in the meanwhile).

Open question: do we also need to fix getRegistrationDTO(uuid) in line 185:

return registrationDTOs.stream().filter(r -> r.getUuid().equals(registrationUuid) ).findFirst();

I have no experience how findFirst reacts if filter returns an empty stream. Can you have a look.

Actions #3

Updated by Andreas Kohlbecker over 2 years ago

  • Status changed from Resolved to Closed
  • Assignee changed from Andreas Kohlbecker to Andreas Müller
  • % Done changed from 50 to 100

findFirst() will returns an Optional describing the first element of this stream, or an empty Optional if the stream is empty.

So this works as expected.

Your fix for the IOOB Exception looks perfect.

Actions

Also available in: Atom PDF