Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<bouncy.castle.version>1.80</bouncy.castle.version>
<client.protocol.version>0.12.0</client.protocol.version>
<fastutil.version>8.5.15</fastutil.version>
<guava.version>33.3.1-jre</guava.version>
<guava.version>33.4.8-jre</guava.version>
<guice.version>7.0.0</guice.version>
<jackson.version>2.18.3</jackson.version>
<javassist.version>3.30.2-GA</javassist.version>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/arpnetworking/http/Routes.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.arpnetworking.steno.LogBuilder;
import com.arpnetworking.steno.Logger;
import com.arpnetworking.steno.LoggerFactory;
import com.google.common.base.Charsets;
import com.google.common.base.Stopwatch;
import com.google.common.collect.ImmutableList;
import com.google.common.io.Resources;
Expand Down Expand Up @@ -62,6 +61,7 @@
import org.apache.pekko.util.Timeout;

import java.io.Serial;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.Objects;
import java.util.Optional;
Expand Down Expand Up @@ -388,7 +388,7 @@ private String createMetricName(final HttpRequest request, final int responseSta
static {
String statusJson = "{}";
try {
statusJson = Resources.toString(Resources.getResource("status.json"), Charsets.UTF_8);
statusJson = Resources.toString(Resources.getResource("status.json"), StandardCharsets.UTF_8);
// CHECKSTYLE.OFF: IllegalCatch - Prevent program shutdown
} catch (final Exception e) {
// CHECKSTYLE.ON: IllegalCatch
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/arpnetworking/metrics/mad/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import com.arpnetworking.utility.Launchable;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
Expand Down Expand Up @@ -81,6 +80,7 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
Expand Down Expand Up @@ -290,7 +290,7 @@ private HttpsConnectionContext createHttpsContext() {
final PrivateKey privateKey;
try (PEMParser keyReader = new PEMParser(
new InputStreamReader(
new FileInputStream(_configuration.getHttpsKeyPath()), Charsets.UTF_8))) {
new FileInputStream(_configuration.getHttpsKeyPath()), StandardCharsets.UTF_8))) {
final Object keyObject = keyReader.readObject();

if (keyObject instanceof PrivateKeyInfo) {
Expand All @@ -309,7 +309,7 @@ private HttpsConnectionContext createHttpsContext() {
final X509Certificate cert;
try (PEMParser certReader = new PEMParser(
new InputStreamReader(
new FileInputStream(_configuration.getHttpsCertificatePath()), Charsets.UTF_8))) {
new FileInputStream(_configuration.getHttpsCertificatePath()), StandardCharsets.UTF_8))) {
final PemObject certObject = certReader.readPemObject();
final CertificateFactory cf = CertificateFactory.getInstance("X.509");
cert = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(certObject.getContent()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.arpnetworking.metrics.mad.model.DefaultRecord;
import com.arpnetworking.metrics.mad.model.MetricType;
import com.arpnetworking.metrics.mad.model.Record;
import com.google.common.base.Charsets;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
Expand All @@ -33,6 +32,7 @@
import net.sf.oval.constraint.NotNull;

import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.text.NumberFormat;
import java.text.ParseException;
import java.time.Instant;
Expand Down Expand Up @@ -95,14 +95,14 @@ public final class GraphitePlaintextToRecordParser implements Parser<List<Record
*/
public List<Record> parse(final ByteBuffer record) throws ParsingException {
// CHECKSTYLE.OFF: IllegalInstantiation - This is the recommended way
final String line = new String(record.array(), Charsets.UTF_8);
final String line = new String(record.array(), StandardCharsets.UTF_8);
// CHECKSTYLE.ON: IllegalInstantiation

final ImmutableList.Builder<Record> recordListBuilder = ImmutableList.builder();
final ZonedDateTime now = ZonedDateTime.now();
final Matcher matcher = GRAPHITE_PATTERN.matcher(line);
if (!matcher.matches()) {
throw new ParsingException("Invalid graphite line", line.getBytes(Charsets.UTF_8));
throw new ParsingException("Invalid graphite line", line.getBytes(StandardCharsets.UTF_8));
}

// Annotations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.arpnetworking.metrics.mad.model.MetricType;
import com.arpnetworking.metrics.mad.model.Record;
import com.arpnetworking.metrics.mad.model.Unit;
import com.google.common.base.Charsets;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
Expand All @@ -34,6 +33,7 @@
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.text.NumberFormat;
import java.text.ParseException;
import java.time.Clock;
Expand Down Expand Up @@ -76,14 +76,14 @@ public final class StatsdToRecordParser implements Parser<List<Record>, ByteBuff
@Override
public List<Record> parse(final ByteBuffer datagram) throws ParsingException {
// CHECKSTYLE.OFF: IllegalInstantiation - This is the recommended way
final String datagramAsString = new String(datagram.array(), Charsets.UTF_8);
final String datagramAsString = new String(datagram.array(), StandardCharsets.UTF_8);
final ImmutableList.Builder<Record> recordListBuilder = ImmutableList.builder();
try {
for (final String line : LINE_SPLITTER.split(datagramAsString)) {
// CHECKSTYLE.ON: IllegalInstantiation
final Matcher matcher = STATSD_PATTERN.matcher(line);
if (!matcher.matches()) {
throw new ParsingException("Invalid statsd line", line.getBytes(Charsets.UTF_8));
throw new ParsingException("Invalid statsd line", line.getBytes(StandardCharsets.UTF_8));
}

// Parse the name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

import com.arpnetworking.logback.annotations.Loggable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.base.Charsets;
import com.google.common.base.MoreObjects;
import com.google.common.primitives.Bytes;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -68,7 +68,7 @@ public List<Byte> getLine() {
* @return The line data as a {@link String} interpreted as UTF-8.
*/
public String convertLineToString() {
return convertLineToString(Charsets.UTF_8);
return convertLineToString(StandardCharsets.UTF_8);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.arpnetworking.steno.LoggerFactory;
import com.arpnetworking.tsdcore.model.PeriodicData;
import com.arpnetworking.tsdcore.model.RequestEntry;
import com.google.common.base.Charsets;
import com.google.common.collect.EvictingQueue;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
Expand All @@ -37,6 +36,7 @@
import org.asynchttpclient.Response;
import scala.concurrent.duration.FiniteDuration;

import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.Instant;
import java.util.Collection;
Expand Down Expand Up @@ -233,7 +233,7 @@ private void processRejectedRequest(final PostRejected rejected) {
final Optional<String> responseBody = Optional.ofNullable(response.getResponseBody());
final byte[] requestBodyBytes = rejected.getRequest().getByteData();
// CHECKSTYLE.OFF: IllegalInstantiation - This is ok for String from byte[]
final String requestBody = requestBodyBytes == null ? null : new String(requestBodyBytes, Charsets.UTF_8);
final String requestBody = requestBodyBytes == null ? null : new String(requestBodyBytes, StandardCharsets.UTF_8);
// CHECKSTYLE.ON: IllegalInstantiation
LOGGER.warn()
.setMessage("Post rejected")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
package com.arpnetworking.configuration;

import com.arpnetworking.configuration.triggers.DirectoryTrigger;
import com.google.common.base.Charsets;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Optional;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -112,7 +112,7 @@ public void testDirectoryChangedFileCreated() throws IOException {
Assert.assertTrue(trigger.evaluateAndReset());
Assert.assertFalse(trigger.evaluateAndReset());

Files.write(directory.toPath().resolve("foo.txt"), "bar".getBytes(Charsets.UTF_8));
Files.write(directory.toPath().resolve("foo.txt"), "bar".getBytes(StandardCharsets.UTF_8));

Assert.assertTrue(trigger.evaluateAndReset());
}
Expand All @@ -134,7 +134,7 @@ public void testDirectoryChangedFileModified() throws IOException, InterruptedEx

// Ensure file system modified time reflects the change
Thread.sleep(1000);
Files.write(file.toPath(), "bar".getBytes(Charsets.UTF_8));
Files.write(file.toPath(), "bar".getBytes(StandardCharsets.UTF_8));

Assert.assertTrue(trigger.evaluateAndReset());
}
Expand All @@ -145,7 +145,7 @@ public void testDirectoryChangedFileDeleted() throws IOException {
deleteDirectory(directory);
Files.createDirectory(directory.toPath());
final File file = directory.toPath().resolve("foo.txt").toFile();
Files.write(file.toPath(), "bar".getBytes(Charsets.UTF_8));
Files.write(file.toPath(), "bar".getBytes(StandardCharsets.UTF_8));

final Trigger trigger = new DirectoryTrigger.Builder()
.setDirectory(directory)
Expand Down Expand Up @@ -173,10 +173,10 @@ public void testOnlyMatchedName() throws IOException {
Assert.assertTrue(trigger.evaluateAndReset());
Assert.assertFalse(trigger.evaluateAndReset());

Files.write(directory.toPath().resolve("foo.txt"), "bar".getBytes(Charsets.UTF_8));
Files.write(directory.toPath().resolve("foo.txt"), "bar".getBytes(StandardCharsets.UTF_8));
Assert.assertFalse(trigger.evaluateAndReset());

Files.write(directory.toPath().resolve("bar.txt"), "bar".getBytes(Charsets.UTF_8));
Files.write(directory.toPath().resolve("bar.txt"), "bar".getBytes(StandardCharsets.UTF_8));
Assert.assertTrue(trigger.evaluateAndReset());
}

Expand All @@ -194,10 +194,10 @@ public void testOnlyMatchedNamePattern() throws IOException {
Assert.assertTrue(trigger.evaluateAndReset());
Assert.assertFalse(trigger.evaluateAndReset());

Files.write(directory.toPath().resolve("foo.txt"), "bar".getBytes(Charsets.UTF_8));
Files.write(directory.toPath().resolve("foo.txt"), "bar".getBytes(StandardCharsets.UTF_8));
Assert.assertFalse(trigger.evaluateAndReset());

Files.write(directory.toPath().resolve("foo.json"), "bar".getBytes(Charsets.UTF_8));
Files.write(directory.toPath().resolve("foo.json"), "bar".getBytes(StandardCharsets.UTF_8));
Assert.assertTrue(trigger.evaluateAndReset());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
package com.arpnetworking.configuration;

import com.arpnetworking.configuration.triggers.FileTrigger;
import com.google.common.base.Charsets;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.attribute.FileTime;

Expand Down Expand Up @@ -116,7 +116,7 @@ public void testFileCreated() throws IOException {
public void testFileChanged() throws IOException, InterruptedException {
final File file = new File("./target/tmp/filter/FileTriggerTest/testFileChanged");
Files.deleteIfExists(file.toPath());
Files.write(file.toPath(), "foo".getBytes(Charsets.UTF_8));
Files.write(file.toPath(), "foo".getBytes(StandardCharsets.UTF_8));

final Trigger trigger = new FileTrigger.Builder()
.setFile(file)
Expand All @@ -127,7 +127,7 @@ public void testFileChanged() throws IOException, InterruptedException {

// Ensure file system modified time reflects the change
Thread.sleep(1000);
Files.write(file.toPath(), "bar".getBytes(Charsets.UTF_8));
Files.write(file.toPath(), "bar".getBytes(StandardCharsets.UTF_8));

Assert.assertTrue(trigger.evaluateAndReset());
}
Expand All @@ -136,7 +136,7 @@ public void testFileChanged() throws IOException, InterruptedException {
public void testFileChangedLastModifiedOnly() throws IOException {
final File file = new File("./target/tmp/filter/FileTriggerTest/testFileChangedLastModifiedOnly");
Files.deleteIfExists(file.toPath());
Files.write(file.toPath(), "foo".getBytes(Charsets.UTF_8));
Files.write(file.toPath(), "foo".getBytes(StandardCharsets.UTF_8));
Files.setLastModifiedTime(file.toPath(), FileTime.fromMillis(1418112007000L));

final Trigger trigger = new FileTrigger.Builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package com.arpnetworking.configuration.jackson;

import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableSet;
import com.typesafe.config.impl.ConfigImpl;
import org.junit.Assert;
Expand All @@ -24,6 +23,7 @@

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.attribute.PosixFilePermission;

Expand Down Expand Up @@ -54,7 +54,7 @@ public void testFileDoesNotExist() throws IOException {
@Test
public void testFileUnreadable() throws IOException {
final File file = new File("./target/tmp/filter/HoconFileSourceTest/testFileUnreadable.json");
Files.write(file.toPath(), "foo=\"bar\"".getBytes(Charsets.UTF_8));
Files.write(file.toPath(), "foo=\"bar\"".getBytes(StandardCharsets.UTF_8));
Files.setPosixFilePermissions(file.toPath(), ImmutableSet.of(PosixFilePermission.OWNER_WRITE));
final HoconFileSource source = new HoconFileSource.Builder()
.setFile(file)
Expand All @@ -65,7 +65,7 @@ public void testFileUnreadable() throws IOException {
@Test
public void testValidHocon() throws IOException {
final File file = new File("./target/tmp/filter/HoconFileSourceTest/testValidHocon.conf");
Files.write(file.toPath(), "foo:\"bar\"".getBytes(Charsets.UTF_8));
Files.write(file.toPath(), "foo:\"bar\"".getBytes(StandardCharsets.UTF_8));
final HoconFileSource source = new HoconFileSource.Builder()
.setFile(file)
.build();
Expand All @@ -77,7 +77,7 @@ public void testValidHocon() throws IOException {
@Test
public void testSystemPropertyDirect() throws IOException {
final File file = new File("./target/tmp/filter/HoconFileSourceTest/testSystemPropertyDirect.hocon");
Files.write(file.toPath(), "".getBytes(Charsets.UTF_8));
Files.write(file.toPath(), "".getBytes(StandardCharsets.UTF_8));
final HoconFileSource source = new HoconFileSource.Builder()
.setFile(file)
.build();
Expand All @@ -88,7 +88,7 @@ public void testSystemPropertyDirect() throws IOException {
@Test
public void testSystemPropertyReference() throws IOException {
final File file = new File("./target/tmp/filter/HoconFileSourceTest/testSystemPropertyReference.hocon");
Files.write(file.toPath(), "foo:${HoconFileSourceTest_testSystemPropertyReference_foo}".getBytes(Charsets.UTF_8));
Files.write(file.toPath(), "foo:${HoconFileSourceTest_testSystemPropertyReference_foo}".getBytes(StandardCharsets.UTF_8));
final HoconFileSource source = new HoconFileSource.Builder()
.setFile(file)
.build();
Expand All @@ -99,7 +99,7 @@ public void testSystemPropertyReference() throws IOException {
@Test(expected = RuntimeException.class)
public void testInvalidHocon() throws IOException {
final File file = new File("./target/tmp/filter/HoconFileSourceTest/testInvalidHocon.json");
Files.write(file.toPath(), "This=\"not-hocon".getBytes(Charsets.UTF_8));
Files.write(file.toPath(), "This=\"not-hocon".getBytes(StandardCharsets.UTF_8));
new HoconFileSource.Builder()
.setFile(file)
.build();
Expand Down
Loading