You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by ki...@apache.org on 2022/01/06 01:55:11 UTC

[incubator-seatunnel] branch dev updated: Use collection methods instead (#951)

This is an automated email from the ASF dual-hosted git repository.

kirs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new e093e0a  Use collection methods instead (#951)
e093e0a is described below

commit e093e0a3d3eb4e2a2442ade239734528e1230e83
Author: Benedict Jin <as...@apache.org>
AuthorDate: Thu Jan 6 09:55:02 2022 +0800

    Use collection methods instead (#951)
---
 .../java/org/apache/seatunnel/flink/sink/JsonRowOutputFormat.java   | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/seatunnel-connectors/seatunnel-connector-flink-file/src/main/java/org/apache/seatunnel/flink/sink/JsonRowOutputFormat.java b/seatunnel-connectors/seatunnel-connector-flink-file/src/main/java/org/apache/seatunnel/flink/sink/JsonRowOutputFormat.java
index ae3248c..99a68a8 100644
--- a/seatunnel-connectors/seatunnel-connector-flink-file/src/main/java/org/apache/seatunnel/flink/sink/JsonRowOutputFormat.java
+++ b/seatunnel-connectors/seatunnel-connector-flink-file/src/main/java/org/apache/seatunnel/flink/sink/JsonRowOutputFormat.java
@@ -30,6 +30,7 @@ import java.io.IOException;
 import java.nio.charset.Charset;
 import java.nio.charset.IllegalCharsetNameException;
 import java.nio.charset.UnsupportedCharsetException;
+import java.util.Arrays;
 
 public class JsonRowOutputFormat extends FileOutputFormat<Row> {
 
@@ -109,10 +110,7 @@ public class JsonRowOutputFormat extends FileOutputFormat<Row> {
                         jsonArray.add(getJson(r, (RowTypeInfo) componentInfo));
                     }
                 } else {
-                    final Object[] objects = (Object[]) field;
-                    for (Object o : objects) {
-                        jsonArray.add(o);
-                    }
+                    jsonArray.addAll(Arrays.asList((Object[]) field));
                 }
                 json.put(name, jsonArray);
             } else if (type instanceof RowTypeInfo) {