copy into new array when returning from resolver

This commit is contained in:
Daniel Gultsch 2018-09-20 20:29:21 +02:00
parent 5be64de7be
commit 4930f22615
1 changed files with 10 additions and 6 deletions

View File

@ -106,14 +106,18 @@ public class Resolver {
threads[1].join();
if (results.size() > 0) {
threads[2].interrupt();
synchronized (results) {
Collections.sort(results);
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": " + results.toString());
return results;
return new ArrayList<>(results);
}
} else {
threads[2].join();
synchronized (fallbackResults) {
Collections.sort(fallbackResults);
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": " + fallbackResults.toString());
return fallbackResults;
return new ArrayList<>(fallbackResults);
}
}
} catch (InterruptedException e) {
return results;