Skip to content

Commit

Permalink
close #173: made Matcher an instance property since "Instances of thi…
Browse files Browse the repository at this point in the history
…s class are not safe for use by multiple concurrent threads".
  • Loading branch information
torakiki committed Oct 15, 2024
1 parent 2fd6ad9 commit eeefc63
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/org/sejda/sambox/input/ObjectsFullScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
class ObjectsFullScanner
{
private static final Logger LOG = LoggerFactory.getLogger(ObjectsFullScanner.class);
private static final Matcher OBJECT_DEF_MATCHER = Pattern.compile("(\\d+)[\\s]+(\\d+)[\\s]+obj")
private final Matcher matcher = Pattern.compile("(\\d+)[\\s]+(\\d+)[\\s]+obj")
.matcher("");

private Xref xref = new Xref();
Expand Down Expand Up @@ -77,12 +77,12 @@ private void addEntryIfObjectDefinition(long offset, String line) throws IOExcep
boolean found = false;
if (line.contains("obj"))
{
OBJECT_DEF_MATCHER.reset(line);
while (OBJECT_DEF_MATCHER.find())
matcher.reset(line);
while (matcher.find())
{
long entryOffset = offset + OBJECT_DEF_MATCHER.start();
xref.add(XrefEntry.inUseEntry(Long.parseUnsignedLong(OBJECT_DEF_MATCHER.group(1)),
entryOffset, Integer.parseUnsignedInt(OBJECT_DEF_MATCHER.group(2))));
long entryOffset = offset + matcher.start();
xref.add(XrefEntry.inUseEntry(Long.parseUnsignedLong(matcher.group(1)), entryOffset,
Integer.parseUnsignedInt(matcher.group(2))));
onObjectDefinitionLine(entryOffset, line);
found = true;
}
Expand Down

0 comments on commit eeefc63

Please sign in to comment.