From 98dfcef355d8d68360fde70afb52bc4250b1926b Mon Sep 17 00:00:00 2001 From: William Deegan Date: Tue, 2 Oct 2018 12:13:38 -0700 Subject: Update to use paths set by javac, rmic. Also update RMISecurityManager to SecurityManager (RMI.. has been deprecated for some time. JDK 1.8 started to issue deprecation warnings and break test) --- test/Java/RMIC.py | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/test/Java/RMIC.py b/test/Java/RMIC.py index 19e799e..021f666 100644 --- a/test/Java/RMIC.py +++ b/test/Java/RMIC.py @@ -32,6 +32,8 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() +# test.verbose_set(1) + test.write('myrmic.py', r""" import os import sys @@ -74,7 +76,6 @@ test.run(arguments = '.', stderr = None) test.must_match(['outdir', 'test1.class'], "test1.java\nline 3\n", mode='r') if os.path.normcase('.java') == os.path.normcase('.JAVA'): - test.write('SConstruct', """\ env = Environment(tools = ['rmic'], RMIC = r'%(_python_)s myrmic.py') @@ -103,6 +104,12 @@ if java_version.count('.') == 1: curver = (int(major), int(minor)) except: pass +elif java_version.count('.') == 0: + # java 11? + try: + curver = (int(java_version), 0) + except: + pass # Check the version of the found Java compiler. # If it's 1.8 or higher, we skip the further RMIC test @@ -118,9 +125,7 @@ if curver < (1, 8): test.file_fixture('wrapper_with_args.py') test.write('SConstruct', """ -foo = Environment(tools = ['javac', 'rmic'], - JAVAC = r'%(where_javac)s', - RMIC = r'%(where_rmic)s') +foo = Environment(tools = ['javac', 'rmic']) foo.Java(target = 'class1', source = 'com/sub/foo') foo.RMIC(target = 'outdir1', source = ['class1/com/sub/foo/Example1.class', @@ -161,7 +166,7 @@ package com.sub.foo; import java.rmi.Naming; import java.rmi.RemoteException; -import java.rmi.RMISecurityManager; +import java.lang.SecurityManager; import java.rmi.server.UnicastRemoteObject; public class Example1 extends UnicastRemoteObject implements Hello { @@ -178,7 +183,7 @@ public class Example1 extends UnicastRemoteObject implements Hello { public static void main(String args[]) { if (System.getSecurityManager() == null) { - System.setSecurityManager(new RMISecurityManager()); + System.setSecurityManager(new SecurityManager()); } try { @@ -200,7 +205,7 @@ package com.sub.foo; import java.rmi.Naming; import java.rmi.RemoteException; -import java.rmi.RMISecurityManager; +import java.lang.SecurityManager; import java.rmi.server.UnicastRemoteObject; public class Example2 extends UnicastRemoteObject implements Hello { @@ -217,7 +222,7 @@ public class Example2 extends UnicastRemoteObject implements Hello { public static void main(String args[]) { if (System.getSecurityManager() == null) { - System.setSecurityManager(new RMISecurityManager()); + System.setSecurityManager(new SecurityManager()); } try { @@ -250,7 +255,7 @@ package com.sub.bar; import java.rmi.Naming; import java.rmi.RemoteException; -import java.rmi.RMISecurityManager; +import java.lang.SecurityManager; import java.rmi.server.UnicastRemoteObject; public class Example3 extends UnicastRemoteObject implements Hello { @@ -267,7 +272,7 @@ public class Example3 extends UnicastRemoteObject implements Hello { public static void main(String args[]) { if (System.getSecurityManager() == null) { - System.setSecurityManager(new RMISecurityManager()); + System.setSecurityManager(new SecurityManager()); } try { @@ -289,7 +294,7 @@ package com.sub.bar; import java.rmi.Naming; import java.rmi.RemoteException; -import java.rmi.RMISecurityManager; +import java.lang.SecurityManager; import java.rmi.server.UnicastRemoteObject; public class Example4 extends UnicastRemoteObject implements Hello { @@ -306,7 +311,7 @@ public class Example4 extends UnicastRemoteObject implements Hello { public static void main(String args[]) { if (System.getSecurityManager() == null) { - System.setSecurityManager(new RMISecurityManager()); + System.setSecurityManager(new SecurityManager()); } try { @@ -326,7 +331,7 @@ public class Example4 extends UnicastRemoteObject implements Hello { test.run(arguments = '.') test.must_match('wrapper.out', - "wrapper_with_args.py %s -d outdir2 -classpath class2 com.sub.bar.Example3 com.sub.bar.Example4\n" % where_rmic, + "wrapper_with_args.py rmic -d outdir2 -classpath class2 com.sub.bar.Example3 com.sub.bar.Example4\n", mode='r') test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example1_Stub.class')) -- cgit v0.12