diff options
author | Colin Decker <cgdecker@google.com> | 2013-10-18 14:37:49 -0400 |
---|---|---|
committer | Colin Decker <cgdecker@google.com> | 2013-10-18 14:37:49 -0400 |
commit | 40560ae2f2f04012c229aa5348e9b462a81a0e56 (patch) | |
tree | 9515d10f6090d0eac98b69812c44d24654c052fd /jimfs/src/main | |
parent | 00f243cb657c0bfb4829f839600c0a48c26c6585 (diff) | |
download | jimfs-40560ae2f2f04012c229aa5348e9b462a81a0e56.tar.gz |
Minor changes.
Diffstat (limited to 'jimfs/src/main')
-rw-r--r-- | jimfs/src/main/java/com/google/jimfs/internal/DirectoryTable.java | 13 | ||||
-rw-r--r-- | jimfs/src/main/java/com/google/jimfs/internal/FileSystemView.java | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/jimfs/src/main/java/com/google/jimfs/internal/DirectoryTable.java b/jimfs/src/main/java/com/google/jimfs/internal/DirectoryTable.java index 3ecec21..bbb1f98 100644 --- a/jimfs/src/main/java/com/google/jimfs/internal/DirectoryTable.java +++ b/jimfs/src/main/java/com/google/jimfs/internal/DirectoryTable.java @@ -16,10 +16,10 @@ package com.google.jimfs.internal; -import static com.google.common.base.Preconditions.checkArgument; import static com.google.jimfs.internal.Name.PARENT; import static com.google.jimfs.internal.Name.SELF; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Predicates; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSortedSet; @@ -136,7 +136,8 @@ final class DirectoryTable implements FileContent { /** * Returns the number of entries in this directory. */ - public int size() { + @VisibleForTesting + int entryCount() { return entries.size(); } @@ -161,7 +162,9 @@ final class DirectoryTable implements FileContent { } private DirectoryEntry linkInternal(Name name, File file) { - checkArgument(!entries.containsKey(name), "entry '%s' already exists", name); + if (entries.containsKey(name)) { + throw new IllegalArgumentException("entry '" + name + "' already exists"); + } DirectoryEntry entry = new DirectoryEntry(self(), name, file); entries.put(name, entry); file.incrementLinkCount(); @@ -219,7 +222,9 @@ final class DirectoryTable implements FileContent { } private static Name checkValidName(Name name, String action) { - checkArgument(!RESERVED_NAMES.contains(name), "cannot %s: %s", action, name); + if (RESERVED_NAMES.contains(name)) { + throw new IllegalArgumentException("cannot " + action + ": " + name); + } return name; } } diff --git a/jimfs/src/main/java/com/google/jimfs/internal/FileSystemView.java b/jimfs/src/main/java/com/google/jimfs/internal/FileSystemView.java index 9c114ca..9666eff 100644 --- a/jimfs/src/main/java/com/google/jimfs/internal/FileSystemView.java +++ b/jimfs/src/main/java/com/google/jimfs/internal/FileSystemView.java @@ -273,7 +273,7 @@ final class FileSystemView { * already exists at the given path, returns the key of that file. Otherwise, throws {@link * FileAlreadyExistsException}. */ - public File createFile(JimfsPath path, Supplier<File> fileSupplier, + private File createFile(JimfsPath path, Supplier<File> fileSupplier, boolean allowExisting, FileAttribute<?>... attrs) throws IOException { checkNotNull(path); checkNotNull(fileSupplier); |