Skip to content

Commit 24a821c

Browse files
committed
HBASE-22844 Fixed Checkstyle violations in client snapshot exceptions
Signed-off-by: stack <[email protected]>
1 parent bb31ffa commit 24a821c

10 files changed

+170
-108
lines changed

hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/ClientSnapshotDescriptionUtils.java

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616
* See the License for the specific language governing permissions and
1717
* limitations under the License.
1818
*/
19-
2019
package org.apache.hadoop.hbase.snapshot;
2120

22-
import org.apache.hadoop.hbase.classification.InterfaceAudience;
2321
import org.apache.hadoop.hbase.TableName;
22+
import org.apache.hadoop.hbase.classification.InterfaceAudience;
2423
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
2524
import org.apache.hadoop.hbase.util.Bytes;
2625

@@ -29,18 +28,21 @@
2928
* There is a corresponding class on the server side.
3029
*/
3130
@InterfaceAudience.Private
32-
public class ClientSnapshotDescriptionUtils {
31+
public final class ClientSnapshotDescriptionUtils {
32+
private ClientSnapshotDescriptionUtils() {
33+
}
34+
3335
/**
3436
* Check to make sure that the description of the snapshot requested is valid
3537
* @param snapshot description of the snapshot
3638
* @throws IllegalArgumentException if the name of the snapshot or the name of the table to
37-
* snapshot are not valid names.
39+
* snapshot are not valid names
3840
*/
3941
public static void assertSnapshotRequestIsValid(SnapshotDescription snapshot)
4042
throws IllegalArgumentException {
4143
// make sure the snapshot name is valid
4244
TableName.isLegalTableQualifierName(Bytes.toBytes(snapshot.getName()), true);
43-
if(snapshot.hasTable()) {
45+
if (snapshot.hasTable()) {
4446
// make sure the table name is valid, this will implicitly check validity
4547
TableName tableName = TableName.valueOf(snapshot.getTable());
4648

@@ -51,24 +53,28 @@ public static void assertSnapshotRequestIsValid(SnapshotDescription snapshot)
5153
}
5254

5355
/**
54-
* Returns a single line (no \n) representation of snapshot metadata. Use this instead of
55-
* {@link SnapshotDescription#toString()}. We don't replace SnapshotDescrpition's toString
56-
* because it is auto-generated by protoc.
57-
* @param ssd
58-
* @return Single line string with a summary of the snapshot parameters
56+
* Returns a single line (no \n) representation of snapshot metadata. Use this instead of
57+
* {@link org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription#toString()}.
58+
* We don't replace
59+
* {@link org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription}'s
60+
* {@code toString}, because it is auto-generated by protoc.
61+
*
62+
* @param snapshot description of the snapshot
63+
* @return single line string with a summary of the snapshot parameters
5964
*/
60-
public static String toString(SnapshotDescription ssd) {
61-
if (ssd == null) {
65+
public static String toString(SnapshotDescription snapshot) {
66+
if (snapshot == null) {
6267
return null;
6368
}
69+
6470
return new StringBuilder("{ ss=")
65-
.append(ssd.getName())
71+
.append(snapshot.getName())
6672
.append(" table=")
67-
.append(ssd.hasTable() ? TableName.valueOf(ssd.getTable()) : "")
73+
.append(snapshot.hasTable() ? TableName.valueOf(snapshot.getTable()) : "")
6874
.append(" type=")
69-
.append(ssd.getType())
75+
.append(snapshot.getType())
7076
.append(" ttl=")
71-
.append(ssd.getTtl())
77+
.append(snapshot.getTtl())
7278
.append(" }")
7379
.toString();
7480
}

hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/CorruptedSnapshotException.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,42 @@
1919

2020
import org.apache.hadoop.hbase.classification.InterfaceAudience;
2121
import org.apache.hadoop.hbase.classification.InterfaceStability;
22+
2223
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
2324

2425

2526
/**
26-
* Exception thrown when the found snapshot info from the filesystem is not valid
27+
* Exception thrown when the found snapshot info from the filesystem is not valid.
2728
*/
2829
@SuppressWarnings("serial")
2930
@InterfaceAudience.Public
3031
@InterfaceStability.Evolving
3132
public class CorruptedSnapshotException extends HBaseSnapshotException {
32-
3333
/**
34+
* Snapshot was corrupt for some reason.
35+
*
3436
* @param message message describing the exception
35-
* @param e cause
37+
* @param e the actual cause of the exception
3638
*/
3739
public CorruptedSnapshotException(String message, Exception e) {
3840
super(message, e);
3941
}
4042

4143
/**
42-
* Snapshot was corrupt for some reason
44+
* Snapshot was corrupt for some reason.
45+
*
4346
* @param message full description of the failure
44-
* @param snapshot snapshot that was expected
47+
* @param snapshotDescription snapshot that was expected
48+
* @deprecated since 1.3.0, will be removed in 3.0.0
4549
*/
4650
@Deprecated
47-
public CorruptedSnapshotException(String message, SnapshotDescription snapshot) {
48-
super(message, snapshot);
51+
public CorruptedSnapshotException(String message, SnapshotDescription snapshotDescription) {
52+
super(message, snapshotDescription);
4953
}
5054

5155
/**
56+
* Snapshot was corrupt for some reason.
57+
*
5258
* @param message message describing the exception
5359
*/
5460
public CorruptedSnapshotException(String message) {

hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshotException.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,16 @@
2727
@InterfaceStability.Stable
2828
@SuppressWarnings("serial")
2929
public class ExportSnapshotException extends HBaseSnapshotException {
30-
3130
/**
32-
* @param msg message describing the exception
31+
* @param message message describing the exception
3332
*/
34-
public ExportSnapshotException(String msg) {
35-
super(msg);
33+
public ExportSnapshotException(String message) {
34+
super(message);
3635
}
3736

3837
/**
3938
* @param message message describing the exception
40-
* @param e cause
39+
* @param e the actual cause of the exception
4140
*/
4241
public ExportSnapshotException(String message, Exception e) {
4342
super(message, e);

hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/HBaseSnapshotException.java

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,62 +17,73 @@
1717
*/
1818
package org.apache.hadoop.hbase.snapshot;
1919

20+
import org.apache.hadoop.hbase.DoNotRetryIOException;
2021
import org.apache.hadoop.hbase.classification.InterfaceAudience;
2122
import org.apache.hadoop.hbase.classification.InterfaceStability;
22-
import org.apache.hadoop.hbase.DoNotRetryIOException;
23+
2324
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
2425

2526
/**
26-
* General exception base class for when a snapshot fails
27+
* General exception base class for when a snapshot fails.
2728
*/
2829
@SuppressWarnings("serial")
2930
@InterfaceAudience.Public
3031
@InterfaceStability.Evolving
3132
public class HBaseSnapshotException extends DoNotRetryIOException {
32-
3333
private SnapshotDescription description;
3434

3535
/**
36-
* Some exception happened for a snapshot and don't even know the snapshot that it was about
37-
* @param msg Full description of the failure
36+
* Some exception happened for a snapshot and don't even know the snapshot that it was about.
37+
*
38+
* @param message the full description of the failure
3839
*/
39-
public HBaseSnapshotException(String msg) {
40-
super(msg);
40+
public HBaseSnapshotException(String message) {
41+
super(message);
4142
}
4243

4344
/**
44-
* Exception for the given snapshot that has no previous root cause
45-
* @param msg reason why the snapshot failed
46-
* @param desc description of the snapshot that is being failed
45+
* Exception for the given snapshot that has no previous root cause.
46+
*
47+
* @param message the reason why the snapshot failed
48+
* @param snapshotDescription the description of the snapshot that is failing
49+
* @deprecated since 1.3.0, will be removed in 3.0.0
4750
*/
4851
@Deprecated
49-
public HBaseSnapshotException(String msg, SnapshotDescription desc) {
50-
super(msg);
51-
this.description = desc;
52+
public HBaseSnapshotException(String message, SnapshotDescription snapshotDescription) {
53+
super(message);
54+
this.description = snapshotDescription;
5255
}
5356

5457
/**
55-
* Exception for the given snapshot due to another exception
56-
* @param msg reason why the snapshot failed
57-
* @param cause root cause of the failure
58-
* @param desc description of the snapshot that is being failed
58+
* Exception for the given snapshot due to another exception.
59+
*
60+
* @param message the reason why the snapshot failed
61+
* @param cause the root cause of the failure
62+
* @param snapshotDescription the description of the snapshot that is being failed
63+
* @deprecated since 1.3.0, will be removed in 3.0.0
5964
*/
6065
@Deprecated
61-
public HBaseSnapshotException(String msg, Throwable cause, SnapshotDescription desc) {
62-
super(msg, cause);
63-
this.description = desc;
66+
public HBaseSnapshotException(String message, Throwable cause,
67+
SnapshotDescription snapshotDescription) {
68+
super(message, cause);
69+
this.description = snapshotDescription;
6470
}
6571

6672
/**
6773
* Exception when the description of the snapshot cannot be determined, due to some root other
68-
* root cause
74+
* root cause.
75+
*
6976
* @param message description of what caused the failure
70-
* @param e root cause
77+
* @param e the root cause
7178
*/
7279
public HBaseSnapshotException(String message, Exception e) {
7380
super(message, e);
7481
}
7582

83+
/**
84+
* @return the description of the snapshot that is being failed
85+
* @deprecated since 1.3.0, will be removed in 3.0.0
86+
*/
7687
@Deprecated
7788
public SnapshotDescription getSnapshotDescription() {
7889
return this.description;

hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotException.java

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18-
1918
package org.apache.hadoop.hbase.snapshot;
2019

2120
import org.apache.hadoop.hbase.classification.InterfaceAudience;
2221
import org.apache.hadoop.hbase.classification.InterfaceStability;
22+
2323
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
2424

2525
/**
@@ -29,20 +29,39 @@
2929
@InterfaceAudience.Public
3030
@InterfaceStability.Evolving
3131
public class RestoreSnapshotException extends HBaseSnapshotException {
32+
/**
33+
* @param message reason why restoring the snapshot fails
34+
* @param snapshotDescription description of the snapshot attempted
35+
* @deprecated since 1.3.0, will be removed in 3.0.0
36+
*/
3237
@Deprecated
33-
public RestoreSnapshotException(String msg, SnapshotDescription desc) {
34-
super(msg, desc);
38+
public RestoreSnapshotException(String message, SnapshotDescription snapshotDescription) {
39+
super(message, snapshotDescription);
3540
}
3641

42+
/**
43+
* @param message reason why restoring the snapshot fails
44+
* @param cause the root cause of the failure
45+
* @param snapshotDescription description of the snapshot attempted
46+
* @deprecated since 1.3.0, will be removed in 3.0.0
47+
*/
3748
@Deprecated
38-
public RestoreSnapshotException(String msg, Throwable cause, SnapshotDescription desc) {
39-
super(msg, cause, desc);
49+
public RestoreSnapshotException(String message, Throwable cause,
50+
SnapshotDescription snapshotDescription) {
51+
super(message, cause, snapshotDescription);
4052
}
4153

42-
public RestoreSnapshotException(String msg) {
43-
super(msg);
54+
/**
55+
* @param message reason why restoring the snapshot fails
56+
*/
57+
public RestoreSnapshotException(String message) {
58+
super(message);
4459
}
4560

61+
/**
62+
* @param message reason why restoring the snapshot fails
63+
* @param e the root cause of the failure
64+
*/
4665
public RestoreSnapshotException(String message, Exception e) {
4766
super(message, e);
4867
}

hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotCreationException.java

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import org.apache.hadoop.hbase.classification.InterfaceAudience;
2121
import org.apache.hadoop.hbase.classification.InterfaceStability;
22+
2223
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
2324

2425
/**
@@ -29,32 +30,36 @@
2930
@InterfaceAudience.Public
3031
@InterfaceStability.Evolving
3132
public class SnapshotCreationException extends HBaseSnapshotException {
32-
3333
/**
3434
* Used internally by the RPC engine to pass the exception back to the client.
35-
* @param msg error message to pass back
35+
*
36+
* @param message error message to pass back
3637
*/
37-
public SnapshotCreationException(String msg) {
38-
super(msg);
38+
public SnapshotCreationException(String message) {
39+
super(message);
3940
}
4041

4142
/**
42-
* Failure to create the specified snapshot
43-
* @param msg reason why the snapshot couldn't be completed
44-
* @param desc description of the snapshot attempted
43+
* Failure to create the specified snapshot.
44+
*
45+
* @param message reason why the snapshot couldn't be completed
46+
* @param snapshotDescription description of the snapshot attempted
4547
*/
46-
public SnapshotCreationException(String msg, SnapshotDescription desc) {
47-
super(msg, desc);
48+
public SnapshotCreationException(String message, SnapshotDescription snapshotDescription) {
49+
super(message, snapshotDescription);
4850
}
4951

5052
/**
51-
* Failure to create the specified snapshot due to an external cause
52-
* @param msg reason why the snapshot couldn't be completed
53-
* @param cause root cause of the failure
54-
* @param desc description of the snapshot attempted
53+
* Failure to create the specified snapshot due to an external cause.
54+
*
55+
* @param message reason why the snapshot couldn't be completed
56+
* @param cause the root cause of the failure
57+
* @param snapshotDescription description of the snapshot attempted
58+
* @deprecated since 1.3.0, will be removed in 3.0.0
5559
*/
5660
@Deprecated
57-
public SnapshotCreationException(String msg, Throwable cause, SnapshotDescription desc) {
58-
super(msg, cause, desc);
61+
public SnapshotCreationException(String message, Throwable cause,
62+
SnapshotDescription snapshotDescription) {
63+
super(message, cause, snapshotDescription);
5964
}
6065
}

0 commit comments

Comments
 (0)