diff --git a/google-auth-library-java/credentials/java/com/google/auth/Credentials.java b/google-auth-library-java/credentials/java/com/google/auth/Credentials.java index 3c78490ea676..6b6fbddc15c3 100644 --- a/google-auth-library-java/credentials/java/com/google/auth/Credentials.java +++ b/google-auth-library-java/credentials/java/com/google/auth/Credentials.java @@ -121,7 +121,7 @@ public Map> getRequestMetadata() throws IOException { * @param callback Callback to execute when the request is finished. */ public void getRequestMetadata( - final URI uri, Executor executor, final RequestMetadataCallback callback) { + final @Nullable URI uri, Executor executor, final RequestMetadataCallback callback) { executor.execute( new Runnable() { @Override @@ -137,7 +137,7 @@ public void run() { * @param uri URI of the entry point for the request. * @param callback Callback handler to execute when the metadata completes. */ - protected final void blockingGetToCallback(URI uri, RequestMetadataCallback callback) { + protected final void blockingGetToCallback(@Nullable URI uri, RequestMetadataCallback callback) { Map> result; try { result = getRequestMetadata(uri); diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/MtlsUtils.java b/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/MtlsUtils.java index a5c4c0f86e77..b47eb4e4e298 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/MtlsUtils.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/MtlsUtils.java @@ -40,6 +40,7 @@ import java.io.InputStream; import java.util.Locale; import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; /** * Utility class for mTLS related operations. @@ -65,7 +66,9 @@ private MtlsUtils() { * @throws IOException if the certificate configuration cannot be found or loaded. */ public static String getCertificatePath( - EnvironmentProvider envProvider, PropertyProvider propProvider, String certConfigPathOverride) + EnvironmentProvider envProvider, + PropertyProvider propProvider, + @Nullable String certConfigPathOverride) throws IOException { String certPath = getWorkloadCertificateConfiguration(envProvider, propProvider, certConfigPathOverride) @@ -92,7 +95,9 @@ public static String getCertificatePath( * @throws IOException if the configuration file cannot be found, read, or parsed */ static WorkloadCertificateConfiguration getWorkloadCertificateConfiguration( - EnvironmentProvider envProvider, PropertyProvider propProvider, String certConfigPathOverride) + EnvironmentProvider envProvider, + PropertyProvider propProvider, + @Nullable String certConfigPathOverride) throws IOException { File certConfig; if (certConfigPathOverride != null) { diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/X509Provider.java b/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/X509Provider.java index 911c0fdcf922..0486931963a9 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/X509Provider.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/X509Provider.java @@ -54,7 +54,7 @@ public class X509Provider implements MtlsProvider { private final EnvironmentProvider envProvider; private final PropertyProvider propProvider; - private final String certConfigPathOverride; + private final @Nullable String certConfigPathOverride; /** * Creates an X509 provider with an override path for the certificate configuration, bypassing the @@ -69,7 +69,7 @@ public class X509Provider implements MtlsProvider { public X509Provider( EnvironmentProvider envProvider, PropertyProvider propProvider, - String certConfigPathOverride) { + @Nullable String certConfigPathOverride) { this.envProvider = envProvider; this.propProvider = propProvider; this.certConfigPathOverride = certConfigPathOverride; diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/AwsRequestSigner.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/AwsRequestSigner.java index cd20a06dba76..5eda1e665afb 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/AwsRequestSigner.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/AwsRequestSigner.java @@ -287,9 +287,9 @@ static class Builder { private final String url; private final String region; - @Nullable private String requestPayload; - @Nullable private Map additionalHeaders; - @Nullable private AwsDates dates; + private @Nullable String requestPayload; + private @Nullable Map additionalHeaders; + private @Nullable AwsDates dates; private Builder( AwsSecurityCredentials awsSecurityCredentials, @@ -303,7 +303,7 @@ private Builder( } @CanIgnoreReturnValue - Builder setRequestPayload(String requestPayload) { + Builder setRequestPayload(@Nullable String requestPayload) { this.requestPayload = requestPayload; return this; } diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/AwsSecurityCredentials.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/AwsSecurityCredentials.java index 1a60bc07c975..a85ac6905d9f 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/AwsSecurityCredentials.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/AwsSecurityCredentials.java @@ -44,7 +44,7 @@ public class AwsSecurityCredentials { private final String accessKeyId; private final String secretAccessKey; - @Nullable private final String sessionToken; + private final @Nullable String sessionToken; /** * Constructor for AWSSecurityCredentials. @@ -83,8 +83,7 @@ public String getSecretAccessKey() { * * @return the AWS session token. */ - @Nullable - public String getSessionToken() { + public @Nullable String getSessionToken() { return sessionToken; } } diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java index a3b87c0c6489..afc430c9c0ca 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java @@ -154,7 +154,7 @@ public enum GoogleAuthTransport { private final String label; - private GoogleAuthTransport(String label) { + GoogleAuthTransport(String label) { this.label = label; } @@ -185,7 +185,7 @@ public enum BindingEnforcement { private final String label; - private BindingEnforcement(String label) { + BindingEnforcement(String label) { this.label = label; } @@ -455,7 +455,7 @@ public AccessToken refreshAccessToken() throws IOException { OAuth2Utils.validateString(responseData, "access_token", PARSE_ERROR_PREFIX); int expiresInSeconds = OAuth2Utils.validateInt32(responseData, "expires_in", PARSE_ERROR_PREFIX); - long expiresAtMilliseconds = clock.currentTimeMillis() + expiresInSeconds * 1000; + long expiresAtMilliseconds = clock.currentTimeMillis() + expiresInSeconds * 1000L; return new AccessToken(accessToken, new Date(expiresAtMilliseconds)); } @@ -828,7 +828,7 @@ public byte[] sign(byte[] toSign) { this.getUniverseDomain(), transportFactory.create(), toSign, - Collections.emptyMap()); + Collections.emptyMap()); } catch (SigningException ex) { throw ex; } catch (RuntimeException ex) { diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/CredentialAccessBoundary.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/CredentialAccessBoundary.java index 324d53d0b782..b3b97240cb67 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/CredentialAccessBoundary.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/CredentialAccessBoundary.java @@ -166,7 +166,7 @@ public static final class AccessBoundaryRule { private final String availableResource; private final List availablePermissions; - @Nullable private final AvailabilityCondition availabilityCondition; + private final @Nullable AvailabilityCondition availabilityCondition; AccessBoundaryRule( String availableResource, @@ -197,8 +197,7 @@ public List getAvailablePermissions() { return availablePermissions; } - @Nullable - public AvailabilityCondition getAvailabilityCondition() { + public @Nullable AvailabilityCondition getAvailabilityCondition() { return availabilityCondition; } @@ -210,7 +209,7 @@ public static class Builder { private String availableResource; private List availablePermissions; - @Nullable private AvailabilityCondition availabilityCondition; + private @Nullable AvailabilityCondition availabilityCondition; private Builder() {} @@ -269,7 +268,8 @@ public Builder addAvailablePermission(String availablePermission) { * @return this {@code Builder} object */ @CanIgnoreReturnValue - public Builder setAvailabilityCondition(AvailabilityCondition availabilityCondition) { + public Builder setAvailabilityCondition( + @Nullable AvailabilityCondition availabilityCondition) { this.availabilityCondition = availabilityCondition; return this; } @@ -296,8 +296,8 @@ public AccessBoundaryRule build() { public static final class AvailabilityCondition { private final String expression; - @Nullable private final String title; - @Nullable private final String description; + private final @Nullable String title; + private final @Nullable String description; AvailabilityCondition( String expression, @Nullable String title, @Nullable String description) { @@ -312,13 +312,11 @@ public String getExpression() { return expression; } - @Nullable - public String getTitle() { + public @Nullable String getTitle() { return title; } - @Nullable - public String getDescription() { + public @Nullable String getDescription() { return description; } @@ -329,8 +327,8 @@ public static Builder newBuilder() { public static final class Builder { private String expression; - @Nullable private String title; - @Nullable private String description; + private @Nullable String title; + private @Nullable String description; private Builder() {} @@ -358,7 +356,7 @@ public Builder setExpression(String expression) { * @return this {@code Builder} object */ @CanIgnoreReturnValue - public Builder setTitle(String title) { + public Builder setTitle(@Nullable String title) { this.title = title; return this; } @@ -370,7 +368,7 @@ public Builder setTitle(String title) { * @return this {@code Builder} object */ @CanIgnoreReturnValue - public Builder setDescription(String description) { + public Builder setDescription(@Nullable String description) { this.description = description; return this; } diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/DefaultCredentialsProvider.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/DefaultCredentialsProvider.java index a763326a870c..8477b38a4d14 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/DefaultCredentialsProvider.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/DefaultCredentialsProvider.java @@ -56,7 +56,9 @@ */ @NullMarked class DefaultCredentialsProvider { + static final Logger LOGGER = Logger.getLogger(DefaultCredentialsProvider.class.getName()); static final DefaultCredentialsProvider DEFAULT = new DefaultCredentialsProvider(); + static final String CREDENTIAL_ENV_VAR = "GOOGLE_APPLICATION_CREDENTIALS"; static final String QUOTA_PROJECT_ENV_VAR = "GOOGLE_CLOUD_QUOTA_PROJECT"; @@ -66,14 +68,11 @@ class DefaultCredentialsProvider { static final String CLOUD_SHELL_ENV_VAR = "DEVSHELL_CLIENT_PORT"; static final String SKIP_APP_ENGINE_ENV_VAR = "GOOGLE_APPLICATION_CREDENTIALS_SKIP_APP_ENGINE"; static final String SPECIFICATION_VERSION = System.getProperty("java.specification.version"); - static final String GAE_RUNTIME_VERSION = + static final @Nullable String GAE_RUNTIME_VERSION = System.getProperty("com.google.appengine.runtime.version"); - static final String RUNTIME_JETTY_LOGGER = System.getProperty("org.eclipse.jetty.util.log.class"); - static final Logger LOGGER = Logger.getLogger(DefaultCredentialsProvider.class.getName()); + static final @Nullable String RUNTIME_JETTY_LOGGER = System.getProperty("org.eclipse.jetty.util.log.class"); static final String NO_GCE_CHECK_ENV_VAR = "NO_GCE_CHECK"; static final String GCE_METADATA_HOST_ENV_VAR = "GCE_METADATA_HOST"; - static final String CLOUDSDK_CLIENT_ID = - "764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com"; static final String CLOUDSDK_CREDENTIALS_WARNING = "You are authenticating using user credentials. " + "For production, we recommend using service account credentials.\n\n" @@ -136,7 +135,7 @@ final GoogleCredentials getDefaultCredentials(HttpTransportFactory transportFact // First try the environment variable GoogleCredentials credentials = null; String credentialsPath = getEnv(CREDENTIAL_ENV_VAR); - if (credentialsPath != null && credentialsPath.length() > 0) { + if (credentialsPath != null && !credentialsPath.isEmpty()) { LOGGER.log( Level.FINE, String.format("Attempting to load credentials from file: %s", credentialsPath)); @@ -234,7 +233,7 @@ final GoogleCredentials getDefaultCredentials(HttpTransportFactory transportFact if (credentials != null) { String quotaFromEnv = getEnv(QUOTA_PROJECT_ENV_VAR); - if (quotaFromEnv != null && quotaFromEnv.trim().length() > 0) { + if (quotaFromEnv != null && !quotaFromEnv.trim().isEmpty()) { credentials = credentials.createWithQuotaProject(quotaFromEnv); } } @@ -357,8 +356,8 @@ Class forName(String className) throws ClassNotFoundException { return System.getenv(name); } - @Nullable String getProperty(String property, @Nullable String def) { - return System.getProperty(property, def); + String getProperty(String property, String defaultValue) { + return System.getProperty(property, defaultValue); } boolean isFile(File file) { diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ExecutableResponse.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ExecutableResponse.java index 1e8fa837ce2e..9fb75bde15b0 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ExecutableResponse.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ExecutableResponse.java @@ -50,11 +50,11 @@ class ExecutableResponse { private final int version; private final boolean success; - @Nullable private Long expirationTime; - @Nullable private String tokenType; - @Nullable private String subjectToken; - @Nullable private String errorCode; - @Nullable private String errorMessage; + private @Nullable Long expirationTime; + private @Nullable String tokenType; + private @Nullable String subjectToken; + private @Nullable String errorCode; + private @Nullable String errorMessage; ExecutableResponse(GenericJson json) throws IOException { if (!json.containsKey("version")) { diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GdchCredentials.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GdchCredentials.java index 19362961ffe9..74f3c237154c 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GdchCredentials.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GdchCredentials.java @@ -675,8 +675,8 @@ public GdchCredentials build() { } } - private static String validateField(String field, String fieldName) throws IOException { - if (field == null || field.isEmpty()) { + private static String validateField(@Nullable String field, String fieldName) throws IOException { + if (Strings.isNullOrEmpty(field)) { throw new IOException( String.format( "Error reading GDCH service account credential from JSON, %s is misconfigured.", @@ -712,8 +712,8 @@ public HttpTransport create() { return transport; } - private void setTransport(String caCertPath) throws IOException { - if (caCertPath == null || caCertPath.isEmpty()) { + private void setTransport(@Nullable String caCertPath) throws IOException { + if (Strings.isNullOrEmpty(caCertPath)) { this.transport = new NetHttpTransport(); return; } @@ -752,7 +752,6 @@ private void setTransport(String caCertPath) throws IOException { * @param payload The JWS payload containing claims like "iss", "sub", and "aud". * @return A complete, signed JWS string in the format {@code [header].[payload].[signature]}. * @throws GeneralSecurityException If signing fails due to cryptographic errors. - * @throws IOException If serialization or transcoding fails. */ @VisibleForTesting static String signUsingEsSha256( @@ -778,7 +777,7 @@ static String signUsingEsSha256( SecurityUtils.sign(SecurityUtils.getEs256SignatureAlgorithm(), privateKey, contentBytes); // 3. Transcode the signature from DER to Concatenated R|S. - byte[] jwsSignature = transcodeDerToConcat(signature, 64); + byte[] jwsSignature = transcodeDerToConcat(signature); // 4. Return final JWS: [Signing Input] + '.' + Base64URL(Signature) return content + "." + Base64.getUrlEncoder().withoutPadding().encodeToString(jwsSignature); @@ -795,13 +794,11 @@ static String signUsingEsSha256( *

Concatenated format: {@code r | s} (where {@code |} is concatenation). * * @param derSignature The raw bytes of the DER-encoded signature. - * @param outputLength The total expected length of the concatenated signature (64 bytes for - * ES256). * @return The signature in concatenated R|S format. * @throws IOException If the DER format is invalid. */ @VisibleForTesting - static byte[] transcodeDerToConcat(byte[] derSignature, int outputLength) + static byte[] transcodeDerToConcat(byte[] derSignature) throws GoogleAuthException { // Validate basic ASN.1 DER structure (0x30 = SEQUENCE) if (derSignature.length < 8 || derSignature[0] != 0x30) { @@ -847,7 +844,7 @@ static byte[] transcodeDerToConcat(byte[] derSignature, int outputLength) System.arraycopy(derSignature, offset, s, 0, sLength); // Concatenate r and s into fixed-length segments (32 bytes each for ES256) - int keySizeBytes = outputLength / 2; + int keySizeBytes = 64 / 2; if (r.length > keySizeBytes || s.length > keySizeBytes) { throw new GoogleAuthException( false, @@ -858,9 +855,9 @@ static byte[] transcodeDerToConcat(byte[] derSignature, int outputLength) null); } - byte[] result = new byte[outputLength]; + byte[] result = new byte[64]; System.arraycopy(r, 0, result, keySizeBytes - r.length, r.length); - System.arraycopy(s, 0, result, outputLength - s.length, s.length); + System.arraycopy(s, 0, result, 64 - s.length, s.length); return result; } diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GoogleAuthException.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GoogleAuthException.java index bfb36fa90a45..95507697e724 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GoogleAuthException.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GoogleAuthException.java @@ -57,7 +57,7 @@ class GoogleAuthException extends IOException implements Retryable { * @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method). * (A null value is permitted, and indicates that the cause is nonexistent or unknown.) */ - GoogleAuthException(boolean isRetryable, int retryCount, String message, Throwable cause) { + GoogleAuthException(boolean isRetryable, int retryCount, String message, @Nullable Throwable cause) { super(message, cause); this.isRetryable = isRetryable; this.retryCount = retryCount; diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentialSource.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentialSource.java index c930b5c518e8..5773ee544658 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentialSource.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentialSource.java @@ -52,7 +52,7 @@ public class IdentityPoolCredentialSource extends ExternalAccountCredentials.Cre private String credentialLocation; @Nullable String subjectTokenFieldName; @Nullable Map headers; - @Nullable private CertificateConfig certificateConfig; + private @Nullable CertificateConfig certificateConfig; /** * Gets the location of the credential source. This could be a file path or a URL, depending on @@ -175,7 +175,7 @@ public static class CertificateConfig implements java.io.Serializable { * useDefaultCertificateConfig} is false or unset. Must be set if {@code * useDefaultCertificateConfig} is false. */ - @Nullable private final String certificateConfigLocation; + private final @Nullable String certificateConfigLocation; /** * Specifies the path to a PEM-formatted file containing the X.509 certificate trust chain. This @@ -185,7 +185,7 @@ public static class CertificateConfig implements java.io.Serializable { * workload identity pool's trust store are optional in this file. Certificates should be * ordered with the leaf certificate (or the certificate which signed the leaf) first. */ - @Nullable private final String trustChainPath; + private final @Nullable String trustChainPath; /** * Constructor for {@code CertificateConfig}. diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/JwtClaims.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/JwtClaims.java index cb165b76850c..e9ed07b3f411 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/JwtClaims.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/JwtClaims.java @@ -56,14 +56,11 @@ public abstract class JwtClaims implements Serializable { private static final long serialVersionUID = 4974444151019426702L; - @Nullable - abstract String getAudience(); + abstract @Nullable String getAudience(); - @Nullable - abstract String getIssuer(); + abstract @Nullable String getIssuer(); - @Nullable - abstract String getSubject(); + abstract @Nullable String getSubject(); /** * Returns additional claims for this object. The returned map is not guaranteed to be mutable. @@ -115,11 +112,11 @@ public boolean isComplete() { @AutoValue.Builder public abstract static class Builder { - public abstract Builder setAudience(String audience); + public abstract Builder setAudience(@Nullable String audience); - public abstract Builder setIssuer(String issuer); + public abstract Builder setIssuer(@Nullable String issuer); - public abstract Builder setSubject(String subject); + public abstract Builder setSubject(@Nullable String subject); public abstract Builder setAdditionalClaims(Map additionalClaims); diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java index 9816a4c87bf2..5e164d64ea3d 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java @@ -83,7 +83,7 @@ public class OAuth2Credentials extends Credentials { // byte[] is serializable, so the lock variable can be final @VisibleForTesting final Object lock = new byte[0]; private volatile @Nullable OAuthValue value = null; - @Nullable @VisibleForTesting transient RefreshTask refreshTask; + @VisibleForTesting transient @Nullable RefreshTask refreshTask; // Change listeners are not serialized private transient @Nullable List changeListeners; diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2CredentialsWithRefresh.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2CredentialsWithRefresh.java index 91b374da5e96..0fd36e9faf3b 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2CredentialsWithRefresh.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2CredentialsWithRefresh.java @@ -36,6 +36,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.io.IOException; import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; /** * A refreshable alternative to {@link OAuth2Credentials}. @@ -63,7 +64,7 @@ protected OAuth2CredentialsWithRefresh(Builder builder) { } protected OAuth2CredentialsWithRefresh( - AccessToken accessToken, OAuth2RefreshHandler refreshHandler) { + @Nullable AccessToken accessToken, OAuth2RefreshHandler refreshHandler) { super(accessToken); // If no expirationTime is provided, the token will never be refreshed. @@ -93,7 +94,7 @@ public static Builder newBuilder() { public static class Builder extends OAuth2Credentials.Builder { - private OAuth2RefreshHandler refreshHandler; + private @Nullable OAuth2RefreshHandler refreshHandler; private Builder() {} @@ -103,7 +104,7 @@ private Builder() {} */ @Override @CanIgnoreReturnValue - public Builder setAccessToken(AccessToken token) { + public Builder setAccessToken(@Nullable AccessToken token) { super.setAccessToken(token); return this; } diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuthException.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuthException.java index 0349227e8071..4b90c03e51e0 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuthException.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuthException.java @@ -48,8 +48,8 @@ class OAuthException extends GoogleAuthException { private final String errorCode; - @Nullable private final String errorDescription; - @Nullable private final String errorUri; + private final @Nullable String errorDescription; + private final @Nullable String errorUri; OAuthException(String errorCode, @Nullable String errorDescription, @Nullable String errorUri) { this.errorCode = checkNotNull(errorCode); diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentialSource.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentialSource.java index dcd04635b4f7..a80e2ef4a05a 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentialSource.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentialSource.java @@ -80,7 +80,7 @@ public class PluggableAuthCredentialSource extends ExternalAccountCredentials.Cr // Optional. Provided when the 3rd party executable caches the response at the specified // location. - @Nullable final String outputFilePath; + final @Nullable String outputFilePath; @SuppressWarnings("unchecked") public PluggableAuthCredentialSource(Map credentialSourceMap) { diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentials.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentials.java index 10ab650c77e5..c16a68717cec 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentials.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentials.java @@ -174,9 +174,8 @@ public int getExecutableTimeoutMs() { return executableTimeoutMs; } - @Nullable @Override - public String getOutputFilePath() { + public @Nullable String getOutputFilePath() { return outputFilePath; } }; diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java index 3c09e1c20dfa..26ec0386ced3 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java @@ -512,7 +512,7 @@ public boolean createScopedRequired() { /** Returns true if credential is configured domain wide delegation */ @VisibleForTesting boolean isConfiguredForDomainWideDelegation() { - return serviceAccountUser != null && serviceAccountUser.length() > 0; + return serviceAccountUser != null && !serviceAccountUser.isEmpty(); } private GenericData parseResponseAs(HttpResponse response) throws IOException { diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java index f4f2145c4cc2..5144cf68a4d0 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java @@ -85,12 +85,12 @@ public class ServiceAccountJwtAccessCredentials extends Credentials @VisibleForTesting static final long LIFE_SPAN_SECS = TimeUnit.HOURS.toSeconds(1); private static final long CLOCK_SKEW = TimeUnit.MINUTES.toSeconds(5); - private final String clientId; + private final @Nullable String clientId; private final String clientEmail; private final PrivateKey privateKey; - private final String privateKeyId; - private final URI defaultAudience; - private final String quotaProjectId; + private final @Nullable String privateKeyId; + private final @Nullable URI defaultAudience; + private final @Nullable String quotaProjectId; private final String universeDomain; private transient LoadingCache credentialsCache; @@ -107,7 +107,7 @@ public class ServiceAccountJwtAccessCredentials extends Credentials * @param privateKeyId Private key identifier for the service account. May be null. */ private ServiceAccountJwtAccessCredentials( - String clientId, String clientEmail, PrivateKey privateKey, String privateKeyId) { + @Nullable String clientId, String clientEmail, PrivateKey privateKey, @Nullable String privateKeyId) { this( clientId, clientEmail, @@ -130,13 +130,13 @@ private ServiceAccountJwtAccessCredentials( * googleapis.com */ private ServiceAccountJwtAccessCredentials( - String clientId, + @Nullable String clientId, String clientEmail, PrivateKey privateKey, - String privateKeyId, + @Nullable String privateKeyId, @Nullable URI defaultAudience, @Nullable String quotaProjectId, - String universeDomain) { + @Nullable String universeDomain) { this.clientId = clientId; this.clientEmail = Preconditions.checkNotNull(clientEmail); this.privateKey = Preconditions.checkNotNull(privateKey); @@ -246,13 +246,13 @@ public static ServiceAccountJwtAccessCredentials fromPkcs8( } static ServiceAccountJwtAccessCredentials fromPkcs8( - String clientId, + @Nullable String clientId, String clientEmail, String privateKeyPkcs8, - String privateKeyId, - URI defaultAudience, + @Nullable String privateKeyId, + @Nullable URI defaultAudience, @Nullable String quotaProjectId, - String universeDomain) + @Nullable String universeDomain) throws IOException { PrivateKey privateKey = OAuth2Utils.privateKeyFromPkcs8(privateKeyPkcs8); return new ServiceAccountJwtAccessCredentials( @@ -423,7 +423,7 @@ public void refresh() { credentialsCache.invalidateAll(); } - public final String getClientId() { + public final @Nullable String getClientId() { return clientId; } @@ -435,7 +435,7 @@ public final PrivateKey getPrivateKey() { return privateKey; } - public final String getPrivateKeyId() { + public final @Nullable String getPrivateKeyId() { return privateKeyId; } @@ -508,19 +508,19 @@ public Builder toBuilder() { } @Override - public String getQuotaProjectId() { + public @Nullable String getQuotaProjectId() { return quotaProjectId; } public static class Builder { - private String clientId; - private String clientEmail; - private PrivateKey privateKey; - private String privateKeyId; - private URI defaultAudience; - private String quotaProjectId; - private String universeDomain; + private @Nullable String clientId; + private @Nullable String clientEmail; + private @Nullable PrivateKey privateKey; + private @Nullable String privateKeyId; + private @Nullable URI defaultAudience; + private @Nullable String quotaProjectId; + private @Nullable String universeDomain; protected Builder() {} @@ -535,7 +535,7 @@ protected Builder(ServiceAccountJwtAccessCredentials credentials) { } @CanIgnoreReturnValue - public Builder setClientId(String clientId) { + public Builder setClientId(@Nullable String clientId) { this.clientId = clientId; return this; } @@ -553,64 +553,64 @@ public Builder setPrivateKey(PrivateKey privateKey) { } @CanIgnoreReturnValue - public Builder setPrivateKeyId(String privateKeyId) { + public Builder setPrivateKeyId(@Nullable String privateKeyId) { this.privateKeyId = privateKeyId; return this; } @CanIgnoreReturnValue - public Builder setDefaultAudience(URI defaultAudience) { + public Builder setDefaultAudience(@Nullable URI defaultAudience) { this.defaultAudience = defaultAudience; return this; } @CanIgnoreReturnValue - public Builder setQuotaProjectId(String quotaProjectId) { + public Builder setQuotaProjectId(@Nullable String quotaProjectId) { this.quotaProjectId = quotaProjectId; return this; } @CanIgnoreReturnValue /** Sets the universe domain (example, googleapis.com). */ - public Builder setUniverseDomain(String universeDomain) { + public Builder setUniverseDomain(@Nullable String universeDomain) { this.universeDomain = universeDomain; return this; } - public String getClientId() { + public @Nullable String getClientId() { return clientId; } - public String getClientEmail() { + public @Nullable String getClientEmail() { return clientEmail; } - public PrivateKey getPrivateKey() { + public @Nullable PrivateKey getPrivateKey() { return privateKey; } - public String getPrivateKeyId() { + public @Nullable String getPrivateKeyId() { return privateKeyId; } - public URI getDefaultAudience() { + public @Nullable URI getDefaultAudience() { return defaultAudience; } - public String getQuotaProjectId() { + public @Nullable String getQuotaProjectId() { return quotaProjectId; } /** Returns the universe domain (example, googleapis.com) for the credentials instance. */ - public String getUniverseDomain() { + public @Nullable String getUniverseDomain() { return universeDomain; } public ServiceAccountJwtAccessCredentials build() { return new ServiceAccountJwtAccessCredentials( clientId, - clientEmail, - privateKey, + Preconditions.checkNotNull(clientEmail), + Preconditions.checkNotNull(privateKey), privateKeyId, defaultAudience, quotaProjectId, diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/StsRequestHandler.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/StsRequestHandler.java index b1db8b682b9c..e0c9b4e86f06 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/StsRequestHandler.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/StsRequestHandler.java @@ -75,8 +75,8 @@ public final class StsRequestHandler { private final StsTokenExchangeRequest request; private final HttpRequestFactory httpRequestFactory; - @Nullable private final HttpHeaders headers; - @Nullable private final String internalOptions; + private final @Nullable HttpHeaders headers; + private final @Nullable String internalOptions; private StsRequestHandler(Builder builder) { this.tokenExchangeEndpoint = builder.tokenExchangeEndpoint; @@ -211,8 +211,8 @@ public static class Builder { private final StsTokenExchangeRequest request; private final HttpRequestFactory httpRequestFactory; - @Nullable private HttpHeaders headers; - @Nullable private String internalOptions; + private @Nullable HttpHeaders headers; + private @Nullable String internalOptions; private Builder( String tokenExchangeEndpoint, @@ -224,13 +224,13 @@ private Builder( } @CanIgnoreReturnValue - public StsRequestHandler.Builder setHeaders(HttpHeaders headers) { + public StsRequestHandler.Builder setHeaders(@Nullable HttpHeaders headers) { this.headers = headers; return this; } @CanIgnoreReturnValue - public StsRequestHandler.Builder setInternalOptions(String internalOptions) { + public StsRequestHandler.Builder setInternalOptions(@Nullable String internalOptions) { this.internalOptions = internalOptions; return this; } diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeRequest.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeRequest.java index 036e28aa0846..19e60c100700 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeRequest.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeRequest.java @@ -57,12 +57,12 @@ public final class StsTokenExchangeRequest { private final String subjectToken; private final String subjectTokenType; - @Nullable private final ActingParty actingParty; - @Nullable private final List scopes; - @Nullable private final String resource; - @Nullable private final String audience; - @Nullable private final String requestedTokenType; - @Nullable private final String internalOptions; + private final @Nullable ActingParty actingParty; + private final @Nullable List scopes; + private final @Nullable String resource; + private final @Nullable String audience; + private final @Nullable String requestedTokenType; + private final @Nullable String internalOptions; private StsTokenExchangeRequest( String subjectToken, @@ -108,33 +108,27 @@ public String getSubjectTokenType() { return subjectTokenType; } - @Nullable - public String getResource() { + public @Nullable String getResource() { return resource; } - @Nullable - public String getAudience() { + public @Nullable String getAudience() { return audience; } - @Nullable - public String getRequestedTokenType() { + public @Nullable String getRequestedTokenType() { return requestedTokenType; } - @Nullable - public List getScopes() { + public @Nullable List getScopes() { return scopes; } - @Nullable - public ActingParty getActingParty() { + public @Nullable ActingParty getActingParty() { return actingParty; } - @Nullable - public String getInternalOptions() { + public @Nullable String getInternalOptions() { return internalOptions; } @@ -162,12 +156,12 @@ public static class Builder { private final String subjectToken; private final String subjectTokenType; - @Nullable private String resource; - @Nullable private String audience; - @Nullable private String requestedTokenType; - @Nullable private List scopes; - @Nullable private ActingParty actingParty; - @Nullable private String internalOptions; + private @Nullable String resource; + private @Nullable String audience; + private @Nullable String requestedTokenType; + private @Nullable List scopes; + private @Nullable ActingParty actingParty; + private @Nullable String internalOptions; private Builder(String subjectToken, String subjectTokenType) { this.subjectToken = subjectToken; @@ -175,37 +169,37 @@ private Builder(String subjectToken, String subjectTokenType) { } @CanIgnoreReturnValue - public StsTokenExchangeRequest.Builder setResource(String resource) { + public StsTokenExchangeRequest.Builder setResource(@Nullable String resource) { this.resource = resource; return this; } @CanIgnoreReturnValue - public StsTokenExchangeRequest.Builder setAudience(String audience) { + public StsTokenExchangeRequest.Builder setAudience(@Nullable String audience) { this.audience = audience; return this; } @CanIgnoreReturnValue - public StsTokenExchangeRequest.Builder setRequestTokenType(String requestedTokenType) { + public StsTokenExchangeRequest.Builder setRequestTokenType(@Nullable String requestedTokenType) { this.requestedTokenType = requestedTokenType; return this; } @CanIgnoreReturnValue - public StsTokenExchangeRequest.Builder setScopes(List scopes) { + public StsTokenExchangeRequest.Builder setScopes(@Nullable List scopes) { this.scopes = scopes; return this; } @CanIgnoreReturnValue - public StsTokenExchangeRequest.Builder setActingParty(ActingParty actingParty) { + public StsTokenExchangeRequest.Builder setActingParty(@Nullable ActingParty actingParty) { this.actingParty = actingParty; return this; } @CanIgnoreReturnValue - public StsTokenExchangeRequest.Builder setInternalOptions(String internalOptions) { + public StsTokenExchangeRequest.Builder setInternalOptions(@Nullable String internalOptions) { this.internalOptions = internalOptions; return this; } diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeResponse.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeResponse.java index 51881027906c..d9de4d92aeb3 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeResponse.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeResponse.java @@ -58,10 +58,10 @@ public final class StsTokenExchangeResponse { private final String issuedTokenType; private final String tokenType; - @Nullable private final Long expiresInSeconds; - @Nullable private final String refreshToken; - @Nullable private final List scopes; - @Nullable private final String accessBoundarySessionKey; + private final @Nullable Long expiresInSeconds; + private final @Nullable String refreshToken; + private final @Nullable List scopes; + private final @Nullable String accessBoundarySessionKey; private StsTokenExchangeResponse( String accessToken, @@ -111,18 +111,15 @@ public String getTokenType() { return tokenType; } - @Nullable - public Long getExpiresInSeconds() { + public @Nullable Long getExpiresInSeconds() { return expiresInSeconds; } - @Nullable - public String getRefreshToken() { + public @Nullable String getRefreshToken() { return refreshToken; } - @Nullable - public List getScopes() { + public @Nullable List getScopes() { if (scopes == null) { return null; } @@ -134,8 +131,7 @@ public List getScopes() { * * @return the access boundary session key or {@code null} if not present */ - @Nullable - public String getAccessBoundarySessionKey() { + public @Nullable String getAccessBoundarySessionKey() { return accessBoundarySessionKey; } @@ -144,10 +140,10 @@ public static class Builder { private final String issuedTokenType; private final String tokenType; - @Nullable private Long expiresInSeconds; - @Nullable private String refreshToken; - @Nullable private List scopes; - @Nullable private String accessBoundarySessionKey; + private @Nullable Long expiresInSeconds; + private @Nullable String refreshToken; + private @Nullable List scopes; + private @Nullable String accessBoundarySessionKey; private Builder(String accessToken, String issuedTokenType, String tokenType) { this.accessToken = accessToken; @@ -162,13 +158,13 @@ public StsTokenExchangeResponse.Builder setExpiresInSeconds(long expiresInSecond } @CanIgnoreReturnValue - public StsTokenExchangeResponse.Builder setRefreshToken(String refreshToken) { + public StsTokenExchangeResponse.Builder setRefreshToken(@Nullable String refreshToken) { this.refreshToken = refreshToken; return this; } @CanIgnoreReturnValue - public StsTokenExchangeResponse.Builder setScopes(List scopes) { + public StsTokenExchangeResponse.Builder setScopes(@Nullable List scopes) { if (scopes != null) { this.scopes = new ArrayList<>(scopes); } @@ -183,7 +179,7 @@ public StsTokenExchangeResponse.Builder setScopes(List scopes) { */ @CanIgnoreReturnValue public StsTokenExchangeResponse.Builder setAccessBoundarySessionKey( - String accessBoundarySessionKey) { + @Nullable String accessBoundarySessionKey) { this.accessBoundarySessionKey = accessBoundarySessionKey; return this; } diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/UserCredentials.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/UserCredentials.java index c2eb38aa490c..8d3095f64b29 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/UserCredentials.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/UserCredentials.java @@ -196,7 +196,7 @@ public AccessToken refreshAccessToken() throws IOException { OAuth2Utils.validateString(responseData, "access_token", PARSE_ERROR_PREFIX); int expiresInSeconds = OAuth2Utils.validateInt32(responseData, "expires_in", PARSE_ERROR_PREFIX); - long expiresAtMilliseconds = clock.currentTimeMillis() + expiresInSeconds * 1000; + long expiresAtMilliseconds = clock.currentTimeMillis() + expiresInSeconds * 1000L; String scopes = OAuth2Utils.validateOptionalString( responseData, OAuth2Utils.TOKEN_RESPONSE_SCOPE, PARSE_ERROR_PREFIX); diff --git a/google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/DefaultCredentialsProviderTest.java b/google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/DefaultCredentialsProviderTest.java index eceebe65902c..4769669dea77 100644 --- a/google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/DefaultCredentialsProviderTest.java +++ b/google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/DefaultCredentialsProviderTest.java @@ -911,9 +911,9 @@ void setEnv(String name, @Nullable String value) { } @Override - @Nullable String getProperty(String property, @Nullable String def) { + String getProperty(String property, String defaultValue) { String value = properties.get(property); - return value == null ? def : value; + return value == null ? defaultValue : value; } void setProperty(String property, @Nullable String value) { diff --git a/google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/GdchCredentialsTest.java b/google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/GdchCredentialsTest.java index ace74dd67e63..6b5484aaa7a9 100644 --- a/google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/GdchCredentialsTest.java +++ b/google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/GdchCredentialsTest.java @@ -1101,7 +1101,7 @@ void transcodeDerToConcat_withGeneratedSignature() throws Exception { byte[] derSignature = signer.sign(); // Transcode the signature and check length. - byte[] jwsSignature = GdchCredentials.transcodeDerToConcat(derSignature, 64); + byte[] jwsSignature = GdchCredentials.transcodeDerToConcat(derSignature); assertEquals(64, jwsSignature.length); } @@ -1110,7 +1110,7 @@ void transcodeDerToConcat_invalidDerFormat() { byte[] invalidDer = new byte[] {0x31, 0x00}; // Not a SEQUENCE GoogleAuthException e = assertThrows( - GoogleAuthException.class, () -> GdchCredentials.transcodeDerToConcat(invalidDer, 64)); + GoogleAuthException.class, () -> GdchCredentials.transcodeDerToConcat(invalidDer)); assertEquals("Invalid DER signature format.", e.getMessage()); } @@ -1120,7 +1120,7 @@ void transcodeDerToConcat_invalidLength() { byte[] invalidDer = new byte[] {0x30, 0x05, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02}; GoogleAuthException e = assertThrows( - GoogleAuthException.class, () -> GdchCredentials.transcodeDerToConcat(invalidDer, 64)); + GoogleAuthException.class, () -> GdchCredentials.transcodeDerToConcat(invalidDer)); assertEquals("Invalid DER signature length.", e.getMessage()); } @@ -1130,7 +1130,7 @@ void transcodeDerToConcat_invalidRInteger() { byte[] invalidDer = new byte[] {0x30, 0x06, 0x03, 0x01, 0x01, 0x02, 0x01, 0x02}; GoogleAuthException e = assertThrows( - GoogleAuthException.class, () -> GdchCredentials.transcodeDerToConcat(invalidDer, 64)); + GoogleAuthException.class, () -> GdchCredentials.transcodeDerToConcat(invalidDer)); assertEquals("Expected INTEGER for R.", e.getMessage()); } @@ -1140,7 +1140,7 @@ void transcodeDerToConcat_invalidSInteger() { byte[] invalidDer = new byte[] {0x30, 0x06, 0x02, 0x01, 0x01, 0x03, 0x01, 0x01}; GoogleAuthException e = assertThrows( - GoogleAuthException.class, () -> GdchCredentials.transcodeDerToConcat(invalidDer, 64)); + GoogleAuthException.class, () -> GdchCredentials.transcodeDerToConcat(invalidDer)); assertEquals("Expected INTEGER for S.", e.getMessage()); } diff --git a/google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthHandlerTest.java b/google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthHandlerTest.java index 121adbd9bc2f..6300635ddf1d 100644 --- a/google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthHandlerTest.java +++ b/google-auth-library-java/oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthHandlerTest.java @@ -92,9 +92,8 @@ public int getExecutableTimeoutMs() { return 30000; } - @Nullable @Override - public String getOutputFilePath() { + public @Nullable String getOutputFilePath() { return null; } };