fhanik      2004/12/09 06:36:43

  Modified:    modules/cluster/src/share/org/apache/catalina/cluster/session
                        SerializablePrincipal.java
  Log:
  Fixed nullpointer exception when the principal contains a null password
  
  Revision  Changes    Path
  1.5       +6 -3      
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/SerializablePrincipal.java
  
  Index: SerializablePrincipal.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/SerializablePrincipal.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SerializablePrincipal.java        1 Jul 2004 09:44:26 -0000       1.4
  +++ SerializablePrincipal.java        9 Dec 2004 14:36:43 -0000       1.5
  @@ -167,7 +167,9 @@
       
       public static GenericPrincipal readPrincipal(java.io.ObjectInputStream 
in, Realm realm) throws java.io.IOException{
           String name = in.readUTF();
  -        String pwd = in.readUTF();
  +        boolean hasPwd = in.readBoolean();
  +        String pwd = null;
  +        if ( hasPwd ) pwd = in.readUTF();
           int size = in.readInt();
           String[] roles = new String[size];
           for ( int i=0; i<size; i++ ) roles[i] = in.readUTF();
  @@ -176,7 +178,8 @@
       
       public static void writePrincipal(GenericPrincipal p, 
java.io.ObjectOutputStream out) throws java.io.IOException {
           out.writeUTF(p.getName());
  -        out.writeUTF(p.getPassword());
  +        out.writeBoolean(p.getPassword()!=null);
  +        if ( p.getPassword()!= null ) out.writeUTF(p.getPassword());
           String[] roles = p.getRoles();
           if ( roles == null ) roles = new String[0];
           out.writeInt(roles.length);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to