Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unread trailing e when scientific notation was expected #91

Open
wants to merge 2 commits into
base: 2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pdfbox/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,19 @@
<sha512>5ae7f232c47c13ed31997eb2c368e7deb1013c1321d70bf79369f8d709b33406191d94c21a5d27b4c4bb48241bafd9328a0a6d2d093d4e540d5044e9503bd099</sha512>
</configuration>
</execution>
<execution>
<id>PDFBOX-5025</id>
<phase>generate-test-resources</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://issues.apache.org/jira/secure/attachment/13015946/issue3323.pdf</url>
<outputDirectory>${project.build.directory}/pdfs</outputDirectory>
<outputFileName>PDFBOX-5025.pdf</outputFileName>
<sha512>d56d05eea079290133246f10ae327b3d51bd213f9e121717cb70155009608fe3164a174f80f92678e42ac00a9b2041ae7933f4f2c5734c9765cf2b145a28fc64</sha512>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,12 @@ private COSNumber parseCOSNumber() throws IOException
{
seqSource.unread(ic);
}
char lastc = buf.charAt(buf.length() - 1);
if (lastc == 'e' || lastc == 'E')
{
buf.deleteCharAt(buf.length() - 1);
seqSource.unread(lastc);
}
return COSNumber.get(buf.toString());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,19 @@ public void testPDFBox4490() throws IOException
doc.close();
}

/**
* Test that PDFBOX-5025 has 1 page.
*
* @throws IOException
*/
@Test
public void testPDFBox5025() throws IOException
{
PDDocument doc = PDDocument.load(new File(TARGETPDFDIR, "PDFBOX-5025.pdf"));
assertEquals(1, doc.getNumberOfPages());
doc.close();
}

private void executeParserTest(RandomAccessRead source, MemoryUsageSetting memUsageSetting) throws IOException
{
ScratchFile scratchFile = new ScratchFile(memUsageSetting);
Expand Down