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/05 16:41:51 UTC
svn commit: r1900593 - in /db/derby/code/trunk/java: org.apache.derby.engine/org/apache/derby/iapi/services/cache/ org.apache.derby.engine/org/apache/derby/iapi/types/ org.apache.derby.engine/org/apache/derby/impl/services/bytecode/ org.apache.derby.en...
Author: rhillegas
Date: Thu May 5 16:41:51 2022
New Revision: 1900593
URL: http://svn.apache.org/viewvc?rev=1900593&view=rev
Log:
DERBY-7138: Remove more SecurityManager references from the code; commit derby-7138-15-aa-mostRemainingReferences.diff.
Modified:
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/cache/ClassSize.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/types/SqlXmlUtil.java
db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/bytecode/d_BCValidate.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.tests/org/apache/derbyTesting/functionTests/util/SecurityCheck.java
db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/TestRoutines.java
db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/junit/TestConfiguration.java
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/cache/ClassSize.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/cache/ClassSize.java?rev=1900593&r1=1900592&r2=1900593&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/cache/ClassSize.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/services/cache/ClassSize.java Thu May 5 16:41:51 2022
@@ -258,11 +258,6 @@ public class ClassSize
* size of an array field does not depend on the size of the array. Similarly the size of
* an object (reference) field does not depend on the object.
*
- * Note that this method will throw a SecurityException if the SecurityManager does not
- * let this class execute the method Class.getDeclaredFields(). If this is a concern try
- * to compute the size coefficients at build time.
- * see org.apache.derbyBuild.ClassSizeCrawler
- *
* @param cl A class
* @return the size estimate in bytes.
*
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/types/SqlXmlUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/types/SqlXmlUtil.java?rev=1900593&r1=1900592&r2=1900593&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/types/SqlXmlUtil.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/iapi/types/SqlXmlUtil.java Thu May 5 16:41:51 2022
@@ -136,8 +136,6 @@ public class SqlXmlUtil
* and serialization at some point, we just initialize the
* objects up front.
*/
- // SecurityManager deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
- @SuppressWarnings("removal")
public SqlXmlUtil() throws StandardException
{
try {
@@ -200,12 +198,9 @@ public class SqlXmlUtil
dBF.setValidating(false);
dBF.setNamespaceAware(true);
- if ( System.getSecurityManager() == null )
- {
- dBF.setFeature( XMLConstants.FEATURE_SECURE_PROCESSING, true );
- dBF.setFeature(
- "http://xml.org/sax/features/external-general-entities", false );
- }
+ dBF.setFeature( XMLConstants.FEATURE_SECURE_PROCESSING, true );
+ dBF.setFeature(
+ "http://xml.org/sax/features/external-general-entities", false );
// Load document builder that can be used for parsing XML.
dBuilder = dBF.newDocumentBuilder();
Modified: db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/bytecode/d_BCValidate.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/bytecode/d_BCValidate.java?rev=1900593&r1=1900592&r2=1900593&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/bytecode/d_BCValidate.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/services/bytecode/d_BCValidate.java Thu May 5 16:41:51 2022
@@ -84,12 +84,9 @@ class d_BCValidate
}
// If the class is not in the same class loader then it
- // it must be a non-Derby class. In that case any method etc.
+ // must be a non-Derby class. In that case any method etc.
// being accessed must be public, so don't use the getDeclared
- // methods. Default SecurityManager behaviour is to grant access to public members
- // and members from classes loaded by the same class loader. Thus
- // we try to fall into these categories to avoid having to grant
- // permissions to derby jars for the function tests.
+ // methods.
ClassLoader myLoader = d_BCValidate.class.getClassLoader();
boolean sameClassLoader;
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=1900593&r1=1900592&r2=1900593&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 Thu May 5 16:41:51 2022
@@ -524,7 +524,7 @@ final class JarLoader extends SecureClas
}
/**
- * Provide a SecurityManager with information about the class name
+ * Provide a SecurityException with information about the class name
* and the jar file.
*/
private SecurityException handleException(Exception e, String className) {
Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/SecurityCheck.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/SecurityCheck.java?rev=1900593&r1=1900592&r2=1900593&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/SecurityCheck.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/SecurityCheck.java Thu May 5 16:41:51 2022
@@ -147,11 +147,6 @@ public class SecurityCheck {
* the declared type is java.sql.Connection which has no security risks,
* but the implementation type returned may have many.
*
- * <code>
- * Connection conn = DriverManager.getConnection(url);
- * // will inspect the implementation call, eg. EmbedConnection30
- * SecurityManager.inspect(conn);
- * </code>
* No output is generated by this call,
* the caller must call report() to obtain the risks.
* @param o Obejct to be inspected
Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/TestRoutines.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/TestRoutines.java?rev=1900593&r1=1900592&r2=1900593&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/TestRoutines.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/TestRoutines.java Thu May 5 16:41:51 2022
@@ -62,8 +62,6 @@ public class TestRoutines {
// sleep
s.execute("CREATE PROCEDURE TESTROUTINE.SLEEP(IN SLEEP_TIME_MS BIGINT) NO SQL EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.TestRoutines.sleep' language java parameter style java");
- s.execute("CREATE FUNCTION TESTROUTINE.HAS_SECURITY_MANAGER() RETURNS INT NO SQL EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.TestRoutines.hasSecurityManager' language java parameter style java");
-
s.execute("CREATE FUNCTION TESTROUTINE.READ_FILE(FILE_NAME VARCHAR(60), ENCODING VARCHAR(60)) RETURNS VARCHAR(32000) NO SQL EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.TestRoutines.readFile' language java parameter style java");
s.close();
}
@@ -88,17 +86,6 @@ public class TestRoutines {
}
/**
- * TESTROUTINE.HAS_SECURITY_MANAGER()
- * @return 0 if no security manager is installed, 1 if one is.
- */
- // SecurityManager deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
- @SuppressWarnings("removal")
- public static int hasSecurityManager()
- {
- return System.getSecurityManager() == null ? 0 : 1;
- }
-
- /**
TESTROUTINE.READ_FILE(FILE_NAME VARCHAR(60), ENCODING VARCHAR(60)) RETURNS VARCHAR(32000)
Read a file using the passed in encoding display its contents
as ASCII with unicode esacpes..
Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/junit/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/junit/TestConfiguration.java?rev=1900593&r1=1900592&r2=1900593&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/junit/TestConfiguration.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/junit/TestConfiguration.java Thu May 5 16:41:51 2022
@@ -2229,16 +2229,8 @@ public final class TestConfiguration {
* if the jar has a URL with a file protocol.
*
*/
- // SecurityManager deprecated for removal by JEP 411 https://openjdk.java.net/jeps/411
- @SuppressWarnings("removal")
private static boolean determineClasspath()
{
- // Security manager already installed, assume that
- // it is set up correctly.
- if (System.getSecurityManager() != null) {
- return true;
- }
-
//We need the junit classes to instantiate this class, so the
//following should not cause runtime errors.
setCodebase(TESTING_JUNIT, getURL(junit.framework.Test.class));