You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pa...@apache.org on 2019/12/29 16:21:54 UTC

[camel] branch master updated (078d235 -> d0d2df5)

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

pascalschumacher pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 078d235  Fix "javadoc @param tags that do not match any parameters in the method" problems identified by lgtm.com.
     new 6287b6d  camel-aws-lambda: Close FileInputStreams in LambdaProducer#createFunction because com.amazonaws.util.IOUtils#toByteArray requires the client to close the InputStream.
     new d0d2df5  camel-google-bigquery: Close the FileInputStream in GoogleBigQueryConnectionFactory#createFromFile

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/camel/component/aws/lambda/LambdaProducer.java | 10 ++++++----
 .../google/bigquery/GoogleBigQueryConnectionFactory.java      | 11 ++++++-----
 2 files changed, 12 insertions(+), 9 deletions(-)


[camel] 02/02: camel-google-bigquery: Close the FileInputStream in GoogleBigQueryConnectionFactory#createFromFile

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pascalschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit d0d2df571400e87f130866c3eced085504b7e125
Author: Pascal Schumacher <pa...@gmx.net>
AuthorDate: Sun Dec 29 16:36:11 2019 +0100

    camel-google-bigquery: Close the FileInputStream in GoogleBigQueryConnectionFactory#createFromFile
---
 .../google/bigquery/GoogleBigQueryConnectionFactory.java      | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/components/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryConnectionFactory.java b/components/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryConnectionFactory.java
index 3c7db1d..5fc3536 100644
--- a/components/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryConnectionFactory.java
+++ b/components/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryConnectionFactory.java
@@ -113,14 +113,15 @@ public class GoogleBigQueryConnectionFactory {
     }
 
     private GoogleCredential createFromFile() throws Exception {
+        try (InputStream is = new FileInputStream(credentialsFileLocation)) {
+            GoogleCredential credential = GoogleCredential.fromStream(is);
 
-        GoogleCredential credential = GoogleCredential.fromStream(new FileInputStream(credentialsFileLocation));
+            if (credential.createScopedRequired()) {
+                credential = credential.createScoped(BigqueryScopes.all());
+            }
 
-        if (credential.createScopedRequired()) {
-            credential = credential.createScoped(BigqueryScopes.all());
+            return credential;
         }
-
-        return credential;
     }
 
     private GoogleCredential createDefault() throws Exception {


[camel] 01/02: camel-aws-lambda: Close FileInputStreams in LambdaProducer#createFunction because com.amazonaws.util.IOUtils#toByteArray requires the client to close the InputStream.

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pascalschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 6287b6d1c60f0cc281fbdd642788a09a4443400e
Author: Pascal Schumacher <pa...@gmx.net>
AuthorDate: Sun Dec 29 16:35:18 2019 +0100

    camel-aws-lambda: Close FileInputStreams in LambdaProducer#createFunction because com.amazonaws.util.IOUtils#toByteArray requires the client to close the InputStream.
---
 .../org/apache/camel/component/aws/lambda/LambdaProducer.java  | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/components/camel-aws-lambda/src/main/java/org/apache/camel/component/aws/lambda/LambdaProducer.java b/components/camel-aws-lambda/src/main/java/org/apache/camel/component/aws/lambda/LambdaProducer.java
index d71cd9a..ed90cf1 100644
--- a/components/camel-aws-lambda/src/main/java/org/apache/camel/component/aws/lambda/LambdaProducer.java
+++ b/components/camel-aws-lambda/src/main/java/org/apache/camel/component/aws/lambda/LambdaProducer.java
@@ -202,8 +202,9 @@ public class LambdaProducer extends DefaultProducer {
             if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(LambdaConstants.ZIP_FILE))) {
                 String zipFile = exchange.getIn().getHeader(LambdaConstants.ZIP_FILE, String.class);
                 File fileLocalPath = new File(zipFile);
-                FileInputStream inputStream = new FileInputStream(fileLocalPath);
-                functionCode.withZipFile(ByteBuffer.wrap(IOUtils.toByteArray(inputStream)));
+                try (FileInputStream inputStream = new FileInputStream(fileLocalPath)) {
+                    functionCode.withZipFile(ByteBuffer.wrap(IOUtils.toByteArray(inputStream)));
+                }
             }
             if (ObjectHelper.isNotEmpty(exchange.getIn().getBody())) {
                 functionCode.withZipFile(exchange.getIn().getBody(ByteBuffer.class));
@@ -337,8 +338,9 @@ public class LambdaProducer extends DefaultProducer {
             if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(LambdaConstants.ZIP_FILE))) {
                 String zipFile = exchange.getIn().getHeader(LambdaConstants.ZIP_FILE, String.class);
                 File fileLocalPath = new File(zipFile);
-                FileInputStream inputStream = new FileInputStream(fileLocalPath);
-                functionCode.withZipFile(ByteBuffer.wrap(IOUtils.toByteArray(inputStream)));
+                try (FileInputStream inputStream = new FileInputStream(fileLocalPath)) {
+                    functionCode.withZipFile(ByteBuffer.wrap(IOUtils.toByteArray(inputStream)));
+                }
             }
             if (ObjectHelper.isNotEmpty(exchange.getIn().getBody())) {
                 functionCode.withZipFile(exchange.getIn().getBody(ByteBuffer.class));