You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Hani Suleiman (JIRA)" <ji...@apache.org> on 2008/07/09 07:32:31 UTC

[jira] Updated: (CXF-1689) CXF assumes class.getPackage() is never null

     [ https://issues.apache.org/jira/browse/CXF-1689?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hani Suleiman updated CXF-1689:
-------------------------------

    Attachment: cxf-1689.patch

Fixing the code: 10 minutes
Running tests to find checkstyle violations: 4 hours
Getting closer to switching to cxf from xfire: priceless

Patch enclosed. Some tests fail, but the same ones fail without the patch so all is well.

> CXF assumes class.getPackage() is never null
> --------------------------------------------
>
>                 Key: CXF-1689
>                 URL: https://issues.apache.org/jira/browse/CXF-1689
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1.1
>            Reporter: Hani Suleiman
>             Fix For: 2.1.2, 2.0.8
>
>         Attachments: cxf-1689.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.