Skip to content

Commit

Permalink
add null check for missing file
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlerman committed Dec 21, 2023
1 parent ffe46f2 commit 68cb9e8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tds/src/main/java/thredds/servlet/ServletUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ public static void writeMFileToResponse(HttpServletRequest request, HttpServletR
final String ncmlLocation = TdsRequestedDataset.getLocationFromNcml(requestPath);
final String location =
ncmlLocation != null ? ncmlLocation : TdsRequestedDataset.getLocationFromRequestPath(requestPath);

if (location == null) {
response.sendError(HttpServletResponse.SC_NOT_FOUND, "Could not find file with URL path: " + requestPath);
return;
}

final MFile file = MFiles.create(location);

if (file == null) {
Expand Down

0 comments on commit 68cb9e8

Please sign in to comment.