docs: update Dirty Flag docs (#2908)

This commit is contained in:
Ilkka Seppälä
2024-04-09 21:02:36 +03:00
committed by GitHub
parent 317f9c3920
commit 66538ddcda
4 changed files with 125 additions and 36 deletions
@@ -40,7 +40,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class DataFetcher {
private final String filename = "world.txt";
private static final String FILENAME = "world.txt";
private long lastFetched;
public DataFetcher() {
@@ -62,14 +62,14 @@ public class DataFetcher {
*/
public List<String> fetch() {
var classLoader = getClass().getClassLoader();
var file = new File(classLoader.getResource(filename).getFile());
var file = new File(classLoader.getResource(FILENAME).getFile());
if (isDirty(file.lastModified())) {
LOGGER.info(filename + " is dirty! Re-fetching file content...");
LOGGER.info(FILENAME + " is dirty! Re-fetching file content...");
try (var br = new BufferedReader(new FileReader(file))) {
return br.lines().collect(Collectors.collectingAndThen(Collectors.toList(), List::copyOf));
} catch (IOException e) {
e.printStackTrace();
LOGGER.error("An error occurred: ", e);
}
}
-23
View File
@@ -1,26 +1,3 @@
====
The MIT License
Copyright © 2014-2021 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
====
UNITED_KINGDOM
MALAYSIA
UNITED_STATES
@@ -36,7 +36,6 @@ class AppTest {
/**
* Issue: Add at least one assertion to this test case.
*
* Solution: Inserted assertion to check whether the execution of the main method in {@link App#main(String[])}
* throws an exception.
*/