Announcement Announcement Module
Collapse
No announcement yet.
spring 1.1.5 broke error binding Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring 1.1.5 broke error binding

    I have had not time to investigate it yet. Just to note that When I tried to upgrade from 1.1.4 to 1.1.5 form submission is broken.

    I am getting errors like this in the logs.

    Code:
    org.apache.jasper.JasperException: No message found under code 'CATEGORY_REQUIRED.partForm.part.categoryId' for locale '
    en_US'.
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:207)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

  • #2
    If I were you, I would investigate a little further. This sounds like an entry is missing your resource file.

    Comment


    • #3
      no code change - no resource file

      I don't have any resource file. I am just using default entries for now.
      All entries have default value defined.

      This has been working for all spring 1.1.x. Code didn't change.
      Now that I upgrade to 1.1.5 it breaks. I didn't expect that. To me it's a bug.

      Comment


      • #4
        Could be cause by the following change

        Code:
        org.springframework.context.NoSuchMessageException: No message found under code 'TYPE_REQUIRED.partForm.part.isType1' fo
        r locale 'en_US'.
                at org.springframework.context.support.DelegatingMessageSource.getMessage(DelegatingMessageSource.java:73)
                at org.springframework.context.support.DelegatingMessageSource.getMessage(DelegatingMessageSource.java:68)
                at org.springframework.context.support.AbstractApplicationContext.getMessage(AbstractApplicationContext.java:594
        )
                at org.springframework.web.servlet.support.RequestContext.getMessage(RequestContext.java:492)
                at org.springframework.web.servlet.support.BindStatus.getErrorMessages(BindStatus.java:171)
                at org.springframework.web.servlet.support.BindStatus.<init>&#40;BindStatus.java&#58;128&#41;
                at org.springframework.web.servlet.tags.BindStatus.<init>&#40;BindStatus.java&#58;38&#41;
                at org.springframework.web.servlet.tags.BindTag.doStartTagInternal&#40;BindTag.java&#58;105&#41;
                at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag&#40;RequestContextAwareTag.java&#58;70&#41;
                at org.apache.jsp.NewPartForm_jsp._jspService&#40;NewPartForm_jsp.java&#58;247&#41;
                at org.apache.jasper.runtime.HttpJspBase.service&#40;HttpJspBase.java&#58;92&#41;
                at javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;853&#41;
        I believe the problem is due to that change (http://www.springframework.org/docs/changelog.txt).

        Code:
        * AbstractApplicationContext uses new DelegatingMessageSource as placeholder, to avoid StaticMessageSource side effects
        with change detailed here:
        http://cvs.sourceforge.net/viewcvs.p...1=1.58&r2=1.61

        I couldn't find any issue related to that change (hint next time put the issue numbers in the release notes). So what are those "StaticMessageSource side effects"?

        Comment


        • #5
          I also encountered this problem when upgrading to Spring 1.1.5. (See my post here: http://forum.springframework.org/vie...945&highlight= )

          How did you go about fixing the problem?

          Comment


          • #6
            Proposed fix and workaround

            with regard to the change introduced in AbstractApplicationContext, I think the code
            Code:
            dms.setParentMessageSource&#40;getInternalParentMessageSource&#40;&#41;&#41;;
            should have been written with backward compatibility in mind:
            Code:
            dms.setParentMessageSource&#40;getInternalParentMessageSource&#40;&#41; == null ? new StaticMessageSource&#40;&#41; &#58; getInternalParentMessageSource&#40;&#41;&#41;;
            See change in:
            http://<br /> <a href="http://cvs.s...1.61</a><br />

            In the meantime, I've fixed my issue by adding it in the application context:
            Code:
            <bean id="messageSource" class="org.springframework.context.support.StaticMessageSource" />

            Comment


            • #7
              First of all: Of course, Spring 1.1.5 did not break "error binding". The title of this thread is misleading.

              The only thing that broke was the fallback for MessageSourceResolvable messages if no proper MessageSource is defined in the context. This only affects development settings and is easy to work around by specifying an explicit StaticMessageSource, as mentioned above. While this was not intended, it only constitutes a minor bug, IMHO.

              The correct fix belongs in DelegatingMessageSource, not in AbstractApplicationContext: If a MessageSourceResolvable contains a default message, it has to be returned instead of throwing a NoSuchMessageException. I've fixed this in CVS, to be released in 1.2 RC1.

              The reason for the change in MessageSource fallback is AbstractMessageSource's "useCodeAsDefaultMessage" feature: This only works consistently when specified on a root MessageSource if the child contexts use a pure delegating MessageSource if no explicit one defined.

              Juergen

              Comment

              Working...
              X