From a00ddf512263bb51ed526b624ee17225fdf44dc2 Mon Sep 17 00:00:00 2001 From: georgweiss Date: Tue, 15 Aug 2023 09:15:05 +0200 Subject: [PATCH] Removed compiler warnings --- .../java/org/phoebus/olog/LogResource.java | 41 ++++--------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/src/main/java/org/phoebus/olog/LogResource.java b/src/main/java/org/phoebus/olog/LogResource.java index 4e629b2..766ea0f 100644 --- a/src/main/java/org/phoebus/olog/LogResource.java +++ b/src/main/java/org/phoebus/olog/LogResource.java @@ -6,13 +6,7 @@ package org.phoebus.olog; import org.apache.commons.collections4.CollectionUtils; -import org.phoebus.olog.entity.Attachment; -import org.phoebus.olog.entity.Log; -import org.phoebus.olog.entity.LogEntryGroupHelper; -import org.phoebus.olog.entity.Logbook; -import org.phoebus.olog.entity.Property; -import org.phoebus.olog.entity.SearchResult; -import org.phoebus.olog.entity.Tag; +import org.phoebus.olog.entity.*; import org.phoebus.olog.entity.preprocess.LogPropertyProvider; import org.phoebus.olog.entity.preprocess.MarkupCleaner; import org.phoebus.olog.notification.LogEntryNotifier; @@ -21,23 +15,10 @@ import org.springframework.core.io.InputStreamResource; import org.springframework.core.io.Resource; import org.springframework.core.task.TaskExecutor; -import org.springframework.http.ContentDisposition; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; +import org.springframework.http.*; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.util.MultiValueMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.server.ResponseStatusException; @@ -46,12 +27,7 @@ import java.time.Instant; import java.time.temporal.TemporalAmount; import java.time.temporal.UnsupportedTemporalTypeException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Optional; -import java.util.Set; +import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; @@ -207,8 +183,7 @@ public SearchResult search(@RequestHeader(value = OLOG_CLIENT_INFO_HEADER, requi } } } - SearchResult searchResult = logRepository.search(allRequestParams); - return searchResult; + return logRepository.search(allRequestParams); } /** @@ -304,9 +279,9 @@ public Log createLog(@RequestHeader(value = OLOG_CLIENT_INFO_HEADER, required = for (int i = 0; i < files.length; i++) { String originalFileName = files[i].getOriginalFilename(); Optional attachment = - logEntry.getAttachments().stream() - .filter(a -> a.getFilename() != null && a.getFilename().equals(originalFileName)).findFirst(); - if(attachment.isEmpty()){ // Should not happen if client behaves correctly + logEntry.getAttachments().stream() + .filter(a -> a.getFilename() != null && a.getFilename().equals(originalFileName)).findFirst(); + if (attachment.isEmpty()) { // Should not happen if client behaves correctly logger.log(Level.WARNING, "File " + originalFileName + " not matched with attachment meta-data"); continue; }