diff --git a/CHANGES.txt b/CHANGES.txt index 9cbf0ebe27f..494fd391df5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -69,6 +69,7 @@ Trunk (unreleased changes) HADOOP-1996 TestHStoreFile fails on windows if run multiple times HADOOP-1937 When the master times out a region server's lease, it is too aggressive in reclaiming the server's log. + HADOOP-2004 webapp hql formatting bugs IMPROVEMENTS HADOOP-1737 Make HColumnDescriptor data publically members settable diff --git a/src/java/org/apache/hadoop/hbase/shell/DescCommand.java b/src/java/org/apache/hadoop/hbase/shell/DescCommand.java index dc516a2db09..56e2e053428 100644 --- a/src/java/org/apache/hadoop/hbase/shell/DescCommand.java +++ b/src/java/org/apache/hadoop/hbase/shell/DescCommand.java @@ -76,8 +76,8 @@ public class DescCommand extends BasicCommand { tmp = tmp.substring(1, tmp.length() - 1); } columnStrs[i] = tmp; + formatter.row(new String [] {columnStrs[i]}); } - formatter.row(columnStrs); formatter.footer(); return new ReturnMsg(1, columns.length + " columnfamily(s) in set"); } catch (IOException e) { diff --git a/src/java/org/apache/hadoop/hbase/shell/formatter/HtmlTableFormatter.java b/src/java/org/apache/hadoop/hbase/shell/formatter/HtmlTableFormatter.java index bd9842bcf12..318e471d9b2 100644 --- a/src/java/org/apache/hadoop/hbase/shell/formatter/HtmlTableFormatter.java +++ b/src/java/org/apache/hadoop/hbase/shell/formatter/HtmlTableFormatter.java @@ -1,6 +1,7 @@ package org.apache.hadoop.hbase.shell.formatter; import java.io.IOException; +import java.io.OutputStreamWriter; import java.io.Writer; import org.apache.hadoop.hbase.shell.TableFormatter; @@ -8,14 +9,14 @@ import org.znerd.xmlenc.LineBreak; import org.znerd.xmlenc.XMLOutputter; /** - * Formatter that outputs data inside an HTML table. - * If only a single cell result, then no formatting is done. Presumption is - * that client manages serial access outputting tables. Does not close passed - * {@link Writer}. + * Formatter that outputs data inside an HTML table. If only a single cell + * result, then no formatting is done. Presumption is that client manages + * serial access outputting tables. Does not close passed {@link Writer}. + * Since hbase columns have no typing, the formatter presumes a type of + * UTF-8 String. If cells contain images, etc., this formatter will mangle + * their display. *
TODO: Uses xmlenc. Hopefully it flushes every so often (Claims its a * stream-based outputter). Verify. - *
For now, invoke it this way (until shell starts to take cmdline params);
- * $ HBASE_OPTS='-Dhbaseshell.formatter=org.apache.hadoop.hbase.shell.TableFormatterFactory$HtmlTableFormatter' ./bin/hbase shell
*/
public class HtmlTableFormatter implements TableFormatter {
private final XMLOutputter outputter;
@@ -70,7 +71,7 @@ public class HtmlTableFormatter implements TableFormatter {
public void row(String [] cells) throws IOException{
if (isNoFormatting()) {
- this.outputter.pcdata(cells[0]);
+ getOut().write(cells[0]);
return;
}
this.outputter.startTag("tr");
@@ -108,4 +109,12 @@ public class HtmlTableFormatter implements TableFormatter {
public void setNoFormatting(boolean noFormatting) {
this.noFormatting = noFormatting;
}
+
+ public static void main(String[] args) throws IOException {
+ HtmlTableFormatter f =
+ new HtmlTableFormatter(new OutputStreamWriter(System.out, "UTF-8"));
+ f.header(new String [] {"a", "b"});
+ f.row(new String [] {"a", "b"});
+ f.footer();
+ }
}
\ No newline at end of file