0

以下のようにグローバル関数を定義しました

<configuration doc:name="Configuration">
    <expression-language autoResolveVariables="true">
        <import class="java.text.SimpleDateFormat" />
        <global-functions>
            def convertDate(shiftDate){
                dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                return dateFormat.format(shiftDate);
            }            
        </global-functions>         
    </expression-language>
</configuration>

しかし、ロガー経由で呼び出すと何も起こらないようです

<logger message="Convert Date #[convertDate(xpath://address/@timestamp)]" level="DEBUG" doc:name="Logger"/>

xpath 式 xpath://address/@timestamp は 2014-10-29T15:23:07 を生成します

しかし、私が見るロガーの前に

xpath-branch:/address/@timestamp is: org.dom4j.tree.DefaultAttribute@6452310a [属性: name タイムスタンプ値 "2014-10-29T15:23:07"]

エラーメッセージは以下の通り

org.mule.api.expression.InvalidExpressionException: [Error: unexpected end of statement]
[Near : {... convertDate(xpath://address/@payloadID) ....}]

ここで何が間違っていますか?どうもありがとう。

4

1 に答える 1