You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Alexander (JIRA)" <ji...@apache.org> on 2012/05/09 12:05:51 UTC

[jira] [Created] (WICKET-4544) FeedbackMessage.getReporter() returns null at accept(final FeedbackMessage message) overriding

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

        

[jira] [Commented] (WICKET-4544) FeedbackMessage.getReporter() returns null at accept(final FeedbackMessage message) overriding

Posted by "Alexander (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13271327#comment-13271327 ] 

Alexander commented on WICKET-4544:
-----------------------------------

Martin, thanks for comment, I guess the ticket should be closed.
   
Non-submiting component was working, probably, because of process(null)
public void onClick(AjaxRequestTarget target) { 
                if (target != null) { 
                    process(null); 
                } 
            } 

                
> 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
>              Labels: FeedbackMessage.getReporter
>
> 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

        

[jira] [Commented] (WICKET-4544) FeedbackMessage.getReporter() returns null at accept(final FeedbackMessage message) overriding

Posted by "Alexander (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13271288#comment-13271288 ] 

Alexander commented on WICKET-4544:
-----------------------------------

I've resolved the problem by using  SubmitLink instead of  AjaxFallbackLink.
Meanwhile, the behavior of process() was changed?
                
> 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
>              Labels: FeedbackMessage.getReporter
>
> 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

        

[jira] [Closed] (WICKET-4544) FeedbackMessage.getReporter() returns null at accept(final FeedbackMessage message) overriding

Posted by "Alexander (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander closed WICKET-4544.
-----------------------------

    
> 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
>              Labels: FeedbackMessage.getReporter
>
> 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

        

[jira] [Commented] (WICKET-4544) FeedbackMessage.getReporter() returns null at accept(final FeedbackMessage message) overriding

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13271330#comment-13271330 ] 

Martin Grigorov commented on WICKET-4544:
-----------------------------------------

process(null) triggers the Form processing code but by using non-submitting component like AjaxLink/AjaxFallbackLink there is no data coming from the browser (username and password).
I'm not sure how it worked for you but it was by accident.
                
> 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
>              Labels: FeedbackMessage.getReporter
>
> 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

        

[jira] [Resolved] (WICKET-4544) FeedbackMessage.getReporter() returns null at accept(final FeedbackMessage message) overriding

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-4544.
-------------------------------------

    Resolution: Invalid
    
> 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
>              Labels: FeedbackMessage.getReporter
>
> 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

        

[jira] [Commented] (WICKET-4544) FeedbackMessage.getReporter() returns null at accept(final FeedbackMessage message) overriding

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13271322#comment-13271322 ] 

Martin Grigorov commented on WICKET-4544:
-----------------------------------------

Do you say that a non-submitting component like AjaxFallbackLink did the job in 1.5.x ?
You need a submitting component to actually submit the values of the form components.

The NullPointerException is in your code so I don't think this is Wicket's problem.
The feedback message's component is null-ified at the end of the request to prevent OutOfMemoryError. This is since WICKET-2384 (early days of 1.4.x branch).
If you still think there is a problem in Wicket please create a quickstart app and attach it to this ticket and we will reopen it.
                
> 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
>              Labels: FeedbackMessage.getReporter
>
> 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