jamh93 / zirco-browser

Automatically exported from code.google.com/p/zirco-browser
Other
0 stars 0 forks source link

Dowload crash #61

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Click a url whose content contains no "?" to download something. 
2. The Browser crashes immediately.

What is the expected output? What do you see instead?
A StringIndexOutOfBoundsException from the logcat.

What version of the product are you using? On what operating system?
I build the source code by myself, but I think it's the latest version 0.4.4. I 
am running it on a Android 2.3 mobile phone. 

Please provide any additional information below.
Fixing the following code defect may fix this bug :
1)
DownloadItem.java line 68 :         
mFileName = mFileName.substring(0, mFileName.indexOf("?");

replaced with:
int end = mFileName.indexOf("?") >= 0 ? mFileName.indexOf("?") : 
mFileName.length();
mFileName = mFileName.substring(0, end);

2)
DownloadRunnable.java line 68
return fileName.substring(0, fileName.indexOf("?");

replaced with :
int end = fileName.indexOf("?") >= 0 ? fileName.indexOf("?") : 
fileName.length();
        return fileName.substring(0, end);

Original issue reported on code.google.com by kchicon....@gmail.com on 24 May 2012 at 3:49