Results 1 to 9 of 9
  1. #1
    tsili is offline Member
    Join Date
    May 2010
    Posts
    8
    Rep Power
    0

    Exclamation problem with the pageFetcher

    Hello, I use this code
    for(int i = 0; i < citylink.length; i++) {
    body=pF.fetchpage(citylink[i][1]);
    // It's for taking the url from the table citylink
    // and returns the source of this url!
    i have also declared it in my pagefetcher.java class like this:



    public String fetchPage(String url) {
    try {
    url = URIUtil.encodeQuery(url);
    } catch (URIException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    but when I compile it it says that the method fetchpage(String) is undefined for the type PageFetcher and I can't run my problem! I don't know what to do.
    then i corrected and in pagefetcher.java and i put citylink everywhere exists the url but it still doesn't compile.....

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,449
    Rep Power
    25

    Default

    Please post the full text of the error message.
    Also will need to see the code the defines the class and the references to the class.

  3. #3
    tsili is offline Member
    Join Date
    May 2010
    Posts
    8
    Rep Power
    0

    Default

    the errors are two
    at Weather.main(Weather.java:226)
    at PageFetcher.fetchPage(PageFetcher.java:108)

  4. #4
    tsili is offline Member
    Join Date
    May 2010
    Posts
    8
    Rep Power
    0

    Default

    what code to u exactly want?the weather.java or the pagefetcher.java?

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,449
    Rep Power
    25

    Default

    Please post the full text of the error message.
    You've only shown one line. Need all of it.

  6. #6
    tsili is offline Member
    Join Date
    May 2010
    Posts
    8
    Rep Power
    0

    Default

    this is what it says to me when i compile it
    at PageFetcher.fetchPage(PageFetcher.java:108)
    get = new GetMethod(citylink); it refers here in my pagefetcher.java
    at Weather.main(Weather.java:226)
    body=pF.fetchPage(citylink[i][1]);
    it also gets me an error that says
    Description Resource Path Location Type
    This method must return a result of type String Weather.java weather8/src line 35 Java Problem
    private static String getSnippetFrom(String body, String prefix,//it's right here
    String suffix) {
    final int kSnippetLength = 2500;
    try {

    Matcher m = Pattern.compile(prefix).matcher(body);
    String snippet;
    if (m.find())
    {

    snippet = body.substring(m.end(0), body.length());
    if (suffix != null && snippet.indexOf(suffix) > 0) {
    snippet = snippet.substring(0, snippet.indexOf(suffix));
    }
    if (snippet.length() > kSnippetLength) {
    snippet = snippet.substring(0, kSnippetLength);

    snippet = HtmlMethods.stripOutTags(snippet);
    return snippet;
    }
    }

    else

    return "";

    }

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,449
    Rep Power
    25

    Default

    When posting formatted text please put it in Quote tags to preserver the indentation.
    What you have posted is very hard to read.

    I expect to see something like this:
    estArrayDef.java:11: cannot find symbol
    symbol : variable object
    location: class TestArrayDef
    object.method(10);
    ^
    Just noticed that you've spelled your classes using different case: upper and lower. Java is case sensitive. Be sure all spellings are identical
    Last edited by Norm; 06-01-2010 at 11:56 PM.

  8. #8
    tsili is offline Member
    Join Date
    May 2010
    Posts
    8
    Rep Power
    0

    Default

    i use eclipse how i can see it in this way??because it doesn't appear t me like this

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,449
    Rep Power
    25

    Default

    Sorry, I don't know how to get error messages out of your IDE. Is there a log file where they are written?

    Post a question on the forum section for eclipse on how to get a copy of the error messages.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •