db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1837739 - in /db/derby/code/trunk: ./ java/build/org/apache/derbyBuild/lastgoodjarcontents/ java/locales/ java/org.apache.derby.client/ java/org.apache.derby.client/org/apache/derby/loc/client/ java/org.apache.derby.commons/ java/org.apach...
Date Thu, 09 Aug 2018 15:01:24 GMT
Author: rhillegas
Date: Thu Aug  9 15:01:23 2018
New Revision: 1837739

URL: http://svn.apache.org/viewvc?rev=1837739&view=rev
Log:
DERBY-6945: Make engine, client, and tools localization logic work when Derby runs with a module path; commit derby-6945-47-aa-runModulesWithLocalizations.diff.

Added:
    db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/reference/ModuleUtil.java   (with props)
Removed:
    db/derby/code/trunk/java/org.apache.derby.client/org/apache/derby/loc/client/clientmessagesProviderImpl.java
    db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/loc/client/spi/clientmessagesProvider.java
Modified:
    db/derby/code/trunk/build.xml
    db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derbyTesting.jar.lastcontents
    db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derbyclient.jar.lastcontents
    db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derbyTesting.jar.lastcontents
    db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derbyclient.jar.lastcontents
    db/derby/code/trunk/java/locales/module-info.template
    db/derby/code/trunk/java/org.apache.derby.client/module-info.java
    db/derby/code/trunk/java/org.apache.derby.commons/module-info.java
    db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/i18n/MessageService.java
    db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/i18n/MessageUtil.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/module-info.java
    db/derby/code/trunk/java/org.apache.derby.server/module-info.java
    db/derby/code/trunk/java/org.apache.derby.server/org/apache/derby/drda/server.policy
    db/derby/code/trunk/java/org.apache.derby.server/org/apache/derby/drda/template.policy
    db/derby/code/trunk/java/org.apache.derby.tests/module-info.java
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/NetworkServerControlApiTest.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/ProtocolTest.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/RuntimeInfoTest.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/ServerPropertiesTest.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/SysinfoTest.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/engine/noDeregisterPermission.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbc4/noAbortPermission.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPTests.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.initial.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.modified.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.unreloadable.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/luceneSupport.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/no_derby_internals.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/resultSetReader.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.withPerm.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.withoutPerm.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/replicationTests/Derby5937SlaveShutdownTest.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/unit/fillLog.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/derby_tests.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/nwsvr.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/useprocessfalse.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/AssertFailureTest.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/AssertFailureTest1.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.java
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest1.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest2.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest.policy
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest1.policy
    db/derby/code/trunk/java/org.apache.derby.tools/module-info.java
    db/derby/code/trunk/java/org.apache.derby.tools/org/apache/derby/impl/tools/ij/utilMain.java
    db/derby/code/trunk/java/org.apache.derby.tools/org/apache/derby/impl/tools/sysinfo/Main.java

Modified: db/derby/code/trunk/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/build.xml?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/build.xml (original)
+++ db/derby/code/trunk/build.xml Thu Aug  9 15:01:23 2018
@@ -1743,9 +1743,12 @@
       <param name="info.file" value="${out.testing.dir}/org/apache/derby/info/tsting/info.properties"/>
     </antcall>
 
-    <zip destfile="${derby.jar.dir}/derbyTesting.jar" filesonly="true" compress="true">
-      <fileset dir="${out.testing.dir}" includes="org/apache/derbyTesting/**,toursdb/**,SimpleApp.class,org/apache/derby/info/tsting/**"/>
-    </zip>
+    <delete file="${derby.jar.dir}/derbyTesting.jar"/>
+    <jar destfile="${derby.jar.dir}/derbyTesting.jar"
+         basedir="${out.testing.dir}"
+         compress="true"
+         filesonly="true"/>
+
   </target>
 
   <target name="ckderbytesting">

Modified: db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derbyTesting.jar.lastcontents
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derbyTesting.jar.lastcontents?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derbyTesting.jar.lastcontents (original)
+++ db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derbyTesting.jar.lastcontents Thu Aug  9 15:01:23 2018
@@ -1,3 +1,4 @@
+module-info.class
 org.apache.derbyTesting.functionTests.harness.BackgroundStreamDrainer.class
 org.apache.derbyTesting.functionTests.harness.BackgroundStreamSaver.class
 org.apache.derbyTesting.functionTests.harness.CopySuppFiles.class

Modified: db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derbyclient.jar.lastcontents
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derbyclient.jar.lastcontents?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derbyclient.jar.lastcontents (original)
+++ db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derbyclient.jar.lastcontents Thu Aug  9 15:01:23 2018
@@ -142,4 +142,3 @@ org.apache.derby.client.net.StatementRep
 org.apache.derby.client.net.StatementRequestInterface.class
 org.apache.derby.client.net.Typdef.class
 org.apache.derby.client.net.Utf8CcsidManager.class
-org.apache.derby.loc.client.clientmessagesProviderImpl.class

Modified: db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derbyTesting.jar.lastcontents
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derbyTesting.jar.lastcontents?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derbyTesting.jar.lastcontents (original)
+++ db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derbyTesting.jar.lastcontents Thu Aug  9 15:01:23 2018
@@ -1,3 +1,4 @@
+module-info.class
 org.apache.derbyTesting.functionTests.harness.BackgroundStreamDrainer.class
 org.apache.derbyTesting.functionTests.harness.BackgroundStreamSaver.class
 org.apache.derbyTesting.functionTests.harness.CopySuppFiles.class

Modified: db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derbyclient.jar.lastcontents
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derbyclient.jar.lastcontents?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derbyclient.jar.lastcontents (original)
+++ db/derby/code/trunk/java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derbyclient.jar.lastcontents Thu Aug  9 15:01:23 2018
@@ -142,4 +142,3 @@ org.apache.derby.client.net.StatementRep
 org.apache.derby.client.net.StatementRequestInterface.class
 org.apache.derby.client.net.Typdef.class
 org.apache.derby.client.net.Utf8CcsidManager.class
-org.apache.derby.loc.client.clientmessagesProviderImpl.class

Modified: db/derby/code/trunk/java/locales/module-info.template
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/locales/module-info.template?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/locales/module-info.template (original)
+++ db/derby/code/trunk/java/locales/module-info.template Thu Aug  9 15:01:23 2018
@@ -21,8 +21,15 @@
 
 /**
  * Template for the module descriptor generated
- * for each localization jar file.
+ * for each localization jar file. The localization
+ * jars are declared "open" (for reflective use)
+ * so that the shared module can see their message files
+ * when looking up message ids.
  */
 module org.apache.derby.locale_@LOCALE@
 {
+    // Allow resource lookup via reflection
+    opens org.apache.derby.info.locale_@LOCALE@;
+    opens org.apache.derby.loc.locale_@LOCALE@;
+    opens org.apache.derby.loc.tools.locale_@LOCALE@;
 }

Modified: db/derby/code/trunk/java/org.apache.derby.client/module-info.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.client/module-info.java?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.client/module-info.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.client/module-info.java Thu Aug  9 15:01:23 2018
@@ -41,10 +41,9 @@ module org.apache.derby.client
     requires static java.naming;
 
     //
-    // PUBLISH THE CLIENT MESSAGE LOCALIZATIONS.
+    // ALLOW RESOURCE LOOKUP VIA REFLECTION
     //
-    provides org.apache.derby.loc.client.spi.clientmessagesProvider
-        with org.apache.derby.loc.client.clientmessagesProviderImpl;
+    opens org.apache.derby.loc.client;
 
     //
     // DERBY INTERNAL EXPORTS

Modified: db/derby/code/trunk/java/org.apache.derby.commons/module-info.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.commons/module-info.java?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.commons/module-info.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.commons/module-info.java Thu Aug  9 15:01:23 2018
@@ -28,12 +28,6 @@ module org.apache.derby.commons
     requires java.sql;
 
     //
-    // FOR LOADING MESSAGE LOCALIZATIONS FROM
-    // OTHER MODULES.
-    //
-    uses org.apache.derby.loc.client.spi.clientmessagesProvider;
-
-    //
     // PUBLIC API
     //
     exports org.apache.derby.shared.common.security;
@@ -43,9 +37,6 @@ module org.apache.derby.commons
     //
     // ONLY VISIBLE TO OTHER DERBY MODULES.
     //
-    exports org.apache.derby.loc.client.spi to
-        org.apache.derby.client;
-
     exports org.apache.derby.shared.common.drda to
         org.apache.derby.client,
         org.apache.derby.server,

Modified: db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/i18n/MessageService.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/i18n/MessageService.java?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/i18n/MessageService.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/i18n/MessageService.java Thu Aug  9 15:01:23 2018
@@ -23,9 +23,13 @@ package org.apache.derby.shared.common.i
 
 import org.apache.derby.shared.common.error.ShutdownException;
 import org.apache.derby.shared.common.info.JVMInfo;
+import org.apache.derby.shared.common.reference.ModuleUtil;
 
+import java.io.InputStream;
+import java.io.IOException;
 import java.util.Locale;
 import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
 import java.util.ResourceBundle;
 import java.text.MessageFormat;
 
