# SonarCloud analysis failed with NullPointerException

**URL:** <https://community.sonarsource.com/t/sonarcloud-analysis-failed-with-nullpointerexception/18749>\
**Category:** SonarQube Cloud\
**Tags:** sonarqube-cloud, java\
**Created:** [January 14, 2020, 4:45pm UTC](https://community.sonarsource.com/t/sonarcloud-analysis-failed-with-nullpointerexception/18749 "2020-01-14T16:45:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Helayxa](https://avatars.discourse-cdn.com/v4/letter/h/e79b87/32.png) [@Helayxa](https://community.sonarsource.com/u/Helayxa)\
**Post date:** [January 14, 2020, 4:45pm UTC](https://community.sonarsource.com/t/sonarcloud-analysis-failed-with-nullpointerexception/18749/1 "2020-01-14T16:45:43Z")

</div>

Since January 7, 2020, all our Jenkins build are failing on the Sonar analysis step, always on the same Java test class.

We’re using SonarCloud, we haven’t modified the file since October, and the error log is :

```auto
org.sonar.java.AnalysisException: SonarQube is unable to analyze file : '...'
	at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:108)
	at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:65)
	at org.sonar.java.JavaSquid.scanTests(JavaSquid.java:117)
	at org.sonar.java.JavaSquid.scan(JavaSquid.java:106)

```

…

```auto
Caused by: java.lang.NullPointerException at org.eclipse.jdt.core.dom.DefaultBindingResolver.lookupEnvironment(DefaultBindingResolver.java:605)
	at org.eclipse.jdt.core.dom.ASTUtils.mayTolerateMissingType(ASTUtils.java:36)
	at org.sonar.java.model.JParser.parse(JParser.java:315)
	at org.sonar.java.model.JParser.parse(JParser.java:249)
	at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:93)

```

I can’t give you any reproduction step, but maybe I can give some piece of code to help you ?

---

<div class="post-metadata">

**Author:** ![Michael](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/michael/32/43_2.png) [@Michael](https://community.sonarsource.com/u/Michael)\
**Post date:** [January 17, 2020, 2:06pm UTC](https://community.sonarsource.com/t/sonarcloud-analysis-failed-with-nullpointerexception/18749/2 "2020-01-17T14:06:35Z")

</div>

Hello @Helayxa,

Thanks for the feedback. It is most probably related to the update of SonarCloud from SonarJava version 5.14 to 6.0 (and now 6.0.1).

In order to help you, could you share the test class code? You can send it to me privately if needed.  
If you also manage to reduce the case to a small self-contained reproducer (without dependencies to code outside of the JDK), it would also help quite a lot.

- Is this test class particularly different from others?
- Is it the first test class to be analyzed which fails, or it is in the middle of the analysis?
- Which scanner are you using for your analysis? (maven / gradle / sonar-scanner)

As a temporarily workaround, I would advise to temporarily exclude the test class from analysis, while we are investigating the issue and trying to reproduce it on our side.

Cheers,  
Michael

---

<div class="post-metadata">

**Author:** ![Helayxa](https://avatars.discourse-cdn.com/v4/letter/h/e79b87/32.png) [@Helayxa](https://community.sonarsource.com/u/Helayxa)\
**Post date:** [January 17, 2020, 2:23pm UTC](https://community.sonarsource.com/t/sonarcloud-analysis-failed-with-nullpointerexception/18749/4 "2020-01-17T14:23:30Z")

</div>

Hi @Michael

Thanks a lot for your answer !  
I’m still investigating about this issue (to give you the maximum of reproduction informations), but I can’t publish some code here. How can I contact you privately to give it to you ?

Thanks a lot.  
Axel

---

<div class="post-metadata">

**Author:** ![Michael](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/michael/32/43_2.png) [@Michael](https://community.sonarsource.com/u/Michael)\
**Post date:** [January 17, 2020, 2:30pm UTC](https://community.sonarsource.com/t/sonarcloud-analysis-failed-with-nullpointerexception/18749/5 "2020-01-17T14:30:05Z")

</div>

I sent you a private message regarding this 🙂

---

<div class="post-metadata">

**Author:** ![Michael](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/michael/32/43_2.png) [@Michael](https://community.sonarsource.com/u/Michael)\
**Post date:** [February 10, 2020, 5:01pm UTC](https://community.sonarsource.com/t/sonarcloud-analysis-failed-with-nullpointerexception/18749/6 "2020-02-10T17:01:59Z")

</div>

Hey @Helayxa,

Just to let you know that SonarJava 6.0.2 has been released and deployed on SonarCloud. It should correctly recover from such exception now. I would appreciate if you could give it a try and let me know if things are working now.

Regards,  
Michael

---

<div class="post-metadata">

**Author:** ![Helayxa](https://avatars.discourse-cdn.com/v4/letter/h/e79b87/32.png) [@Helayxa](https://community.sonarsource.com/u/Helayxa)\
**Post date:** [February 12, 2020, 4:41pm UTC](https://community.sonarsource.com/t/sonarcloud-analysis-failed-with-nullpointerexception/18749/7 "2020-02-12T16:41:15Z")

</div>

Hi @Michael

Thanks a lot for your message. I can confirm that we don’t have the issue anymore. We remove every exclusions, and Sonar analysis are fine !  
Thanks for the work.
