[ 
https://issues.apache.org/jira/browse/BEAM-11327?focusedWorklogId=533766&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-533766
 ]

ASF GitHub Bot logged work on BEAM-11327:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Jan/21 04:16
            Start Date: 10/Jan/21 04:16
    Worklog Time Spent: 10m 
      Work Description: omarismail94 commented on a change in pull request 
#13701:
URL: https://github.com/apache/beam/pull/13701#discussion_r554141396



##########
File path: 
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/logging/DataflowWorkerLoggingInitializer.java
##########
@@ -167,10 +168,10 @@ public static synchronized void initialize() {
       originalStdErr = System.err;
       System.setOut(
           JulHandlerPrintStreamAdapterFactory.create(
-              loggingHandler, SYSTEM_OUT_LOG_NAME, Level.INFO));
+              loggingHandler, SYSTEM_OUT_LOG_NAME, Level.INFO, 
StandardCharsets.UTF_8));
       System.setErr(
           JulHandlerPrintStreamAdapterFactory.create(
-              loggingHandler, SYSTEM_ERR_LOG_NAME, Level.SEVERE));
+              loggingHandler, SYSTEM_ERR_LOG_NAME, Level.SEVERE, 
StandardCharsets.UTF_8));

Review comment:
       @TheNeuralBit  Fixed! And I left UTF_8 in the test case, which I think 
is correct. 
   
   Even though the `checkstyleMain.enabled` flag in the `build.gradle` file for 
the worker project is set to false, I added `ForbidDefaultCharset` to 
`SuppressWarning`. If `checkstyleMain.enabled` is set to true,  the test should 
still pass. I set the flag to true and I didn't see the warning. I also removed 
the suppression exception and the checkstyle was triggered for 
`defaultCharset()`

##########
File path: 
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/logging/DataflowWorkerLoggingInitializer.java
##########
@@ -167,10 +168,10 @@ public static synchronized void initialize() {
       originalStdErr = System.err;
       System.setOut(
           JulHandlerPrintStreamAdapterFactory.create(
-              loggingHandler, SYSTEM_OUT_LOG_NAME, Level.INFO));
+              loggingHandler, SYSTEM_OUT_LOG_NAME, Level.INFO, 
StandardCharsets.UTF_8));
       System.setErr(
           JulHandlerPrintStreamAdapterFactory.create(
-              loggingHandler, SYSTEM_ERR_LOG_NAME, Level.SEVERE));
+              loggingHandler, SYSTEM_ERR_LOG_NAME, Level.SEVERE, 
StandardCharsets.UTF_8));

Review comment:
       No problem -enjoy your weekend!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 533766)
    Time Spent: 8h 50m  (was: 8h 40m)

> Replace Charset.defaultCharset() with StandardCharsets.UTF_8
> ------------------------------------------------------------
>
>                 Key: BEAM-11327
>                 URL: https://issues.apache.org/jira/browse/BEAM-11327
>             Project: Beam
>          Issue Type: Bug
>          Components: test-failures
>            Reporter: Omar Ismail
>            Assignee: Omar Ismail
>            Priority: P2
>             Fix For: 2.28.0
>
>          Time Spent: 8h 50m
>  Remaining Estimate: 0h
>
> When running tests where `getBytes(Charset.defaultCharset())` is called, and 
> `locale` is not set to "UTF8", the test fails.
>  
> I am going to replace all mentions of `Charset.defaultCharset()` to 
> `StandardCharsets.UTF_8` so testing is not affected my computer settings.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to