Skip to content

Commit

Permalink
Merge dev to master for 9.2.0 release (#1506)
Browse files Browse the repository at this point in the history
Merge dev to master for 9.2.0 release (#1506)
  • Loading branch information
peterbae authored Jan 29, 2021
1 parent 9e76aba commit 66ee808
Show file tree
Hide file tree
Showing 28 changed files with 240 additions and 154 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)

## [9.2.0] Stable Release
### Added
- Added logic to handle multi-factor authentication timeouts during ActiveDirectoryInteractive authentication [#1488](https://github.com/microsoft/mssql-jdbc/pull/1488)

### Fixed issues
- Fixed an issue with high memory allocation during bulk copy [#1475](https://github.com/microsoft/mssql-jdbc/pull/1475)

## [9.1.1] Preview Release
### Added
- Added maxResultBuffer connection property [1431](https://github.com/microsoft/mssql-jdbc/pull/1431)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ We're now on the Maven Central Repository. Add the following to your POM file to
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.4.1.jre14</version>
<version>9.2.0.jre15</version>
</dependency>
```
The driver can be downloaded from the [Microsoft Download Center](https://go.microsoft.com/fwlink/?linkid=868287).
Expand Down Expand Up @@ -127,7 +127,7 @@ Projects that require either of the two features need to explicitly declare the
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>9.1.1.jre15-preview</version>
<version>9.2.0.jre15-preview</version>
<scope>compile</scope>
</dependency>

Expand All @@ -145,7 +145,7 @@ Projects that require either of the two features need to explicitly declare the
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>9.1.1.jre15-preview</version>
<version>9.2.0.jre15-preview</version>
<scope>compile</scope>
</dependency>

Expand All @@ -172,7 +172,7 @@ When setting 'useFmtOnly' property to 'true' for establishing a connection or cr
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>9.1.1.jre15-preview</version>
<version>9.2.0.jre15-preview</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -212,7 +212,7 @@ Preview releases happen approximately monthly between stable releases. This give
You can see what is going into a future release by monitoring [Milestones](https://github.com/Microsoft/mssql-jdbc/milestones) in the repository.

### Version conventions
Starting with 6.0, stable versions have an even minor version. For example, 6.0, 6.2, 6.4, 7.0, 7.2, 7.4, 8.2, 8.4. Preview versions have an odd minor version. For example, 6.1, 6.3, 6.5, 7.1, 7.3, 8.1 and so on
Starting with 6.0, stable versions have an even minor version. For example, 6.0, 6.2, 6.4, 7.0, 7.2, 7.4, 8.2, 8.4, 9.2. Preview versions have an odd minor version. For example, 6.1, 6.3, 6.5, 7.1, 7.3, 8.1 and so on

## Contributors
Special thanks to everyone who has contributed to the project.
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
name: authDLL
displayName: 'Download mssql-jdbc_auth DLL'
inputs:
secureFile: 'mssql-jdbc_auth-9.1.1.x64-preview.dll'
secureFile: 'mssql-jdbc_auth-9.2.0.x64.dll'
- task: Maven@3
displayName: 'Maven build jre15'
inputs:
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

apply plugin: 'java'

version = '9.1.1'
version = '9.2.0'
def jreVersion = ""
def testOutputDir = file("build/classes/java/test")
def archivesBaseName = 'mssql-jdbc'
Expand Down Expand Up @@ -75,7 +75,7 @@ if(hasProperty('buildProfile') && buildProfile == "jre8") {
}
}

jar.archiveFileName = "${archivesBaseName}-${version}.${jreVersion}-preview.jar"
jar.archiveFileName = "${archivesBaseName}-${version}.${jreVersion}.jar"
jar {
manifest {
attributes 'Title': "Microsoft JDBC Driver ${version} for SQL Server",
Expand Down
2 changes: 1 addition & 1 deletion mssql-jdbc_auth_LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MICROSOFT SOFTWARE LICENSE TERMS
MICROSOFT JDBC DRIVER 9.1 FOR SQL SERVER
MICROSOFT JDBC DRIVER 9.2 FOR SQL SERVER

These license terms are an agreement between you and Microsoft Corporation (or one of its affiliates). They apply to the software named above and any Microsoft services or software updates (except to the extent such services or updates are accompanied by new or additional terms, in which case those different terms apply prospectively and do not alter your or Microsoft’s rights relating to pre-updated software or services). IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE RIGHTS BELOW. BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS.

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>9.1.1</version>
<version>9.2.0</version>
<packaging>jar</packaging>

<name>Microsoft JDBC Driver for SQL Server</name>
Expand Down Expand Up @@ -57,7 +57,7 @@
<excludedGroups>xSQLv12,xSQLv15,NTLM,MSI,reqExternalSetup,clientCertAuth,fedAuth</excludedGroups>

<!-- Use -preview for preview release, leave empty for official release.-->
<releaseExt>-preview</releaseExt>
<releaseExt></releaseExt>

<!-- Driver Dependencies -->
<azure.keyvault.version>4.2.1</azure.keyvault.version>
Expand Down
21 changes: 11 additions & 10 deletions src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3151,6 +3151,11 @@ boolean isEOMSent() {
private ByteBuffer socketBuffer;
private ByteBuffer logBuffer;

// Intermediate arrays
// It is assumed, startMessage is called before use, to alloc arrays
private char[] streamCharBuffer;
private byte[] streamByteBuffer;

private CryptoMetadata cryptoMeta = null;

TDSWriter(TDSChannel tdsChannel, SQLServerConnection con) {
Expand Down Expand Up @@ -3247,6 +3252,8 @@ void startMessage(TDSCommand command, byte tdsMessageType) throws SQLServerExcep
stagingBuffer = ByteBuffer.allocate(negotiatedPacketSize).order(ByteOrder.LITTLE_ENDIAN);
logBuffer = ByteBuffer.allocate(negotiatedPacketSize).order(ByteOrder.LITTLE_ENDIAN);
currentPacketSize = negotiatedPacketSize;
streamCharBuffer = new char[2 * currentPacketSize];
streamByteBuffer = new byte[4 * currentPacketSize];
}

((Buffer) socketBuffer).position(((Buffer) socketBuffer).limit());
Expand Down Expand Up @@ -4015,21 +4022,17 @@ void writeNonUnicodeReader(Reader reader, long advertisedLength, boolean isDestB
assert DataTypes.UNKNOWN_STREAM_LENGTH == advertisedLength || advertisedLength >= 0;

long actualLength = 0;
char[] streamCharBuffer = new char[currentPacketSize];
// The unicode version, writeReader() allocates a byte buffer that is 4 times the currentPacketSize, not sure
// why.
byte[] streamByteBuffer = new byte[currentPacketSize];
int charsRead = 0;
int charsToWrite;
int bytesToWrite;
String streamString;

do {
// Read in next chunk
for (charsToWrite = 0; -1 != charsRead && charsToWrite < streamCharBuffer.length;
for (charsToWrite = 0; -1 != charsRead && charsToWrite < currentPacketSize;
charsToWrite += charsRead) {
try {
charsRead = reader.read(streamCharBuffer, charsToWrite, streamCharBuffer.length - charsToWrite);
charsRead = reader.read(streamCharBuffer, charsToWrite, currentPacketSize - charsToWrite);
} catch (IOException e) {
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_errorReadingStream"));
Object[] msgArgs = {e.toString()};
Expand All @@ -4040,7 +4043,7 @@ void writeNonUnicodeReader(Reader reader, long advertisedLength, boolean isDestB
break;

// Check for invalid bytesRead returned from Reader.read
if (charsRead < 0 || charsRead > streamCharBuffer.length - charsToWrite) {
if (charsRead < 0 || charsRead > currentPacketSize - charsToWrite) {
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_errorReadingStream"));
Object[] msgArgs = {SQLServerException.getErrString("R_streamReadReturnedInvalidValue")};
error(form.format(msgArgs), SQLState.DATA_EXCEPTION_NOT_SPECIFIC, DriverError.NOT_SET);
Expand Down Expand Up @@ -4070,7 +4073,7 @@ void writeNonUnicodeReader(Reader reader, long advertisedLength, boolean isDestB
if (0 != charsToWrite)
bytesToWrite = charsToWrite / 2;

streamString = new String(streamCharBuffer);
streamString = new String(streamCharBuffer, 0, currentPacketSize);
byte[] bytes = ParameterUtils.HexToBin(streamString.trim());
writeInt(bytesToWrite);
writeBytes(bytes, 0, bytesToWrite);
Expand All @@ -4096,8 +4099,6 @@ void writeReader(Reader reader, long advertisedLength, boolean writeChunkSizes)
assert DataTypes.UNKNOWN_STREAM_LENGTH == advertisedLength || advertisedLength >= 0;

long actualLength = 0;
char[] streamCharBuffer = new char[2 * currentPacketSize];
byte[] streamByteBuffer = new byte[4 * currentPacketSize];
int charsRead = 0;
int charsToWrite;
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
*/
@Immutable
class KeyVaultTokenCredential implements TokenCredential {
private static final String NULL_VALUE = "R_NullValue";

private final String clientId;
private final String clientSecret;
private final SQLServerKeyVaultAuthenticationCallback authenticationCallback;
Expand All @@ -48,13 +50,13 @@ class KeyVaultTokenCredential implements TokenCredential {
*/
KeyVaultTokenCredential(String clientId, String clientSecret) throws SQLServerException {
if (null == clientId || clientId.isEmpty()) {
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_NullValue"));
MessageFormat form = new MessageFormat(SQLServerException.getErrString(NULL_VALUE));
Object[] msgArgs1 = {"Client ID"};
throw new SQLServerException(form.format(msgArgs1), null);
}

if (null == clientSecret || clientSecret.isEmpty()) {
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_NullValue"));
MessageFormat form = new MessageFormat(SQLServerException.getErrString(NULL_VALUE));
Object[] msgArgs1 = {"Client Secret"};
throw new SQLServerException(form.format(msgArgs1), null);
}
Expand Down Expand Up @@ -116,19 +118,19 @@ KeyVaultTokenCredential setAuthorization(String authorization) {
*/
private ConfidentialClientApplication getConfidentialClientApplication() {
if (null == clientId) {
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_NullValue"));
MessageFormat form = new MessageFormat(SQLServerException.getErrString(NULL_VALUE));
Object[] msgArgs1 = {"Client ID"};
throw new IllegalArgumentException(form.format(msgArgs1), null);
}

if (null == authorization) {
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_NullValue"));
MessageFormat form = new MessageFormat(SQLServerException.getErrString(NULL_VALUE));
Object[] msgArgs1 = {"Authorization"};
throw new IllegalArgumentException(form.format(msgArgs1), null);
}

if (null == clientSecret) {
MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_NullValue"));
MessageFormat form = new MessageFormat(SQLServerException.getErrString(NULL_VALUE));
Object[] msgArgs1 = {"Client Secret"};
throw new IllegalArgumentException(form.format(msgArgs1), null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

final class SQLJdbcVersion {
static final int major = 9;
static final int minor = 1;
static final int patch = 1;
static final int minor = 2;
static final int patch = 0;
static final int build = 0;
/*
* Used to load mssql-jdbc_auth DLL.
* 1. Set to "-preview" for preview release.
* 2. Set to "" (empty String) for official release.
*/
static final String releaseExt = "-preview";
static final String releaseExt = "";
}
Loading

0 comments on commit 66ee808

Please sign in to comment.