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.
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:
- the dash phase was equal to 0,
- the dash array was not null and
- 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?
Did you know...
IDRsolutions offers a whole range of online file converters to convert PDF and Microsoft Excel, Word and Office Documents to HTML5, SVG or image formats?
It is free to use for single file conversions and also includes Developer links if you want to use our commercial software for bulk conversions. Find out more on this page