Use self-contained Preconditions (in hadoop common module)

This commit is contained in:
jay.zhu 2023-03-06 16:54:18 +08:00
parent b20d228c69
commit c906c78e3e
2 changed files with 3 additions and 5 deletions

View File

@ -33,9 +33,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
import org.apache.hadoop.util.Preconditions; import static org.apache.hadoop.util.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkArgument;
/** /**
* The OptionsParser parses out the command-line options passed to DistCp, * The OptionsParser parses out the command-line options passed to DistCp,
@ -69,7 +67,7 @@ public class OptionsParser {
} }
private static void checkSnapshotsArgs(final String[] snapshots) { private static void checkSnapshotsArgs(final String[] snapshots) {
Preconditions.checkArgument(snapshots != null && snapshots.length == 2 checkArgument(snapshots != null && snapshots.length == 2
&& !StringUtils.isBlank(snapshots[0]) && !StringUtils.isBlank(snapshots[0])
&& !StringUtils.isBlank(snapshots[1]), && !StringUtils.isBlank(snapshots[1]),
"Must provide both the starting and ending snapshot names"); "Must provide both the starting and ending snapshot names");

View File

@ -60,10 +60,10 @@ import org.apache.hadoop.tools.util.ThrottledInputStream;
import org.apache.hadoop.classification.VisibleForTesting; import org.apache.hadoop.classification.VisibleForTesting;
import static com.google.common.base.Preconditions.checkArgument;
import static org.apache.hadoop.fs.Options.OpenFileOptions.FS_OPTION_OPENFILE_READ_POLICY; import static org.apache.hadoop.fs.Options.OpenFileOptions.FS_OPTION_OPENFILE_READ_POLICY;
import static org.apache.hadoop.fs.Options.OpenFileOptions.FS_OPTION_OPENFILE_READ_POLICY_SEQUENTIAL; import static org.apache.hadoop.fs.Options.OpenFileOptions.FS_OPTION_OPENFILE_READ_POLICY_SEQUENTIAL;
import static org.apache.hadoop.tools.mapred.CopyMapper.getFileAttributeSettings; import static org.apache.hadoop.tools.mapred.CopyMapper.getFileAttributeSettings;
import static org.apache.hadoop.util.Preconditions.checkArgument;
import static org.apache.hadoop.util.functional.FutureIO.awaitFuture; import static org.apache.hadoop.util.functional.FutureIO.awaitFuture;
/** /**