freemandz / gitiles

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

Crashes if no repos found: String index out of range #101

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run the gitiles dev server from a directory with no git repositories.
2. Navigate to http://localhost:8080.

What is the expected output? What do you see instead?
Expected: An empty list is displayed in the web browser.

Actual:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1921)
    at com.google.gitiles.DefaultAccess.getRelativePath(DefaultAccess.java:165)
    at com.google.gitiles.DefaultAccess.getRelativePath(DefaultAccess.java:159)
    at com.google.gitiles.DefaultAccess.getRepositoryName(DefaultAccess.java:142)
    at com.google.gitiles.DefaultAccess.listRepositories(DefaultAccess.java:113)
    at com.google.gitiles.HostIndexServlet.list(HostIndexServlet.java:70)
    at com.google.gitiles.HostIndexServlet.doGetHtml(HostIndexServlet.java:143)
    at com.google.gitiles.BaseServlet.doGet(BaseServlet.java:113)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at com.google.gitiles.GitilesFilter$DispatchFilter$1.doFilter(GitilesFilter.java:147)
    at com.google.gitiles.GitilesFilter$DispatchFilter.doFilter(GitilesFilter.java:150)
    at com.google.gitiles.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
    at org.eclipse.jgit.http.server.glue.UrlPipeline$Chain.doFilter(UrlPipeline.java:235)
    at com.google.gitiles.GitwebRedirectFilter.doFilter(GitwebRedirectFilter.java:71)
    at com.google.gitiles.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
    at com.google.gitiles.GitwebRedirectFilter.doFilter(GitwebRedirectFilter.java:45)
    at org.eclipse.jgit.http.server.glue.UrlPipeline$Chain.doFilter(UrlPipeline.java:235)
    at com.google.gitiles.ViewFilter.doFilter(ViewFilter.java:131)
    at com.google.gitiles.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32)
    at com.google.gitiles.ViewFilter.doFilter(ViewFilter.java:39)
    at org.eclipse.jgit.http.server.glue.UrlPipeline$Chain.doFilter(UrlPipeline.java:235)
    at org.eclipse.jgit.http.server.glue.UrlPipeline.service(UrlPipeline.java:215)
    at org.eclipse.jgit.http.server.glue.RegexPipeline.service(RegexPipeline.java:149)
    at org.eclipse.jgit.http.server.glue.MetaFilter.doFilter(MetaFilter.java:175)
    at org.eclipse.jgit.http.server.glue.MetaServlet.service(MetaServlet.java:133)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)

What version of the product are you using? On what operating system?
2f442fa. Linux.

Original issue reported on code.google.com by mgiuca@chromium.org on 26 Feb 2016 at 12:41

GoogleCodeExporter commented 8 years ago
Uploaded a fix: https://gerrit-review.googlesource.com/#/c/75278

Original comment by mgiuca@chromium.org on 26 Feb 2016 at 12:59