av线上观看_丁香花高清视频完整版在线观看_国产小视频在线_欧美激情一区二区三区全黄

Findbugs中的過濾

2017-02-14 09:32:40來源:威易網作者:joe

我們部分產品中發現Findbugs檢查有以下錯誤:Type MS_SHOULD_BE_FINAL

我們部分產品中發現Findbugs檢查有以下錯誤:

Type MS_SHOULD_BE_FINAL

This static field public but not final, and could be changed by malicious code or by accident from another package. The field could be made final to avoid this vulnerability.

這個類型的錯誤屬于設計上不夠嚴謹,但由于歷史代碼修改比較多,所以我們可以對這個錯誤告警進行過濾。

具體方法如下:

增加一個過濾文件

我這里命名為:findbugs-exclude.xml

<FindBugsFilter>
    <Match>
        <Bug pattern="MS_SHOULD_BE_FINAL" />
    </Match>
</FindBugsFilter>

修改pom.xml

在findbugs中增加配置:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>findbugs-maven-plugin</artifactId>
    <version>3.0.4</version>
    <configuration>
         <excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
    </configuration>
</plugin>

現在這個問題就不會再告警了。

不過,我們還是要嚴謹的對待Findbugs和PMD提醒我們的問題。

關鍵詞:Findbugs

相關閱讀: