<pre id="vvttv"><mark id="vvttv"><progress id="vvttv"></progress></mark></pre>
    <pre id="vvttv"></pre>

      <p id="vvttv"></p>

          <p id="vvttv"></p>

                <p id="vvttv"></p>

                <pre id="vvttv"><cite id="vvttv"><progress id="vvttv"></progress></cite></pre>

                  <output id="vvttv"><dfn id="vvttv"><th id="vvttv"></th></dfn></output>

                    <p id="vvttv"></p>

                    Dead Code: Expression is Always false

                    ABSTRACT

                    此表達式(或部分表達式)的計算結果始終為 false。

                    EXPLANATION

                    此表達式(或部分表達式)的計算結果始終為 false;程序可以按一種更為簡單的方式重寫。而其附近代碼的出現可能是出于調試目的,或者可能沒有與程序中的其他代碼一同進行維護。該表達式還可能為我們指出方法中的錯誤所在。

                    例 1:以下方法將變量 secondCall 初始化為 false 后,將不會再對該變量進行設置。(變量 firstCall 被錯誤地使用了兩次。)這將會造成對表達式 firstCall && secondCall 的評估總為 false,從而再不會調用 setUpDualCall()


                    public void setUpCalls() {
                    boolean firstCall = false;
                    boolean secondCall = false;

                    if (fCall > 0) {
                    setUpFCall();
                    firstCall = true;
                    }
                    if (sCall > 0) {
                    setUpSCall();
                    firstCall = true;
                    }

                    if (firstCall && secondCall) {
                    setUpDualCall();
                    }
                    }


                    例 2:以下方法不會再將變量 firstCall 設為 false。(在首個條件語句后,變量 firstCall 被錯誤地設為 false。)其結果是,表達式 firstCall && secondCall 的第一部分的計算結果始終為 false。


                    public void setUpCalls() {
                    boolean firstCall = false;
                    boolean secondCall = false;

                    if (fCall > 0) {
                    setUpFCall();
                    firstCall = false;
                    }
                    if (sCall > 0) {
                    setUpSCall();
                    secondCall = true;
                    }

                    if (firstCall || secondCall) {
                    setUpForCall();
                    }
                    }

                    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 570


                    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_expression_is_always_false

                      <pre id="vvttv"><mark id="vvttv"><progress id="vvttv"></progress></mark></pre>
                      <pre id="vvttv"></pre>

                        <p id="vvttv"></p>

                            <p id="vvttv"></p>

                                  <p id="vvttv"></p>

                                  <pre id="vvttv"><cite id="vvttv"><progress id="vvttv"></progress></cite></pre>

                                    <output id="vvttv"><dfn id="vvttv"><th id="vvttv"></th></dfn></output>

                                      <p id="vvttv"></p>

                                      这里只有精品视频