--- old/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java 2014-06-25 16:47:43.000000000 +0800 +++ new/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java 2014-06-25 16:47:42.000000000 +0800 @@ -334,15 +334,28 @@ * returns null. */ Credentials readCred(int version) throws IOException,RealmException, KrbApErrException, Asn1Exception { - PrincipalName cpname = readPrincipal(version); - if (DEBUG) + PrincipalName cpname = null; + try { + cpname = readPrincipal(version); + } catch (Exception e) { + // cpname is null + } + if (DEBUG) { System.out.println(">>>DEBUG client principal is " + cpname); - PrincipalName spname = readPrincipal(version); - if (DEBUG) + } + PrincipalName spname = null; + try { + spname = readPrincipal(version); + } catch (Exception e) { + // spname is null + } + if (DEBUG) { System.out.println(">>>DEBUG server principal is " + spname); + } EncryptionKey key = readKey(version); - if (DEBUG) + if (DEBUG) { System.out.println(">>>DEBUG key type: " + key.getEType()); + } long times[] = readTimes(); KerberosTime authtime = new KerberosTime(times[0]); KerberosTime starttime = @@ -375,6 +388,10 @@ byte[] ticketData = readData(); byte[] ticketData2 = readData(); + if (cpname == null || spname == null) { + return null; + } + try { return new Credentials(cpname, spname, key, authtime, starttime, endtime, renewTill, skey, tFlags,