You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/06/12 08:22:11 UTC
[camel] branch main updated: CAMEL-16709: camel-core: file resource
loader use java.io.File which is more windows friendly and what was used
previously.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 2f203e2 CAMEL-16709: camel-core: file resource loader use java.io.File which is more windows friendly and what was used previously.
2f203e2 is described below
commit 2f203e2ae03bd1855dff5f93d5204521506e18ac
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jun 12 10:16:10 2021 +0200
CAMEL-16709: camel-core: file resource loader use java.io.File which is more windows friendly and what was used previously.
---
.../camel/impl/engine/DefaultResourceResolvers.java | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultResourceResolvers.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultResourceResolvers.java
index 2a6aa30..7d451a9 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultResourceResolvers.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultResourceResolvers.java
@@ -17,6 +17,8 @@
package org.apache.camel.impl.engine;
import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@@ -27,9 +29,6 @@ import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.Base64;
import java.util.zip.GZIPInputStream;
@@ -58,17 +57,17 @@ public final class DefaultResourceResolvers {
@Override
public Resource createResource(String location, String remaining) {
- final Path path = Paths.get(tryDecodeUri(remaining));
+ final File path = new File(tryDecodeUri(remaining));
return new ResourceSupport(location) {
@Override
public boolean exists() {
- return Files.exists(path);
+ return path.exists();
}
@Override
public URI getURI() {
- return path.toUri();
+ return path.toURI();
}
@Override
@@ -76,11 +75,11 @@ public final class DefaultResourceResolvers {
if (!exists()) {
throw new FileNotFoundException(path + " does not exists");
}
- if (Files.isDirectory(path)) {
+ if (path.isDirectory()) {
throw new FileNotFoundException(path + " is a directory");
}
- return Files.newInputStream(path);
+ return new FileInputStream(path);
}
};
}