Skip to content

Commit 711864f

Browse files
authored
Fix XFileSystem serialization issue (#5411)
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
1 parent 718dcbe commit 711864f

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

modules/nextflow/src/test/groovy/nextflow/util/KryoHelperTest.groovy

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,16 @@ class KryoHelperTest extends Specification {
165165
KryoHelper.deserialize(buffer).toUri() == new URI('http://host.com/foo.txt')
166166
}
167167

168+
def 'should serialise xfilesystem' () {
169+
when:
170+
def uri = new URI('https://host.com/path/foo.txt')
171+
def fs = FileHelper.getOrCreateFileSystemFor(new URI('https://host.com/path/foo.txt'))
172+
def fsBuffer = KryoHelper.serialize(fs)
173+
then:
174+
KryoHelper.deserialize(fsBuffer).getClass().getName() == 'nextflow.file.http.XFileSystem'
175+
KryoHelper.deserialize(fsBuffer).getPath("/path/foo.txt").toUri() == uri
176+
}
177+
168178
@EqualsAndHashCode
169179
static class Foo implements SerializableMarker {
170180
String foo

modules/nf-httpfs/src/main/nextflow/file/http/XFileSystem.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ class XFileSystem extends FileSystem {
4444

4545
private URI base
4646

47+
/*
48+
* Only needed to prevent serialization issues - see https://github.com/nextflow-io/nextflow/issues/5208
49+
*/
50+
protected XFileSystem(){}
51+
4752
XFileSystem(XFileSystemProvider provider, URI base) {
4853
this.provider = provider
4954
this.base = base

0 commit comments

Comments
 (0)