• Post Reply Bookmark Topic Watch Topic
  • New Topic

Which exception is thrown?  RSS feed

 
MaxJan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which exception is thrown when a native method breaks?
For example: when a native method cannot access some device.

Is it RunTimeException, or just plain Exception, or perhaps something else?

Thanks.
 
Makarand Parab
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
It has to be remote exception. I feel it will subclass of Remote Exception or remote exception itself. PLease check the subclass of RemoteException.

Let me know if i am wrong.

Regards
Makarand Parab
 
Makarand Parab
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It can be IOException or Subcalss of IOException. Remote Exception is subclass of IOException.

Regards
Makarand Parab
 
MaxJan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks for your reply.
Im using Eclipse. And usually when (any) exception is thrown (and not captured, of course in Console window says something like:


But in case when native method "breaks" it just says: description...

So that is my doubt. It doesn't indentify which exception is it.

Thanks.
 
Makarand Parab
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To Know which exception it is
Try to catch it by placing a try/catch block
inside catch block have
try
{}
catch(Exception e)
{
System.out.println("Name of the Exception :: " + e.getClass().getName());
e.printStackTrace(); /*prints where it failed and other details*/
}


let me know

Regards
Makarand Parab
 
MaxJan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You could be right. (Never thougt to use reflection in this case )
I'll let you know what happens as soon as I catch it. It doesn't brake always, it does it rather randomly.

Thanks.
 
Makarand Parab
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keep me posted.

Regards
Makarand Parab
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!