Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Uncaught TypeError: Cannot read property '0' of null #30

Closed
coderbond007 opened this issue Sep 26, 2017 · 19 comments
Closed

Uncaught TypeError: Cannot read property '0' of null #30

coderbond007 opened this issue Sep 26, 2017 · 19 comments

Comments

@coderbond007
Copy link

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.21.0-beta1 x64
Electron: 1.6.9
OS: Microsoft Windows 10 Home Single Language
Thrown From: ide-java package 0.6.2

Stack Trace

Uncaught TypeError: Cannot read property '0' of null

At C:\Users\user\.atom\packages\ide-java\lib\main.js:89

TypeError: Cannot read property '0' of null
    at ChildProcess.childProcess.on.exitCode (/packages/ide-java/lib/main.js:89:45)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

Commands

     -3:07.7.0 welcome:show (atom-pane.pane)
  2x -2:43.9.0 core:backspace (input.hidden-input)
     -2:41.6.0 core:confirm (input.hidden-input)
 14x -2:23.6.0 core:backspace (input.hidden-input)
     -2:19.7.0 core:confirm (input.hidden-input)

Non-Core Packages

atom-ide-ui 0.3.3 
ide-java 0.6.2 
@damieng
Copy link
Contributor

damieng commented Sep 26, 2017

What version of the Java runtime do you have installed and is it on your path?

Both answers can be had by typing java --showversion -version from a command prompt window.

@jbree
Copy link
Contributor

jbree commented Sep 26, 2017

Same issue. Included my version of Java in case it helps.

  1. Add project folder
  2. Open .java file

Atom: 1.21.0-beta1 x64
Electron: 1.6.9
OS: Ubuntu 17.04
Thrown From: ide-java package 0.6.2

Stack Trace

Uncaught TypeError: Cannot read property '0' of null

At /home/jbreeden/.atom/packages/ide-java/lib/main.js:89

TypeError: Cannot read property '0' of null
    at ChildProcess.childProcess.on.exitCode (/packages/ide-java/lib/main.js:89:45)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

Commands

     -0:25.3.0 application:add-project-folder (input.hidden-input)
     -0:10.7.0 fuzzy-finder:toggle-file-finder (div.tool-panel.tree-view)
     -0:09.0 core:select-all (input.hidden-input)
     -0:08.5.0 core:backspace (input.hidden-input)
  2x -0:06.5.0 core:move-down (input.hidden-input)
     -0:04.7.0 core:move-up (input.hidden-input)
     -0:03.9.0 core:confirm (input.hidden-input)

Non-Core Packages

atom-beautify 0.30.5 
atom-ide-ui 0.4.0 
atom-maven 1.3.0 
behave-theme 1.7.0 
build 0.68.0 
busy 0.7.0 
busy-signal 1.4.3 
docblockr 0.11.0 
file-icons 2.1.12 
fonts 3.0.3 
git-diff-details 1.4.0 
ide-clangd 0.1.2 
ide-java 0.6.2 
intentions 1.1.5 
java-package-view 0.0.0 
language-autotools 2.0.1 
language-cmake 0.3.0 
language-swift 0.5.0 
linter 2.2.0 
linter-eslint 8.3.2 
linter-jshint 3.1.6 
linter-jsonlint 1.3.0 
linter-ui-default 1.6.10 
linter-xmllint 1.4.3 
minimap 4.29.7 
minimap-git-diff 4.3.1 
minimap-pigments 0.2.2 
nucleus-dark-ui 0.12.3 
project-manager 3.3.5 
Sublime-Style-Column-Selection 1.7.4 
svn 0.0.13 
switch-header-source 0.22.1 
tability 0.0.0 
toggle-packages 1.1.0 
tree-view-autoresize 2.2.0 

Java version:

openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.17.04.3-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

@damieng
Copy link
Contributor

damieng commented Sep 26, 2017

I've pushed a 0.6.3 update that tries to grab the version output in multiple ways. Let me know if you still get the error or not after updating.

@jbree
Copy link
Contributor

jbree commented Sep 26, 2017

Still fails. I think the problem is with the regex on line 90:

/java version "(\d+.\d+).\d+_\d+"/

problem is, in openjdk, the string I get back is:
openjdk version "1.8.0_131"

@damieng
Copy link
Contributor

damieng commented Sep 26, 2017

Ah, OpenJDK. Have only tried it with the official Sun one. Will get another update out in a few minutes.

@jbree
Copy link
Contributor

jbree commented Sep 26, 2017

When I changed it to this, it fixed the issue for me:
/^\w+ version "(\d+.\d+).\d+_\d+"/

@damieng
Copy link
Contributor

damieng commented Sep 26, 2017

0.6.4 published with a similar fix.

@jbree
Copy link
Contributor

jbree commented Sep 26, 2017

Fixed for me, thx!

@damieng damieng closed this as completed Sep 26, 2017
@coderbond007
Copy link
Author

Same error showing again now the message is

C:\Users\user.atom\packages\ide-java\lib\main.js:91
Hide Stack Trace
TypeError: Cannot read property '0' of null
at ChildProcess.childProcess.on.exitCode (C:\Users\user.atom\packages\ide-java\lib\main.js:91:45)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

@damieng
Copy link
Contributor

damieng commented Sep 27, 2017

@coderbond007 can you type the following on your command line and report the results;

java --showversion -version

@coderbond007
Copy link
Author

coderbond007 commented Sep 27, 2017

I have Java version 9 (Windows 10). Build (9 + 181)

@damieng
Copy link
Contributor

damieng commented Sep 27, 2017

Can you post the exact results? That error is specifically in the area where we try to parse the result string to ensure it is 1.8 or later.

@coderbond007
Copy link
Author

coderbond007 commented Sep 27, 2017

C:\Users\user.atom\packages\ide-java\lib\main.js:91

TypeError: Cannot read property '0' of null
    at ChildProcess.childProcess.on.exitCode (C:\Users\user\.atom\packages\ide-java\lib\main.js:91:45)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

I pasted your command on Windows Command Prompt. Exact Results are

java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)

@damieng
Copy link
Contributor

damieng commented Sep 28, 2017

Hmm, looks like Java version 9 has a totally different version string :(

Will get an update out for this soon.

@jbree
Copy link
Contributor

jbree commented Sep 28, 2017

@damieng Do you mind if I take a crack at this?

@damieng
Copy link
Contributor

damieng commented Sep 28, 2017 via email

@damieng
Copy link
Contributor

damieng commented Sep 28, 2017

(and add unit tests to start covering the combinations of output messages)

@fbricon
Copy link
Contributor

fbricon commented Oct 2, 2017

Got the same issue. I suspect Atom picked up the default JDK 9 install to launch jdt.ls. When JDK 9 is used, the server should be launched with extra args, see https://github.com/redhat-developer/vscode-java/blob/40b6f2136f97e4879c615900241db7a8c3b0e087/src/javaServerStarter.ts#L50-L56

@damieng
Copy link
Contributor

damieng commented Oct 2, 2017

#35 fixes the null ref when given Java 9. We'll need to add those args as well it seems before putting out Java 9 support.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants