< prev index next >

src/com/sun/javatest/agent/AgentMain.java

Print this page
rev 152 : 7902245: Correct Agent.productVersion
Reviewed-by: jjg


 397                 return (ConnectionFactory)(m.newInstance(args));
 398             }
 399             catch (Throwable e) {
 400                 Throwable t = unwrapInvocationTargetException(e);
 401                 if (t instanceof IOException)
 402                     throw new Fault("Cannot create socket on port " + passivePort);
 403                 else {
 404                     String[] msgs = {
 405                         "Error occurred while trying to start a passive agent",
 406                         t.toString(),
 407                         "Are the java.net classes available?"
 408                     };
 409                     throw new Fault(msgs);
 410                 }
 411             }
 412 
 413         case SERIAL:
 414             try {
 415                 Class<?> c = Class.forName(pkg + ".SerialPortConnectionFactory");
 416                 Constructor<?> m = c.getConstructor(new Class<?>[] {String.class, String.class, int.class});
 417                 Object[] args = {serialPort, Agent.productName, new Integer(10*1000)};
 418                 return (ConnectionFactory)(m.newInstance(args));
 419             }
 420             catch (InvocationTargetException e) {
 421                 Throwable t = e.getTargetException();
 422                 if (t instanceof IllegalArgumentException ||
 423                     t.getClass().getName().equals("gnu.io.NoSuchPortException")) {
 424                     throw new Fault(serialPort + " is not a valid port");
 425                 }
 426                 else {
 427                     String[] msgs = {
 428                         "Error occurred while trying to access the communication ports",
 429                         t.toString(),
 430                         "Is the gnu.io extension installed?"
 431                     };
 432                     throw new Fault(msgs);
 433                 }
 434             }
 435             catch (Throwable e) {
 436                 String[] msgs = {
 437                     "Error occurred while trying to access the communication ports",




 397                 return (ConnectionFactory)(m.newInstance(args));
 398             }
 399             catch (Throwable e) {
 400                 Throwable t = unwrapInvocationTargetException(e);
 401                 if (t instanceof IOException)
 402                     throw new Fault("Cannot create socket on port " + passivePort);
 403                 else {
 404                     String[] msgs = {
 405                         "Error occurred while trying to start a passive agent",
 406                         t.toString(),
 407                         "Are the java.net classes available?"
 408                     };
 409                     throw new Fault(msgs);
 410                 }
 411             }
 412 
 413         case SERIAL:
 414             try {
 415                 Class<?> c = Class.forName(pkg + ".SerialPortConnectionFactory");
 416                 Constructor<?> m = c.getConstructor(new Class<?>[] {String.class, String.class, int.class});
 417                 Object[] args = {serialPort, Agent.PRODUCT_NAME, new Integer(10*1000)};
 418                 return (ConnectionFactory)(m.newInstance(args));
 419             }
 420             catch (InvocationTargetException e) {
 421                 Throwable t = e.getTargetException();
 422                 if (t instanceof IllegalArgumentException ||
 423                     t.getClass().getName().equals("gnu.io.NoSuchPortException")) {
 424                     throw new Fault(serialPort + " is not a valid port");
 425                 }
 426                 else {
 427                     String[] msgs = {
 428                         "Error occurred while trying to access the communication ports",
 429                         t.toString(),
 430                         "Is the gnu.io extension installed?"
 431                     };
 432                     throw new Fault(msgs);
 433                 }
 434             }
 435             catch (Throwable e) {
 436                 String[] msgs = {
 437                     "Error occurred while trying to access the communication ports",


< prev index next >