Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting the error Assertion botch: negative time

 
Dave Trower
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written a simple java program that inserts database records into a database. The program works most of the time but I occassionaly get the error:
Runtime exception: java.lang.RuntimeException: Assertion botch: negative time

My java machine is on the Central Time zone and the database itself is on Pacific Time zone.
I did some research online and one person said this problem is time zone related but I did not understand how to fix the problem.
The record that I time trying to insert is this one:
Record that causes the exception is as follows:
ExceptionRecord [hostname=lion.odc.vzwcorp.com, logFile=/log/srv01_epb02/SystemOut.log, time=1/24/14 23:53:47:491 PST, exception=org.springframework.web.util.NestedServletException:]

 
Paul Clapham
Sheriff
Posts: 21567
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on what database and JDBC driver you are using. Some of them understand time zones and work properly regardless of differences between the client and server, and others don't. I remember that Microsoft SQL Server fell in the latter group and I had to write some really awful code to map my timestamps to GMT on its behalf.
 
Dave Trower
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured out the problem. I was converting a date field from a log file into a java timestamp object. There is was a bug in the code and dates like 1/24/14 were treated like the date on January 24 on year 14 instead of year 2014. Once I corrected the convertion problem, my Oracle exception went away.
 
Paul Clapham
Sheriff
Posts: 21567
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's good. A lot easier to fix then if it had been what I was thinking.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic