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

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


The following commit(s) were added to refs/heads/master by this push:
     new bdc882a  Switch to using nio Files.createTempFile
bdc882a is described below

commit bdc882a2031df73fdf48d5c22ff8c0014ceec82d
Author: Colm O hEigeartaigh <cohei...@apache.org>
AuthorDate: Thu Jun 20 20:28:01 2019 +0100

    Switch to using nio Files.createTempFile
---
 .../org/apache/camel/component/bonita/api/util/BonitaAPIUtil.java   | 3 ++-
 components/camel-cm-sms/src/main/docs/cm-sms-component.adoc         | 6 +++---
 .../main/java/org/apache/camel/component/hdfs2/HdfsFileType.java    | 3 ++-
 .../java/org/apache/camel/component/jetty/CamelFilterWrapper.java   | 3 ++-
 .../camel/processor/aggregate/tarfile/TarAggregationStrategy.java   | 5 +++--
 .../org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java  | 3 ++-
 .../camel/processor/aggregate/zipfile/ZipAggregationStrategy.java   | 5 +++--
 core/camel-util/src/main/java/org/apache/camel/util/FileUtil.java   | 2 +-
 8 files changed, 18 insertions(+), 12 deletions(-)

diff --git 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/util/BonitaAPIUtil.java
 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/util/BonitaAPIUtil.java
index 775ce94..af8ab3b 100644
--- 
a/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/util/BonitaAPIUtil.java
+++ 
b/components/camel-bonita/src/main/java/org/apache/camel/component/bonita/api/util/BonitaAPIUtil.java
@@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.Serializable;
+import java.nio.file.Files;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -67,7 +68,7 @@ public class BonitaAPIUtil {
             .resolveTemplate("processName", processDefinition.getName())
             .resolveTemplate("processVersion", processDefinition.getVersion());
 
-        File tempFile = File.createTempFile("tempFile", ".tmp");
+        File tempFile = Files.createTempFile("tempFile", ".tmp").toFile();
         FileOutputStream fos = new FileOutputStream(tempFile);
         fos.write(file.getContent());
         fos.close();
diff --git a/components/camel-cm-sms/src/main/docs/cm-sms-component.adoc 
b/components/camel-cm-sms/src/main/docs/cm-sms-component.adoc
index 4470bc5..d40ba67 100644
--- a/components/camel-cm-sms/src/main/docs/cm-sms-component.adoc
+++ b/components/camel-cm-sms/src/main/docs/cm-sms-component.adoc
@@ -71,10 +71,10 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *defaultFrom* (producer) | This is the sender name. The maximum length is 11 
characters. |  | String
-| *defaultMaxNumberOfParts* (producer) | If it is a multipart message forces 
the max number. Message can be truncated. Technically the gateway will first 
check if a message is larger than 160 characters, if so, the message will be 
cut into multiple 153 characters parts limited by these parameters. | 8 | 
Max(8L)Int
+| *defaultFrom* (producer) | This is the sender name. The maximum length is 11 
characters. |  | String)
+| *defaultMaxNumberOfParts* (producer) | If it is a multipart message forces 
the max number. Message can be truncated. Technically the gateway will first 
check if a message is larger than 160 characters, if so, the message will be 
cut into multiple 153 characters parts limited by these parameters. | 8 | 
Max(8L)::Int)
 | *lazyStartProducer* (producer) | Whether the producer should be started lazy 
(on the first message). By starting lazy you can use this to allow CamelContext 
and routes to startup in situations where a producer may otherwise fail during 
starting and cause the route to fail being started. By deferring this startup 
to be lazy then the startup failure can be handled during routing messages via 
Camel's routing error handlers. Beware that when the first message is processed 
then creating and [...]
-| *productToken* (producer) | *Required* The unique token to use |  | String
+| *productToken* (producer) | *Required* The unique token to use |  | String)
 | *testConnectionOnStartup* (producer) | Whether to test the connection to the 
SMS Gateway on startup | false | boolean
 | *basicPropertyBinding* (advanced) | Whether the endpoint should use basic 
property binding (Camel 2.x) or the newer property binding with additional 
capabilities | false | boolean
 | *synchronous* (advanced) | Sets whether synchronous processing should be 
strictly used, or Camel is allowed to use asynchronous processing (if 
supported). | false | boolean
diff --git 
a/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsFileType.java
 
b/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsFileType.java
index 392ae36..a797f87 100644
--- 
a/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsFileType.java
+++ 
b/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsFileType.java
@@ -25,6 +25,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintStream;
 import java.nio.ByteBuffer;
