Project

General

Profile

« Previous | Next » 

Revision 976

Added by Jing Tao over 22 years ago

Method getGourps was revised. Attributes variables were set there. Other wise, when it caught a referral exception and started a thread, this will caused a exception problem. When string array groups were returned by method getGroups in getPrincipals method, we should check if the groups is null or not. Otherwise it will cause a exception problem. This revise is for bug 445.

View differences:

src/edu/ucsb/nceas/metacat/AuthLdap.java
481 481
         throws ConnectException
482 482
  {
483 483
    String[] groups = null;
484

  
484
    //Pass the username and password to run() method
485
    userName=user;
486
    userPassword=password;
485 487
    // Identify service provider to use
486 488
    env.put(Context.INITIAL_CONTEXT_FACTORY, 
487 489
            "com.sun.jndi.ldap.LdapCtxFactory");
......
771 773
      String[] groups = getGroups(user, password);
772 774

  
773 775
      // for the groups and users that belong to them
774
      if ( groups.length > 0 ) {
776
      if ( groups!=null && groups.length > 0 ) {
775 777
        for (int i=0; i < groups.length; i++ ) {
776 778
          out.append("    <group>\n");
777 779
          out.append("      <groupname>" + groups[i] + "</groupname>\n");

Also available in: Unified diff