JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
Serialization for a class has not been explicitly disabled by
defining a writeObject() method that always throws an
exception.
| クラス名 | Serialization Not Disabled (Java) | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 日本語クラス名 | Serialization Not Disabled (Java) | |||||||||||||||||||||||||||
| クラス分類 | 信頼性 (reliability) | |||||||||||||||||||||||||||
| ニーモニック | JAVA.CLASS.SER.ND | |||||||||||||||||||||||||||
| カテゴリー |
|
|||||||||||||||||||||||||||
| 対応言語 | Available for Java and Kotlin. |
|||||||||||||||||||||||||||
| 有効/無効設定 | このワーニングクラスのチェックはデフォルトで無効になっています。チェックを有効にするにはプロジェクト設定ファイル
(configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += allow class="Serialization Not Disabled (Java)" |
In the following code excerpt, class MyWindow is serializable (because it extends serializable class JFrame).
However, the programmer has annotated the class with @SuppressWarnings("serial"), suppressing any compiler warnings about the missing serialVersionUID field. CodeSonar observes this suppression and reasons that the programmer does not intend the class to be serialized. However, serialization has not been explicitly disabled.
// MyWindow.java import javax.swing.JFrame; @SuppressWarnings("serial") public class MyWindow extends JFrame { // "Serialization Not Disabled" warning issued here private final int secret; public MyWindow(int secret) { this.secret = secret; } }
In this example, the programmer should explicitly prevent serialization of class MyWindow, as follows.
// MyWindow.java, after modification
import java.io.ObjectOutputStream;
import javax.swing.JFrame;
@SuppressWarnings("serial")
public class MyWindow extends JFrame {
private final int secret;
public MyWindow(int secret) {
this.secret = secret;
}
private void writeObject(ObjectOutputStream stream) {
throw new RuntimeException("Serialization is not allowed");
}
}
設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。
To report problems with this documentation, please visit https://support.codesecure.com/.