Skip to content
Permalink
Browse files

chore: add StaticVariableName checkstyle rule (#1414)

add StaticVariableName checkstyle rule + fix violations + simplify SSPIClient constructor
  • Loading branch information...
AlexElin authored and davecramer committed Feb 21, 2019
1 parent 4cd3f05 commit ddb38e572690f9366ba392a63f1a73711821ae1d
@@ -118,6 +118,7 @@
<module name="EqualsHashCode"/>
<module name="MemberName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="LocalVariableName">
<property name="allowOneCharVarInForLoop" value="true"/>
@@ -33,7 +33,7 @@
private static final int TYPE_DNS_NAME = 2;
private static final int TYPE_IP_ADDRESS = 7;

public static Comparator<String> HOSTNAME_PATTERN_COMPARATOR = new Comparator<String>() {
public static final Comparator<String> HOSTNAME_PATTERN_COMPARATOR = new Comparator<String>() {
private int countChars(String value, char ch) {
int count = 0;
int pos = -1;
@@ -35,7 +35,7 @@
*/
public class SSPIClient implements ISSPIClient {

public static String SSPI_DEFAULT_SPN_SERVICE_CLASS = "POSTGRES";
public static final String SSPI_DEFAULT_SPN_SERVICE_CLASS = "POSTGRES";

private static final Logger LOGGER = Logger.getLogger(SSPIClient.class.getName());
private final PGStream pgStream;
@@ -62,11 +62,7 @@
public SSPIClient(PGStream pgStream, String spnServiceClass, boolean enableNegotiate) {
this.pgStream = pgStream;

/* If blank or unspecified, SPN service class should be POSTGRES */
if (spnServiceClass != null && spnServiceClass.isEmpty()) {
spnServiceClass = null;
}
if (spnServiceClass == null) {
if (spnServiceClass == null || spnServiceClass.isEmpty()) {
spnServiceClass = SSPI_DEFAULT_SPN_SERVICE_CLASS;
}
this.spnServiceClass = spnServiceClass;
@@ -81,6 +77,7 @@ public SSPIClient(PGStream pgStream, String spnServiceClass, boolean enableNegot
*
* @return true if it's safe to attempt SSPI authentication
*/
@Override
public boolean isSSPISupported() {
try {
/*
@@ -122,6 +119,7 @@ private String makeSPN() throws PSQLException {
* @throws SQLException on SSPI authentication handshake failure
* @throws IOException on network I/O issues
*/
@Override
public void startSSPI() throws SQLException, IOException {

/*
@@ -181,6 +179,7 @@ public void startSSPI() throws SQLException, IOException {
* @throws SQLException if something wrong happens
* @throws IOException if something wrong happens
*/
@Override
public void continueSSPI(int msgLength) throws SQLException, IOException {

if (sspiContext == null) {
@@ -226,6 +225,7 @@ private void sendSSPIResponse(byte[] outToken) throws IOException {
* Clean up native win32 resources after completion or failure of SSPI authentication. This
* SSPIClient instance becomes unusable after disposal.
*/
@Override
public void dispose() {
if (sspiContext != null) {
sspiContext.dispose();
@@ -14,7 +14,7 @@
* Simple container for host and port.
*/
public class HostSpec {
public static String DEFAULT_NON_PROXY_HOSTS = "localhost|127.*|[::1]|0.0.0.0|[::0]";
public static final String DEFAULT_NON_PROXY_HOSTS = "localhost|127.*|[::1]|0.0.0.0|[::0]";

protected final String host;
protected final int port;
@@ -39,7 +39,8 @@
* @author Aaron Mulder (ammulder@chariotsolutions.com)
*/
public abstract class BaseDataSourceTest {
public static String DATA_SOURCE_JNDI = "BaseDataSource";
public static final String DATA_SOURCE_JNDI = "BaseDataSource";

protected Connection con;
protected BaseDataSource bds;

@@ -30,7 +30,7 @@

@RunWith(Parameterized.class)
public class SingleCertValidatingFactoryTestSuite {
private static String IS_ENABLED_PROP_NAME = "testsinglecertfactory";
private static final String IS_ENABLED_PROP_NAME = "testsinglecertfactory";

/**
* <p>This method returns the parameters that JUnit will use when constructing this class for

0 comments on commit ddb38e5

Please sign in to comment.
You can’t perform that action at this time.