Index: javax/security/auth/Subject.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/security/auth/Subject.java,v retrieving revision 1.4 diff -u -B -b -r1.4 Subject.java --- javax/security/auth/Subject.java 2 Jul 2005 20:32:46 -0000 1.4 +++ javax/security/auth/Subject.java 13 Sep 2005 02:46:45 -0000 @@ -1,5 +1,5 @@ /* Subject.java -- a single entity in the system. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -385,19 +385,19 @@ // Constructors. // ----------------------------------------------------------------------- - SecureSet (final Subject subject, final int type, final Collection elements) + SecureSet (final Subject subject, final int type, final Collection inElements) { this (subject, type); - for (Iterator it = elements.iterator(); it.hasNext(); ) + for (Iterator it = inElements.iterator(); it.hasNext(); ) { Object o = it.next(); if (type == PRINCIPALS && !(o instanceof Principal)) { throw new IllegalArgumentException(o+" is not a Principal"); } - if (!elements.contains (o)) + if (!this.elements.contains (o)) { - elements.add (o); + this.elements.add (o); } } } @@ -511,7 +511,7 @@ public synchronized boolean contains (final Object element) { - return elements.remove (element); + return elements.contains (element); } public boolean removeAll (final Collection c) Index: javax/security/auth/SubjectDomainCombiner.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/security/auth/SubjectDomainCombiner.java,v retrieving revision 1.2 diff -u -B -b -r1.2 SubjectDomainCombiner.java --- javax/security/auth/SubjectDomainCombiner.java 2 Jul 2005 20:32:46 -0000 1.2 +++ javax/security/auth/SubjectDomainCombiner.java 13 Sep 2005 02:46:45 -0000 @@ -1,5 +1,5 @@ /* SubjectDomainCombiner.java -- domain combiner for Subjects. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -67,8 +67,9 @@ final ProtectionDomain[] assigned) { LinkedList domains = new LinkedList(); - Principal[] principals = - (Principal[]) subject.getPrincipals().toArray (new Principal[0]); + Principal[] principals = null; + if (subject != null) + principals = (Principal[]) subject.getPrincipals().toArray (new Principal[0]); if (current != null) { for (int i = 0; i < current.length; i++)