From e46a6ef645b8f405dc7a90edf60f66d70c920ebf Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Mon, 23 Jul 2018 15:53:14 -0700 Subject: [PATCH] Updated formatter to add new line to EOF + formatted project --- mssql-jdbc_formatter.xml | 4 +- .../microsoft/sqlserver/jdbc/Geography.java | 2 +- .../microsoft/sqlserver/jdbc/Parameter.java | 7 +- .../sqlserver/jdbc/SQLServerDataColumn.java | 2 +- .../jdbc/SQLServerDatabaseMetaData.java | 2 +- .../sqlserver/jdbc/SQLServerDriver.java | 4 +- .../sqlserver/jdbc/SQLServerException.java | 7 +- .../sqlserver/jdbc/SQLServerJdbc43.java | 2 +- ...LServerKeyVaultAuthenticationCallback.java | 2 +- .../jdbc/SQLServerSpatialDatatype.java | 2 +- .../src/main/java/executeStoredProcedure.java | 38 ++++----- .../adaptive/src/main/java/readLargeData.java | 37 ++++----- .../src/main/java/updateLargeData.java | 41 ++++------ .../src/main/java/AlwaysEncrypted.java | 77 +++++++++---------- .../AzureActiveDirectoryAuthentication.java | 24 ++---- .../connections/src/main/java/connectDS.java | 20 ++--- .../connections/src/main/java/connectURL.java | 24 ++---- .../src/main/java/ConstrainedSample.java | 25 +++--- .../datatypes/src/main/java/basicDT.java | 58 ++++++-------- .../src/main/java/sqlxmlExample.java | 75 +++++++----------- .../resultsets/src/main/java/cacheRS.java | 38 ++++----- .../resultsets/src/main/java/retrieveRS.java | 52 ++++++------- .../resultsets/src/main/java/updateRS.java | 40 ++++------ .../sparse/src/main/java/SparseColumns.java | 33 ++++---- .../jdbc/bulkCopy/BulkCopyAllTypes.java | 2 +- .../bulkCopy/BulkCopyResultSetCursorTest.java | 2 +- .../jdbc/datatypes/DateAndTimeTypeTest.java | 2 +- .../resultset/DataClassificationTest.java | 3 +- .../sqlserver/jdbc/tvp/TVPAllTypes.java | 2 +- .../sqlserver/jdbc/tvp/TVPNumericTest.java | 2 +- .../RegressionTestAlwaysEncrypted.java | 2 +- .../testframework/DBCallableStatement.java | 2 +- .../sqlserver/testframework/DBCoercion.java | 2 +- .../sqlserver/testframework/DBCoercions.java | 2 +- .../sqlserver/testframework/DBColumn.java | 2 +- .../sqlserver/testframework/DBConnection.java | 2 +- .../testframework/DBInvalidUtil.java | 2 +- .../sqlserver/testframework/DBItems.java | 2 +- .../testframework/DBPreparedStatement.java | 2 +- .../sqlserver/testframework/DBStatement.java | 2 +- .../sqlserver/testframework/DBTable.java | 2 +- .../testframework/sqlType/SqlBigInt.java | 2 +- .../testframework/sqlType/SqlBinary.java | 2 +- .../testframework/sqlType/SqlBit.java | 2 +- .../testframework/sqlType/SqlChar.java | 2 +- .../testframework/sqlType/SqlDate.java | 2 +- .../testframework/sqlType/SqlDateTime.java | 2 +- .../testframework/sqlType/SqlDateTime2.java | 2 +- .../sqlType/SqlDateTimeOffset.java | 2 +- .../testframework/sqlType/SqlDecimal.java | 2 +- .../testframework/sqlType/SqlFloat.java | 2 +- .../testframework/sqlType/SqlInt.java | 2 +- .../testframework/sqlType/SqlMoney.java | 2 +- .../testframework/sqlType/SqlNChar.java | 2 +- .../testframework/sqlType/SqlNVarChar.java | 2 +- .../testframework/sqlType/SqlNVarCharMax.java | 2 +- .../testframework/sqlType/SqlNumber.java | 2 +- .../testframework/sqlType/SqlNumeric.java | 2 +- .../testframework/sqlType/SqlReal.java | 2 +- .../sqlType/SqlSmallDateTime.java | 2 +- .../testframework/sqlType/SqlSmallInt.java | 2 +- .../testframework/sqlType/SqlSmallMoney.java | 2 +- .../testframework/sqlType/SqlTime.java | 2 +- .../testframework/sqlType/SqlTinyInt.java | 2 +- .../testframework/sqlType/SqlType.java | 2 +- .../testframework/sqlType/SqlVarBinary.java | 2 +- .../sqlType/SqlVarBinaryMax.java | 2 +- .../testframework/sqlType/SqlVarChar.java | 2 +- .../testframework/sqlType/SqlVarCharMax.java | 2 +- 69 files changed, 302 insertions(+), 405 deletions(-) diff --git a/mssql-jdbc_formatter.xml b/mssql-jdbc_formatter.xml index 1fe65fde3..d6d74d50e 100644 --- a/mssql-jdbc_formatter.xml +++ b/mssql-jdbc_formatter.xml @@ -117,7 +117,7 @@ - + @@ -146,7 +146,7 @@ - + diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/Geography.java b/src/main/java/com/microsoft/sqlserver/jdbc/Geography.java index 1bcac796c..a1bdca638 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/Geography.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/Geography.java @@ -409,4 +409,4 @@ private void readPoints() { points[2 * i] = buffer.getDouble(); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/Parameter.java b/src/main/java/com/microsoft/sqlserver/jdbc/Parameter.java index db03eace1..93758a09c 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/Parameter.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/Parameter.java @@ -626,10 +626,9 @@ private void setTypeDefinition(DTV dtv) { * generic type info can be used as before. */ if (userProvidesScale) { - param.typeDefinition = con.isKatmaiOrLater() - ? (SSType.DATETIME2.toString() + "(" + outScale - + ")") - : (SSType.DATETIME.toString()); + param.typeDefinition = con + .isKatmaiOrLater() ? (SSType.DATETIME2.toString() + "(" + outScale + ")") + : (SSType.DATETIME.toString()); } else { param.typeDefinition = con.isKatmaiOrLater() ? (SSType.DATETIME2.toString() + "(" diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataColumn.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataColumn.java index 2357e47d6..48facf844 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataColumn.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataColumn.java @@ -45,4 +45,4 @@ public String getColumnName() { public int getColumnType() { return javaSqlType; } -} \ No newline at end of file +} diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java index 21b37244d..fb18bd370 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java @@ -2445,4 +2445,4 @@ final Object apply(Object value, JDBCType asJDBCType) throws SQLServerException } } -} \ No newline at end of file +} diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDriver.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDriver.java index 0245fc2c5..6f0035177 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDriver.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDriver.java @@ -46,8 +46,8 @@ final String getName() { } DriverPropertyInfo build(Properties connProperties) { - String propValue = name - .equals(SQLServerDriverStringProperty.PASSWORD.toString()) ? "" : connProperties.getProperty(name); + String propValue = name.equals(SQLServerDriverStringProperty.PASSWORD.toString()) ? "" : connProperties + .getProperty(name); if (null == propValue) propValue = defaultValue; diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerException.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerException.java index d9e564ece..bb735913d 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerException.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerException.java @@ -186,8 +186,7 @@ static String getErrString(String errCode) { * @param bStack * true to generate the stack trace */ - SQLServerException(Object obj, String errText, String errState, StreamError streamError, - boolean bStack) { + SQLServerException(Object obj, String errText, String errState, StreamError streamError, boolean bStack) { super(errText, errState, streamError.getErrorNumber()); // Log SQL error with info from StreamError. @@ -248,8 +247,8 @@ static void makeFromDriverError(SQLServerConnection con, Object obj, String errT * true to generate the stack trace * @throws SQLServerException */ - static void makeFromDatabaseError(SQLServerConnection con, Object obj, String errText, - StreamError streamError, boolean bStack) throws SQLServerException { + static void makeFromDatabaseError(SQLServerConnection con, Object obj, String errText, StreamError streamError, + boolean bStack) throws SQLServerException { String state = generateStateCode(con, streamError.getErrorNumber(), streamError.getErrorState()); SQLServerException theException = new SQLServerException(obj, diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerJdbc43.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerJdbc43.java index 61eadf577..4c7f2db6f 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerJdbc43.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerJdbc43.java @@ -27,4 +27,4 @@ static final void throwBatchUpdateException(SQLServerException lastError, throw new BatchUpdateException(lastError.getMessage(), lastError.getSQLState(), lastError.getErrorCode(), updateCounts, new Throwable(lastError.getMessage())); } -} \ No newline at end of file +} diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerKeyVaultAuthenticationCallback.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerKeyVaultAuthenticationCallback.java index 7358279bf..a6bcb5bd2 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerKeyVaultAuthenticationCallback.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerKeyVaultAuthenticationCallback.java @@ -19,4 +19,4 @@ public interface SQLServerKeyVaultAuthenticationCallback { * @return access token */ public String getAccessToken(String authority, String resource, String scope); -} \ No newline at end of file +} diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSpatialDatatype.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSpatialDatatype.java index 38d722c3e..5a5cb426b 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSpatialDatatype.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSpatialDatatype.java @@ -1759,4 +1759,4 @@ public double getZ() { public double getM() { return m; } -} \ No newline at end of file +} diff --git a/src/samples/adaptive/src/main/java/executeStoredProcedure.java b/src/samples/adaptive/src/main/java/executeStoredProcedure.java index 6fbd21803..4b8f6b9ce 100644 --- a/src/samples/adaptive/src/main/java/executeStoredProcedure.java +++ b/src/samples/adaptive/src/main/java/executeStoredProcedure.java @@ -1,9 +1,6 @@ /* - * Microsoft JDBC Driver for SQL Server - * - * Copyright(c) Microsoft Corporation All rights reserved. - * - * This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information. + * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made + * available under the terms of the MIT License. See the LICENSE file in the project root for more information. */ package adaptive.src.main.java; @@ -20,6 +17,7 @@ import com.microsoft.sqlserver.jdbc.SQLServerCallableStatement; import com.microsoft.sqlserver.jdbc.SQLServerDataSource; + public class executeStoredProcedure { public static void main(String[] args) { @@ -66,7 +64,8 @@ public static void main(String[] args) { for (int i = 0; i < 4000; i++) buffer.append((char) ('A')); - PreparedStatement pstmt = con.prepareStatement("UPDATE Document_JDBC_Sample " + "SET DocumentSummary = ? WHERE (DocumentID = 1)"); + PreparedStatement pstmt = con.prepareStatement( + "UPDATE Document_JDBC_Sample " + "SET DocumentSummary = ? WHERE (DocumentID = 1)"); pstmt.setString(1, buffer.toString()); pstmt.executeUpdate(); @@ -118,26 +117,19 @@ public static void main(String[] args) { // Handle any errors that may have occurred. catch (Exception e) { e.printStackTrace(); - } - finally { + } finally { if (rs != null) try { rs.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (stmt != null) try { stmt.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (con != null) try { con.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} } } @@ -150,8 +142,9 @@ private static void createStoredProcedure(Connection con) throws SQLException { + "') and OBJECTPROPERTY(id, N'IsProcedure') = 1)" + " DROP PROCEDURE " + outputProcedure; stmt.execute(sql); - sql = "CREATE PROCEDURE " + outputProcedure + " @p0 int, @p1 int OUTPUT, @p2 char(50) OUTPUT, " + "@p3 varchar(max) OUTPUT " + " AS" - + " SELECT top 1 @p1=DocumentID, @p2=Title," + " @p3=DocumentSummary FROM Document_JDBC_Sample where DocumentID = @p0"; + sql = "CREATE PROCEDURE " + outputProcedure + " @p0 int, @p1 int OUTPUT, @p2 char(50) OUTPUT, " + + "@p3 varchar(max) OUTPUT " + " AS" + " SELECT top 1 @p1=DocumentID, @p2=Title," + + " @p3=DocumentSummary FROM Document_JDBC_Sample where DocumentID = @p0"; stmt.execute(sql); } @@ -159,10 +152,11 @@ private static void createStoredProcedure(Connection con) throws SQLException { private static void createTable(Connection con) throws SQLException { Statement stmt = con.createStatement(); - stmt.execute("if exists (select * from sys.objects where name = 'Document_JDBC_Sample')" + "drop table Document_JDBC_Sample"); + stmt.execute("if exists (select * from sys.objects where name = 'Document_JDBC_Sample')" + + "drop table Document_JDBC_Sample"); - String sql = "CREATE TABLE Document_JDBC_Sample(" + "[DocumentID] [int] NOT NULL identity," + "[Title] [char](50) NOT NULL," - + "[DocumentSummary] [varchar](max) NULL)"; + String sql = "CREATE TABLE Document_JDBC_Sample(" + "[DocumentID] [int] NOT NULL identity," + + "[Title] [char](50) NOT NULL," + "[DocumentSummary] [varchar](max) NULL)"; stmt.execute(sql); diff --git a/src/samples/adaptive/src/main/java/readLargeData.java b/src/samples/adaptive/src/main/java/readLargeData.java index f52d5e18c..fea24728d 100644 --- a/src/samples/adaptive/src/main/java/readLargeData.java +++ b/src/samples/adaptive/src/main/java/readLargeData.java @@ -1,9 +1,6 @@ /* - * Microsoft JDBC Driver for SQL Server - * - * Copyright(c) Microsoft Corporation All rights reserved. - * - * This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information. + * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made + * available under the terms of the MIT License. See the LICENSE file in the project root for more information. */ package adaptive.src.main.java; @@ -19,6 +16,7 @@ import com.microsoft.sqlserver.jdbc.SQLServerStatement; + public class readLargeData { public static void main(String[] args) { @@ -48,8 +46,8 @@ public static void main(String[] args) { password = br.readLine(); // Create a variable for the connection string. - String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + databaseName + ";username=" - + username + ";password=" + password + ";"; + String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + + databaseName + ";username=" + username + ";password=" + password + ";"; // Establish the connection. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); @@ -62,7 +60,8 @@ public static void main(String[] args) { for (int i = 0; i < 4000; i++) buffer.append((char) ('A')); - PreparedStatement pstmt = con.prepareStatement("UPDATE Document_JDBC_Sample " + "SET DocumentSummary = ? WHERE (DocumentID = 1)"); + PreparedStatement pstmt = con.prepareStatement( + "UPDATE Document_JDBC_Sample " + "SET DocumentSummary = ? WHERE (DocumentID = 1)"); pstmt.setString(1, buffer.toString()); pstmt.executeUpdate(); @@ -102,36 +101,30 @@ public static void main(String[] args) { // Handle any errors that may have occurred. catch (Exception e) { e.printStackTrace(); - } - finally { + } finally { if (rs != null) try { rs.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (stmt != null) try { stmt.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (con != null) try { con.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} } } private static void createTable(Connection con) throws SQLException { Statement stmt = con.createStatement(); - stmt.execute("if exists (select * from sys.objects where name = 'Document_JDBC_Sample')" + "drop table Document_JDBC_Sample"); + stmt.execute("if exists (select * from sys.objects where name = 'Document_JDBC_Sample')" + + "drop table Document_JDBC_Sample"); - String sql = "CREATE TABLE Document_JDBC_Sample (" + "[DocumentID] [int] NOT NULL identity," + "[Title] [char](50) NOT NULL," - + "[DocumentSummary] [varchar](max) NULL)"; + String sql = "CREATE TABLE Document_JDBC_Sample (" + "[DocumentID] [int] NOT NULL identity," + + "[Title] [char](50) NOT NULL," + "[DocumentSummary] [varchar](max) NULL)"; stmt.execute(sql); diff --git a/src/samples/adaptive/src/main/java/updateLargeData.java b/src/samples/adaptive/src/main/java/updateLargeData.java index f11c1ccc5..f54ec8e30 100644 --- a/src/samples/adaptive/src/main/java/updateLargeData.java +++ b/src/samples/adaptive/src/main/java/updateLargeData.java @@ -1,9 +1,6 @@ /* - * Microsoft JDBC Driver for SQL Server - * - * Copyright(c) Microsoft Corporation All rights reserved. - * - * This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information. + * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made + * available under the terms of the MIT License. See the LICENSE file in the project root for more information. */ package adaptive.src.main.java; @@ -18,6 +15,7 @@ import com.microsoft.sqlserver.jdbc.SQLServerStatement; + public class updateLargeData { public static void main(String[] args) { @@ -49,8 +47,8 @@ public static void main(String[] args) { password = br.readLine(); // Create a variable for the connection string. - String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + databaseName + ";username=" - + username + ";password=" + password + ";"; + String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + + databaseName + ";username=" + username + ";password=" + password + ";"; // Establish the connection. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); @@ -91,8 +89,7 @@ public static void main(String[] args) { System.out.println("Updating " + rs.getString("Title")); rs.updateString("DocumentSummary", "Work in progress"); rs.updateRow(); - } - else { + } else { System.out.println("reading " + rs.getString("Title")); reader.close(); reader = null; @@ -102,42 +99,34 @@ public static void main(String[] args) { // Handle any errors that may have occurred. catch (Exception e) { e.printStackTrace(); - } - finally { + } finally { if (reader != null) try { reader.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (rs != null) try { rs.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (stmt != null) try { stmt.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (con != null) try { con.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} } } private static void createTable(Connection con) throws SQLException { Statement stmt = con.createStatement(); - stmt.execute("if exists (select * from sys.objects where name = 'Document_JDBC_Sample')" + "drop table Document_JDBC_Sample"); + stmt.execute("if exists (select * from sys.objects where name = 'Document_JDBC_Sample')" + + "drop table Document_JDBC_Sample"); - String sql = "CREATE TABLE Document_JDBC_Sample (" + "[DocumentID] [int] NOT NULL identity," + "[Title] [char](50) NOT NULL," - + "[DocumentSummary] [varchar](max) NULL)"; + String sql = "CREATE TABLE Document_JDBC_Sample (" + "[DocumentID] [int] NOT NULL identity," + + "[Title] [char](50) NOT NULL," + "[DocumentSummary] [varchar](max) NULL)"; stmt.execute(sql); diff --git a/src/samples/alwaysencrypted/src/main/java/AlwaysEncrypted.java b/src/samples/alwaysencrypted/src/main/java/AlwaysEncrypted.java index abdd4a970..ac6be5bdc 100644 --- a/src/samples/alwaysencrypted/src/main/java/AlwaysEncrypted.java +++ b/src/samples/alwaysencrypted/src/main/java/AlwaysEncrypted.java @@ -1,9 +1,6 @@ /* - * Microsoft JDBC Driver for SQL Server - * - * Copyright(c) Microsoft Corporation All rights reserved. - * - * This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information. + * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made + * available under the terms of the MIT License. See the LICENSE file in the project root for more information. */ package alwaysencrypted.src.main.java; @@ -15,14 +12,14 @@ import java.sql.SQLException; import java.sql.Statement; - import com.microsoft.sqlserver.jdbc.SQLServerColumnEncryptionJavaKeyStoreProvider; import com.microsoft.sqlserver.jdbc.SQLServerColumnEncryptionKeyStoreProvider; import com.microsoft.sqlserver.jdbc.SQLServerException; + /** - * This program demonstrates how to create Column Master Key (CMK) and Column Encryption Key (CEK) CMK is created first and then it is used to create - * CEK + * This program demonstrates how to create Column Master Key (CMK) and Column Encryption Key (CEK) CMK is created first + * and then it is used to create CEK */ public class AlwaysEncrypted { // Alias of the key stored in the keystore. @@ -41,8 +38,8 @@ public class AlwaysEncrypted { private static char[] keyStoreSecret = null; /** - * Name of the encryption algorithm used to encrypt the value of the column encryption key. The algorithm for the system providers must be - * RSA_OAEP. + * Name of the encryption algorithm used to encrypt the value of the column encryption key. The algorithm for the + * system providers must be RSA_OAEP. */ private static String algorithm = "RSA_OAEP"; @@ -65,16 +62,16 @@ public static void main(String[] args) { System.out.print("Enter password: "); password = br.readLine(); - System.out.print("Enter the location of the keystore: "); // e.g. C:\\Dev\\Always Encrypted\\keystore.jks + System.out.print("Enter the location of the keystore: "); // e.g. C:\\Dev\\Always Encrypted\\keystore.jks keyStoreLocation = br.readLine(); - System.out.print("Enter the alias of the key stored in the keystore: "); // e.g. lp-e796acea-c3bd-4a27-b657-2bb71e3517d1 + System.out.print("Enter the alias of the key stored in the keystore: "); // e.g. + // lp-e796acea-c3bd-4a27-b657-2bb71e3517d1 keyAlias = br.readLine(); System.out.print("Enter the password of the keystore and the key: "); keyStoreSecret = br.readLine().toCharArray(); - } - catch (IOException e) { + } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } @@ -89,8 +86,8 @@ public static void main(String[] args) { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); try (Connection sourceConnection = DriverManager.getConnection(connectionString)) { // Instantiate the Java Key Store provider. - SQLServerColumnEncryptionKeyStoreProvider storeProvider = new SQLServerColumnEncryptionJavaKeyStoreProvider(keyStoreLocation, - keyStoreSecret); + SQLServerColumnEncryptionKeyStoreProvider storeProvider = new SQLServerColumnEncryptionJavaKeyStoreProvider( + keyStoreLocation, keyStoreSecret); dropKeys(sourceConnection); @@ -100,8 +97,9 @@ public static void main(String[] args) { * Create column mater key For details on syntax refer: https://msdn.microsoft.com/library/mt146393.aspx * */ - String createCMKSQL = "CREATE COLUMN MASTER KEY " + columnMasterKeyName + " WITH ( " + " KEY_STORE_PROVIDER_NAME = '" - + storeProvider.getName() + "' , KEY_PATH = '" + keyAlias + "' ) "; + String createCMKSQL = "CREATE COLUMN MASTER KEY " + columnMasterKeyName + " WITH ( " + + " KEY_STORE_PROVIDER_NAME = '" + storeProvider.getName() + "' , KEY_PATH = '" + keyAlias + + "' ) "; try (Statement cmkStatement = sourceConnection.createStatement()) { cmkStatement.executeUpdate(createCMKSQL); @@ -111,37 +109,36 @@ public static void main(String[] args) { byte[] encryptedCEK = getEncryptedCEK(storeProvider); /** - * Create column encryption key For more details on the syntax refer: https://msdn.microsoft.com/library/mt146372.aspx Encrypted CEK - * first needs to be converted into varbinary_literal from bytes, for which DatatypeConverter.printHexBinary is used + * Create column encryption key For more details on the syntax refer: + * https://msdn.microsoft.com/library/mt146372.aspx Encrypted CEK first needs to be converted into + * varbinary_literal from bytes, for which DatatypeConverter.printHexBinary is used */ - String createCEKSQL = "CREATE COLUMN ENCRYPTION KEY " + columnEncryptionKey + " WITH VALUES ( " + " COLUMN_MASTER_KEY = " - + columnMasterKeyName + " , ALGORITHM = '" + algorithm + "' , ENCRYPTED_VALUE = 0x" - + bytesToHexString(encryptedCEK, encryptedCEK.length) + " ) "; + String createCEKSQL = "CREATE COLUMN ENCRYPTION KEY " + columnEncryptionKey + " WITH VALUES ( " + + " COLUMN_MASTER_KEY = " + columnMasterKeyName + " , ALGORITHM = '" + algorithm + + "' , ENCRYPTED_VALUE = 0x" + bytesToHexString(encryptedCEK, encryptedCEK.length) + " ) "; try (Statement cekStatement = sourceConnection.createStatement()) { cekStatement.executeUpdate(createCEKSQL); System.out.println("CEK created with name : " + columnEncryptionKey); } } - } - catch (Exception e) { + } catch (Exception e) { // Handle any errors that may have occurred. e.printStackTrace(); } } - + /** * * @param b - * byte value + * byte value * @param length - * length of the array + * length of the array * @return */ final static char[] hexChars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; - private static String bytesToHexString(byte[] b, - int length) { + private static String bytesToHexString(byte[] b, int length) { StringBuilder sb = new StringBuilder(length * 2); for (int i = 0; i < length; i++) { int hexVal = b[i] & 0xFF; @@ -155,16 +152,18 @@ private static String bytesToHexString(byte[] b, // you can retrieve it from a configuration file. private static String GetConnectionString() { // Create a variable for the connection string. - String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + databaseName + ";username=" + username - + ";password=" + password + ";"; + String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + + databaseName + ";username=" + username + ";password=" + password + ";"; return connectionUrl; } - private static byte[] getEncryptedCEK(SQLServerColumnEncryptionKeyStoreProvider storeProvider) throws SQLServerException { + private static byte[] getEncryptedCEK( + SQLServerColumnEncryptionKeyStoreProvider storeProvider) throws SQLServerException { /** - * Following arguments needed by SQLServerColumnEncryptionJavaKeyStoreProvider 1) keyStoreLocation : Path where keystore is located, including - * the keystore file name. 2) keyStoreSecret : Password of the keystore and the key. + * Following arguments needed by SQLServerColumnEncryptionJavaKeyStoreProvider 1) keyStoreLocation : Path where + * keystore is located, including the keystore file name. 2) keyStoreSecret : Password of the keystore and the + * key. */ String plainTextKey = "You need to give your plain text"; @@ -178,12 +177,12 @@ private static byte[] getEncryptedCEK(SQLServerColumnEncryptionKeyStoreProvider } private static void dropKeys(Connection sourceConnection) throws SQLException { - String cekSql = " if exists (SELECT name from sys.column_encryption_keys where name='" + columnEncryptionKey + "')" + " begin" - + " drop column encryption key " + columnEncryptionKey + " end"; + String cekSql = " if exists (SELECT name from sys.column_encryption_keys where name='" + columnEncryptionKey + + "')" + " begin" + " drop column encryption key " + columnEncryptionKey + " end"; sourceConnection.createStatement().execute(cekSql); - cekSql = " if exists (SELECT name from sys.column_master_keys where name='" + columnMasterKeyName + "')" + " begin" - + " drop column master key " + columnMasterKeyName + " end"; + cekSql = " if exists (SELECT name from sys.column_master_keys where name='" + columnMasterKeyName + "')" + + " begin" + " drop column master key " + columnMasterKeyName + " end"; sourceConnection.createStatement().execute(cekSql); } } diff --git a/src/samples/azureactivedirectoryauthentication/src/main/java/AzureActiveDirectoryAuthentication.java b/src/samples/azureactivedirectoryauthentication/src/main/java/AzureActiveDirectoryAuthentication.java index 6436c9da6..29f639b03 100644 --- a/src/samples/azureactivedirectoryauthentication/src/main/java/AzureActiveDirectoryAuthentication.java +++ b/src/samples/azureactivedirectoryauthentication/src/main/java/AzureActiveDirectoryAuthentication.java @@ -1,9 +1,6 @@ /* - * Microsoft JDBC Driver for SQL Server - * - * Copyright(c) Microsoft Corporation All rights reserved. - * - * This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information. + * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made + * available under the terms of the MIT License. See the LICENSE file in the project root for more information. */ package azureactivedirectoryauthentication.src.main.java; @@ -16,6 +13,7 @@ import com.microsoft.sqlserver.jdbc.SQLServerDataSource; + public class AzureActiveDirectoryAuthentication { public static void main(String[] args) { @@ -48,9 +46,9 @@ public static void main(String[] args) { username = br.readLine(); System.out.print("Enter password: "); password = br.readLine(); - System.out.print("Enter authentication: "); // e.g. ActiveDirectoryPassword + System.out.print("Enter authentication: "); // e.g. ActiveDirectoryPassword authentication = br.readLine(); - System.out.print("Enter host name in certificate: "); // e.g. *.database.windows.net + System.out.print("Enter host name in certificate: "); // e.g. *.database.windows.net hostNameInCertificate = br.readLine(); // Establish the connection. @@ -87,21 +85,15 @@ public static void main(String[] args) { if (rs != null) try { rs.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (cstmt != null) try { cstmt.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (con != null) try { con.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} } } } diff --git a/src/samples/connections/src/main/java/connectDS.java b/src/samples/connections/src/main/java/connectDS.java index d41a37224..17076d66e 100644 --- a/src/samples/connections/src/main/java/connectDS.java +++ b/src/samples/connections/src/main/java/connectDS.java @@ -1,9 +1,6 @@ /* - * Microsoft JDBC Driver for SQL Server - * - * Copyright(c) Microsoft Corporation All rights reserved. - * - * This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information. + * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made + * available under the terms of the MIT License. See the LICENSE file in the project root for more information. */ package connections.src.main.java; @@ -16,6 +13,7 @@ import com.microsoft.sqlserver.jdbc.SQLServerDataSource; + public class connectDS { public static void main(String[] args) { @@ -77,21 +75,15 @@ public static void main(String[] args) { if (rs != null) try { rs.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (cstmt != null) try { cstmt.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (con != null) try { con.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} } } } diff --git a/src/samples/connections/src/main/java/connectURL.java b/src/samples/connections/src/main/java/connectURL.java index 57b40f710..c1d4a1d72 100644 --- a/src/samples/connections/src/main/java/connectURL.java +++ b/src/samples/connections/src/main/java/connectURL.java @@ -1,9 +1,6 @@ /* - * Microsoft JDBC Driver for SQL Server - * - * Copyright(c) Microsoft Corporation All rights reserved. - * - * This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information. + * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made + * available under the terms of the MIT License. See the LICENSE file in the project root for more information. */ package connections.src.main.java; @@ -14,6 +11,7 @@ import java.sql.ResultSet; import java.sql.Statement; + public class connectURL { public static void main(String[] args) { @@ -43,8 +41,8 @@ public static void main(String[] args) { password = br.readLine(); // Create a variable for the connection string. - String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + databaseName + ";username=" - + username + ";password=" + password + ";"; + String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + + databaseName + ";username=" + username + ";password=" + password + ";"; // Establish the connection. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); @@ -73,21 +71,15 @@ public static void main(String[] args) { if (rs != null) try { rs.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (stmt != null) try { stmt.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (con != null) try { con.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} } } } diff --git a/src/samples/constrained/src/main/java/ConstrainedSample.java b/src/samples/constrained/src/main/java/ConstrainedSample.java index 59b89ed2a..f70db48a4 100644 --- a/src/samples/constrained/src/main/java/ConstrainedSample.java +++ b/src/samples/constrained/src/main/java/ConstrainedSample.java @@ -20,20 +20,19 @@ import com.sun.security.jgss.ExtendedGSSCredential; + /** * * Sample of constrained delegation connection. * - * An intermediate service is necessary to impersonate the client. This service needs to be configured with the - * options: - * "Trust this user for delegation to specified services only" - * "Use any authentication protocol" + * An intermediate service is necessary to impersonate the client. This service needs to be configured with the options: + * "Trust this user for delegation to specified services only" "Use any authentication protocol" * */ public class ConstrainedSample { // Connection properties - private static final String DRIVER_CLASS_NAME ="com.microsoft.sqlserver.jdbc.SQLServerDriver"; + private static final String DRIVER_CLASS_NAME = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; private static final String CONNECTION_URI = "jdbc:sqlserver:// URI of the SQLServer"; private static final String TARGET_USER_NAME = "User to be impersonated"; @@ -82,7 +81,8 @@ public static void main(String... args) throws Exception { * Authenticate the intermediate server that is going to impersonate the client * * @return a subject for the intermediate server with the keytab credentials - * @throws PrivilegedActionException in case of failure + * @throws PrivilegedActionException + * in case of failure */ private static Subject doInitialLogin() throws PrivilegedActionException { serviceSubject = new Subject(); @@ -131,7 +131,8 @@ private static Subject doInitialLogin() throws PrivilegedActionException { * Generate the impersonated user credentials thanks to the S4U2self mechanism * * @return the client impersonated GSSCredential - * @throws PrivilegedActionException in case of failure + * @throws PrivilegedActionException + * in case of failure */ private static GSSCredential impersonate() throws PrivilegedActionException { return Subject.doAs(serviceSubject, (PrivilegedExceptionAction) () -> { @@ -147,12 +148,14 @@ private static GSSCredential impersonate() throws PrivilegedActionException { /** * Obtains a connection using an impersonated credential * - * @param impersonatedUserCredential impersonated user credentials + * @param impersonatedUserCredential + * impersonated user credentials * @return a connection to the SQL Server opened using the given impersonated credential - * @throws PrivilegedActionException in case of failure + * @throws PrivilegedActionException + * in case of failure */ - private static Connection createConnection(final GSSCredential impersonatedUserCredential) - throws PrivilegedActionException { + private static Connection createConnection( + final GSSCredential impersonatedUserCredential) throws PrivilegedActionException { return Subject.doAs(new Subject(), (PrivilegedExceptionAction) () -> { driverProperties.put("gsscredential", impersonatedUserCredential); diff --git a/src/samples/datatypes/src/main/java/basicDT.java b/src/samples/datatypes/src/main/java/basicDT.java index a0cf01cc8..8641e7029 100644 --- a/src/samples/datatypes/src/main/java/basicDT.java +++ b/src/samples/datatypes/src/main/java/basicDT.java @@ -1,9 +1,6 @@ /* - * Microsoft JDBC Driver for SQL Server - * - * Copyright(c) Microsoft Corporation All rights reserved. - * - * This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information. + * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made + * available under the terms of the MIT License. See the LICENSE file in the project root for more information. */ package datatypes.src.main.java; @@ -23,6 +20,7 @@ import microsoft.sql.DateTimeOffset; + public class basicDT { // Declare the JDBC objects. private static Connection con = null; @@ -53,8 +51,8 @@ public static void main(String[] args) { password = br.readLine(); // Create a variable for the connection string. - String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + databaseName + ";username=" - + username + ";password=" + password + ";"; + String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + + databaseName + ";username=" + username + ";password=" + password + ";"; // Establish the connection. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); @@ -108,54 +106,48 @@ public static void main(String[] args) { if (rs != null) try { rs.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (stmt != null) try { stmt.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (con != null) try { con.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} } } - private static void displayRow(String title, - ResultSet rs) { + private static void displayRow(String title, ResultSet rs) { try { System.out.println(title); - System.out.println(rs.getInt(1) + " , " + // SQL integer type. - rs.getString(2) + " , " + // SQL char type. - rs.getString(3) + " , " + // SQL varchar type. - rs.getBoolean(4) + " , " + // SQL bit type. - rs.getDouble(5) + " , " + // SQL decimal type. - rs.getDouble(6) + " , " + // SQL money type. - rs.getTimestamp(7) + " , " + // SQL datetime type. - rs.getDate(8) + " , " + // SQL date type. - rs.getTime(9) + " , " + // SQL time type. - rs.getTimestamp(10) + " , " + // SQL datetime2 type. + System.out.println(rs.getInt(1) + " , " + // SQL integer type. + rs.getString(2) + " , " + // SQL char type. + rs.getString(3) + " , " + // SQL varchar type. + rs.getBoolean(4) + " , " + // SQL bit type. + rs.getDouble(5) + " , " + // SQL decimal type. + rs.getDouble(6) + " , " + // SQL money type. + rs.getTimestamp(7) + " , " + // SQL datetime type. + rs.getDate(8) + " , " + // SQL date type. + rs.getTime(9) + " , " + // SQL time type. + rs.getTimestamp(10) + " , " + // SQL datetime2 type. ((SQLServerResultSet) rs).getDateTimeOffset(11)); // SQL datetimeoffset type. System.out.println(); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } private static void dropAndCreateTable() throws SQLException { - con.createStatement().executeUpdate("if object_id('" + tableName + "','U') is not null" + " drop table " + tableName); + con.createStatement() + .executeUpdate("if object_id('" + tableName + "','U') is not null" + " drop table " + tableName); - String sql = "create table " + tableName + " (" + "c1 int, " + "c2 char(20), " + "c3 varchar(20), " + "c4 bit, " + "c5 decimal(10,5), " - + "c6 money, " + "c7 datetime, " + "c8 date, " + "c9 time(7), " + "c10 datetime2(7), " + "c11 datetimeoffset(7), " + ");"; + String sql = "create table " + tableName + " (" + "c1 int, " + "c2 char(20), " + "c3 varchar(20), " + "c4 bit, " + + "c5 decimal(10,5), " + "c6 money, " + "c7 datetime, " + "c8 date, " + "c9 time(7), " + + "c10 datetime2(7), " + "c11 datetimeoffset(7), " + ");"; con.createStatement().execute(sql); } diff --git a/src/samples/datatypes/src/main/java/sqlxmlExample.java b/src/samples/datatypes/src/main/java/sqlxmlExample.java index 0dc314f48..c62518978 100644 --- a/src/samples/datatypes/src/main/java/sqlxmlExample.java +++ b/src/samples/datatypes/src/main/java/sqlxmlExample.java @@ -1,9 +1,6 @@ /* - * Microsoft JDBC Driver for SQL Server - * - * Copyright(c) Microsoft Corporation All rights reserved. - * - * This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information. + * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made + * available under the terms of the MIT License. See the LICENSE file in the project root for more information. */ package datatypes.src.main.java; @@ -28,6 +25,7 @@ import org.xml.sax.SAXException; import org.xml.sax.XMLReader; + public class sqlxmlExample { public static void main(String[] args) { @@ -57,8 +55,8 @@ public static void main(String[] args) { password = br.readLine(); // Create a variable for the connection string. - String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + databaseName + ";username=" - + username + ";password=" + password + ";"; + String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + + databaseName + ";username=" + username + ";password=" + password + ";"; // Establish the connection. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); @@ -83,26 +81,19 @@ public static void main(String[] args) { // Handle any errors that may have occurred. catch (Exception e) { e.printStackTrace(); - } - finally { + } finally { if (rs != null) try { rs.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (stmt != null) try { stmt.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (con != null) try { con.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} } } @@ -130,8 +121,7 @@ private static void showGetters(Connection con) { System.out.println("showGetters method: Parse an XML data in TestTable1 => "); xmlReader.parse(sxSource.getInputSource()); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -174,8 +164,7 @@ private static void showSetters(Connection con) { SQLXML xml = rs.getSQLXML("Col3"); System.out.println("XML column : " + xml.getString()); } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -209,7 +198,8 @@ private static void showTransformer(Connection con) { identity.transform(sxSource, sxResult); // Insert the destination SQLXML object into the database. - PreparedStatement psmt = con.prepareStatement("INSERT INTO TestTable2" + " (Col2, Col3, Col4, Col5) VALUES (?, ?, ?, ?)"); + PreparedStatement psmt = con + .prepareStatement("INSERT INTO TestTable2" + " (Col2, Col3, Col4, Col5) VALUES (?, ?, ?, ?)"); psmt.setString(1, "A"); psmt.setString(2, "Test data"); psmt.setInt(3, 123); @@ -229,8 +219,7 @@ private static void showTransformer(Connection con) { SQLXML xml = rs.getSQLXML("Col5"); System.out.println("XML column : " + xml.getString()); } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -241,13 +230,16 @@ private static void createSampleTables(Connection con) { Statement stmt = con.createStatement(); // Drop the tables. - stmt.executeUpdate("if exists (select * from sys.objects where name = 'TestTable1')" + "drop table TestTable1"); + stmt.executeUpdate( + "if exists (select * from sys.objects where name = 'TestTable1')" + "drop table TestTable1"); - stmt.executeUpdate("if exists (select * from sys.objects where name = 'TestTable2')" + "drop table TestTable2"); + stmt.executeUpdate( + "if exists (select * from sys.objects where name = 'TestTable2')" + "drop table TestTable2"); // Create empty tables. stmt.execute("CREATE TABLE TestTable1 (Col1 int IDENTITY, Col2 char, Col3 xml)"); - stmt.execute("CREATE TABLE TestTable2 (Col1 int IDENTITY, Col2 char, Col3 varchar(50), Col4 int, Col5 xml)"); + stmt.execute( + "CREATE TABLE TestTable2 (Col1 int IDENTITY, Col2 char, Col3 varchar(50), Col4 int, Col5 xml)"); // Insert two rows to the TestTable1. String row1 = "Contact Name 1XXX-XXX-XXXX"; @@ -256,31 +248,24 @@ private static void createSampleTables(Connection con) { stmt.executeUpdate("insert into TestTable1" + " (Col2, Col3) values('A', '" + row1 + "')"); stmt.executeUpdate("insert into TestTable1" + " (Col2, Col3) values('B', '" + row2 + "')"); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } } + class ExampleContentHandler implements ContentHandler { - public void startElement(String namespaceURI, - String localName, - String qName, - Attributes atts) throws SAXException { + public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { System.out.println("startElement method: localName => " + localName); } - public void characters(char[] text, - int start, - int length) throws SAXException { + public void characters(char[] text, int start, int length) throws SAXException { System.out.println("characters method"); } - public void endElement(String namespaceURI, - String localName, - String qName) throws SAXException { + public void endElement(String namespaceURI, String localName, String qName) throws SAXException { System.out.println("endElement method: localName => " + localName); } @@ -296,8 +281,7 @@ public void endDocument() throws SAXException { System.out.println("endDocument method"); } - public void startPrefixMapping(String prefix, - String uri) throws SAXException { + public void startPrefixMapping(String prefix, String uri) throws SAXException { System.out.println("startPrefixMapping method: prefix => " + prefix); } @@ -309,14 +293,11 @@ public void skippedEntity(String name) throws SAXException { System.out.println("skippedEntity method: name => " + name); } - public void ignorableWhitespace(char[] text, - int start, - int length) throws SAXException { + public void ignorableWhitespace(char[] text, int start, int length) throws SAXException { System.out.println("ignorableWhiteSpace method"); } - public void processingInstruction(String target, - String data) throws SAXException { + public void processingInstruction(String target, String data) throws SAXException { System.out.println("processingInstruction method: target => " + target); } } diff --git a/src/samples/resultsets/src/main/java/cacheRS.java b/src/samples/resultsets/src/main/java/cacheRS.java index 8484fc348..916e0c802 100644 --- a/src/samples/resultsets/src/main/java/cacheRS.java +++ b/src/samples/resultsets/src/main/java/cacheRS.java @@ -1,9 +1,6 @@ /* - * Microsoft JDBC Driver for SQL Server - * - * Copyright(c) Microsoft Corporation All rights reserved. - * - * This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information. + * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made + * available under the terms of the MIT License. See the LICENSE file in the project root for more information. */ package resultsets.src.main.java; @@ -17,6 +14,7 @@ import com.microsoft.sqlserver.jdbc.SQLServerResultSet; + public class cacheRS { public static void main(String[] args) { @@ -46,8 +44,8 @@ public static void main(String[] args) { password = br.readLine(); // Create a variable for the connection string. - String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + databaseName + ";username=" - + username + ";password=" + password + ";"; + String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + + databaseName + ";username=" + username + ";password=" + password + ";"; // Establish the connection. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); @@ -58,7 +56,8 @@ public static void main(String[] args) { // Create and execute an SQL statement that returns a large // set of data and then display it. String SQL = "SELECT * FROM SalesOrderDetail_JDBC_Sample;"; - stmt = con.createStatement(SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY, +SQLServerResultSet.CONCUR_READ_ONLY); + stmt = con.createStatement(SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY, + +SQLServerResultSet.CONCUR_READ_ONLY); // Perform a fetch for every row in the result set. rs = stmt.executeQuery(SQL); @@ -95,26 +94,19 @@ public static void main(String[] args) { if (rs != null) try { rs.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (stmt != null) try { stmt.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (con != null) try { con.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} } } - private static void timerTest(int fetchSize, - ResultSet rs) { + private static void timerTest(int fetchSize, ResultSet rs) { try { // Declare the variables for tracking the row count and elapsed time. @@ -139,8 +131,7 @@ private static void timerTest(int fetchSize, System.out.println("TIME TO EXECUTE: " + runTime); System.out.println(); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -149,7 +140,8 @@ private static void createTable(Connection con) throws SQLException { Statement stmt = con.createStatement(); - stmt.execute("if exists (select * from sys.objects where name = 'SalesOrderDetail_JDBC_Sample')" + "drop table SalesOrderDetail_JDBC_Sample"); + stmt.execute("if exists (select * from sys.objects where name = 'SalesOrderDetail_JDBC_Sample')" + + "drop table SalesOrderDetail_JDBC_Sample"); String sql = "CREATE TABLE [SalesOrderDetail_JDBC_Sample](" + "[SalesOrderID] [int] NOT NULL," + "[SalesOrderDetailID] [int] IDENTITY(1,1) NOT NULL," + "[CarrierTrackingNumber] [nvarchar](25) NULL," @@ -165,4 +157,4 @@ private static void createTable(Connection con) throws SQLException { stmt.execute(sql); } } -} \ No newline at end of file +} diff --git a/src/samples/resultsets/src/main/java/retrieveRS.java b/src/samples/resultsets/src/main/java/retrieveRS.java index f8b6e7b3b..54e81203f 100644 --- a/src/samples/resultsets/src/main/java/retrieveRS.java +++ b/src/samples/resultsets/src/main/java/retrieveRS.java @@ -1,9 +1,6 @@ /* - * Microsoft JDBC Driver for SQL Server - * - * Copyright(c) Microsoft Corporation All rights reserved. - * - * This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information. + * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made + * available under the terms of the MIT License. See the LICENSE file in the project root for more information. */ package resultsets.src.main.java; @@ -15,6 +12,7 @@ import java.sql.SQLException; import java.sql.Statement; + public class retrieveRS { public static void main(String[] args) { @@ -44,8 +42,8 @@ public static void main(String[] args) { password = br.readLine(); // Create a variable for the connection string. - String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + databaseName + ";username=" - + username + ";password=" + password + ";"; + String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + + databaseName + ";username=" + username + ";password=" + password + ";"; // Establish the connection. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); @@ -70,37 +68,35 @@ public static void main(String[] args) { if (rs != null) try { rs.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (stmt != null) try { stmt.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (con != null) try { con.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} } } private static void createTable(Connection con) throws SQLException { Statement stmt = con.createStatement(); - stmt.execute("if exists (select * from sys.objects where name = 'Product_JDBC_Sample')" + "drop table Product_JDBC_Sample"); + stmt.execute("if exists (select * from sys.objects where name = 'Product_JDBC_Sample')" + + "drop table Product_JDBC_Sample"); - String sql = "CREATE TABLE [Product_JDBC_Sample](" + "[ProductID] [int] IDENTITY(1,1) NOT NULL," + "[Name] [varchar](30) NOT NULL," - + "[ProductNumber] [nvarchar](25) NOT NULL," + "[MakeFlag] [bit] NOT NULL," + "[FinishedGoodsFlag] [bit] NOT NULL," - + "[Color] [nvarchar](15) NULL," + "[SafetyStockLevel] [smallint] NOT NULL," + "[ReorderPoint] [smallint] NOT NULL," + String sql = "CREATE TABLE [Product_JDBC_Sample](" + "[ProductID] [int] IDENTITY(1,1) NOT NULL," + + "[Name] [varchar](30) NOT NULL," + "[ProductNumber] [nvarchar](25) NOT NULL," + + "[MakeFlag] [bit] NOT NULL," + "[FinishedGoodsFlag] [bit] NOT NULL," + "[Color] [nvarchar](15) NULL," + + "[SafetyStockLevel] [smallint] NOT NULL," + "[ReorderPoint] [smallint] NOT NULL," + "[StandardCost] [money] NOT NULL," + "[ListPrice] [money] NOT NULL," + "[Size] [nvarchar](5) NULL," - + "[SizeUnitMeasureCode] [nchar](3) NULL," + "[WeightUnitMeasureCode] [nchar](3) NULL," + "[Weight] [decimal](8, 2) NULL," - + "[DaysToManufacture] [int] NOT NULL," + "[ProductLine] [nchar](2) NULL," + "[Class] [nchar](2) NULL," + "[Style] [nchar](2) NULL," - + "[ProductSubcategoryID] [int] NULL," + "[ProductModelID] [int] NULL," + "[SellStartDate] [datetime] NOT NULL," - + "[SellEndDate] [datetime] NULL," + "[DiscontinuedDate] [datetime] NULL," + "[rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL," + + "[SizeUnitMeasureCode] [nchar](3) NULL," + "[WeightUnitMeasureCode] [nchar](3) NULL," + + "[Weight] [decimal](8, 2) NULL," + "[DaysToManufacture] [int] NOT NULL," + + "[ProductLine] [nchar](2) NULL," + "[Class] [nchar](2) NULL," + "[Style] [nchar](2) NULL," + + "[ProductSubcategoryID] [int] NULL," + "[ProductModelID] [int] NULL," + + "[SellStartDate] [datetime] NOT NULL," + "[SellEndDate] [datetime] NULL," + + "[DiscontinuedDate] [datetime] NULL," + "[rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL," + "[ModifiedDate] [datetime] NOT NULL,)"; stmt.execute(sql); @@ -115,16 +111,14 @@ private static void createTable(Connection con) throws SQLException { stmt.execute(sql); } - private static void displayRow(String title, - ResultSet rs) { + private static void displayRow(String title, ResultSet rs) { try { System.out.println(title); while (rs.next()) { System.out.println(rs.getString("ProductNumber") + " : " + rs.getString("Name")); } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } -} \ No newline at end of file +} diff --git a/src/samples/resultsets/src/main/java/updateRS.java b/src/samples/resultsets/src/main/java/updateRS.java index 9b2fd1630..b97c02968 100644 --- a/src/samples/resultsets/src/main/java/updateRS.java +++ b/src/samples/resultsets/src/main/java/updateRS.java @@ -1,9 +1,6 @@ /* - * Microsoft JDBC Driver for SQL Server - * - * Copyright(c) Microsoft Corporation All rights reserved. - * - * This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information. + * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made + * available under the terms of the MIT License. See the LICENSE file in the project root for more information. */ package resultsets.src.main.java; @@ -15,6 +12,7 @@ import java.sql.SQLException; import java.sql.Statement; + public class updateRS { public static void main(String[] args) { @@ -44,8 +42,8 @@ public static void main(String[] args) { password = br.readLine(); // Create a variable for the connection string. - String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + databaseName + ";username=" - + username + ";password=" + password + ";"; + String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + + databaseName + ";username=" + username + ";password=" + password + ";"; // Establish the connection. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); @@ -98,46 +96,40 @@ public static void main(String[] args) { if (rs != null) try { rs.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (stmt != null) try { stmt.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} if (con != null) try { con.close(); - } - catch (Exception e) { - } + } catch (Exception e) {} } } private static void createTable(Connection con) throws SQLException { Statement stmt = con.createStatement(); - stmt.execute("if exists (select * from sys.objects where name = 'Department_JDBC_Sample')" + "drop table Department_JDBC_Sample"); + stmt.execute("if exists (select * from sys.objects where name = 'Department_JDBC_Sample')" + + "drop table Department_JDBC_Sample"); - String sql = "CREATE TABLE [Department_JDBC_Sample](" + "[DepartmentID] [smallint] IDENTITY(1,1) NOT NULL," + "[Name] [varchar](50) NOT NULL," - + "[GroupName] [varchar](50) NOT NULL," + "[ModifiedDate] [datetime] NOT NULL,)"; + String sql = "CREATE TABLE [Department_JDBC_Sample](" + "[DepartmentID] [smallint] IDENTITY(1,1) NOT NULL," + + "[Name] [varchar](50) NOT NULL," + "[GroupName] [varchar](50) NOT NULL," + + "[ModifiedDate] [datetime] NOT NULL,)"; stmt.execute(sql); } - private static void displayRow(String title, - ResultSet rs) { + private static void displayRow(String title, ResultSet rs) { try { System.out.println(title); while (rs.next()) { System.out.println(rs.getString("Name") + " : " + rs.getString("GroupName")); System.out.println(); } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } -} \ No newline at end of file +} diff --git a/src/samples/sparse/src/main/java/SparseColumns.java b/src/samples/sparse/src/main/java/SparseColumns.java index 8e03a5ea0..0568e68b2 100644 --- a/src/samples/sparse/src/main/java/SparseColumns.java +++ b/src/samples/sparse/src/main/java/SparseColumns.java @@ -1,9 +1,6 @@ /* - * Microsoft JDBC Driver for SQL Server - * - * Copyright(c) Microsoft Corporation All rights reserved. - * - * This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information. + * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made + * available under the terms of the MIT License. See the LICENSE file in the project root for more information. */ package sparse.src.main.java; @@ -25,6 +22,7 @@ import org.w3c.dom.NodeList; import org.xml.sax.InputSource; + public class SparseColumns { public static void main(String args[]) { @@ -54,8 +52,8 @@ public static void main(String args[]) { password = br.readLine(); // Create a variable for the connection string. - String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + databaseName + ";username=" - + username + ";password=" + password + ";"; + String connectionUrl = "jdbc:sqlserver://" + serverName + ":" + portNumber + ";" + "databaseName=" + + databaseName + ";username=" + username + ";password=" + password + ";"; // Establish the connection. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); @@ -113,46 +111,41 @@ public static void main(String args[]) { for (int n = 0; n < sparseColumnList.getLength(); ++n) { Node sparseColumnNode = sparseColumnList.item(n); String columnName = sparseColumnNode.getNodeName(); - // Note that the column value is not in the sparseColumNode, it is the value of the first child of it + // Note that the column value is not in the sparseColumNode, it is the value of the + // first child of it Node sparseColumnValueNode = sparseColumnNode.getFirstChild(); String columnValue = sparseColumnValueNode.getNodeValue(); System.out.println("\t" + columnName + "\t: " + columnValue); } } - } - else { // Just print the name + value of non-sparse columns + } else { // Just print the name + value of non-sparse columns System.out.println(name + "\t: " + value); } } System.out.println();// New line between rows } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); - } - finally { + } finally { if (rs != null) { try { rs.close(); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } if (stmt != null) { try { stmt.close(); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } if (con != null) { try { con.close(); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/bulkCopy/BulkCopyAllTypes.java b/src/test/java/com/microsoft/sqlserver/jdbc/bulkCopy/BulkCopyAllTypes.java index 9a566c8eb..93d12eadd 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/bulkCopy/BulkCopyAllTypes.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/bulkCopy/BulkCopyAllTypes.java @@ -88,4 +88,4 @@ private void terminateVariation() throws SQLException { Utils.dropTableIfExists(tableDest.getEscapedTableName(), stmt); } } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/bulkCopy/BulkCopyResultSetCursorTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/bulkCopy/BulkCopyResultSetCursorTest.java index 0a41245e6..ad6a497e3 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/bulkCopy/BulkCopyResultSetCursorTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/bulkCopy/BulkCopyResultSetCursorTest.java @@ -214,4 +214,4 @@ private static void createTables(Statement stmt) throws SQLException { + " (c1 decimal(10,5) null, c2 nchar(50) null, c3 datetime2(7) null, c4 char(7000));"; stmt.execute(sql); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/datatypes/DateAndTimeTypeTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/datatypes/DateAndTimeTypeTest.java index 13439c34a..86e0b78f8 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/datatypes/DateAndTimeTypeTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/datatypes/DateAndTimeTypeTest.java @@ -202,4 +202,4 @@ public static void terminateVariation() throws SQLException { rs.close(); } } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/resultset/DataClassificationTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/resultset/DataClassificationTest.java index 57cb40307..a59187826 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/resultset/DataClassificationTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/resultset/DataClassificationTest.java @@ -55,7 +55,8 @@ private void createTable(Connection connection, Statement stmt) throws SQLExcept String createQuery = "CREATE TABLE " + tableName + " (" + "[Id] [int] IDENTITY(1,1) NOT NULL," + "[CompanyName] [nvarchar](40) NOT NULL," + "[ContactName] [nvarchar](50) NULL," + "[ContactTitle] [nvarchar](40) NULL," + "[City] [nvarchar](40) NULL," - + "[CountryName] [nvarchar](40) NULL," + "[Phone] [nvarchar](30) MASKED WITH (FUNCTION = 'default()') NULL," + + "[CountryName] [nvarchar](40) NULL," + + "[Phone] [nvarchar](30) MASKED WITH (FUNCTION = 'default()') NULL," + "[Fax] [nvarchar](30) MASKED WITH (FUNCTION = 'default()') NULL)"; stmt.execute(createQuery); diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/tvp/TVPAllTypes.java b/src/test/java/com/microsoft/sqlserver/jdbc/tvp/TVPAllTypes.java index 0f65ef34d..210d73e87 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/tvp/TVPAllTypes.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/tvp/TVPAllTypes.java @@ -207,4 +207,4 @@ private void terminateVariation() throws SQLException { Utils.dropTableIfExists(tableDest.getEscapedTableName(), stmt); dropTVPS(tvpName); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/tvp/TVPNumericTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/tvp/TVPNumericTest.java index f52037a0b..98a989cc9 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/tvp/TVPNumericTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/tvp/TVPNumericTest.java @@ -122,4 +122,4 @@ public void terminateVariation() throws SQLException { } } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/RegressionTestAlwaysEncrypted.java b/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/RegressionTestAlwaysEncrypted.java index aef4f8b96..005a40e01 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/RegressionTestAlwaysEncrypted.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/RegressionTestAlwaysEncrypted.java @@ -106,4 +106,4 @@ * "','U') is not null" + " drop table " + dateTable); stmt.executeUpdate("if object_id('" + charTable + * "','U') is not null" + " drop table " + charTable); stmt.executeUpdate("if object_id('" + numericTable + * "','U') is not null" + " drop table " + numericTable); } } - */ \ No newline at end of file + */ diff --git a/src/test/java/com/microsoft/sqlserver/testframework/DBCallableStatement.java b/src/test/java/com/microsoft/sqlserver/testframework/DBCallableStatement.java index 0fc5bd9be..adff2fa7f 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/DBCallableStatement.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/DBCallableStatement.java @@ -64,4 +64,4 @@ public void registerOutParameter(int index, int sqltype) throws SQLException { } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/DBCoercion.java b/src/test/java/com/microsoft/sqlserver/testframework/DBCoercion.java index 820f2b8f4..c0c673478 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/DBCoercion.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/DBCoercion.java @@ -60,4 +60,4 @@ public Class type() { public BitSet flags() { return flags; } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/DBCoercions.java b/src/test/java/com/microsoft/sqlserver/testframework/DBCoercions.java index 6c24ec3b4..2005b590c 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/DBCoercions.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/DBCoercions.java @@ -24,4 +24,4 @@ public DBCoercions(DBCoercion coercion) { this.add(coercion); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/DBColumn.java b/src/test/java/com/microsoft/sqlserver/testframework/DBColumn.java index d8796f3d6..067d0b01a 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/DBColumn.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/DBColumn.java @@ -90,4 +90,4 @@ Object getRowValue(int row) { return columnValues.get(row); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/DBConnection.java b/src/test/java/com/microsoft/sqlserver/testframework/DBConnection.java index abb2a6570..03e70faa7 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/DBConnection.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/DBConnection.java @@ -231,4 +231,4 @@ public double getServerVersion() throws Exception { return serverversion; } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/DBInvalidUtil.java b/src/test/java/com/microsoft/sqlserver/testframework/DBInvalidUtil.java index 58c58a534..948519026 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/DBInvalidUtil.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/DBInvalidUtil.java @@ -383,4 +383,4 @@ public int read(byte[] bytes, int off, int len) { } } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/DBItems.java b/src/test/java/com/microsoft/sqlserver/testframework/DBItems.java index bffe69374..0eb5ec6a7 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/DBItems.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/DBItems.java @@ -35,4 +35,4 @@ public DBCoercion find(Class type) { public boolean add(DBCoercion item) { return coercionsList.add(item); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/DBPreparedStatement.java b/src/test/java/com/microsoft/sqlserver/testframework/DBPreparedStatement.java index f5b67ae58..796c2a114 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/DBPreparedStatement.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/DBPreparedStatement.java @@ -102,4 +102,4 @@ public boolean populateTable(DBTable table) { public boolean execute() throws SQLException { return pstmt.execute(); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/DBStatement.java b/src/test/java/com/microsoft/sqlserver/testframework/DBStatement.java index 87811de3f..0752d2de9 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/DBStatement.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/DBStatement.java @@ -180,4 +180,4 @@ public DBResultSet getResultSet() throws SQLException { ResultSet rs = ((Statement) product()).getResultSet(); return dbresultSet = new DBResultSet(this, rs); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/DBTable.java b/src/test/java/com/microsoft/sqlserver/testframework/DBTable.java index 976639b85..a61b86096 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/DBTable.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/DBTable.java @@ -462,4 +462,4 @@ private String byteArrayToHex(byte[] a) { sb.append(String.format("%02x", b)); return sb.toString(); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlBigInt.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlBigInt.java index e1ebe5810..6219cb84b 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlBigInt.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlBigInt.java @@ -22,4 +22,4 @@ public Object createdata() { // TODO: include max value return ThreadLocalRandom.current().nextLong(Long.MIN_VALUE, Long.MAX_VALUE); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlBinary.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlBinary.java index 3b5294e5f..12fef8180 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlBinary.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlBinary.java @@ -44,4 +44,4 @@ public Object createdata() { ThreadLocalRandom.current().nextBytes(bytes); return bytes; } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlBit.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlBit.java index 80f95b827..a77fd578a 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlBit.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlBit.java @@ -19,4 +19,4 @@ public SqlBit() { public Object createdata() { return ((0 == ThreadLocalRandom.current().nextInt(2)) ? minvalue : maxvalue); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlChar.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlChar.java index a5700fef3..3a0772c54 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlChar.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlChar.java @@ -75,4 +75,4 @@ private static char pickRandomChar(String charSet) { int randomIndex = ThreadLocalRandom.current().nextInt(charSetLength); return charSet.charAt(randomIndex); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDate.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDate.java index c8ae58878..467672b04 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDate.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDate.java @@ -32,4 +32,4 @@ public SqlDate() { public Object createdata() { return new Date(ThreadLocalRandom.current().nextLong(((Date) minvalue).getTime(), ((Date) maxvalue).getTime())); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDateTime.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDateTime.java index 7c45810a9..613feba9e 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDateTime.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDateTime.java @@ -57,4 +57,4 @@ protected int generateRandomInt(int length) { return randomNumeric; } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDateTime2.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDateTime2.java index c75c235b3..d743047e1 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDateTime2.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDateTime2.java @@ -51,4 +51,4 @@ public Object createdata() { // it unchanged for now to handle prepared statements // return LocalDateTime.parse(timeNano, formatter); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDateTimeOffset.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDateTimeOffset.java index 3eb4db25c..560f1e061 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDateTimeOffset.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDateTimeOffset.java @@ -147,4 +147,4 @@ private static char pickRandomChar(String charSet) { int randomIndex = ThreadLocalRandom.current().nextInt(charSetLength); return charSet.charAt(randomIndex); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDecimal.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDecimal.java index 7189f3b00..ab240b6b4 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDecimal.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlDecimal.java @@ -92,4 +92,4 @@ public Object createdata() { return randomValue; } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlFloat.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlFloat.java index baadc40a1..f1881406f 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlFloat.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlFloat.java @@ -35,4 +35,4 @@ public Object createdata() { (Float) SqlTypeValue.REAL.maxValue); } } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlInt.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlInt.java index 8639713d1..20b1fb713 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlInt.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlInt.java @@ -21,4 +21,4 @@ public Object createdata() { // TODO: include max value return ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlMoney.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlMoney.java index 6e80f179f..71ebf40ff 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlMoney.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlMoney.java @@ -10,4 +10,4 @@ public class SqlMoney extends SqlDecimal { public SqlMoney() { super("money", 19, 4, SqlTypeValue.MONEY.minValue, SqlTypeValue.MONEY.maxValue, VariableLengthType.Fixed); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNChar.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNChar.java index 64f169811..c7fc8fbdf 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNChar.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNChar.java @@ -29,4 +29,4 @@ private static String generateCharTypes(int columnLength) { String charSet = normalCharSet; return buildCharOrNChar(columnLength, charSet); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNVarChar.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNVarChar.java index 68d60afc4..e0e174ee4 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNVarChar.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNVarChar.java @@ -13,4 +13,4 @@ public class SqlNVarChar extends SqlNChar { public SqlNVarChar() { super("nvarchar", JDBCType.NVARCHAR, 2000); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNVarCharMax.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNVarCharMax.java index 2d996906f..f1eda908a 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNVarCharMax.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNVarCharMax.java @@ -26,4 +26,4 @@ public SqlNVarCharMax() { } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNumber.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNumber.java index c0c6ea533..efa9dc04f 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNumber.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNumber.java @@ -13,4 +13,4 @@ public abstract class SqlNumber extends SqlType { VariableLengthType variableLengthType, Class type) { super(name, jdbctype, precision, scale, min, max, nullvalue, VariableLengthType.Fixed, type); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNumeric.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNumeric.java index 5d7f78f40..7b843915d 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNumeric.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlNumeric.java @@ -13,4 +13,4 @@ public class SqlNumeric extends SqlDecimal { public SqlNumeric() { super("numeric", JDBCType.NUMERIC); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlReal.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlReal.java index b3fcceea7..4ae52a3e0 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlReal.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlReal.java @@ -20,4 +20,4 @@ public SqlReal() { public Object createdata() { return (float) ThreadLocalRandom.current().nextDouble((Float) minvalue, (Float) maxvalue); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlSmallDateTime.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlSmallDateTime.java index fc9920a1c..708514fba 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlSmallDateTime.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlSmallDateTime.java @@ -35,4 +35,4 @@ public Object createdata() { return smallDateTime.toString().substring(0, 19);// ignore the nano second portion // return smallDateTime; } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlSmallInt.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlSmallInt.java index 891b18bd2..af064093f 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlSmallInt.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlSmallInt.java @@ -21,4 +21,4 @@ public Object createdata() { // TODO: include max value return (short) ThreadLocalRandom.current().nextInt(Short.MIN_VALUE, Short.MAX_VALUE); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlSmallMoney.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlSmallMoney.java index a6689e35a..af93d2510 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlSmallMoney.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlSmallMoney.java @@ -11,4 +11,4 @@ public SqlSmallMoney() { super("smallmoney", 10, 4, SqlTypeValue.SMALLMONEY.minValue, SqlTypeValue.SMALLMONEY.maxValue, VariableLengthType.Fixed); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlTime.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlTime.java index e7e83c2f3..2ecaa1762 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlTime.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlTime.java @@ -56,4 +56,4 @@ public Object createdata() { */ // return LocalTime.parse(timeNano, formatter); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlTinyInt.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlTinyInt.java index 70a814f1b..ab9e41e7b 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlTinyInt.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlTinyInt.java @@ -20,4 +20,4 @@ public Object createdata() { // TODO: include max value return (short) ThreadLocalRandom.current().nextInt((short) minvalue, ((short) maxvalue)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlType.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlType.java index b0b93250f..e8acf7c0b 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlType.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlType.java @@ -260,4 +260,4 @@ public boolean canConvert(Class target, int flag, DBConnection conn) throws Exce return false; } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarBinary.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarBinary.java index fe3ecc1e2..964c2bc20 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarBinary.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarBinary.java @@ -40,4 +40,4 @@ public SqlVarBinary() { DBCoercion.GETPARAM, DBCoercion.REG, DBCoercion.STREAM})); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarBinaryMax.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarBinaryMax.java index de451d60d..ccc115211 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarBinaryMax.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarBinaryMax.java @@ -21,4 +21,4 @@ public SqlVarBinaryMax() { DBCoercion.SET, DBCoercion.SETOBJECT, DBCoercion.GETPARAM, DBCoercion.REG})); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarChar.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarChar.java index 39677d181..7d6bac54f 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarChar.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarChar.java @@ -13,4 +13,4 @@ public class SqlVarChar extends SqlChar { public SqlVarChar() { super("varchar", JDBCType.VARCHAR, 4000); } -} \ No newline at end of file +} diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarCharMax.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarCharMax.java index cb9425f72..b8578cc33 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarCharMax.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlVarCharMax.java @@ -21,4 +21,4 @@ public SqlVarCharMax() { DBCoercion.SET, DBCoercion.SETOBJECT, DBCoercion.GETPARAM, DBCoercion.REG, DBCoercion.CHAR})); } -} \ No newline at end of file +}