38 |
|
|
39 |
package gnu.CORBA.GIOP; |
package gnu.CORBA.GIOP; |
40 |
|
|
41 |
|
import gnu.CORBA.OrbFunctional; |
42 |
import gnu.CORBA.IOR; |
import gnu.CORBA.IOR; |
43 |
|
import gnu.CORBA.Minor; |
44 |
|
|
45 |
import java.io.IOException; |
import java.io.IOException; |
46 |
import java.io.OutputStream; |
import java.io.OutputStream; |
48 |
import java.net.Socket; |
import java.net.Socket; |
49 |
|
|
50 |
import org.omg.CORBA.MARSHAL; |
import org.omg.CORBA.MARSHAL; |
51 |
|
import org.omg.CORBA.ORB; |
52 |
|
|
53 |
/** |
/** |
54 |
* The error message is sent in response to the message, encoded |
* The error message is sent in response to the message, encoded |
62 |
public class ErrorMessage |
public class ErrorMessage |
63 |
extends MessageHeader |
extends MessageHeader |
64 |
{ |
{ |
65 |
|
/** |
66 |
|
* Use serialVersionUID for interoperability. |
67 |
|
*/ |
68 |
|
private static final long serialVersionUID = 1; |
69 |
|
|
70 |
/** |
/** |
71 |
* Create a new error message, setting the message field |
* Create a new error message, setting the message field |
72 |
* to the {@link MESSAGE_ERROR} and the version number to |
* to the {@link MESSAGE_ERROR} and the version number to |
81 |
/** |
/** |
82 |
* Send the error message to the given IOR address. |
* Send the error message to the given IOR address. |
83 |
* |
* |
84 |
* @param to the IOR address (host and port, other fields |
* @param ior the IOR address (host and port, other fields |
85 |
* are not used). |
* are not used). |
86 |
|
* |
87 |
|
* @param orb the ORB, sending the error message. |
88 |
*/ |
*/ |
89 |
public void send(IOR ior) |
public void send(IOR ior, ORB orb) |
90 |
{ |
{ |
91 |
try |
try |
92 |
{ |
{ |
93 |
Socket socket = new Socket(ior.Internet.host, ior.Internet.port); |
Socket socket; |
94 |
|
|
95 |
|
if (orb instanceof OrbFunctional) |
96 |
|
socket = ((OrbFunctional) orb).socketFactory.createClientSocket( |
97 |
|
ior.Internet.host, ior.Internet.port); |
98 |
|
else |
99 |
|
socket = new Socket(ior.Internet.host, ior.Internet.port); |
100 |
|
|
101 |
OutputStream socketOutput = socket.getOutputStream(); |
OutputStream socketOutput = socket.getOutputStream(); |
102 |
write(socketOutput); |
write(socketOutput); |
106 |
catch (IOException ex) |
catch (IOException ex) |
107 |
{ |
{ |
108 |
MARSHAL t = new MARSHAL(); |
MARSHAL t = new MARSHAL(); |
109 |
|
t.minor = Minor.Header; |
110 |
t.initCause(ex); |
t.initCause(ex); |
111 |
throw t; |
throw t; |
112 |
} |
} |