Skip to content

Commit 966690f

Browse files
authored
Remove a null check that isn't required (#123)
1 parent 82aaad1 commit 966690f

File tree

3 files changed

+1
-6
lines changed

3 files changed

+1
-6
lines changed

avaje-jex-static-content/src/main/java/io/avaje/jex/staticcontent/AbstractStaticHandler.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,10 @@ protected String getExt(String path) {
5959

6060
protected String lookupMime(String path) {
6161
var lower = path.toLowerCase();
62-
6362
return Objects.requireNonNullElseGet(
6463
MIME_MAP.getContentTypeFor(path),
6564
() -> {
6665
String ext = getExt(lower);
67-
6866
return mimeTypes.getOrDefault(ext, "application/octet-stream");
6967
});
7068
}

avaje-jex-static-content/src/main/java/io/avaje/jex/staticcontent/StaticResourceHandlerBuilder.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ static StaticResourceHandlerBuilder builder(String root) {
3838

3939
@Override
4040
public void add(Routing routing) {
41-
4241
routing.get(path, createHandler());
4342
}
4443

@@ -122,7 +121,6 @@ private StaticFileHandler fileLoader() {
122121
if (directoryIndex != null) {
123122
try {
124123
dirIndex = new File(root.transform(this::appendSlash) + directoryIndex).getCanonicalFile();
125-
126124
fsRoot = dirIndex.getParentFile().getPath();
127125
} catch (Exception e) {
128126
throw new IllegalStateException(
@@ -131,7 +129,6 @@ private StaticFileHandler fileLoader() {
131129
} else {
132130
try {
133131
singleFile = new File(root).getCanonicalFile();
134-
135132
fsRoot = singleFile.getParentFile().getPath();
136133
} catch (Exception e) {
137134
throw new IllegalStateException(FAILED_TO_LOCATE_FILE + root, e);

avaje-jex/src/main/java/io/avaje/jex/core/JdkContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public String pathParam(String name) {
250250
@Override
251251
public String queryParam(String name) {
252252
final List<String> vals = queryParams(name);
253-
return vals == null || vals.isEmpty() ? null : vals.getFirst();
253+
return vals.isEmpty() ? null : vals.getFirst();
254254
}
255255

256256
private Map<String, List<String>> queryParams() {

0 commit comments

Comments
 (0)