Re: [Htmlparser-user] Not able to catch ParserException
Brought to you by:
derrickoswald
From: Martin S. <mst...@gm...> - 2007-01-11 12:35:43
|
Hi, While I'm not a developer of HTMLParser, I think it is very unlikely that somewhere in the code a ParseException is printed to standard out. I use StringBean rather intensively in my application, but did not have this problem. The only thing I can think of is that your logger is printing the exception to standard out or something (you are passing the exception to the error method). Does the problem occur when you comment out the logger.error("Coul= d not parse url", e); ? -- Martin 2007/1/11, =D8ystein Lervik Larsen <oys...@me...>: > > 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 =3D ""; > > try { > > StringBean sb; > > > > sb =3D new StringBean (); > > sb.setLinks (false); > > sb.setURL (url); > > content =3D 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. > > > -=D8ystein > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV > _______________________________________________ > Htmlparser-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlparser-user > |