Solved

Comparing Throwable

Posted on 2004-08-12
9
245 Views
Last Modified: 2013-12-29
I have this in my java code

Throwable t = Status.getException();

Status.getException returns OperationCanceledException.

Is there a way of comaring throwables like strings.

I want to check if the throwable is OperationCanceledException. IF yes.Put a message.


How do i accomplish this.



0
Comment
Question by:rashmi_be
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
9 Comments
 
LVL 5

Expert Comment

by:TrekkyLeaper
ID: 11784018
If i understand correctly, you just want to do this:

if( t instanceof OperationCanceledException ) {
  //do what you want if it is
} else {
  // do what you want if it isn't
}
0
 

Author Comment

by:rashmi_be
ID: 11784142
no t is not an instance of OperationCanceledException
0
 
LVL 5

Accepted Solution

by:
TrekkyLeaper earned 20 total points
ID: 11785919
t is a Throwable, but instanceof will check to see if the actual value (whatever was returned from the getException method call). If I am still misunderstanding, please post more information.
0
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 
LVL 24

Expert Comment

by:sciuriware
ID: 11791018
TrekkyLeaper is right; read the books!
;JOOP!
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12042199
ok
0
 
LVL 5

Expert Comment

by:TrekkyLeaper
ID: 12043151
Thanks, Venabili.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question