Fix nomulus tool NPEs on login/logout commands when printing usage

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149535358
This commit is contained in:
shikhman 2017-03-08 07:16:37 -08:00 committed by Ben McIlwain
parent 0c7443815a
commit b05afd2153
2 changed files with 5 additions and 1 deletions

View file

@ -14,12 +14,14 @@
package google.registry.tools;
import com.beust.jcommander.Parameters;
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
import javax.inject.Inject;
/** Authorizes the nomulus tool for OAuth 2.0 access to remote resources. */
@Parameters(commandDescription = "Create local OAuth credentials")
final class LoginCommand implements Command {
@Inject GoogleAuthorizationCodeFlow flow;
@ -30,4 +32,4 @@ final class LoginCommand implements Command {
new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver())
.authorize(clientScopeQualifier);
}
}
}

View file

@ -14,6 +14,7 @@
package google.registry.tools;
import com.beust.jcommander.Parameters;
import com.google.api.client.auth.oauth2.StoredCredential;
import com.google.api.client.util.store.AbstractDataStoreFactory;
import google.registry.util.FormattingLogger;
@ -21,6 +22,7 @@ import java.io.IOException;
import javax.inject.Inject;
/** Logout (invalidates OAuth credentials). */
@Parameters(commandDescription = "Remove local OAuth credentials")
class LogoutCommand implements Command {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();