Tapestry
  1. Tapestry
  2. TAPESTRY-1559

application package initializer removed while merging svn

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.5
    • Fix Version/s: 5.0.5
    • Component/s: Core Components
    • Labels:
      None
    • Environment:
      any

      Description

      revision: #536053 (Marge changes from the temporary branch)

      a chunk of code was removed from
      org.apache.tapestry.internal.services.InternalModule#contributeApplicationInitializer

      this code was responsible for setting TAPESTRY_APP_PACKAGE_PARAM to ApplicationGlobals

      this will cause problems, I noticed because my entities weren't recognized ba tapestry-hibernate

      the problematic code is clearly visible in the diff, so I'll omit a patch...
      perhaps the revision shoould be checked for any other deleted code
      that might cause problems....

      1. 1559.patch
        1 kB
        Davor Hrg

        Activity

        Hide
        Davor Hrg added a comment -

        in revision 548175 by hlship,
        HibernateModule was modified to inject appRootPackage directly

        Show
        Davor Hrg added a comment - in revision 548175 by hlship, HibernateModule was modified to inject appRootPackage directly
        Hide
        Davor Hrg added a comment -

        set root package using @Symbol

        Show
        Davor Hrg added a comment - set root package using @Symbol
        Hide
        Davor Hrg added a comment -

        Ill try to be more precise in defining the problem:

        I have a simple app that works with 5.0.4
        it uses tapestry-hibernate and holds hibernate-entities in appPackage.entities
        hibernate fails to recognize these entities in 5.0.5-SNAPSHOT

        I traced the problem myself to the following
        HibernateModule adds "null.entities" to HibernateSessionSource configuration
        this is caused by: ApplicationGlobals returning null for rootPackage

        .....

        this was previously done in InternalModeule.contributeApplicationInitializer
        my fault of course not to recognize the code was obsolete,

        eclipse did not find references to TAPESTRY_APP_PACKAGE_PARAM for me,
        but after using simple grep, it is obvious that injecting this value is now done in a more proper way than the old code,

        I found this in ComponentClassResolver
        @Inject
        @Symbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM)
        String appRootPackage,

        I am aware I've wasted your time by assuming the solution for the issue without focusing enough to
        finding the real cause of it, sorry about that.

        never the less I'll again assume I can solve this issue properly so here's a patch
        1559.patch

        Show
        Davor Hrg added a comment - Ill try to be more precise in defining the problem: I have a simple app that works with 5.0.4 it uses tapestry-hibernate and holds hibernate-entities in appPackage.entities hibernate fails to recognize these entities in 5.0.5-SNAPSHOT I traced the problem myself to the following HibernateModule adds "null.entities" to HibernateSessionSource configuration this is caused by: ApplicationGlobals returning null for rootPackage ..... this was previously done in InternalModeule.contributeApplicationInitializer my fault of course not to recognize the code was obsolete, eclipse did not find references to TAPESTRY_APP_PACKAGE_PARAM for me, but after using simple grep, it is obvious that injecting this value is now done in a more proper way than the old code, I found this in ComponentClassResolver @Inject @Symbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM) String appRootPackage, I am aware I've wasted your time by assuming the solution for the issue without focusing enough to finding the real cause of it, sorry about that. never the less I'll again assume I can solve this issue properly so here's a patch 1559.patch
        Hide
        Davor Hrg added a comment -

        A simplest example app using application-root-package.entities for hibernate entities fails.

        reason is that tapestry-hibernate fails because it depends on ApplicationGlobals to provide the value for root-package:
        an extract from HibernateModule:

        public static void contributeHibernateSessionSource(Configuration<String> configuration,
        ApplicationGlobals globals)

        { configuration.add(globals.getApplicationRootPackage() + ".entities"); }

        Application globals returns null which is expected since following code was removed from InternalModeule.contributeApplicationInitializer:

        ApplicationInitializerFilter setApplicationPackage = new ApplicationInitializerFilter()
        {
        public void initializeApplication(Context context, ApplicationInitializer initializer)

        { String packageName = context .getInitParameter(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM); applicationGlobals.store(packageName); _componentClassResolver.setApplicationPackage(packageName); initializer.initializeApplication(context); }

        };

        configuration.add("SetApplicationPackage", setApplicationPackage, "before:.");

        Show
        Davor Hrg added a comment - A simplest example app using application-root-package.entities for hibernate entities fails. reason is that tapestry-hibernate fails because it depends on ApplicationGlobals to provide the value for root-package: an extract from HibernateModule: public static void contributeHibernateSessionSource(Configuration<String> configuration, ApplicationGlobals globals) { configuration.add(globals.getApplicationRootPackage() + ".entities"); } Application globals returns null which is expected since following code was removed from InternalModeule.contributeApplicationInitializer: ApplicationInitializerFilter setApplicationPackage = new ApplicationInitializerFilter() { public void initializeApplication(Context context, ApplicationInitializer initializer) { String packageName = context .getInitParameter(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM); applicationGlobals.store(packageName); _componentClassResolver.setApplicationPackage(packageName); initializer.initializeApplication(context); } }; configuration.add("SetApplicationPackage", setApplicationPackage, "before: . ");
        Hide
        Howard M. Lewis Ship added a comment -

        Please show some incorrect behavior of the framework. Code gets deleted when it is no longer needed.

        Show
        Howard M. Lewis Ship added a comment - Please show some incorrect behavior of the framework. Code gets deleted when it is no longer needed.

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Davor Hrg
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development