Closed Bug 888086 Opened 12 years ago Closed 12 years ago

sync/Utils.java claims `StringBuffer should be used instead`

Categories

(Firefox for Android Graveyard :: General, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 27

People

(Reporter: ckitching, Assigned: mcomella)

Details

Attachments

(1 file, 2 obsolete files)

Method byte2hex of Utils.java in mobile/android/base/sync has a comment reminding the programmer that StringBuffer should be used instead of String concatenation in this method, but concatenation is wastefully still being used (And what you really want here is a StringBuilder anyway, because it`s only being accessed from one thread) Let´s fix that.
Assignee: nobody → ckitching
A patch to do as described.
Attachment #768655 - Flags: review?(margaret.leibovic)
Missed the initial capacity... fixed.
Attachment #768655 - Attachment is obsolete: true
Attachment #768655 - Flags: review?(margaret.leibovic)
Attachment #768659 - Flags: review?(margaret.leibovic)
Comment on attachment 768659 [details] [diff] [review] byte2hex now uses StringBuilder, as requested by the comment, V2 (Added initial capacity). This is also rnewman's domain. You've made your way into sync code! :)
Attachment #768659 - Flags: review?(margaret.leibovic) → review?(rnewman)
Comment on attachment 768659 [details] [diff] [review] byte2hex now uses StringBuilder, as requested by the comment, V2 (Added initial capacity). Review of attachment 768659 [details] [diff] [review]: ----------------------------------------------------------------- Don't forget to clean up the patch headers; 'hg qfold' concatenates your temporary commit messages into the destination patch. In order to land this, you first need to take it upstream: https://github.com/mozilla-services/android-sync/blob/develop/README.rst This is a good set of skills to acquire. If you can test that change (there are plenty of tests in the repo that exercise it), open a pull req and we'll get it merged in both places. If you're disinclined to do so (I know margaret is a harsh taskmistress), let me know and I'll take care of the landing. Please don't set checkin-needed without addressing the style nit and upstreaming first. ::: mobile/android/base/sync/Utils.java @@ +82,5 @@ > /** > * Helper to convert a byte array to a hex-encoded string > */ > public static String byte2hex(byte[] b) { > + StringBuilder hs = new StringBuilder(b.length*2); Spaces around arithmetic operators.
Attachment #768659 - Flags: review?(rnewman) → review+
Status: NEW → ASSIGNED
I implemented the test ckitching was missing: https://github.com/mozilla-services/android-sync/pull/362
Flags: needinfo?(rnewman)
r+ via github.
Assignee: chriskitching → michael.l.comella
Flags: needinfo?(rnewman)
Attached patch 01c: m-c PatchSplinter Review
r+ via github.
Attachment #768659 - Attachment is obsolete: true
Attachment #814673 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 27
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: