How to fix SecurityException from class org.eclipse.jdt.core.dom.ASTUtils?

I am trying to Consume Sonar API , During file scanning getting below issue , I have tried sonar community but still struggling to fix…Please anyone help me to resolve this issue

Caused by: java.lang.SecurityException: class “org.eclipse.jdt.core.dom.ASTUtils”'s signer information does not match signer information of other classes in the same package
** at java.base/java.lang.ClassLoader.checkCerts(**
** at java.base/java.lang.ClassLoader.preDefineClass(**
** at java.base/java.lang.ClassLoader.defineClass(**
** at java.base/**
** at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(**
** at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(**
** at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(**
** at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(**
** at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(**
** at java.base/java.lang.ClassLoader.loadClass(**
** at**
** at**
** at$FileByFile.parse(**
** … 5 more**

Hey there.

What version of SonarQube / the API are you using? In what contest are you receiving an error – while building your project? While performing a scan?

1 Like

Hello Colin,
Thanks for your response. I fixed this issue “Sonar Version mismatch”,

Hello Colin & Team,
I am currently working to automate sonar issues using Rules In my local, I am not able to do this job,
For example,
I am taking StringToStringCheckTest class, I would like to work without below code

String string = "hello".toString(); // Noncompliant [[sc=21;ec=28;quickfixes=qf1]]
	    // fix@qf1 {{Remove "toString()"}}
	    // edit@qf1 [[sc=28;ec=39]] {{}}

While execute I got this error

Exception in thread "main" java.lang.AssertionError: Unexpected at [9]

Please give me any good solution to automate fix sonar issue using Rule or without Rule,

Hey there.

To make sure I understand correctly, you get that error when you remove this block of code?

1 Like

Hello Colin,
Yes, you are correct, When i remove a block of code, I receive the error.
but I would like to use without this commented codes because of i am using webapi https://***********.com/api/issues/search?severities=MAJOR&componentKeys=branch=test&statuses=OPEN&asc=false based on the API results, I should apply the rules

First of all, when I removed those three lines, the code still compiles successfully (with tests run).

Secondly, I think I understand more what you’re speaking about – while yes, java:s125 is being raised on this code, these comments are actually a part of how the Sonar API runs the tests (it indicates which code is noncompliant and what columns are a part of the issue. Removing the comments will likely cause the tests to get confused and fail.

As a result, when we (SoanarSource) scan the code, we ignore these issues on these directories to prevent the issues from being raised at all.

1 Like

Okay, I understood your points. I am trying to do an automatic fix for some sonar issues. Do you have any suggestions?
Automatic fix like walkmod?