Author: djd
Date: Sat Nov 11 11:50:15 2006
New Revision: 473783
URL: http://svn.apache.org/viewvc?view=rev&rev=473783
Log:
SupportFilesSetup needs to convert from the File to a URL in a privileged block as
that operation requires the permission to read user.dir.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java?view=diff&rev=473783&r1=473782&r2=473783
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
Sat Nov 11 11:50:15 2006
@@ -169,7 +169,7 @@
*/
public static URL getReadOnlyURL(String name) throws MalformedURLException
{
- return getReadOnly(name).toURL();
+ return getURL(getReadOnly(name));
}
/**
* Obtain the URL to the local copy of a read-write resource.
@@ -177,7 +177,7 @@
*/
public static URL getReadWriteURL(String name) throws MalformedURLException
{
- return getReadWrite(name).toURL();
+ return getURL(getReadWrite(name));
}
/**
* Obtain the URL to the local copy of a write-only resource.
@@ -185,7 +185,7 @@
*/
public static URL getWriteOnlyURL(String name) throws MalformedURLException
{
- return getWriteOnly(name).toURL();
+ return getURL(getWriteOnly(name));
}
@@ -218,5 +218,22 @@
{
File dir = new File(dirName);
return new File(dir, name);
+ }
+
+ private static URL getURL(final File file) throws MalformedURLException
+ {
+ try {
+ return (URL) AccessController.doPrivileged
+ (new java.security.PrivilegedExceptionAction(){
+
+ public Object run() throws MalformedURLException{
+ return file.toURL();
+
+ }
+ }
+ );
+ } catch (PrivilegedActionException e) {
+ throw (MalformedURLException) e.getException();
+ }
}
}
|