question abt BuilderException: Check synta x #{property|(expression), var1=value1, var2=value2, ...}

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

question abt BuilderException: Check synta x #{property|(expression), var1=value1, var2=value2, ...}

jenius
Hi~

I have catch a builderException when I use mybatis 3.2.0 like below,since I know it caused by "#{list[1,000].instanceId}. ",and I have resolved it by using 1,000 -> 1000,

```Caused by: org.apache.ibatis.builder.BuilderException: .
 Cause: org.apache.ibatis.builder.BuilderException: Parsing error was found in mapping #{list[1,000].instanceId}.  Check synta
x #{property|(expression), var1=value1, var2=value2, ...}
```

But, I still have some doubts when i look up it's source code

private static void option(char[] expression, int p, Map<String, String> map) {
int left = skipWS(expression, p);
if(left < expression.length) {
int right = skipUntil(expression, left, '=');
String name = new String(expression, left, right - left);
left = skipWS(expression, right) + 1;
right = skipUntil(expression, left, ',');
String value = new String(expression, left, right - left);
map.put(name, value);
option(expression, right + 1, map);
}


I catch exceotion in red line ,since right -left =-1 and string out of range, and my sql  string is 

INSERT INTO Queue (instanceId, queueId, queueName, createTime, status, policy, ttl, vhost, updateTime, isDelete)  VALUES(#{list[1,000].instanceId}, #{list[1,000].queueId}, #{list[1,000].queueName}, #{list[1,000]..createTime}, #{list[1,000]..status}, #{list[1,000]..policy}, #{list[1,000].ttl}, #{list[1,000].vhost}, #{list[1,000].updateTime}, #{list[1,000].isDelete});

I want to know what the "expression" is  in static method expression, as I see its should be couples of key-values like 

instanceId=#{list[1,000].instanceId},queueId=#{list[1,000].queueId}, …… ,isDelete=#{list[1,000].isDelete} ,  so when it parsed to the last key-value "isDelete=#{list[1,000].isDelete}"

the red line would throw a outOfRangeException, but..why mybatis throw " caused by "#{list[1,000].instanceId}" ? 

so I suspect the "expression" is  in static method expression is just "instanceId=#{list[1,000].instanceId}" , but why it should use a recursion in option method just in purple line?




--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: question abt BuilderException: Check synta x #{property|(expression), var1=value1, var2=value2, ...}

jenius
@mybatis

On Friday, August 24, 2018 at 9:59:38 AM UTC+8, jenius wrote:
Hi~

I have catch a builderException when I use mybatis 3.2.0 like below,since I know it caused by "#{list[1,000].instanceId}. ",and I have resolved it by using 1,000 -> 1000,

```Caused by: org.apache.ibatis.builder.BuilderException: .
 Cause: org.apache.ibatis.builder.BuilderException: Parsing error was found in mapping #{list[1,000].instanceId}.  Check synta
x #{property|(expression), var1=value1, var2=value2, ...}
```

But, I still have some doubts when i look up it's source code

private static void option(char[] expression, int p, Map<String, String> map) {
int left = skipWS(expression, p);
if(left < expression.length) {
int right = skipUntil(expression, left, '=');
String name = new String(expression, left, right - left);
left = skipWS(expression, right) + 1;
right = skipUntil(expression, left, ',');
String value = new String(expression, left, right - left);
map.put(name, value);
option(expression, right + 1, map);
}


I catch exceotion in red line ,since right -left =-1 and string out of range, and my sql  string is 

INSERT INTO Queue (instanceId, queueId, queueName, createTime, status, policy, ttl, vhost, updateTime, isDelete)  VALUES(#{list[1,000].instanceId}, #{list[1,000].queueId}, #{list[1,000].queueName}, #{list[1,000]..createTime}, #{list[1,000]..status}, #{list[1,000]..policy}, #{list[1,000].ttl}, #{list[1,000].vhost}, #{list[1,000].updateTime}, #{list[1,000].isDelete});

I want to know what the "expression" is  in static method expression, as I see its should be couples of key-values like 

instanceId=#{list[1,000].instanceId},queueId=#{list[1,000].queueId}, …… ,isDelete=#{list[1,000].isDelete} ,  so when it parsed to the last key-value "isDelete=#{list[1,000].isDelete}"

the red line would throw a outOfRangeException, but..why mybatis throw " caused by "#{list[1,000].instanceId}" ? 

so I suspect the "expression" is  in static method expression is just "instanceId=#{list[1,000].instanceId}" , but why it should use a recursion in option method just in purple line?




--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: question abt BuilderException: Check synta x #{property|(expression), var1=value1, var2=value2, ...}

Iwao AVE!
Hi,

There can be jdbcType, javaType, typeHandler, etc..
http://www.mybatis.org/mybatis-3/sqlmap-xml.html#Parameters
Does this answer your question?

Regards,
Iwao



On Mon, Aug 27, 2018 at 12:12 PM jenius <[hidden email]> wrote:

>
> @mybatis
>
> On Friday, August 24, 2018 at 9:59:38 AM UTC+8, jenius wrote:
>>
>> Hi~
>>
>> I have catch a builderException when I use mybatis 3.2.0 like below,since I know it caused by "#{list[1,000].instanceId}. ",and I have resolved it by using 1,000 -> 1000,
>>
>> ```Caused by: org.apache.ibatis.builder.BuilderException: .
>>  Cause: org.apache.ibatis.builder.BuilderException: Parsing error was found in mapping #{list[1,000].instanceId}.  Check synta
>> x #{property|(expression), var1=value1, var2=value2, ...}
>> ```
>>
>> But, I still have some doubts when i look up it's source code
>>
>> private static void option(char[] expression, int p, Map<String, String> map) {
>>     int left = skipWS(expression, p);
>>     if(left < expression.length) {
>>         int right = skipUntil(expression, left, '=');
>>         String name = new String(expression, left, right - left);
>>         left = skipWS(expression, right) + 1;
>>         right = skipUntil(expression, left, ',');
>>         String value = new String(expression, left, right - left);
>>         map.put(name, value);
>>         option(expression, right + 1, map);
>>     }
>>
>>
>>
>> I catch exceotion in red line ,since right -left =-1 and string out of range, and my sql  string is
>>
>> INSERT INTO Queue (instanceId, queueId, queueName, createTime, status, policy, ttl, vhost, updateTime, isDelete)  VALUES(#{list[1,000].instanceId}, #{list[1,000].queueId}, #{list[1,000].queueName}, #{list[1,000]..createTime}, #{list[1,000]..status}, #{list[1,000]..policy}, #{list[1,000].ttl}, #{list[1,000].vhost}, #{list[1,000].updateTime}, #{list[1,000].isDelete});
>>
>> I want to know what the "expression" is  in static method expression, as I see its should be couples of key-values like
>>
>> instanceId=#{list[1,000].instanceId},queueId=#{list[1,000].queueId}, …… ,isDelete=#{list[1,000].isDelete} ,  so when it parsed to the last key-value "isDelete=#{list[1,000].isDelete}"
>>
>> the red line would throw a outOfRangeException, but..why mybatis throw " caused by "#{list[1,000].instanceId}" ?
>>
>> so I suspect the "expression" is  in static method expression is just "instanceId=#{list[1,000].instanceId}" , but why it should use a recursion in option method just in purple line?
>>
>>
>>
>>
> --
> You received this message because you are subscribed to the Google Groups "mybatis-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: question abt BuilderException: Check synta x #{property|(expression), var1=value1, var2=value2, ...}

jenius
Hi~ Iwao

Does the expression  #{list[1,000].instanceId}, jdbcType=XXX, javaType=XXX, etc. like this?

On Monday, August 27, 2018 at 9:53:59 PM UTC+8, Iwao AVE! wrote:
Hi,

There can be jdbcType, javaType, typeHandler, etc..
<a href="http://www.mybatis.org/mybatis-3/sqlmap-xml.html#Parameters" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.mybatis.org%2Fmybatis-3%2Fsqlmap-xml.html%23Parameters\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHYqTTXZ7kcqY7CVJ5bEPTHc5jcHg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.mybatis.org%2Fmybatis-3%2Fsqlmap-xml.html%23Parameters\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHYqTTXZ7kcqY7CVJ5bEPTHc5jcHg&#39;;return true;">http://www.mybatis.org/mybatis-3/sqlmap-xml.html#Parameters
Does this answer your question?

Regards,
Iwao



On Mon, Aug 27, 2018 at 12:12 PM jenius <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="V_D3bkS0AQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">yjflo...@...> wrote:

>
> @mybatis
>
> On Friday, August 24, 2018 at 9:59:38 AM UTC+8, jenius wrote:
>>
>> Hi~
>>
>> I have catch a builderException when I use mybatis 3.2.0 like below,since I know it caused by "#{list[1,000].instanceId}. ",and I have resolved it by using 1,000 -> 1000,
>>
>> ```Caused by: org.apache.ibatis.builder.BuilderException: .
>>  Cause: org.apache.ibatis.builder.BuilderException: Parsing error was found in mapping #{list[1,000].instanceId}.  Check synta
>> x #{property|(expression), var1=value1, var2=value2, ...}
>> ```
>>
>> But, I still have some doubts when i look up it's source code
>>
>> private static void option(char[] expression, int p, Map<String, String> map) {
>>     int left = skipWS(expression, p);
>>     if(left < expression.length) {
>>         int right = skipUntil(expression, left, '=');
>>         String name = new String(expression, left, right - left);
>>         left = skipWS(expression, right) + 1;
>>         right = skipUntil(expression, left, ',');
>>         String value = new String(expression, left, right - left);
>>         map.put(name, value);
>>         option(expression, right + 1, map);
>>     }
>>
>>
>>
>> I catch exceotion in red line ,since right -left =-1 and string out of range, and my sql  string is
>>
>> INSERT INTO Queue (instanceId, queueId, queueName, createTime, status, policy, ttl, vhost, updateTime, isDelete)  VALUES(#{list[1,000].instanceId}, #{list[1,000].queueId}, #{list[1,000].queueName}, #{list[1,000]..createTime}, #{list[1,000]..status}, #{list[1,000]..policy}, #{list[1,000].ttl}, #{list[1,000].vhost}, #{list[1,000].updateTime}, #{list[1,000].isDelete});
>>
>> I want to know what the "expression" is  in static method expression, as I see its should be couples of key-values like
>>
>> instanceId=#{list[1,000].instanceId},queueId=#{list[1,000].queueId}, …… ,isDelete=#{list[1,000].isDelete} ,  so when it parsed to the last key-value "isDelete=#{list[1,000].isDelete}"
>>
>> the red line would throw a outOfRangeException, but..why mybatis throw " caused by "#{list[1,000].instanceId}" ?
>>
>> so I suspect the "expression" is  in static method expression is just "instanceId=#{list[1,000].instanceId}" , but why it should use a recursion in option method just in purple line?
>>
>>
>>
>>
> --
> You received this message because you are subscribed to the Google Groups "mybatis-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="V_D3bkS0AQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybatis-user...@googlegroups.com.
> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.