rootiny / gitiles

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

StringIndexOutOfBoundsException: String index out of range #91

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Browse to a commit on a project that resides in a subfolder on the server, 
so you're looking at something like: 
http://review.example.com/plugins/gitiles/subfolder/projectname/+/sha1
2. Click on subfolder

What is the expected output? What do you see instead?

500 internal server error.

What version of the product are you using? On what operating system?

Gerrit 2.12-rc1 with gitiles plugin built from 490a649.

Please provide any additional information below.

I can't reproduce this on my local dev instance with 2.12-rc2, but throwing it 
out here in case anyone else gets it and can reproduce.

Original issue reported on code.google.com by david.pu...@sonymobile.com on 7 Dec 2015 at 11:04

GoogleCodeExporter commented 8 years ago
Forgot to include the log:

http://paste.openstack.org/show/481001/

Original comment by david.pu...@sonymobile.com on 7 Dec 2015 at 11:07

GoogleCodeExporter commented 8 years ago
I managed to reproduce it:

On a site with the gitiles plugin installed, create two projects: 'a' and 
'foo/bar'.

Browse to the 'foo/bar' project:

 http://review.example.com/plugins/gitiles/foo/bar

click the 'foo' link.  This results in in the 'Server Error' page and in the 
log:

  String index out of range: -3

Root cause seems to be that HostIndexServlet.toSoyMapData calls:

  stripPrefix(prefix, desc.name)

which in turn calls

  name.substring(prefix.length() + 1)

In this case prefix is "foo" (length 3) and name is "a" (length 1).

So "a".substring("foo".length() + 1) is what causes the index error.

Original comment by david.pu...@sonymobile.com on 8 Dec 2015 at 5:55

GoogleCodeExporter commented 8 years ago
https://gerrit-review.googlesource.com/#/c/73070/

Original comment by david.pu...@sonymobile.com on 8 Dec 2015 at 6:15

GoogleCodeExporter commented 8 years ago

Original comment by dborowitz@google.com on 10 Dec 2015 at 12:43