How to minimize "Unknown source" Exceptions?

Hi,

I've been writing a few applications recently and compiling with javac, and I've noticed that many of the Exceptions I get have "Unknown source" in the stack trace. This isn't a problem in my applications as they're all very small, but in a larger application this would be a huge pain to debug.

Basically, I do not even know what causes "Unknown source" exceptions. I assume mine are due to some flaw in my design. I couldn't find any information on these forums or on Google, because "Unknown source exception" isn't exactly the easiest term to search for, as it will simply return millions of stack traces of unknown source, and not what I actually want to find out.

For example, in one class I have two private methods, createInitializationData(), and initializeClient(). I also have a public method, run(), as the class implements Runnable. I start this class in a new thread, and the run() method will call the initializeClient() method, which will call the createInitializationData() method. Whenever I get an exception in this program, it is always "Unknown source".

I have two questions:

(1) What causes "Unknown source" Exceptions? Is it something preventable through an alteration in design?

(2) What is the best way to minimize these types of Exceptions? Is there a common flaw I should be aware of?

Thanks,

Dan

[1390 byte] By [Djaunla] at [2007-11-27 11:25:30]
# 1

If you are using ant for build purposes, please note that ant omits debug information from compiled class by default. Hence producing exact line number in case of an error is not possible. The solution however is simple. I just modified my build file to turn debug on and to set debuglevel="lines,vars,source" under javac target in ant, and everything worked fine.

kilyasa at 2007-7-29 16:04:49 > top of Java-index,Java Essentials,Java Programming...
# 2

> If you are using ant for build purposes, please note

> that ant omits debug information from compiled class

> by default. Hence producing exact line number in case

> of an error is not possible. The solution however is

> simple. I just modified my build file to turn debug

> on and to set debuglevel="lines,vars,source" under

> javac target in ant, and everything worked fine.

Hah, that would explain it perfectly, as I do use Ant for build purposes. Is something like this (a tool not including debug information) the only thing that would cause this?

Thanks a lot

Djaunla at 2007-7-29 16:04:49 > top of Java-index,Java Essentials,Java Programming...
# 3

Yes.

Unless of course you're using a 3rd party library built without debug information.

jwentinga at 2007-7-29 16:04:49 > top of Java-index,Java Essentials,Java Programming...