EXXETA / sonar-esql-plugin

Sonar plugin to analyze ESQL-sourcecode of IBM Integration Bus projects
Apache License 2.0
35 stars 34 forks source link

Unable to scan esql file, getting null pointer exception #118

Closed vipul-bhardwaj closed 4 years ago

vipul-bhardwaj commented 4 years ago

image

vipul-bhardwaj commented 4 years ago

`package com.exxeta.iss.sonar.esql.check;

import org.sonar.check.Rule;

import com.exxeta.iss.sonar.esql.api.tree.statement.DeclareStatementTree; import com.exxeta.iss.sonar.esql.api.visitors.DoubleDispatchVisitorCheck;

@Rule(key="BlobVariableName") public class BlobVariableNameCheck extends DoubleDispatchVisitorCheck{

@Override
public void visitDeclareStatement(DeclareStatementTree tree){
        if(tree.dataType().dataType().text().toUpperCase().equals("BLOB")) {
            for(int i=0;i<tree.nameList().size();i++) {
                if(!tree.nameList().get(i).name().startsWith("blob")) {
                    addIssue(tree,"Blob Variable Name: "+tree.nameList().get(i).name()+" must start with blob");
                }
            }
        }
}

}`

ThomasPohl commented 4 years ago

Hi @vipul-bhardwaj , can you provide the esql file or the relevant part of it? Then it should be easy to fix this issue.

ThomasPohl commented 4 years ago

Is BlobVariableNameCheck a rule you defined somewhere else? I think it's not part of the current codebase.

vipul-bhardwaj commented 4 years ago

Hi Thomas,

This issue is resolved now. Thanks for the concern.