Re: [Htmlparser-user] Not able to catch ParserException
Brought to you by:
derrickoswald
From: <oys...@me...> - 2007-01-11 09:19:40
|
Martin Sturm wrote: > Hi, Good morning, thanks for your reply! > Are you sure you are running your own program? Not quite sure what you mean there... > StringExtractor is only a sample application for the StringBean, so it > would be better to use the StringBean directly instead of StringExtractor. I tried that too and the same thing happened, see below. > I did not experience your problem (I use StringBean rather intensively) > and it would mean that the ParserException is catched somewhere in the > HTMLParser codebase and printed directly to standard out. This is not > very likely I think. That is exactly what I'm suspecting. Though unlikely - is it possible? > Maybe you can try to use StringBean directly insttead of StringExtractor: > > String content = ""; > try { > StringBean sb; > > sb = new StringBean (); > sb.setLinks (false); > sb.setURL (url); > content = sb.getStrings(); > System.out.println(content); > } catch (ParserException e) { > logger.error("Could not parse url", e); > System.out.println("test"); > } I modified my code according to your example but removed the try/catch and the exception was still written to the console the same way as it used to. When I'm not catching the exception I guess it get caught some place else? The exception occurs when the web server responds with http error code 401 Unauthorized. I'm developing a web application using Tomcat and Spring framework if that's relevant. -Øystein |