Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

IndexOutOfBoundsException when opening a project #77

Closed
cquilezg opened this issue Aug 18, 2023 · 9 comments
Closed

IndexOutOfBoundsException when opening a project #77

cquilezg opened this issue Aug 18, 2023 · 9 comments

Comments

@cquilezg
Copy link

Hi,
The plugin is working fine but sometimes IntelliJ shows a notification with a crash when I open a project.
I don't know how to exactly reproduce the error because it happens only sometimes and with some projects.
When the problem appears I have to restart IntelliJ to commit my changes because the text area with the commit message dissapears.

To reproduce the issue:

  • Open IntelliJ and go to the Commit tool window.
  • Click on the frog icon.
  • Open a different project (in a new or the same window).
  • The notification appears in the lower right corner of the screen.

Stacktrace:
java.lang.RuntimeException: Cannot invoke (class=ChangesViewWorkflowManager$$Lambda$9091/0x00000001036fa498, method=commitModeChanged, topic=CommitModeListener) at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:676) at com.intellij.util.messages.impl.MessageBusImplKt.executeOrAddToQueue(MessageBusImpl.kt:491) at com.intellij.util.messages.impl.MessagePublisher.publish$intellij_platform_core(MessageBusImpl.kt:471) at com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:448) at jdk.proxy2/jdk.proxy2.$Proxy182.commitModeChanged(Unknown Source) at com.intellij.vcs.commit.CommitModeManager.updateCommitMode(CommitModeManager.kt:97) at com.intellij.vcs.commit.CommitModeManager.access$updateCommitMode(CommitModeManager.kt:64) at com.intellij.vcs.commit.CommitModeManager$MyStartupActivity.runActivity$lambda$0(CommitModeManager.kt:76) at com.intellij.openapi.application.constraints.BaseConstrainedExecution$Companion.scheduleWithinConstraints$inner(BaseConstrainedExecution.kt:68) at com.intellij.openapi.application.constraints.BaseConstrainedExecution$Companion.scheduleWithinConstraints(BaseConstrainedExecution.kt:71) at com.intellij.openapi.application.constraints.BaseConstrainedExecution.scheduleWithinConstraints(BaseConstrainedExecution.kt:38) at com.intellij.openapi.application.impl.BaseExpirableExecutorMixinImpl.access$scheduleWithinConstraints$s628187586(BaseExpirableExecutorMixinImpl.kt:12) at com.intellij.openapi.application.impl.BaseExpirableExecutorMixinImpl$scheduleWithinConstraints$$inlined$Runnable$1.run(Runnable.kt:19) at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:24) at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:208) at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21) at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:190) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861) at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:478) at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:79) at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:121) at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:789) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:740) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:734) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:759) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:685) at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$10(IdeEventQueue.kt:589) at com.intellij.openapi.application.impl.ApplicationImpl.runWithoutImplicitRead(ApplicationImpl.java:1485) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589) at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:67) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:369) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:368) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:368) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:363) at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:992) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105) at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:992) at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:363) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:405) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at com.intellij.util.SmartList.checkOutOfBounds(SmartList.java:78) at com.intellij.util.SmartList.get(SmartList.java:63) at java.base/java.util.Collections$UnmodifiableList.get(Collections.java:1347) at org.nemwiz.jiracommitmessage.provider.PluginProvider.getCommitMessage(PluginProvider.kt:23) at com.intellij.vcs.commit.AbstractCommitMessagePolicy.getCommitMessageFromProvider(AbstractCommitMessagePolicy.kt:31) at com.intellij.vcs.commit.AbstractCommitMessagePolicy.getCommitMessageForList(AbstractCommitMessagePolicy.kt:20) at com.intellij.vcs.commit.ChangesViewCommitMessagePolicy.getCommitMessage(ChangesViewCommitMessagePolicy.kt:49) at com.intellij.vcs.commit.ChangesViewCommitMessagePolicy.init(ChangesViewCommitMessagePolicy.kt:16) at com.intellij.vcs.commit.ChangesViewCommitWorkflowHandler.<init>(ChangesViewCommitWorkflowHandler.kt:80) at com.intellij.openapi.vcs.changes.ChangesViewWorkflowManager.updateCommitWorkflowHandler(ChangesViewWorkflowManager.java:69) at com.intellij.openapi.vcs.changes.ChangesViewWorkflowManager.lambda$new$0(ChangesViewWorkflowManager.java:44) at com.intellij.util.messages.impl.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:696) at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:659) ... 50 more

