Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
Metrics
Onionoo
Commits
38bd70ae
Commit
38bd70ae
authored
Aug 20, 2018
by
Karsten Loesing
Browse files
Use diamond operator.
parent
c9aadac0
Changes
13
Show whitespace changes
Inline
Side-by-side
src/main/java/org/torproject/onionoo/docs/DetailsDocument.java
View file @
38bd70ae
...
...
@@ -76,7 +76,7 @@ public class DetailsDocument extends Document {
}
public
List
<
String
>
getExitAddresses
()
{
return
this
.
exitAddresses
==
null
?
new
ArrayList
<
String
>()
return
this
.
exitAddresses
==
null
?
new
ArrayList
<>()
:
this
.
exitAddresses
;
}
...
...
src/main/java/org/torproject/onionoo/docs/DetailsStatus.java
View file @
38bd70ae
...
...
@@ -248,7 +248,7 @@ public class DetailsStatus extends Document {
}
public
SortedSet
<
String
>
getOrAddressesAndPorts
()
{
return
this
.
orAddressesAndPorts
==
null
?
new
TreeSet
<
String
>()
:
return
this
.
orAddressesAndPorts
==
null
?
new
TreeSet
<>()
:
this
.
orAddressesAndPorts
;
}
...
...
src/main/java/org/torproject/onionoo/docs/NodeStatus.java
View file @
38bd70ae
...
...
@@ -182,7 +182,7 @@ public class NodeStatus extends Document {
}
public
SortedSet
<
String
>
getOrAddressesAndPorts
()
{
return
this
.
orAddressesAndPorts
==
null
?
new
TreeSet
<
String
>()
return
this
.
orAddressesAndPorts
==
null
?
new
TreeSet
<>()
:
this
.
orAddressesAndPorts
;
}
...
...
src/main/java/org/torproject/onionoo/server/NodeIndexer.java
View file @
38bd70ae
...
...
@@ -211,7 +211,7 @@ public class NodeIndexer implements ServletContextListener, Runnable {
}
if
(!
newRelaysByCountryCode
.
containsKey
(
countryCode
))
{
newRelaysByCountryCode
.
put
(
countryCode
,
new
HashSet
<
String
>());
new
HashSet
<>());
}
newRelaysByCountryCode
.
get
(
countryCode
).
add
(
fingerprint
);
newRelaysByCountryCode
.
get
(
countryCode
).
add
(
hashedFingerprint
);
...
...
@@ -226,7 +226,7 @@ public class NodeIndexer implements ServletContextListener, Runnable {
asNumber
=
"AS0"
;
}
if
(!
newRelaysByAsNumber
.
containsKey
(
asNumber
))
{
newRelaysByAsNumber
.
put
(
asNumber
,
new
HashSet
<
String
>());
newRelaysByAsNumber
.
put
(
asNumber
,
new
HashSet
<>());
}
newRelaysByAsNumber
.
get
(
asNumber
).
add
(
fingerprint
);
newRelaysByAsNumber
.
get
(
asNumber
).
add
(
hashedFingerprint
);
...
...
@@ -239,7 +239,7 @@ public class NodeIndexer implements ServletContextListener, Runnable {
for
(
String
flag
:
entry
.
getRelayFlags
())
{
String
flagLowerCase
=
flag
.
toLowerCase
();
if
(!
newRelaysByFlag
.
containsKey
(
flagLowerCase
))
{
newRelaysByFlag
.
put
(
flagLowerCase
,
new
HashSet
<
String
>());
newRelaysByFlag
.
put
(
flagLowerCase
,
new
HashSet
<>());
}
newRelaysByFlag
.
get
(
flagLowerCase
).
add
(
fingerprint
);
newRelaysByFlag
.
get
(
flagLowerCase
).
add
(
hashedFingerprint
);
...
...
@@ -260,7 +260,7 @@ public class NodeIndexer implements ServletContextListener, Runnable {
-
entry
.
getFirstSeenMillis
())
/
ONE_DAY
);
if
(!
newRelaysByFirstSeenDays
.
containsKey
(
daysSinceFirstSeen
))
{
newRelaysByFirstSeenDays
.
put
(
daysSinceFirstSeen
,
new
HashSet
<
String
>());
new
HashSet
<>());
}
newRelaysByFirstSeenDays
.
get
(
daysSinceFirstSeen
).
add
(
fingerprint
);
newRelaysByFirstSeenDays
.
get
(
daysSinceFirstSeen
).
add
(
...
...
@@ -270,21 +270,21 @@ public class NodeIndexer implements ServletContextListener, Runnable {
-
entry
.
getLastSeenMillis
())
/
ONE_DAY
);
if
(!
newRelaysByLastSeenDays
.
containsKey
(
daysSinceLastSeen
))
{
newRelaysByLastSeenDays
.
put
(
daysSinceLastSeen
,
new
HashSet
<
String
>());
new
HashSet
<>());
}
newRelaysByLastSeenDays
.
get
(
daysSinceLastSeen
).
add
(
fingerprint
);
newRelaysByLastSeenDays
.
get
(
daysSinceLastSeen
).
add
(
hashedFingerprint
);
String
contact
=
entry
.
getContact
();
if
(!
newRelaysByContact
.
containsKey
(
contact
))
{
newRelaysByContact
.
put
(
contact
,
new
HashSet
<
String
>());
newRelaysByContact
.
put
(
contact
,
new
HashSet
<>());
}
newRelaysByContact
.
get
(
contact
).
add
(
fingerprint
);
newRelaysByContact
.
get
(
contact
).
add
(
hashedFingerprint
);
String
version
=
entry
.
getVersion
();
if
(
null
!=
version
)
{
if
(!
newRelaysByVersion
.
containsKey
(
version
))
{
newRelaysByVersion
.
put
(
version
,
new
HashSet
<
String
>());
newRelaysByVersion
.
put
(
version
,
new
HashSet
<>());
}
newRelaysByVersion
.
get
(
version
).
add
(
fingerprint
);
newRelaysByVersion
.
get
(
version
).
add
(
hashedFingerprint
);
...
...
@@ -347,7 +347,7 @@ public class NodeIndexer implements ServletContextListener, Runnable {
for
(
String
flag
:
entry
.
getRelayFlags
())
{
String
flagLowerCase
=
flag
.
toLowerCase
();
if
(!
newBridgesByFlag
.
containsKey
(
flagLowerCase
))
{
newBridgesByFlag
.
put
(
flagLowerCase
,
new
HashSet
<
String
>());
newBridgesByFlag
.
put
(
flagLowerCase
,
new
HashSet
<>());
}
newBridgesByFlag
.
get
(
flagLowerCase
).
add
(
hashedFingerprint
);
newBridgesByFlag
.
get
(
flagLowerCase
).
add
(
...
...
@@ -358,7 +358,7 @@ public class NodeIndexer implements ServletContextListener, Runnable {
-
entry
.
getFirstSeenMillis
())
/
ONE_DAY
);
if
(!
newBridgesByFirstSeenDays
.
containsKey
(
daysSinceFirstSeen
))
{
newBridgesByFirstSeenDays
.
put
(
daysSinceFirstSeen
,
new
HashSet
<
String
>());
new
HashSet
<>());
}
newBridgesByFirstSeenDays
.
get
(
daysSinceFirstSeen
).
add
(
hashedFingerprint
);
...
...
@@ -369,7 +369,7 @@ public class NodeIndexer implements ServletContextListener, Runnable {
-
entry
.
getLastSeenMillis
())
/
ONE_DAY
);
if
(!
newBridgesByLastSeenDays
.
containsKey
(
daysSinceLastSeen
))
{
newBridgesByLastSeenDays
.
put
(
daysSinceLastSeen
,
new
HashSet
<
String
>());
new
HashSet
<>());
}
newBridgesByLastSeenDays
.
get
(
daysSinceLastSeen
).
add
(
hashedFingerprint
);
...
...
src/main/java/org/torproject/onionoo/updater/ClientsStatusUpdater.java
View file @
38bd70ae
...
...
@@ -116,7 +116,7 @@ public class ClientsStatusUpdater implements DescriptorListener,
responsesByTransport
,
responsesByVersion
);
if
(!
this
.
newResponses
.
containsKey
(
hashedFingerprint
))
{
this
.
newResponses
.
put
(
hashedFingerprint
,
new
TreeSet
<
ClientsHistory
>());
new
TreeSet
<>());
}
this
.
newResponses
.
get
(
hashedFingerprint
).
add
(
newResponseHistory
);
...
...
src/main/java/org/torproject/onionoo/updater/DescriptorSource.java
View file @
38bd70ae
...
...
@@ -83,7 +83,7 @@ public class DescriptorSource {
DescriptorType
descriptorType
)
{
if
(!
this
.
descriptorListeners
.
containsKey
(
descriptorType
))
{
this
.
descriptorListeners
.
put
(
descriptorType
,
new
HashSet
<
DescriptorListener
>());
new
HashSet
<>());
}
this
.
descriptorListeners
.
get
(
descriptorType
).
add
(
listener
);
}
...
...
src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java
View file @
38bd70ae
...
...
@@ -224,7 +224,7 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
continue
;
}
if
(!
this
.
exitListEntries
.
containsKey
(
fingerprint
))
{
this
.
exitListEntries
.
put
(
fingerprint
,
new
HashMap
<
String
,
Long
>());
this
.
exitListEntries
.
put
(
fingerprint
,
new
HashMap
<>());
}
String
exitAddress
=
exitAddressScanMillis
.
getKey
();
if
(!
this
.
exitListEntries
.
get
(
fingerprint
).
containsKey
(
...
...
src/main/java/org/torproject/onionoo/updater/RdnsLookupRequest.java
View file @
38bd70ae
...
...
@@ -91,7 +91,7 @@ class RdnsLookupRequest extends Thread {
envProps
.
put
(
Context
.
INITIAL_CONTEXT_FACTORY
,
"com.sun.jndi.dns.DnsContextFactory"
);
final
DirContext
dnsContext
=
new
InitialDirContext
(
envProps
);
Set
<
String
>
results
=
new
TreeSet
<
String
>();
Set
<
String
>
results
=
new
TreeSet
<>();
Attributes
dnsEntries
=
dnsContext
.
getAttributes
(
hostName
,
new
String
[]
{
type
});
if
(
dnsEntries
!=
null
)
{
...
...
src/main/java/org/torproject/onionoo/updater/UptimeStatusUpdater.java
View file @
38bd70ae
...
...
@@ -105,7 +105,7 @@ public class UptimeStatusUpdater implements DescriptorListener,
String
fingerprint
=
entry
.
getFingerprint
();
if
(!
this
.
newRunningRelays
.
containsKey
(
fingerprint
))
{
this
.
newRunningRelays
.
put
(
fingerprint
,
new
TreeMap
<
Long
,
Flags
>());
new
TreeMap
<>());
}
this
.
newRunningRelays
.
get
(
fingerprint
).
put
(
dateHourMillis
,
new
Flags
(
entry
.
getFlags
()));
...
...
@@ -125,7 +125,7 @@ public class UptimeStatusUpdater implements DescriptorListener,
/
DateTimeHelper
.
ONE_HOUR
)
*
DateTimeHelper
.
ONE_HOUR
;
for
(
String
fingerprint
:
fingerprints
)
{
if
(!
this
.
newRunningBridges
.
containsKey
(
fingerprint
))
{
this
.
newRunningBridges
.
put
(
fingerprint
,
new
TreeSet
<
Long
>());
this
.
newRunningBridges
.
put
(
fingerprint
,
new
TreeSet
<>());
}
this
.
newRunningBridges
.
get
(
fingerprint
).
add
(
dateHourMillis
);
}
...
...
src/test/java/org/torproject/onionoo/docs/DummyDocumentStore.java
View file @
38bd70ae
...
...
@@ -20,7 +20,7 @@ public class DummyDocumentStore extends DocumentStore {
private
<
T
extends
Document
>
SortedMap
<
String
,
Document
>
getStoredDocumentsByClass
(
Class
<
T
>
documentType
)
{
if
(!
this
.
storedDocuments
.
containsKey
(
documentType
))
{
this
.
storedDocuments
.
put
(
documentType
,
new
TreeMap
<
String
,
Document
>());
this
.
storedDocuments
.
put
(
documentType
,
new
TreeMap
<>());
}
return
this
.
storedDocuments
.
get
(
documentType
);
}
...
...
src/test/java/org/torproject/onionoo/server/ResourceServletTest.java
View file @
38bd70ae
...
...
@@ -56,7 +56,7 @@ public class ResourceServletTest {
this
.
requestUri
=
requestUri
;
this
.
queryString
=
queryString
;
this
.
parameterMap
=
parameterMap
==
null
?
new
HashMap
<
String
,
String
[]
>()
:
parameterMap
;
?
new
HashMap
<>()
:
parameterMap
;
}
@Override
...
...
@@ -162,8 +162,8 @@ public class ResourceServletTest {
"Running"
,
"V2Dir"
,
"Valid"
})),
1140L
,
"us"
,
DateTimeHelper
.
parse
(
"2013-04-16 18:00:00"
),
"AS7922"
,
"comcast cable communications, llc"
,
null
,
new
TreeSet
<
String
>(
Arrays
.
asList
(
new
String
[]
{
"000C5F55BD4814B917CC474BD537F1A3B33CCE2A"
})),
new
TreeSet
<>(
Arrays
.
asList
(
new
String
[]{
"000C5F55BD4814B917CC474BD537F1A3B33CCE2A"
})),
new
TreeSet
<>(
Arrays
.
asList
(
new
String
[]
{
"000C5F55BD4814B917CC474BD537F1A3B33CCE2A"
})),
null
,
null
,
new
TreeSet
<>(
Arrays
.
asList
(
...
...
@@ -182,7 +182,7 @@ public class ResourceServletTest {
"liberty global operations b.v."
,
"1024d/51e2a1c7 \"steven j. murdoch\" "
+
"<tor+steven.murdoch@cl.cam.ac.uk> <fb-token:5sr_k_zs2wm=>"
,
new
TreeSet
<
String
>(),
new
TreeSet
<
String
>(),
"0.2.3.24-rc-dev"
,
new
TreeSet
<>(),
new
TreeSet
<>(),
"0.2.3.24-rc-dev"
,
"windows xp"
,
null
,
null
,
false
);
this
.
relays
.
put
(
"0025C136C1F3A9EEFE2AE3F918F03BFA21B5070B"
,
relayTimMayTribute
);
...
...
@@ -337,7 +337,7 @@ public class ResourceServletTest {
String
[]
parameterParts
=
parameter
.
split
(
"="
);
if
(!
parameterLists
.
containsKey
(
parameterParts
[
0
]))
{
parameterLists
.
put
(
parameterParts
[
0
],
new
ArrayList
<
String
>());
new
ArrayList
<>());
}
parameterLists
.
get
(
parameterParts
[
0
]).
add
(
parameterParts
[
1
]);
}
...
...
src/test/java/org/torproject/onionoo/updater/DummyDescriptorSource.java
View file @
38bd70ae
...
...
@@ -32,7 +32,7 @@ public class DummyDescriptorSource extends DescriptorSource {
private
Set
<
Descriptor
>
getDescriptorsByType
(
DescriptorType
descriptorType
)
{
if
(!
this
.
descriptors
.
containsKey
(
descriptorType
))
{
this
.
descriptors
.
put
(
descriptorType
,
new
HashSet
<
Descriptor
>());
this
.
descriptors
.
put
(
descriptorType
,
new
HashSet
<>());
}
return
this
.
descriptors
.
get
(
descriptorType
);
}
...
...
@@ -45,7 +45,7 @@ public class DummyDescriptorSource extends DescriptorSource {
DescriptorType
descriptorType
)
{
if
(!
this
.
descriptorListeners
.
containsKey
(
descriptorType
))
{
this
.
descriptorListeners
.
put
(
descriptorType
,
new
HashSet
<
DescriptorListener
>());
new
HashSet
<>());
}
this
.
descriptorListeners
.
get
(
descriptorType
).
add
(
listener
);
}
...
...
src/test/java/org/torproject/onionoo/updater/LookupServiceTest.java
View file @
38bd70ae
...
...
@@ -234,19 +234,19 @@ public class LookupServiceTest {
@Test
()
public
void
testLookupNoBlocksLines
()
{
this
.
assertLookupResult
(
new
ArrayList
<
String
>(),
null
,
null
,
this
.
assertLookupResult
(
new
ArrayList
<>(),
null
,
null
,
"8.8.8.8"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
);
}
@Test
()
public
void
testLookupNoLocationLines
()
{
this
.
assertLookupResult
(
null
,
new
ArrayList
<
String
>(),
null
,
this
.
assertLookupResult
(
null
,
new
ArrayList
<>(),
null
,
"8.8.8.8"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
);
}
@Test
()
public
void
testLookupNoGeoipAsNum2Lines
()
{
this
.
assertLookupResult
(
null
,
null
,
new
ArrayList
<
String
>(),
this
.
assertLookupResult
(
null
,
null
,
new
ArrayList
<>(),
"8.8.8.8"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment