Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix javadoc warnings #2521

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

package com.microsoft.sqlserver.jdbc;

import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.text.MessageFormat;
Expand Down Expand Up @@ -96,7 +94,7 @@
Subject currentSubject;
KerbCallback callback = new KerbCallback(con);
try {
AccessControlContext context = AccessController.getContext();
java.security.AccessControlContext context = java.security.AccessController.getContext();

Check warning on line 97 in src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java#L97

Added line #L97 was not covered by tests
currentSubject = Subject.getSubject(context);
if (null == currentSubject) {
if (useDefaultJaas) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ public class PersistentTokenCacheAccessAspect implements ITokenCacheAccessAspect
static final long TIME_TO_LIVE = 86400000L; // Token cache time to live (24 hrs).
private long expiryTime;

/**
* default constructor
*/
public PersistentTokenCacheAccessAspect() {
// default constructor
}

static PersistentTokenCacheAccessAspect getInstance() {
if (instance == null) {
instance = new PersistentTokenCacheAccessAspect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
@FunctionalInterface
public interface ReconnectListener {

/**
* called before reconnect
*/
void beforeReconnect();

}
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,9 @@ public void setCalcBigDecimalPrecision(boolean calcBigDecimalPrecision) {
this.calcBigDecimalPrecision = calcBigDecimalPrecision;
}

/**
* Retry exec
*/
private String retryExec = SQLServerDriverStringProperty.RETRY_EXEC.getDefaultValue();

/**
Expand Down Expand Up @@ -1783,10 +1786,22 @@ SQLServerPooledConnection getPooledConnectionParent() {
*/
private List<ReconnectListener> reconnectListeners = new ArrayList<>();

/**
* Register before reconnect listener
*
* @param reconnectListener
* reconnect listener
*/
public void registerBeforeReconnectListener(ReconnectListener reconnectListener) {
reconnectListeners.add(reconnectListener);
}

/**
* Remove before reconnect listener
*
* @param reconnectListener
* reconnect listener
*/
public void removeBeforeReconnectListener(ReconnectListener reconnectListener) {
reconnectListeners.remove(reconnectListener);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ static String getErrString(String errCode) {
logException(obj, errText, bStack);
}

/**
* Constructs a new SQLServerException from SQL Server error
*
* @param sqlServerError
* SQL Server error
*/
public SQLServerException(SQLServerError sqlServerError) {
super(sqlServerError.getErrorMessage(),
generateStateCode(null, sqlServerError.getErrorNumber(), sqlServerError.getErrorState()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,20 @@
* For caching data related to batch insert with bulkcopy
*/
private SQLServerBulkCopy bcOperation = null;

/**
* Bulkcopy operation table name
*/
private String bcOperationTableName = null;

/**
* Bulkcopy operation column list
*/
private ArrayList<String> bcOperationColumnList = null;

/**
* Bulkcopy operation value list
*/
private ArrayList<String> bcOperationValueList = null;

/** Returns the prepared statement SQL */
Expand Down Expand Up @@ -450,13 +462,13 @@
return "";

// Output looks like @P0 timestamp, @P1 varchar
int stringLen = nCols * 2; // @P
stringLen += nCols; // spaces
stringLen += nCols -1; // commas
int stringLen = nCols * 2; // @P
stringLen += nCols; // spaces
stringLen += nCols - 1; // commas
if (nCols > 10)
stringLen += 10 + ((nCols - 10) * 2); // @P{0-99} Numbers after p
stringLen += 10 + ((nCols - 10) * 2); // @P{0-99} Numbers after p
else
stringLen += nCols; // @P{0-9} Numbers after p less than 10
stringLen += nCols; // @P{0-9} Numbers after p less than 10

// Computing the type definitions up front, so we can get exact string lengths needed for the string builder.
String[] typeDefinitions = new String[nCols];
Expand Down Expand Up @@ -2358,7 +2370,8 @@
if (rs.getColumnCount() != bcOperationValueList.size()) {
MessageFormat form = new MessageFormat(
SQLServerException.getErrString("R_colNotMatchTable"));
Object[] msgArgs = {bcOperationColumnList!= null ? bcOperationColumnList.size() : 0, bcOperationValueList.size()};
Object[] msgArgs = {bcOperationColumnList != null ? bcOperationColumnList.size() : 0,
bcOperationValueList.size()};

Check warning on line 2374 in src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java#L2374

Added line #L2374 was not covered by tests
throw new IllegalArgumentException(form.format(msgArgs));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
*
*/
public enum SQLServerSortOrder {
/** ascending order */
ASCENDING(0),
/** descending order */
DESCENDING(1),
/** unspecified order */
UNSPECIFIED(-1);

final int value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ public class SQLServerWarning extends SQLWarning {
/** SQL server error */
private SQLServerError sqlServerError;

/*
/**
* Create a SQLWarning from an SQLServerError object
*
* @param sqlServerError
* SQL Server error
*/
public SQLServerWarning(SQLServerError sqlServerError) {
super(sqlServerError.getErrorMessage(), SQLServerException.generateStateCode(null,
Expand Down