intellij-platform-gradle-plugin icon indicating copy to clipboard operation
intellij-platform-gradle-plugin copied to clipboard

ZipException: invalid distance too far back during the plugin Unload

Open ion-forgood opened this issue 1 year ago • 0 comments

What happened?

Hello community! I've registered a DynamicPluginListener:

The code is quite simple:

class ZencoderDynamicPluginListener : DynamicPluginListener { private val logger = Logger.getInstance(ZencoderDynamicPluginListener::class.java) override fun beforePluginUnload(pluginDescriptor: IdeaPluginDescriptor, isUpdate: Boolean) { logger.info("Plugin about to be unloaded: start") Sentry.close() logger.info("Plugin about to be unloaded: ${pluginDescriptor.pluginId}, isUpdate: $isUpdate") } } But everytime I reload the pugin, I'm facing:

Caused by: java.lang.ClassNotFoundException: ai.zencoder.plugin.providers.completion.ZencoderDynamicPluginListener at com.intellij.ide.plugins.cl.PluginClassLoader.tryLoadingClass(PluginClassLoader.kt:188) at com.intellij.serviceContainer.ComponentManagerImplKt.doLoadClass(ComponentManagerImpl.kt:2255) at com.intellij.serviceContainer.ComponentManagerImpl.createListener(ComponentManagerImpl.kt:1442) ... 55 more Caused by: java.util.zip.ZipException: invalid distance too far back at com.intellij.util.lang.ImmutableZipEntry.getByteBuffer(ImmutableZipEntry.java:149) at com.intellij.util.lang.HashMapZipFile.getByteBuffer(HashMapZipFile.java:99) at com.intellij.util.lang.ZipResourceFile.findClass(ZipResourceFile.java:107) at com.intellij.util.lang.JarLoader.findClass(JarLoader.java:58) at com.intellij.util.lang.ClassPath.findClassInLoader(ClassPath.java:240) at com.intellij.util.lang.ClassPath.findClass(ClassPath.java:190) at com.intellij.ide.plugins.cl.PluginClassLoader.loadClassInsideSelf(PluginClassLoader.kt:326) at com.intellij.ide.plugins.cl.PluginClassLoader.tryLoadingClass(PluginClassLoader.kt:178) I've tried to recreate the class, clean build, move packages to avoid any possibilities of the file corruption, but still didn't succeed. If you have any suggestions, would be appreciated.

Relevant log output or stack trace

Caused by: java.lang.ClassNotFoundException: ai.zencoder.plugin.providers.completion.ZencoderDynamicPluginListener
    at com.intellij.ide.plugins.cl.PluginClassLoader.tryLoadingClass(PluginClassLoader.kt:188)
    at com.intellij.serviceContainer.ComponentManagerImplKt.doLoadClass(ComponentManagerImpl.kt:2255)
    at com.intellij.serviceContainer.ComponentManagerImpl.createListener(ComponentManagerImpl.kt:1442)
    ... 55 more
Caused by: java.util.zip.ZipException: invalid distance too far back
    at com.intellij.util.lang.ImmutableZipEntry.getByteBuffer(ImmutableZipEntry.java:149)
    at com.intellij.util.lang.HashMapZipFile.getByteBuffer(HashMapZipFile.java:99)
    at com.intellij.util.lang.ZipResourceFile.findClass(ZipResourceFile.java:107)
    at com.intellij.util.lang.JarLoader.findClass(JarLoader.java:58)
    at com.intellij.util.lang.ClassPath.findClassInLoader(ClassPath.java:240)
    at com.intellij.util.lang.ClassPath.findClass(ClassPath.java:190)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClassInsideSelf(PluginClassLoader.kt:326)
    at com.intellij.ide.plugins.cl.PluginClassLoader.tryLoadingClass(PluginClassLoader.kt:178)

Steps to reproduce

  1. Create a simple extension of DynamicPluginListener (example above)
  2. Register the listener in plugin.xml
  3. build
  4. Run the Sandbox: ./gradlew runIde
  5. Perform any changes in the plugin code
  6. Run ./gradlew buildPlugin
  7. Switch the cursor focus to Sandbox

Gradle IntelliJ Plugin version

2.0.1

Gradle version

8.9

Operating System

macOS

Link to build, i.e. failing GitHub Action job

No response

ion-forgood avatar Aug 26 '24 15:08 ion-forgood