You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2021/07/19 18:20:22 UTC
svn commit: r1891662 -
/pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/parser/PreflightParser.java
Author: tilman
Date: Mon Jul 19 18:20:22 2021
New Revision: 1891662
URL: http://svn.apache.org/viewvc?rev=1891662&view=rev
Log:
PDFBOX-4892: optimize, as suggested by valerybokov
Modified:
pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/parser/PreflightParser.java
Modified: pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/parser/PreflightParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/parser/PreflightParser.java?rev=1891662&r1=1891661&r2=1891662&view=diff
==============================================================================
--- pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/parser/PreflightParser.java (original)
+++ pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/parser/PreflightParser.java Mon Jul 19 18:20:22 2021
@@ -410,6 +410,8 @@ public class PreflightParser extends PDF
// signal start of new XRef
xrefTrailerResolver.nextXrefObj(startByteOffset,XRefType.TABLE);
+ Pattern pattern = Pattern.compile("(\\d+)\\s(\\d+)(\\s*)");
+
// Xref tables can have multiple sections. Each starts with a starting object id and a count.
while (true)
{
@@ -421,7 +423,6 @@ public class PreflightParser extends PDF
long offset = source.getPosition();
String line = readLine();
- Pattern pattern = Pattern.compile("(\\d+)\\s(\\d+)(\\s*)");
Matcher matcher = pattern.matcher(line);
if (matcher.matches())
{