NullPointerException Issue Not Detected in Analysis

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

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

OperacionItemProductoVO (extends OperacionItemVO)

		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

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).

 
HTH,
Ann

1 Like

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