Repository: hadoop Updated Branches: refs/heads/HADOOP-13345 5f02de2e0 -> 5415c82bf
HADOOP-14487 DirListingMetadata precondition failure messages to include path at fault. Contributed by Steve Loughran Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/5415c82b Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/5415c82b Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/5415c82b Branch: refs/heads/HADOOP-13345 Commit: 5415c82bf87e052925e872f5fbe247983def8b3b Parents: 5f02de2 Author: Steve Loughran <[email protected]> Authored: Tue Jun 6 13:40:47 2017 +0100 Committer: Steve Loughran <[email protected]> Committed: Tue Jun 6 13:40:47 2017 +0100 ---------------------------------------------------------------------- .../hadoop/fs/s3a/s3guard/DirListingMetadata.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/5415c82b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/DirListingMetadata.java ---------------------------------------------------------------------- diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/DirListingMetadata.java b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/DirListingMetadata.java index 320fa8d..fe4f9a1 100644 --- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/DirListingMetadata.java +++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/DirListingMetadata.java @@ -272,12 +272,13 @@ public class DirListingMetadata { "host: %s", childUri); Preconditions.checkArgument( childUri.getHost().equals(parentUri.getHost()), - "childUri %s and parentUri %s should have the same host", + "childUri %s and parentUri %s must have the same host", childUri, parentUri); - Preconditions.checkNotNull(childUri.getScheme()); + Preconditions.checkNotNull(childUri.getScheme(), "No scheme in path %s", + childUri); } Preconditions.checkArgument(!childPath.isRoot(), - "childPath cannot be the root path"); + "childPath cannot be the root path: %s", childPath); Preconditions.checkArgument(childPath.getParent().equals(path), "childPath %s must be a child of %s", childPath, path); } @@ -294,9 +295,9 @@ public class DirListingMetadata { Path p = status.getPath(); Preconditions.checkNotNull(p, "Child status' path cannot be null"); Preconditions.checkArgument(!p.isRoot(), - "childPath cannot be the root path"); + "childPath cannot be the root path: %s", p); Preconditions.checkArgument(p.getParent().equals(path), - "childPath must be a child of path"); + "childPath %s must be a child of %s", p, path); URI uri = p.toUri(); URI parentUri = path.toUri(); // If FileStatus' path is missing host, but should have one, add it. @@ -305,7 +306,7 @@ public class DirListingMetadata { return new Path(new URI(parentUri.getScheme(), parentUri.getHost(), uri.getPath(), uri.getFragment())); } catch (URISyntaxException e) { - throw new IllegalArgumentException("FileStatus path invalid with " + + throw new IllegalArgumentException("FileStatus path invalid with" + " added " + parentUri.getScheme() + "://" + parentUri.getHost() + " added", e); } @@ -315,6 +316,6 @@ public class DirListingMetadata { private void checkPathAbsolute(Path p) { Preconditions.checkNotNull(p, "path must be non-null"); - Preconditions.checkArgument(p.isAbsolute(), "path must be absolute"); + Preconditions.checkArgument(p.isAbsolute(), "path must be absolute: %s", p); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
