Package org.htmlparser.util

Examples of org.htmlparser.util.ParserException


            else
                ret = type.startsWith ("text/html");
        }
        catch (Exception e)
        {
            throw new ParserException ("URL " + link + " has a problem", e);
        }
       
        return (ret);
    }
View Full Code Here


                        }
                    }
                    catch (UnknownHostException uhe)
                    {
                        int message = (int)(Math.random () * FOUR_OH_FOUR.length);
                        throw new ParserException (FOUR_OH_FOUR[message], uhe);
                    }
                    catch (IOException ioe)
                    {
                        throw new ParserException (ioe.getMessage (), ioe);
                    }
                }
                finally
                {
                    if ((null != getProxyHost ()) && (0 != getProxyPort ()))
                    {
                        sysprops = System.getProperties ();
                        if (null != set)
                            sysprops.put ("proxySet", set);
                        else
                            sysprops.remove ("proxySet");
                        if (null != host)
                            sysprops.put ("proxyHost", host);
                        else
                            sysprops.remove ("proxyHost");
                        if (null != port)
                            sysprops.put ("proxyPort", port);
                        else
                            sysprops.remove ("proxyPort");
                        if (null != host2)
                            sysprops.put ("http.proxyHost", host2);
                        else
                            sysprops.remove ("http.proxyHost");
                        if (null != port2)
                            sysprops.put ("http.proxyPort", port2);
                        else
                            sysprops.remove ("http.proxyPort");
                        System.setProperties (sysprops);
                    }
                }
            }
            catch (IOException ioe)
            {
                String msg = "Error in opening a connection to "
                    + url.toExternalForm ();
                ParserException ex = new ParserException (msg, ioe);
                throw ex;
            }
        }
        while (repeat);

View Full Code Here

                ret = openConnection (url);
            }
            catch (MalformedURLException murle2)
            {
                String msg = "Error in opening a connection to " + string;
                ParserException ex = new ParserException (msg, murle2);
                throw ex;
            }
            catch (IOException ioe)
            {
                String msg = "Error in opening a connection to " + string;
                ParserException ex = new ParserException (msg, ioe);
                throw ex;
            }
        }

        return (ret);
View Full Code Here

      String msg;
      if (tag != null)
        msg = tag.getText();
      else
        msg = "null";
      throw new ParserException(
          "HTMLFrameScanner.extractFrameLocn() : Error in extracting frame location from tag " + msg, e);
    }
  }
View Full Code Here

    try {
      ret = url.openConnection();
    } catch (IOException ioe) {
      String msg = "HTMLParser.openConnection() : Error in opening a connection to " + url.toExternalForm();
      ParserException ex = new ParserException(msg, ioe);
      if (null != feedback)
        feedback.error(msg, ex);
      throw ex;
    }
View Full Code Here

        ret = ParserHelper.openConnection(url, feedback);
        if (null != feedback)
          feedback.info(url.toExternalForm());
      } catch (MalformedURLException murle2) {
        String msg = "HTMLParser.openConnection() : Error in opening a connection to " + string;
        ParserException ex = new ParserException(msg, murle2);
        if (null != feedback)
          feedback.error(msg, ex);
        throw ex;
      } catch (IOException ioe) {
        String msg = "HTMLParser.openConnection() : Error in opening a connection to " + string;
        ParserException ex = new ParserException(msg, ioe);
        if (null != feedback)
          feedback.error(msg, ex);
        throw ex;
      }
    }
View Full Code Here

      String msg;
      if (tag != null)
        msg = tag.getText();
      else
        msg = "null";
      throw new ParserException("HTMLLinkScanner.extractLink() : Error while extracting link from tag " + msg
          + ", url = " + url, e);
    }
  }
View Full Code Here

   */
  public void crawl(int crawlDepth) throws ParserException {
    try {
      crawl(parser, crawlDepth);
    } catch (ParserException e) {
      throw new ParserException("HTMLParserException at crawl(" + crawlDepth + ")", e);
    }
  }
View Full Code Here

      String errorMsg;
      if (tagContents != null)
        errorMsg = tagContents.toString();
      else
        errorMsg = "null";
      throw new ParserException("Tag.scan() : Error while scanning tag, tag contents = " + errorMsg
          + ", tagLine = " + tagLine, e);
    }
  }
View Full Code Here

      if (relativeLink == null)
        return "";
      else
        return processor.extract(relativeLink, url);
    } catch (Exception e) {
      throw new ParserException(
          "HTMLImageScanner.extractImageLocn() : Error in extracting image location, relativeLink = "
              + relativeLink + ", url = " + url, e);
    }
  }
View Full Code Here

TOP

Related Classes of org.htmlparser.util.ParserException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.