-
Notifications
You must be signed in to change notification settings - Fork 36
Closed
Description
Recently I've encountered following stacktrace:
FAILED CONFIGURATION: @BeforeMethod setUpDatabase
com.ninja_squad.dbsetup.DbSetupRuntimeException: org.h2.jdbc.JdbcSQLException: Data conversion error converting "aced0005737200146a6176612e6d6174682e426967496e74656765728cfc9f1fa93bfb1d030006490008626974436f756e744900096269744c656e67746849001366697273744e6f6e7a65726f427974654e756d49000c6c6f776573745365744269744900067369676e756d5b00096d61676e69747564657400025b42787200106a6176612e6c616e672e4e756d62657286ac951d0b94e08b0200007870fffffffffffffffffffffffefffffffe00000001757200025b42acf317f8060854e00200007870000000010378" [22018-182]
at com.ninja_squad.dbsetup.DbSetup.launch(DbSetup.java:123)
at com.ninja_squad.dbsetup.DbSetupTracker.launchIfNecessary(DbSetupTracker.java:101)
at com.mycompany.mytest.MyServiceBeanTest.setUpDatabase(MyServiceBeanTest.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:653)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: org.h2.jdbc.JdbcSQLException: Data conversion error converting "aced0005737200146a6176612e6d6174682e426967496e74656765728cfc9f1fa93bfb1d030006490008626974436f756e744900096269744c656e67746849001366697273744e6f6e7a65726f427974654e756d49000c6c6f776573745365744269744900067369676e756d5b00096d61676e69747564657400025b42787200106a6176612e6c616e672e4e756d62657286ac951d0b94e08b0200007870fffffffffffffffffffffffefffffffe00000001757200025b42acf317f8060854e00200007870000000010378" [22018-182]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:168)
at org.h2.value.Value.convertTo(Value.java:902)
at org.h2.jdbc.JdbcPreparedStatement.setObject(JdbcPreparedStatement.java:490)
at com.ninja_squad.dbsetup.bind.Binders$IntegerBinder.bind(Binders.java:226)
at com.ninja_squad.dbsetup.operation.Insert.execute(Insert.java:218)
at com.ninja_squad.dbsetup.operation.CompositeOperation.execute(CompositeOperation.java:93)
at com.ninja_squad.dbsetup.DbSetup.launch(DbSetup.java:107)
... 28 more
Caused by: java.lang.NumberFormatException: For input string: "aced0005737200146a6176612e6d6174682e426967496e74656765728cfc9f1fa93bfb1d030006490008626974436f756e744900096269744c656e67746849001366697273744e6f6e7a65726f427974654e756d49000c6c6f776573745365744269744900067369676e756d5b00096d61676e69747564657400025b42787200106a6176612e6c616e672e4e756d62657286ac951d0b94e08b0200007870fffffffffffffffffffffffefffffffe00000001757200025b42acf317f8060854e00200007870000000010378"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:441)
at java.lang.Long.parseLong(Long.java:483)
at org.h2.value.Value.convertTo(Value.java:854)
... 33 moreSteps to reproduce
drop table buildings if exists;
create table buildings (id bigint generated by default as identity, name varchar(255) not null, bldgNr bigint, primary key (id));Key java code snippet:
Operations.insertInto("buildings")
.columns("id", "bldgNr", "name")
.values(1L, "1", "Dormitory No. 1")
.build()Details
I don't know if it Bug with DbSetup or H2 JDBC driver.
Reason of the exception is known to me: exception exists because "bldgNr" is an integer on the database, and I'm inserting "1" string.
When corrected to .values(1L, 1, "Dormitory No. 1") above snippet works fine.
Despite that, I'm reporting this bug because given error message is completely misleading.
Guessing that is because string parameter is decoded internally by the DbSetup, am I correct?
But why above code can't work with H2, while with HSQLDB (hsqldb-2.3.2.jar) under the hood is working just fine?
Environment
- dbsetup version 1.3.0
- whatever h2 database version
- OS: Win 7 Enterprise
- JDK: 1.7.0_51
Tried with:
- h2-1.3.173.jar as
externaldatabase - h2-1.4.181.jar embedded
- h2-1.4.182.jar embedded
but exception is the same.
Regards
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels