@@ -480,7 +480,8 @@ public void addPersistedDelegationToken(
480480 getTrackingIdIfEnabled (identifier )));
481481 addTokenForOwnerStats (identifier );
482482 } else {
483- throw new IOException ("Same delegation token being added twice: " + formatTokenId (identifier ));
483+ throw new IOException ("Same delegation token being added twice: " +
484+ formatTokenId (identifier ));
484485 }
485486 } finally {
486487 this .apiLock .writeLock ().unlock ();
@@ -566,10 +567,12 @@ protected byte[] createPassword(TokenIdent identifier) {
566567 identifier .setMaxDate (now + tokenMaxLifetime );
567568 identifier .setMasterKeyId (currentKey .getKeyId ());
568569 identifier .setSequenceNumber (sequenceNum );
569- LOG .info ("Creating password for identifier: " + formatTokenId (identifier ) + ", currentKey: " + currentKey .getKeyId ());
570+ LOG .info ("Creating password for identifier: " + formatTokenId (identifier ) +
571+ ", currentKey: " + currentKey .getKeyId ());
570572 byte [] password = createPassword (identifier .getBytes (), currentKey .getKey ());
571573 DelegationTokenInformation tokenInfo =
572- new DelegationTokenInformation (now + tokenRenewInterval , password , getTrackingIdIfEnabled (identifier ));
574+ new DelegationTokenInformation (now + tokenRenewInterval , password ,
575+ getTrackingIdIfEnabled (identifier ));
573576 try {
574577 METRICS .trackStoreToken (() -> storeToken (identifier , tokenInfo ));
575578 } catch (IOException ioe ) {
@@ -684,20 +687,23 @@ public long renewToken(Token<TokenIdent> token,
684687
685688 long now = Time .now ();
686689 if (id .getMaxDate () < now ) {
687- throw new InvalidToken (renewer + " tried to renew an expired token " + formatTokenId (id ) + " max expiration date: "
688- + Time .formatTime (id .getMaxDate ()) + " currentTime: " + Time .formatTime (now ));
690+ throw new InvalidToken (renewer + " tried to renew an expired token " + formatTokenId (id ) +
691+ " max expiration date: " + Time .formatTime (id .getMaxDate ()) + " currentTime: " +
692+ Time .formatTime (now ));
689693 }
690694 if ((id .getRenewer () == null ) || (id .getRenewer ().toString ().isEmpty ())) {
691- throw new AccessControlException (renewer + " tried to renew a token " + formatTokenId (id ) + " without a renewer" );
695+ throw new AccessControlException (renewer + " tried to renew a token " + formatTokenId (id ) +
696+ " without a renewer" );
692697 }
693698 if (!id .getRenewer ().toString ().equals (renewer )) {
694- throw new AccessControlException (renewer + " tries to renew a token " + formatTokenId (id ) + " with non-matching renewer "
695- + id .getRenewer ());
699+ throw new AccessControlException (renewer + " tries to renew a token " + formatTokenId (id ) +
700+ " with non-matching renewer " + id .getRenewer ());
696701 }
697702 DelegationKey key = getDelegationKey (id .getMasterKeyId ());
698703 if (key == null ) {
699- throw new InvalidToken ("Unable to find master key for keyId=" + id .getMasterKeyId () + " from cache. Failed to renew an unexpired token "
700- + formatTokenId (id ) + " with sequenceNumber=" + id .getSequenceNumber ());
704+ throw new InvalidToken ("Unable to find master key for keyId=" + id .getMasterKeyId () +
705+ " from cache. Failed to renew an unexpired token " + formatTokenId (id ) +
706+ " with sequenceNumber=" + id .getSequenceNumber ());
701707 }
702708 byte [] password = createPassword (token .getIdentifier (), key .getKey ());
703709 if (!MessageDigest .isEqual (password , token .getPassword ())) {
@@ -745,8 +751,11 @@ public TokenIdent cancelToken(Token<TokenIdent> token,
745751 Text renewer = id .getRenewer ();
746752 HadoopKerberosName cancelerKrbName = new HadoopKerberosName (canceller );
747753 String cancelerShortName = cancelerKrbName .getShortName ();
748- if (!canceller .equals (owner ) && (renewer == null || renewer .toString ().isEmpty () || !cancelerShortName .equals (renewer .toString ()))) {
749- throw new AccessControlException (canceller + " is not authorized to cancel the token " + formatTokenId (id ));
754+ if (!canceller .equals (owner ) &&
755+ (renewer == null || renewer .toString ().isEmpty () ||
756+ !cancelerShortName .equals (renewer .toString ()))) {
757+ throw new AccessControlException (canceller + " is not authorized to cancel the token " +
758+ formatTokenId (id ));
750759 }
751760 DelegationTokenInformation info = currentTokens .remove (id );
752761 if (info == null ) {
@@ -903,10 +912,6 @@ public boolean isRunning() {
903912 return running ;
904913 }
905914
906- public ReentrantReadWriteLock getApiLock () {
907- return this .apiLock ;
908- }
909-
910915 private class ExpiredTokenRemover extends Thread {
911916 private long lastMasterKeyUpdate ;
912917 private long lastTokenCacheCleanup ;
0 commit comments