Skip to content

Commit e39c0cc

Browse files
sunyuhan1998spring-builds
authored andcommitted
refactor: Replace System.err.println with log output (#3600)
Fixes #3600 Signed-off-by: Sun Yuhan <sunyuhan1998@users.noreply.github.com> Co-authored-by: Sun Yuhan <sunyuhan1998@users.noreply.github.com> (cherry picked from commit 49df56c)
1 parent 99822a3 commit e39c0cc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

document-readers/pdf-reader/src/main/java/org/springframework/ai/reader/pdf/layout/ForkPDFLayoutTextStripper.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import org.apache.pdfbox.text.PDFTextStripper;
2828
import org.apache.pdfbox.text.TextPosition;
2929
import org.apache.pdfbox.text.TextPositionComparator;
30+
import org.slf4j.Logger;
31+
import org.slf4j.LoggerFactory;
3032

3133
/**
3234
* This class extends PDFTextStripper to provide custom text extraction and formatting
@@ -38,6 +40,8 @@
3840
*/
3941
public class ForkPDFLayoutTextStripper extends PDFTextStripper {
4042

43+
private final static Logger logger = LoggerFactory.getLogger(ForkPDFLayoutTextStripper.class);
44+
4145
public static final boolean DEBUG = false;
4246

4347
public static final int OUTPUT_SPACE_CHARACTER_WIDTH_IN_PT = 4;
@@ -80,7 +84,7 @@ protected void writePage() throws IOException {
8084
this.sortTextPositionList(textList);
8185
}
8286
catch (java.lang.IllegalArgumentException e) {
83-
System.err.println(e);
87+
logger.error("Error sorting text positions", e);
8488
}
8589
this.iterateThroughTextList(textList.iterator());
8690
}

0 commit comments

Comments
 (0)