Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/microsoft/sqlserver/jdbc/AE.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ byte[] getCekMdVersion() {
cekId = 0;
cekVersion = 0;
cekMdVersion = null;
columnEncryptionKeyValues = new ArrayList<EncryptionKeyInfo>();
columnEncryptionKeyValues = new ArrayList<>();
}

int getSize() {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/microsoft/sqlserver/jdbc/DataTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ private GetterConversion(SSType.Category from,
this.to = to;
}

private static final EnumMap<SSType.Category, EnumSet<JDBCType.Category>> conversionMap = new EnumMap<SSType.Category, EnumSet<JDBCType.Category>>(
private static final EnumMap<SSType.Category, EnumSet<JDBCType.Category>> conversionMap = new EnumMap<>(
SSType.Category.class);

static {
Expand Down Expand Up @@ -776,7 +776,7 @@ private SetterConversionAE(JavaType from,
this.to = to;
}

private static final EnumMap<JavaType, EnumSet<JDBCType>> setterConversionAEMap = new EnumMap<JavaType, EnumSet<JDBCType>>(JavaType.class);
private static final EnumMap<JavaType, EnumSet<JDBCType>> setterConversionAEMap = new EnumMap<>(JavaType.class);

static {
for (JavaType javaType : JavaType.values())
Expand Down Expand Up @@ -1086,7 +1086,7 @@ private SetterConversion(JDBCType.Category from,
this.to = to;
}

private static final EnumMap<JDBCType.Category, EnumSet<JDBCType.Category>> conversionMap = new EnumMap<JDBCType.Category, EnumSet<JDBCType.Category>>(
private static final EnumMap<JDBCType.Category, EnumSet<JDBCType.Category>> conversionMap = new EnumMap<>(
JDBCType.Category.class);

static {
Expand Down Expand Up @@ -1305,7 +1305,7 @@ private UpdaterConversion(JDBCType.Category from,
this.to = to;
}

private static final EnumMap<JDBCType.Category, EnumSet<SSType.Category>> conversionMap = new EnumMap<JDBCType.Category, EnumSet<SSType.Category>>(
private static final EnumMap<JDBCType.Category, EnumSet<SSType.Category>> conversionMap = new EnumMap<>(
JDBCType.Category.class);

static {
Expand Down Expand Up @@ -1616,7 +1616,7 @@ private NormalizationAE(JDBCType from,
this.to = to;
}

private static final EnumMap<JDBCType, EnumSet<SSType>> normalizationMapAE = new EnumMap<JDBCType, EnumSet<SSType>>(JDBCType.class);
private static final EnumMap<JDBCType, EnumSet<SSType>> normalizationMapAE = new EnumMap<>(JDBCType.class);

static {
for (JDBCType jdbcType : JDBCType.values())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

final class FailoverMapSingleton {
private static int INITIALHASHMAPSIZE = 5;
private static HashMap<String, FailoverInfo> failoverMap = new HashMap<String, FailoverInfo>(INITIALHASHMAPSIZE);
private static HashMap<String, FailoverInfo> failoverMap = new HashMap<>(INITIALHASHMAPSIZE);

private FailoverMapSingleton() {
/* hide the constructor to stop the instantiation of this class. */}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2316,8 +2316,8 @@ else if (!useTnir) {
findSocketUsingJavaNIO(inetAddrs, portNumber, timeoutInMilliSeconds);
}
else {
LinkedList<Inet4Address> inet4Addrs = new LinkedList<Inet4Address>();
LinkedList<Inet6Address> inet6Addrs = new LinkedList<Inet6Address>();
LinkedList<Inet4Address> inet4Addrs = new LinkedList<>();
LinkedList<Inet6Address> inet6Addrs = new LinkedList<>();

for (InetAddress inetAddr : inetAddrs) {
if (inetAddr instanceof Inet4Address) {
Expand Down Expand Up @@ -2445,7 +2445,7 @@ private void findSocketUsingJavaNIO(InetAddress[] inetAddrs,
assert inetAddrs.length != 0 : "Number of inetAddresses should not be zero in this function";

Selector selector = null;
LinkedList<SocketChannel> socketChannels = new LinkedList<SocketChannel>();
LinkedList<SocketChannel> socketChannels = new LinkedList<>();
SocketChannel selectedChannel = null;

try {
Expand Down Expand Up @@ -2624,8 +2624,8 @@ private void findSocketUsingThreading(LinkedList<Inet6Address> inetAddrs,

assert inetAddrs.isEmpty() == false : "Number of inetAddresses should not be zero in this function";

LinkedList<Socket> sockets = new LinkedList<Socket>();
LinkedList<SocketConnector> socketConnectors = new LinkedList<SocketConnector>();
LinkedList<Socket> sockets = new LinkedList<>();
LinkedList<SocketConnector> socketConnectors = new LinkedList<>();

try {

Expand Down Expand Up @@ -5143,7 +5143,7 @@ void writeTvpOrderUnique(TVP value) throws SQLServerException {

Map<Integer, SQLServerMetaData> columnMetadata = value.getColumnMetadata();
Iterator<Entry<Integer, SQLServerMetaData>> columnsIterator = columnMetadata.entrySet().iterator();
LinkedList<TdsOrderUnique> columnList = new LinkedList<TdsOrderUnique>();
LinkedList<TdsOrderUnique> columnList = new LinkedList<>();

while (columnsIterator.hasNext()) {
byte flags = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public class JaasConfiguration extends Configuration {

private static AppConfigurationEntry[] generateDefaultConfiguration() {
if (Util.isIBM()) {
Map<String, String> confDetailsWithoutPassword = new HashMap<String, String>();
Map<String, String> confDetailsWithoutPassword = new HashMap<>();
confDetailsWithoutPassword.put("useDefaultCcache", "true");
Map<String, String> confDetailsWithPassword = new HashMap<String, String>();
Map<String, String> confDetailsWithPassword = new HashMap<>();
// We generated a two configurations fallback that is suitable for password and password-less authentication
// See https://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ibm.java.security.component.80.doc/security-component/jgssDocs/jaas_login_user.html
final String ibmLoginModule = "com.ibm.security.auth.module.Krb5LoginModule";
Expand All @@ -34,7 +34,7 @@ private static AppConfigurationEntry[] generateDefaultConfiguration() {
new AppConfigurationEntry(ibmLoginModule, AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, confDetailsWithPassword)};
}
else {
Map<String, String> confDetails = new HashMap<String, String>();
Map<String, String> confDetails = new HashMap<>();
confDetails.put("useTicketCache", "true");
return new AppConfigurationEntry[] {new AppConfigurationEntry("com.sun.security.auth.module.Krb5LoginModule",
AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, confDetails)};
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/microsoft/sqlserver/jdbc/SQLCollation.java
Original file line number Diff line number Diff line change
Expand Up @@ -530,11 +530,11 @@ private Encoding encodingFromSortId() throws UnsupportedEncodingException {
static {
// Populate the windows locale and sort order indices

localeIndex = new HashMap<Integer, WindowsLocale>();
localeIndex = new HashMap<>();
for (WindowsLocale locale : EnumSet.allOf(WindowsLocale.class))
localeIndex.put(locale.langID, locale);

sortOrderIndex = new HashMap<Integer, SortOrder>();
sortOrderIndex = new HashMap<>();
for (SortOrder sortOrder : EnumSet.allOf(SortOrder.class))
sortOrderIndex.put(sortOrder.sortId, sortOrder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class SQLServerAeadAes256CbcHmac256Factory extends SQLServerEncryptionAlgorithmFactory {
// In future we can have more
private byte algorithmVersion = 0x1;
private ConcurrentHashMap<String, SQLServerAeadAes256CbcHmac256Algorithm> encryptionAlgorithms = new ConcurrentHashMap<String, SQLServerAeadAes256CbcHmac256Algorithm>();
private ConcurrentHashMap<String, SQLServerAeadAes256CbcHmac256Algorithm> encryptionAlgorithms = new ConcurrentHashMap<>();

@Override
SQLServerEncryptionAlgorithm create(SQLServerSymmetricKey columnEncryptionKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public final class SQLServerBlob implements java.sql.Blob, java.io.Serializable
// Initial size of the array is based on an assumption that a Blob object is
// typically used either for input or output, and then only once. The array size
// grows automatically if multiple streams are used.
ArrayList<Closeable> activeStreams = new ArrayList<Closeable>(1);
ArrayList<Closeable> activeStreams = new ArrayList<>(1);

static private final Logger logger = Logger.getLogger("com.microsoft.sqlserver.jdbc.internals.SQLServerBlob");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ else if (null == delimiter) {
catch (Exception e) {
throw new SQLServerException(null, e.getMessage(), null, 0, false);
}
columnMetadata = new HashMap<Integer, SQLServerBulkCSVFileRecord.ColumnMetadata>();
columnMetadata = new HashMap<>();

loggerExternal.exiting(loggerClassName, "SQLServerBulkCSVFileRecord");
}
Expand Down Expand Up @@ -216,7 +216,7 @@ else if (null == delimiter) {
catch (Exception e) {
throw new SQLServerException(null, e.getMessage(), null, 0, false);
}
columnMetadata = new HashMap<Integer, SQLServerBulkCSVFileRecord.ColumnMetadata>();
columnMetadata = new HashMap<>();

loggerExternal.exiting(loggerClassName, "SQLServerBulkCSVFileRecord");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ public void writeToServer(ISQLServerBulkRecord sourceData) throws SQLServerExcep
* Initializes the defaults for member variables that require it.
*/
private void initializeDefaults() {
columnMappings = new LinkedList<SQLServerBulkCopy.ColumnMapping>();
columnMappings = new LinkedList<>();
destinationTableName = null;
sourceBulkRecord = null;
sourceResultSet = null;
Expand Down Expand Up @@ -1471,7 +1471,7 @@ private String getDestTypeFromSrcType(int srcColIndx,

private String createInsertBulkCommand(TDSWriter tdsWriter) throws SQLServerException {
StringBuilder bulkCmd = new StringBuilder();
List<String> bulkOptions = new ArrayList<String>();
List<String> bulkOptions = new ArrayList<>();
String endColumn = " , ";
bulkCmd.append("INSERT BULK " + destinationTableName + " (");

Expand Down Expand Up @@ -1747,7 +1747,7 @@ private void getDestinationMetadata() throws SQLServerException {
.executeQueryInternal("SET FMTONLY ON SELECT * FROM " + destinationTableName + " SET FMTONLY OFF ");

destColumnCount = rs.getMetaData().getColumnCount();
destColumnMetadata = new HashMap<Integer, BulkColumnMetaData>();
destColumnMetadata = new HashMap<>();
destCekTable = rs.getCekTable();

if (!connection.getServerSupportsColumnEncryption()) {
Expand Down Expand Up @@ -1793,7 +1793,7 @@ private void getDestinationMetadata() throws SQLServerException {
* source metadata from the same place for both ResultSet and File.
*/
private void getSourceMetadata() throws SQLServerException {
srcColumnMetadata = new HashMap<Integer, BulkColumnMetaData>();
srcColumnMetadata = new HashMap<>();
int currentColumn;
if (null != sourceResultSet) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ public NClob getNClob(String parameterName) throws SQLException {
}

ResultSet rs = s.executeQueryInternal(metaQuery.toString());
paramNames = new ArrayList<String>();
paramNames = new ArrayList<>();
while (rs.next()) {
String sCol = rs.getString(4);
paramNames.add(sCol.trim());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ abstract class SQLServerClobBase implements Serializable {
// Initial size of the array is based on an assumption that a Clob/NClob object is
// typically used either for input or output, and then only once. The array size
// grows automatically if multiple streams are used.
private ArrayList<Closeable> activeStreams = new ArrayList<Closeable>(1);
private ArrayList<Closeable> activeStreams = new ArrayList<>(1);

transient SQLServerConnection con;
private static Logger logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public class SQLServerConnection implements ISQLServerConnection {
private Boolean enablePrepareOnFirstPreparedStatementCall = null; // Current limit for this particular connection.

// Handle the actual queue of discarded prepared statements.
private ConcurrentLinkedQueue<PreparedStatementHandle> discardedPreparedStatementHandles = new ConcurrentLinkedQueue<PreparedStatementHandle>();
private ConcurrentLinkedQueue<PreparedStatementHandle> discardedPreparedStatementHandles = new ConcurrentLinkedQueue<>();
private AtomicInteger discardedPreparedStatementHandleCount = new AtomicInteger(0);

private boolean fedAuthRequiredByUser = false;
Expand Down Expand Up @@ -525,7 +525,7 @@ boolean getServerSupportsColumnEncryption() {
}

static boolean isWindows;
static Map<String, SQLServerColumnEncryptionKeyStoreProvider> globalSystemColumnEncryptionKeyStoreProviders = new HashMap<String, SQLServerColumnEncryptionKeyStoreProvider>();
static Map<String, SQLServerColumnEncryptionKeyStoreProvider> globalSystemColumnEncryptionKeyStoreProviders = new HashMap<>();
static {
if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).startsWith("windows")) {
isWindows = true;
Expand All @@ -538,7 +538,7 @@ boolean getServerSupportsColumnEncryption() {
}
static Map<String, SQLServerColumnEncryptionKeyStoreProvider> globalCustomColumnEncryptionKeyStoreProviders = null;
// This is a per-connection store provider. It can be JKS or AKV.
Map<String, SQLServerColumnEncryptionKeyStoreProvider> systemColumnEncryptionKeyStoreProvider = new HashMap<String, SQLServerColumnEncryptionKeyStoreProvider>();
Map<String, SQLServerColumnEncryptionKeyStoreProvider> systemColumnEncryptionKeyStoreProvider = new HashMap<>();

/**
* Registers key store providers in the globalCustomColumnEncryptionKeyStoreProviders.
Expand All @@ -561,7 +561,7 @@ public static synchronized void registerColumnEncryptionKeyStoreProviders(
throw new SQLServerException(null, SQLServerException.getErrString("R_CustomKeyStoreProviderSetOnce"), null, 0, false);
}

globalCustomColumnEncryptionKeyStoreProviders = new HashMap<String, SQLServerColumnEncryptionKeyStoreProvider>();
globalCustomColumnEncryptionKeyStoreProviders = new HashMap<>();

for (Map.Entry<String, SQLServerColumnEncryptionKeyStoreProvider> entry : clientKeyStoreProviders.entrySet()) {
String providerName = entry.getKey();
Expand Down Expand Up @@ -625,7 +625,7 @@ synchronized SQLServerColumnEncryptionKeyStoreProvider getSystemColumnEncryption
}

private String trustedServerNameAE = null;
private static Map<String, List<String>> columnEncryptionTrustedMasterKeyPaths = new HashMap<String, List<String>>();
private static Map<String, List<String>> columnEncryptionTrustedMasterKeyPaths = new HashMap<>();

/**
* Sets Trusted Master Key Paths in the columnEncryptionTrustedMasterKeyPaths.
Expand Down Expand Up @@ -691,7 +691,7 @@ public static synchronized void removeColumnEncryptionTrustedMasterKeyPaths(Stri
public static synchronized Map<String, List<String>> getColumnEncryptionTrustedMasterKeyPaths() {
loggerExternal.entering(SQLServerConnection.class.getName(), "getColumnEncryptionTrustedMasterKeyPaths", "Getting Trusted Master Key Paths");

Map<String, List<String>> masterKeyPathCopy = new HashMap<String, List<String>>();
Map<String, List<String>> masterKeyPathCopy = new HashMap<>();

for (Map.Entry<String, List<String>> entry : columnEncryptionTrustedMasterKeyPaths.entrySet()) {
masterKeyPathCopy.put(entry.getKey(), entry.getValue());
Expand Down Expand Up @@ -3230,7 +3230,7 @@ public CallableStatement prepareCall(String sql,
public java.util.Map<String, Class<?>> getTypeMap() throws SQLServerException {
loggerExternal.entering(getClassNameLogging(), "getTypeMap");
checkClosed();
java.util.Map<String, Class<?>> mp = new java.util.HashMap<String, Class<?>>();
java.util.Map<String, Class<?>> mp = new java.util.HashMap<>();
loggerExternal.exiting(getClassNameLogging(), "getTypeMap", mp);
return mp;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public final class SQLServerDataTable {
*/
// Name used in CREATE TYPE
public SQLServerDataTable() throws SQLServerException {
columnMetadata = new LinkedHashMap<Integer, SQLServerDataColumn>();
rows = new HashMap<Integer, Object[]>();
columnMetadata = new LinkedHashMap<>();
rows = new HashMap<>();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ final void close() throws SQLServerException {
}
}

EnumMap<CallableHandles, HandleAssociation> handleMap = new EnumMap<CallableHandles, HandleAssociation>(CallableHandles.class);
EnumMap<CallableHandles, HandleAssociation> handleMap = new EnumMap<>(CallableHandles.class);

// Returns unique id for each instance.
private static int nextInstanceID() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class SQLServerEncryptionAlgorithmFactoryList {
private static final SQLServerEncryptionAlgorithmFactoryList instance = new SQLServerEncryptionAlgorithmFactoryList();

private SQLServerEncryptionAlgorithmFactoryList() {
encryptionAlgoFactoryMap = new ConcurrentHashMap<String, SQLServerEncryptionAlgorithmFactory>();
encryptionAlgoFactoryMap = new ConcurrentHashMap<>();
encryptionAlgoFactoryMap.putIfAbsent(SQLServerAeadAes256CbcHmac256Algorithm.algorithmName, new SQLServerAeadAes256CbcHmac256Factory());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ private void checkClosed() throws SQLServerException {
// procedure "sp_describe_undeclared_parameters" to retrieve parameter meta data
// if SQL server version is 2008, then use FMTONLY
else {
queryMetaMap = new HashMap<Integer, QueryMeta>();
queryMetaMap = new HashMap<>();

if (con.getServerMajorVersion() >= SQL_SERVER_2012_VERSION) {
// new implementation for SQL verser 2012 and above
Expand All @@ -618,7 +618,7 @@ private void checkClosed() throws SQLServerException {
else {
// old implementation for SQL server 2008
stringToParse = sProcString;
ArrayList<MetaInfo> metaInfoList = new ArrayList<MetaInfo>();
ArrayList<MetaInfo> metaInfoList = new ArrayList<>();

while (stringToParse.length() > 0) {
MetaInfo metaInfo = parseStatement(stringToParse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class SQLServerPooledConnection implements PooledConnection {
SQLServerPooledConnection(SQLServerDataSource ds,
String user,
String password) throws SQLException {
listeners = new Vector<ConnectionEventListener>();
listeners = new Vector<>();
// Piggyback SQLServerDataSource logger for now.
pcLogger = SQLServerDataSource.dsLogger;

Expand Down
Loading