From dd6d7d7b6bc23c580755c5c7fd8e23ce56c67f06 Mon Sep 17 00:00:00 2001 From: abhinav-qlogic <48669998+abhinav-qlogic@users.noreply.github.com> Date: Mon, 8 Apr 2019 21:44:56 +0530 Subject: [PATCH] Bigquery : Fix close write channel (#4924) * close write channel * Update BigQuerySnippets.java * Update BigQuerySnippets.java * Update BigQuerySnippets.java --- .../cloud/examples/bigquery/snippets/BigQuerySnippets.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigquery/snippets/BigQuerySnippets.java b/google-cloud-examples/src/main/java/com/google/cloud/examples/bigquery/snippets/BigQuerySnippets.java index f0c91d62344c..0569b3ef82cf 100644 --- a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigquery/snippets/BigQuerySnippets.java +++ b/google-cloud-examples/src/main/java/com/google/cloud/examples/bigquery/snippets/BigQuerySnippets.java @@ -383,6 +383,8 @@ public long writeFileToTable(String datasetName, String tableName, Path csvPath, // Write data to writer try (OutputStream stream = Channels.newOutputStream(writer)) { Files.copy(csvPath, stream); + } finally { + writer.close(); } // Get load job Job job = writer.getJob();