You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2021/07/06 11:46:29 UTC

[GitHub] [sling-org-apache-sling-feature] kwin commented on a change in pull request #29: SLING-10586 prevent java.nio.file.FileSystemNotFoundException during

kwin commented on a change in pull request #29:
URL: https://github.com/apache/sling-org-apache-sling-feature/pull/29#discussion_r664470272



##########
File path: src/main/java/org/apache/sling/feature/io/artifacts/ArtifactManager.java
##########
@@ -383,16 +385,17 @@ public URL getArtifact(final String url, final String relativeCachePath) {
             logger.debug("Checking url to be local file {}", url);
             // check if this is already a local file
             try {
-                final Path f = Paths.get(new URL(url).toURI());
-                if (Files.exists(f)) {
-                    this.config.incLocalArtifacts();
-                    return f.toUri().toURL();
+                URI uri = new URI(url);
+                if (FileSystems.getDefault().provider().getScheme().equals(uri.getScheme())) {

Review comment:
       Do we need to URIs without a scheme?

##########
File path: src/main/java/org/apache/sling/feature/io/artifacts/ArtifactManager.java
##########
@@ -383,16 +385,17 @@ public URL getArtifact(final String url, final String relativeCachePath) {
             logger.debug("Checking url to be local file {}", url);
             // check if this is already a local file
             try {
-                final Path f = Paths.get(new URL(url).toURI());
-                if (Files.exists(f)) {
-                    this.config.incLocalArtifacts();
-                    return f.toUri().toURL();
+                URI uri = new URI(url);
+                if (FileSystems.getDefault().provider().getScheme().equals(uri.getScheme())) {

Review comment:
       Do we need to support URIs without a scheme?

##########
File path: src/main/java/org/apache/sling/feature/io/artifacts/ArtifactManager.java
##########
@@ -383,16 +385,17 @@ public URL getArtifact(final String url, final String relativeCachePath) {
             logger.debug("Checking url to be local file {}", url);
             // check if this is already a local file
             try {
-                final Path f = Paths.get(new URL(url).toURI());
-                if (Files.exists(f)) {
-                    this.config.incLocalArtifacts();
-                    return f.toUri().toURL();
+                URI uri = new URI(url);
+                if (FileSystems.getDefault().provider().getScheme().equals(uri.getScheme())) {

Review comment:
       Do we need to support URIs without a scheme for local files?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org