abashev / vfs-s3

Amazon S3 driver for Apache commons-vfs (Virtual File System) project
Apache License 2.0
93 stars 50 forks source link

[4.0.0] AbstractFileSystem and AbstractVfsComponent are custom #62

Open boris-petrov opened 4 years ago

boris-petrov commented 4 years ago

I saw the following error in our logs:

class com.github.vfss3.S3FileSystem cannot be cast to class org.apache.commons.vfs2.provider.AbstractFileSystem

Coming from here:

commons-vfs2-2.4.1.jar!/org/apache/commons/vfs2/impl/DefaultFileMonitor$FileMonitorAgent.class:423→ fireAllCreate

And I saw that in version 4.0.0 of vfs-s3 there is a custom class AbstractFileSystem and AbstractVfsComponent (at least these two, maybe there are more). This makes vfs-s3 incompatible with utilities provided by commons-vfs like the DefaultFileMonitor.

abashev commented 4 years ago

@boris-petrov are you using DefaultFileMonitor only with S3 file systems or is it shared monitor for other types?

boris-petrov commented 4 years ago

@abashev - it is shared. We use the same code for all VFS protocols, that's the whole idea of VFS...

I'm not sure why you need these custom classes? Are there still concurrency/other kinds of bugs in the upstream repo that you've fixed? If there are, please open PRs on their side so that all users can benefit.

abashev commented 4 years ago

@boris-petrov lol 😀 I tried to submit a few times but even small changes are not going through. That is why I decided not to manage separated commons-vfs fork but to take all required classes inside the project and don't rely on the Apache's project. commons-vfs has really poor design and instead of using interfaces, somewhere inside, they are doing a conversion to a specific class - I can't fix that problem on my end. I can take DefaultFileMonitor in my project and provide correct, platform-agnostic implementation. But you have to replace all the usages with my class. Is it ok for you?

boris-petrov commented 4 years ago

@abashev - true, I've seen how they seem to ignore your PRs, no idea why. They seem to be accepting mine though. :smile: Perhaps I could try? Can you fork the original repo and create a few branches with your commits that I can look at? Do you have some tests that "prove" that your fixes are really needed?

I think it's better to go this way. I agree that commons-vfs is badly designed, believe me, I've spent quite some time on it... but there is nothing we can do about that now. Let's try to fix what we have because a lot of people use that in production. :)

As a last resort we could go the way you suggest, yes, by using a custom DefaultFileMonitor. But I do believe that we can make it work the "right" way.

Thank you for your time!