Updating color scheme plugin leads to errors that didn't occur before
I am very new to plugin development; however, I did publish my first color scheme plugin to the JetBrain Plugin Repository a few months ago. In the last few days, I have tried to update my color scheme; however, I have ran into some troubles. The biggest issue I am trying to understand is why this issue did not come up before.
As a background, I develop with Android Studio, and edit my color scheme step-by-step in Android Studio. I use IntelliJ IDEA to develop my color scheme plugin. A few months ago, I posted this question (https://devnet.jetbrains.com/message/5561352#5561352), fixed the issue and published my plugin and it works well. Now, all I have done was copy the content of the color scheme XML (in Android Studio) into my IntelliJ plugin development.
I didn't change anything else. All I did was copy-paste the new color scheme xml into my old file. I ran the plugin and received an error.
[ 31596] ERROR - ions.SchemesManagerFactoryImpl - Cannot read scheme from colors/ChroMATERIAL.xml
java.lang.IllegalArgumentException: Argument for @NotNull parameter 'element' of com/intellij/openapi/editor/markup/TextAttributes.<init> must not be null
at com.intellij.openapi.editor.markup.TextAttributes.<init>(TextAttributes.java)
at com.intellij.openapi.editor.colors.impl.AbstractColorsScheme.readAttributes(AbstractColorsScheme.java:339)
at com.intellij.openapi.editor.colors.impl.AbstractColorsScheme.readScheme(AbstractColorsScheme.java:314)
at com.intellij.openapi.editor.colors.impl.AbstractColorsScheme.readExternal(AbstractColorsScheme.java:269)
at com.intellij.openapi.editor.colors.impl.EditorColorsManagerImpl$ReadOnlyColorsSchemeImpl.<init>(EditorColorsManagerImpl.java:153)
at com.intellij.openapi.editor.colors.impl.EditorColorsManagerImpl$2.convert(EditorColorsManagerImpl.java:130)
at com.intellij.openapi.editor.colors.impl.EditorColorsManagerImpl$2.convert(EditorColorsManagerImpl.java:127)
at com.intellij.openapi.options.SchemesManagerImpl.loadBundledScheme(SchemesManagerImpl.java:214)
at com.intellij.openapi.editor.colors.impl.EditorColorsManagerImpl.<init>(EditorColorsManagerImpl.java:127)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter$1.run(ConstructorInjectionComponentAdapter.java:220)
at org.picocontainer.defaults.ThreadLocalCyclicDependencyGuard.observe(ThreadLocalCyclicDependencyGuard.java:53)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:248)
at com.intellij.util.pico.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:58)
at com.intellij.openapi.components.impl.ServiceManagerImpl$MyComponentAdapter.initializeInstance(ServiceManagerImpl.java:228)
at com.intellij.openapi.components.impl.ServiceManagerImpl$MyComponentAdapter$1.compute(ServiceManagerImpl.java:216)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:884)
at com.intellij.openapi.components.impl.ServiceManagerImpl$MyComponentAdapter.getComponentInstance(ServiceManagerImpl.java:207)
at com.intellij.util.pico.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:245)
at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:211)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.picocontainer.defaults.ImmutablePicoContainerProxyFactory.invoke(ImmutablePicoContainerProxyFactory.java:73)
at com.sun.proxy.$Proxy41.getComponentInstance(Unknown Source)
at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:216)
at org.picocontainer.defaults.BasicComponentParameter.resolveInstance(BasicComponentParameter.java:77)
at org.picocontainer.defaults.ComponentParameter.resolveInstance(ComponentParameter.java:114)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getConstructorArguments(ConstructorInjectionComponentAdapter.java:257)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter$1.run(ConstructorInjectionComponentAdapter.java:217)
at org.picocontainer.defaults.ThreadLocalCyclicDependencyGuard.observe(ThreadLocalCyclicDependencyGuard.java:53)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:248)
at com.intellij.util.pico.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:58)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter$1.getComponentInstance(ComponentManagerImpl.java:550)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:610)
at com.intellij.util.pico.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:245)
at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:211)
at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponent(ComponentManagerImpl.java:125)
at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponents(ComponentManagerImpl.java:116)
at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:87)
at com.intellij.openapi.project.impl.ProjectImpl.init(ProjectImpl.java:292)
at com.intellij.openapi.project.impl.ProjectManagerImpl.initProject(ProjectManagerImpl.java:319)
at com.intellij.openapi.project.impl.ProjectManagerImpl.access$700(ProjectManagerImpl.java:82)
at com.intellij.openapi.project.impl.ProjectManagerImpl$6.run(ProjectManagerImpl.java:398)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:452)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:402)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:180)
at com.intellij.openapi.project.impl.ProjectManagerImpl.getDefaultProject(ProjectManagerImpl.java:393)
at com.intellij.openapi.project.DefaultProjectFactoryImpl.getDefaultProject(DefaultProjectFactoryImpl.java:24)
at org.jetbrains.java.decompiler.IdeaDecompiler.<init>(IdeaDecompiler.java:94)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter$1.run(ConstructorInjectionComponentAdapter.java:220)
at org.picocontainer.defaults.ThreadLocalCyclicDependencyGuard.observe(ThreadLocalCyclicDependencyGuard.java:53)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:248)
at com.intellij.util.pico.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:58)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.getComponentInstance(ExtensionComponentAdapter.java:77)
at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.getExtension(ExtensionComponentAdapter.java:119)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapters(ExtensionPointImpl.java:249)
at com.intellij.openapi.extensions.impl.ExtensionPointImpl.getExtensions(ExtensionPointImpl.java:194)
at com.intellij.openapi.extensions.Extensions.getExtensions(Extensions.java:101)
at com.intellij.openapi.extensions.Extensions.getExtensions(Extensions.java:87)
at com.intellij.openapi.extensions.ExtensionPointName.getExtensions(ExtensionPointName.java:49)
at com.intellij.psi.impl.compiled.ClassFileStubBuilder.getStubVersion(ClassFileStubBuilder.java:105)
at com.intellij.psi.stubs.CumulativeStubVersion.getCumulativeVersion(CumulativeStubVersion.java:46)
at com.intellij.psi.stubs.StubUpdatingIndex.getVersion(StubUpdatingIndex.java:206)
at com.intellij.util.indexing.FileBasedIndexImpl.registerIndexer(FileBasedIndexImpl.java:382)
at com.intellij.util.indexing.FileBasedIndexImpl.initExtensions(FileBasedIndexImpl.java:285)
at com.intellij.util.indexing.FileBasedIndexImpl.initComponent(FileBasedIndexImpl.java:362)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter$1.getComponentInstance(ComponentManagerImpl.java:568)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:610)
at com.intellij.util.pico.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:245)
at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:211)
at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponent(ComponentManagerImpl.java:125)
at com.intellij.openapi.application.impl.ApplicationImpl.createComponent(ApplicationImpl.java:354)
at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponents(ComponentManagerImpl.java:116)
at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:87)
at com.intellij.openapi.components.impl.stores.ApplicationStoreImpl.load(ApplicationStoreImpl.java:101)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:499)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:481)
at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:170)
at com.intellij.idea.MainImpl$1$1$1.run(MainImpl.java:52)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:362)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
[ 31635] ERROR - ions.SchemesManagerFactoryImpl - IntelliJ IDEA 14.1.5 Build #IC-141.2735.5
[ 31635] ERROR - ions.SchemesManagerFactoryImpl - JDK: 1.7.0_45
[ 31635] ERROR - ions.SchemesManagerFactoryImpl - VM: Java HotSpot(TM) 64-Bit Server VM
[ 31636] ERROR - ions.SchemesManagerFactoryImpl - Vendor: Oracle Corporation
[ 31636] ERROR - ions.SchemesManagerFactoryImpl - OS: Windows 8
Actually, before I ran the plugin, I noticed that I actually could not run it. I had to create a new module because the run configuration could not be found. So I created a new module and fixed the run configuration, and ran the plugin. When I ran the plugin, the error above occurred. I don't know why these 2 issues did not come up last time.
I also ran the "Prepare all Plugin Modules for Deployment" option, and I seen that the color scheme XML file was not included.
Here is the link to my gitHub which has the old code - https://github.com/ciscorucinski/ChroMATERIAL
So, how do I fix this issue? And why did this not occur last time?
请先登录再写评论。
I understand that the issue is with a null value being passed into a nonnull TextAttributes Constructor parameter. I have stepped through the decompiled code, and cannot figure out why this issue is occurring.
I also stepped through the code in EditorColorsManagerImpl. That shows that my xml file is being parsed correctly. I didn't see if every line works, but it is being parsed.
There are intellij sources available https://github.com/jetbrains/intellij-community, they might be more handy than decompiled code.
As for the issue, it might have been caused by scheme with <option> tag without <value> inside.
https://github.com/JetBrains/intellij-community/blob/73c9823544963dc4172c818bf238033e9b5704f0/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java#L339
I guess, I should update here.
Since there were 2 newer versions of the IDE available (upto IntelliJ IDEA 16), I decided to updated my IDE and try my luck with that. This error went away almost immediately; however, I had to do some reworking of my code and figuring out the correct SDK / JDK setup again to get it working.
Now, this isn't an issue.
My only existing issue is that when I deploy the plugin, the JAR file I get is missing the color scheme file; however, the local plugin works as expected. Don't get why this is ... http://stackoverflow.com/questions/34936002/deployable-jar-file-from-jb-plugin-repo-does-not-contain-my-files-but-the-plugi
Update: I think I got it working now, but I don't think I got it working through the official means.
1st, I have to run my plugin which starts up a new IDE instance. 2nd, open up my plugin project (same project) in the new IDE instance, 3rd, set up the SDK, JDK correctly and make the project in the new IDE instance, 4th, have the new IDE instance create the deployable JAR file.
This JAR file now contains the correct file. I uploaded that JAR file to the JetBrain's Plugin Repo and I think it works now.
However, I cannot use my original IDE instance to create this JAR file, it is an incomplete JAR file. Why is that, or why would something like that happen?