Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SonarQube 10.4 compatibility fixes #873

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

GreyTeardrop
Copy link
Contributor

@GreyTeardrop GreyTeardrop commented Feb 15, 2024

When installed into SonarQube 10.4, community-branch-plugin fails with

Caused by: java.lang.NoSuchMethodError: 'io.jsonwebtoken.JwtBuilder io.jsonwebtoken.JwtBuilder.setExpiration(java.util.Date)'
	at com.github.mc1arke.sonarqube.plugin.almclient.github.v3.RestApplicationAuthenticationProvider.getInstallationToken(RestApplicationAuthenticationProvider.java:81)
	at com.github.mc1arke.sonarqube.plugin.almclient.github.DefaultGithubClientFactory.createClient(DefaultGithubClientFactory.java:56)
	at com.github.mc1arke.sonarqube.plugin.server.pullrequest.validator.GithubValidator.validate(GithubValidator.java:43)
	at com.github.mc1arke.sonarqube.plugin.server.pullrequest.ws.binding.action.ValidateBindingAction.validateProject(ValidateBindingAction.java:73)
	at com.github.mc1arke.sonarqube.plugin.server.pullrequest.ws.binding.action.ValidateBindingAction.lambda$handleProjectRequest$0(ValidateBindingAction.java:58)
	at java.base/java.util.Optional.ifPresent(Unknown Source)
	at com.github.mc1arke.sonarqube.plugin.server.pullrequest.ws.binding.action.ValidateBindingAction.handleProjectRequest(ValidateBindingAction.java:58)
	at com.github.mc1arke.sonarqube.plugin.server.pullrequest.ws.binding.action.ProjectWsAction.handle(ProjectWsAction.java:73)
	at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:114)
	at org.sonar.server.platform.web.WebServiceFilter.doFilter(WebServiceFilter.java:84)
	at org.sonar.server.platform.web.MasterServletFilter$JavaxFilterAdapter.doFilter(MasterServletFilter.java:227)
	at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:198)
	at org.sonar.server.platform.web.MasterServletFilter$HttpFilterChainAdapter.doFilter(MasterServletFilter.java:241)
	at org.sonar.server.platform.web.SonarLintConnectionFilter.doFilter(SonarLintConnectionFilter.java:66)
	at org.sonar.server.platform.web.MasterServletFilter$JavaxFilterAdapter.doFilter(MasterServletFilter.java:227)
	at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:198)
	at org.sonar.server.platform.web.MasterServletFilter.doFilter(MasterServletFilter.java:146)
	at jdk.internal.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.security.SecurityUtil.lambda$execute$0(SecurityUtil.java:222)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Unknown Source)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:250)
	... 141 common frames omitted

That seems to be a binary compatibility issue - the method io.jsonwebtoken.JwtBuilder.setExpiration is still available to the code (inherited from the io.jsonwebtoken.ClaimsMutator), however, it used to be explicitly overridden in the io.jsonwebtoken.JwtBuilder and now it's not.

Simply rebuilding the project against SonarQube 10.4 was enough to make it work - I'm able to get PR annotations with the rebuilt plugin.

This PR also tackles a few deprecations caused by JJwt 0.11.x -> 0.12.x upgrade in SonarQube 10.4. There are, however, more deprecations in the SonarQube API that are not required yet for the plugin to work.


Fixes #870

@GreyTeardrop GreyTeardrop marked this pull request as ready for review February 15, 2024 14:42
@GreyTeardrop GreyTeardrop changed the title Sonarqube 10.4 compatibility fixes SonarQube 10.4 compatibility fixes Feb 15, 2024
@man-andy

This comment was marked as duplicate.

@GreyTeardrop

This comment was marked as duplicate.

@PaulBol

This comment was marked as duplicate.

@nklarman

This comment was marked as duplicate.

@mericozkayagan

This comment was marked as duplicate.

@markoftw
Copy link

The new version is now 10.4.1.88267

@Survival1sm
Copy link

Myself and my team are looking forward to this PR as well!

@wang-xiaowu

This comment was marked as off-topic.

@gjabouley-invn
Copy link

gjabouley-invn commented Mar 26, 2024

The new version is now 10.4.1.88267

Looks like the release note contains only a fix about database connections issues (https://community.sonarsource.com/t/sonarqube-10-4-1-released/109966)

Plugin built for 10.4.0 should be compatible with 10.4.1

Generally speaking, SQ patch releases only contains fixes, ie. does not introduce any breaking changes.
So this plugin could be released with x.y.0 dependency.

@gjabouley-invn
Copy link

:-) is there any progressions here

For the impatients (so you can test out your upgrade for example), you can download the SNAPSHOT version directly from this PR: https://github.com/mc1arke/sonarqube-community-branch-plugin/actions/runs/7917642518/artifacts/1273134084

Updates to the latest Sonarqube minor version, including changes
to the Github decorator to handle changes in the JTW library method
signatures inherited from Sonarqube core, and test only changes to
the Class Loader code built into Sonarqube.
@mc1arke mc1arke merged commit 929154b into mc1arke:master Apr 8, 2024
7 checks passed
@mc1arke
Copy link
Owner

mc1arke commented Apr 8, 2024

Merged, thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Sonarqube 10.4 support
10 participants