linkedin / linkedin/URL-Detector

StringIndexOutOfBoundsException on particular string

Open
#16 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
785
Forks
184
PR merge metrics
No merged PRs in 30d

Description

This string (excluding the double quotes) triggers a StringIndexOutOfBoundsException:
"://VIVE MARINE LE PEN//:@."

```
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:908) ~[na:1.8.0_60]
at java.lang.StringBuilder.substring(StringBuilder.java:76) ~[na:1.8.0_60]
at java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:854) ~[na:1.8.0_60]
at java.lang.StringBuilder.substring(StringBuilder.java:76) ~[na:1.8.0_60]
at com.linkedin.urls.detection.UrlDetector.readDefault(UrlDetector.java:191) ~[url-detector-0.1.17.jar!/:na]
at com.linkedin.urls.detection.UrlDetector.detect(UrlDetector.java:142) ~[url-detector-0.1.17.jar!/:na]
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The stack trace points to UrlDetector.readDefault at line 191, reached through UrlDetector.detect. Reproduce the failure with the quoted string and inspect the substring handling there; done means this input no longer throws StringIndexOutOfBoundsException during detection.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.