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

JDeply does not initialize correctly when one of the detected JAR files is corrupted #104

Closed
Oliver-Loeffler opened this issue Mar 26, 2023 · 3 comments

Comments

@Oliver-Loeffler
Copy link

Oliver-Loeffler commented Mar 26, 2023

As I was trying to get Scene Builder into npm registry via JDeploy, the command jdeploy init failed with an exception java.util.zip.ZipException and the file package.json was not created.

Expected Behavior

  • the error message ideally shows more detail, e.g. in which phase at which step something broke (e.g. the JAR file name during scanning for manifests) so that its a little bit easier to figure this out.
  • The init process probably could continue, but JDeploy should inform (or warn) the user that one of the detected JAR files is broken
  • JDeploy would not scan src/test/resources folders for JARs

Current Behavior

The user will either see a dialog with an error message or read the exception message in the CLI.
grafik
Also JDeploy scanned all folders of the project, including resource directories, which in case for the tests, contained illegal JAR files.

Steps to Reproduce

md test
cd test
touch Empty.jar
jdeploy init

or:

md test
cd test
echo TEST > Broken.jar
jdeploy init

Both cases will fail. The important thing is, the JAR must be somehow broken.

The problematic method is JDeploy.findJarCandidates(). The exception is raised at the attempt to open the 0-byte file with new JarFile(f).getManifest().

Your Environment

  • JDK20, Win10
  • NPM 9.5.0
  • jdeploy@4.0.20
@shannah
Copy link
Owner

shannah commented Mar 26, 2023

What is the use case for a zero byte jar file?

@shannah
Copy link
Owner

shannah commented Mar 26, 2023

If you place your jars in a subdirectory it will only scan that subdirectory. Not the root.

@Oliver-Loeffler
Copy link
Author

Oliver-Loeffler commented Mar 27, 2023

Its just a dummy, just needed for one test a Jar file. It doesnt need to be a true JAR in that case, However, files can get broken.
As with jdeploy@4.0.20, it scans the root dir of a project and the subdirs.

@shannah shannah closed this as completed Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants