Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-2785

Base64Utils.decode should handle/wrap all exception types.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.6
    • Fix Version/s: 2.2.8, 2.3
    • Component/s: Core
    • Labels:
      None

      Description

      Currently if you pass an invalid base64 encoded string to Base64Utils.decode() you can get various kinds of errors, as the code only catches at most IOException and converts that to a Base64Exception. Should really catch Exception and log it appropriately to avoid seeing errors at runtime like this:

      java.lang.ArrayIndexOutOfBoundsException: 8
      at org.apache.cxf.common.util.Base64Utility.processEncodeme(Base64Utility.java:345)
      at org.apache.cxf.common.util.Base64Utility.decodeChunk(Base64Utility.java:164)
      at org.apache.cxf.common.util.Base64Utility.decode(Base64Utility.java:180)
      at org.apache.cxf.transport.http.AbstractHTTPDestination.setHeaders(AbstractHTTPDestination.java:147)
      at org.apache.cxf.transport.http.AbstractHTTPDestination.setupMessage(AbstractHTTPDestination.java:333)
      at org.apache.cxf.transport.http.AbstractHTTPDestination.setupMessage(AbstractHTTPDestination.java:270)
      at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:302)
      at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:276)
      at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
      ...

      The attached patch does this.

        Attachments

        1. patch.txt
          3 kB
          Stanley J. Lewis

          Activity

            People

            • Assignee:
              njiang Willem Jiang
              Reporter:
              slewis Stanley J. Lewis
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: