commit f7f56dd83d2318a1e435642c5a653ab79af453d1 Author: Karsten Loesing karsten.loesing@gmx.net Date: Sun Oct 9 08:45:02 2016 +0200
Avoid running into an IOException and logging it.
When we recently switched from System.err printing to slf4j logging, we started logging an IOException that we shouldn't be running into and that we simply ignored before. This exception gets thrown when DescriptorReaderImpl attempts to read a parse history file that doesn't exist (yet). We should simply check whether that files exists before attempting to read it.
Fixes #20320. --- CHANGELOG.md | 6 ++++++ .../java/org/torproject/descriptor/impl/DescriptorReaderImpl.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md index 232049e..b5cee05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# Changes in version 1.?.? - 2016-1?-?? + + * Minor changes + - Avoid running into an IOException and logging a warning for it. + + # Changes in version 1.4.0 - 2016-08-31
* Major changes diff --git a/src/main/java/org/torproject/descriptor/impl/DescriptorReaderImpl.java b/src/main/java/org/torproject/descriptor/impl/DescriptorReaderImpl.java index fac9475..020cdd7 100644 --- a/src/main/java/org/torproject/descriptor/impl/DescriptorReaderImpl.java +++ b/src/main/java/org/torproject/descriptor/impl/DescriptorReaderImpl.java @@ -200,7 +200,7 @@ public class DescriptorReaderImpl implements DescriptorReader { }
private void readOldHistory() { - if (this.historyFile == null) { + if (this.historyFile == null || !this.historyFile.exists()) { return; } try {