@@ -44,6 +48,8 @@ public final class MessageService {
 	private static final Locale EN = new Locale("en", "US");
     private static final String LOCALE_STUB = "locale_";
     private static final String CLIENT_MESSAGES = "clientmessages";
+    private static final String TOOLS_MESSAGES = "toolsmessages";
+    private static final String SYSINFO_MESSAGES = "sysinfoMessages";
 
 	private static BundleFinder finder;
 
@@ -259,9 +265,90 @@ public final class MessageService {
 	*/
 	private static ResourceBundle lookupBundle(String resource, Locale locale)
     {
-        return ResourceBundle.getBundle(resource, locale);
+        if (JVMInfo.isModuleAware()) { return lookupBundleInModule(resource, locale); }
+        else { return ResourceBundle.getBundle(resource, locale); }
 	}
   
+	/**
+		Lookup the message in a Jigsaw module.
+	*/
+	public static ResourceBundle lookupBundleInModule(String resource, Locale locale)
+    {
+        String moduleName;
+        boolean useEnglish = locale.getLanguage().equals(EN.getLanguage());
+        boolean useEngineModule = false;
+
+        //
+        // The message localizations should be in one of the following modules:
+        //
+        //   engine jar
+        //   client jar
+        //   tools jar
+        //   locale-specific message jar
+        //
+
+        if (resource.contains(CLIENT_MESSAGES)) { moduleName = ModuleUtil.CLIENT_MODULE_NAME; }
+        else if (resource.contains(TOOLS_MESSAGES) || resource.contains(SYSINFO_MESSAGES))
+        {
+            if (useEnglish){ moduleName = ModuleUtil.TOOLS_MODULE_NAME; }
+            else { moduleName = ModuleUtil.localizationModuleName(locale); }
+        }
+        else // must be engine messages
+        {
+            if (useEnglish) { moduleName = ModuleUtil.ENGINE_MODULE_NAME; }
+            else { moduleName = ModuleUtil.localizationModuleName(locale); }
+
+            useEngineModule = true;
+        }
+
+        Module messageModule = ModuleUtil.jvmSystemModule(moduleName);
+        if (messageModule == null) { return null; }
+
+        StringBuilder buffer = new StringBuilder();
+        buffer.append(resource.replace('.', '/'));
+        if (!useEnglish)
+        {
+            buffer.append("_");
+            buffer.append(locale.toString());
+        }
+        if (useEngineModule)
+        {
+            buffer.append("_en");
+        }
+        buffer.append(".properties");
+        String fullResourceName = buffer.toString();
+
+        return getModuleResourceBundle(fullResourceName, messageModule);
+    }
+
+    /**
+     * Get a resource bundle from a module.
+     *
+     * @param resourceName The name of the resource
+     * @param module The module where it lives
+     *
+     * @return the corresponding resource bundle
+     */
+    private static PropertyResourceBundle getModuleResourceBundle
+       (String resourceName, Module module)
+    {
+        try
+        {
+            InputStream is = module.getResourceAsStream(resourceName);
+            //System.out.println("XXX stream = " + is + " for resourceName " + resourceName + " in module " + module);
+
+            if (is != null)
+            {
+                return new PropertyResourceBundle(is);
+            }
+            else { return null; }
+        }
+        catch (IOException ioe)
+        {
+            return null;
+        }
+    }
+
     /**
         Add a directory level named locale_xx_YY to the resource name
         if it is not the clientmessages resource bundle. So, for instance,

Modified: db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/i18n/MessageUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/i18n/MessageUtil.java?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/i18n/MessageUtil.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/i18n/MessageUtil.java Thu Aug  9 15:01:23 2018
@@ -137,7 +137,7 @@ public class MessageUtil
             // we should compose a default message or throw an exception if
             // the message still is not found.
             return formatMessage(
-                    ResourceBundle.getBundle(resourceBundleName, US), 
+                    MessageService.getBundleWithEnDefault(resourceBundleName, US), 
                     messageId, arguments, composeDefault);
         }
     }

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=1837739&r1=1837738&r2=1837739&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 Thu Aug  9 15:01:23 2018
@@ -52,6 +52,9 @@ public abstract class JVMInfo
         <LI> 9 - J2SE_18 - JDK 1.8
 		</UL>
 	*/
+
+    private static final boolean _isModuleAware;
+  
 	public static final int JDK_ID;
 
     public static final int J2SE_18 = 9;   // Java SE 8
@@ -124,6 +127,8 @@ public abstract class JVMInfo
         }
 
 		JDK_ID = id;
+
+        _isModuleAware = (getSystemModulePath() != null);
 	}
 
 	/**
@@ -180,6 +185,27 @@ public abstract class JVMInfo
     }
     
     /**
+     * Return true if the JVM uses a module path rather than a classpath.
+     *
+     * @return true if it is IBM jvm, false if it is not IBM jvm
+     */
+    public static final boolean isModuleAware()
+    {
+        return _isModuleAware;
+    }
+
+    /**
+     * Get the JVM's system module path. Returns null if the JVM is
+     * not running with a module path.
+     *
+     * @return the system module path (might be null)
+     */
+    public static final String getSystemModulePath()
+    {
+        return getSystemProperty("jdk.module.path");
+    }
+    
+    /**
      * For IBM jvm, this method will dump more diagnostic information to file.
      * JVM specific code for other vender can be added. DERBY-4856 
      *  

Added: db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/reference/ModuleUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/reference/ModuleUtil.java?rev=1837739&view=auto
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/reference/ModuleUtil.java (added)
+++ db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/reference/ModuleUtil.java Thu Aug  9 15:01:23 2018
@@ -0,0 +1,162 @@
+/*
+
+   Derby - Class org.apache.derby.shared.common.reference.ModuleUtil
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to you under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+package org.apache.derby.shared.common.reference;
+
+import java.io.File;
+import java.lang.module.Configuration;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReference;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Locale;
+import java.util.Optional;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.apache.derby.shared.common.info.JVMInfo;
+
+/**
+ * Utility methods for handling the components introduced
+ * by the Java Platform Module System (project Jigsaw)
+ * in Java 9.
+ */
+public class ModuleUtil
+{
+    /////////////////////////////////////////////////////////
+    //
+    // CONSTANTS
+    //
+    /////////////////////////////////////////////////////////
+
+    // module names
+    public static final String ENGINE_MODULE_NAME = "org.apache.derby.engine";
+    public static final String CLIENT_MODULE_NAME = "org.apache.derby.client";
+    public static final String SERVER_MODULE_NAME = "org.apache.derby.server";
+    public static final String RUNNER_MODULE_NAME = "org.apache.derby.runner";
+    public static final String SHARED_MODULE_NAME = "org.apache.derby.commons";
+    public static final String TOOLS_MODULE_NAME = "org.apache.derby.tools";
+    public static final String OPTIONALTOOLS_MODULE_NAME = "org.apache.derby.optionaltools";
+    public static final String TESTING_MODULE_NAME = "org.apache.derby.tests";
+    public static final String LOCALE_MODULE_NAME_PREFIX = "org.apache.derby.locale_";
+
+    /////////////////////////////////////////////////////////
+    //
+    // STATE
+    //
+    /////////////////////////////////////////////////////////
+
+    /** ModuleFinder for modules on the JVM's module path */
+    private static ModuleFinder _systemModuleFinder;
+
+    /////////////////////////////////////////////////////////
+    //
+    // ENTRY POINTS
+    //
+    /////////////////////////////////////////////////////////
+
+    /**
+     * Return the module with the given name located on the system module path.
+     *
+     * @param moduleName The name of the module
+     *
+     * @return the corresponding module, or null if none is found
+     */
+    public static java.lang.Module jvmSystemModule(String moduleName)
+    {
+        if (!JVMInfo.isModuleAware()) { return null; }
+        
+        initModulePaths();  // read system module path
+
+        try
+        {
+            ModuleLayer parent = ModuleLayer.boot();
+            Configuration configuration =
+                parent
+                .configuration()
+                .resolve(_systemModuleFinder, ModuleFinder.of(), Set.of(moduleName));
+            ModuleLayer layer =
+                parent.defineModulesWithOneLoader(configuration, ClassLoader.getSystemClassLoader());
+
+            return layer.findModule(moduleName).orElse(null);
+        }
+        catch (Exception ex)
+        {
+            return null;
+        }
+    }
+
+    /**
+     * Return all of the jigsaw modules on the system module path.
+     *
+     * @param name The name of the module
+     *
+     * @return the corresponding module, or null if none is found
+     */
+    public static Set<ModuleReference> allJvmSystemModules()
+    {
+        if (!JVMInfo.isModuleAware()) { return null; }
+
+        initModulePaths();  // read system module path
+
+        return _systemModuleFinder.findAll();
+    }
+
+    /**
+     * Get the name of the module containing the localized
+     * messages for the given locale.
+     *
+     * @param locale The locale in question
+     *
+     * @return the corresponding module name
+     */
+    public static String localizationModuleName(Locale locale)
+    {
+        return LOCALE_MODULE_NAME_PREFIX + locale.toString();
+    }
+
+    /////////////////////////////////////////////////////////
+    //
+    // MINIONS
+    //
+    /////////////////////////////////////////////////////////
+
+    /**
+     * Initialize the list of module paths if necessary.
+     */
+    private static void initModulePaths()
+    {
+        if (_systemModuleFinder != null) { return; }
+
+        String modulePathString = JVMInfo.getSystemModulePath();
+        StringTokenizer tokens = new StringTokenizer(modulePathString, File.pathSeparator);
+        int tokenCount = tokens.countTokens();
+        Path[] modulePaths = new Path[tokenCount];
+
+        for (int idx = 0; idx < tokenCount; idx++)
+        {
+            modulePaths[idx] = Paths.get(tokens.nextToken());
+        }
+
+        _systemModuleFinder = ModuleFinder.of(modulePaths);
+    }
+
+}

Propchange: db/derby/code/trunk/java/org.apache.derby.commons/org/apache/derby/shared/common/reference/ModuleUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/org.apache.derby.engine/module-info.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.engine/module-info.java?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.engine/module-info.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.engine/module-info.java Thu Aug  9 15:01:23 2018
@@ -55,6 +55,22 @@ module org.apache.derby.engine
     exports org.apache.derby.vti;
 
     //
+    // ALLOW RESOURCE LOOKUP VIA REFLECTION
+    //
+    
+    // ALLOW THE Monitor TO FIND modules.properties
+    opens org.apache.derby;
+    // ALLOW ACCESS TO ENGLISH MESSAGES
+    opens org.apache.derby.loc;
+
+    //
+    // ALLOW CLASS INSTANTIATION VIA REFLECTION
+    //
+    
+    // ALLOW ExceptionFactory TO INSTANTIATE SQLExceptionFactory
+    opens org.apache.derby.impl.jdbc to org.apache.derby.commons;
+    
+    //
     // DERBY INTERNAL EXPORTS
     //
     // VISIBLE ONLY INSIDE derby.jar AT RUNTIME.