+import java.nio.file.Files;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -139,7 +140,7 @@ public enum HdfsFileType {
             try {
                 String fname = hdfsPath.substring(hdfsPath.lastIndexOf('/'));
 
-                File outputDest = File.createTempFile(fname, ".hdfs");
+                File outputDest = Files.createTempFile(fname, 
".hdfs").toFile();
                 if (outputDest.exists()) {
                     outputDest.delete();
                 }
diff --git 
a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/CamelFilterWrapper.java
 
b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/CamelFilterWrapper.java
index caa7cfb..ea62420 100644
--- 
a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/CamelFilterWrapper.java
+++ 
b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/CamelFilterWrapper.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.jetty;
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Files;
 
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
@@ -57,7 +58,7 @@ public class CamelFilterWrapper implements Filter {
             //but the MultiPartFilter requires it (will NPE if not set) so 
we'll 
             //go ahead and set it to the default tmp dir on the system.
             try {
-                File file = File.createTempFile("camel", "");
+                File file = Files.createTempFile("camel", "").toFile();
                 file.delete();
                 
config.getServletContext().setAttribute("javax.servlet.context.tempdir",
                                                         file.getParentFile());
diff --git 
a/components/camel-tarfile/src/main/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategy.java
 
b/components/camel-tarfile/src/main/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategy.java
index aa00788..23a670e 100644
--- 
a/components/camel-tarfile/src/main/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategy.java
+++ 
b/components/camel-tarfile/src/main/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategy.java
@@ -22,6 +22,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.Charset;
+import java.nio.file.Files;
 
 import org.apache.camel.AggregationStrategy;
 import org.apache.camel.Exchange;
@@ -193,7 +194,7 @@ public class TarAggregationStrategy implements 
AggregationStrategy {
     }
 
     private void addFileToTar(File source, File file, String fileName) throws 
IOException, ArchiveException {
-        File tmpTar = File.createTempFile(source.getName(), null, parentDir);
+        File tmpTar = Files.createTempFile(parentDir.toPath(), 
source.getName(), null).toFile();
         tmpTar.delete();
         if (!source.renameTo(tmpTar)) {
             throw new IOException("Could not make temp file (" + 
source.getName() + ")");
@@ -228,7 +229,7 @@ public class TarAggregationStrategy implements 
AggregationStrategy {
     }
 
     private void addEntryToTar(File source, String entryName, byte[] buffer, 
int length) throws IOException, ArchiveException {
-        File tmpTar = File.createTempFile(source.getName(), null, parentDir);
+        File tmpTar = Files.createTempFile(parentDir.toPath(), 
source.getName(), null).toFile();
         tmpTar.delete();
         if (!source.renameTo(tmpTar)) {
             throw new IOException("Cannot create temp file: " + 
source.getName());
diff --git 
a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
 
b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
index ee37f9e..522f5ee 100644
--- 
a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
+++ 
b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
@@ -21,6 +21,7 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+import java.nio.file.Files;
 import java.util.Arrays;
 import java.util.Dictionary;
 import java.util.Enumeration;
@@ -531,7 +532,7 @@ public abstract class CamelBlueprintTestSupport extends 
CamelTestSupport {
     private String prepareInitialConfigFile(Properties initialConfiguration) 
throws IOException {
         File dir = new File("target/etc");
         dir.mkdirs();
-        File cfg = File.createTempFile("properties-", ".cfg", dir);
+        File cfg = Files.createTempFile(dir.toPath(), "properties-", 
".cfg").toFile();
         FileWriter writer = new FileWriter(cfg);
         try {
             initialConfiguration.store(writer, null);
diff --git 
a/components/camel-zipfile/src/main/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategy.java
 
b/components/camel-zipfile/src/main/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategy.java
index d4fe444..71a1117 100644
--- 
a/components/camel-zipfile/src/main/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategy.java
+++ 
b/components/camel-zipfile/src/main/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategy.java
@@ -22,6 +22,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.Charset;
+import java.nio.file.Files;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
@@ -191,7 +192,7 @@ public class ZipAggregationStrategy implements 
AggregationStrategy {
     }
     
     private static void addFileToZip(File source, File file, String fileName) 
throws IOException {
-        File tmpZip = File.createTempFile(source.getName(), null);
+        File tmpZip = Files.createTempFile(source.getName(), null).toFile();
         tmpZip.delete();
         if (!source.renameTo(tmpZip)) {
             throw new IOException("Could not make temp file (" + 
source.getName() + ")");
@@ -225,7 +226,7 @@ public class ZipAggregationStrategy implements 
AggregationStrategy {
     }
     
     private static void addEntryToZip(File source, String entryName, byte[] 
buffer, int length) throws IOException {
-        File tmpZip = File.createTempFile(source.getName(), null);
+        File tmpZip = Files.createTempFile(source.getName(), null).toFile();
         tmpZip.delete();
         if (!source.renameTo(tmpZip)) {
             throw new IOException("Cannot create temp file: " + 
source.getName());
diff --git a/core/camel-util/src/main/java/org/apache/camel/util/FileUtil.java 
b/core/camel-util/src/main/java/org/apache/camel/util/FileUtil.java
index b082f05..852e540 100644
--- a/core/camel-util/src/main/java/org/apache/camel/util/FileUtil.java
+++ b/core/camel-util/src/main/java/org/apache/camel/util/FileUtil.java
@@ -98,7 +98,7 @@ public final class FileUtil {
         // create parent folder
         parentDir.mkdirs();
 
-        return File.createTempFile(prefix, suffix, parentDir);
+        return Files.createTempFile(parentDir.toPath(), prefix, 
suffix).toFile();
     }
 
     /**

Reply via email to