You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Neal Hu (JIRA)" <ji...@apache.org> on 2016/11/25 15:12:59 UTC

[jira] [Commented] (CXF-7124) PackageUtils.getSharedPackageName(List>) has bug

    [ https://issues.apache.org/jira/browse/CXF-7124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15696078#comment-15696078 ] 

Neal Hu commented on CXF-7124:
------------------------------

Dear Sergey,

Please reopen the ticket, the patch has bug.
{code:java}
    @Test
    public void testSharedPackageNameManyClassesCommonRoot6() {
        String packageName = PackageUtils.getSharedPackageName(
            Arrays.asList(org.apache.cxf.bus.spring.BusApplicationContext.class,
                    org.apache.cxf.configuration.spring.JAXBBeanFactory.class));
        assertEquals("org.apache.cxf", packageName);
    }
Failed tests: 
  PackageUtilsTest.testSharedPackageNameManyClassesCommonRoot6:101->Assert.assertEquals:144->Assert.assertEquals:115 expected:<org.apache.cxf[]> but was:<org.apache.cxf[.spring]>
{code}

I will try to commit the new patch to github.
Thanks~
Neal

> PackageUtils.getSharedPackageName(List<Class<?>>) has bug
> ---------------------------------------------------------
>
>                 Key: CXF-7124
>                 URL: https://issues.apache.org/jira/browse/CXF-7124
>             Project: CXF
>          Issue Type: Bug
>          Components: Core, JAX-RS
>    Affects Versions: 3.1.7
>         Environment: mac swagger
>            Reporter: Neal Hu
>            Assignee: Sergey Beryozkin
>             Fix For: 3.2.0, 3.1.9, 3.0.12
>
>         Attachments: org.apache.cxf.common.util.PackageUtils.patch, org.apache.cxf.common.util.PackageUtilsTest.patch
>
>
> The swagger feature scans undefined api,  the root cause is the util in PackageUtils has bug. For example:
> String packageName = PackageUtils.getSharedPackageName(
>             Arrays.asList(org.apache.cxf.common.util.PackageUtils.class, 
>                     org.apache.cxf.bus.CXFBusFactory.class,
>                     org.apache.cxf.common.jaxb.JAXBContextCache.class));   
> Currently we get org.apache, but we should get org.apache.cxf.
> I have uploaded the patch and verified in the local environment, please review.
> ------
> org.apache.cxf.jaxrs.swagger.AbstractSwaggerFeature.setResourcePackage(String)
> -->
> org.apache.cxf.common.util.PackageUtils.getSharedPackageName(List<Class<?>>)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)