line number of the source code in the thrown exception  
Author Message
Ahmed Moustafa





PostPosted: 2003-7-15 6:43:00 Top

java-programmer, line number of the source code in the thrown exception Why does it sometimes show the line number of the source code in the
thrown exception and sometimes does not?
Thanks in advance,
Ahmed

 
Ahmed Moustafa





PostPosted: 2003-7-15 6:57:00 Top

java-programmer >> line number of the source code in the thrown exception >>Why does it sometimes show the line number of the source code in the
>>thrown exception and sometimes does not?
>
>
> for native methods it would not have the same mechanism to figure the
> line number out from the address. Does that explain it all?

I am asking about exceptions I throw.

 
Alex Bendig





PostPosted: 2003-7-15 7:30:00 Top

java-programmer >> line number of the source code in the thrown exception Some code showing your throwing and handling of exceptions would be helpful.

Regards,
Alex

"Ahmed Moustafa" <email***@***.com> wrote in message
news:email***@***.com...
> >>Why does it sometimes show the line number of the source code in the
> >>thrown exception and sometimes does not?
> >
> >
> > for native methods it would not have the same mechanism to figure the
> > line number out from the address. Does that explain it all?
>
> I am asking about exceptions I throw.
>


 
 
Ahmed Moustafa





PostPosted: 2003-7-15 7:39:00 Top

java-programmer >> line number of the source code in the thrown exception > Some code showing your throwing and handling of exceptions would be helpful.

Say,

<code>
public void methodX() thorns XException {
try {
Some code that will throw an exception...
} catch (Exception e) {
throw new XException ( "Error: " + e.getMessage() );
}
</code>

> Regards,
> Alex
>
>>>>Why does it sometimes show the line number of the source code in the
>>>>thrown exception and sometimes does not?
>>>
>>>
>>>for native methods it would not have the same mechanism to figure the
>>>line number out from the address. Does that explain it all?
>>
>>I am asking about exceptions I throw.

 
 
J





PostPosted: 2003-7-15 8:08:00 Top

java-programmer >> line number of the source code in the thrown exception On Mon, 14 Jul 2003 18:42:36 -0400, Ahmed Moustafa wrote
(in message <wlGQa.100946$email***@***.com>):

> Why does it sometimes show the line number of the source code in the
> thrown exception and sometimes does not?
> Thanks in advance,
> Ahmed
>

I think if you have debugging turn OFF, then line numbers will not show up.

J

 
 
brougham3





PostPosted: 2003-7-15 8:39:00 Top

java-programmer >> line number of the source code in the thrown exception Ahmed Moustafa <email***@***.com> wrote:

>Why does it sometimes show the line number of the source code in the
>thrown exception and sometimes does not?
>Thanks in advance,
>Ahmed

When you are using javac to compile, what option are you using for -g?
 
 
Sudsy





PostPosted: 2003-7-15 9:24:00 Top

java-programmer >> line number of the source code in the thrown exception Ahmed Moustafa wrote:
> Why does it sometimes show the line number of the source code in the
> thrown exception and sometimes does not?
> Thanks in advance,
> Ahmed
>

I've found that the JIT discards the debug informtion (such as line
numbers) and you'll just see (IIRC) "compiled code". I turn the JIT
off during debugging. How you do that depends on your environment.

 
 
Ahmed Moustafa





PostPosted: 2003-7-15 12:07:00 Top

java-programmer >> line number of the source code in the thrown exception >>Why does it sometimes show the line number of the source code in the
>>thrown exception and sometimes does not?
>
> When you are using javac to compile, what option are you using for -g?

I am not using -g with javac. I am compiling with WSAD, maybe I need to
check the settings.

 
 
Jon A. Cruz





PostPosted: 2003-7-15 15:18:00 Top

java-programmer >> line number of the source code in the thrown exception Sudsy wrote:
> I've found that the JIT discards the debug informtion (such as line
> numbers) and you'll just see (IIRC) "compiled code". I turn the JIT
> off during debugging. How you do that depends on your environment.
>


I've only seen that with older JITs, not newer ones.

 
 
Jon Skeet





PostPosted: 2003-7-15 15:24:00 Top

java-programmer >> line number of the source code in the thrown exception Sudsy <email***@***.com> wrote:
> I've found that the JIT discards the debug informtion (such as line
> numbers) and you'll just see (IIRC) "compiled code".

That hasn't been the case since HotSpot was introduced a *long* time
ago.

--
Jon Skeet - <email***@***.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
 
 
Tor Iver Wilhelmsen





PostPosted: 2003-7-18 2:16:00 Top

java-programmer >> line number of the source code in the thrown exception Ahmed Moustafa <email***@***.com> writes:

> Why does it sometimes show the line number of the source code in the
> thrown exception and sometimes does not?

It only does for classes with line number debug info present.