You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uniffle.apache.org by "advancedxy (via GitHub)" <gi...@apache.org> on 2023/02/07 13:58:05 UTC

[GitHub] [incubator-uniffle] advancedxy opened a new issue, #559: [Improvement] refactor RssUtilsTest.setEnv by leverage EnvironmentVariables system stub

advancedxy opened a new issue, #559:
URL: https://github.com/apache/incubator-uniffle/issues/559

   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   
   
   ### Search before asking
   
   - [X] I have searched in the [issues](https://github.com/apache/incubator-uniffle/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### What would you like to be improved?
   
   Currently `setEnv` is defined as below
   ```
     @SuppressWarnings("unchecked")
     public static void setEnv(String key, String value) {
       try {
         Map<String, String> env = System.getenv();
         Class<?> cl = env.getClass();
         Field field = cl.getDeclaredField("m");
         field.setAccessible(true);
         Map<String, String> writableEnv = (Map<String, String>) field.get(env);
         if (value != null) {
           writableEnv.put(key, value);
         } else {
           writableEnv.remove(key);
         }
       } catch (Exception e) {
         throw new IllegalStateException("Failed to set environment variable", e);
       }
     }
   ```
   
   which is not idiomatic Java. We should use https://www.baeldung.com/java-system-stubs#3-junit-5-environment-variables instead.
   
   ### How should we improve?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@uniffle.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-uniffle] advancedxy closed issue #559: [Improvement] refactor RssUtilsTest.setEnv by leverage EnvironmentVariables system stub

Posted by "advancedxy (via GitHub)" <gi...@apache.org>.
advancedxy closed issue #559: [Improvement] refactor RssUtilsTest.setEnv by leverage EnvironmentVariables system stub
URL: https://github.com/apache/incubator-uniffle/issues/559


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org