@@ -101,9 +117,15 @@ module org.apache.derby.engine
     exports org.apache.derby.iapi.services.jmx to
         org.apache.derby.server;
 
-    exports org.apache.derby.iapi.services.loader to
-        org.apache.derby.optionaltools,
-        org.apache.derby.tests;
+    // FIXME! THE GENERATED CLASSES END UP IN THE UNNAMED MODULE.
+    // BECAUSE THEY REFERENCE GeneratedByteCode, WE HAVE TO EXPORT ITS
+    // PACKAGE. WE SHOULD TIGHTEN THIS UP. MAYBE WE CAN GIVE THE GENERATED
+    // CLASSES THEIR OWN MODULE WHICH CAN RECEIVE THE EXPORT.
+    // THEN WE CAN UNCOMMENT THE EXPORTS TO OTHER MODULES.
+    exports org.apache.derby.iapi.services.loader;
+    //exports org.apache.derby.iapi.services.loader to
+    //    org.apache.derby.optionaltools,
+    //    org.apache.derby.tests;
 
     exports org.apache.derby.iapi.services.locks to
         org.apache.derby.tests;
@@ -121,8 +143,14 @@ module org.apache.derby.engine
     exports org.apache.derby.iapi.services.uuid to
         org.apache.derby.tests;
 
-    exports org.apache.derby.iapi.sql to
-        org.apache.derby.tests;
+    // FIXME! THE GENERATED CLASSES END UP IN THE UNNAMED MODULE.
+    // BECAUSE THEY REFERENCE Row, WE HAVE TO EXPORT ITS
+    // PACKAGE. WE SHOULD TIGHTEN THIS UP. MAYBE WE CAN GIVE THE GENERATED
+    // CLASSES THEIR OWN MODULE WHICH CAN RECEIVE THE EXPORT.
+    // THEN WE CAN UNCOMMENT THE EXPORT TO THE TESTING MODULE.
+    exports org.apache.derby.iapi.sql;
+    //exports org.apache.derby.iapi.sql to
+    //    org.apache.derby.tests;
 
     exports org.apache.derby.iapi.sql.compile to
         org.apache.derby.tests;
@@ -139,8 +167,14 @@ module org.apache.derby.engine
         org.apache.derby.optionaltools,
         org.apache.derby.tests;
 
-    exports org.apache.derby.iapi.sql.execute to
-        org.apache.derby.tests;
+    // FIXME! THE GENERATED CLASSES END UP IN THE UNNAMED MODULE.
+    // BECAUSE THEY REFERENCE ExecutionFactory, WE HAVE TO EXPORT ITS
+    // PACKAGE. WE SHOULD TIGHTEN THIS UP. MAYBE WE CAN GIVE THE GENERATED
+    // CLASSES THEIR OWN MODULE WHICH CAN RECEIVE THE EXPORT.
+    // THEN WE CAN UNCOMMENT THE EXPORT TO THE TESTING MODULE.
+    exports org.apache.derby.iapi.sql.execute;
+    //exports org.apache.derby.iapi.sql.execute to
+    //    org.apache.derby.tests;
 
     exports org.apache.derby.iapi.store.access to
         org.apache.derby.tests;
@@ -169,9 +203,15 @@ module org.apache.derby.engine
     exports org.apache.derby.iapi.transaction to
         org.apache.derby.server;
 
-    exports org.apache.derby.iapi.types to
-        org.apache.derby.optionaltools,
-        org.apache.derby.tests;
+    // FIXME! THE GENERATED CLASSES END UP IN THE UNNAMED MODULE.
+    // BECAUSE THEY REFERENCE DataValueFactory, WE HAVE TO EXPORT ITS
+    // PACKAGE. WE SHOULD TIGHTEN THIS UP. MAYBE WE CAN GIVE THE GENERATED
+    // CLASSES THEIR OWN MODULE WHICH CAN RECEIVE THE EXPORT.
+    // THEN WE CAN UNCOMMENT THE EXPORT TO THE OPTIONALTOOLS AND TESTING MODULES.
+    exports org.apache.derby.iapi.types;
+    //exports org.apache.derby.iapi.types to
+    //    org.apache.derby.optionaltools,
+    //    org.apache.derby.tests;
 
     exports org.apache.derby.iapi.util to
         org.apache.derby.server,
@@ -198,8 +238,14 @@ module org.apache.derby.engine
     exports org.apache.derby.impl.sql to
         org.apache.derby.tests;
 
-    exports org.apache.derby.impl.sql.execute to
-        org.apache.derby.tests;
+    // FIXME! THE GENERATED CLASSES END UP IN THE UNNAMED MODULE.
+    // BECAUSE THEY EXTEND BaseActivation, WE HAVE TO EXPORT ITS
+    // PACKAGE. WE SHOULD TIGHTEN THIS UP. MAYBE WE CAN GIVE THE GENERATED
+    // CLASSES THEIR OWN MODULE WHICH CAN RECEIVE THE EXPORT.
+    // THEN WE CAN UNCOMMENT THE EXPORT TO THE TESTING MODULE.
+    exports org.apache.derby.impl.sql.execute;
+    //exports org.apache.derby.impl.sql.execute to
+    //    org.apache.derby.tests;
 
     exports org.apache.derby.impl.sql.catalog to
         org.apache.derby.tests;

Modified: db/derby/code/trunk/java/org.apache.derby.server/module-info.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.server/module-info.java?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.server/module-info.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.server/module-info.java Thu Aug  9 15:01:23 2018
@@ -46,7 +46,7 @@ module org.apache.derby.server
     //
     exports org.apache.derby.drda;
     exports org.apache.derby.mbeans.drda;
-    
+
     //
     // DERBY INTERNAL EXPORTS
     //

Modified: db/derby/code/trunk/java/org.apache.derby.server/org/apache/derby/drda/server.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.server/org/apache/derby/drda/server.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.server/org/apache/derby/drda/server.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.server/org/apache/derby/drda/server.policy Thu Aug  9 15:01:23 2018
@@ -99,6 +99,7 @@ grant codeBase "${derby.install.url}derb
 // Permissions for shared code (derbyshared.jar)
 //
 grant codeBase "${derby.install.url}derbyshared.jar" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
 //
 // Permissions needed for JMX based management and monitoring, which is only
 // available for JVMs supporting "platform management", that is J2SE 5.0 or better.

