Annoying Java Bugs - who broke right aligned text fields
Posted by Mark Stephens on Tue, Jul 27, 2010 @ 02:12 AM
Bugs are an unfortunate part of a coder's life. Working in PDF, which has quite an 'elastic' specification and where often real world does not match what is supposedly allowed - Sam yelled at me last week that another PDF file we were looking at was missing supposedly mandatory values - there is lots of scope for coding and logic errors. We have three machines in the office which constantly run regression tests on Windows and Linux, so hopefully we only have to fix a bug once and we can see if a fix breaks other things. So our bugs are a controllable annoyance where we can constantly try to raise our game and improve.
No, the most annoying bugs are the ones we do not write - we can put our hands up to those and can fix them easily...
Last week we had an issue with right aligned text values not appearing correctly. It took some time to hunt this one down as we simply could not reproduce it - until we made sure that we were using the same version of the JVM as our client. It turns out that alignment of right aligned text values was broken in JDK1.6_update 10 and does not appear to have been fixed yet.
The fix is a hack, which adds a spaces to the right of all text values and adds spaces so that all the text values are the same length. Then they align nicely. So tomorrow's release of JPedal has a boolean flag in it to enable this 'hack' to ensure that fields works in all JVMs. Hopefully Sun (or rather Oracle now), will fix it as it is a big deal to anyone writing financial software in Java. It also means that you may need to tie down customers to a certain version of Java to avoid a whole nightmare of issues and work arounds.
Do you have a particularly annoying Java bug?