<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>

                    Poor Style: Non-final Public Static Field

                    ABSTRACT

                    外部類可更改非最終公共靜態字段。

                    EXPLANATION

                    通常情況下,您不會希望為外部類提供對象成員字段的直接訪問路徑,因為任意外部類都可以更改公共字段。面向對象的良好設計使用 Encapsulation 來防止將實現詳細信息(例如成員字段)暴露給其他類。此外,如果系統假定此字段不可更改,則惡意代碼可能能夠逆向更改系統的行為。
                    '
                    例 1:在下列代碼中,字段 ERROR_CODE 已聲明為公共、靜態和非最終。


                    public class MyClass
                    {
                    public static int ERROR_CODE = 100;
                    //...
                    }


                    在這種情況下,惡意代碼可能能夠更改此錯誤代碼并導致程序出現意外行為。

                    REFERENCES

                    [1] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 493

                    [2] Sun Microsystems, Inc. Secure Coding Guidelines for the Java Programming Language, version 2.0


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

                      <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>

                                      这里只有精品视频