Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnsupportedOperationException when trying to copy files from a NodeArray's root path on JDK 21 #209

Open
lorban opened this issue Apr 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@lorban
Copy link
Member

lorban commented Apr 19, 2024

When using Jetty 12's org.eclipse.jetty.util.IO.copyDir(Path, Path) helper to copy a NodeArray's root path, the following exception is thrown:

java.lang.UnsupportedOperationException
	at org.mortbay.jetty.orchestrator.nodefs.NodeFileSystemProvider.getFileAttributeView(NodeFileSystemProvider.java:89)
	at java.base/java.nio.file.Files.getFileAttributeView(Files.java:1790)
	at java.base/java.nio.file.CopyMoveHelper.copyToForeignTarget(CopyMoveHelper.java:110)
	at java.base/java.nio.file.Files.copy(Files.java:1307)
...

Running the same code with JDK 17 works fine.

@lorban lorban added the bug Something isn't working label Apr 19, 2024
@lorban lorban changed the title UnsupportedOperationException when trying to copy files from a NodeArray's root path UnsupportedOperationException when trying to copy files from a NodeArray's root path on JDK 21 Apr 19, 2024
@joakime
Copy link
Member

joakime commented Apr 19, 2024

Try use the IO.copyDir() version that takes two Path objects, not File objects.

https://github.com/jetty/jetty.project/blob/jetty-12.0.8/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/IO.java#L243

@lorban
Copy link
Member Author

lorban commented Apr 19, 2024

@joakime that's exactly the version that was used, so I modified the description to reflect that.

The problem seems to be that JDK 21 takes a different codepath through the orchestrator's NodeFileSystemProvider than JDK 17 used to take. And that new codepath seems to call a method that hasn't been implemented yet: NodeFileSystemProvider.getFileAttributeView() unconditionally throws UnsupportedOperationException.

I'm going to check what it takes to replace SSHJ with Apache Mina SSH, as they already have a sftp nio Filesystem implementation we could simply wrap. An extra benefit would be that the orchestrator's node filesystem would support writing to it, which would allow uploading files to the nodes.

If that is too much work, I'll try to come up with an implementation of NodeFileSystemProvider.getFileAttributeView() with SSHJ.

lorban added a commit that referenced this issue Apr 23, 2024
lorban added a commit that referenced this issue Apr 23, 2024
lorban added a commit that referenced this issue Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants