asepaprianto / crawler4j

Automatically exported from code.google.com/p/crawler4j
0 stars 0 forks source link

StringIndexOutOfBoundsException in WebURL #206

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Sometimes there are StringIndexOutOfBoundsException when setting the URL of 
the WebURL class

What is the expected output? What do you see instead?
The given URL is valid, it should be parsed as correctly.

What version of the product are you using?
3.4

The following unit test provides an example url that generates this exception.
    @Test(expected = StringIndexOutOfBoundsException.class)
    public void testUrlSetterThatGeneratesStringIndexOutOfBoundsException()
    {
        WebURL url = new WebURL();
        url.setURL("http://redirect.com");

    }

Original issue reported on code.google.com by acrocraw...@gmail.com on 15 Mar 2013 at 11:30

GoogleCodeExporter commented 9 years ago
The parsing problem seems to be related to the fact that it's a root URL - as 
soon as you add
        url.setURL("http://www.redirect.com/foo");
it works fine.

Original comment by acrocraw...@gmail.com on 15 Mar 2013 at 11:32

GoogleCodeExporter commented 9 years ago
Does it repro in 3.5 as well?

Original comment by ganjisaffar@gmail.com on 15 Mar 2013 at 6:54

GoogleCodeExporter commented 9 years ago

Original comment by avrah...@gmail.com on 18 Aug 2014 at 3:35

GoogleCodeExporter commented 9 years ago
Thank you Acro.

Fixed the bug and added your unit test!

Keep it up.

Fixed in revision: 65954e30f219 

Original comment by avrah...@gmail.com on 19 Aug 2014 at 3:35