# NullPointerException Issue Not Detected in Analysis

**URL:** <https://community.sonarsource.com/t/nullpointerexception-issue-not-detected-in-analysis/131864>\
**Category:** SonarQube Server / Community Build\
**Tags:** java\
**Created:** [December 9, 2024, 8:19pm UTC](https://community.sonarsource.com/t/nullpointerexception-issue-not-detected-in-analysis/131864 "2024-12-09T20:19:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafael\_Machado](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/rafael_machado/32/48174_2.png) [@Rafael\_Machado](https://community.sonarsource.com/u/Rafael_Machado)\
**Post date:** [December 9, 2024, 8:19pm UTC](https://community.sonarsource.com/t/nullpointerexception-issue-not-detected-in-analysis/131864/1 "2024-12-09T20:19:15Z")

</div>

Hello everyone,  
I was expecting SonarQube to detect a potential NullPointerException issue during the analysis, specifically in the **getOperacionItemID()** method. However, this issue was not flagged. I also tried using annotations like @NonNull in the method, but it didn’t work.

Version: 10.6.0-community  
Implementation: Docker  
Project: java 11

OperacionItemVO

```auto
	public Long getOperacionItemID() {
		return (Long) getValorAtributo("OperacionItemID");
	}

```

OperacionItemProductoVO (extends OperacionItemVO)

```auto
		ISqlWhere where = new SqlWhere();
		if (tipoRol == WorkflowCTE.TIPO_ROL_ORIGEN) {
			where.addCondition(
					new SqlTerm(new SqlField(BSTables.TABLA_OPERACIONITEMCANCELACION,
							"OperacionItemIDOrigen", "OperacionItemIDOrigen"), SqlConstants.IGUAL,
							this.getOperacionItemID().toString(), Types.INTEGER, true),
					SqlConstants.AND);
		}else{
			where.addCondition(
					new SqlTerm(new SqlField(BSTables.TABLA_OPERACIONITEMCANCELACION,
							"OperacionItemIDDestino", "OperacionItemIDDestino"), SqlConstants.IGUAL,
							this.getOperacionItemID().toString(), Types.INTEGER, true),
					SqlConstants.AND);
		}

```

Could this be a configuration issue, or is there something specific about the code that prevents SonarQube from detecting it?  
Thank you, Rafael

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [December 10, 2024, 1:35pm UTC](https://community.sonarsource.com/t/nullpointerexception-issue-not-detected-in-analysis/131864/2 "2024-12-10T13:35:52Z")

</div>

Hi,

I guess you’re talking about `java:S2259`. This is a rule we haven’t worked on in a while because the technology we built it with isn’t (as you’ve seen) the best. It’s been functionally replaced with `javabugs:S6555`, which is available in SonarQube Server (i.e. commercial editions).

&nbsp;  
HTH,  
Ann

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [December 17, 2024, 1:36pm UTC](https://community.sonarsource.com/t/nullpointerexception-issue-not-detected-in-analysis/131864/3 "2024-12-17T13:36:23Z")

</div>

Closed on December 17, 2024, 1:36pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
