<dd id="sga4y"><optgroup id="sga4y"></optgroup></dd>
<nav id="sga4y"><code id="sga4y"></code></nav>
  • <optgroup id="sga4y"></optgroup>

    Dead Code: Empty Try Block

    ABSTRACT

    空 try 塊是 dead code 或者表示存在調試代碼。

    EXPLANATION

    空 try 塊沒有任何用處。事實上,當編譯成字節代碼時,優化操作會去除空 try 塊,并且不會將其包含在完成的程序中。空 try 塊可能表示被刪除或注釋掉的代碼。
    例 1:下列代碼包含空 try 塊。


    try {
    //rs = stmt.executeQuery(query);
    }
    catch (SQLException e) {
    log(e);
    }

    Dead code 對 code quality 有負面影響,會使代碼更難于讀取、理解和維護。

    REFERENCES

    [1] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP3050 CAT II

    [2] Standards Mapping - Security Technical Implementation Guide Version 3.4 - (STIG 3.4) APP3050 CAT II

    [3] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 561

    [4] Sun Microsystems, Inc. Java Sun Tutorial


    Copyright 2013 Fortify Software - All rights reserved.
    (Generated from version 2013.1.1.0008 of the Fortify Secure Coding Rulepacks)
    desc.structural.java.dead_code_empty_try_block

    97av