You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by fa...@apache.org on 2010/07/15 01:09:42 UTC

svn commit: r964257 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java

Author: faywang
Date: Wed Jul 14 23:09:41 2010
New Revision: 964257

URL: http://svn.apache.org/viewvc?rev=964257&view=rev
Log:
OPENJPA-1726: fix test case failures (TestInputStreamLob) for PostgreSQL

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java?rev=964257&r1=964256&r2=964257&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java Wed Jul 14 23:09:41 2010
@@ -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");
             }