[tor-bugs] #17830 [metrics-lib]: use StringBuilder correctly

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Dec 12 14:49:01 UTC 2015


#17830: use StringBuilder correctly
-----------------------------+---------------------
     Reporter:  iwakeh       |      Owner:  karsten
         Type:  defect       |     Status:  new
     Priority:  Medium       |  Milestone:
    Component:  metrics-lib  |    Version:
     Severity:  Normal       |   Keywords:
Actual Points:               |  Parent ID:  #17822
       Points:               |    Sponsor:
-----------------------------+---------------------
 This is not java 7 related, but should be included here:

 Code like this
 {{{
  crypto = new StringBuilder();
  crypto.append(line + "\n");
 }}}
  defeats the purpose of using StringBuilder, because String concatenation
 using {{{+}}} will internally be accomplished by using another
 StringBuilder (see Javadoc).


 This should also be added to the coding guidelines (or did we write these
 for Onionoo only?).

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


More information about the tor-bugs mailing list