Modified: db/derby/code/trunk/java/org.apache.derby.server/org/apache/derby/drda/template.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.server/org/apache/derby/drda/template.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.server/org/apache/derby/drda/template.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.server/org/apache/derby/drda/template.policy Thu Aug  9 15:01:23 2018
@@ -104,6 +104,7 @@ grant codeBase "${derby.install.url}derb
 // Permissions for shared code (derbyshared.jar)
 //
 grant codeBase "${derby.install.url}derbyshared.jar" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
 //
 // Permissions needed for JMX based management and monitoring, which is only
 // available for JVMs supporting "platform management", that is J2SE 5.0 or better.

Modified: db/derby/code/trunk/java/org.apache.derby.tests/module-info.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/module-info.java?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/module-info.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/module-info.java Thu Aug  9 15:01:23 2018
@@ -19,7 +19,7 @@
 
  */
 
-module org.apache.derby.tests
+open module org.apache.derby.tests
 {
     //
     // MANDATORY IMPORTS
@@ -39,8 +39,6 @@ module org.apache.derby.tests
     requires org.apache.derby.optionaltools;
     requires org.apache.derby.runner;
 
-    requires junit;
-
     //
     // OPTIONAL IMPORTS
     //
@@ -51,4 +49,13 @@ module org.apache.derby.tests
     requires static lucene.analyzers.common;
     requires static lucene.core;
     requires static lucene.queryparser;
+    // MAKING THIS STATIC ALLOWS sysinfo TO EXAMINE derbyTesting.jar
+    requires static junit;
+
+    //
+    // PUBLIC API
+    //
+    // NEEDED BY sysinfo
+    exports org.apache.derbyTesting.junit;
+
 }

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/GetCurrentPropertiesTest.policy Thu Aug  9 15:01:23 2018
@@ -122,6 +122,13 @@ grant codeBase "${derbyTesting.netserver
 };
 
 //
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
+//
 // Permissions for the network client (derbyclient.jar)
 //
 grant codeBase "${derbyTesting.client}" {

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/NetworkServerControlApiTest.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/NetworkServerControlApiTest.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/NetworkServerControlApiTest.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/NetworkServerControlApiTest.policy Thu Aug  9 15:01:23 2018
@@ -162,6 +162,13 @@ grant codeBase "${derbyTesting.tools}" {
 };
 
 //
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
+//
 // Permissions for the tests (derbyTesting.jar)
 // We are liberal here, it's not a goal to make the test harness
 // or tests secure.

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/ProtocolTest.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/ProtocolTest.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/ProtocolTest.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/ProtocolTest.policy Thu Aug  9 15:01:23 2018
@@ -35,3 +35,11 @@ grant codeBase "${derbyTesting.testing}"
 grant codeBase "${derbyTesting.netserver}" {
   permission java.io.FilePermission "${user.dir}${/}system${/}-", "read,write";
 };
+
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/RuntimeInfoTest.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/RuntimeInfoTest.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/RuntimeInfoTest.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/RuntimeInfoTest.policy Thu Aug  9 15:01:23 2018
@@ -134,6 +134,13 @@ permission java.util.PropertyPermission
 };
 
 //
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
+//
 // Permissions for the network server (derbynet.jar)
 //
 grant codeBase "${derbyTesting.netserver}" {
@@ -313,6 +320,7 @@ grant {
 grant {
   permission java.io.FilePermission "${jacoco.active}${user.dir}${/}*", "read, write";
   permission java.io.FilePermission "${jacoco.active}${user.dir}${/}..${/}jacoco.exec", "read, write";
+
 };
 
 // When inserting XML values that use external DTD's, the JAXP parser

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.policy Thu Aug  9 15:01:23 2018
@@ -238,6 +238,13 @@ grant codeBase "${derbyTesting.tools}" {
 };
 
 //
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
+//
 // Permissions for the tests (derbyTesting.jar)
 // We are liberal here, it's not a goal to make the test harness
 // or tests secure.

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/ServerPropertiesTest.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/ServerPropertiesTest.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/ServerPropertiesTest.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/ServerPropertiesTest.policy Thu Aug  9 15:01:23 2018
@@ -172,6 +172,13 @@ grant codeBase "${derbyTesting.tools}" {
 };
 
 //
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
+//
 // Permissions for the tests (derbyTesting.jar)
 // We are liberal here, it's not a goal to make the test harness
 // or tests secure.

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/SysinfoTest.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/SysinfoTest.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/SysinfoTest.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/SysinfoTest.policy Thu Aug  9 15:01:23 2018
@@ -207,6 +207,13 @@ grant codeBase "${derbyTesting.tools}" {
 };
 
 //
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
+//
 // Permissions for the tests (derbyTesting.jar)
 // We are liberal here, it's not a goal to make the test harness
 // or tests secure.

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/engine/noDeregisterPermission.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/engine/noDeregisterPermission.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/engine/noDeregisterPermission.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/engine/noDeregisterPermission.policy Thu Aug  9 15:01:23 2018
@@ -216,6 +216,13 @@ grant codeBase "${derbyTesting.tools}" {
 };
 
 //
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
+//
 // Permissions for the tests (derbyTesting.jar)
 // We are liberal here, it's not a goal to make the test harness
 // or tests secure.

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbc4/noAbortPermission.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbc4/noAbortPermission.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbc4/noAbortPermission.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbc4/noAbortPermission.policy Thu Aug  9 15:01:23 2018
@@ -195,6 +195,13 @@ grant codeBase "${derbyTesting.tools}" {
 };
 
 //
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
+//
 // Permissions for the tests (derbyTesting.jar)
 // We are liberal here, it's not a goal to make the test harness
 // or tests secure.

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPTests.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPTests.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPTests.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/LDAPTests.policy Thu Aug  9 15:01:23 2018
@@ -187,6 +187,13 @@ grant codeBase "${derbyTesting.tools}" {
 };
 
 //
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
+//
 // Permissions for the tests (derbyTesting.jar)
 // We are liberal here, it's not a goal to make the test harness
 // or tests secure.

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.policy Thu Aug  9 15:01:23 2018
@@ -166,6 +166,13 @@ grant codeBase "${derbyTesting.tools}" {
 };
 
 //
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
+//
 // Permissions for the tests (derbyTesting.jar)
 // We are liberal here, it's not a goal to make the test harness
 // or tests secure.

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.initial.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.initial.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.initial.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.initial.policy Thu Aug  9 15:01:23 2018
@@ -114,6 +114,13 @@ grant {
   permission java.io.FilePermission "${jacoco.active}${user.dir}${/}..${/}jacoco.exec", "read, write";
 };
 
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
 grant codeBase "${derbyTesting.tools}" {
   permission org.apache.derby.shared.common.security.SystemPermission "engine", "usederbyinternals";
 };

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.modified.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.modified.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.modified.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.modified.policy Thu Aug  9 15:01:23 2018
@@ -81,6 +81,13 @@ grant codeBase "${derbyTesting.testing}"
   permission java.lang.RuntimePermission "setIO"; 
 };
 
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
 grant codeBase "${derbyTesting.tools}" {
   permission org.apache.derby.shared.common.security.SystemPermission "engine", "usederbyinternals";
 };

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.unreloadable.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.unreloadable.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.unreloadable.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/SecurityPolicyReloadingTest.unreloadable.policy Thu Aug  9 15:01:23 2018
@@ -134,6 +134,13 @@ permission java.util.PropertyPermission
 };
 
 //
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
+//
 // Permissions for the tools (derbytools.jar)
 // Ideally this would be more secure, for now the
 // focus is on getting the engine & network server secure.

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/luceneSupport.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/luceneSupport.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/luceneSupport.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/luceneSupport.policy Thu Aug  9 15:01:23 2018
@@ -340,6 +340,13 @@ grant {
   permission java.lang.RuntimePermission "${emma.active}writeFileDescriptor";
 };
 
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
 // Grant the required permissions for JaCoCo (code coverage tool).
 grant {
   permission java.io.FilePermission "${jacoco.active}${user.dir}${/}*", "read, write";

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/no_derby_internals.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/no_derby_internals.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/no_derby_internals.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/no_derby_internals.policy Thu Aug  9 15:01:23 2018
@@ -209,6 +209,13 @@ grant codeBase "${derbyTesting.client}"
 };
 
 //
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
+//
 // Permissions for the tools (derbytools.jar)
 // Ideally this would be more secure, for now the
 // focus is on getting the engine & network server secure.

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/resultSetReader.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/resultSetReader.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/resultSetReader.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/resultSetReader.policy Thu Aug  9 15:01:23 2018
@@ -220,6 +220,13 @@ grant codeBase "${derbyTesting.tools}" {
 };
 
 //
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
+//
 // Permissions for the tests (derbyTesting.jar)
 // We are liberal here, it's not a goal to make the test harness
 // or tests secure.

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.withPerm.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.withPerm.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.withPerm.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.withPerm.policy Thu Aug  9 15:01:23 2018
@@ -94,6 +94,13 @@ grant codeBase "${derbyTesting.antjunit}
     permission java.io.FilePermission "${user.dir}${/}*", "write";
 };
 
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
 grant codeBase "${derbyTesting.tools}" {
   permission org.apache.derby.shared.common.security.SystemPermission "engine", "usederbyinternals";
 };

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.withoutPerm.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.withoutPerm.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.withoutPerm.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/management/CacheManagerMBeanTest.withoutPerm.policy Thu Aug  9 15:01:23 2018
@@ -92,6 +92,13 @@ grant codeBase "${derbyTesting.antjunit}
     permission java.io.FilePermission "${user.dir}${/}*", "write";
 };
 
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
 grant codeBase "${derbyTesting.tools}" {
   permission org.apache.derby.shared.common.security.SystemPermission "engine", "usederbyinternals";
 };

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/replicationTests/Derby5937SlaveShutdownTest.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/replicationTests/Derby5937SlaveShutdownTest.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/replicationTests/Derby5937SlaveShutdownTest.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/replicationTests/Derby5937SlaveShutdownTest.policy Thu Aug  9 15:01:23 2018
@@ -27,3 +27,11 @@ grant codeBase "${derbyTesting.engine}"
   permission java.net.SocketPermission "127.0.0.1", "connect,accept,listen";
   permission java.net.SocketPermission "localhost", "connect,accept,listen";
 };
