< prev index next >

src/java.base/share/classes/javax/security/auth/Subject.java

Print this page




1384             } catch (NullPointerException unused) {
1385                 return false;
1386             }
1387         }
1388 
1389         public int hashCode() {
1390             int h = 0;
1391             Iterator<E> i = iterator();
1392             while (i.hasNext()) {
1393                 E obj = i.next();
1394                 if (obj != null) {
1395                     h += obj.hashCode();
1396                 }
1397             }
1398             return h;
1399         }
1400 
1401         /**
1402          * Writes this object out to a stream (i.e., serializes it).
1403          *
1404          * <p>
1405          *
1406          * @serialData If this is a private credential set,
1407          *      a security check is performed to ensure that
1408          *      the caller has permission to access each credential
1409          *      in the set.  If the security check passes,
1410          *      the set is serialized.
1411          */
1412         private void writeObject(java.io.ObjectOutputStream oos)
1413                 throws java.io.IOException {
1414 
1415             if (which == Subject.PRIV_CREDENTIAL_SET) {
1416                 // check permissions before serializing
1417                 Iterator<E> i = iterator();
1418                 while (i.hasNext()) {
1419                     i.next();
1420                 }
1421             }
1422             ObjectOutputStream.PutField fields = oos.putFields();
1423             fields.put("this$0", subject);
1424             fields.put("elements", elements);
1425             fields.put("which", which);




1384             } catch (NullPointerException unused) {
1385                 return false;
1386             }
1387         }
1388 
1389         public int hashCode() {
1390             int h = 0;
1391             Iterator<E> i = iterator();
1392             while (i.hasNext()) {
1393                 E obj = i.next();
1394                 if (obj != null) {
1395                     h += obj.hashCode();
1396                 }
1397             }
1398             return h;
1399         }
1400 
1401         /**
1402          * Writes this object out to a stream (i.e., serializes it).
1403          *


1404          * @serialData If this is a private credential set,
1405          *      a security check is performed to ensure that
1406          *      the caller has permission to access each credential
1407          *      in the set.  If the security check passes,
1408          *      the set is serialized.
1409          */
1410         private void writeObject(java.io.ObjectOutputStream oos)
1411                 throws java.io.IOException {
1412 
1413             if (which == Subject.PRIV_CREDENTIAL_SET) {
1414                 // check permissions before serializing
1415                 Iterator<E> i = iterator();
1416                 while (i.hasNext()) {
1417                     i.next();
1418                 }
1419             }
1420             ObjectOutputStream.PutField fields = oos.putFields();
1421             fields.put("this$0", subject);
1422             fields.put("elements", elements);
1423             fields.put("which", which);


< prev index next >