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

CXF assumes class.getPackage() is never null

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.0.8, 2.1.2
    • Component/s: Core
    • Labels:
      None
    • Estimated Complexity:
      Novice

      Description

      One example, JAXBExtensionHelper has this line:

      cls.getPackage().getAnnotation(XmlSchema.class)

      According to the javadocs of Class.getPackage, a classloader may return null if it has not defined a package for the class. Specifying a package is optional, so the class needs to handle getPackage() returning null.

      Note that some CXF developers seem to understand this restriction, and so parts of the codebase perform the correct null check for getPackage(), but others seem unaware of it, and so do not check for null. The right solution is to go through every call to getPackage() and add a null check.

      If needed (and if it'd speed up the fixing), I can supply a patch to apply to fix all occurrences of this issue.

        Attachments

        1. cxf-1689.patch
          20 kB
          Hani Suleiman

          Activity

            People

            • Assignee:
              dkulp Daniel Kulp
              Reporter:
              hani Hani Suleiman
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: