Skip to content

Commit ed31c89

Browse files
authored
Fixes #346 (#351)
* Fixes #346 * Updated changelog.
1 parent 51419eb commit ed31c89

5 files changed

Lines changed: 6 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This project aims to adhere to [Semantic Versioning](http://semver.org/).
1818
- Setting `manta.retries`/`MANTA_HTTP_RETRIES` to 0 would print `Retry of failed requests is disabled` but
1919
leave the default Apache HttpClient [retry behavior](https://hc.apache.org/httpcomponents-client-4.5.x/tutorial/html/fundamentals.html#d5e316).
2020
- [Content type is set for file object in directory listing when it isn't available](https://github.com/joyent/java-manta/issues/341)
21+
- [Fixes validation guard clauses that are not validating anything](https://github.com/joyent/java-manta/issues/346)
2122
### Changed
2223
- Validation of paths passed to `MantaClient` is now more consistently strict.
2324
More useful errors should be thrown sooner for invalid paths, without any

java-manta-client-unshaded/src/main/java/com/joyent/manta/client/MantaClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2009,7 +2009,7 @@ public MantaJob getJob(final UUID jobId) throws IOException {
20092009
}
20102010
}
20112011

2012-
Validate.notNull("Job returned must not be null");
2012+
Validate.notNull(job, "Job returned must not be null");
20132013
return job;
20142014
}
20152015

java-manta-client-unshaded/src/main/java/com/joyent/manta/client/crypto/MantaEncryptedObjectInputStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ public Long getContentLength() {
818818
}
819819

820820
Long plaintextSize = super.getContentLength();
821-
Validate.notNull("Content-length header wasn't set by server");
821+
Validate.notNull(plaintextSize, "Content-length header wasn't set by server");
822822
return this.cipherDetails.plaintextSize(plaintextSize);
823823
}
824824
}

java-manta-client-unshaded/src/main/java/com/joyent/manta/client/jobs/MantaJobBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public Run lookupJob(final MantaJob job) {
9797
* @return a fluent interface providing job management options
9898
*/
9999
public Run lookupJob(final UUID jobId) {
100-
Validate.notNull("Job id must not be null");
100+
Validate.notNull(jobId, "Job id must not be null");
101101

102102
return new MantaJobBuilder.Run(this, jobId);
103103
}

java-manta-client-unshaded/src/main/java/com/joyent/manta/client/multipart/AbstractMultipartManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public PART uploadPart(final UPLOAD upload,
144144
final int partNumber,
145145
final InputStream inputStream)
146146
throws IOException {
147-
Validate.notNull("InputStream must not be null");
147+
Validate.notNull(inputStream, "InputStream must not be null");
148148

149149
if (inputStream.getClass().equals(FileInputStream.class)) {
150150
final FileInputStream fin = (FileInputStream)inputStream;
@@ -163,7 +163,7 @@ public PART uploadPart(final UPLOAD upload,
163163
final int partNumber,
164164
final long contentLength,
165165
final InputStream inputStream) throws IOException {
166-
Validate.notNull("InputStream must not be null");
166+
Validate.notNull(inputStream, "InputStream must not be null");
167167

168168
HttpEntity entity;
169169

0 commit comments

Comments
 (0)