Skip to content

Commit

Permalink
Merge pull request #189 from basil/charsets
Browse files Browse the repository at this point in the history
Use `java.nio.charset.StandardCharsets` where possible
  • Loading branch information
bitwiseman authored Jul 23, 2021
2 parents 852e1bd + 25673b8 commit 07dd67f
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
import javax.annotation.Nonnull;
import javax.servlet.ServletException;
import net.jcip.annotations.GuardedBy;
import org.apache.commons.io.Charsets;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.jelly.XMLOutput;
Expand Down Expand Up @@ -152,7 +152,7 @@ public void run() {
} else {
os = new FileOutputStream(logFile);
}
listener = new StreamBuildListener(os, Charsets.UTF_8);
listener = new StreamBuildListener(os, StandardCharsets.UTF_8);
} catch (IOException x) {
LOGGER.log(Level.WARNING, null, x);
result = Result.FAILURE;
Expand Down Expand Up @@ -258,7 +258,7 @@ public boolean canWriteNow() {
BACKUP_LOG_COUNT == null ? 0 : Math.max(0, BACKUP_LOG_COUNT)
);
}
return new StreamTaskListener(eventStreams.get(), Charsets.UTF_8);
return new StreamTaskListener(eventStreams.get(), StandardCharsets.UTF_8);
}

@Nonnull
Expand Down Expand Up @@ -324,7 +324,7 @@ public boolean isLogUpdated() {

@Nonnull
public AnnotatedLargeText<FolderComputation<I>> getLogText() {
return new AnnotatedLargeText<FolderComputation<I>>(getLogFile(), Charsets.UTF_8, !isLogUpdated(), this);
return new AnnotatedLargeText<FolderComputation<I>>(getLogFile(), StandardCharsets.UTF_8, !isLogUpdated(), this);
}

@Nonnull
Expand All @@ -335,14 +335,14 @@ public AnnotatedLargeText<FolderComputation<I>> getEventsText() {
try {
buffer.write(
String.format("No events as of %tc, waiting for events...%n", new Date())
.getBytes(Charsets.UTF_8)
.getBytes(StandardCharsets.UTF_8)
);
return new AnnotatedLargeText<FolderComputation<I>>(buffer, Charsets.UTF_8, false, this);
return new AnnotatedLargeText<FolderComputation<I>>(buffer, StandardCharsets.UTF_8, false, this);
} catch (IOException e) {
// ignore and fall through
}
}
return new AnnotatedLargeText<FolderComputation<I>>(eventsFile, Charsets.UTF_8, false, this);
return new AnnotatedLargeText<FolderComputation<I>>(eventsFile, StandardCharsets.UTF_8, false, this);
}

@SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED", justification = "Only one page is ever written here")
Expand Down Expand Up @@ -418,7 +418,7 @@ public InputStream getLogInputStream() throws IOException {
}

String message = "No such file: " + logFile;
return new ByteArrayInputStream(message.getBytes(Charsets.UTF_8));
return new ByteArrayInputStream(message.getBytes(StandardCharsets.UTF_8));
}

@CheckForNull
Expand Down

0 comments on commit 07dd67f

Please sign in to comment.