diff options
author | Jiayu Liu <Jimexist@users.noreply.github.com> | 2022-05-06 12:56:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 00:56:42 -0400 |
commit | 53ec08228a14130909d4dd6fc2c98f47a09d76b0 (patch) | |
tree | 19fd3589502b5471be23efe4d1190ad26fcbc91e /lib/java/src/main/java/org/apache/thrift/transport/TSaslClientTransport.java | |
parent | 23b86364ef3dbccc19f5f3828e6d115f7b015651 (diff) | |
download | thrift-53ec08228a14130909d4dd6fc2c98f47a09d76b0.tar.gz |
THRIFT-5568: enforce consistent Java formatting (#2581)
* use spotless plugin and google-java-format to enforce a consistent code format
* add a step of spotless check before building
* only run spotless on the src/ directory
Co-authored-by: Christopher Tubbs <ctubbsii@apache.org>
Diffstat (limited to 'lib/java/src/main/java/org/apache/thrift/transport/TSaslClientTransport.java')
-rw-r--r-- | lib/java/src/main/java/org/apache/thrift/transport/TSaslClientTransport.java | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/lib/java/src/main/java/org/apache/thrift/transport/TSaslClientTransport.java b/lib/java/src/main/java/org/apache/thrift/transport/TSaslClientTransport.java index e5ca41831..19cc41ec0 100644 --- a/lib/java/src/main/java/org/apache/thrift/transport/TSaslClientTransport.java +++ b/lib/java/src/main/java/org/apache/thrift/transport/TSaslClientTransport.java @@ -21,71 +21,69 @@ package org.apache.thrift.transport; import java.nio.charset.StandardCharsets; import java.util.Map; - import javax.security.auth.callback.CallbackHandler; import javax.security.sasl.Sasl; import javax.security.sasl.SaslClient; import javax.security.sasl.SaslException; - import org.apache.thrift.transport.sasl.NegotiationStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Wraps another Thrift <code>TTransport</code>, but performs SASL client - * negotiation on the call to <code>open()</code>. This class will wrap ensuing - * communication over it, if a SASL QOP is negotiated with the other party. + * Wraps another Thrift <code>TTransport</code>, but performs SASL client negotiation on the call to + * <code>open()</code>. This class will wrap ensuing communication over it, if a SASL QOP is + * negotiated with the other party. */ public class TSaslClientTransport extends TSaslTransport { private static final Logger LOGGER = LoggerFactory.getLogger(TSaslClientTransport.class); - /** - * The name of the mechanism this client supports. - */ + /** The name of the mechanism this client supports. */ private final String mechanism; /** * Uses the given <code>SaslClient</code>. * - * @param saslClient - * The <code>SaslClient</code> to use for the subsequent SASL - * negotiation. - * @param transport - * Transport underlying this one. + * @param saslClient The <code>SaslClient</code> to use for the subsequent SASL negotiation. + * @param transport Transport underlying this one. */ - public TSaslClientTransport(SaslClient saslClient, TTransport transport) throws TTransportException { + public TSaslClientTransport(SaslClient saslClient, TTransport transport) + throws TTransportException { super(saslClient, transport); mechanism = saslClient.getMechanismName(); } /** - * Creates a <code>SaslClient</code> using the given SASL-specific parameters. - * See the Java documentation for <code>Sasl.createSaslClient</code> for the - * details of the parameters. + * Creates a <code>SaslClient</code> using the given SASL-specific parameters. See the Java + * documentation for <code>Sasl.createSaslClient</code> for the details of the parameters. * - * @param transport - * The underlying Thrift transport. + * @param transport The underlying Thrift transport. * @throws SaslException */ - public TSaslClientTransport(String mechanism, String authorizationId, String protocol, - String serverName, Map<String, String> props, CallbackHandler cbh, TTransport transport) - throws SaslException, TTransportException { - super(Sasl.createSaslClient(new String[] { mechanism }, authorizationId, protocol, serverName, - props, cbh), transport); + public TSaslClientTransport( + String mechanism, + String authorizationId, + String protocol, + String serverName, + Map<String, String> props, + CallbackHandler cbh, + TTransport transport) + throws SaslException, TTransportException { + super( + Sasl.createSaslClient( + new String[] {mechanism}, authorizationId, protocol, serverName, props, cbh), + transport); this.mechanism = mechanism; } - @Override protected SaslRole getRole() { return SaslRole.CLIENT; } /** - * Performs the client side of the initial portion of the Thrift SASL - * protocol. Generates and sends the initial response to the server, including - * which mechanism this client wants to use. + * Performs the client side of the initial portion of the Thrift SASL protocol. Generates and + * sends the initial response to the server, including which mechanism this client wants to use. */ @Override protected void handleSaslStartMessage() throws TTransportException, SaslException { @@ -95,15 +93,17 @@ public class TSaslClientTransport extends TSaslTransport { if (saslClient.hasInitialResponse()) initialResponse = saslClient.evaluateChallenge(initialResponse); - LOGGER.debug("Sending mechanism name {} and initial response of length {}", mechanism, + LOGGER.debug( + "Sending mechanism name {} and initial response of length {}", + mechanism, initialResponse.length); byte[] mechanismBytes = mechanism.getBytes(StandardCharsets.UTF_8); - sendSaslMessage(NegotiationStatus.START, - mechanismBytes); + sendSaslMessage(NegotiationStatus.START, mechanismBytes); // Send initial response - sendSaslMessage(saslClient.isComplete() ? NegotiationStatus.COMPLETE : NegotiationStatus.OK, - initialResponse); + sendSaslMessage( + saslClient.isComplete() ? NegotiationStatus.COMPLETE : NegotiationStatus.OK, + initialResponse); underlyingTransport.flush(); } } |