[tor-bugs] #20320 [Metrics/metrics-lib]: Avoid running into an IOException and logging a warning for it

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Oct 8 15:54:20 UTC 2016


#20320: Avoid running into an IOException and logging a warning for it
-------------------------------------+---------------------
     Reporter:  karsten              |      Owner:  karsten
         Type:  defect               |     Status:  new
     Priority:  Low                  |  Milestone:
    Component:  Metrics/metrics-lib  |    Version:
     Severity:  Normal               |   Keywords:
Actual Points:                       |  Parent ID:
       Points:                       |   Reviewer:
      Sponsor:                       |
-------------------------------------+---------------------
 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.  Trivial patch:

 {{{
 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 {
 }}}

 I'd say this is a minor issue, because it prints a warning message that
 might confuse users, but only on the first run.  No need to put out a
 (point) release just for this, but it would be good to fix this in master.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/20320>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list