我很难理解如何将存储在body中的变量作为throwException的参数传递。 这是我的代码:
select ITEM_ID, STATE, sum(SecondsDifference) SecondsDifference
from(
select ITEM_ID, STATE, (lead(state_start_ts,1) over(partition by ITEM_ID order by state_start_ts) - state_start_ts) * 24 * 60 * 60 SecondsDifference
from(
select openLog.ITEM_ID,
case when openLog.OPEN_TS > STATE_START_TS and openLog.OPEN_TS < lead(STATE_START_TS,1) over(partition by openLog.ITEM_ID order by state_start_ts)
then openLog.OPEN_TS
when openLog.CLOSE_TS < STATE_START_TS then openLog.CLOSE_TS
else STATE_START_TS end STATE_START_TS,
stateLog.STATE
from openLog
join stateLog on openLog.ITEM_ID = stateLog.ITEM_ID))
group by ITEM_ID, STATE
当我运行应用程序时,传递给ErrorHandling的消息是
.when(simple("${body[errorCode]} contains '101'"))
.throwException(new IllegalArgumentException(
"Action not allowed- Error code:" + ${body[errorCode]))
.otherwise()
有什么建议吗? TNKS。
答案 0 :(得分:0)
所以你在Java中使用Simple语言,但是你有一些语法问题。没什么大不了的。您没有完成Simple表达式的分隔符。你也没有连接字符串。
更改代码:
.throwException(new IllegalArgumentException("Action not allowed- Error code:" + ${body[errorCode]))
要: .throwException(new IllegalArgumentException(“Action not allowed-错误代码:$ {body [errorCode]}”))
我在使用我的手机,因此无法检查代码是否运行但它应该指向正确的方向。
答案 1 :(得分:0)