Alexander created WICKET-4544:
---------------------------------

             Summary: FeedbackMessage.getReporter() returns null at 
accept(final FeedbackMessage message) overriding
                 Key: WICKET-4544
                 URL: https://issues.apache.org/jira/browse/WICKET-4544
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 6.0.0-beta1
            Reporter: Alexander


After migratin from 1.5.5 to 6 beta I've got a nullpointerExc. trying to 
execute feadback message filter. 
That is my code: 
 public final class SignInForm extends Form
    {
        private final ValueMap properties = new ValueMap();

        final FeedbackPanel feedback = new FeedbackPanel("loginfeedback"
                , new IFeedbackMessageFilter()
        {
            public boolean accept(final FeedbackMessage message) {
                if(SignInForm.this==message.getReporter())
                    return true;
                else return "loginForm".equals(message.getReporter().getId());
            }
        }
        );

        AjaxFallbackLink loginButton = new AjaxFallbackLink("loginbutton")
        {
            @Override
            public void onClick(AjaxRequestTarget target) {
                if (target != null) {
                    process(null);
                }
            }
        };

        public SignInForm(final String id)
        {
            super(id);
            add(feedback);
            TextField<String> loginField= new TextField<String>("login", new 
PropertyModel<String>(properties, "username"));
            TextField passwordField= new PasswordTextField("password", new 
PropertyModel<String>(properties, "password"));

            loginField.setRequired(true);
            add(new Label("lll",(new ResourceModel("LoginPanel.login"))));
            add(loginField);

            passwordField.setRequired(true);
            add(new Label("lpl", new ResourceModel("LoginPanel.password")));
            add(passwordField);

            add(loginButton);
        }

        @Override
        public final void onSubmit()
        {
            super.onSubmit();

            SignInSession session = (SignInSession)getPage().getSession();
            // Sign the user in
            if (session.authenticate(properties.getString("username"), 
properties.getString("password")))
            {
                if (session.getUser() != null
                        && (session.getUser().getRole()==3))
                    setResponsePage(ValidationPage.class);
                else
                    setResponsePage(MasterPage.class);

            }
            else
            {
                //  final String errmsg = 
getLocalizer().getString("loginError", this, "Unable to sign you in");
                error("Unable to sign you in");
                // continueToOriginalDestination();
            }
        }
    }




--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to