From e7e8bd8af341719b7cb902c7861ea198f5db43a6 Mon Sep 17 00:00:00 2001
From: Robbert Noordzij <robbert@xseeding.nl>
Date: Tue, 07 Oct 2014 06:14:27 -0400
Subject: [PATCH] Bug in the rawservlet in extracting the repository out of the path. The offset for finding the next slash should be the current slash + 1, not the last offset + the offset of the current slash.

---
 src/main/java/com/gitblit/wicket/charting/Flotr2Charts.java |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/gitblit/wicket/charting/Flotr2Charts.java b/src/main/java/com/gitblit/wicket/charting/Flotr2Charts.java
index dd72362..7a8adcf 100644
--- a/src/main/java/com/gitblit/wicket/charting/Flotr2Charts.java
+++ b/src/main/java/com/gitblit/wicket/charting/Flotr2Charts.java
@@ -32,24 +32,30 @@
 
 	@Override
 	public void renderHead(IHeaderResponse response) {
-		
+
 		// add Google Chart JS API reference
 		ServletContext servletContext = WebApplication.get().getServletContext();
 		String contextPath = servletContext.getContextPath();
-		
+
 		response.renderJavascriptReference(contextPath + "/bootstrap/js/jquery.js");
 		response.renderJavascriptReference(contextPath + "/flotr2/flotr2.min.js");
 		response.renderCSSReference(contextPath + "/flotr2/flotr2.custom.css");
-		
+
 		// prepare draw chart function
 		StringBuilder sb = new StringBuilder();
-		
+
 		line(sb, "$( document ).ready(function() {");
+		line(sb, "try {");
 		// add charts to header
 		for (Chart chart : charts) {
 			chart.appendChart(sb);
 		}
-
+		line(sb, "} catch (exception) {");
+		line(sb, "  if (window.console && window.console.log) {");
+		line(sb, "    window.console.log('flotr2 exception');");
+		line(sb, "    window.console.log(exception);");
+		line(sb, "  }");
+		line(sb, "}");
 		// end draw chart function
 		line(sb, "});");
 		response.renderJavascript(sb.toString(), null);
@@ -72,5 +78,5 @@
 			String valueName) {
 		return new Flotr2BarChart(tagId, title, keyName, valueName);
 	}
-	
+
 }

--
Gitblit v1.9.1