Menu

#10 <acegijsf:authentication operation="username"/> returns null

v1.0 (example)
open
None
5
2007-04-30
2007-04-04
Aron
No

Calling

<acegijsf:authentication operation="username"/>

on a jsp, when the user is not authenticated yet (so no username is net in acegis security context), causes a NullPointerException because the username is null.

Instead an empty string should be returned in that case.

Discussion

  • Aron

    Aron - 2007-04-04

    Logged In: YES
    user_id=1630113
    Originator: YES

    The bugfix in class "net.sf.jsfcomp.acegijsf.Authentication" would be:

    change:

    public void encodeBegin(FacesContext context) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    if (getOperation().equals("username")) {
    String username = getRequest().getRemoteUser();
    writer.write(username);
    }
    }

    to

    public void encodeBegin(FacesContext context) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    if (getOperation().equals("username")) {
    String username = getRequest().getRemoteUser();
    if(null == username){
    username="";
    }
    writer.write(username);
    }
    }

     
  • Aron

    Aron - 2007-04-04

    Logged In: YES
    user_id=1630113
    Originator: YES

    File Added: Authentication.java

     
  • Aron

    Aron - 2007-04-04

    the class with the bugfix

     
  • Aron

    Aron - 2007-04-04

    Logged In: YES
    user_id=1630113
    Originator: YES

    File Added: Authentication.java

     
  • Aron

    Aron - 2007-04-30
    • assigned_to: nobody --> cagatay_civici
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.