This is an automated email from the ASF dual-hosted git repository. domgarguilo pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo-proxy.git
The following commit(s) were added to refs/heads/main by this push: new d7988f8 Fix spotbugs errors (#57) d7988f8 is described below commit d7988f812c50f78bafde4e94ab13f6aaaca92041 Author: Dom G <domgargu...@apache.org> AuthorDate: Tue Nov 29 15:27:32 2022 -0500 Fix spotbugs errors (#57) --- src/main/java/org/apache/accumulo/proxy/Proxy.java | 5 ----- .../org/apache/accumulo/proxy/its/SimpleProxyBase.java | 4 ++-- .../org/apache/accumulo/proxy/its/TestProxyClient.java | 15 +++++++-------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/apache/accumulo/proxy/Proxy.java b/src/main/java/org/apache/accumulo/proxy/Proxy.java index 296f641..da31732 100644 --- a/src/main/java/org/apache/accumulo/proxy/Proxy.java +++ b/src/main/java/org/apache/accumulo/proxy/Proxy.java @@ -29,7 +29,6 @@ import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.clientImpl.ClientConfConverter; import org.apache.accumulo.core.conf.ClientProperty; import org.apache.accumulo.core.conf.ConfigurationTypeHelper; -import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.rpc.SslConnectionParams; import org.apache.accumulo.core.trace.TraceUtil; import org.apache.accumulo.core.util.HostAndPort; @@ -186,10 +185,6 @@ public class Proxy implements KeywordExecutable { .parseInt(props.getProperty(THRIFT_THREAD_POOL_SIZE_KEY, THRIFT_THREAD_POOL_SIZE_DEFAULT)); final long maxFrameSize = ConfigurationTypeHelper.getFixedMemoryAsBytes( props.getProperty(THRIFT_MAX_FRAME_SIZE_KEY, THRIFT_MAX_FRAME_SIZE_DEFAULT)); - final int simpleTimerThreadpoolSize = Integer - .parseInt(Property.GENERAL_SIMPLETIMER_THREADPOOL_SIZE.getDefaultValue()); - // How frequently to try to resize the thread pool - final long threadpoolResizeInterval = 1000L * 5; // No timeout final long serverSocketTimeout = 0L; // Use the new hadoop metrics2 support diff --git a/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java b/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java index 0724611..ffad3dc 100644 --- a/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java +++ b/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java @@ -162,13 +162,13 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase { private static int proxyPort; private TestProxyClient proxyClient; - private static org.apache.accumulo.proxy.thrift.AccumuloProxy.Client client; + private org.apache.accumulo.proxy.thrift.AccumuloProxy.Client client; private static Map<String,String> properties = new HashMap<>(); private static String hostname, proxyPrincipal, proxyPrimary, clientPrincipal; private static File proxyKeytab, clientKeytab; - private static ByteBuffer creds = null; + private ByteBuffer creds = null; // Implementations can set this static TProtocolFactory factory = null; diff --git a/src/test/java/org/apache/accumulo/proxy/its/TestProxyClient.java b/src/test/java/org/apache/accumulo/proxy/its/TestProxyClient.java index 5c6b133..8fbdd0b 100644 --- a/src/test/java/org/apache/accumulo/proxy/its/TestProxyClient.java +++ b/src/test/java/org/apache/accumulo/proxy/its/TestProxyClient.java @@ -51,7 +51,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; public class TestProxyClient { - protected AccumuloProxy.Client proxy; + protected TProtocolFactory factory; protected TTransport transport; public TestProxyClient(String host, int port) throws TTransportException { @@ -63,8 +63,7 @@ public class TestProxyClient { final TSocket socket = new TSocket(host, port); socket.setTimeout(600000); transport = new TFramedTransport(socket); - final TProtocol protocol = protoFactory.getProtocol(transport); - proxy = new AccumuloProxy.Client(protocol); + factory = protoFactory; transport.open(); } @@ -79,9 +78,7 @@ public class TestProxyClient { // UGI transport will perform the doAs for us transport.open(); - AccumuloProxy.Client.Factory factory = new AccumuloProxy.Client.Factory(); - final TProtocol protocol = protoFactory.getProtocol(transport); - proxy = factory.getClient(protocol); + factory = protoFactory; } public synchronized void close() { @@ -92,7 +89,9 @@ public class TestProxyClient { } public AccumuloProxy.Client proxy() { - return proxy; + AccumuloProxy.Client.Factory factory1 = new AccumuloProxy.Client.Factory(); + final TProtocol protocol = factory.getProtocol(transport); + return factory1.getClient(protocol); } @SuppressFBWarnings(value = "HARD_CODE_PASSWORD", justification = "test password is okay") @@ -104,7 +103,7 @@ public class TestProxyClient { props.put("password", "secret"); System.out.println("Logging in"); - ByteBuffer login = tpc.proxy.login(principal, props); + ByteBuffer login = tpc.proxy().login(principal, props); System.out.println("Creating user: "); if (!tpc.proxy().listLocalUsers(login).contains("testuser")) {