jdk/src/share/classes/sun/rmi/server/Activation.java
changeset 12040 558b0e0d5910
parent 9502 de183d393b77
child 13041 8477cb6992be
--- a/jdk/src/share/classes/sun/rmi/server/Activation.java	Fri Mar 02 17:24:08 2012 +0000
+++ b/jdk/src/share/classes/sun/rmi/server/Activation.java	Fri Mar 02 13:48:43 2012 -0800
@@ -138,7 +138,6 @@
 
     /** indicate compatibility with JDK 1.2 version of class */
     private static final long serialVersionUID = 2921265612698155191L;
-
     private static final byte MAJOR_VERSION = 1;
     private static final byte MINOR_VERSION = 0;
 
@@ -298,6 +297,7 @@
     private static class SystemRegistryImpl extends RegistryImpl {
 
         private static final String NAME = ActivationSystem.class.getName();
+        private static final long serialVersionUID = 4877330021609408794L;
         private final ActivationSystem systemStub;
 
         SystemRegistryImpl(int port,
@@ -804,9 +804,8 @@
         ActivationGroupDesc desc = null;
         ActivationGroupID groupID = null;
         long incarnation = 0;
-        Map<ActivationID,ObjectEntry> objects =
-            new HashMap<ActivationID,ObjectEntry>();
-        Set<ActivationID> restartSet = new HashSet<ActivationID>();
+        Map<ActivationID,ObjectEntry> objects = new HashMap<>();
+        Set<ActivationID> restartSet = new HashSet<>();
 
         transient ActivationInstantiator group = null;
         transient int status = NORMAL;
@@ -1057,6 +1056,11 @@
             }
         }
 
+       /*
+        * Fallthrough from TERMINATE to TERMINATING
+        * is intentional
+        */
+        @SuppressWarnings("fallthrough")
         private void await() {
             while (true) {
                 switch (status) {
@@ -1228,14 +1232,13 @@
                     PipeWriter.plugTogetherPair
                         (child.getInputStream(), System.out,
                          child.getErrorStream(), System.err);
-
-                    MarshalOutputStream out =
-                        new MarshalOutputStream(child.getOutputStream());
-                    out.writeObject(id);
-                    out.writeObject(desc);
-                    out.writeLong(incarnation);
-                    out.flush();
-                    out.close();
+                    try (MarshalOutputStream out =
+                            new MarshalOutputStream(child.getOutputStream())) {
+                        out.writeObject(id);
+                        out.writeObject(desc);
+                        out.writeLong(incarnation);
+                        out.flush();
+                    }
 
 
                 } catch (IOException e) {
@@ -1352,7 +1355,7 @@
         cmdenv = desc.getCommandEnvironment();
 
         // argv is the literal command to exec
-        List<String> argv = new ArrayList<String>();
+        List<String> argv = new ArrayList<>();
 
         // Command name/path
         argv.add((cmdenv != null && cmdenv.getCommandPath() != null)
@@ -1957,7 +1960,7 @@
             }
 
             String log = null;
-            List<String> childArgs = new ArrayList<String>();
+            List<String> childArgs = new ArrayList<>();
 
             /*
              * Parse arguments
@@ -2031,8 +2034,7 @@
                 }
 
                 try {
-                    Class<?> execPolicyClass =
-                        RMIClassLoader.loadClass(execPolicyClassName);
+                    Class<?> execPolicyClass = getRMIClass(execPolicyClassName);
                     execPolicy = execPolicyClass.newInstance();
                     execPolicyMethod =
                         execPolicyClass.getMethod("checkExecCommand",
@@ -2123,6 +2125,10 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
+    private static Class<?> getRMIClass(String execPolicyClassName) throws Exception  {
+        return RMIClassLoader.loadClass(execPolicyClassName);
+    }
     /*
      * Dijkstra semaphore operations to limit the number of subprocesses
      * rmid attempts to make at once.