db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r795314 - in /db/derby/code/branches/10.5/java: testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ testing/org/apache/derbyTesting/functionTests/tests/tools/ testing/org/apache/derbyTesting/functionTests/util/ tools/org/apache/der...
Date Sat, 18 Jul 2009 04:36:30 GMT
Author: kmarsden
Date: Sat Jul 18 04:36:28 2009
New Revision: 795314

URL: http://svn.apache.org/viewvc?rev=795314&view=rev
Log:
DERBY-4292 creation of FileInputStream in org.apache.derby.impl.tools.ij.Main not wrapped
in privilege block which can cause problems running under SecurityManager

svn merge -r 794111:794112 https://svn.apache.org/repos/asf/db/derby/code/trunk
Contributed by Tiago R. Esphina (tiago at espinhas dot net)



Added:
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IjSecurityManagerTest.java
      - copied unchanged from r794112, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IjSecurityManagerTest.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IjSecurityManagerTest.sql
      - copied unchanged from r794112, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IjSecurityManagerTest.sql
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/util/TestNullOutputStream.java
      - copied unchanged from r794112, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestNullOutputStream.java
Modified:
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java
    db/derby/code/branches/10.5/java/tools/org/apache/derby/impl/tools/ij/Main.java

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java?rev=795314&r1=795313&r2=795314&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
(original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
Sat Jul 18 04:36:28 2009
@@ -112,6 +112,8 @@
         
         PreparedStatement ps = prepareStatement( sql);
         ps.setBinaryStream( 1, is,data.length);
+        //DERBY-4312 Make sure commit() doesn't interfere here
+        commit();
         ps.executeUpdate();          
         // Make sure things still work ok when we have a parameter that does get consumed.
         // insert a matching row.
@@ -209,6 +211,8 @@
         Reader streamReader = new LoopingAlphabetReader(
                 clobLength, CharAlphabet.tamil());
         ps.setCharacterStream(1, streamReader, clobLength);
+        //DERBY-4312 make sure commit() doesn't interfere
+        commit();
         ps.executeUpdate();
         streamReader.close();
         ps.close();
@@ -1302,6 +1306,8 @@
         InputStream streamIn = new LoopingAlphabetStream(10000);
         ps.setAsciiStream(5, streamIn, 10000);
         ps.setInt(6, 1);
+        // DERBY-4312 make sure commit() doesn't interfere here.
+        commit();
         ps.executeUpdate();
         streamIn.close();
         ps.close();

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java?rev=795314&r1=795313&r2=795314&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java
(original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/tools/_Suite.java
Sat Jul 18 04:36:28 2009
@@ -54,7 +54,8 @@
         suite.addTest(ToolScripts.suite());
         suite.addTest(SysinfoCPCheckTest.suite());
         suite.addTest(SysinfoLocaleTest.suite());
-
+        suite.addTest(IjSecurityManagerTest.suite());
+        
         // SysinfoAPITest currently fails when run against jars, so is
         // disabled. Only the first jar file on the classpath properly
         // returns its information through the sysinfo API.

Modified: db/derby/code/branches/10.5/java/tools/org/apache/derby/impl/tools/ij/Main.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/tools/org/apache/derby/impl/tools/ij/Main.java?rev=795314&r1=795313&r2=795314&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/tools/org/apache/derby/impl/tools/ij/Main.java (original)
+++ db/derby/code/branches/10.5/java/tools/org/apache/derby/impl/tools/ij/Main.java Sat Jul
18 04:36:28 2009
@@ -39,6 +39,8 @@
 
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.sql.Connection;
 import java.sql.SQLException;
 
@@ -114,12 +116,17 @@
                         out.flush();
     	        } else {
                     try {
-                        in1 = new FileInputStream(file);
+                    	final String inFile1 = file;
+                    	in1 = (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction()
{
+            				public Object run() throws FileNotFoundException {
+        						return new FileInputStream(inFile1);
+            				}
+            			});
                         if (in1 != null) {
                             in1 = new BufferedInputStream(in1, utilMain.BUFFEREDFILESIZE);
                             in = langUtil.getNewInput(in1);
                         }
-                    } catch (FileNotFoundException e) {
+                    } catch (PrivilegedActionException e) {
                         if (Boolean.getBoolean("ij.searchClassPath")) {
                             in = langUtil.getNewInput(util.getResourceAsStream(file));
                         }



Mime
View raw message