Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5778

Module Deployer incorrectly invalidates MAR due to invalid filename recognition in ModuleDeployer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7.3
    • 1.7.4
    • kernel
    • None
    • Windows

    Description

      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(...)]:

      int index = fileUrl.getPath().lastIndexOf(File.separator);
      if(index > 0) {
        moduleFile = fileUrl.getPath().substring(index);
      } else {
        moduleFile = fileUrl.getPath();                
      } 
      

      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:

      int index = fileUrl.getPath().lastIndexOf('/');
      String moduleFile;
      if(index > 0){
        moduleFile = fileUrl.getPath().substring(index + 1);
      } else {
        moduleFile = fileUrl.getPath();
      }  
      

      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".

      Attachments

        Issue Links

          Activity

            People

              veithen Andreas Veithen
              JWT007 Jeff Thomas
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: