Solved

Comparing Throwable

Posted on 2004-08-12
9
242 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

734 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