+
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/tools/derbyrunjartest.policy Thu Aug  9 15:01:23 2018
@@ -19,3 +19,10 @@ grant codeBase "${derbyTesting.testing}"
   permission java.lang.RuntimePermission "getProtectionDomain";
 };
 
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/unit/fillLog.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/unit/fillLog.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/unit/fillLog.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/unit/fillLog.policy Thu Aug  9 15:01:23 2018
@@ -25,3 +25,11 @@ grant codeBase "${derbyTesting.engine}"
   // for unit tests
   permission java.util.PropertyPermission "derbyTesting.unittest.*", "read";
 };
+
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/derby_tests.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/derby_tests.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/derby_tests.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/derby_tests.policy Thu Aug  9 15:01:23 2018
@@ -160,6 +160,7 @@ grant codeBase "${derbyTesting.shared}"
   // do tracing in that directory. Also, it needs read/write permissions in user.dir in order
   // to create the trace files in that directory.
   permission java.util.PropertyPermission "user.dir", "read";
+  permission java.util.PropertyPermission "jdk.module.path", "read";
   permission java.io.FilePermission "${user.dir}${/}-", "read, write"; 
 
   //

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/nwsvr.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/nwsvr.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/nwsvr.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/nwsvr.policy Thu Aug  9 15:01:23 2018
@@ -57,6 +57,13 @@ permission java.lang.RuntimePermission "
 
 };
  
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
 //Required set of permissions to stop the network server, assuming you have
 // secured the '${csinfo.codebase}${/}-' directory
 //Remember to fine tune this as per your environment.

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/useprocessfalse.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/useprocessfalse.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/useprocessfalse.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/useprocessfalse.policy Thu Aug  9 15:01:23 2018
@@ -26,3 +26,10 @@ grant codeBase "${derbyTesting.testing}"
   permission java.lang.RuntimePermission "setIO"; 
 };
 
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/AssertFailureTest.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/AssertFailureTest.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/AssertFailureTest.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/AssertFailureTest.policy Thu Aug  9 15:01:23 2018
@@ -88,6 +88,7 @@ grant codeBase "${derbyTesting.engine}"
 };
 
 grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
 //These are the ones that matter:
 //-----------------------------------------------------------------------------
   permission java.lang.RuntimePermission "getStackTrace";

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/AssertFailureTest1.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/AssertFailureTest1.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/AssertFailureTest1.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/AssertFailureTest1.policy Thu Aug  9 15:01:23 2018
@@ -57,6 +57,13 @@ grant codeBase "${derbyTesting.testing}"
   
 };
 
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
 
 grant codeBase "${derbyTesting.junit}" {
     // This permission is needed when running the tests using ant 1.7

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.java?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.java Thu Aug  9 15:01:23 2018
@@ -236,6 +236,8 @@ public class MissingPermissionsTest exte
                     + getSystemProperty("derbyTesting.tools"));
         args.add("-DderbyTesting.testing="
                     + getSystemProperty("derbyTesting.testing"));
