You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ja...@apache.org on 2019/08/21 08:30:32 UTC
[hbase] branch master updated: HBASE-22844 Fixed Checkstyle
violations in client snapshot exceptions
This is an automated email from the ASF dual-hosted git repository.
janh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new 1b50404 HBASE-22844 Fixed Checkstyle violations in client snapshot exceptions
1b50404 is described below
commit 1b50404f34401e0508264aa7ae7eeb044b380ca5
Author: Jan Hentschel <ja...@ultratendency.com>
AuthorDate: Wed Aug 21 10:30:26 2019 +0200
HBASE-22844 Fixed Checkstyle violations in client snapshot exceptions
Signed-off-by: stack <st...@apache.org>
---
.../snapshot/ClientSnapshotDescriptionUtils.java | 39 ++++++++-------
.../hbase/snapshot/CorruptedSnapshotException.java | 21 +++++----
.../hbase/snapshot/ExportSnapshotException.java | 9 ++--
.../hbase/snapshot/HBaseSnapshotException.java | 55 ++++++++++++----------
.../hbase/snapshot/RestoreSnapshotException.java | 36 ++++++++++----
.../hbase/snapshot/SnapshotCreationException.java | 35 +++++++-------
.../snapshot/SnapshotDoesNotExistException.java | 18 +++----
.../hbase/snapshot/SnapshotExistsException.java | 24 ++++++----
.../snapshot/TablePartiallyOpenException.java | 26 +++++-----
.../hbase/snapshot/UnknownSnapshotException.java | 16 ++++---
10 files changed, 163 insertions(+), 116 deletions(-)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/ClientSnapshotDescriptionUtils.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/ClientSnapshotDescriptionUtils.java
index 106836c..d9fb983 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/ClientSnapshotDescriptionUtils.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/ClientSnapshotDescriptionUtils.java
@@ -16,31 +16,34 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.hadoop.hbase.snapshot;
import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.util.Bytes;
import org.apache.yetus.audience.InterfaceAudience;
+
import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos;
-import org.apache.hadoop.hbase.util.Bytes;
/**
* Class to help with dealing with a snapshot description on the client side.
* There is a corresponding class on the server side.
*/
@InterfaceAudience.Private
-public class ClientSnapshotDescriptionUtils {
+public final class ClientSnapshotDescriptionUtils {
+ private ClientSnapshotDescriptionUtils() {
+ }
+
/**
* Check to make sure that the description of the snapshot requested is valid
* @param snapshot description of the snapshot
* @throws IllegalArgumentException if the name of the snapshot or the name of the table to
- * snapshot are not valid names.
+ * snapshot are not valid names
*/
public static void assertSnapshotRequestIsValid(SnapshotProtos.SnapshotDescription snapshot)
throws IllegalArgumentException {
// make sure the snapshot name is valid
TableName.isLegalTableQualifierName(Bytes.toBytes(snapshot.getName()), true);
- if(snapshot.hasTable()) {
+ if (snapshot.hasTable()) {
// make sure the table name is valid, this will implicitly check validity
TableName tableName = TableName.valueOf(snapshot.getTable());
@@ -51,24 +54,28 @@ public class ClientSnapshotDescriptionUtils {
}
/**
- * Returns a single line (no \n) representation of snapshot metadata. Use this instead of
- * {@link org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription#toString()}. We don't replace SnapshotDescrpition's toString
- * because it is auto-generated by protoc.
- * @param ssd
- * @return Single line string with a summary of the snapshot parameters
+ * Returns a single line (no \n) representation of snapshot metadata. Use this instead of
+ * {@link org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription#toString()}.
+ * We don't replace
+ * {@link org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription}'s
+ * {@code toString}, because it is auto-generated by protoc.
+ *
+ * @param snapshot description of the snapshot
+ * @return single line string with a summary of the snapshot parameters
*/
- public static String toString(SnapshotProtos.SnapshotDescription ssd) {
- if (ssd == null) {
+ public static String toString(SnapshotProtos.SnapshotDescription snapshot) {
+ if (snapshot == null) {
return null;
}
+
return new StringBuilder("{ ss=")
- .append(ssd.getName())
+ .append(snapshot.getName())
.append(" table=")
- .append(ssd.hasTable() ? TableName.valueOf(ssd.getTable()) : "")
+ .append(snapshot.hasTable() ? TableName.valueOf(snapshot.getTable()) : "")
.append(" type=")
- .append(ssd.getType())
+ .append(snapshot.getType())
.append(" ttl=")
- .append(ssd.getTtl())
+ .append(snapshot.getTtl())
.append(" }")
.toString();
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/CorruptedSnapshotException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/CorruptedSnapshotException.java
index 446f391..c8ba848 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/CorruptedSnapshotException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/CorruptedSnapshotException.java
@@ -17,35 +17,38 @@
*/
package org.apache.hadoop.hbase.snapshot;
-import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.client.SnapshotDescription;
-
+import org.apache.yetus.audience.InterfaceAudience;
/**
- * Exception thrown when the found snapshot info from the filesystem is not valid
+ * Exception thrown when the found snapshot info from the filesystem is not valid.
*/
@SuppressWarnings("serial")
@InterfaceAudience.Public
public class CorruptedSnapshotException extends HBaseSnapshotException {
-
/**
+ * Snapshot was corrupt for some reason.
+ *
* @param message message describing the exception
- * @param e cause
+ * @param e the actual cause of the exception
*/
public CorruptedSnapshotException(String message, Exception e) {
super(message, e);
}
/**
- * Snapshot was corrupt for some reason
+ * Snapshot was corrupt for some reason.
+ *
* @param message full description of the failure
- * @param snapshot snapshot that was expected
+ * @param snapshotDescription snapshot that was expected
*/
- public CorruptedSnapshotException(String message, SnapshotDescription snapshot) {
- super(message, snapshot);
+ public CorruptedSnapshotException(String message, SnapshotDescription snapshotDescription) {
+ super(message, snapshotDescription);
}
/**
+ * Snapshot was corrupt for some reason.
+ *
* @param message message describing the exception
*/
public CorruptedSnapshotException(String message) {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshotException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshotException.java
index ce851f6..df5f925 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshotException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshotException.java
@@ -25,17 +25,16 @@ import org.apache.yetus.audience.InterfaceAudience;
@InterfaceAudience.Public
@SuppressWarnings("serial")
public class ExportSnapshotException extends HBaseSnapshotException {
-
/**
- * @param msg message describing the exception
+ * @param message message describing the exception
*/
- public ExportSnapshotException(String msg) {
- super(msg);
+ public ExportSnapshotException(String message) {
+ super(message);
}
/**
* @param message message describing the exception
- * @param e cause
+ * @param e the actual cause of the exception
*/
public ExportSnapshotException(String message, Exception e) {
super(message, e);
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/HBaseSnapshotException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/HBaseSnapshotException.java
index 90a509e..1f50b5c 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/HBaseSnapshotException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/HBaseSnapshotException.java
@@ -18,57 +18,64 @@
package org.apache.hadoop.hbase.snapshot;
import org.apache.hadoop.hbase.DoNotRetryIOException;
-import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.client.SnapshotDescription;
+import org.apache.yetus.audience.InterfaceAudience;
/**
- * General exception base class for when a snapshot fails
+ * General exception base class for when a snapshot fails.
*/
@SuppressWarnings("serial")
@InterfaceAudience.Public
public class HBaseSnapshotException extends DoNotRetryIOException {
-
private SnapshotDescription description;
/**
- * Some exception happened for a snapshot and don't even know the snapshot that it was about
- * @param msg Full description of the failure
+ * Some exception happened for a snapshot and don't even know the snapshot that it was about.
+ *
+ * @param message the full description of the failure
*/
- public HBaseSnapshotException(String msg) {
- super(msg);
+ public HBaseSnapshotException(String message) {
+ super(message);
}
/**
- * Exception for the given snapshot that has no previous root cause
- * @param msg reason why the snapshot failed
- * @param desc description of the snapshot that is being failed
+ * Exception for the given snapshot that has no previous root cause.
+ *
+ * @param message the reason why the snapshot failed
+ * @param snapshotDescription the description of the snapshot that is failing
*/
- public HBaseSnapshotException(String msg, SnapshotDescription desc) {
- super(msg);
- this.description = desc;
+ public HBaseSnapshotException(String message, SnapshotDescription snapshotDescription) {
+ super(message);
+ this.description = snapshotDescription;
}
/**
- * Exception for the given snapshot due to another exception
- * @param msg reason why the snapshot failed
- * @param cause root cause of the failure
- * @param desc description of the snapshot that is being failed
+ * Exception for the given snapshot due to another exception.
+ *
+ * @param message the reason why the snapshot failed
+ * @param cause the root cause of the failure
+ * @param snapshotDescription the description of the snapshot that is being failed
*/
- public HBaseSnapshotException(String msg, Throwable cause, SnapshotDescription desc) {
- super(msg, cause);
- this.description = desc;
+ public HBaseSnapshotException(String message, Throwable cause,
+ SnapshotDescription snapshotDescription) {
+ super(message, cause);
+ this.description = snapshotDescription;
}
/**
* Exception when the description of the snapshot cannot be determined, due to some root other
- * root cause
+ * root cause.
+ *
* @param message description of what caused the failure
- * @param e root cause
+ * @param cause the root cause
*/
- public HBaseSnapshotException(String message, Throwable e) {
- super(message, e);
+ public HBaseSnapshotException(String message, Throwable cause) {
+ super(message, cause);
}
+ /**
+ * @return the description of the snapshot that is being failed
+ */
public SnapshotDescription getSnapshotDescription() {
return this.description;
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotException.java
index b2b335c..0294509 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotException.java
@@ -15,11 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.hadoop.hbase.snapshot;
-import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.client.SnapshotDescription;
+import org.apache.yetus.audience.InterfaceAudience;
/**
* Thrown when a snapshot could not be restored due to a server-side error when restoring it.
@@ -27,19 +26,36 @@ import org.apache.hadoop.hbase.client.SnapshotDescription;
@SuppressWarnings("serial")
@InterfaceAudience.Public
public class RestoreSnapshotException extends HBaseSnapshotException {
- public RestoreSnapshotException(String msg, SnapshotDescription desc) {
- super(msg, desc);
+ /**
+ * @param message reason why restoring the snapshot fails
+ * @param snapshotDescription description of the snapshot attempted
+ */
+ public RestoreSnapshotException(String message, SnapshotDescription snapshotDescription) {
+ super(message, snapshotDescription);
}
- public RestoreSnapshotException(String msg, Throwable cause, SnapshotDescription desc) {
- super(msg, cause, desc);
+ /**
+ * @param message reason why restoring the snapshot fails
+ * @param cause the root cause of the failure
+ * @param snapshotDescription description of the snapshot attempted
+ */
+ public RestoreSnapshotException(String message, Throwable cause,
+ SnapshotDescription snapshotDescription) {
+ super(message, cause, snapshotDescription);
}
- public RestoreSnapshotException(String msg) {
- super(msg);
+ /**
+ * @param message reason why restoring the snapshot fails
+ */
+ public RestoreSnapshotException(String message) {
+ super(message);
}
- public RestoreSnapshotException(String message, Throwable e) {
- super(message, e);
+ /**
+ * @param message reason why restoring the snapshot fails
+ * @param cause the root cause of the failure
+ */
+ public RestoreSnapshotException(String message, Throwable cause) {
+ super(message, cause);
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotCreationException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotCreationException.java
index 9815f26..d4f672b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotCreationException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotCreationException.java
@@ -17,8 +17,8 @@
*/
package org.apache.hadoop.hbase.snapshot;
-import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.client.SnapshotDescription;
+import org.apache.yetus.audience.InterfaceAudience;
/**
* Thrown when a snapshot could not be created due to a server-side error when
@@ -27,31 +27,34 @@ import org.apache.hadoop.hbase.client.SnapshotDescription;
@SuppressWarnings("serial")
@InterfaceAudience.Public
public class SnapshotCreationException extends HBaseSnapshotException {
-
/**
* Used internally by the RPC engine to pass the exception back to the client.
- * @param msg error message to pass back
+ *
+ * @param message error message to pass back
*/
- public SnapshotCreationException(String msg) {
- super(msg);
+ public SnapshotCreationException(String message) {
+ super(message);
}
/**
- * Failure to create the specified snapshot
- * @param msg reason why the snapshot couldn't be completed
- * @param desc description of the snapshot attempted
+ * Failure to create the specified snapshot.
+ *
+ * @param message reason why the snapshot couldn't be completed
+ * @param snapshotDescription description of the snapshot attempted
*/
- public SnapshotCreationException(String msg, SnapshotDescription desc) {
- super(msg, desc);
+ public SnapshotCreationException(String message, SnapshotDescription snapshotDescription) {
+ super(message, snapshotDescription);
}
/**
- * Failure to create the specified snapshot due to an external cause
- * @param msg reason why the snapshot couldn't be completed
- * @param cause root cause of the failure
- * @param desc description of the snapshot attempted
+ * Failure to create the specified snapshot due to an external cause.
+ *
+ * @param message reason why the snapshot couldn't be completed
+ * @param cause the root cause of the failure
+ * @param snapshotDescription description of the snapshot attempted
*/
- public SnapshotCreationException(String msg, Throwable cause, SnapshotDescription desc) {
- super(msg, cause, desc);
+ public SnapshotCreationException(String message, Throwable cause,
+ SnapshotDescription snapshotDescription) {
+ super(message, cause, snapshotDescription);
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDoesNotExistException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDoesNotExistException.java
index 8f19be9..9c0e51c 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDoesNotExistException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDoesNotExistException.java
@@ -17,27 +17,27 @@
*/
package org.apache.hadoop.hbase.snapshot;
-import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.client.SnapshotDescription;
-
+import org.apache.yetus.audience.InterfaceAudience;
/**
- * Thrown when the server is looking for a snapshot but can't find the snapshot on the filesystem
+ * Thrown when the server is looking for a snapshot, but can't find the snapshot on the filesystem.
*/
@SuppressWarnings("serial")
@InterfaceAudience.Public
public class SnapshotDoesNotExistException extends HBaseSnapshotException {
/**
- * @param msg full description of the failure
+ * @param message the full description of the failure
*/
- public SnapshotDoesNotExistException(String msg) {
- super(msg);
+ public SnapshotDoesNotExistException(String message) {
+ super(message);
}
/**
- * @param desc expected snapshot to find
+ * @param snapshotDescription expected snapshot to find
*/
- public SnapshotDoesNotExistException(SnapshotDescription desc) {
- super("Snapshot '" + desc.getName() +"' doesn't exist on the filesystem", desc);
+ public SnapshotDoesNotExistException(SnapshotDescription snapshotDescription) {
+ super("Snapshot '" + snapshotDescription.getName() + "' doesn't exist on the filesystem",
+ snapshotDescription);
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotExistsException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotExistsException.java
index 4ce0b12..6942b69 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotExistsException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotExistsException.java
@@ -17,25 +17,31 @@
*/
package org.apache.hadoop.hbase.snapshot;
-import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.client.SnapshotDescription;
+import org.apache.yetus.audience.InterfaceAudience;
/**
- * Thrown when a snapshot exists but should not
+ * Thrown when a snapshot exists, but should not.
*/
@SuppressWarnings("serial")
@InterfaceAudience.Public
public class SnapshotExistsException extends HBaseSnapshotException {
- public SnapshotExistsException(String msg) {
- super(msg);
+ /**
+ * Failure due to the snapshot already existing.
+ *
+ * @param message the full description of the failure
+ */
+ public SnapshotExistsException(String message) {
+ super(message);
}
/**
- * Failure due to the snapshot already existing
- * @param msg full description of the failure
- * @param desc snapshot that was attempted
+ * Failure due to the snapshot already existing.
+ *
+ * @param message the full description of the failure
+ * @param snapshotDescription snapshot that was attempted
*/
- public SnapshotExistsException(String msg, SnapshotDescription desc) {
- super(msg, desc);
+ public SnapshotExistsException(String message, SnapshotDescription snapshotDescription) {
+ super(message, snapshotDescription);
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/TablePartiallyOpenException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/TablePartiallyOpenException.java
index d6aa8b9..5de3521 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/TablePartiallyOpenException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/TablePartiallyOpenException.java
@@ -20,38 +20,42 @@ package org.apache.hadoop.hbase.snapshot;
import java.io.IOException;
import org.apache.hadoop.hbase.TableName;
-import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.yetus.audience.InterfaceAudience;
/**
- * Thrown if a table should be online/offline but is partially open
+ * Thrown if a table should be online/offline, but is partially open.
*/
@InterfaceAudience.Public
public class TablePartiallyOpenException extends IOException {
private static final long serialVersionUID = 3571982660065058361L;
+ /**
+ * Constructs an {@code TablePartiallyOpenException} with {@code null} as its error detail
+ * message.
+ */
public TablePartiallyOpenException() {
super();
}
/**
- * @param s message
+ * @param message the message describing the exception
*/
- public TablePartiallyOpenException(String s) {
- super(s);
+ public TablePartiallyOpenException(String message) {
+ super(message);
}
/**
- * @param tableName Name of table that is partial open
+ * @param tableName the name of the table that is partially open
*/
public TablePartiallyOpenException(TableName tableName) {
this(tableName.getNameAsString());
}
/**
- * @param tableName Name of table that is partial open
- */
- public TablePartiallyOpenException(byte[] tableName) {
- this(Bytes.toString(tableName));
- }
+ * @param tableName the name of the table that is partially open
+ */
+ public TablePartiallyOpenException(byte[] tableName) {
+ this(Bytes.toString(tableName));
+ }
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/UnknownSnapshotException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/UnknownSnapshotException.java
index ef56a14..7951eaf 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/UnknownSnapshotException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/UnknownSnapshotException.java
@@ -25,16 +25,18 @@ import org.apache.yetus.audience.InterfaceAudience;
@SuppressWarnings("serial")
@InterfaceAudience.Public
public class UnknownSnapshotException extends HBaseSnapshotException {
-
/**
- * @param msg full information about the failure
+ * @param message full information about the failure
*/
- public UnknownSnapshotException(String msg) {
- super(msg);
+ public UnknownSnapshotException(String message) {
+ super(message);
}
- public UnknownSnapshotException(String msg, Exception e) {
- super(msg, e);
+ /**
+ * @param message full information about the failure
+ * @param e the actual cause of the exception
+ */
+ public UnknownSnapshotException(String message, Exception e) {
+ super(message, e);
}
-
}