Struts 2
  1. Struts 2
  2. WW-4038

struts.convention.action.includeJars didn't work

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.12
    • Fix Version/s: 2.3.15
    • Component/s: Plugin - Convention
    • Labels:
      None
    • Environment:

      struts-2.3.12

    • Flags:
      Patch

      Description

      please change the 416 line of org.apache.struts2.convention.PackageBasedActionConfigBuilder

      urlSet.include(new UrlSet(classLoaderInterface, this.fileProtocols));

      to

      urlSet = urlSet.include(new UrlSet(classLoaderInterface, this.fileProtocols));

        Issue Links

          Activity

          Hide
          Lukasz Lenart added a comment -

          Resolved, thanks for reporting!

          Show
          Lukasz Lenart added a comment - Resolved, thanks for reporting!
          Hide
          Hudson added a comment -

          Integrated in Struts2-JDK6 #692 (See https://builds.apache.org/job/Struts2-JDK6/692/)
          WW-4038 Solves a bug with struts.convention.action.includeJars (Revision 1469182)

          Result = SUCCESS
          lukaszlenart :
          Files :

          • /struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
          Show
          Hudson added a comment - Integrated in Struts2-JDK6 #692 (See https://builds.apache.org/job/Struts2-JDK6/692/ ) WW-4038 Solves a bug with struts.convention.action.includeJars (Revision 1469182) Result = SUCCESS lukaszlenart : Files : /struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
          Hide
          Carol Saah added a comment -

          A workaround to upgrade to 2.3.14 is to add the following lines to struts.xml using the 2.3.8 version of PackageBasedActionConfigBuilder. I put a copy of PackageBasedActionConfigBuilder from 2.3.8 in a package in our project.

          <bean type="org.apache.struts2.convention.ActionConfigBuilder" name="ActionConfigBuilder_2_3_8" class="...package_name...PackageBasedActionConfigBuilder"/>
          <constant name="struts.convention.actionConfigBuilder" value="ActionConfigBuilder_2_3_8"/>
          <constant name="struts.convention.exclude.parentClassLoader" value="false" />

          Show
          Carol Saah added a comment - A workaround to upgrade to 2.3.14 is to add the following lines to struts.xml using the 2.3.8 version of PackageBasedActionConfigBuilder. I put a copy of PackageBasedActionConfigBuilder from 2.3.8 in a package in our project. <bean type="org.apache.struts2.convention.ActionConfigBuilder" name="ActionConfigBuilder_2_3_8" class="...package_name...PackageBasedActionConfigBuilder"/> <constant name="struts.convention.actionConfigBuilder" value="ActionConfigBuilder_2_3_8"/> <constant name="struts.convention.exclude.parentClassLoader" value="false" />
          Hide
          Lukasz Lenart added a comment -

          Thanks a lot Carol Saah!

          Show
          Lukasz Lenart added a comment - Thanks a lot Carol Saah !
          Hide
          Carol Saah added a comment -

          Because this issue was fixed, I didn't add the rest of my findings. But, I'm not sure that the fix solves the issue that I found. So, just in case, I am posting my findings. To get this information, I put the 2.3.14 version of PackageBasedActionConfigBuilder in my solution above. And, I extracted new UrlSet(classLoaderInterface, this.fileProtocols)" into a local variable. Then, I added debug log statements after each statement so that when WebLogic started and loaded the app, I could see what was being set.

          The source of the bug is in line 416 of PackageBasedActionConfigBuilder (as posted above): urlSet.include(new UrlSet(classLoaderInterface, this.fileProtocols));

          The URLs generated in new UrlSet(classLoaderInterface, this.fileProtocols) DO include _wl_cls_gen.jar, but the jars from the UrlSet are not added to the overall urlSet. Line 104 in UrlSet does not add the URLs from the urlSet parameter. This test will fail for the 2.3.14 implementation of UrlSet. (I copied the source file for UrlSet into our apps test packages to write a test against it.)

          @Test
          public void testInclude() {
          try

          { UrlSet thisUrlSet = new UrlSet(); ArrayList<URL> urls = new ArrayList<URL>(); URL url = new URL("file:/c:/dir"); urls.add(url); UrlSet anotherUrlSet = new UrlSet(urls); thisUrlSet.include(anotherUrlSet); List<URL> expectedUrlsInUrlSet = thisUrlSet.getUrls(); assertFalse("file:/c:/dir should be in the list of URLs", expectedUrlsInUrlSet.isEmpty()); assertThat("file:/c:/dir should be in the list of URLs", url, Matchers.isIn(expectedUrlsInUrlSet)); }

          catch (MalformedURLException e)

          { fail("should not throw: " + e.getMessage()); }

          }

          Sorry, if I am incorrect, but it doesn't seem like the fix is complete so I am adding this info.

          Show
          Carol Saah added a comment - Because this issue was fixed, I didn't add the rest of my findings. But, I'm not sure that the fix solves the issue that I found. So, just in case, I am posting my findings. To get this information, I put the 2.3.14 version of PackageBasedActionConfigBuilder in my solution above. And, I extracted new UrlSet(classLoaderInterface, this.fileProtocols)" into a local variable. Then, I added debug log statements after each statement so that when WebLogic started and loaded the app, I could see what was being set. The source of the bug is in line 416 of PackageBasedActionConfigBuilder (as posted above): urlSet.include(new UrlSet(classLoaderInterface, this.fileProtocols)); The URLs generated in new UrlSet(classLoaderInterface, this.fileProtocols) DO include _wl_cls_gen.jar, but the jars from the UrlSet are not added to the overall urlSet. Line 104 in UrlSet does not add the URLs from the urlSet parameter. This test will fail for the 2.3.14 implementation of UrlSet. (I copied the source file for UrlSet into our apps test packages to write a test against it.) @Test public void testInclude() { try { UrlSet thisUrlSet = new UrlSet(); ArrayList<URL> urls = new ArrayList<URL>(); URL url = new URL("file:/c:/dir"); urls.add(url); UrlSet anotherUrlSet = new UrlSet(urls); thisUrlSet.include(anotherUrlSet); List<URL> expectedUrlsInUrlSet = thisUrlSet.getUrls(); assertFalse("file:/c:/dir should be in the list of URLs", expectedUrlsInUrlSet.isEmpty()); assertThat("file:/c:/dir should be in the list of URLs", url, Matchers.isIn(expectedUrlsInUrlSet)); } catch (MalformedURLException e) { fail("should not throw: " + e.getMessage()); } } Sorry, if I am incorrect, but it doesn't seem like the fix is complete so I am adding this info.
          Hide
          Lukasz Lenart added a comment -

          Please re-open the issue then, test will be helpful

          Show
          Lukasz Lenart added a comment - Please re-open the issue then, test will be helpful
          Hide
          Lukasz Lenart added a comment -

          And one more thing, did you try with the latest build? 2.3.14 doesn't contain the fix.

          Show
          Lukasz Lenart added a comment - And one more thing, did you try with the latest build? 2.3.14 doesn't contain the fix.
          Hide
          Carol Saah added a comment -

          I substituted the 2.3.15-SNAPSHOT version from struts2-java6 trunk in my workaround and it works. So, there is no bug in UrlSet.

          Thanks. I'll use the 2.3.15-SNAPSHOT version instead of 2.3.8 version in my work-around.

          I don't think there are any tests for UrlSet – at least not in the test source for com.opensymphony.xwork2.util.finder.

          Show
          Carol Saah added a comment - I substituted the 2.3.15-SNAPSHOT version from struts2-java6 trunk in my workaround and it works. So, there is no bug in UrlSet. Thanks. I'll use the 2.3.15-SNAPSHOT version instead of 2.3.8 version in my work-around. I don't think there are any tests for UrlSet – at least not in the test source for com.opensymphony.xwork2.util.finder.

            People

            • Assignee:
              Lukasz Lenart
              Reporter:
              Xu Hui Sheng
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development