gemini-code-assist[bot] commented on code in PR #39365:
URL: https://github.com/apache/beam/pull/39365#discussion_r3602755872


##########
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy:
##########
@@ -96,6 +96,17 @@ class BeamModulePlugin implements Plugin<Project> {
     }
   }
 
+  // Serializes pipeline options to JSON for the beamTestPipelineOptions 
system property.
+  // On Windows each option is wrapped in literal quotes so the JSON survives 
the quote
+  // stripping applied to the forked test JVM's command line.
+  // See https://github.com/apache/beam/issues/39332.
+  static def toBeamTestPipelineOptionsJson(def options) {
+    if (System.properties['os.name'].toLowerCase().contains('windows')) {
+      return JsonOutput.toJson(options.collect { "\"$it\"" })
+    }
+    return JsonOutput.toJson(options)
+  }

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   If `options` is null, calling `options.collect` will throw a 
`NullPointerException`. Adding a null check ensures the method is robust 
against null inputs.
   
   ```
     static def toBeamTestPipelineOptionsJson(def options) {
       if (options && 
System.properties['os.name'].toLowerCase().contains('windows')) {
         return JsonOutput.toJson(options.collect { "\"$it\"" })
       }
       return JsonOutput.toJson(options)
     }
   ```



-- 
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: [email protected]

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

Reply via email to