以下に示すように、「messageString」がnullでない場合、「messageString」を引数として渡して例外を呼び出しています
if (messageString !=null) {
throw new org.jaffa.exceptions.ApplicationExceptions(
new com.mirotechnologies.task.core.domain.exceptions.TaskException(
com.mirotechnologies.task.core.domain.exceptions.TaskException.MANDATORY_FIELD,
messageString
)
);
}
(AOPスニペット内にあるため、クラスのフルパスを記述する必要があります)
そうでない場合messageString
は正常に機能null
し、メッセージを適切に表示します。
しかし、それがの場合null
、実際には例外で実行時エラーをスローしています。
undefined argument 'messageString' at : throw new org.jaffa.exceptions.ApplicationExceptions(new com.mirotechnologies.task.core.domain.exceptions.TaskException(com.mirotechnologies.task.core.domain.exceptions.TaskException.MANDATORY_FIELD, messageString));
AOP 内にあるため、これをデバッグできません。また、null の場合にループ内に入る理由もわかりません - TaskException コンストラクターへのあいまいな null パラメーターのコンパイラの問題である可能性がありますか?
TaskException 内のコンストラクター宣言は次のとおりです。
public TaskException(String propertyName, Object parameter0) {
this(propertyName, new Object[] {parameter0});
}
public TaskException(String propertyName, Object[] parameters) {
super(propertyName, parameters);
}
messageString
Java スニペットでを渡すときにキャストを追加する必要がありますか?
更新: 例外をスローするときにキャスト (Object )messageString を追加しましたが、「void」値を java.lang.Object にキャストできないというエラーがスローされます。メッセージ文字列が null ですか?
最初に、最初の行は java.lang.String messageString = null; として宣言されます。