classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: Preparing CORBA for 1.6 release - 1.


From: Meskauskas Audrius
Subject: [cp-patches] FYI: Preparing CORBA for 1.6 release - 1.
Date: Tue, 28 Jun 2005 16:09:03 +0200
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Checking of all tests and examples I found the regression in
gnu/CORBA/NamingService/NamingServiceTransient.java. This patch fixes
the discovered regression. During regression search I noticed that bug would be
easier to find if rethrowing the catched exception in submit method of the
gnuRequest.java. Instead of returning null that fails later anyway the method now
rethrows MARSHAL with the initialised cause.

2005-06-28  Audrius Meskauskas  <address@hidden>


* gnu/CORBA/gnuRequest.java (submit): If IOException is thrown while opening
   a socket, rethrow MARSHAL.
* gnu/CORBA/NamingService/NamingServiceTransient.java (main): Fixed regression
   due that the service started on the wrong port.

Index: gnu/CORBA/gnuRequest.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/CORBA/gnuRequest.java,v
retrieving revision 1.6
diff -u -r1.6 gnuRequest.java
--- gnu/CORBA/gnuRequest.java   7 Jun 2005 13:30:11 -0000       1.6
+++ gnu/CORBA/gnuRequest.java   28 Jun 2005 13:14:10 -0000
@@ -667,7 +667,7 @@
 
     Socket socket = null;
 
-    java.lang.Object key = ior.Internet.host+":"+ior.Internet.port;
+    java.lang.Object key = ior.Internet.host + ":" + ior.Internet.port;
 
     synchronized (SocketRepository.class)
       {
@@ -743,7 +743,12 @@
       }
     catch (IOException io_ex)
       {
-        return null;
+        MARSHAL m =
+          new MARSHAL("Unable to open a socket at " + ior.Internet.host + ":" +
+                      ior.Internet.port
+                     );
+        m.initCause(io_ex);
+        throw m;
       }
     finally
       {
@@ -752,9 +757,7 @@
             if (socket != null && !socket.isClosed())
               {
                 socket.setSoTimeout(Functional_ORB.TANDEM_REQUESTS);
-                SocketRepository.put_socket(key,
-                                            socket
-                                           );
+                SocketRepository.put_socket(key, socket);
               }
           }
         catch (IOException scx)
Index: gnu/CORBA/NamingService/NamingServiceTransient.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java,v
retrieving revision 1.2
diff -u -r1.2 NamingServiceTransient.java
--- gnu/CORBA/NamingService/NamingServiceTransient.java 21 Jun 2005 10:30:55 
-0000      1.2
+++ gnu/CORBA/NamingService/NamingServiceTransient.java 28 Jun 2005 13:22:14 
-0000
@@ -102,17 +102,9 @@
     String iorf = null;
     try
       {
-        Functional_ORB.setPort(PORT);
-
         // Create and initialize the ORB
         final Functional_ORB orb = new Functional_ORB();
 
-        Functional_ORB.setPort(Functional_ORB.DEFAULT_INITIAL_PORT);
-
-        // Create the servant and register it with the ORB
-        NamingContextExt namer = new Ext(new TransientContext());
-        orb.connect(namer, getDefaultKey());
-
         if (args.length > 1)
           for (int i = 0; i < args.length - 1; i++)
             {
@@ -123,7 +115,11 @@
                 iorf = args [ i + 1 ];
             }
 
-        orb.setPort(port);
+        Functional_ORB.setPort(port);
+
+        // Create the servant and register it with the ORB
+        NamingContextExt namer = new Ext(new TransientContext());
+        orb.connect(namer, getDefaultKey());
 
         // Storing the IOR reference.
         String ior = orb.object_to_string(namer);
@@ -147,7 +143,7 @@
           {
             public void run()
             {
-              // wait for invocations from clients
+              // Wait for invocations from clients.
               orb.run();
             }
           }.start();
@@ -157,5 +153,8 @@
         System.err.println("ERROR: " + e);
         e.printStackTrace(System.out);
       }
+
+    // Restore the default value for allocating ports for the subsequent 
objects.
+    Functional_ORB.setPort(Functional_ORB.DEFAULT_INITIAL_PORT);
   }
 }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]