{"action":"created","issue":{"url":"https://api.github.com/repos/jdbi/jdbi/issues/1188","repository_url":"https://api.github.com/repos/jdbi/jdbi","labels_url":"https://api.github.com/repos/jdbi/jdbi/issues/1188/labels{/name}","comments_url":"https://api.github.com/repos/jdbi/jdbi/issues/1188/comments","events_url":"https://api.github.com/repos/jdbi/jdbi/issues/1188/events","html_url":"https://github.com/jdbi/jdbi/issues/1188","id":335323355,"node_id":"MDU6SXNzdWUzMzUzMjMzNTU=","number":1188,"title":"jdbi3 InvocationTargetException instead of UnableToExecuteStatementException on PostgreSQL","user":{"login":"natnan","id":5628051,"node_id":"MDQ6VXNlcjU2MjgwNTE=","avatar_url":"https://avatars2.githubusercontent.com/u/5628051?v=4","gravatar_id":"","url":"https://api.github.com/users/natnan","html_url":"https://github.com/natnan","followers_url":"https://api.github.com/users/natnan/followers","following_url":"https://api.github.com/users/natnan/following{/other_user}","gists_url":"https://api.github.com/users/natnan/gists{/gist_id}","starred_url":"https://api.github.com/users/natnan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natnan/subscriptions","organizations_url":"https://api.github.com/users/natnan/orgs","repos_url":"https://api.github.com/users/natnan/repos","events_url":"https://api.github.com/users/natnan/events{/privacy}","received_events_url":"https://api.github.com/users/natnan/received_events","type":"User","site_admin":false},"labels":[{"id":276671342,"node_id":"MDU6TGFiZWwyNzY2NzEzNDI=","url":"https://api.github.com/repos/jdbi/jdbi/labels/bug","name":"bug","color":"e11d21","default":true}],"state":"open","locked":false,"assignee":{"login":"stevenschlansker","id":129097,"node_id":"MDQ6VXNlcjEyOTA5Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/129097?v=4","gravatar_id":"","url":"https://api.github.com/users/stevenschlansker","html_url":"https://github.com/stevenschlansker","followers_url":"https://api.github.com/users/stevenschlansker/followers","following_url":"https://api.github.com/users/stevenschlansker/following{/other_user}","gists_url":"https://api.github.com/users/stevenschlansker/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenschlansker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenschlansker/subscriptions","organizations_url":"https://api.github.com/users/stevenschlansker/orgs","repos_url":"https://api.github.com/users/stevenschlansker/repos","events_url":"https://api.github.com/users/stevenschlansker/events{/privacy}","received_events_url":"https://api.github.com/users/stevenschlansker/received_events","type":"User","site_admin":false},"assignees":[{"login":"stevenschlansker","id":129097,"node_id":"MDQ6VXNlcjEyOTA5Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/129097?v=4","gravatar_id":"","url":"https://api.github.com/users/stevenschlansker","html_url":"https://github.com/stevenschlansker","followers_url":"https://api.github.com/users/stevenschlansker/followers","following_url":"https://api.github.com/users/stevenschlansker/following{/other_user}","gists_url":"https://api.github.com/users/stevenschlansker/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenschlansker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenschlansker/subscriptions","organizations_url":"https://api.github.com/users/stevenschlansker/orgs","repos_url":"https://api.github.com/users/stevenschlansker/repos","events_url":"https://api.github.com/users/stevenschlansker/events{/privacy}","received_events_url":"https://api.github.com/users/stevenschlansker/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2018-06-25T09:16:07Z","updated_at":"2018-06-25T22:01:00Z","closed_at":null,"author_association":"NONE","body":"This started after bumping dropwizard from 1.3.2 to 1.3.4. That means jdbi3 from 3.1.0 to 3.2.1. I have also tried 3.3.0 and the result seems to be the same.\r\n\r\nWe have an onDemand jdbi object and calling any method that returns a legitimate SQL error now throws `InvocationTargetException `instead of the old `UnableToExecuteStatementException` which we handle to return a proper error message.\r\n\r\n```\r\nJdbi jdbi = new JdbiFactory().build(environment, configuration.getDatabase(), \"db\"); // factory from dropwizard\r\njdbi.installPlugin(new PostgresPlugin());\r\nIdentityProviderDao dao = jdbi.onDemand(IdentityProviderDao.class)\r\ndao.insert(entity);\r\n```\r\n\r\nException sample:\r\n```\r\n! org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint \"identity_provider_display_name_key\"\r\n!   Detail: Key (display_name)=(cz_test_ldap) already exists.\r\n! at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433)\r\n! at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2178)\r\n! at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306)\r\n! at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)\r\n! at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)\r\n! at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:155)\r\n! at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:144)\r\n! at sun.reflect.GeneratedMethodAccessor263.invoke(Unknown Source)\r\n! at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n! at java.lang.reflect.Method.invoke(Method.java:498)\r\n! at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)\r\n! at com.sun.proxy.$Proxy66.execute(Unknown Source)\r\n! at org.jdbi.v3.core.statement.SqlLoggerUtil.wrap(SqlLoggerUtil.java:29)\r\n! at org.jdbi.v3.core.statement.SqlStatement.internalExecute(SqlStatement.java:1380)\r\n! ... 111 common frames omitted\r\n! Causing: org.jdbi.v3.core.statement.UnableToExecuteStatementException: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint \"identity_provider_display_name_key\"\r\n!   Detail: Key (display_name)=(cz_test_ldap) already exists. [statement: cropped', parameters=ParsedParameters{positional=false, parameterNames=[cropped]}}\", arguments:{ positional:{}, named:{}, finder:[{lazy bean property arguments \"cropped\"]}]\r\n! at org.jdbi.v3.core.statement.SqlStatement.internalExecute(SqlStatement.java:1388)\r\n! at org.jdbi.v3.core.result.ResultProducers.lambda$returningUpdateCount$0(ResultProducers.java:48)\r\n! at org.jdbi.v3.core.statement.Update.execute(Update.java:53)\r\n! at org.jdbi.v3.core.statement.Update.execute(Update.java:41)\r\n! at org.jdbi.v3.sqlobject.statement.internal.SqlUpdateHandler.lambda$new$1(SqlUpdateHandler.java:59)\r\n! at org.jdbi.v3.sqlobject.statement.internal.SqlUpdateHandler.lambda$configureReturner$3(SqlUpdateHandler.java:74)\r\n! at org.jdbi.v3.sqlobject.statement.internal.CustomizingStatementHandler.invoke(CustomizingStatementHandler.java:155)\r\n! at org.jdbi.v3.sqlobject.statement.internal.SqlUpdateHandler.invoke(SqlUpdateHandler.java:30)\r\n! at org.jdbi.v3.sqlobject.SqlObjectFactory.lambda$null$13(SqlObjectFactory.java:158)\r\n! at org.jdbi.v3.core.internal.JdbiThreadLocals.invokeInContext(JdbiThreadLocals.java:27)\r\n! at org.jdbi.v3.core.LazyHandleSupplier.lambda$invokeInContext$1(LazyHandleSupplier.java:68)\r\n! at org.jdbi.v3.core.internal.JdbiThreadLocals.invokeInContext(JdbiThreadLocals.java:27)\r\n! at org.jdbi.v3.core.LazyHandleSupplier.invokeInContext(LazyHandleSupplier.java:67)\r\n! at org.jdbi.v3.sqlobject.SqlObjectFactory.lambda$createInvocationHandler$14(SqlObjectFactory.java:157)\r\n! at com.sun.proxy.$Proxy79.insertIdentityProvider(Unknown Source)\r\n! at com.cyxtera.controller.service.identity.identityprovider.dao.IdentityProviderDao.insert(IdentityProviderDao.java:103)\r\n! at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)\r\n! at org.jdbi.v3.sqlobject.DefaultMethodHandler.invoke(DefaultMethodHandler.java:102)\r\n! at org.jdbi.v3.sqlobject.transaction.internal.TransactionDecorator.lambda$decorateHandler$1(TransactionDecorator.java:47)\r\n! at org.jdbi.v3.sqlobject.SqlObjectFactory.lambda$null$13(SqlObjectFactory.java:158)\r\n! at org.jdbi.v3.core.internal.JdbiThreadLocals.invokeInContext(JdbiThreadLocals.java:27)\r\n! at org.jdbi.v3.core.LazyHandleSupplier.lambda$invokeInContext$1(LazyHandleSupplier.java:68)\r\n! at org.jdbi.v3.core.internal.JdbiThreadLocals.invokeInContext(JdbiThreadLocals.java:27)\r\n! at org.jdbi.v3.core.LazyHandleSupplier.invokeInContext(LazyHandleSupplier.java:67)\r\n! at org.jdbi.v3.sqlobject.SqlObjectFactory.lambda$createInvocationHandler$14(SqlObjectFactory.java:157)\r\n! at com.sun.proxy.$Proxy79.insert(Unknown Source)\r\n! ... 86 common frames omitted\r\n! Causing: java.lang.reflect.InvocationTargetException: null\r\n! at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n! at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n! at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n! at java.lang.reflect.Method.invoke(Method.java:498)\r\n! at org.jdbi.v3.sqlobject.BridgeMethodHandlerFactory.lambda$null$3(BridgeMethodHandlerFactory.java:39)\r\n! at org.jdbi.v3.sqlobject.transaction.internal.TransactionDecorator.lambda$null$0(TransactionDecorator.java:50)\r\n! at org.jdbi.v3.core.transaction.LocalTransactionHandler.inTransaction(LocalTransactionHandler.java:135)\r\n! at org.jdbi.v3.core.Handle.inTransaction(Handle.java:393)\r\n! at org.jdbi.v3.sqlobject.transaction.internal.TransactionDecorator.lambda$decorateHandler$1(TransactionDecorator.java:59)\r\n! at org.jdbi.v3.sqlobject.SqlObjectFactory.lambda$null$13(SqlObjectFactory.java:158)\r\n! at org.jdbi.v3.core.internal.JdbiThreadLocals.invokeInContext(JdbiThreadLocals.java:27)\r\n! at org.jdbi.v3.core.LazyHandleSupplier.lambda$invokeInContext$1(LazyHandleSupplier.java:68)\r\n! at org.jdbi.v3.core.internal.JdbiThreadLocals.invokeInContext(JdbiThreadLocals.java:27)\r\n! at org.jdbi.v3.core.LazyHandleSupplier.invokeInContext(LazyHandleSupplier.java:67)\r\n! at org.jdbi.v3.sqlobject.SqlObjectFactory.lambda$createInvocationHandler$14(SqlObjectFactory.java:157)\r\n! at org.jdbi.v3.core.OnDemandExtensions.invoke(OnDemandExtensions.java:76)\r\n! ... 70 common frames omitted\r\n! Causing: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException\r\n! at org.jdbi.v3.core.OnDemandExtensions.invoke(OnDemandExtensions.java:82)\r\n! at org.jdbi.v3.core.OnDemandExtensions.lambda$null$0(OnDemandExtensions.java:63)\r\n! at org.jdbi.v3.core.internal.JdbiThreadLocals.invokeInContext(JdbiThreadLocals.java:27)\r\n! at org.jdbi.v3.core.OnDemandExtensions.lambda$null$1(OnDemandExtensions.java:62)\r\n! at org.jdbi.v3.core.Jdbi.withExtension(Jdbi.java:439)\r\n! at org.jdbi.v3.core.OnDemandExtensions.lambda$create$2(OnDemandExtensions.java:61)\r\n! at com.sun.proxy.$Proxy79.insert(Unknown Source)\r\n! at com.cyxtera.controller.dropwizard.BaseEntityResource.save(BaseEntityResource.java:269)\r\n! at com.cyxtera.controller.service.identity.resource.IdentityProviderResource.save(IdentityProviderResource.java:146)\r\n! at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n! at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n! at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n! at java.lang.reflect.Method.invoke(Method.java:498)\r\n! at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)\r\n! at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)\r\n! at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)\r\n! at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205)\r\n! at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)\r\n! at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)\r\n! at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)\r\n! at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)\r\n! at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)\r\n! at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)\r\n! at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)\r\n! at org.glassfish.jersey.internal.Errors.process(Errors.java:315)\r\n! at org.glassfish.jersey.internal.Errors.process(Errors.java:297)\r\n! at org.glassfish.jersey.internal.Errors.process(Errors.java:267)\r\n! at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)\r\n! at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)\r\n! at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)\r\n! at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)\r\n! at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)\r\n! at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)\r\n! at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)\r\n! at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)\r\n! at io.dropwizard.jetty.NonblockingServletHolder.handle(NonblockingServletHolder.java:49)\r\n! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)\r\n! at io.dropwizard.servlets.ThreadNameFilter.doFilter(ThreadNameFilter.java:35)\r\n! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)\r\n! at io.dropwizard.jersey.filter.AllowedMethodsFilter.handle(AllowedMethodsFilter.java:45)\r\n! at io.dropwizard.jersey.filter.AllowedMethodsFilter.doFilter(AllowedMethodsFilter.java:39)\r\n! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)\r\n! at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)\r\n! at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)\r\n! at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)\r\n! at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)\r\n! at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)\r\n! at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)\r\n! at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)\r\n! at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)\r\n! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)\r\n! at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:239)\r\n! at io.dropwizard.jetty.RoutingHandler.handle(RoutingHandler.java:52)\r\n! at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:674)\r\n! at io.dropwizard.jetty.BiDiGzipHandler.handle(BiDiGzipHandler.java:67)\r\n! at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:56)\r\n! at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:169)\r\n! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)\r\n! at org.eclipse.jetty.server.Server.handle(Server.java:531)\r\n! at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)\r\n! at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)\r\n! at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)\r\n! at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)\r\n! at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)\r\n! at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)\r\n! at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)\r\n! at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)\r\n! at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:132)\r\n! at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:760)\r\n! at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:678)\r\n! at java.lang.Thread.run(Thread.java:748)\r\n```"},"comment":{"url":"https://api.github.com/repos/jdbi/jdbi/issues/comments/400109927","html_url":"https://github.com/jdbi/jdbi/issues/1188#issuecomment-400109927","issue_url":"https://api.github.com/repos/jdbi/jdbi/issues/1188","id":400109927,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDEwOTkyNw==","user":{"login":"stevenschlansker","id":129097,"node_id":"MDQ6VXNlcjEyOTA5Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/129097?v=4","gravatar_id":"","url":"https://api.github.com/users/stevenschlansker","html_url":"https://github.com/stevenschlansker","followers_url":"https://api.github.com/users/stevenschlansker/followers","following_url":"https://api.github.com/users/stevenschlansker/following{/other_user}","gists_url":"https://api.github.com/users/stevenschlansker/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenschlansker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenschlansker/subscriptions","organizations_url":"https://api.github.com/users/stevenschlansker/orgs","repos_url":"https://api.github.com/users/stevenschlansker/repos","events_url":"https://api.github.com/users/stevenschlansker/events{/privacy}","received_events_url":"https://api.github.com/users/stevenschlansker/received_events","type":"User","site_admin":false},"created_at":"2018-06-25T22:01:00Z","updated_at":"2018-06-25T22:01:00Z","author_association":"MEMBER","body":"candidate fix in #1189 , please let us know if this fixes it for you!  targeted to 3.3.1"}}
{"actor":{"display_login":"stevenschlansker"}}