forked from I2P_Developers/i2p.i2p
Use copy constructor instead of clone()
This commit is contained in:
@ -151,7 +151,7 @@ public class OutNetMessage implements CDPQEntry {
|
||||
if (_log.shouldLog(Log.INFO)) {
|
||||
synchronized (this) {
|
||||
locked_initTimestamps();
|
||||
return (Map<String, Long>)_timestamps.clone();
|
||||
return new HashMap<String, Long>(_timestamps);
|
||||
}
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
|
@ -44,12 +44,12 @@ class SearchState {
|
||||
public Hash getTarget() { return _searchKey; }
|
||||
public Set<Hash> getPending() {
|
||||
synchronized (_pendingPeers) {
|
||||
return (Set<Hash>)_pendingPeers.clone();
|
||||
return new HashSet<Hash>(_pendingPeers);
|
||||
}
|
||||
}
|
||||
public Set<Hash> getAttempted() {
|
||||
synchronized (_attemptedPeers) {
|
||||
return (Set<Hash>)_attemptedPeers.clone();
|
||||
return new HashSet<Hash>(_attemptedPeers);
|
||||
}
|
||||
}
|
||||
public Set<Hash> getClosestAttempted(int max) {
|
||||
@ -78,12 +78,12 @@ class SearchState {
|
||||
}
|
||||
public Set<Hash> getSuccessful() {
|
||||
synchronized (_successfulPeers) {
|
||||
return (Set<Hash>)_successfulPeers.clone();
|
||||
return new HashSet<Hash>(_successfulPeers);
|
||||
}
|
||||
}
|
||||
public Set<Hash> getFailed() {
|
||||
synchronized (_failedPeers) {
|
||||
return (Set<Hash>)_failedPeers.clone();
|
||||
return new HashSet<Hash>(_failedPeers);
|
||||
}
|
||||
}
|
||||
public boolean completed() { return _completed != -1; }
|
||||
@ -155,7 +155,7 @@ class SearchState {
|
||||
}
|
||||
}
|
||||
|
||||
public Set<Hash> getRepliedPeers() { synchronized (_repliedPeers) { return (Set<Hash>)_repliedPeers.clone(); } }
|
||||
public Set<Hash> getRepliedPeers() { synchronized (_repliedPeers) { return new HashSet<Hash>(_repliedPeers); } }
|
||||
|
||||
public void replyTimeout(Hash peer) {
|
||||
synchronized (_pendingPeers) {
|
||||
|
@ -58,17 +58,17 @@ class StoreState {
|
||||
public DatabaseEntry getData() { return _data; }
|
||||
public Set<Hash> getPending() {
|
||||
synchronized (_pendingPeers) {
|
||||
return (Set<Hash>)_pendingPeers.clone();
|
||||
return new HashSet<Hash>(_pendingPeers);
|
||||
}
|
||||
}
|
||||
public Set<Hash> getAttempted() {
|
||||
synchronized (_attemptedPeers) {
|
||||
return (Set<Hash>)_attemptedPeers.clone();
|
||||
return new HashSet<Hash>(_attemptedPeers);
|
||||
}
|
||||
}
|
||||
public Set<Hash> getSuccessful() {
|
||||
synchronized (_successfulPeers) {
|
||||
return (Set<Hash>)_successfulPeers.clone();
|
||||
return new HashSet<Hash>(_successfulPeers);
|
||||
}
|
||||
}
|
||||
/** unused */
|
||||
@ -82,7 +82,7 @@ class StoreState {
|
||||
|
||||
public Set<Hash> getFailed() {
|
||||
synchronized (_failedPeers) {
|
||||
return (Set<Hash>)_failedPeers.clone();
|
||||
return new HashSet<Hash>(_failedPeers);
|
||||
}
|
||||
}
|
||||
public boolean completed() { return _completed != -1; }
|
||||
|
Reference in New Issue
Block a user