From 586d4c58c89c2bfcfc90bf49e79e56ec8f4fdbae Mon Sep 17 00:00:00 2001 From: Ben Creech Date: Fri, 9 Sep 2022 03:30:14 +0000 Subject: [PATCH] fix: Fix a couple linter issues on my stderr update --- .../java/com/google/cloud/logging/LoggingHandler.java | 6 +++--- .../com/google/cloud/logging/LoggingHandlerTest.java | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java index 8acad5a41..07f9fcd9e 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java @@ -453,9 +453,9 @@ public Boolean getAutoPopulateMetadata() { * the Json format that can be parsed by the logging agent. If set to {@code false}, logs will be * ingested to Cloud Logging by calling Logging API. * - *

This method is mutually exclusive with {@link #setLogTarget()}. + *

This method is mutually exclusive with {@link #setLogTarget(LogTarget)}. * - * @deprecated Use {@link #setLogTarget()}. + * @deprecated Use {@link #setLogTarget(LogTarget)}. */ @Deprecated public void setRedirectToStdout(boolean value) { @@ -475,7 +475,7 @@ public Boolean getRedirectToStdout() { * to the corresponding stream in the Json format that can be parsed by the logging agent. If set * to CLOUD_LOGGING, logs will be sent directly to the Google Cloud Logging API. * - *

This method is mutually exclusive with {@link #setRedirectToStdout()}. + *

This method is mutually exclusive with {@link #setRedirectToStdout(boolean)}. */ public void setLogTarget(LogTarget value) { this.logTarget = value; diff --git a/google-cloud-logging/src/test/java/com/google/cloud/logging/LoggingHandlerTest.java b/google-cloud-logging/src/test/java/com/google/cloud/logging/LoggingHandlerTest.java index a03ac04bf..502612c23 100644 --- a/google-cloud-logging/src/test/java/com/google/cloud/logging/LoggingHandlerTest.java +++ b/google-cloud-logging/src/test/java/com/google/cloud/logging/LoggingHandlerTest.java @@ -32,6 +32,7 @@ import com.google.gson.JsonParser; import java.io.ByteArrayOutputStream; import java.io.PrintStream; +import java.io.UnsupportedEncodingException; import java.util.logging.ErrorManager; import java.util.logging.Filter; import java.util.logging.Formatter; @@ -398,14 +399,15 @@ public void testEnhancedLogEntry() { handler.publish(newLogRecord(Level.FINEST, MESSAGE)); } - void validateJsonOutput(ByteArrayOutputStream bout) { + void validateJsonOutput(ByteArrayOutputStream bout) throws UnsupportedEncodingException { final String expectedOutput = "{\"severity\":\"INFO\",\"time\":\"1970-01-02T10:17:36.789Z\",\"logging.googleapis.com/labels\":{\"enhanced\":\"true\"},\"logging.googleapis.com/trace_sampled\":false,\"message\":\"message\"}"; - assertEquals(JsonParser.parseString(expectedOutput), JsonParser.parseString(bout.toString())); + assertEquals( + JsonParser.parseString(expectedOutput), JsonParser.parseString(bout.toString("UTF-8"))); } @Test - public void testEnhancedLogEntryPrintToStdout() { + public void testEnhancedLogEntryPrintToStdout() throws UnsupportedEncodingException { outputStreamPatcher.patch(); replay(options, logging); @@ -422,7 +424,7 @@ public void testEnhancedLogEntryPrintToStdout() { } @Test - public void testEnhancedLogEntryPrintToStderr() { + public void testEnhancedLogEntryPrintToStderr() throws UnsupportedEncodingException { outputStreamPatcher.patch(); replay(options, logging); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy