redhat-developer / redhat-developer/vscode-java

TypeError: Cannot set properties of undefined (setting 'text')

Open
#2,701 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extension-start
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

I see below error message in console when spring-petclinic is opened. Not sure about how to reproduce it. But some potential NPE must be there.

TypeError: Cannot set properties of undefined (setting 'text')
	at Object.e.update (c:\Users\admin\.vscode\extensions\redhat.java-1.10.0-win32-x64\dist\extension.js:2:724923)
	at Object.<anonymous> (c:\Users\admin\.vscode\extensions\redhat.java-1.10.0-win32-x64\dist\extension.js:2:768615)
	at Generator.next (<anonymous>)
	at o (c:\Users\admin\.vscode\extensions\redhat.java-1.10.0-win32-x64\dist\extension.js:2:764166)

Location should be:

https://github.com/redhat-developer/vscode-java/blob/d6a2fd53b97f8518ece92cbae4d4b580c1aafe69/src/languageStatusItemFactory.ts#L146

@CsCherrYY Can you take a look?

BTW if possible, can we replace item: any to leverage the type check, which would be good to prevent such error.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/languageStatusItemFactory.ts#L146 and compare it with the update call shown in the stack trace. Investigate how the item can be undefined and whether replacing item: any with a specific TypeScript type exposes the problem. Done means identifying the cause and preventing the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.