+        args.add("-DderbyTesting.shared="
+                    + getSystemProperty("derbyTesting.shared"));
         args.add("-DderbyTesting.junit="
                     + getSystemProperty("derbyTesting.junit"));
         String antjunit = getSystemProperty("derbyTesting.antjunit");
@@ -376,6 +378,8 @@ public class MissingPermissionsTest exte
                     + getSystemProperty("derbyTesting.tools"));
             args.add("-DderbyTesting.testing="
                     + getSystemProperty("derbyTesting.testing"));
+            args.add("-DderbyTesting.shared="
+                    + getSystemProperty("derbyTesting.shared"));
             args.add("-DderbyTesting.junit="
                     + getSystemProperty("derbyTesting.junit"));
             String antjunit = getSystemProperty("derbyTesting.antjunit");

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.policy Thu Aug  9 15:01:23 2018
@@ -163,6 +163,13 @@ grant {
   permission java.lang.RuntimePermission "${jacoco.active}shutdownHooks";
 };
 
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
 grant codeBase "${derbyTesting.tools}" {
   permission org.apache.derby.shared.common.security.SystemPermission "engine", "usederbyinternals";
 };

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest1.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest1.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest1.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest1.policy Thu Aug  9 15:01:23 2018
@@ -154,6 +154,13 @@ grant codeBase "${derbyTesting.antjunit}
     permission java.io.FilePermission "${user.dir}${/}*", "write";
 };
 
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
 grant codeBase "${derbyTesting.tools}" {
   permission org.apache.derby.shared.common.security.SystemPermission "engine", "usederbyinternals";
 };

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest2.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest2.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest2.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest2.policy Thu Aug  9 15:01:23 2018
@@ -137,6 +137,13 @@ grant codeBase "${derbyTesting.tools}"
   permission org.apache.derby.shared.common.security.SystemPermission "engine", "usederbyinternals";
 };
 
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
 // JUnit jar file tries to read junit.properties in the user's
 // home directory and seems to require permission to read the
 // property user.home as well.

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest.policy Thu Aug  9 15:01:23 2018
@@ -130,6 +130,13 @@ grant codeBase "${derbyTesting.antjunit}
     permission java.io.FilePermission "${user.dir}${/}*", "write";
 };
 
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
 grant codeBase "${derbyTesting.tools}" {
   permission org.apache.derby.shared.common.security.SystemPermission "engine", "usederbyinternals";
 };

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest1.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest1.policy?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest1.policy (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest1.policy Thu Aug  9 15:01:23 2018
@@ -110,6 +110,13 @@ grant codeBase "${derbyTesting.antjunit}
     permission java.io.FilePermission "${user.dir}${/}*", "write";
 };
 
+//
+// Permissions for shared code (derbyshared.jar)
+//
+grant codeBase "${derbyTesting.shared}" {
+  permission java.util.PropertyPermission "jdk.module.path", "read";
+};
+
 grant codeBase "${derbyTesting.tools}" {
   permission org.apache.derby.shared.common.security.SystemPermission "engine", "usederbyinternals";
 };

Modified: db/derby/code/trunk/java/org.apache.derby.tools/module-info.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tools/module-info.java?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tools/module-info.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tools/module-info.java Thu Aug  9 15:01:23 2018
@@ -49,6 +49,11 @@ module org.apache.derby.tools
     exports org.apache.derby.jdbc;
 
     //
+    // ALLOW RESOURCE LOOKUP VIA REFLECTION
+    //
+    opens org.apache.derby.loc.tools;
+
+    //
     // DERBY INTERNAL EXPORTS
     //
     // ONLY VISIBLE TO OTHER DERBY MODULES.

Modified: db/derby/code/trunk/java/org.apache.derby.tools/org/apache/derby/impl/tools/ij/utilMain.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tools/org/apache/derby/impl/tools/ij/utilMain.java?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tools/org/apache/derby/impl/tools/ij/utilMain.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tools/org/apache/derby/impl/tools/ij/utilMain.java Thu Aug  9 15:01:23 2018
@@ -389,6 +389,7 @@ public class utilMain {
     			} catch (Throwable e) {
                     scriptErrorCount++;
     			  	out.println(langUtil.getTextMessage("IJ_JavaErro0",e.toString()));
+                    e.printStackTrace();
 					doTrace(e);
 				}
 
@@ -553,6 +554,7 @@ public class utilMain {
 			doTrace(ie);
 	    } catch (Throwable t) {
 	  		out.println(langUtil.getTextMessage("IJ_JavaErro0_7", t.toString()));
+            t.printStackTrace();
 			doTrace(t);
 	    }
         return false;

Modified: db/derby/code/trunk/java/org.apache.derby.tools/org/apache/derby/impl/tools/sysinfo/Main.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tools/org/apache/derby/impl/tools/sysinfo/Main.java?rev=1837739&r1=1837738&r2=1837739&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tools/org/apache/derby/impl/tools/sysinfo/Main.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tools/org/apache/derby/impl/tools/sysinfo/Main.java Thu Aug  9 15:01:23 2018
@@ -24,6 +24,7 @@ package org.apache.derby.impl.tools.sysi
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Arrays;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Locale;
 import java.io.IOException;
@@ -51,9 +52,11 @@ import java.security.ProtectionDomain;
 import java.security.CodeSource;
 import java.security.AccessController;
 
+import org.apache.derby.shared.common.info.JVMInfo;
 import org.apache.derby.shared.common.info.PropertyNames;
 import org.apache.derby.shared.common.info.ProductVersionHolder;
 import org.apache.derby.shared.common.info.ProductGenusNames;
+import org.apache.derby.shared.common.reference.ModuleUtil;
 
 import org.apache.derby.iapi.tools.i18n.*;
 
