Post by:Ernest Friedman-Hill
author and iconoclast
Well, you don't say where the NPE happens -- the stack trace has a lot of useful information in it. But one thing I see here is that if the getConnection() method fails, it prints an exception message and returns null. Then the code that calls getConnection() fails to test the return value for null; so if getConnection() fails, you'll get an NPE in its client code.
If getConnection() fails, the routine that calls it should fail, too, so actually, getConnection() should not catch those exceptions; it should just let them go up and abort the caller.
Post by:marc weber
Now that I've looked closer at your previous post, I see that this is a continuation of that topic. Please continue this discussion in that original thread, rather than starting a new thread. Thanks!
No matter. Try again. Fail again. Fail better. This time, do it with this tiny ad:
Download Free Java APIs to Work with Office Files and PDF