linkedin / URL-Detector

A Java library to detect and normalize URLs in text
783 stars 186 forks source link

Fixed [Issue #12] [Issue #16] #17

Open BenEast opened 7 years ago

BenEast commented 7 years ago

--[Issue #12] Fixed StringIndexOutOfBoundsException when given 'http://user:pass@host.com host.com' as input string--

Updated url-detector.processColon to set length to 0 when readUserPass(length) is true.

All unit tests passed after this update.

--[Issue #16] Fixed StringIndexOutOfBoundsException when input string contains the substring "//:@."--

Updated conditional statements in url-detector.processColon() to clear the buffer if it has contents when readUserPass fails, and to set length to 0 otherwise.

This resolved Issue #16 regarding a StringIndexOutOfBoundsException being thrown when provided the input string "://VIVE MARINE LE PEN//:@.".

All unit tests still pass after this update.

pgalbraith commented 6 years ago

@tzuhanjan will this be included?

cstroe commented 6 years ago

This PR seems to be missing tests in TestUriDetection.java:

  @Test
  public void testTwoUrls() {
    runTest("http://user:pass@host.com host.com", UrlDetectorOptions.Default, "http://user:pass@host.com", "host.com");
  }

  @Test
  public void testSlashes() {
    runTest("://TEST//:@.", UrlDetectorOptions.Default);
  }