Fix NPE in JRTUtil#1155
Conversation
|
@ jarthana @iloveeclipse can you take a look here, this is really annoying and currently makes working with the Java Search impossible in my Platform-IDE-SDK as it seems I have some project imported that triggers the NPE every time. |
|
Please rebase to get rid of #1150 issue. Also I believe your issue could be caused by eclipse-jdt/eclipse.jdt.debug#231 and your fix is applied at wrong place. I assume somehow the "autoimport" of JDK/JRE managed to setup invalid JDK/JRE. Please check that: which is now the default one and how to prevent importing that one in first place. |
I think this fix is good anyways, as obviously there can be
I'll check that, how would I identify such "invalid JDK"? If i look at the dialog it all looks quite usual I also selected each JDK and hit "edit" but no error was reported. |
If you can always reproduce your issue, try to debug it and see which JDK causes the problem. |
|
As it is on the batch-compiler it seems only system-out is printing something I started eclipse with a console now and see this error: #1154 (comment) |
In some cases JRTUtil#getJrtSystem() can return null what results in a NPE a caller most likley do not exspect. This adds required null checks and act accordingly. Fix eclipse-jdt#1154
|
@jarthana @iloveeclipse I have rebased this now and all tests seem green. If you think it should be fixed at another place I'm fine with that but this currently makes my Eclipse-Ide somewhat unuseable... |
I think if possible we should check the presence of that file on adding such JRE's.
Just remove or fix that Java 9 installation (/usr/lib/jvm/java-9-openjdk-amd64/release is missing). |
If you can point to the spec that it requires a |
Well, almost all of JDK internal structure is not spec'd, even ct.sym is not - should we now rewrite all of JDT code that relies on the JDK internals? You've complained about, and I've offered a solution that would immediately help. You don't need to apply this solution. Note: the problem with "broken" JDK will appear surely later on in some different code in JDT, you may not even notice where it will be because the search or call hierarchy would return only a subset of matches. |
And that's why I suggest to handle such cases... some of the methods are even throwing an exception so callers can handle / forward this, but the NPE bubbles up into an ugly error dialog I have to dismiss all the time. |
iloveeclipse
left a comment
There was a problem hiding this comment.
The change itself is not complete, but can be merged. I will push a follow up PR.
See #1170 |
Thanks I also has thought about it, but was not sure about the consequences (especially as it seems one needs to enable exceptions explicitly). The followup looks like a good path forward! |
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>
…fter importing org.eclipse.pde.ui Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com>

What it does
In some cases JRTUtil#getJrtSystem() can return null what results in a NPE a caller most likley do not exspect.
This adds required null checks and act accordingly.
Fix #1154
How to test
Author checklist