From 24bbe63da1ed67dccfd10d514c063ca59cdb4ec0 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 6 Jan 2017 14:49:12 +0100 Subject: [PATCH] Minor code improvements in DNSutil --- .../src/main/java/org/jivesoftware/smack/util/DNSUtil.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java b/smack-core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java index 17ed2a46b..ebe709a06 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java @@ -250,14 +250,16 @@ public class DNSUtil { List bucket = buckets.get(priority); int bucketSize; while ((bucketSize = bucket.size()) > 0) { - int[] totals = new int[bucket.size()]; + int[] totals = new int[bucketSize]; int running_total = 0; int count = 0; int zeroWeight = 1; for (SRVRecord r : bucket) { - if (r.getWeight() > 0) + if (r.getWeight() > 0) { zeroWeight = 0; + break; + } } for (SRVRecord r : bucket) {