Images:
jira-commit-plugin-crash

  • IntelliJ version: 2023.2 Community Edition
  • Plugin version: 3.4.0
  • OS: Windows

Thank you in advance.

@nemwiz
Copy link
Owner

nemwiz commented Aug 19, 2023

Is the project that shows the error using another version control system like SVN?
We've had this issue before. It happens when another version control system is used and this plugin only supports Git

@cquilezg
Copy link
Author

Hi nemwiz,
Not the case, I'm using Git in all my projects.

@nemwiz
Copy link
Owner

nemwiz commented Aug 21, 2023

For some reason the plugin can't find the repository, at least that is what the error message shows.

Could you confirm that you have a repository set up and that IntelliJ is aware of it? If you go to Settings -> Version Control -> Directory Mappings it should look something like this.
image

Since this is difficult to reproduce, you can help by answering these questions or trying some stuff on your end:

  • Has this bug started happening with the latest version of the plugin? This one was released a few days ago. You can install an older version and see if the issue is present
  • Is your project open source by chance so that I can try to run it?
  • This only appears when you open a new project not when clicking the icon or invoking the plugin?
  • Under Settings -> Version Control -> Commit is the option Use non-modal commit interface checked or not?
  • In the top menu under Help -> Show log in Explorer you can find logs from IntelliJ. If you open .log file you can search for jiracommitmessage to find the logs produced by the plugin. See if there is anything interesting there.

Thanks

@cquilezg
Copy link
Author

Yes, I have the Git repo configured. This screenshot is from a repo that fails:
image

  • I don't know if this problem was present in previous versions, but I don't remember it. I'm going to install an older version and try it a few days to check it.
  • My project is not open source, sorry, but I'll try to find one to test it.
  • This only appears when I open a project, not necessarily a new project. This not happens when I click the icon.
  • The opction Use non modal commit interface is checked.
  • What I've seen in the logs is that it fails trying to get the project repository branch.
    image

It fails at this line:
image

Maybe the repository list is not available at that point.

@nemwiz
Copy link
Owner

nemwiz commented Sep 23, 2023

I was a bit puzzled why the plugin runs when you open the project, but as specified in the documentation, when you are using non modal commit interface, the plugin will run on startup.

Now I still don't know why you get an error - it could be some timing issue with your repo not being ready when project is open or similar. What I can do is fix the issue in my code. It's not wise to rely that repositories list will be populated so now I explicitly check for that. This should stop IntelliJ from throwing an exception.

Could you test it out? You can install this version by going to Plugins -> Click the cog icon -> Install plugin from disk
jira-commit-message-3.4.1.zip

@cquilezg
Copy link
Author

Hi nemwiz,

Thanks for the fix. I just installed the plugin and have tested it on several projects. At the moment I am not receiving errors. I will write to you in a few days and confirm if I still have no problems.

Thank you so much.

@nemwiz nemwiz mentioned this issue Sep 23, 2023
@nemwiz
Copy link
Owner

nemwiz commented Oct 12, 2023

Hi @carmeloquilez,

How is it going with the testing? If there are no more errors, I'd like to release the new version.

Thanks

@cquilezg
Copy link
Author

Hi @nemwiz,

Sorry, I've been away for a few days.

I haven't had any more errors. The fix works.

Thanks for your time.

@nemwiz
Copy link
Owner

nemwiz commented Oct 27, 2023

Awesome, I just published a new version. Thank you for reporting.

@nemwiz nemwiz closed this as completed Oct 27, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants