An attempt to read beyond the end of stream occurred, why?

I'm trying to get the search to be done in the database and present it in XHTML, but I tried it in different ways using an interator, etc. In this last attempt the error is that Stream is unable to read the constant (apparently)

try {
            
            CursoredStream cursor = gestaoReceitasComerciaisEAO
                    .executeNativeQuery(propertiesLoader.getValor(Constantes.comando.BUSCAR_CONTAS_ABATIMENTO_ORIGEM));;
            
            @SuppressWarnings("unused")
            Object[] record = null;         
            
            while (cursor.hasNext()) {
                
                cursor.next(1000).iterator();
                
                
                Object[] conta = (Object[]) cursor.next();
                                    
                ContaVO contaVO = new ContaVO();
                // validar se é null
                contaVO.setCodigoConta((Long)(conta[0]));
                contaVO.setDescricaoConta((String)conta[1]);
                contaVO.setFlagAbatimentoOrigem((BigDecimal)(conta[2] == null ? 0 : contaVO.getFlagAbatimentoOrigem()));                
                contaVO.setNmRepresentante((String)conta[3] == null ? "" : contaVO.getNmRepresentante());

                listaContasVO.add(contaVO);
                }
            

        } catch (Exception e) {
            e.printStackTrace();
            logger.log(Level.SEVERE, e.getMessage(), e);
            throw new ContaException("Conta não encontrada", e);
        }
        return listaContasVO;
    }

        


Read more here: https://stackoverflow.com/questions/65706025/an-attempt-to-read-beyond-the-end-of-stream-occurred-why

Content Attribution

This content was originally published by Paulo Oliveira at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: