From f76fee63ed9cb3a30d3c0c092d860b1cb93a481b Mon Sep 17 00:00:00 2001
From: Gerard Smyth <gerard.smyth@gmail.com>
Date: Thu, 08 May 2014 13:09:30 -0400
Subject: [PATCH] Updated the SyndicationServlet to provide an additional option to return details of the tags in the repository instead of the commits. This uses a new 'ot' request parameter to indicate the object type of the content to return, which can be ither TAG or COMMIT. If this is not provided, then COMMIT is assumed to maintain backwards compatability. If tags are returned, then the paging parameters, 'l' and 'pg' are still supported, but searching options are currently ignored.

---
 src/main/java/com/gitblit/utils/FlipTable.java |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/gitblit/utils/FlipTable.java b/src/main/java/com/gitblit/utils/FlipTable.java
index 666b70c..0197517 100644
--- a/src/main/java/com/gitblit/utils/FlipTable.java
+++ b/src/main/java/com/gitblit/utils/FlipTable.java
@@ -36,7 +36,7 @@
  * </pre>
  */
 public final class FlipTable {
-	private static final String EMPTY = "(empty)";
+	public static final String EMPTY = "(empty)";
 
 	public static enum Borders {
 		FULL(15), BODY_HCOLS(13), HCOLS(12), BODY(9), HEADER(8), COLS(4);
@@ -46,7 +46,7 @@
 		private Borders(int bitmask) {
 			this.bitmask = bitmask;
 		}
-		
+
 		boolean header() {
 			return isset(0x8);
 		}
@@ -69,12 +69,12 @@
 	}
 
 	/** Create a new table with the specified headers and row data. */
-	public static String of(String[] headers, String[][] data) {
+	public static String of(String[] headers, Object[][] data) {
 		return of(headers, data, Borders.FULL);
 	}
 
 	/** Create a new table with the specified headers and row data. */
-	public static String of(String[] headers, String[][] data, Borders borders) {
+	public static String of(String[] headers, Object[][] data, Borders borders) {
 		if (headers == null)
 			throw new NullPointerException("headers == null");
 		if (headers.length == 0)
@@ -85,13 +85,13 @@
 	}
 
 	private final String[] headers;
-	private final String[][] data;
+	private final Object[][] data;
 	private final Borders borders;
 	private final int columns;
 	private final int[] columnWidths;
 	private final int emptyWidth;
 
-	private FlipTable(String[] headers, String[][] data, Borders borders) {
+	private FlipTable(String[] headers, Object[][] data, Borders borders) {
 		this.headers = headers;
 		this.data = data;
 		this.borders = borders;
@@ -99,17 +99,17 @@
 		columns = headers.length;
 		columnWidths = new int[columns];
 		for (int row = -1; row < data.length; row++) {
-			String[] rowData = (row == -1) ? headers : data[row];
+			Object[] rowData = (row == -1) ? headers : data[row];
 			if (rowData.length != columns) {
 				throw new IllegalArgumentException(String.format("Row %s's %s columns != %s columns", row + 1,
 						rowData.length, columns));
 			}
 			for (int column = 0; column < columns; column++) {
-				String cell = rowData[column];
+				Object cell = rowData[column];
 				if (cell == null) {
 					continue;
 				}
-				for (String rowDataLine : cell.split("\\n")) {
+				for (String rowDataLine : cell.toString().split("\\n")) {
 					columnWidths[column] = Math.max(columnWidths[column], rowDataLine.length());
 				}
 			}
@@ -194,7 +194,7 @@
 		out.append(format.charAt(4)).append('\n');
 	}
 
-	private void printData(StringBuilder out, String[] data, boolean isHeader) {
+	private void printData(StringBuilder out, Object[] data, boolean isHeader) {
 		for (int line = 0, lines = 1; line < lines; line++) {
 			for (int column = 0; column < columns; column++) {
 				if (column == 0) {
@@ -208,11 +208,11 @@
 				} else {
 					out.append(' ');
 				}
-				String cell = data[column];
+				Object cell = data[column];
 				if (cell == null) {
 					cell = "";
 				}
-				String[] cellLines = cell.split("\\n");
+				String[] cellLines = cell.toString().split("\\n");
 				lines = Math.max(lines, cellLines.length);
 				String cellLine = line < cellLines.length ? cellLines[line] : "";
 				out.append(pad(columnWidths[column], cellLine));

--
Gitblit v1.9.1