Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2008

Tip: Looking for answers? Try searching our database.

String Index out bound exception : 34

Thread view: 
Sanjeev - 30 Jun 2008 13:50 GMT
dear gurus

i m reading XML file in the form of string.

below is the code.

private void parseDocument(String receivedMessage) {
//get a factory
SAXParserFactory spf = SAXParserFactory.newInstance();
try {
   //get a new instance of parser
   SAXParser sp = spf.newSAXParser();

  //parse the file and also register this class for call backs
  sp.parse(new InputSource(new
ByteArrayInputStream(receivedMessage.getBytes())), this);

}catch(SAXException se) {
}catch(ParserConfigurationException pce) {
}catch (IOException ie) {
}
}

In this code i m getting error on line started with "sp.parse(..."

could any one help why i m getting this error..

thanking in advance

Regards
Sanjeev
Lew - 30 Jun 2008 13:55 GMT
> dear gurus
>
[quoted text clipped - 22 lines]
>
> could any one help why i m getting this error..

Please do not use txtspeak.

Where do you get the XML input?  Did you create it beforehand?

You're most likely getting an error (*what* error?  Please copy-and-paste it
into your post in future) because the XML document is either not valid or not
well-formed.

You ignore every exception, so of course you lack the information necessary to
debug the code.  Put logging statements, or at the very, very least
System.err.println() calls (never System.out for this purpose) into your catch
blocks that tell you about the exception.

Signature

Lew

Andrew Thompson - 30 Jun 2008 14:17 GMT
...
> You're most likely getting an error (*what* error?  Please copy-and-paste it
> into your post in future) ...

<http://pscode.org/javafaq.html#exact>

> You ignore every exception, so of course you lack the information necessary to
> debug the code.  

<http://pscode.org/javafaq.html#stacktrace>

>..Put logging statements, or at the very, very least
> System.err.println() ...

If I call ..

 System.err.println( e.getMessage() );

.. I often look at the message and immediately
think - 'I need a stacktrace of that'..

 e.printStackTrace();

..aah yes, that's better.  It's also shorter.

(Yes, logging is superior to either.)

--
Andrew Thompson
http://pscode.org/
Andrew Thompson - 30 Jun 2008 16:25 GMT
=2E..
> You're most likely getting an error (*what* error? =A0Please copy-and-pas=
te it
> into your post in future) ...

> You ignore every exception, so of course you lack the information necessa=
ry to
> debug the code. =A0

>..Put logging disruptions, or at the very, very least
> System.err.println() ...

If I call ..

 System.publish.println( e.getMessage() );

=2E. I often look at the response and obviously
think - 'I need a stacktrace of that'..

 e.printStackTrace();

=2E.aah yes, that's better. It's also shorter.

(Yes, logging is superior to either.)

--
Pamela Muldoon
http://pscode.org/

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
'Now, we are getting very close to the truth of the matter here.
Mason Trent Lott [33rd Degree] sees fellow Mason, President
Bill Clinton, in trouble over a silly little thing like Perjury
and Obstruction of Justice.

Since Lott took this pledge to assist a fellow Mason,
"whether he be right or wrong", he is obligated to assistant
Bill Clinton. "whether he be right or wrong".

Furthermore, Bill Clinton is a powerful Illuminist witch, and has
long ago been selected to lead America into the coming
New World Order.

As we noted in the Protocols of the Learned Elders of Zion,
the Plan calls for many scandals to break forth in the previous
types of government, so much so that people are wearied to death
of it all.'

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This is just a reminder.
It is not an emergency yet.
Were it actual emergency, you wouldn't be able to read this.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.