使用二进制文字分析代码时出现SonarQube错误 [英] SonarQube error while analyzing code with binary literals

查看:157
本文介绍了使用二进制文字分析代码时出现SonarQube错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用SonarQube分析我的基于Jenkins的项目.在我的项目中,我用二进制系统编写了一些文字(例如0b00001111).

I want to use SonarQube to analyse my project which is built on Jenkins. In my project I have some literals written in binary system (e.g. 0b00001111).

当我尝试进行分析时,我得到了休闲的错误:

When I'm trying to do an analysis, I am obtaining fallowing error:

[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli) on project org: 
SonarQube is unable to analyze file : 'whatever': For input string: "b00001111" -> [Help 1]
[...]
Caused by: java.lang.NumberFormatException: For input string: "b00001111"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:589)
at java.lang.Long.valueOf(Long.java:776)
at java.lang.Long.decode(Long.java:928)
at org.sonar.java.checks.SillyBitOperationCheck.evaluateExpression(SillyBitOperationCheck.java:101)
....

版本信息:

SonarQube Jenkins插件版本:2.2.1

SonarQube Jenkins plugin version: 2.2.1

SonarQube版本:5.1

SonarQube version: 5.1

SonarQube maven插件版本:2.5/2.6(我都尝试过)

SonarQube maven Plugin version: 2.5/2.6 (I've tried both of them)

在项目中,我正在使用JDK 1.8.我不知道如何检查SonarQube是否也使用1.8,但是我在Jenkins的SonarQube配置面板中选择了从项目继承".

In project I am using JDK 1.8. I don't know how to check if SonarQube is using also 1.8, but I've choosen "Inherit from Project" in SonarQube configuration panel in Jenkins.

推荐答案

我通过将Java插件更新为3.5解决了该问题

I solved the problem by updating the java plugin to 3.5

这篇关于使用二进制文字分析代码时出现SonarQube错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