saaj
  1. saaj
  2. SAAJ-56

com.sun.xml.messaging.saaj.util.JaxmURI.initializeAuthority(String p_uriSpec) does not support IPv6

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: 1.3.20
    • Component/s: code
    • Labels:
      None

      Description

      private void initializeAuthority(String p_uriSpec)
      throws MalformedURIException {
      int index = 0;
      int start = 0;
      int end = p_uriSpec.length();
      char testChar = '\0';
      String userinfo = null;

      // userinfo is everything up @
      if (p_uriSpec.indexOf('@', start) != -1) {
      while (index < end) {
      testChar = p_uriSpec.charAt(index);
      if (testChar == '@')

      { break; }

      index++;
      }
      userinfo = p_uriSpec.substring(start, index);
      index++;
      }

      // host is everything up to ':'
      String host = null;
      start = index;
      while (index < end) {
      testChar = p_uriSpec.charAt(index);
      if (testChar == ':')

      { break; }

      index++;
      }
      host = p_uriSpec.substring(start, index);
      int port = -1;
      if (host.length() > 0) {
      // port
      if (testChar == ':') {
      index++;
      start = index;
      while (index < end)

      { index++; }

      String portStr = p_uriSpec.substring(start, index);
      if (portStr.length() > 0) {
      for (int i = 0; i < portStr.length(); i++) {
      if (!isDigit(portStr.charAt))

      { throw new MalformedURIException( portStr + " is invalid. Port should only contain digits!"); }

      }
      try

      { port = Integer.parseInt(portStr); }

      catch (NumberFormatException nfe)

      { // can't happen }

      }
      }
      }
      setHost(host);
      setPort(port);
      setUserinfo(userinfo);
      }

      when p_uriSpec follows IPv6 pattern (for instance [fe80:0:0:0:2e0:81ff:fe33:1874]:9992) it throws:
      JaxmURI$MalformedURIException: 0:0:0:2e0:81ff:fe33:1874]:9992 is invalid. Port should only contain digits

        Activity

        Hide
        gagordon added a comment -

        To add IPv6 support here is hard to justify for several reasons. The JDK has supported JAX-WS Dispatch<SOAPMessage> clients using IPv6 since JDK 6, so we recommend that approach be used for IPv6 clients. The SOAPConnection support is now optional in the SAAJ spec, and the call() method may legitimately throw an UnsupportedOperationException. The Dispatch client is more robust and not really any more difficult to use for the simple case of creating a SAAJ message and invoking an endpoint. One would create a Service, add a port with an endpoint URL as a String, create the Dispatch object from the Service and then call invoke() with the SOAPMessage and get the response SOAPMessage.

        I will leave the door open for a while for anyone who wants to contribute a modified version of JaxmURI that supports IPv6 along with adequate test cases, but otherwise this is not likely to be addressed given it will require adding a new parsing module and a switch to recognize whether it is IPv4 or IPv6.

        Show
        gagordon added a comment - To add IPv6 support here is hard to justify for several reasons. The JDK has supported JAX-WS Dispatch<SOAPMessage> clients using IPv6 since JDK 6, so we recommend that approach be used for IPv6 clients. The SOAPConnection support is now optional in the SAAJ spec, and the call() method may legitimately throw an UnsupportedOperationException. The Dispatch client is more robust and not really any more difficult to use for the simple case of creating a SAAJ message and invoking an endpoint. One would create a Service, add a port with an endpoint URL as a String, create the Dispatch object from the Service and then call invoke() with the SOAPMessage and get the response SOAPMessage. I will leave the door open for a while for anyone who wants to contribute a modified version of JaxmURI that supports IPv6 along with adequate test cases, but otherwise this is not likely to be addressed given it will require adding a new parsing module and a switch to recognize whether it is IPv4 or IPv6.
        Hide
        gagordon added a comment -

        Assuming JaxmURI is not being directly invoked by the user, which it should not, the issue is resolved. HttpSOAPConnection.java has been fixed to use java.net.URI, which is IPv6-aware, instead of JaxmURI. Now it should be possible to use SOAPConnection with URLs that contain or map to IPv6 addresses.

        [saaj~svn:410] Fix for JIRA SAAJ-56

        In trunk, not snapshot release yet. Will close when release is pushed.

        Show
        gagordon added a comment - Assuming JaxmURI is not being directly invoked by the user, which it should not, the issue is resolved. HttpSOAPConnection.java has been fixed to use java.net.URI, which is IPv6-aware, instead of JaxmURI. Now it should be possible to use SOAPConnection with URLs that contain or map to IPv6 addresses. [saaj~svn:410] Fix for JIRA SAAJ-56 In trunk, not snapshot release yet. Will close when release is pushed.

          People

          • Assignee:
            gagordon
            Reporter:
            orly_otero
          • Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: