Skip to content

Commit 0ea889f

Browse files
committed
Push down null check in constructor
Javadoc
1 parent 4ece975 commit 0ea889f

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

src/main/java/org/apache/commons/codec/digest/GitDirectoryEntry.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,22 @@ class GitDirectoryEntry implements Comparable<GitDirectoryEntry> {
5252
enum Type {
5353

5454
/**
55-
* A sub-directory (Git sub-tree)
55+
* A sub-directory (Git sub-tree).
5656
*/
5757
DIRECTORY("40000"),
5858

5959
/**
60-
* An executable file
60+
* An executable file.
6161
*/
6262
EXECUTABLE("100755"),
6363

6464
/**
65-
* A regular (non-executable) file
65+
* A regular (non-executable) file.
6666
*/
6767
REGULAR("100644"),
6868

6969
/**
70-
* A symbolic link
70+
* A symbolic link.
7171
*/
7272
SYMBOLIC_LINK("120000");
7373

@@ -112,30 +112,30 @@ private static String getFileName(final Path path) {
112112
private final byte[] rawObjectId;
113113

114114
/**
115-
* Creates an entry
115+
* Creates an entry.
116116
*
117-
* @param path The path of the entry; must not be an empty path
118-
* @param type The type of the entry
119-
* @param rawObjectId The id of the entry
120-
* @throws IllegalArgumentException If the path is empty
121-
* @throws NullPointerException If any argument is {@code null}
117+
* @param path The path of the entry; must not be an empty path.
118+
* @param type The type of the entry.
119+
* @param rawObjectId The id of the entry.
120+
* @throws IllegalArgumentException If the path is empty.
121+
* @throws NullPointerException If any argument is {@code null}.
122122
*/
123123
GitDirectoryEntry(final Path path, final Type type, final byte[] rawObjectId) {
124-
this(getFileName(path), Objects.requireNonNull(type), Objects.requireNonNull(rawObjectId));
124+
this(getFileName(path), type, rawObjectId);
125125
}
126126

127127
/**
128-
* Creates an entry
128+
* Creates an entry.
129129
*
130130
* @param name The name of the entry
131131
* @param type The type of the entry
132132
* @param rawObjectId The id of the entry
133133
*/
134134
private GitDirectoryEntry(final String name, final Type type, final byte[] rawObjectId) {
135135
this.name = name;
136-
this.type = type;
136+
this.type = Objects.requireNonNull(type);
137137
this.sortKey = type == Type.DIRECTORY ? name + "/" : name;
138-
this.rawObjectId = rawObjectId;
138+
this.rawObjectId = Objects.requireNonNull(rawObjectId);
139139
}
140140

141141
@Override
@@ -168,7 +168,7 @@ public int hashCode() {
168168
* &lt;mode&gt; SP &lt;name&gt; NUL &lt;20-byte-object-id&gt;
169169
* </pre>
170170
*
171-
* @return the binary tree-entry encoding; never {@code null}
171+
* @return the binary tree-entry encoding; never {@code null}.
172172
*/
173173
byte[] toTreeEntryBytes() {
174174
final byte[] nameBytes = name.getBytes(StandardCharsets.UTF_8);

0 commit comments

Comments
 (0)