You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2022/05/10 16:25:08 UTC
svn commit: r1900787 - in /db/derby/code/trunk/java: build/org/apache/derbyBuild/ org.apache.derby.client/org/apache/derby/client/net/ org.apache.derby.commons/org/apache/derby/shared/common/info/ org.apache.derby.engine/org/apache/derby/iapi/jdbc/ org...
Author: rhillegas
Date: Tue May 10 16:25:08 2022
New Revision: 1900787
URL: http://svn.apache.org/viewvc?rev=1900787&view=rev
Log:
DERBY-7138: Remove many references to SecurityExceptions; commit derby-7138-17-ab-securityExceptions.diff.
Modified:
db/derby/code/trunk/java/build/org/apache/derbyBuild/ClassSizeCrawler.java
db/derby/code/trunk/java/org.apache.derby.client/org/apache/derby/client/net/NetXAResource.java
db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/info/JVMInfo.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/jdbc/DRDAServerStarter.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/loader/ClassInfo.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/loader/ClassInspector.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/monitor/ModuleFactory.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/property/PropertyUtil.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/load/ImportReadData.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/jce/JCECipherFactory.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/BaseMonitor.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/FileMonitor.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/reflect/JarLoader.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/RollingFileStream.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/RollingFileStreamProvider.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/SingleStream.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/timer/SingletonTimerFactory.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/sql/compile/BinaryListOperatorNode.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/RAFContainer.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/StreamFileContainer.java
db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoloadTest.java
db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.java
db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java
db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/harness/BasicUnitTestManager.java
Modified: db/derby/code/trunk/java/build/org/apache/derbyBuild/ClassSizeCrawler.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/build/org/apache/derbyBuild/ClassSizeCrawler.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/build/org/apache/derbyBuild/ClassSizeCrawler.java (original)
+++ db/derby/code/trunk/java/build/org/apache/derbyBuild/ClassSizeCrawler.java Tue May 10 16:25:08 2022
@@ -235,19 +235,11 @@ public class ClassSizeCrawler
private void crawl( File curDir, StringBuffer className)
{
if( verbose)
- System.out.println( "Searching directory " + curDir.getPath());
+ { System.out.println( "Searching directory " + curDir.getPath()); }
- try
+ if( ! curDir.isDirectory())
{
- if( ! curDir.isDirectory())
- {
- System.err.println( "*** " + curDir.getPath() + " is not a directory.");
- System.exit(1);
- }
- }
- catch( SecurityException se)
- {
- System.err.println( "Cannot access " + curDir.getPath());
+ System.err.println( "*** " + curDir.getPath() + " is not a directory.");
System.exit(1);
}
String[] filenames = curDir.list( );
Modified: db/derby/code/trunk/java/org.apache.derby.client/org/apache/derby/client/net/NetXAResource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.client/org/apache/derby/client/net/NetXAResource.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.client/org/apache/derby/client/net/NetXAResource.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.client/org/apache/derby/client/net/NetXAResource.java Tue May 10 16:25:08 2022
@@ -904,8 +904,6 @@ public class NetXAResource implements XA
InetAddress localhostNameIA = InetAddress.getLocalHost();
String localhostName = localhostNameIA.getHostName();
return localhostName;
- } catch (SecurityException se) {
- return serverName;
} catch (UnknownHostException ue) {
return serverName;
}
Modified: db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/info/JVMInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/info/JVMInfo.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/info/JVMInfo.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/info/JVMInfo.java Tue May 10 16:25:08 2022
@@ -87,13 +87,8 @@ public abstract class JVMInfo
// version 1.8, which is the lowest level we support.
//
String javaVersion = "1.8";
- try {
javaVersion =
System.getProperty("java.specification.version", javaVersion);
- } catch (SecurityException se) {
- // some vms do not know about this property so they
- // throw a security exception when access is restricted.
- }
if (javaVersion.equals("1.8")) {
id = J2SE_18;
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/jdbc/DRDAServerStarter.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/jdbc/DRDAServerStarter.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/jdbc/DRDAServerStarter.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/jdbc/DRDAServerStarter.java Tue May 10 16:25:08 2022
@@ -131,10 +131,9 @@ public final class DRDAServerStarter imp
* code is not dependent on the network server code.
* @param serverClass
* @throws NoSuchMethodException
- * @throws SecurityException
*/
private void findStartStopMethods(final Class<?> serverClass)
- throws SecurityException, NoSuchMethodException
+ throws NoSuchMethodException
{
// Methods are public so no need for privilege blocks.
runServerMethod = serverClass.getMethod(
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/loader/ClassInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/loader/ClassInfo.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/loader/ClassInfo.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/loader/ClassInfo.java Tue May 10 16:25:08 2022
@@ -91,11 +91,6 @@ public class ClassInfo implements Instan
useConstructor = false;
return getNewInstance();
- } catch (SecurityException se) {
- // not allowed to to get a handle on the constructor
- // just use the standard mechanism.
- useConstructor = false;
- return getNewInstance();
}
}
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/loader/ClassInspector.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/loader/ClassInspector.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/loader/ClassInspector.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/loader/ClassInspector.java Tue May 10 16:25:08 2022
@@ -410,8 +410,6 @@ public class ClassInspector
e = cnfe;
} catch (NoSuchFieldException nsfep) {
e = nsfep;
- } catch (SecurityException se) {
- e = se;
}
throw StandardException.newException(
@@ -899,7 +897,7 @@ nextMethod: for (int i = 0; i < methods.
@param className Name of class
@return the class
@exception ClassNotFoundException Class cannot be found, or
- a SecurityException or LinkageException was thrown loading the class.
+ LinkageException was thrown loading the class.
*/
public Class<?> getClass(String className) throws ClassNotFoundException {
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/monitor/ModuleFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/monitor/ModuleFactory.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/monitor/ModuleFactory.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/monitor/ModuleFactory.java Tue May 10 16:25:08 2022
@@ -279,7 +279,6 @@ public interface ModuleFactory
Return a property from the JVM's system set.
In a Java2 environment this will be executed as a privileged block
if and only if the property starts with 'derby.'.
- If a SecurityException occurs, null is returned.
*/
public String getJVMProperty(String key);
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/property/PropertyUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/property/PropertyUtil.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/property/PropertyUtil.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/property/PropertyUtil.java Tue May 10 16:25:08 2022
@@ -701,30 +701,17 @@ public class PropertyUtil {
*/
private static boolean systemPropertiesExistsBuiltinUser(String username)
{
- ModuleFactory monitor = getMonitorLite();
+ ModuleFactory monitor = getMonitorLite();
- try {
- Properties JVMProperties = System.getProperties();
+ Properties JVMProperties = System.getProperties();
- if (propertiesContainsBuiltinUser(JVMProperties, username)) {
- return true;
- }
- } catch (SecurityException e) {
- // Running with security manager and we can't get at all
- // JVM properties, to try to map the back the authid to
- // how the user may have specified a matching id (1->many,
- // since userids are subject to SQL up-casing).
- String key= Property.USER_PROPERTY_PREFIX +
- IdUtil.SQLIdentifier2CanonicalPropertyUsername(username);
+ if (propertiesContainsBuiltinUser(JVMProperties, username)) {
+ return true;
+ }
- if (monitor.getJVMProperty(key) != null) {
- return true;
- }
- }
+ Properties applicationProperties = monitor.getApplicationProperties();
- Properties applicationProperties = monitor.getApplicationProperties();
-
- return propertiesContainsBuiltinUser(applicationProperties, username);
+ return propertiesContainsBuiltinUser(applicationProperties, username);
}
private static boolean propertiesContainsBuiltinUser(Properties props,
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/load/ImportReadData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/load/ImportReadData.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/load/ImportReadData.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/load/ImportReadData.java Tue May 10 16:25:08 2022
@@ -255,9 +255,7 @@ final class ImportReadData {
}
} catch (FileNotFoundException ex) {
throw LoadError.dataFileNotFound(inputFileName, ex);
- } catch (SecurityException se) {
- throw LoadError.dataFileNotFound(inputFileName, se);
- }
+ }
java.io.Reader rd = dataCodeset == null ?
new InputStreamReader(inputStream) : new InputStreamReader(inputStream, dataCodeset);
bufferedReader = new BufferedReader(rd, 32*1024);
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/jce/JCECipherFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/jce/JCECipherFactory.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/jce/JCECipherFactory.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/jce/JCECipherFactory.java Tue May 10 16:25:08 2022
@@ -629,10 +629,6 @@ final class JCECipherFactory implements
catch (NoSuchAlgorithmException nsae)
{
t = nsae;
- }
- catch (SecurityException se)
- {
- t = se;
} catch (LinkageError le) {
t = le;
} catch (ClassCastException cce) {
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/BaseMonitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/BaseMonitor.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/BaseMonitor.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/BaseMonitor.java Tue May 10 16:25:08 2022
@@ -1357,8 +1357,6 @@ nextModule:
return properties;
- } catch (SecurityException se) {
- return null;
} catch (IOException ioe) {
report(ioe.toString() + " (" + Property.PROPERTIES_FILE + ")");
reportException(ioe);
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/FileMonitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/FileMonitor.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/FileMonitor.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/FileMonitor.java Tue May 10 16:25:08 2022
@@ -85,70 +85,52 @@ public final class FileMonitor extends B
* Warnings are suppressed because ThreadGroup.setDaemon() was slated
* for removal by Open JDK build 16-ea+26-1764. See https://issues.apache.org/jira/browse/DERBY-7094
*
- * @return the thread group "derby.daemons" or null if we saw
- * a SecurityException
+ * @return the thread group "derby.daemons"
*/
@SuppressWarnings("removal")
private ThreadGroup createDaemonGroup() {
- try {
- ThreadGroup group = new ThreadGroup("derby.daemons");
- group.setDaemon(true);
- return group;
- } catch (SecurityException se) {
- // In case of a lacking privilege, issue a warning, return null and
- // let the daemon threads be created in the default thread group.
- // This can only happen if the current Derby thread is a part of
- // the root thread group "system".
- reportThread(se);
- return null;
- }
+ ThreadGroup group = new ThreadGroup("derby.daemons");
+ group.setDaemon(true);
+ return group;
}
- /**
- SECURITY WARNING.
+ /**
+ SECURITY WARNING.
- This method is run in a privileged block in a Java 2 environment.
+ This method is run in a privileged block in a Java 2 environment.
- Set the system home directory. Returns false if it couldn't for
- some reason.
+ Set the system home directory. Returns false if it couldn't for
+ some reason.
- **/
- private boolean PBinitialize(boolean lite)
- {
- if (!lite) {
+ **/
+ private boolean PBinitialize(boolean lite)
+ {
+ if (!lite) {
daemonGroup = createDaemonGroup();
- }
+ }
- InputStream versionStream = getClass().getResourceAsStream("/" + ProductGenusNames.DBMS_INFO);
+ InputStream versionStream = getClass().getResourceAsStream("/" + ProductGenusNames.DBMS_INFO);
- engineVersion = ProductVersionHolder.getProductVersionHolderFromMyEnv(versionStream);
+ engineVersion = ProductVersionHolder.getProductVersionHolderFromMyEnv(versionStream);
+
+ String systemHome;
+ // create the system home directory if it doesn't exist
+ systemHome = System.getProperty(Property.SYSTEM_HOME_PROPERTY);
+
+ if (systemHome != null) {
+ home = new File(systemHome);
+
+ // SECURITY PERMISSION - OP2a
+ if (home.exists()) {
+ if (!home.isDirectory()) {
+ report(Property.SYSTEM_HOME_PROPERTY + "=" + systemHome
+ + " does not represent a directory");
+ return false;
+ }
+ } else if (!lite) {
- String systemHome;
- // create the system home directory if it doesn't exist
- try {
- // SECURITY PERMISSION - OP2
- systemHome = System.getProperty(Property.SYSTEM_HOME_PROPERTY);
- } catch (SecurityException se) {
- // system home will be the current directory
- report(se, Property.SYSTEM_HOME_PROPERTY);
- systemHome = null;
- }
-
- if (systemHome != null) {
- home = new File(systemHome);
-
- // SECURITY PERMISSION - OP2a
- if (home.exists()) {
- if (!home.isDirectory()) {
- report(Property.SYSTEM_HOME_PROPERTY + "=" + systemHome
- + " does not represent a directory");
- return false;
- }
- } else if (!lite) {
-
- boolean created = false;
- try {
- // SECURITY PERMISSION - OP2b
+ try {
+ // SECURITY PERMISSION - OP2b
// Attempt to create just the folder initially
// which does not require read permission on
// the parent folder. This is to allow a policy
@@ -162,42 +144,33 @@ public final class FileMonitor extends B
// and mkdirs() retains existing (pre10.3) behaviour
// but avoids requiring read permission on the parent
// directory if it exists.
+ boolean created = false;
created = home.mkdir() || home.mkdirs();
if (created) {
FileUtil.limitAccessToOwner(home);
}
- } catch (SecurityException se) {
- report(se, home);
- return false;
} catch (IOException ioe) {
return false;
}
- }
- }
+ }
+ }
+
+ return true;
+ }
- return true;
- }
+ /**
+ SECURITY WARNING.
- /**
- SECURITY WARNING.
+ This method is run in a privileged block in a Java 2 environment.
- This method is run in a privileged block in a Java 2 environment.
-
- Return a property from the JVM's system set.
- In a Java2 environment this will be executed as a privileged block
- if and only if the property starts with 'derby.'.
- If a SecurityException occurs, null is returned.
- */
- private String PBgetJVMProperty(String key) {
-
- try {
- // SECURITY PERMISSION - OP1
- return System.getProperty(key);
- } catch (SecurityException se) {
- report(se, key);
- return null;
- }
- }
+ Return a property from the JVM's system set.
+ In a Java2 environment this will be executed as a privileged block
+ if and only if the property starts with 'derby.'.
+ */
+ private String PBgetJVMProperty(String key) {
+
+ return System.getProperty(key);
+ }
private final static Map<String, Void> securityProperties =
@@ -214,25 +187,6 @@ public final class FileMonitor extends B
securityProperties.put(Property.SYSTEM_HOME_PROPERTY, null);
};
- private void report(SecurityException e, String key) {
- if (securityProperties.containsKey(key)) {
- report(MessageService.getTextMessage(
- MessageId.CANNOT_READ_SECURITY_PROPERTY, key, e.toString()));
- }
- }
-
- private void report(SecurityException e, File file) {
- report(MessageService.getTextMessage(
- MessageId.CANNOT_CREATE_FILE_OR_DIRECTORY,
- file.toString(),
- e.toString()));
- }
-
- private void reportThread(SecurityException e) {
- report(MessageService.getTextMessage(
- MessageId.CANNOT_SET_DAEMON, e.toString()));
- }
-
/*
** Priv block code, moved out of the old Java2 version.
*/
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java Tue May 10 16:25:08 2022
@@ -908,7 +908,6 @@ final class StorageFactoryService implem
*
* @param file the file to check
* @return {@code true} if the file exists, {@code false} if not.
- * @throws SecurityException if the required privileges are missing
*/
private final boolean fileExists(final File file) {
return file.exists();
@@ -1065,11 +1064,7 @@ final class StorageFactoryService implem
throws StandardException {
operation = "exists";
boolean ret = false;
- try {
- ret = file.exists();
- } catch (SecurityException se) {
- handleSecPrivException(file, mustSucceed, se);
- }
+ ret = file.exists();
return ret;
}
@@ -1077,11 +1072,7 @@ final class StorageFactoryService implem
throws StandardException {
operation = "delete";
boolean deleted = false;
- try {
- deleted = file.delete();
- } catch (SecurityException se) {
- handleSecPrivException(file, mustSucceed, se);
- }
+ deleted = file.delete();
if (mustSucceed && !deleted) {
throw StandardException.newException(
SQLState.UNABLE_TO_DELETE_FILE, file.getPath());
@@ -1104,31 +1095,5 @@ final class StorageFactoryService implem
return renamed;
}
- /**
- * Handles security exceptions caused by missing privileges on the
- * files being accessed.
- *
- * @param file the file that was accessed
- * @param mustSucceed if {@code true} a {@code StandardException} will
- * be thrown, if {@code false} a warning is written to the log
- * @param se the security exception raised
- * @throws StandardException if {@code mustSucceed} is {@code true}
- * @throws NullPointerException if {@code file} or {@code se} is null
- */
- private void handleSecPrivException(StorageFile file,
- boolean mustSucceed,
- SecurityException se)
- throws StandardException {
- if (mustSucceed) {
- throw StandardException.newException(
- SQLState.MISSING_FILE_PRIVILEGE, se, operation,
- file.getName(), se.getMessage());
- } else {
- Monitor.getStream().printlnWithHeader(
- MessageService.getTextMessage(
- SQLState.MISSING_FILE_PRIVILEGE, operation,
- getMostAccuratePath(file), se.getMessage()));
- }
- }
} // End of static class FileOperationHelper
}
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/reflect/JarLoader.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/reflect/JarLoader.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/reflect/JarLoader.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/reflect/JarLoader.java Tue May 10 16:25:08 2022
@@ -455,7 +455,7 @@ final class JarLoader extends SecureClas
* Read the raw data for the class file format
* into a byte array that can be used for loading the class.
* If this is a signed class and it has been compromised then
- * a SecurityException will be thrown.
+ * an IOException will be thrown.
*/
byte[] readData(JarEntry ze, InputStream in, String className)
throws IOException {
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/RollingFileStream.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/RollingFileStream.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/RollingFileStream.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/RollingFileStream.java Tue May 10 16:25:08 2022
@@ -136,11 +136,10 @@ public class RollingFileStream extends O
* </ul>
*
* @exception IOException if there are IO problems opening the files.
- * @exception SecurityException if a security manager exists and if the caller does not have
* <tt>LoggingPermission("control"))</tt>.
* @exception NullPointerException if pattern property is an empty String.
*/
- public RollingFileStream() throws IOException, SecurityException {
+ public RollingFileStream() throws IOException {
this("%d/derby-%g.log", 0, 1, false);
}
@@ -154,14 +153,12 @@ public class RollingFileStream extends O
* @param count the number of files to use
* @param append specifies append mode
* @exception IOException if there are IO problems opening the files.
- * @exception SecurityException if a security manager exists and if the caller does not have
- * <tt>LoggingPermission("control")</tt>.
* @exception IllegalArgumentException if limit < 0, or count < 1.
* @exception IllegalArgumentException if pattern is an empty string
*
*/
public RollingFileStream(String pattern, int limit, int count, boolean append)
- throws IOException, SecurityException {
+ throws IOException {
if (limit < 0 || count < 1 || pattern.length() < 1) {
throw new IllegalArgumentException();
}
@@ -372,11 +369,8 @@ public class RollingFileStream extends O
/**
* Close all the files.
- *
- * @exception SecurityException if a security manager exists and if the caller does not have
- * <tt>LoggingPermission("control")</tt>.
*/
- public synchronized void close() throws SecurityException {
+ public synchronized void close() {
// Close the underlying file
if (null != meter) {
try {
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/RollingFileStreamProvider.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/RollingFileStreamProvider.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/RollingFileStreamProvider.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/RollingFileStreamProvider.java Tue May 10 16:25:08 2022
@@ -45,9 +45,8 @@ public class RollingFileStreamProvider {
*
* @return The configured OutputStream
* @throws IOException
- * @throws SecurityException
*/
- public static OutputStream getOutputStream() throws IOException, SecurityException {
+ public static OutputStream getOutputStream() throws IOException {
OutputStream res = null;
String pattern = PropertyUtil.getSystemProperty(Property.ERRORLOG_ROLLINGFILE_PATTERN_PROPERTY, "%d/derby-%g.log");
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/SingleStream.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/SingleStream.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/SingleStream.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/stream/SingleStream.java Tue May 10 16:25:08 2022
@@ -206,8 +206,6 @@ implements InfoStreams, ModuleControl
FileUtil.limitAccessToOwner(streamFile);
} catch (IOException ioe) {
return useDefaultStream(header, ioe);
- } catch (SecurityException se) {
- return useDefaultStream(header, se);
}
return new BasicHeaderPrintWriter(new BufferedOutputStream(fos), header,
@@ -251,9 +249,6 @@ implements InfoStreams, ModuleControl
}
} catch (ClassNotFoundException cnfe) {
t = cnfe;
- } catch (SecurityException se) {
- t = se;
-
}
return useDefaultStream(header, t);
@@ -313,8 +308,6 @@ implements InfoStreams, ModuleControl
}
} catch (ClassNotFoundException cnfe) {
t = cnfe;
- } catch (SecurityException se) {
- t = se;
}
return useDefaultStream(header, t);
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/timer/SingletonTimerFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/timer/SingletonTimerFactory.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/timer/SingletonTimerFactory.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/timer/SingletonTimerFactory.java Tue May 10 16:25:08 2022
@@ -192,18 +192,6 @@ public class SingletonTimerFactory
Thread.currentThread().setContextClassLoader(cl);
}
- private void report (SecurityException se, String id) {
- warnings.append(MessageService.getTextMessage(id, se.toString()));
- warnings.append('\n');
-
- if (SanityManager.DEBUG) {
- for (StackTraceElement elt : se.getStackTrace()) {
- warnings.append(elt.toString());
- warnings.append('\n');
- }
- warnings.append('\n');
- }
- }
/**
* Return any warnings generated during the initialization of this class, or
* null if none
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/sql/compile/BinaryListOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/sql/compile/BinaryListOperatorNode.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/sql/compile/BinaryListOperatorNode.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/sql/compile/BinaryListOperatorNode.java Tue May 10 16:25:08 2022
@@ -52,7 +52,7 @@ public abstract class BinaryListOperator
ValueNodeList rightOperandList,
String operator,
String methodName,
- ContextManager cm) throws SecurityException {
+ ContextManager cm) {
super(cm);
this.leftOperand = leftOperand;
this.rightOperandList = rightOperandList;
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/RAFContainer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/RAFContainer.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/RAFContainer.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/RAFContainer.java Tue May 10 16:25:08 2022
@@ -847,7 +847,7 @@ class RAFContainer extends FileContainer
}
synchronized boolean removeFile(StorageFile file)
- throws SecurityException, StandardException
+ throws StandardException
{
actionCode = REMOVE_FILE_ACTION;
actionFile = file;
@@ -1303,7 +1303,7 @@ class RAFContainer extends FileContainer
}
synchronized StorageRandomAccessFile getRandomAccessFile(StorageFile file)
- throws SecurityException, StandardException
+ throws StandardException
{
actionCode = GET_RANDOM_ACCESS_FILE_ACTION;
actionFile = file;
@@ -1328,14 +1328,10 @@ class RAFContainer extends FileContainer
{
StorageFile file = privGetFileName( actionIdentity, false, false, false);
- try {
- if (file.exists()) {
- // note I'm left in the no-identity state as fillInIdentity()
- // hasn't been called.
- throw StandardException.newException( SQLState.FILE_EXISTS, file);
- }
- } catch (SecurityException se) {
- throw StandardException.newException( SQLState.FILE_CREATE, se, file);
+ if (file.exists()) {
+ // note I'm left in the no-identity state as fillInIdentity()
+ // hasn't been called.
+ throw StandardException.newException( SQLState.FILE_EXISTS, file);
}
try {
@@ -1394,15 +1390,7 @@ class RAFContainer extends FileContainer
canUpdate = false;
boolean fileDeleted;
- try {
- fileDeleted = privRemoveFile(file);
- } catch (SecurityException se) {
- throw StandardException.newException(
- SQLState.FILE_CREATE_NO_CLEANUP,
- ioe,
- file,
- se.toString());
- }
+ fileDeleted = privRemoveFile(file);
if (!fileDeleted) {
throw StandardException.newException(
@@ -1430,27 +1418,18 @@ class RAFContainer extends FileContainer
if (file == null)
return null;
- try {
- if (!file.exists()) {
+ if (!file.exists()) {
- // file does not exist, may be it has been stubbified
- file = privGetFileName( actionIdentity, true, true, true);
- if (!file.exists())
- return null;
- isStub = true;
- }
- } catch (SecurityException se) {
- throw StandardException.newException(
- SQLState.DATA_UNEXPECTED_EXCEPTION, se);
+ // file does not exist, may be it has been stubbified
+ file = privGetFileName( actionIdentity, true, true, true);
+ if (!file.exists())
+ return null;
+ isStub = true;
}
canUpdate = false;
- try {
- if (!dataFactory.isReadOnly() && file.canWrite())
- canUpdate = true;
- } catch (SecurityException se) {
- // just means we can't write to it.
- }
+ if (!dataFactory.isReadOnly() && file.canWrite())
+ { canUpdate = true; }
fileName = file.toString();
try {
@@ -1615,12 +1594,6 @@ class RAFContainer extends FileContainer
privRemoveFile(file);
}
- catch (SecurityException se)
- {
- throw StandardException.
- newException(SQLState.FILE_CANNOT_REMOVE_FILE, se, file,
- se.toString());
- }
catch (IOException ioe)
{
// exception thrown while in creating the stub. Remove the
@@ -1645,11 +1618,6 @@ class RAFContainer extends FileContainer
throw StandardException.newException(
SQLState.FILE_CANNOT_REMOVE_FILE, ioe2, file, ioe.toString());
}
- catch (SecurityException se)
- {
- throw StandardException.newException(
- SQLState.FILE_CANNOT_REMOVE_FILE, se, file, se.toString());
- }
}
//let the data factory know about this the stub file;It
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/StreamFileContainer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/StreamFileContainer.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/StreamFileContainer.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/store/raw/data/StreamFileContainer.java Tue May 10 16:25:08 2022
@@ -167,40 +167,31 @@ class StreamFileContainer implements Typ
* container after the container has been created.
* <p>
*
- * @exception StandardException Standard exception policy.
+ * @exception StandardException Standard exception policy.
**/
- StreamFileContainer(
+ StreamFileContainer(
ContainerKey identity,
BaseDataFileFactory dataFactory,
Properties prop)
- throws StandardException
+ throws StandardException
{
- this.identity = identity;
- this.dataFactory = dataFactory;
+ this.identity = identity;
+ this.dataFactory = dataFactory;
- try
- {
- file = getFileName(identity, true, false);
-
- if (privExists(file))
- {
- // note I'm left in the no-identity state as fillInIdentity()
- // hasn't been called.
- throw StandardException.newException(
- SQLState.FILE_EXISTS, file);
- }
+ file = getFileName(identity, true, false);
- // get the properties to set buffer size
- // derby.storage.streamFileBufferSize
- getContainerProperties(prop);
-
- }
- catch (SecurityException se)
+ if (privExists(file))
{
- throw StandardException.newException(
- SQLState.FILE_CREATE, se, file);
- }
- }
+ // note I'm left in the no-identity state as fillInIdentity()
+ // hasn't been called.
+ throw StandardException.newException(
+ SQLState.FILE_EXISTS, file);
+ }
+
+ // get the properties to set buffer size
+ // derby.storage.streamFileBufferSize
+ getContainerProperties(prop);
+ }
/**************************************************************************
* Private/Protected methods of This class:
Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java Tue May 10 16:25:08 2022
@@ -718,7 +718,6 @@ public class StatementTest
return method.invoke( _wrappedStatement, argValues );
}
catch (NoSuchMethodException nsme) { throw wrap( nsme ); }
- catch (SecurityException se) { throw wrap( se ); }
catch (IllegalAccessException iae) { throw wrap( iae ); }
catch (IllegalArgumentException iare) { throw wrap( iare ); }
catch (InvocationTargetException ite) { throw wrap( ite ); }
Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoloadTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoloadTest.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoloadTest.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoloadTest.java Tue May 10 16:25:08 2022
@@ -114,23 +114,16 @@ public class AutoloadTest extends BaseJD
// in the value. Could get fancy and see if it is
// correctly formatted but not worth it.
- try {
- String jdbcDrivers = getSystemProperty("jdbc.drivers");
- if (jdbcDrivers == null)
- jdbcDrivers = "";
+ String jdbcDrivers = getSystemProperty("jdbc.drivers");
+ if (jdbcDrivers == null)
+ jdbcDrivers = "";
- embeddedAutoLoad = jdbcDrivers
- .contains("org.apache.derby.jdbc.EmbeddedDriver");
+ embeddedAutoLoad = jdbcDrivers
+ .contains("org.apache.derby.jdbc.EmbeddedDriver");
- clientAutoLoad = jdbcDrivers
- .contains("org.apache.derby.jdbc.ClientDriver");
+ clientAutoLoad = jdbcDrivers
+ .contains("org.apache.derby.jdbc.ClientDriver");
- } catch (SecurityException se) {
- // assume there is no autoloading if
- // we can't read the value of jdbc.drivers.
- }
-
-
if (jdbc4Autoload || embeddedAutoLoad || clientAutoLoad)
{
BaseTestSuite suite = new BaseTestSuite("AutoloadTest");
Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.java Tue May 10 16:25:08 2022
@@ -315,7 +315,6 @@ public class CacheManagerMBeanTest exten
ObjectName name = names.iterator().next();
- // Expect no SecurityException when reading attributes ...
for (String attrName : ALL_ATTRIBUTES) {
getAttribute(name, attrName);
}
Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java Tue May 10 16:25:08 2022
@@ -37,11 +37,8 @@ import java.util.List;
* A set of operations on {@link java.io.File} that wraps the
* operations in privileged block of code. This class is intended to provide
* these methods for testcases to reduce the hassle of having to wrap file
- * operations in privileged code blocks.
- * <p>
- * Derby needs to use privileged blocks in some places to avoid
- * {@link SecurityException}s being thrown, as the required privileges are
- * often granted to Derby itself, but not the higher level application code.
+ * operations in privileged code blocks. This is now a NOP due to the work
+ * done on DERBY-7138.
*/
public class PrivilegedFileOpsForTests {
@@ -186,8 +183,6 @@ public class PrivilegedFileOpsForTests {
* @param file the file to obtain a reader for
* @return An unbuffered reader for the specified file.
* @throws FileNotFoundException if the specified file does not exist
- * @throws SecurityException if the required permissions to read the file,
- * or the path it is in, are missing
*/
public static FileReader getFileReader(final File file)
throws FileNotFoundException {
@@ -319,8 +314,6 @@ public class PrivilegedFileOpsForTests {
* @param file the file to create a stream for
* @return An output stream.
* @throws FileNotFoundException if the specified file does not exist
- * @throws SecurityException if the required permissions to write the file,
- * or the path it is in, are missing
*/
public static FileOutputStream getFileOutputStream(final File file)
throws FileNotFoundException {
Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/harness/BasicUnitTestManager.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/harness/BasicUnitTestManager.java?rev=1900787&r1=1900786&r2=1900787&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/harness/BasicUnitTestManager.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/harness/BasicUnitTestManager.java Tue May 10 16:25:08 2022
@@ -79,10 +79,7 @@ public class BasicUnitTestManager implem
namesOfTests = new Hashtable<String, String>();
findTests(startParams, startParams);
- try {
- findTests(System.getProperties(), startParams);
- } catch (SecurityException se) {
- }
+ findTests(System.getProperties(), startParams);
findTests(getMonitor().getApplicationProperties(), startParams);
if ( !alreadyRun )