sexta-feira, julho 02, 2004

Exception por initcause

Interessante se usar esse tipo de throw qdo temos beans ... ele faz um "track" completo da exception vc não perder as pilhas da exception

throw (SQLException) new SQLException().initCause(e);

Sun training center no brasil 0800.55.7863

Para comprar os vouchers ou agendar as provas ... 0800.55.7863

Descobrir o ip address

 public void getInterfaces() {
  try {
   Enumeration e = NetworkInterface.getNetworkInterfaces();

   while (e.hasMoreElements()) {
    NetworkInterface netface = (NetworkInterface) e.nextElement();
    System.out.println("Net interface: " + netface.getName());

    Enumeration e2 = netface.getInetAddresses();

    while (e2.hasMoreElements()) {
     InetAddress ip = (InetAddress) e2.nextElement();
     System.out.println("IP address: " + ip.toString());
    }
   }
  } catch (Exception e) {
   System.out.println("e: " + e);
  }
 }