Skip to content

Commit 9b8a44d

Browse files
committed
fix bug
1 parent 8a0ea18 commit 9b8a44d

File tree

1 file changed

+3
-4
lines changed
  • document-readers/pdf-reader/src/main/java/org/springframework/ai/reader/pdf/layout

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ class TextLine {
2323
private static final char SPACE_CHARACTER = ' ';
2424

2525
private final int lineLength;
26+
2627
private final char[] line;
28+
2729
private int lastIndex;
2830

2931
TextLine(int lineLength) {
@@ -36,9 +38,6 @@ class TextLine {
3638
}
3739

3840
public void writeCharacterAtIndex(final Character character) {
39-
if (character == null) {
40-
throw new IllegalArgumentException("Character cannot be null");
41-
}
4241
character.setIndex(this.computeIndexForCharacter(character));
4342
int index = character.getIndex();
4443
char characterValue = character.getCharacterValue();
@@ -91,7 +90,7 @@ private int getNextValidIndex(int index, boolean isCharacterPartOfPreviousWord)
9190
if (!this.isNewIndexGreaterThanLastIndex(index)) {
9291
nextValidIndex = this.lastIndex + 1;
9392
}
94-
if (!isCharacterPartOfPreviousWord && index > 0 && this.isSpaceCharacterAtIndex(index - 1)) {
93+
if (!isCharacterPartOfPreviousWord && index > 0 && !this.isSpaceCharacterAtIndex(index - 1)) {
9594
nextValidIndex = nextValidIndex + 1;
9695
}
9796
this.lastIndex = nextValidIndex;

0 commit comments

Comments
 (0)