This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

SAX problem

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I get
java.lang.NullPointerException
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1132)
at com.abnamro.wcs.orchard.gui.madj.ImportXMLFile.main(ImportXMLFile.java:179)
Exception in thread "main"
from the code below. I copied the source from the JAXP example so I cannot understand why it does not work. What is missing?
Any help much appreciated. Please reply to address below.

reply to:
[EMAIL]john.s.coleman@uk.abnamro.com [/EMAIL]
[ April 29, 2002: Message edited by: Jim Yingst ]
 
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having difficulty locating line 179 where the exception is thrown. COuld you mark it someway?
It sounds like something is not being created properly but what the reason is is hard to say.
John
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ugh. That was too much work just to get the code looking semi-presentable. Anyway, the exception must have been thrown by the line
xmlReader.parse(convertToFileURL(aFileName));
as that's the only place parse() is called. But it's not really clear what the cause is.
 
John Coleman
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jim,
You are correct that the error occurs in the .parse method, and also that there is no way of diagnosing the error.
This makes me wonder if the Sax example in JAXP works. I also wonder if anyone unserstands Sax enough to tell me what is missing? Should I contact the author?
John
 
John Coleman
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem is solved. Although the error message appears to point to a problem in the .parse method, in reality it is the methods that I override that cause the error. In this case a stepwise debug reveals that a string variable was not initialised before use in .startElement method.
The moral of the tale is not to let cryptic error messages put you off running a debug or looking for obvious mistakes.
thanks anyway,
John
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic