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
This commit is contained in:
Michael Stack 2008-06-13 05:26:22 +00:00
parent 43841d04f0
commit 390233511b
4 changed files with 17 additions and 7 deletions

View File

@ -234,8 +234,8 @@ class HMerge implements HConstants {
protected void checkOfflined(final HRegionInfo hri) protected void checkOfflined(final HRegionInfo hri)
throws TableNotDisabledException { throws TableNotDisabledException {
if (!hri.isOffline()) { if (!hri.isOffline()) {
throw new TableNotDisabledException("region " + throw new TableNotDisabledException("Region " +
hri.getRegionName() + " is not disabled"); hri.getRegionNameAsString() + " is not disabled");
} }
} }

View File

@ -21,6 +21,8 @@ package org.apache.hadoop.hbase;
import java.io.IOException; import java.io.IOException;
import org.apache.hadoop.hbase.util.Bytes;
/** /**
* Thrown if a table should be offline but is not * Thrown if a table should be offline but is not
*/ */
@ -38,4 +40,11 @@ public class TableNotDisabledException extends IOException {
public TableNotDisabledException(String s) { public TableNotDisabledException(String s) {
super(s); super(s);
} }
/**
* @param tableName Name of table that is not disabled
*/
public TableNotDisabledException(byte[] tableName) {
this(Bytes.toString(tableName));
}
} }

View File

@ -24,9 +24,9 @@ import java.io.IOException;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.HRegionInfo; 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.TableNotDisabledException;
import org.apache.hadoop.hbase.io.BatchUpdate;
import org.apache.hadoop.hbase.ipc.HRegionInterface;
import org.apache.hadoop.hbase.util.Writables; import org.apache.hadoop.hbase.util.Writables;
abstract class ColumnOperation extends TableOperation { abstract class ColumnOperation extends TableOperation {
@ -43,7 +43,7 @@ abstract class ColumnOperation extends TableOperation {
@SuppressWarnings("unused") long startCode, final HRegionInfo info) @SuppressWarnings("unused") long startCode, final HRegionInfo info)
throws IOException { throws IOException {
if (isEnabled(info)) { if (isEnabled(info)) {
throw new TableNotDisabledException(tableName.toString()); throw new TableNotDisabledException(tableName);
} }
} }

View File

@ -29,6 +29,7 @@ import org.apache.hadoop.hbase.RemoteExceptionHandler;
import org.apache.hadoop.hbase.TableNotDisabledException; import org.apache.hadoop.hbase.TableNotDisabledException;
import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.ipc.HRegionInterface; import org.apache.hadoop.hbase.ipc.HRegionInterface;
/** /**
@ -48,7 +49,7 @@ class TableDelete extends TableOperation {
final HRegionInfo info) throws IOException { final HRegionInfo info) throws IOException {
if (isEnabled(info)) { if (isEnabled(info)) {
throw new TableNotDisabledException(tableName.toString()); throw new TableNotDisabledException(tableName);
} }
} }