Uploaded image for project: 'XML-RPC'
  1. XML-RPC
  2. XMLRPC-104

org.apache.xmlrpc.util.HttpUtil.parseAuthorization passes null charset to String(byte[] bytes, String charsetName);

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0rc1
    • 3.0
    • Source
    • None

    Description

      java.lang.NullPointerException: charsetName
      at java.lang.String.<init>(String.java:403)
      at java.lang.String.<init>(String.java:433)
      at org.apache.xmlrpc.util.HttpUtil.parseAuthorization(HttpUtil.java:149)
      at org.apache.xmlrpc.webserver.Connection.getRequestConfig(Connection.java:162)
      at org.apache.xmlrpc.webserver.Connection.run(Connection.java:174)
      at org.apache.xmlrpc.util.ThreadPool$MyThread.runTask(ThreadPool.java:71)
      at org.apache.xmlrpc.util.ThreadPool$MyThread.run(ThreadPool.java:87)

      Code in question, from HttpUtil.parseAuthorization():
      String auth = st.nextToken();
      try {
      byte[] c = Base64.decode(auth.toCharArray(), 0, auth.length());
      String str = new String(c, pConfig.getBasicEncoding()); <-- Will return null
      int col = str.indexOf(':');
      if (col >= 0)

      { pConfig.setBasicUserName(str.substring(0, col)); pConfig.setBasicPassword(str.substring(col+1)); }

      If no charset is specifed, shouldn't the code assume UTF-8 (or ISO-8859-1)?

      Attachments

        Issue Links

          Activity

            People

              jochen@apache.org Jochen Wiedmann
              landonf Landon Fuller
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Slack

                  Issue deployment