Skip to content

Commit 351bf23

Browse files
author
Vladimir
committed
Suppressed exception logging in case of log file or path absence
1 parent e60023e commit 351bf23

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

config/application.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ choices:
1212
- group: Логи в CP1251
1313
# encoding: CP-1251
1414
paths:
15-
- log-samples/bankplus.log as "$g - $f"
15+
- log-samples/bankplus.log as "$g - $f" (selected)
1616

1717
- group: Логи UPC-2
1818
paths:
@@ -22,4 +22,4 @@ choices:
2222
- group: JavaScript
2323
scanDir: C:\lang\analog\src\main\resources\static\js
2424
paths:
25-
- C:\lang\analog\src\main\resources\static\js\main-controller.js as "Main.JS" (selected)
25+
- C:\lang\analog\src\main\resources\static\js\main-controller.js as "Main.JS"

src/main/java/ru/ftc/upc/testing/analog/service/EncodingDetector.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import ru.ftc.upc.testing.analog.util.Util;
1212

1313
import java.io.File;
14+
import java.io.FileNotFoundException;
1415
import java.io.IOException;
1516
import java.util.concurrent.ConcurrentHashMap;
1617

@@ -65,6 +66,9 @@ private void processPath(String path) {
6566
"(took {} ms).", path, DEFAULT_ENCODING, (System.currentTimeMillis() - fileProcessingStart));
6667
}
6768

69+
} catch (FileNotFoundException e) {
70+
log.warn("Couldn't detect encoding of log '{}' because it wasn't found.", path);
71+
6872
} catch (IOException e) {
6973
detectedEncodings.put(path, DEFAULT_ENCODING);
7074
log.warn(format("Couldn't detect encoding of log '%s' because of error. %s has been selected as default",

src/main/java/ru/ftc/upc/testing/analog/service/MainController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import java.io.FileNotFoundException;
1414
import java.io.IOException;
1515
import java.nio.file.Files;
16+
import java.nio.file.NoSuchFileException;
1617
import java.nio.file.Path;
1718
import java.nio.file.Paths;
1819
import java.util.ArrayList;
@@ -144,6 +145,9 @@ private Stream<LogChoice> flattenGroup(ChoiceGroup group) {
144145
Util.expandTitle(logPath.toString(), DEFAULT_TITLE_FORMAT, groupName),
145146
false))
146147
.collect(toSet()));
148+
} catch (NoSuchFileException e) {
149+
log.warn("Path '{}' is not found and thus won't be scanned.", scanDirPath);
150+
147151
} catch (IOException e) {
148152
log.error(format("Failed to scan directory '%s'; will be ignored.", group.getScanDir()), e);
149153
}

0 commit comments

Comments
 (0)