Skip to content

Commit 1c4adf1

Browse files
committed
fix: Checkstyle warnings
1 parent 21035b6 commit 1c4adf1

File tree

12 files changed

+39
-29
lines changed

12 files changed

+39
-29
lines changed

src/main/java/me/desair/tus/server/HttpMethod.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public enum HttpMethod {
2323
TRACE,
2424
PATCH;
2525

26+
/** Get the {@link HttpMethod} instance that matches the provided name. */
2627
public static HttpMethod forName(String name) {
2728
for (HttpMethod method : HttpMethod.values()) {
2829
if (StringUtils.equalsIgnoreCase(method.name(), name)) {
@@ -33,6 +34,10 @@ public static HttpMethod forName(String name) {
3334
return null;
3435
}
3536

37+
/**
38+
* Get the {@link HttpMethod} instance of this request if it is present in the provided
39+
* supportedHttpMethods set.
40+
*/
3641
public static HttpMethod getMethodIfSupported(
3742
HttpServletRequest request, Set<HttpMethod> supportedHttpMethods) {
3843
Validate.notNull(request, "The HttpServletRequest cannot be null");

src/main/java/me/desair/tus/server/TusExtension.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88
import me.desair.tus.server.util.TusServletRequest;
99
import me.desair.tus.server.util.TusServletResponse;
1010

11-
/** Interface that represents an extension in the tus protocol */
11+
/** Interface that represents an extension in the tus protocol. */
1212
public interface TusExtension {
1313

1414
/**
15-
* The name of the Tus extension that can be used to disable or enable the extension
15+
* The name of the Tus extension that can be used to disable or enable the extension.
1616
*
1717
* @return The name of the extension
1818
*/
1919
String getName();
2020

2121
/**
22-
* Validate the given request
22+
* Validate the given request.
2323
*
2424
* @param method The HTTP method of this request (taking into account overrides)
2525
* @param servletRequest The HTTP request
@@ -36,7 +36,7 @@ void validate(
3636
throws TusException, IOException;
3737

3838
/**
39-
* Process the given request
39+
* Process the given request.
4040
*
4141
* @param method The HTTP method of this request (taking into account overrides)
4242
* @param servletRequest The HTTP request
@@ -75,7 +75,7 @@ void handleError(
7575
throws IOException, TusException;
7676

7777
/**
78-
* The minimal list of HTTP methods that this extension needs to function properly
78+
* The minimal list of HTTP methods that this extension needs to function properly.
7979
*
8080
* @return The list of HTTP methods required by this extension
8181
*/

src/main/java/me/desair/tus/server/TusFileUploadService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class TusFileUploadService {
4949
private boolean isThreadLocalCacheEnabled = false;
5050
private boolean isChunkedTransferDecodingEnabled = false;
5151

52+
/** Constructor. */
5253
public TusFileUploadService() {
5354
String storagePath = FileUtils.getTempDirectoryPath() + File.separator + "tus";
5455
this.uploadStorageService = new DiskStorageService(idFactory, storagePath);
@@ -104,9 +105,9 @@ public TusFileUploadService withMaxUploadSize(Long maxUploadSize) {
104105
*/
105106
public TusFileUploadService withUploadIdFactory(UploadIdFactory uploadIdFactory) {
106107
Validate.notNull(uploadIdFactory, "The UploadIdFactory cannot be null");
107-
String previousUploadURI = this.idFactory.getUploadUri();
108+
String previousUploadUri = this.idFactory.getUploadUri();
108109
this.idFactory = uploadIdFactory;
109-
this.idFactory.setUploadUri(previousUploadURI);
110+
this.idFactory.setUploadUri(previousUploadUri);
110111
this.uploadStorageService.setIdFactory(this.idFactory);
111112
this.uploadLockingService.setIdFactory(this.idFactory);
112113
return this;

src/main/java/me/desair/tus/server/core/validation/TusResumableValidator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424
public class TusResumableValidator implements RequestValidator {
2525

26+
/** Validate tus protocol version. */
2627
public void validate(
2728
HttpMethod method,
2829
HttpServletRequest request,

src/main/java/me/desair/tus/server/download/DownloadGetRequestHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import me.desair.tus.server.util.TusServletRequest;
1616
import me.desair.tus.server.util.TusServletResponse;
1717

18-
/** Send the uploaded bytes of finished uploads */
18+
/** Send the uploaded bytes of finished uploads. */
1919
public class DownloadGetRequestHandler extends AbstractRequestHandler {
2020

2121
private static final String CONTENT_DISPOSITION_FORMAT =

src/main/java/me/desair/tus/server/exception/UploadInProgressException.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
/**
44
* Exception thrown when accessing an upload that is still in progress and this is not supported by
5-
* the operation
5+
* the operation.
66
*/
77
public class UploadInProgressException extends TusException {
8+
/** Constructor. */
89
public UploadInProgressException(String message) {
910
// 422 Unprocessable Entity
1011
// The request was well-formed but was unable to be followed due to semantic errors.

src/main/java/me/desair/tus/server/upload/UploadInfo.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
import jakarta.servlet.http.HttpServletRequest;
44
import java.io.Serializable;
5+
import java.nio.charset.StandardCharsets;
56
import java.util.Arrays;
67
import java.util.Date;
78
import java.util.List;
89
import java.util.Map;
910
import java.util.TreeMap;
1011
import me.desair.tus.server.util.Utils;
11-
import org.apache.commons.codec.Charsets;
1212
import org.apache.commons.codec.binary.Base64;
1313
import org.apache.commons.lang3.StringUtils;
1414
import org.apache.commons.lang3.builder.EqualsBuilder;
@@ -36,7 +36,7 @@ public class UploadInfo implements Serializable {
3636
private List<String> concatenationPartIds;
3737
private String uploadConcatHeaderValue;
3838

39-
/** Default constructor to use if an upload is created without HTTP request */
39+
/** Default constructor to use if an upload is created without HTTP request. */
4040
public UploadInfo() {
4141
creationTimestamp = getCurrentTime();
4242
offset = 0L;
@@ -45,7 +45,7 @@ public UploadInfo() {
4545
}
4646

4747
/**
48-
* Constructor to use if the upload is created using an HTTP request (which is usually the case)
48+
* Constructor to use if the upload is created using an HTTP request (which is usually the case).
4949
*
5050
* @param servletRequest The HTTP request that creates the new upload
5151
*/
@@ -131,7 +131,7 @@ public Map<String, String> getMetadata() {
131131
}
132132

133133
/**
134-
* Did the client provide any metadata when creating this upload?
134+
* Check if the client provided any metadata when creating this upload.
135135
*
136136
* @return True if metadata is present, false otherwise
137137
*/
@@ -160,7 +160,7 @@ public void setLength(Long length) {
160160
}
161161

162162
/**
163-
* Did the client already provide a total upload length?
163+
* Check if the client already provided a total upload length.
164164
*
165165
* @return True if the total upload length is known, false otherwise
166166
*/
@@ -170,7 +170,7 @@ public boolean hasLength() {
170170

171171
/**
172172
* An upload is still in progress: - as long as we did not receive information on the total length
173-
* (see {@link UploadInfo#getLength()}) - the total length does not match the current offset
173+
* (see {@link UploadInfo#getLength()}) - the total length does not match the current offset.
174174
*
175175
* @return true if the upload is still in progress, false otherwise
176176
*/
@@ -180,7 +180,7 @@ public boolean isUploadInProgress() {
180180

181181
/**
182182
* Set the unique identifier of this upload process The unique identifier is represented by a
183-
* {@link UploadId} instance
183+
* {@link UploadId} instance.
184184
*
185185
* @param id The unique identifier to use
186186
*/
@@ -190,7 +190,7 @@ public void setId(UploadId id) {
190190

191191
/**
192192
* Get the unique identifier of this upload process The unique identifier is represented by a
193-
* {@link UploadId} instance
193+
* {@link UploadId} instance.
194194
*
195195
* @return The unique upload identifier of this upload
196196
*/
@@ -222,7 +222,7 @@ public String getOwnerKey() {
222222

223223
/**
224224
* Indicates the timestamp after which the upload expires in milliseconds since January 1, 1970,
225-
* 00:00:00 GMT
225+
* 00:00:00 GMT.
226226
*
227227
* @return The expiration timestamp in milliseconds
228228
*/
@@ -241,7 +241,7 @@ public void updateExpiration(long expirationPeriod) {
241241

242242
/**
243243
* The timestamp this upload was created in number of milliseconds since January 1, 1970, 00:00:00
244-
* GMT
244+
* GMT.
245245
*
246246
* @return Creation timestamp of this upload object
247247
*/
@@ -301,7 +301,7 @@ public List<String> getConcatenationPartIds() {
301301
}
302302

303303
/**
304-
* Set the original value of the "Upload-Concat" HTTP header that was provided by the client
304+
* Set the original value of the "Upload-Concat" HTTP header that was provided by the client.
305305
*
306306
* @param uploadConcatHeaderValue The original value of the "Upload-Concat" HTTP header
307307
*/
@@ -310,7 +310,7 @@ public void setUploadConcatHeaderValue(String uploadConcatHeaderValue) {
310310
}
311311

312312
/**
313-
* Get the original value of the "Upload-Concat" HTTP header that was provided by the client
313+
* Get the original value of the "Upload-Concat" HTTP header that was provided by the client.
314314
*
315315
* @return The original value of the "Upload-Concat" HTTP header
316316
*/
@@ -354,7 +354,7 @@ public String getFileMimeType() {
354354
}
355355

356356
/**
357-
* Check if this upload is expired
357+
* Check if this upload is expired.
358358
*
359359
* @return True if the upload is expired, false otherwise
360360
*/
@@ -404,7 +404,7 @@ public int hashCode() {
404404
.toHashCode();
405405
}
406406

407-
/** Get the current time in the number of milliseconds since January 1, 1970, 00:00:00 GMT */
407+
/** Get the current time in the number of milliseconds since January 1, 1970, 00:00:00 GMT. */
408408
protected long getCurrentTime() {
409409
return new Date().getTime();
410410
}
@@ -421,7 +421,7 @@ private String decode(String encodedValue) {
421421
if (encodedValue == null) {
422422
return null;
423423
} else {
424-
return new String(Base64.decodeBase64(encodedValue), Charsets.UTF_8);
424+
return new String(Base64.decodeBase64(encodedValue), StandardCharsets.UTF_8);
425425
}
426426
}
427427
}

src/main/java/me/desair/tus/server/upload/disk/FileBasedLock.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class FileBasedLock implements UploadLock {
3131
private FileChannel fileChannel = null;
3232
protected Path lockPath;
3333

34+
/** Constructor. */
3435
public FileBasedLock(String uploadUri, Path lockPath)
3536
throws UploadAlreadyLockedException, IOException {
3637
Validate.notBlank(uploadUri, "The upload URI cannot be blank");

src/main/java/me/desair/tus/server/util/AbstractRequestHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/**
66
* Abstract {@link me.desair.tus.server.RequestHandler} implementation that contains the common
7-
* functionality
7+
* functionality.
88
*/
99
public abstract class AbstractRequestHandler implements RequestHandler {
1010

src/main/java/me/desair/tus/server/util/AbstractTusExtension.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
import me.desair.tus.server.exception.TusException;
1212
import me.desair.tus.server.upload.UploadStorageService;
1313

14+
/** Abstract class to implement a tus extension using validators and request handlers. */
1415
public abstract class AbstractTusExtension implements TusExtension {
1516

1617
private List<RequestValidator> requestValidators = new LinkedList<>();
1718
private List<RequestHandler> requestHandlers = new LinkedList<>();
1819

19-
public AbstractTusExtension() {
20+
protected AbstractTusExtension() {
2021
initValidators(requestValidators);
2122
initRequestHandlers(requestHandlers);
2223
}

0 commit comments

Comments
 (0)