java-multithread-downloader icon indicating copy to clipboard operation
java-multithread-downloader copied to clipboard

String index out of range!

Open akanshSirohi opened this issue 5 years ago • 2 comments

java.lang.StringIndexOutOfBoundsException: String index out of range: -1 My code looks like this

String url=urls.get(options_list.getSelectionModel().getSelectedIndex());
String filename = file.getAbsolutePath();
DownloadManager downloadManager = DownloadManager.getInstance();
DownloadMission mission = new DownloadMission(url,"",filename);
downloadManager.addMission(mission);
downloadManager.start();

akanshSirohi avatar May 22 '19 13:05 akanshSirohi

You may have a problem on the first line of the attached code. Maybe the index is taken wrong

deVDem avatar Jan 09 '20 15:01 deVDem

java.lang.StringIndexOutOfBoundsException: String index out of range: -1 My code looks like this

String url=urls.get(options_list.getSelectionModel().getSelectedIndex());
String filename = file.getAbsolutePath();
DownloadManager downloadManager = DownloadManager.getInstance();
DownloadMission mission = new DownloadMission(url,"",filename);
downloadManager.addMission(mission);
downloadManager.start();

please include the complete exception. since it is not clear if the raised exception is even related to the library.

themhassany avatar May 03 '21 17:05 themhassany