I h开发者_C百科ave a distributed JBoss-based application that shows a buggy behavior when compiled and run with Java 1.6. It shows an another bug when compiled with Java 1.5 and run with Java 1.6. But it works fine when compiled and run with Java 1.5. What is the best approach to debug this application? Is there a lint for Java 1.5 to 1.6 conversion?
Of course the behavior also depends on the third-party libraries I am using. I am using JBoss 4.0.3 (and several other libraries too!), which I understand is a quite old version. Before I move on to upgrade the JBoss version, I want to make sure that the issue is not related to my code.
Depending on the size of application and complexity of its calls to third party libraries, you could do this. Write mock-up methods which actually returns the value that is returned by third party library calls and compile/run it with both Java versions. In this way, you could be sure that your code is not doing anything wrong. I know this is the most painful way :). But if you already have unit tests for this application in place, you might just need small changes around it.
First of all, be certain you run with the latest version of Java 6. If you use Sun Java then the update 10 changed a LOT of things, and there was still small things being corrected in the following releases.
Secondly verify with JBoss that your version is Java 6 compatible.
If that isn't enough, you'll have to treat the differences as bugs, and figure it out one by one. At least you can run two sessions in parallel - one with Java 6 and one with Java 5 - so you can see what the expected behaviour is.
精彩评论