tags:

views:

60

answers:

1

I am starting on an enhancement to an existing Java applet where I let the user hit a link in a menu item, and open a page in his/her default browser. Some of our deployed code is in Java 1.4, while the majority of it is in Java 5. This prevents me from using the Desktop API in Java 6. It looks like the easiest way to solve the problem is to integrate BrowserLauncher2 into the application.

The wrinkle is that the existing code includes an early version of BrowserLauncher.java (version 1.4b1 (Released June 20, 2001)). Unlike the original, BrowserLauncher2 is more than just one class. It appears to have a ton of enhancements of which I'd like to take advantage.

I think I will use the newer release for my needs, and just drop the references to the old version in the legacy code. I have a pretty good suite of existing unit tests on the old code, and will do some functional testing on the code where I make the swap.

Does anyone who has already been down the upgrade path from older versions of BrowserLauncher have any advice on potential gotchas?

A: 

Well, that's what you get for asking such an obscure question. Instead of letting an unanswered question sit abandoned, I'll share what I've learned.

The BrowserLauncher class in BrowserLauncher2 has deprecated the old static openURL(String) method. In addition, while the old method threw an IOException, the new one throws a different set of exceptions.

It's therefore necessary to rewrite your catch blocks, and is probably a good idea to convert static calls to openURL(String) into calls to methods on an actual BrowserLauncher object.

Given the improvements in BrowserLauncher2, however, it's probably worth it.

Stephen Harmon