slawekjaranowski commented on code in PR #685:
URL: https://github.com/apache/maven-resolver/pull/685#discussion_r2041505558


##########
maven-resolver-transport-file/src/main/java/org/eclipse/aether/transport/file/FileTransporterFactory.java:
##########
@@ -66,28 +65,61 @@ public FileTransporterFactory setPriority(float priority) {
         return this;
     }
 
+    /**
+     * Creates new instance of {@link FileTransporter}.
+     *
+     * @param session The session.
+     * @param repository The remote repository.
+     */
     @Override
     public Transporter newInstance(RepositorySystemSession session, 
RemoteRepository repository)
             throws NoTransporterException {
         requireNonNull(session, "session cannot be null");
         requireNonNull(repository, "repository cannot be null");
 
-        // special case in file transport: to support custom FS providers 
(like JIMFS), we cannot
-        // cover "all possible protocols" to throw NoTransporterEx, but we 
rely on FS rejecting the URI
-        FileTransporter.FileOp fileOp = FileTransporter.FileOp.COPY;
         String repositoryUrl = repository.getUrl();
-        if (repositoryUrl.startsWith("symlink+")) {
-            fileOp = FileTransporter.FileOp.SYMLINK;
-            repositoryUrl = repositoryUrl.substring("symlink+".length());
-        } else if (repositoryUrl.startsWith("hardlink+")) {
-            fileOp = FileTransporter.FileOp.HARDLINK;
-            repositoryUrl = repositoryUrl.substring("hardlink+".length());
-        }
-        try {
-            return new FileTransporter(
-                    
Paths.get(RepositoryUriUtils.toUri(repositoryUrl)).toAbsolutePath(), fileOp);
-        } catch (FileSystemNotFoundException | IllegalArgumentException e) {
-            throw new NoTransporterException(repository, e);
+        if (repositoryUrl.startsWith("bundle:")) {
+            try {
+                repositoryUrl = repositoryUrl.substring("bundle:".length());
+                URI bundlePath = URI.create("jar:"
+                        + Paths.get(RepositoryUriUtils.toUri(repositoryUrl))
+                                .toAbsolutePath()
+                                .toUri()
+                                .toASCIIString());
+                Map<String, String> env = new HashMap<>();
+                FileSystem fileSystem = FileSystems.newFileSystem(bundlePath, 
env);
+                return new FileTransporter(
+                        fileSystem,
+                        true,
+                        false,
+                        fileSystem.getPath(fileSystem.getSeparator()),
+                        FileTransporter.WriteOp.COPY);
+            } catch (IOException e) {
+                throw new UncheckedIOException(e); // hard failure; most 
probably user error (ie wrong path or perm)

Review Comment:
   For others FS we have different exception handling .. 
   can be the same as in lines 120-122
   
   or one catch?



-- 
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: issues-unsubscr...@maven.apache.org

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

Reply via email to