Sonar cleanups 03032019

This commit is contained in:
Ingmar Goudt 2019-03-04 10:43:20 +01:00
parent f46f321635
commit 45f665eb1d
13 changed files with 37 additions and 41 deletions

View file

@ -121,10 +121,8 @@ public enum ServerMessagesUtil {
return Collections.emptyList();
}
Scanner scanner = null;
List<String> newMessages = new ArrayList<>();
try {
scanner = new Scanner(is);
try(Scanner scanner = new Scanner(is)) {
while (scanner.hasNextLine()) {
String message = scanner.nextLine();
if (!message.trim().isEmpty()) {
@ -134,7 +132,6 @@ public enum ServerMessagesUtil {
} catch (Exception e) {
log.error(e, e);
} finally {
StreamUtils.closeQuietly(scanner);
StreamUtils.closeQuietly(is);
}
return newMessages;