?
Solved

JBuilder 7 error:  catch

Posted on 2003-02-25
4
Medium Priority
?
199 Views
Last Modified: 2010-03-31
I am getting this error in my code for catch;


try
    {
      SAXParserFactory spf =SAXParserFactory.newInstance
     ();
      SAXParser parser = spf.newSAXParser();
      XMLReader r = parser.getXMLReader();
    }
 catch(IOException e) {
      e.printStackTrace();
    }

Error:
The exception can never be thrown in the corresponding try block.
0
Comment
Question by:kaushalshah
[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
4 Comments
 
LVL 2

Accepted Solution

by:
warsql earned 200 total points
ID: 8030914
If you check the javadoc for the methods you are using in your try block, you will not find IOException.  That is why you are getting that error.

newInstance() throws FactoryConfigurationError
newSAXParser() throws ParserConfigurationException,
                      SAXException
getXMLReader() throws SAXException

So, you want to catch these exceptions instead.

0
 

Expert Comment

by:CleanupPing
ID: 9059070
kaushalshah:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9672037
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept warsql's comment as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jimmack
EE Cleanup Volunteer
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month11 days, 18 hours left to enroll

752 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