Skip to content

Commit fa1a18f

Browse files
bpcreechBen Creech
and
Ben Creech
authored
fix: Fix a couple linter issues on my stderr update (#1061)
Co-authored-by: Ben Creech <bpcreech@google.com>
1 parent bfef3d1 commit fa1a18f

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

‎google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,9 @@ public Boolean getAutoPopulateMetadata() {
453453
* the Json format that can be parsed by the logging agent. If set to {@code false}, logs will be
454454
* ingested to Cloud Logging by calling Logging API.
455455
*
456-
* <p>This method is mutually exclusive with {@link #setLogTarget()}.
456+
* <p>This method is mutually exclusive with {@link #setLogTarget(LogTarget)}.
457457
*
458-
* @deprecated Use {@link #setLogTarget()}.
458+
* @deprecated Use {@link #setLogTarget(LogTarget)}.
459459
*/
460460
@Deprecated
461461
public void setRedirectToStdout(boolean value) {
@@ -475,7 +475,7 @@ public Boolean getRedirectToStdout() {
475475
* to the corresponding stream in the Json format that can be parsed by the logging agent. If set
476476
* to CLOUD_LOGGING, logs will be sent directly to the Google Cloud Logging API.
477477
*
478-
* <p>This method is mutually exclusive with {@link #setRedirectToStdout()}.
478+
* <p>This method is mutually exclusive with {@link #setRedirectToStdout(boolean)}.
479479
*/
480480
public void setLogTarget(LogTarget value) {
481481
this.logTarget = value;

‎google-cloud-logging/src/test/java/com/google/cloud/logging/LoggingHandlerTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.google.gson.JsonParser;
3333
import java.io.ByteArrayOutputStream;
3434
import java.io.PrintStream;
35+
import java.io.UnsupportedEncodingException;
3536
import java.util.logging.ErrorManager;
3637
import java.util.logging.Filter;
3738
import java.util.logging.Formatter;
@@ -398,14 +399,15 @@ public void testEnhancedLogEntry() {
398399
handler.publish(newLogRecord(Level.FINEST, MESSAGE));
399400
}
400401

401-
void validateJsonOutput(ByteArrayOutputStream bout) {
402+
void validateJsonOutput(ByteArrayOutputStream bout) throws UnsupportedEncodingException {
402403
final String expectedOutput =
403404
"{\"severity\":\"INFO\",\"time\":\"1970-01-02T10:17:36.789Z\",\"logging.googleapis.com/labels\":{\"enhanced\":\"true\"},\"logging.googleapis.com/trace_sampled\":false,\"message\":\"message\"}";
404-
assertEquals(JsonParser.parseString(expectedOutput), JsonParser.parseString(bout.toString()));
405+
assertEquals(
406+
JsonParser.parseString(expectedOutput), JsonParser.parseString(bout.toString("UTF-8")));
405407
}
406408

407409
@Test
408-
public void testEnhancedLogEntryPrintToStdout() {
410+
public void testEnhancedLogEntryPrintToStdout() throws UnsupportedEncodingException {
409411
outputStreamPatcher.patch();
410412

411413
replay(options, logging);
@@ -422,7 +424,7 @@ public void testEnhancedLogEntryPrintToStdout() {
422424
}
423425

424426
@Test
425-
public void testEnhancedLogEntryPrintToStderr() {
427+
public void testEnhancedLogEntryPrintToStderr() throws UnsupportedEncodingException {
426428
outputStreamPatcher.patch();
427429

428430
replay(options, logging);

0 commit comments

Comments
 (0)