Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8158023

SocketExceptions contain too little information sometimes

XMLWordPrintable

    • b126
    • generic

      In some occasions, the information given by a SocketException could contain some more detail to ease troubleshooting and spot the source code location where it happened. For instance, a little testcase where I constructed a problem would throw an exception like this:

      java.net.SocketException: Bad file number
              at java.net.NetworkInterface.getAll(java.base@9-internal/Native Method)
              at java.net.NetworkInterface.getNetworkInterfaces(java.base@9-internal/NetworkInterface.java:343)
              at com.sap.cl.NetworkInterfaceList8.printInterfaces(NetworkInterfaceList8.java:18)
              at com.sap.cl.NetworkInterfaceList8.main(NetworkInterfaceList8.java:105)


      However, native method java.net.NetworkInterface.getAll dives into several other methods and there are quite a few places where socket exceptions could happen. The information should be extended to something like this:

      java.net.SocketException: ioctl SIOCGSIZIFCONF failed: Bad file number
              at java.net.NetworkInterface.getAll(java.base@9-internal/Native Method)
              at java.net.NetworkInterface.getNetworkInterfaces(java.base@9-internal/NetworkInterface.java:343)
              at com.sap.cl.NetworkInterfaceList8.printInterfaces(NetworkInterfaceList8.java:18)
              at com.sap.cl.NetworkInterfaceList8.main(NetworkInterfaceList8.java:105)

            clanger Christoph Langer
            clanger Christoph Langer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: