Interesting PDF bugs – Nasty Java JVM bug (revisited)

Here at IDRSolutions, one of the features of our JPedal library is a PDF to image converter. Occasionally we get bug reports from our customers, and if there is an issue in our code we can generally fix it very quickly. However, sometimes we see issues which are specific to the JVM and these can be complex to fix.

pdf_icon

This bug is actually related to one we flagged on our blog in the article Interesting PDF bugs – tiny dash values and the Java JVM. In this case, the JVM was crashing when the dash array contained very small values. This was in 2012 and the code was run on Java 6.

Four years and two releases of Java later, we are still seeing a related error. A customer recently sent in another file which caused Java to crash when using our library. After spending some time debugging the code to find exactly where the crash was happening, we found that the problem was again related to the Stroke class. As with the previous case, it was an issue with drawing a dotted line.

This time, the crash happened when:

  1. the dash phase was equal to 0,
  2. the dash array was not null and
  3. the shape had an end curve.

This kind of error is particularly nasty because it can be very hard to debug. We now have a workaround for this which stops the crash. It is also worrying that something as simple as setting a value can cause the JVM to crash.

Have you ever come across this error? What was your solution?

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (TwitterFacebook and Google+) or the  Blog RSS.

Related Posts:

The following two tabs change content below.

Bethan Palmer

Developer at IDR Solutions
Bethan is a Java developer at IDR Solutions and was a speaker at JavaOne 2016. She has a degree in English Literature and in her spare time enjoys sports including running and handball.
Bethan

About Bethan Palmer

Bethan is a Java developer at IDR Solutions and was a speaker at JavaOne 2016. She has a degree in English Literature and in her spare time enjoys sports including running and handball.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>