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

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


The following commit(s) were added to refs/heads/camel-2.x by this push:
     new 0154cc1  Switch to using nio Files.createTempFile
0154cc1 is described below

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

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

diff --git a/camel-core/src/main/java/org/apache/camel/util/FileUtil.java 
b/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
index f9c7d9e..5bd7270 100644
--- a/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
+++ b/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
@@ -106,7 +106,7 @@ public final class FileUtil {
         // create parent folder
         parent.mkdirs();
 
-        return File.createTempFile(prefix, suffix, parent);
+        return Files.createTempFile(parent.toPath(), prefix, suffix).toFile();
     }
 
     /**
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 94c1e0d..6ad72cd 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
deleted file mode 100644
index 4a4b254..0000000
--- a/components/camel-cm-sms/src/main/docs/cm-sms-component.adoc
+++ /dev/null
@@ -1,92 +0,0 @@
-[[cm-sms-component]]
-== CM SMS Gateway Component
-
-*Available as of Camel version 2.18*
-
-*Camel-Cm-Sms* is an http://camel.apache.org/[Apache Camel] component 
-for the [CM SMS Gateway](https://www.cmtelecom.com). 
-
-It allows to integrate https://dashboard.onlinesmsgateway.com/docs[CM SMS 
API]in an application as a camel component. 
-
-You must have a valid account.  More information are available at 
https://www.cmtelecom.com/support[CM Telecom].
-
-[source,text]
-----
-cm-sms://sgw01.cm.nl/gateway.ashx?defaultFrom=DefaultSender&defaultMaxNumberOfParts=8&productToken=xxxxx
-----
-
-Maven users will need to add the following dependency to their pom.xml
-for this component:
-
-[source,xml]
----
-<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-cm-sms</artifactId>
- <version>x.x.x</version>
- <!-- use the same version as your Camel core version -->
-</dependency>
----
-
-=== Options
-
-
-// component options: START
-The CM SMS Gateway component has no options.
-// component options: END
-
-
-
-// endpoint options: START
-The CM SMS Gateway endpoint is configured using URI syntax:
-
-----
-cm-sms:host
-----
-
-with the following path and query parameters:
-
-==== Path Parameters (1 parameters):
-
-
-[width="100%",cols="2,5,^1,2",options="header"]
-|===
-| Name | Description | Default | Type
-| *host* | *Required* SMS Provider HOST with scheme |  | String
-|===
-
-
-==== Query Parameters (5 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)
-| *productToken* (producer) | *Required* The unique token to use |  | String)
-| *testConnectionOnStartup* (producer) | Whether to test the connection to the 
SMS Gateway on startup | false | boolean
-| *synchronous* (advanced) | Sets whether synchronous processing should be 
strictly used, or Camel is allowed to use asynchronous processing (if 
supported). | false | boolean
-|===
-// endpoint options: END
-// spring-boot-auto-configure options: START
-=== Spring Boot Auto-Configuration
-
-
-The component supports 2 options, which are listed below.
-
-
-
-[width="100%",cols="2,5,^1,2",options="header"]
-|===
-| Name | Description | Default | Type
-| *camel.component.cm-sms.enabled* | Enable cm-sms component | true | Boolean
-| *camel.component.cm-sms.resolve-property-placeholders* | Whether the 
component should resolve property placeholders on itself when starting. Only 
properties which are of String type can use property placeholders. | true | 
Boolean
-|===
-// spring-boot-auto-configure options: END
-
-
-
-=== Sample
-
-You can try https://github.com/oalles/camel-cm-sample[this project] to see how 
camel-cm-sms can be integrated in a camel route. 
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 77c57fb..5cc6069 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 f247e5f..58a0b82 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 bd2e58f..69a6869 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.Exchange;
 import org.apache.camel.WrappedFile;
@@ -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 66f13af..bd5726a 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 89cc863..ec957cf 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;
@@ -172,7 +173,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() + ")");
@@ -206,7 +207,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());

Reply via email to