axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Thomas (JIRA)" <j...@apache.org>
Subject [jira] [Created] (AXIS2-5778) Module Deployer incorrectly invalidates MAR due to invalid filename recognition in ModuleDeployer
Date Wed, 08 Jun 2016 06:55:20 GMT
Jeff Thomas created AXIS2-5778:
----------------------------------

             Summary: Module Deployer incorrectly invalidates MAR due to invalid filename
recognition in ModuleDeployer
                 Key: AXIS2-5778
                 URL: https://issues.apache.org/jira/browse/AXIS2-5778
             Project: Axis2
          Issue Type: Bug
          Components: kernel
    Affects Versions: 1.7.3
         Environment: Windows
            Reporter: Jeff Thomas
             Fix For: 1.7.4, 1.8.0


When performing full build on windows, the axis2-transport-udp module fails build in the unit
test: UDPTest:testSoapOverUdpWithEchoService

It fails because it is unable to load the 'addressing.mar' Module.  The module (in my workspace)
is at:

file:/C:/XXX/DEV/PWC/TRUNK/AXIS-1.7.3/modules/transport/testkit/target/classes/org/apache/axis2/transport/repo/modules/addressing.mar

The failure seems to occur in org.apache.axis2.deployment.ModuleDeployer within the following
code from method "deoloyFromUrl(...)"  [side note: maybe fix the method name to 'deployFromUrl(...)]:

{code:java}
int index = fileUrl.getPath().lastIndexOf(File.separator);
if(index > 0) {
  moduleFile = fileUrl.getPath().substring(index);
} else {
  moduleFile = fileUrl.getPath();                
} 
{code}
On Windows the File.separator is "\" (backslash) and a URL/URI the separator is always "/"
(forward slash).  The effect is, that on windows the index will always be -1 and on unix it
would correctly be 113 in my case.

The result is that the module name on windows is not "addressing.mar" but the full file URL.
 Because my path also has the Axis version in  it, the version recognition in AxisModule.setModuleName(...)
throws an error (NumberFormatException) and flags the module as faulty.

I believe the correct implementation is:
{code:java}
int index = fileUrl.getPath().lastIndexOf('/');
String moduleFile;
if(index > 0){
  moduleFile = fileUrl.getPath().substring(index + 1);
} else {
  moduleFile = fileUrl.getPath();
}  
{code}
I made the following changes:
1. Changed {{File.separator}} to {{'/'}}
2. Changed {{.substring(index)}} to {{.substring(index + 1)}} so that it returns "{{addressing.mar}}"
instead of "{{/addressing.mar}}".



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

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Mime
View raw message