From a03f7d5d73c6cb7a7fc8eced1d3c4e0160c8f2a8 Mon Sep 17 00:00:00 2001 From: David Frizelle <48738745+dafriz@users.noreply.github.com> Date: Fri, 30 May 2025 10:48:48 +1000 Subject: [PATCH] Bump org.apache.pdfbox to 3.0.4 and guard against empty unicode strings (#3271) Fixes: #3265 * Bump org.apache.pdfbox to 3.0.4 * Guard against empty unicode strings Auto-cherry-pick to 1.0.x Signed-off-by: David Frizelle --------- Signed-off-by: David Frizelle --- .../ai/reader/pdf/layout/CharacterFactory.java | 4 ++-- pom.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/document-readers/pdf-reader/src/main/java/org/springframework/ai/reader/pdf/layout/CharacterFactory.java b/document-readers/pdf-reader/src/main/java/org/springframework/ai/reader/pdf/layout/CharacterFactory.java index b3e491d13..6eae80a7e 100644 --- a/document-readers/pdf-reader/src/main/java/org/springframework/ai/reader/pdf/layout/CharacterFactory.java +++ b/document-readers/pdf-reader/src/main/java/org/springframework/ai/reader/pdf/layout/CharacterFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 the original author or authors. + * Copyright 2023-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -94,7 +94,7 @@ class CharacterFactory { private char getCharacterFromTextPosition(final TextPosition textPosition) { String string = textPosition.getUnicode(); - char character = string.charAt(0); + char character = !string.isEmpty() ? string.charAt(0) : '\0'; return character; } diff --git a/pom.xml b/pom.xml index 29a12653a..b403eb5ef 100644 --- a/pom.xml +++ b/pom.xml @@ -280,7 +280,7 @@ 3.25.2 - 3.0.3 + 3.0.4 0.1.6 2.20.11 24.09