Skip to content

Commit f53c915

Browse files
vjkoskelaBrandonArp
authored andcommitted
Dependency updates and related fixed. (#104)
Dependency updates and related fixed.
1 parent 3a21d9c commit f53c915

17 files changed

+115
-146
lines changed

pom.xml

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<parent>
1919
<groupId>com.arpnetworking.build</groupId>
2020
<artifactId>arpnetworking-parent-pom</artifactId>
21-
<version>1.1.6</version>
21+
<version>1.1.7</version>
2222
<relativePath />
2323
</parent>
2424

@@ -73,51 +73,51 @@
7373
<!--Dependency versions-->
7474
<akka.version>2.5.13</akka.version>
7575
<akka.http.version>10.1.3</akka.http.version>
76-
<apache.httpclient.version>4.5.1</apache.httpclient.version>
77-
<apache.httpcore.version>4.4.3</apache.httpcore.version>
78-
<arpnetworking.commons.version>1.16.0</arpnetworking.commons.version>
79-
<aspectjrt.version>1.8.9</aspectjrt.version>
80-
<asynchttpclient.version>2.4.8</asynchttpclient.version>
81-
<cglib.version>3.2.5</cglib.version>
76+
<apache.httpclient.version>4.5.5</apache.httpclient.version>
77+
<apache.httpcore.version>4.4.9</apache.httpcore.version>
78+
<arpnetworking.commons.version>1.16.1</arpnetworking.commons.version>
79+
<aspectjrt.version>1.9.1</aspectjrt.version>
80+
<asynchttpclient.version>2.4.9</asynchttpclient.version>
81+
<cglib.version>3.2.6</cglib.version>
8282
<client.protocol.version>0.10.0</client.protocol.version>
83-
<fastutil.version>8.1.1</fastutil.version>
83+
<fastutil.version>8.2.1</fastutil.version>
8484
<findbugs.annotations.version>3.0.1</findbugs.annotations.version>
85-
<guava.version>23.4-jre</guava.version>
86-
<guice.version>4.1.0</guice.version>
87-
<jackson.version>2.9.2</jackson.version>
85+
<guava.version>25.1-jre</guava.version>
86+
<guice.version>4.2.0</guice.version>
87+
<jackson.version>2.9.6</jackson.version>
8888
<javassist.version>3.22.0-GA</javassist.version>
8989
<javassist.maven.core.version>0.2.1</javassist.maven.core.version>
9090
<jsr305.version>3.0.2</jsr305.version>
9191
<logback.version>1.2.3</logback.version>
92-
<logback.steno.version>1.18.0</logback.steno.version>
92+
<logback.steno.version>1.18.1</logback.steno.version>
9393
<log4j.over.slf4j.version>1.7.12</log4j.over.slf4j.version>
94-
<metrics.aggregator.protocol.version>1.0.3</metrics.aggregator.protocol.version>
94+
<metrics.aggregator.protocol.version>1.0.5</metrics.aggregator.protocol.version>
9595
<metrics.client.version>0.10.0</metrics.client.version>
9696
<metrics.client.http.version>0.9.1</metrics.client.http.version>
97-
<metrics.client.incubator.version>0.6.0</metrics.client.incubator.version>
98-
<metrics.jvm.extra.version>0.9.0</metrics.jvm.extra.version>
97+
<metrics.client.incubator.version>0.6.2</metrics.client.incubator.version>
98+
<metrics.jvm.extra.version>0.10.0</metrics.jvm.extra.version>
9999
<oval.version>1.90</oval.version>
100-
<protobuf.version>3.4.0</protobuf.version>
100+
<protobuf.version>3.6.0</protobuf.version>
101101
<reflections.version>0.9.11</reflections.version>
102102
<scala.version>2.11</scala.version>
103103
<scala.library.version>2.11.7</scala.library.version>
104104
<slf4j.version>1.7.25</slf4j.version>
105-
<typesafe.config.version>1.3.1</typesafe.config.version>
105+
<typesafe.config.version>1.3.3</typesafe.config.version>
106106
<vertx.core.version>2.1.6</vertx.core.version>
107107

108108
<!--Test dependency versions-->
109-
<commons.math3.version>3.3</commons.math3.version>
109+
<commons.math3.version>3.6.1</commons.math3.version>
110110
<hamcrest.version>2.0.0.0</hamcrest.version>
111111
<junit.benchmarks.version>0.7.2</junit.benchmarks.version>
112112
<junit.version>4.12</junit.version>
113-
<metrics.generator.version>1.2.1</metrics.generator.version>
114-
<mockito.version>2.12.0</mockito.version>
113+
<metrics.generator.version>1.2.2</metrics.generator.version>
114+
<mockito.version>2.19.0</mockito.version>
115115
<performance.test.version>1.1.0</performance.test.version>
116-
<statsd.client.timgroup>3.0.1</statsd.client.timgroup>
117-
<wiremock.version>1.57</wiremock.version>
116+
<statsd.client.timgroup>3.1.0</statsd.client.timgroup>
117+
<wiremock.version>2.18.0</wiremock.version>
118118

119119
<!-- Additional Plugins -->
120-
<aspectjtools.maven.plugin>1.8.9</aspectjtools.maven.plugin>
120+
<aspectjtools.maven.plugin>1.9.1</aspectjtools.maven.plugin>
121121
<aspectj.maven.plugin.version>1.8</aspectj.maven.plugin.version>
122122
<docker.maven.plugin.version>0.26.0</docker.maven.plugin.version>
123123
<javassist.maven.plugin.version>0.1.2</javassist.maven.plugin.version>
@@ -458,13 +458,6 @@
458458
<artifactId>guava</artifactId>
459459
<version>${guava.version}</version>
460460
</dependency>
461-
<dependency>
462-
<!-- Temporary: see https://github.com/google/guava/issues/2721 -->
463-
<groupId>com.google.errorprone</groupId>
464-
<artifactId>error_prone_annotations</artifactId>
465-
<version>2.0.15</version>
466-
<scope>provided</scope>
467-
</dependency>
468461
<dependency>
469462
<groupId>com.google.inject</groupId>
470463
<artifactId>guice</artifactId>

src/main/java/com/arpnetworking/configuration/jackson/JsonNodeDirectorySource.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.arpnetworking.steno.Logger;
2121
import com.arpnetworking.steno.LoggerFactory;
2222
import com.fasterxml.jackson.databind.JsonNode;
23-
import com.google.common.base.MoreObjects;
2423
import com.google.common.collect.Lists;
2524
import com.google.common.collect.Sets;
2625
import net.sf.oval.constraint.NotNull;
@@ -33,7 +32,7 @@
3332
import java.util.regex.Pattern;
3433

3534
/**
36-
* <code>JsonNode</code> based configuration sourced from a directory. This
35+
* {@code JsonNode} based configuration sourced from a directory. This
3736
* is intended to monitor the files in a single directory and is not designed
3837
* to monitor a directory tree (e.g. it is not recursive).
3938
*
@@ -89,7 +88,7 @@ private JsonNodeDirectorySource(final Builder builder) {
8988

9089
// Process all matching files
9190
if (_directory.exists() && _directory.isDirectory() && _directory.canRead()) {
92-
for (final File file : MoreObjects.firstNonNull(_directory.listFiles(), EMPTY_FILE_ARRAY)) {
91+
for (final File file : Optional.ofNullable(_directory.listFiles()).orElse(EMPTY_FILE_ARRAY)) {
9392
if (isFileMonitored(file)) {
9493
LOGGER.debug()
9594
.setMessage("Loading configuration file")
@@ -113,7 +112,7 @@ private JsonNodeDirectorySource(final Builder builder) {
113112
private static final Logger LOGGER = LoggerFactory.getLogger(JsonNodeDirectorySource.class);
114113

115114
/**
116-
* Builder for <code>JsonNodeDirectorySource</code>.
115+
* Builder for {@link JsonNodeDirectorySource}.
117116
*/
118117
public static final class Builder extends BaseJsonNodeSource.Builder<Builder, JsonNodeDirectorySource> {
119118

@@ -128,22 +127,22 @@ public Builder() {
128127
* Set the directory.
129128
*
130129
* @param value The directory.
131-
* @return This <code>Builder</code> instance.
130+
* @return This {@link Builder} instance.
132131
*/
133132
public Builder setDirectory(final File value) {
134133
_directory = value;
135134
return this;
136135
}
137136

138137
/**
139-
* Set the <code>Collection</code> of file names. Optional. Default is
138+
* Set the {@code Collection} of file names. Optional. Default is
140139
* an empty list (e.g. all files). Cannot be null.
141140
*
142141
* <b>Note:</b> Both the file names and file name patterns must be
143142
* empty (e.g. unset) in order to consider all files in the directory.
144143
*
145-
* @param value The <code>Collection</code> of file names.
146-
* @return This <code>Builder</code> instance.
144+
* @param value The {@code Collection} of file names.
145+
* @return This {@link Builder} instance.
147146
*/
148147
public Builder setFileNames(final Collection<String> value) {
149148
_fileNames = Lists.newArrayList(value);
@@ -154,7 +153,7 @@ public Builder setFileNames(final Collection<String> value) {
154153
* Add a file name.
155154
*
156155
* @param value The file name.
157-
* @return This <code>Builder</code> instance.
156+
* @return This {@link Builder} instance.
158157
*/
159158
public Builder addFileName(final String value) {
160159
if (_fileNames == null) {
@@ -166,14 +165,14 @@ public Builder addFileName(final String value) {
166165
}
167166

168167
/**
169-
* Set the <code>Collection</code> of file name patterns. Optional.
168+
* Set the {@code Collection} of file name patterns. Optional.
170169
* Default is an empty list (e.g. all files). Cannot be null.
171170
*
172171
* <b>Note:</b> Both the file names and file name patterns must be
173172
* empty (e.g. unset) in order to consider all files in the directory.
174173
*
175-
* @param value The <code>Collection</code> of file name patterns.
176-
* @return This <code>Builder</code> instance.
174+
* @param value The {@code Collection} of file name patterns.
175+
* @return This {@link Builder} instance.
177176
*/
178177
public Builder setFileNamePatterns(final Collection<Pattern> value) {
179178
_fileNamePatterns = Lists.newArrayList(value);
@@ -184,7 +183,7 @@ public Builder setFileNamePatterns(final Collection<Pattern> value) {
184183
* Add a file name pattern.
185184
*
186185
* @param value The file name pattern.
187-
* @return This <code>Builder</code> instance.
186+
* @return This {@link Builder} instance.
188187
*/
189188
public Builder addFileNamePattern(final Pattern value) {
190189
if (_fileNamePatterns == null) {

src/main/java/com/arpnetworking/configuration/triggers/DirectoryTrigger.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import com.arpnetworking.steno.LogValueMapFactory;
2222
import com.arpnetworking.steno.Logger;
2323
import com.arpnetworking.steno.LoggerFactory;
24-
import com.google.common.base.MoreObjects;
2524
import com.google.common.collect.Lists;
2625
import com.google.common.collect.Maps;
2726
import com.google.common.collect.Sets;
@@ -36,9 +35,9 @@
3635
import java.util.regex.Pattern;
3736

3837
/**
39-
* <code>Trigger</code> implementation based on the contents of a directory.
38+
* ${link Trigger} implementation based on the contents of a directory.
4039
* Configurable to either monitor all content or only specific content. The
41-
* <code>FileTrigger</code> is used to determine whether a file changed. This
40+
* ${link FileTrigger} is used to determine whether a file changed. This
4241
* is intended to monitor the files in a single directory and is not designed
4342
* to monitor a directory tree (e.g. it is not recursive).
4443
*
@@ -56,7 +55,7 @@ public boolean evaluateAndReset() {
5655

5756
// Track directory contents
5857
if (exists) {
59-
for (final File file : MoreObjects.firstNonNull(_directory.listFiles(), EMPTY_FILE_ARRAY)) {
58+
for (final File file :Optional.ofNullable(_directory.listFiles()).orElse(EMPTY_FILE_ARRAY)) {
6059
// Note: To save memory in cases where a directory contains
6160
// temporary files (e.g. create, destroy and never recreate)
6261
// we should remove any triggers for files that no longer exist
@@ -170,7 +169,7 @@ private DirectoryTrigger(final Builder builder) {
170169
private static final Logger LOGGER = LoggerFactory.getLogger(DirectoryTrigger.class);
171170

172171
/**
173-
* Builder for <code>DirectoryTrigger</code>.
172+
* Builder for {@link DirectoryTrigger}.
174173
*/
175174
public static final class Builder extends OvalBuilder<DirectoryTrigger> {
176175

@@ -185,22 +184,22 @@ public Builder() {
185184
* Set the directory.
186185
*
187186
* @param value The directory.
188-
* @return This <code>Builder</code> instance.
187+
* @return This {@link Builder} instance.
189188
*/
190189
public Builder setDirectory(final File value) {
191190
_directory = value;
192191
return this;
193192
}
194193

195194
/**
196-
* Set the <code>Collection</code> of file names. Optional. Default is
195+
* Set the {@code Collection} of file names. Optional. Default is
197196
* an empty list (e.g. all files). Cannot be null.
198197
*
199198
* <b>Note:</b> Both the file names and file name patterns must be
200199
* empty (e.g. unset) in order to consider all files in the directory.
201200
*
202-
* @param value The <code>Collection</code> of file names.
203-
* @return This <code>Builder</code> instance.
201+
* @param value The {@code Collection} of file names.
202+
* @return This {@link Builder} instance.
204203
*/
205204
public Builder setFileNames(final Collection<String> value) {
206205
_fileNames = Lists.newArrayList(value);
@@ -211,7 +210,7 @@ public Builder setFileNames(final Collection<String> value) {
211210
* Add a file name.
212211
*
213212
* @param value The file name.
214-
* @return This <code>Builder</code> instance.
213+
* @return This {@link Builder} instance.
215214
*/
216215
public Builder addFileName(final String value) {
217216
if (_fileNames == null) {
@@ -223,14 +222,14 @@ public Builder addFileName(final String value) {
223222
}
224223

225224
/**
226-
* Set the <code>Collection</code> of file name patterns. Optional.
225+
* Set the {@code Collection} of file name patterns. Optional.
227226
* Default is an empty list (e.g. all files). Cannot be null.
228227
*
229228
* <b>Note:</b> Both the file names and file name patterns must be
230229
* empty (e.g. unset) in order to consider all files in the directory.
231230
*
232-
* @param value The <code>Collection</code> of file name patterns.
233-
* @return This <code>Builder</code> instance.
231+
* @param value The {@code Collection} of file name patterns.
232+
* @return This {@link Builder} instance.
234233
*/
235234
public Builder setFileNamePatterns(final Collection<Pattern> value) {
236235
_fileNamePatterns = Lists.newArrayList(value);
@@ -241,7 +240,7 @@ public Builder setFileNamePatterns(final Collection<Pattern> value) {
241240
* Add a file name pattern.
242241
*
243242
* @param value The file name pattern.
244-
* @return This <code>Builder</code> instance.
243+
* @return This {@link Builder} instance.
245244
*/
246245
public Builder addFileNamePattern(final Pattern value) {
247246
if (_fileNamePatterns == null) {

src/main/java/com/arpnetworking/metrics/mad/Main.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
import com.arpnetworking.utility.Configurator;
5252
import com.arpnetworking.utility.Launchable;
5353
import com.fasterxml.jackson.databind.ObjectMapper;
54-
import com.google.common.base.MoreObjects;
5554
import com.google.common.collect.ImmutableList;
5655
import com.google.common.collect.Maps;
5756
import com.google.common.collect.Sets;
@@ -139,7 +138,7 @@ public static void main(final String[] args) {
139138
.addListener(configurator.get())
140139
.build());
141140

142-
configuration.get().launch();
141+
configuration.ifPresent(DynamicConfiguration::launch);
143142
// Wait for application shutdown
144143
SHUTDOWN_SEMAPHORE.acquire();
145144
} catch (final InterruptedException e) {
@@ -155,7 +154,7 @@ public static void main(final String[] args) {
155154
/**
156155
* Public constructor.
157156
*
158-
* @param configuration Instance of <code>TsdAggregatorConfiguration</code>.
157+
* @param configuration Instance of {@link AggregatorConfiguration}.
159158
*/
160159
public Main(final AggregatorConfiguration configuration) {
161160
_configuration = configuration;
@@ -214,9 +213,8 @@ private void launchActors(final Injector injector) {
214213

215214
// Load supplemental routes
216215
final ImmutableList.Builder<SupplementalRoutes> supplementalHttpRoutes = ImmutableList.builder();
217-
_configuration.getSupplementalHttpRoutesClass().ifPresent(clazz -> {
218-
supplementalHttpRoutes.add(injector.getInstance(clazz));
219-
});
216+
_configuration.getSupplementalHttpRoutesClass().ifPresent(
217+
clazz -> supplementalHttpRoutes.add(injector.getInstance(clazz)));
220218

221219
// Create and bind Http server
222220
final Materializer materializer = ActorMaterializer.create(actorSystem);
@@ -379,7 +377,6 @@ public synchronized void shutdown() {
379377
_pipelinesExecutor = null;
380378

381379
_fileToPipelineLaunchables.keySet()
382-
.stream()
383380
.forEach(this::shutdownPipeline);
384381
_fileToPipelineLaunchables.clear();
385382
}
@@ -389,7 +386,7 @@ public void run() {
389386
final boolean exists = _directory.exists() && _directory.isDirectory();
390387
if (exists) {
391388
final Set<File> missingFiles = Sets.newHashSet(_fileToPipelineLaunchables.keySet());
392-
for (final File file : MoreObjects.firstNonNull(_directory.listFiles(), EMPTY_FILE_ARRAY)) {
389+
for (final File file : Optional.ofNullable(_directory.listFiles()).orElse(EMPTY_FILE_ARRAY)) {
393390
missingFiles.remove(file);
394391
if (!_fileToPipelineLaunchables.containsKey(file)) {
395392
launchPipeline(file);

src/main/java/com/arpnetworking/metrics/mad/parsers/GraphitePlaintextToRecordParser.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.google.common.collect.ImmutableList;
2929
import com.google.common.collect.ImmutableMap;
3030
import com.google.common.collect.Maps;
31+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
3132
import net.sf.oval.constraint.NotNull;
3233

3334
import java.nio.ByteBuffer;
@@ -139,6 +140,8 @@ public List<Record> parse(final ByteBuffer record) throws ParsingException {
139140
return recordListBuilder.build();
140141
}
141142

143+
@SuppressFBWarnings("NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE")
144+
// See: https://github.com/findbugsproject/findbugs/issues/79
142145
private String parseName(final ByteBuffer datagram, @Nullable final String name) throws ParsingException {
143146
if (Strings.isNullOrEmpty(name)) {
144147
throw new ParsingException("Name not found or empty", datagram.array());

src/main/java/com/arpnetworking/metrics/mad/parsers/JsonToRecordParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ private static ImmutableMap<String, String> extractLegacyDimensions(final Map<St
302302
* @return The existing <code>Unit</code> to which the <code>CompoundUnit</code> maps.
303303
*/
304304
@Nullable
305-
private static Unit getLegacyUnit(final CompositeUnit compositeUnit) {
305+
private static Unit getLegacyUnit(@Nullable final CompositeUnit compositeUnit) {
306306
return LEGACY_UNIT_MAP.getOrDefault(compositeUnit, null);
307307
}
308308

@@ -650,8 +650,8 @@ private JsonToRecordParser(final Builder builder) {
650650
private static Quantity version2gSampleToQuantity(final Version2g.Sample sample) {
651651
if (sample != null) {
652652
if (Double.isFinite(sample.getValue())) {
653-
final CompositeUnit sampleUnit = sample.getUnit2g() != null
654-
? Iterables.getFirst(sample.getUnit2g().getNumerators(), null)
653+
@Nullable final CompositeUnit sampleUnit = sample.getUnit2g() != null
654+
? sample.getUnit2g().getNumerators().stream().findFirst().orElse(null)
655655
: null;
656656

657657
return ThreadLocalBuilder.build(

0 commit comments

Comments
 (0)