hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "stack (JIRA)" <j...@apache.org>
Subject [jira] Assigned: (HBASE-757) REST mangles table names
Date Tue, 22 Jul 2008 05:42:31 GMT

     [ https://issues.apache.org/jira/browse/HBASE-757?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

stack reassigned HBASE-757:
---------------------------

    Assignee: stack

> REST mangles table names
> ------------------------
>
>                 Key: HBASE-757
>                 URL: https://issues.apache.org/jira/browse/HBASE-757
>             Project: Hadoop HBase
>          Issue Type: Bug
>            Reporter: stack
>            Assignee: stack
>             Fix For: 0.2.0
>
>
> From Sishen:
> {code}
> Hi, guys. I think i have met the problem of table query.
> When playing with the REST interface, the result is all the table name are un-readable
format and i can't get the table metadata.
> After some debug, i found that if use table.getName().toString() to construct the table
name string. However, getName() return a byte array. So toString() method
> jsut return the string representation of the array object.  The correct way should be
new String(table.getName()). I have tested it and all work well now.
> Below are patches:
> Index: org/apache/hadoop/hbase/rest/MetaHandler.java
> ===================================================================
> --- org/apache/hadoop/hbase/rest/MetaHandler.java    (revision 678344)
> +++ org/apache/hadoop/hbase/rest/MetaHandler.java    (working copy)
> @@ -85,7 +85,7 @@
>            XMLOutputter outputter = getXMLOutputter(response.getWriter());
>            outputter.startTag("tables");
>            for (int i = 0; i < tables.length; i++) {
> -            doElement(outputter, "table", tables[i].getName().toString());
> +            doElement(outputter, "table", new String(tables[i].getName()));
>            }
>            outputter.endTag();
>            outputter.endDocument();
> @@ -96,7 +96,7 @@
>              ContentType.PLAIN.toString());
>            PrintWriter out = response.getWriter();
>            for (int i = 0; i < tables.length; i++) {
> -            out.println(tables[i].getName().toString());
> +            out.println(new String(tables[i].getName()));
>            }
>            out.close();
>          break;
> Index: org/apache/hadoop/hbase/rest/TableHandler.java
> ===================================================================
> --- org/apache/hadoop/hbase/rest/TableHandler.java    (revision 678344)
> +++ org/apache/hadoop/hbase/rest/TableHandler.java    (working copy)
> @@ -391,7 +391,7 @@
>      HTableDescriptor [] tables = this.admin.listTables();
>      HTableDescriptor descriptor = null;
>      for (int i = 0; i < tables.length; i++) {
> -      if (tables[i].getName().toString().equals(tableName)) {
> +      if (new String(tables[i].getName()).equals(tableName)) {
>          descriptor = tables[i];
>          break;
>        }
> @@ -406,7 +406,7 @@
>          setResponseHeader(response, 200, ContentType.XML.toString());
>          XMLOutputter outputter = getXMLOutputter(response.getWriter());
>          outputter.startTag("table");
> -        doElement(outputter, "name", descriptor.getName().toString());
> +        doElement(outputter, "name", new String(descriptor.getName()));
>          outputter.startTag("columnfamilies");
>          for (HColumnDescriptor e: descriptor.getFamilies()) {
>            outputter.startTag("columnfamily");
> Best regards.
> sishen
> Index: org/apache/hadoop/hbase/rest/MetaHandler.java
> ===================================================================
> --- org/apache/hadoop/hbase/rest/MetaHandler.java	(revision 678344)
> +++ org/apache/hadoop/hbase/rest/MetaHandler.java	(working copy)
> @@ -85,7 +85,7 @@
>            XMLOutputter outputter = getXMLOutputter(response.getWriter());
>            outputter.startTag("tables");
>            for (int i = 0; i < tables.length; i++) {
> -            doElement(outputter, "table", tables[i].getName().toString());
> +            doElement(outputter, "table", new String(tables[i].getName()));
>            }
>            outputter.endTag();
>            outputter.endDocument();
> @@ -96,7 +96,7 @@
>              ContentType.PLAIN.toString());
>            PrintWriter out = response.getWriter();
>            for (int i = 0; i < tables.length; i++) {
> -            out.println(tables[i].getName().toString());
> +            out.println(new String(tables[i].getName()));
>            }
>            out.close();
>          break;
> Index: org/apache/hadoop/hbase/rest/TableHandler.java
> ===================================================================
> --- org/apache/hadoop/hbase/rest/TableHandler.java	(revision 678344)
> +++ org/apache/hadoop/hbase/rest/TableHandler.java	(working copy)
> @@ -391,7 +391,7 @@
>      HTableDescriptor [] tables = this.admin.listTables();
>      HTableDescriptor descriptor = null;
>      for (int i = 0; i < tables.length; i++) {
> -      if (tables[i].getName().toString().equals(tableName)) {
> +      if (new String(tables[i].getName()).equals(tableName)) {
>          descriptor = tables[i];
>          break;
>        }
> @@ -406,7 +406,7 @@
>          setResponseHeader(response, 200, ContentType.XML.toString());
>          XMLOutputter outputter = getXMLOutputter(response.getWriter());
>          outputter.startTag("table");
> -        doElement(outputter, "name", descriptor.getName().toString());
> +        doElement(outputter, "name", new String(descriptor.getName()));
>          outputter.startTag("columnfamilies");
>          for (HColumnDescriptor e: descriptor.getFamilies()) {
>            outputter.startTag("columnfamily");
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message