US

Sonar扫描的NPE问题

直到我修改为这样的代码才通过——


public class DetectorImport {
    public String check1(Nonentity nonentity) {
        String s;
        if(nonentity == null) {
            s = null;
        }else {
            s = nonentity.getName();
        }
        if(s !=null) {
            s = s.replaceAll("(", "(");
        }
        return s;
    }
}


  
  
  

Basic-Javaagent

link on JianShu

man java

 -javaagent:jarpath[=options]

Loads the specified Java programming language agent. For more information about instrumenting Java applications, see the java.lang.instrument package description in the Java API documentation at http://docs.oracle.com/javase/8/docs/api/java/lang/instrument/package-summary.html
文档说明部分介绍了基本概念

Provides services that allow Java programming language agents to instrument programs running on the JVM.

Basic-Kafka

link on JianShu

https://kafka.apache.org/quickstart

  • Java8 + Windows环境
  • Zookeeper环境

启动Server时,会提示java.lang.NumberFormatException: For input string: "initial.rebalance.delay.ms"错误,根据这里的提示,在window环境下执行:.\bin\windows\kafka-server-start.bat .\config\server.properties

可以正常启动——这里启动的还是kafka的server,用来连接zookeeper的server,需要先启动zk。否则会超时自动结束。

Basic-Kibana

link on JianShu

假装天天接触大数据的样子= =|

Basic的意思就是:了解这个东西是做什么的?如何配置安装?简单实用方法是怎样的?

有了这个概念,就可以上手操作。

Basic-SonarQube-SonarScanner

link on JianShu

SonarQube Continuous code quality made easy.

Start In Two Minute

  1. 下载 SonarQube downloads,使用Sonar qube 7.6版本,Java8支持;最新版本8.0,需要Java 11+
  2. 解压后将bin目录添加到环境变量
  3. 启动SonarQube服务 (默认会使用内置的数据库,可单独配置数据库)
# On Windows, execute:
C:\sonarqube\bin\windows-x86-xx\StartSonar.bat

# On other operating systems, as a non-root user execute:
/opt/sonarqube/bin/[OS]/sonar.sh console

# server log
...
jvm 1    | 2019.11.20 10:38:32 INFO  app[][o.s.a.SchedulerImpl] Process[ce] is up
jvm 1    | 2019.11.20 10:38:32 INFO  app[][o.s.a.SchedulerImpl] SonarQube is up


  
  
  

Sonar-Web-api(二)

link on JianShu

每个项目主页: http://example.sonar.com/dashboard?id=growth_client:restful-api-seller

主页的核心数据来源: http://example.sonar.com/api/measures/component?additionalFields=metrics,periods&component=projectGroup1:projectNameExample&metricKeys=alert_status,quality_gate_details,bugs,new_bugs,reliability_rating,new_reliability_rating,vulnerabilities,new_vulnerabilities,security_rating,new_security_rating,code_smells,new_code_smells,sqale_rating,new_maintainability_rating,sqale_index,new_technical_debt,coverage,new_coverage,new_lines_to_cover,tests,duplicated_lines_density,new_duplicated_lines_density,duplicated_blocks,ncloc,ncloc_language_distribution,projects,new_lines

最近一次current扫描时间信息: http://example.sonar.com/api/ce/component?component=projectGroup1:projectNameExample

{
    "queue":[

    ],
    "current":{
        "id":"AW7LG4x5rEHtiKcxk1nN",
        "type":"REPORT",
        "componentId":"AWvpaqUHahV-mFVL-A1-",
        "componentKey":"projectGroup1:projectNameExample",
        "componentName":"projectGroup1:projectNameExample",
        "componentQualifier":"TRK",
        "analysisId":"AW7LG5GFQzwg82DVBAfm",
        "status":"SUCCESS",
        "submittedAt":"2019-12-03T17:33:30+0800",
        "submitterLogin":"admin",
        "startedAt":"2019-12-03T17:33:31+0800",
        "executedAt":"2019-12-03T17:33:33+0800",
        "executionTimeMs":1694,
        "logs":false,
        "hasScannerContext":true,
        "organization":"default-organization",
        "warningCount":1,
        "warnings":[

        ]
    }
}


  
  
  

Sonar实践问题记录(一)

link on JianShu

跟踪了一天的问题,记录一下。

问题一:
目前最大的问题为获取Sonar数据时一直处于超时状态。

第一步,怀疑在超时时间内一直请求,相当于对server做了压力测试,导致server端假死。