Harald Wellmann created OWB-1220:
------------------------------------

             Summary: URL-encoding issue in AbstractMetaDataDiscovery
                 Key: OWB-1220
                 URL: https://issues.apache.org/jira/browse/OWB-1220
             Project: OpenWebBeans
          Issue Type: Bug
    Affects Versions: 2.0.2, 1.7.4
            Reporter: Harald Wellmann


h3. Scenario

I have a certain integration test using OWB and DeltaSpike which fails when the 
working directory contains a '+' character and passes otherwise.

What's worse, the failure only occurs when running the test under Maven 
Surefire, it does not occur when running the test from my IDE.

h3. Analysis

Maven Surefire by default builds a manifest-only JAR defining a classpath as as 
list of URLs, e.g.

{noformat}
Class-Path: ... file:/home/hwellmann/work/ops4j/org.ops4j.pax.e
 xam2/itest/cdi/src/it/regression%2bdeltaspike/target/test-classes/ ...
{noformat}

The following snippet from {{AbstractMetaDataDiscovery.registerBeanArchives()}}

{code}
Iterator<URL> cpIt = classPathUrls.iterator(); 
while (cpIt.hasNext())
{
    URL cpUrl = cpIt.next();
    if (beansXml.startsWith(stripProtocol(cpUrl.toExternalForm())))
    {
        cpIt.remove();
        addDeploymentUrl(beansXml, cpUrl);
        break;
    }
}
{code}

does not behave as expected as can be seen from the following log output:

{noformat}
11:48:21.234 [main] INFO  o.a.w.c.s.AbstractMetaDataDiscovery - added beans 
archive URL: 
file:/home/hwellmann/work/ops4j/org.ops4j.pax.exam2/itest/cdi/src/it/regression%2bdeltaspike/target/test-classes/META-INF/beans.xml
11:48:21.252 [main] INFO  o.a.w.c.s.AbstractMetaDataDiscovery - added beans 
archive URL: 
file:/home/hwellmann/work/ops4j/org.ops4j.pax.exam2/itest/cdi/src/it/regression+deltaspike/target/test-classes
{noformat}

A classpath element containing a {{beans.xml}} is *not* removed from the 
classpath, since the path prefix does not match due to varying encoding (i.e. 
{{regression%2bdeltaspike}} vs. {{regression-deltaspike}}).

By the way, the log message "added beans archive URL" seems to be left 
unchanged since CDI 1.0. It would be helpful if the message indicated the 
difference between explicit and implicit bean archives. This is only mentioned 
in the inline comments in the source code.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to