@@ -103,6 +106,8 @@ public final class Main {
     private final static LocalizedResource LOCALIZED_RESOURCE =
         new LocalizedResource(LocalizedResource.SYSINFO_MESSAGE_FILE);
 
+    private static final String TEST_CLASS_NAME = "org.apache.derbyTesting.junit.XATestUtil";
+  
   /**
     Application entry point for SysInfo.   This will print out
     the Derby product information as well as a snapshot of
@@ -226,8 +231,15 @@ public static void getMainInfo (java.io.
 
 	  String classpath = null;
 
-      try {
-          classpath = AccessController.doPrivileged( new PrivilegedAction<String>()
+      if (JVMInfo.isModuleAware())
+      {
+          classpath = JVMInfo.getSystemModulePath();
+      }
+      else
+      {
+          try
+          {
+              classpath = AccessController.doPrivileged( new PrivilegedAction<String>()
               {
                   public String run()
                   {
@@ -235,12 +247,13 @@ public static void getMainInfo (java.io.
                   }
               }
               );
-	  }
-	  catch (SecurityException se) {
-          localAW.println(
-              Main.getTextMessage ("SIF01.U", se.getMessage()));
-		  classpath = null;
-	  }
+	      }
+	      catch (SecurityException se)
+          {
+              localAW.println(Main.getTextMessage ("SIF01.U", se.getMessage()));
+              classpath = null;
+          }
+      }
 
       ZipInfoProperties zip[]= Main.getAllInfo (classpath);
 
@@ -435,29 +448,39 @@ public static void getMainInfo (java.io.
     // If so, then read the properties, and print them out.
 
 	Locale[] supportedLocales = Locale.getAvailableLocales();
-	String[] stringLocales = new String[supportedLocales.length];
-    for (int i = 0; i < supportedLocales.length; i++)
-	{
-		stringLocales[i] = supportedLocales[i].toString();
-	}
-	java.util.Arrays.sort(stringLocales);
+    Arrays.sort(supportedLocales, new LocaleSorter());
 
     Properties p = new Properties ();
-    for (int i = 0; i < stringLocales.length; i++) {
+    for (int i = 0; i < supportedLocales.length; i++) {
 
-      String localeResource =
-         "/org/apache/derby/info/locale_" + stringLocales[i] + "/info.properties";
+      final Locale locale = supportedLocales[i];
+      final String localeString = locale.toString();
+      final String finalLocaleResource =
+         "/org/apache/derby/info/locale_" + localeString + "/info.properties";
       
       final Properties finalp = p;
-      final String finalLocaleResource = localeResource;
      
       try {     
-        	InputStream is = AccessController.doPrivileged
-            (new PrivilegedAction<InputStream>() {
-                  public InputStream run() {
+          InputStream is = AccessController.doPrivileged
+            (new PrivilegedExceptionAction<InputStream>() {
+                  public InputStream run() throws IOException {
                     Class loadingClass = Main.class;
-  		            InputStream locis =
-  		            	loadingClass.getResourceAsStream (finalLocaleResource);
+                    InputStream locis = null;
+
+                    if (JVMInfo.isModuleAware())
+                    {
+                        String moduleName = ModuleUtil.localizationModuleName(locale);
+                        Module localizationModule = ModuleUtil.jvmSystemModule(moduleName);
+
+                        if (localizationModule != null)
+                        {
+                            locis = localizationModule.getResourceAsStream(finalLocaleResource);
+                        }
+                    }
+                    else
+                    {
+                        locis = loadingClass.getResourceAsStream (finalLocaleResource);
+                    }
   					return locis;
                   }
               }
@@ -514,7 +537,7 @@ public static void getMainInfo (java.io.
 
       }
       catch (Throwable t) {
-        localAW.println ("Could not load resource: " + localeResource);
+        localAW.println ("Could not load resource: " + finalLocaleResource);
         localAW.println ("Exception: " + t);
       }
 
@@ -542,14 +565,30 @@ public static void getMainInfo (java.io.
       final String finalTstingResource = tstingResource;
       try {
           InputStream is = AccessController.doPrivileged
-                  (new PrivilegedAction<InputStream>() {
-                      public InputStream run() {
+                  (new PrivilegedExceptionAction<InputStream>() {
+                      public InputStream run() throws IOException {
                           Class loadingClass = Main.class;
-                          InputStream is =
-                                  loadingClass.getResourceAsStream (finalTstingResource);
+                          InputStream is = null;
+
+                          if (JVMInfo.isModuleAware())
+                          {
+                              String moduleName = ModuleUtil.TESTING_MODULE_NAME;
+                              Module testingModule = ModuleUtil.jvmSystemModule(moduleName);
+
+                              if (testingModule != null)
+                              {
+                                  is = testingModule.getResourceAsStream(finalTstingResource);
+                              }
+                          }
+                          else
+                          {
+                              is = loadingClass.getResourceAsStream (finalTstingResource);
+                          }
+                          
                           return is;
                       }
                   });
+
           if (is == null) {
               //localAW.println("resource is null: " + tstingResource);
           }
@@ -560,24 +599,44 @@ public static void getMainInfo (java.io.
                   //Displaying Testing info
                   //String tstingName = p.getProperty("derby.tsting.external.name");
 
-                  StringBuffer successes = new StringBuffer(Main.getTextMessage(crLf()));
-                  StringBuffer failures = new StringBuffer(crLf() + Main.getTextMessage("SIF08.E") + crLf());
-                  tryTstingClasspath(successes, failures);
-                  String successString = successes.toString();
-
-                  if (successString.isEmpty() || successString.length()<=2)
+                  URL testJarURL = null;
+                  
+                  if (JVMInfo.isModuleAware())
+                  {
+                      try
+                      {
+                          Module testingModule = ModuleUtil.jvmSystemModule(ModuleUtil.TESTING_MODULE_NAME);
+                          Class testingClass = testingModule.getClassLoader().loadClass(TEST_CLASS_NAME);
+                          testJarURL = testingClass.getProtectionDomain().getCodeSource().getLocation();
+                      }
+                      catch (Exception ex) {}
+                  }
+                  else
                   {
-                      // if we don't have the BaseTestCase class, assume we don't have any of the
-                      // testing classes, and just print nothing
-                      // this would be the situation that end-users would likely see.
-                      return;
+                      StringBuffer successes = new StringBuffer(Main.getTextMessage(crLf()));
+                      StringBuffer failures =
+                          new StringBuffer(crLf() + Main.getTextMessage("SIF08.E") + crLf());
+                      tryTstingClasspath(successes, failures);
+                      String successString = successes.toString();
+
+                      if (successString.isEmpty() || successString.length()<=2)
+                      {
+                          // if we don't have the BaseTestCase class, assume we don't have any of the
+                          // testing classes, and just print nothing
+                          // this would be the situation that end-users would likely see.
+                          return;
+                      }
+
+                      testJarURL = new URL(successString);
                   }
 
+                  if (testJarURL == null) { return; }
+
                   // show the path and add brackets like we do for the core classes
                   localAW.println(hdr);
                   localAW.print("\t ");
                   localAW.print("[");
-                  localAW.print(formatURL(new URL(successString)));
+                  localAW.print(formatURL(testJarURL));
                   localAW.println("]");
                   // show the version info
                   int major = Integer.parseInt(p.getProperty ("derby.tsting.version.major"));
@@ -1341,5 +1400,14 @@ public static void getMainInfo (java.io.
         return result;
     }
 
+
+    public static class LocaleSorter implements Comparator<Locale>
+    {
+        public int compare(Locale left, Locale right)
+        {
+            return left.toString().compareTo(right.toString());
+        }
+    }
+
 } // end of class Main
 



Mime
View raw message