79417608

Date: 2025-02-06 11:00:27
Score: 1.5
Natty:
Report link

To fix it I researched Vector that @user85421 told me about, I ended up finding the synchronizedList class.

What I have done is modify both; the Arraylist results and the destination one ret to this type.

  // Old one List<InformeFacturacionAsociadoDto> ret = new ArrayList<>();
  List<InformeFacturacionProcesado> results = null;
  results = informeFacturacionDAO.getListInformeFactAsociadosV2(cliJurs, centros, desde, hasta, podologos, tipoPrescriptor, prescriptor, servicios, conveniosBusqueda);

   //NEW CODE
  List<InformeFacturacionAsociadoDto> retS = Collections.synchronizedList(new ArrayList<InformeFacturacionAsociadoDto>());
  List<InformeFacturacionProcesado> resultsS = Collections.synchronizedList(results);

This way no null appears and no data is lost.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @user85421
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Bolskan