From 390233511b52b92991f619fbe1c96cdc99b5d37e Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Fri, 13 Jun 2008 05:26:22 +0000 Subject: [PATCH] Part of HBASE-487 Replace hql... Make Strings of byte arrays in TableNotDisabledException messages git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@667357 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/hadoop/hbase/HMerge.java | 4 ++-- .../hadoop/hbase/TableNotDisabledException.java | 11 ++++++++++- .../apache/hadoop/hbase/master/ColumnOperation.java | 6 +++--- .../org/apache/hadoop/hbase/master/TableDelete.java | 3 ++- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/java/org/apache/hadoop/hbase/HMerge.java b/src/java/org/apache/hadoop/hbase/HMerge.java index 354c620ecf2..da143813bde 100644 --- a/src/java/org/apache/hadoop/hbase/HMerge.java +++ b/src/java/org/apache/hadoop/hbase/HMerge.java @@ -234,8 +234,8 @@ class HMerge implements HConstants { protected void checkOfflined(final HRegionInfo hri) throws TableNotDisabledException { if (!hri.isOffline()) { - throw new TableNotDisabledException("region " + - hri.getRegionName() + " is not disabled"); + throw new TableNotDisabledException("Region " + + hri.getRegionNameAsString() + " is not disabled"); } } diff --git a/src/java/org/apache/hadoop/hbase/TableNotDisabledException.java b/src/java/org/apache/hadoop/hbase/TableNotDisabledException.java index ef9ba072b5a..42878001a7e 100644 --- a/src/java/org/apache/hadoop/hbase/TableNotDisabledException.java +++ b/src/java/org/apache/hadoop/hbase/TableNotDisabledException.java @@ -21,6 +21,8 @@ package org.apache.hadoop.hbase; import java.io.IOException; +import org.apache.hadoop.hbase.util.Bytes; + /** * Thrown if a table should be offline but is not */ @@ -38,4 +40,11 @@ public class TableNotDisabledException extends IOException { public TableNotDisabledException(String s) { super(s); } -} + + /** + * @param tableName Name of table that is not disabled + */ + public TableNotDisabledException(byte[] tableName) { + this(Bytes.toString(tableName)); + } +} \ No newline at end of file diff --git a/src/java/org/apache/hadoop/hbase/master/ColumnOperation.java b/src/java/org/apache/hadoop/hbase/master/ColumnOperation.java index 0f54ca5516f..8b81b5beccf 100644 --- a/src/java/org/apache/hadoop/hbase/master/ColumnOperation.java +++ b/src/java/org/apache/hadoop/hbase/master/ColumnOperation.java @@ -24,9 +24,9 @@ import java.io.IOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.HRegionInfo; -import org.apache.hadoop.hbase.ipc.HRegionInterface; -import org.apache.hadoop.hbase.io.BatchUpdate; import org.apache.hadoop.hbase.TableNotDisabledException; +import org.apache.hadoop.hbase.io.BatchUpdate; +import org.apache.hadoop.hbase.ipc.HRegionInterface; import org.apache.hadoop.hbase.util.Writables; abstract class ColumnOperation extends TableOperation { @@ -43,7 +43,7 @@ abstract class ColumnOperation extends TableOperation { @SuppressWarnings("unused") long startCode, final HRegionInfo info) throws IOException { if (isEnabled(info)) { - throw new TableNotDisabledException(tableName.toString()); + throw new TableNotDisabledException(tableName); } } diff --git a/src/java/org/apache/hadoop/hbase/master/TableDelete.java b/src/java/org/apache/hadoop/hbase/master/TableDelete.java index b9d9f9ff88e..0bbf761cdb3 100644 --- a/src/java/org/apache/hadoop/hbase/master/TableDelete.java +++ b/src/java/org/apache/hadoop/hbase/master/TableDelete.java @@ -29,6 +29,7 @@ import org.apache.hadoop.hbase.RemoteExceptionHandler; import org.apache.hadoop.hbase.TableNotDisabledException; import org.apache.hadoop.hbase.regionserver.HRegion; +import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.ipc.HRegionInterface; /** @@ -48,7 +49,7 @@ class TableDelete extends TableOperation { final HRegionInfo info) throws IOException { if (isEnabled(info)) { - throw new TableNotDisabledException(tableName.toString()); + throw new TableNotDisabledException(tableName); } }