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

Depclean cannot decompress jar files which have both a file and folder named the same #46

Closed
mtorres10 opened this issue Mar 18, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@mtorres10
Copy link
Contributor

mtorres10 commented Mar 18, 2021

Describe the bug

When a dependency has both a folder and a file named the same at the same level depclean throws a file not found exception (java.io.FileNotFoundException).

When both folder and file are named the same, depclean extracts the file correctly but does not create the folder. If folder has child items, depclean tries to extract those items to the folder (as it should), but since it was not created in the filesystem a file not found exception is raised.

Extraction of subsequent files for that jar seems to be halted.

Update: This seems to be caused due in class jarUtils link to line here

new File(filePath).getParentFile().mkdirs(); 

as mkdirs() will not create the folder because a file named the same as the folder already exists

Side by side comparison of jar content vs extracted files

image

Steps To Reproduce

  1. Clone project : https://github.com/mtorres10/DepCleanDebug
  2. Make sure you are using JDK 11 for this project.
  3. Compile using maven
  4. Run depclean goal using maven
  5. See error

Expected behavior

All dependencies should be extracted correctly

Actual behavior

Using the current version available in maven "2.0.0" user only gets a message stating :

[ERROR] Problem decompressing jar file.

Using version "2.0.1-Snapshot" user gets a message with a bit more details:

[WARNING] Problem decompressing jar file: path\to\dependency\dep.jar

Screenshots

v 2.0.0

image

v 2.0.1-Snapshot

image

@mtorres10 mtorres10 added the bug Something isn't working label Mar 18, 2021
@mtorres10 mtorres10 changed the title Depclen cannot decompress jar files which have both a file and folder named the same Depclean cannot decompress jar files which have both a file and folder named the same Mar 18, 2021
@mtorres10
Copy link
Contributor Author

mtorres10 commented Mar 18, 2021

After further research this is not a Java nor a code issue, this is a limitation of the OS since the file has no extension the OS cannot create a file with no extension and folder with the same name. It is strange how the jar was created with such structure. Still the fact remains that an exception halts the extraction of the remaining files.

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

1 participant