From 0b80f23e703e09f6d219ca2e1ce5e1051073f9ed Mon Sep 17 00:00:00 2001 From: Fay Wang Date: Wed, 14 Jul 2010 23:09:41 +0000 Subject: [PATCH] OPENJPA-1726: fix test case failures (TestInputStreamLob) for PostgreSQL git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@964257 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/jdbc/sql/PostgresDictionary.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java index 7d2509c24..ece1f727b 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.Constructor; +import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.security.AccessController; @@ -906,6 +907,19 @@ public class PostgresDictionary Class dbcpConnectionClass = Class.forName("org.apache.commons.dbcp.DelegatingConnection", true, AccessController .doPrivileged(J2DoPrivHelper.getContextClassLoaderAction())); + Class poolingDataSource = Class.forName( + "org.apache.commons.dbcp.PoolingDataSource", true, + AccessController.doPrivileged(J2DoPrivHelper + .getContextClassLoaderAction())); + Method setAccessToUnderlyingConnectionAllowed = poolingDataSource + .getMethod("setAccessToUnderlyingConnectionAllowed", + boolean.class); + + Field this$0 = conn.getClass().getDeclaredField("this$0"); + this$0.setAccessible(true); + Object poolingDataSourceObj = this$0.get(conn); + setAccessToUnderlyingConnectionAllowed.invoke(poolingDataSourceObj, + true); dbcpGetDelegate = dbcpConnectionClass.getMethod("getInnermostDelegate"); }