From 241a0744c42b40baa3de5e7da87283386d281e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Manelphe?= Date: Mon, 22 Jan 2024 16:15:00 +0100 Subject: [PATCH] fix: nb char extraction --- .../core/service/p2chargement/operation/ChargementBrut.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arc-core/src/main/java/fr/insee/arc/core/service/p2chargement/operation/ChargementBrut.java b/arc-core/src/main/java/fr/insee/arc/core/service/p2chargement/operation/ChargementBrut.java index c6bcc5e50..64fea20b2 100644 --- a/arc-core/src/main/java/fr/insee/arc/core/service/p2chargement/operation/ChargementBrut.java +++ b/arc-core/src/main/java/fr/insee/arc/core/service/p2chargement/operation/ChargementBrut.java @@ -51,7 +51,8 @@ private String requeteFichierBrutalement(String idSource, BufferedReader br, int int idLigne = nbBoucle * LIMIT_CHARGEMENT_BRUTAL_NB_LIGNE; String line; try { - line = br.readLine().substring(0, LIMIT_CHARGEMENT_BRUTAL_NB_CHAR); + line = br.readLine(); + line = line.substring(0, Math.min(line.length(), LIMIT_CHARGEMENT_BRUTAL_NB_CHAR)); } catch (IOException e) { throw new ArcException(e, ArcExceptionMessage.FILE_READ_FAILED, idSource); }