This is an automated email from the ASF dual-hosted git repository. acosentino 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 e0be4d7 [CAMEL-13711] Files.createTempFile not equivalent to File.createTempFile e0be4d7 is described below commit e0be4d70bd7c2cf268f2d95080ff2ffcb9c46034 Author: Thomas Diesler <tdies...@redhat.com> AuthorDate: Mon Jul 8 16:15:17 2019 +0200 [CAMEL-13711] Files.createTempFile not equivalent to File.createTempFile --- .../org/apache/camel/component/hdfs2/HdfsFileType.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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 a6ea21f..9857902 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 @@ -141,12 +141,19 @@ public enum HdfsFileType { String fname = hdfsPath.substring(hdfsPath.lastIndexOf('/')); // [CAMEL-13711] Files.createTempFile not equivalent to File.createTempFile - int dotIndex = fname.indexOf('.'); - if (dotIndex > 0) { - fname = fname.substring(0, dotIndex); + + File outputDest; + try { + + // First trying: Files.createTempFile + outputDest = Files.createTempFile(fname, ".hdfs").toFile(); + + } catch (Exception ex) { + + // Now trying: File.createTempFile + outputDest = File.createTempFile(fname, ".hdfs"); } - File outputDest = Files.createTempFile(fname, ".hdfs").toFile(); if (outputDest.exists()) { outputDest.delete(); }