ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Maves" <nathan.ma...@gmail.com>
Subject Re: Re: problem with flushInterval in cacheModel
Date Wed, 07 Nov 2007 10:39:40 GMT
Yeah I was just looking into this.

You might also want to force the constants to be long's as well.

if (hours != null) t += (long)Integer.parseInt(hours) * 60l * 60l * 1000l;

On Nov 7, 2007 3:35 AM, Niels Beekman <n.beekman@wis.nl> wrote:

> This is a bug. The problem is that the flush interval is computed in
> milliseconds, which can easily overflow integer boundaries. The code
> used in parsing the flush interval:
>
> long t = 0;
> String hours = childAttributes.getProperty("hours");
> if (hours != null) t += Integer.parseInt(hours) * 60 * 60 * 1000;
>
> Although the long can hold this information, any arithmetic done in Java
> with two integer operands results in an integer. The code should
> explicitly define computation outcome:
>
> long t = 0;
> String hours = childAttributes.getProperty("hours");
> if (hours != null) t += (long)Integer.parseInt(hours) * 60 * 60 * 1000;
>
> The same modifications should probably be made for the other cases.
>
> You should file a JIRA-issue with forementioned explanation/fix,
> hopefully it can make it into the next release.
>
> Niels
>
> -----Original Message-----
> From: Odelya Glick [mailto:odelya@jpost.com]
> Sent: woensdag 7 november 2007 22:37
> To: user-java@ibatis.apache.org
> Subject: re:Re: problem with flushInterval in cacheModel
>
>
> The exceptionis:
>
> Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.
> Cause: com.ibatis.common.exception.NestedRuntimeException: Error parsing
> XPath '/sqlMap/cacheModel/flushInterval'.  Cause:
> com.ibatis.common.exception.NestedRuntimeException: A flush interval
> must
> specify one or more of milliseconds, seconds, minutes or hours.
> Caused by: com.ibatis.common.exception.NestedRuntimeException: A flush
> interval must specify one or more of milliseconds, seconds, minutes or
> hours.
> Caused by: com.ibatis.common.exception.NestedRuntimeException: Error
> parsing
> XPath '/sqlMap/cacheModel/flushInterval'.  Cause:
> com.ibatis.common.exception.NestedRuntimeException: A flush interval
> must
> specify one or more of milliseconds, seconds, minutes or hours.
> Caused by: com.ibatis.common.exception.NestedRuntimeException: A flush
> interval must specify one or more of milliseconds, seconds, minutes or
> hours.
>        at
> com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)
>        at
> com.ibatis.sqlmap.engine.builder.xml.SqlMapParser.parse(SqlMapParser.jav
> a:45
> )
>        at
> com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$11.process(SqlMa
> pCon
> figParser.java:347)
>        at
> com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:11
> 2)
>        ... 44 more
>
> Thanks,
>
> Odelya Glick
> JPost.com web-programmer
> 050-2052075
>
>
>

Mime
View raw message