HMYDK / AIGitCommit

This plugin uses AI to automatically generate commit messages based on the changes in your code.
https://plugins.jetbrains.com/plugin/24851-ai-git-commit?noRedirect=true
Apache License 2.0
8 stars 1 forks source link

Exception when generating commit message after updating #17

Open Thebluedragon7 opened 4 days ago

Thebluedragon7 commented 4 days ago

Issue

Exception is thrown in plugin when I try to generate commit after updating the plugin

Steps to reproduce

  1. update plugin
  2. click on Plugin Icon in commit panel or Generate AI Commit Message

image

image

Suggestions

A popup could be showed during this scenario

Stack Trace:

java.lang.NullPointerException: Cannot invoke "com.hmydk.aigit.config.ApiKeySettings$ModuleConfig.getApiKey()" because the return value of "java.util.Map.get(Object)" is null
    at com.hmydk.aigit.service.impl.GeminiService.checkNecessaryModuleConfigIsRight(GeminiService.java:49)
    at com.hmydk.aigit.service.CommitMessageService.checkNecessaryModuleConfigIsRight(CommitMessageService.java:23)
    at com.hmydk.aigit.GenerateCommitMessageAction.actionPerformed(GenerateCommitMessageAction.java:45)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.kt:374)
    at com.intellij.openapi.keymap.impl.ActionProcessor.performAction(ActionProcessor.java:32)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$actionProcessor$1.performAction(IdeKeyEventDispatcher.kt:499)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner$lambda$8$lambda$7(IdeKeyEventDispatcher.kt:850)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:109)
    at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:98)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner$lambda$8(IdeKeyEventDispatcher.kt:850)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.performWithActionCallbacks(ActionManagerImpl.kt:1173)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.kt:396)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner(IdeKeyEventDispatcher.kt:848)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.access$doPerformActionInner(IdeKeyEventDispatcher.kt:1)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.kt:577)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.kt:512)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.kt:451)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.kt:444)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.kt:306)
    at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.kt:606)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$22(IdeEventQueue.kt:565)
    at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteIntentReadAction(AnyThreadWriteThreadingSupport.kt:128)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:565)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$18$lambda$17$lambda$16$lambda$15(IdeEventQueue.kt:355)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:857)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$18$lambda$17$lambda$16(IdeEventQueue.kt:354)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$2$lambda$1(IdeEventQueue.kt:1045)
    at com.intellij.openapi.application.WriteIntentReadAction.lambda$run$0(WriteIntentReadAction.java:24)
    at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteIntentReadAction(AnyThreadWriteThreadingSupport.kt:128)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteIntentReadAction(ApplicationImpl.java:916)
    at com.intellij.openapi.application.WriteIntentReadAction.compute(WriteIntentReadAction.java:55)
    at com.intellij.openapi.application.WriteIntentReadAction.run(WriteIntentReadAction.java:23)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$2(IdeEventQueue.kt:1045)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$3(IdeEventQueue.kt:1054)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:117)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1054)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$18(IdeEventQueue.kt:349)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:395)
    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)
HMYDK commented 4 days ago

thx . i will fix it later .

Thebluedragon7 commented 4 days ago

hi @HMYDK , just found out that updating reset or removed my API Key, which resulted in this exception. It occurs for both cases (when there's something to commit and when there's none).

I re-added my API keys now and it works fine but an appropriate popup would be more welcomed than a silent exception. I have updated the question/issue titles.

HMYDK commented 4 days ago

Thank you for your suggestion and for reproducing this bug scenario. I will implement a fix for this in the next minor release.