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

NullPointerException on GitContextImpl.retrieveRemoteAndBranchName #520

Closed
hohwille opened this issue Aug 6, 2024 · 2 comments · Fixed by #600 or #645
Closed

NullPointerException on GitContextImpl.retrieveRemoteAndBranchName #520

hohwille opened this issue Aug 6, 2024 · 2 comments · Fixed by #600 or #645
Assignees
Labels
bug Something isn't working git good first issue Good for newcomers

Comments

@hohwille
Copy link
Member

hohwille commented Aug 6, 2024

D:\projects\IDEasy>ideasy jmc
C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 7: basename: command not found
C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 7: sed: command not found
C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 22: .: git-sh-setup: file not found
Running command 'C:\Program Files\Git\cmd\git.exe' with arguments '--no-pager' 'pull' '--quiet' failed with exit code 1!
  feature/tomcat-test f9e4fb3a Update urls
* master              6be248d1 [origin/master] Update urls
Step 'ide (jmc)' failed: java.lang.NullPointerException
 Step 'Install java (21*)' failed: java.lang.NullPointerException
2 step(s) failed out of 2 steps.
An unexpected error occurred!
We are sorry for the inconvenience.
Please check the error below, resolve it and try again.
If the error is not on your end (network connectivity, lack of permissions, etc.) please file a bug:
https://github.com/devonfw/ide/issues/new?assignees=&labels=bug&projects=&template=bug.md&title=java.lang.NullPointerException
java.lang.NullPointerException
        at com.devonfw.tools.ide.context.GitContextImpl.retrieveRemoteAndBranchName(GitContextImpl.java:198)
        at com.devonfw.tools.ide.context.GitContextImpl.pull(GitContextImpl.java:186)
        at com.devonfw.tools.ide.context.GitContextImpl.pullOrClone(GitContextImpl.java:112)
        at com.devonfw.tools.ide.context.GitContextImpl.pullOrCloneIfNeeded(GitContextImpl.java:70)
        at com.devonfw.tools.ide.context.GitContextImpl.pullOrCloneAndResetIfNeeded(GitContextImpl.java:76)
        at com.devonfw.tools.ide.context.GitContext.pullOrCloneAndResetIfNeeded(GitContext.java:53)
        at com.devonfw.tools.ide.context.AbstractIdeContext.getUrls(AbstractIdeContext.java:548)
        at com.devonfw.tools.ide.repo.DefaultToolRepository.resolveVersion(DefaultToolRepository.java:35)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:157)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:144)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:132)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.doInstall(LocalToolCommandlet.java:77)
        at com.devonfw.tools.ide.tool.ToolCommandlet.install(ToolCommandlet.java:180)
        at com.devonfw.tools.ide.tool.ToolCommandlet.install(ToolCommandlet.java:169)
        at com.devonfw.tools.ide.tool.jmc.Jmc.doInstall(Jmc.java:37)
        at com.devonfw.tools.ide.tool.ToolCommandlet.install(ToolCommandlet.java:180)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.runTool(LocalToolCommandlet.java:332)
        at com.devonfw.tools.ide.tool.jmc.Jmc.run(Jmc.java:44)
        at com.devonfw.tools.ide.context.AbstractIdeContext.applyAndRun(AbstractIdeContext.java:921)
        at com.devonfw.tools.ide.context.AbstractIdeContext.run(AbstractIdeContext.java:859)
        at com.devonfw.tools.ide.cli.Ideasy.runOrThrow(Ideasy.java:88)
        at com.devonfw.tools.ide.cli.Ideasy.run(Ideasy.java:51)
        at com.devonfw.tools.ide.cli.Ideasy.main(Ideasy.java:28)
        at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
@hohwille hohwille added the bug Something isn't working label Aug 6, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Aug 6, 2024
@hohwille
Copy link
Member Author

hohwille commented Aug 9, 2024

@hohwille hohwille added good first issue Good for newcomers git labels Aug 9, 2024
@WorkingAmeise WorkingAmeise moved this from 🆕 New to 🏗 In progress in IDEasy board Aug 28, 2024
@WorkingAmeise
Copy link
Contributor

The error occurs, when you check out another branch than master in the URLs repository. When the method tries to get an upstream, there is a nullpointerexception, since the branch does not have one.
When catching the nullpointer commandlets work as intended, but we should inform the user, that he won't get updates on the URLs if he is not on branch master. Maybe we should even ask the user if we should switch to the master branch automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working git good first issue Good for newcomers
Projects
Status: ✅ Done
2 participants