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

Handle ZipError: invalid END header #33

Open
sylvainlaurent opened this issue Feb 5, 2018 · 2 comments
Open

Handle ZipError: invalid END header #33

sylvainlaurent opened this issue Feb 5, 2018 · 2 comments
Labels

Comments

@sylvainlaurent
Copy link
Member

In one of my projects, the "update maven configuration" fails with what looks like a fatal error to eclipse ("a virtual machine error has occurred...").

Actually this is caused by the lastnpe m2e plugin (verson 1.0.0.201802020829) :

java.util.zip.ZipError: invalid END header (bad central directory offset)
	at com.sun.nio.zipfs.ZipFileSystem.zerror(ZipFileSystem.java:1605)
	at com.sun.nio.zipfs.ZipFileSystem.initCEN(ZipFileSystem.java:1045)
	at com.sun.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:130)
	at com.sun.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:117)
	at java.nio.file.FileSystems.newFileSystem(FileSystems.java:326)
	at java.nio.file.FileSystems.newFileSystem(FileSystems.java:276)
	at org.lastnpe.m2e.core.configurator.ClasspathConfigurator.read(ClasspathConfigurator.java:173)
	at org.lastnpe.m2e.core.configurator.ClasspathConfigurator.readLines(ClasspathConfigurator.java:132)
	at org.lastnpe.m2e.core.configurator.ClasspathConfigurator.getExternalAnnotationMapping(ClasspathConfigurator.java:116)
	at org.lastnpe.m2e.core.configurator.ClasspathConfigurator.lambda$3(ClasspathConfigurator.java:109)
	at java.util.Optional.ifPresent(Optional.java:159)
	at org.lastnpe.m2e.core.configurator.ClasspathConfigurator.getExternalAnnotationMapping(ClasspathConfigurator.java:108)
	at org.lastnpe.m2e.core.configurator.ClasspathConfigurator.configureClasspath(ClasspathConfigurator.java:85)
	at org.eclipse.m2e.jdt.internal.DefaultClasspathManagerDelegate.populateClasspath(DefaultClasspathManagerDelegate.java:61)
	at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:256)
	at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:367)
	at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:347)
	at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:375)
	at org.eclipse.m2e.jdt.internal.BuildPathManager.updateClasspath(BuildPathManager.java:194)
	at org.eclipse.m2e.jdt.internal.BuildPathManager.mavenProjectChanged(BuildPathManager.java:183)
	at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.notifyProjectChangeListeners(ProjectRegistryManager.java:783)
	at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.applyMutableProjectRegistry(ProjectRegistryManager.java:930)
	at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:300)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:405)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:352)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:1)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
	at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1351)
	at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:349)
	at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:77)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)

I probably have a bad/corrupt jar file in my local maven repo, but the plugin should catch the exception.

@nfekete
Copy link
Contributor

nfekete commented Feb 6, 2018

Just make sure it notifies the user about it as that case is probably something that a user would like to be aware of.

@vorburger
Copy link
Member

I probably have a bad/corrupt jar file in my local maven repo

yeah, I remember hitting such errors in the past, not in our eclipse-external-annotations-m2e-plugin but from plain M2E or other (Maven-in-M2E) plugins... if I remember right, I think this could happen e.g. if we read JARs while they are just being refreshed.. or which are corrupt following an interupted download.

but the plugin should catch the exception.

Yes, if we just catch ZipError (and best even others, perhaps?), and log more details about which file it was reading, and then rethrow / log error that, you can see what you have to rm. (I'm pretty sure that a while ago I had raised a bug on eclipse.org for exactly that in M2E itself, or some such place...)

PS: If you want to raise a PR for this, I would merge it ASAP (so that we don't "self merge"; thanks for having merged my NPE one!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants