id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
58,200 | Jasig/uPortal | uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/SmartCache.java | SmartCache.put | public synchronized Object put(Object key, Object value, long lCacheInterval) {
ValueWrapper valueWrapper = new ValueWrapper(value, lCacheInterval);
return super.put(key, valueWrapper);
} | java | public synchronized Object put(Object key, Object value, long lCacheInterval) {
ValueWrapper valueWrapper = new ValueWrapper(value, lCacheInterval);
return super.put(key, valueWrapper);
} | [
"public",
"synchronized",
"Object",
"put",
"(",
"Object",
"key",
",",
"Object",
"value",
",",
"long",
"lCacheInterval",
")",
"{",
"ValueWrapper",
"valueWrapper",
"=",
"new",
"ValueWrapper",
"(",
"value",
",",
"lCacheInterval",
")",
";",
"return",
"super",
".",... | Add a new value to the cache
@param key the key, typically a String
@param value the value
@param lCacheInterval an expiration timeout value, in seconds, which will override the
default cache value just for this item. If a negative timeout value is specified, the
value will be cached indefinitely.
@return the cached o... | [
"Add",
"a",
"new",
"value",
"to",
"the",
"cache"
] | c1986542abb9acd214268f2df21c6305ad2f262b | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/SmartCache.java#L96-L99 |
58,201 | Jasig/uPortal | uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/SmartCache.java | SmartCache.get | @Override
public synchronized Object get(Object key) {
ValueWrapper valueWrapper = (ValueWrapper) super.get(key);
if (valueWrapper != null) {
// Check if value has expired
long creationTime = valueWrapper.getCreationTime();
long cacheInterval = valueWrapper.getCac... | java | @Override
public synchronized Object get(Object key) {
ValueWrapper valueWrapper = (ValueWrapper) super.get(key);
if (valueWrapper != null) {
// Check if value has expired
long creationTime = valueWrapper.getCreationTime();
long cacheInterval = valueWrapper.getCac... | [
"@",
"Override",
"public",
"synchronized",
"Object",
"get",
"(",
"Object",
"key",
")",
"{",
"ValueWrapper",
"valueWrapper",
"=",
"(",
"ValueWrapper",
")",
"super",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"valueWrapper",
"!=",
"null",
")",
"{",
"// C... | Get an object from the cache.
@param key the key, typically a String
@return the value to which the key is mapped in this cache; null if the key is not mapped to
any value in this cache. | [
"Get",
"an",
"object",
"from",
"the",
"cache",
"."
] | c1986542abb9acd214268f2df21c6305ad2f262b | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/SmartCache.java#L108-L122 |
58,202 | Jasig/uPortal | uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/SmartCache.java | SmartCache.sweepCache | protected void sweepCache() {
for (Iterator keyIterator = keySet().iterator(); keyIterator.hasNext(); ) {
Object key = keyIterator.next();
ValueWrapper valueWrapper = (ValueWrapper) super.get(key);
long creationTime = valueWrapper.getCreationTime();
long cacheInte... | java | protected void sweepCache() {
for (Iterator keyIterator = keySet().iterator(); keyIterator.hasNext(); ) {
Object key = keyIterator.next();
ValueWrapper valueWrapper = (ValueWrapper) super.get(key);
long creationTime = valueWrapper.getCreationTime();
long cacheInte... | [
"protected",
"void",
"sweepCache",
"(",
")",
"{",
"for",
"(",
"Iterator",
"keyIterator",
"=",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"keyIterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Object",
"key",
"=",
"keyIterator",
".",
"next",
... | Removes from the cache values which have expired. | [
"Removes",
"from",
"the",
"cache",
"values",
"which",
"have",
"expired",
"."
] | c1986542abb9acd214268f2df21c6305ad2f262b | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/SmartCache.java#L125-L136 |
58,203 | Jasig/uPortal | uPortal-security/uPortal-security-mvc/src/main/java/org/apereo/portal/security/filter/CorsFilter.java | CorsFilter.getInitParameter | private String getInitParameter(String name, String defaultValue) {
String value = getInitParameter(name);
if (value != null) {
return value;
}
return defaultValue;
} | java | private String getInitParameter(String name, String defaultValue) {
String value = getInitParameter(name);
if (value != null) {
return value;
}
return defaultValue;
} | [
"private",
"String",
"getInitParameter",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getInitParameter",
"(",
"name",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"value",
";",
"}",
"return",
... | This method returns the parameter's value if it exists, or defaultValue if not.
@param name The parameter's name
@param defaultValue The default value to return if the parameter does not exist
@return The parameter's value or the default value if the parameter does not exist | [
"This",
"method",
"returns",
"the",
"parameter",
"s",
"value",
"if",
"it",
"exists",
"or",
"defaultValue",
"if",
"not",
"."
] | c1986542abb9acd214268f2df21c6305ad2f262b | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-mvc/src/main/java/org/apereo/portal/security/filter/CorsFilter.java#L228-L236 |
58,204 | Jasig/uPortal | uPortal-security/uPortal-security-mvc/src/main/java/org/apereo/portal/security/filter/CorsFilter.java | CorsFilter.getMediaType | private String getMediaType(String contentType) {
if (contentType == null) {
return null;
}
String result = contentType.toLowerCase(Locale.ENGLISH);
int firstSemiColonIndex = result.indexOf(';');
if (firstSemiColonIndex > -1) {
result = result.substring(0,... | java | private String getMediaType(String contentType) {
if (contentType == null) {
return null;
}
String result = contentType.toLowerCase(Locale.ENGLISH);
int firstSemiColonIndex = result.indexOf(';');
if (firstSemiColonIndex > -1) {
result = result.substring(0,... | [
"private",
"String",
"getMediaType",
"(",
"String",
"contentType",
")",
"{",
"if",
"(",
"contentType",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"result",
"=",
"contentType",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
... | Return the lower case, trimmed value of the media type from the content type. | [
"Return",
"the",
"lower",
"case",
"trimmed",
"value",
"of",
"the",
"media",
"type",
"from",
"the",
"content",
"type",
"."
] | c1986542abb9acd214268f2df21c6305ad2f262b | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-mvc/src/main/java/org/apereo/portal/security/filter/CorsFilter.java#L671-L682 |
58,205 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/ResultJsonParserV2.java | ResultJsonParserV2.endParsing | public void endParsing() throws SnowflakeSQLException
{
if (partialEscapedUnicode.position() > 0)
{
partialEscapedUnicode.flip();
continueParsingInternal(partialEscapedUnicode, true);
partialEscapedUnicode.clear();
}
if (state != State.ROW_FINISHED)
{
throw new SnowflakeSQ... | java | public void endParsing() throws SnowflakeSQLException
{
if (partialEscapedUnicode.position() > 0)
{
partialEscapedUnicode.flip();
continueParsingInternal(partialEscapedUnicode, true);
partialEscapedUnicode.clear();
}
if (state != State.ROW_FINISHED)
{
throw new SnowflakeSQ... | [
"public",
"void",
"endParsing",
"(",
")",
"throws",
"SnowflakeSQLException",
"{",
"if",
"(",
"partialEscapedUnicode",
".",
"position",
"(",
")",
">",
"0",
")",
"{",
"partialEscapedUnicode",
".",
"flip",
"(",
")",
";",
"continueParsingInternal",
"(",
"partialEsca... | Check if the chunk has been parsed correctly.
After calling this it is safe to acquire the output data | [
"Check",
"if",
"the",
"chunk",
"has",
"been",
"parsed",
"correctly",
".",
"After",
"calling",
"this",
"it",
"is",
"safe",
"to",
"acquire",
"the",
"output",
"data"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/ResultJsonParserV2.java#L72-L89 |
58,206 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/ResultJsonParserV2.java | ResultJsonParserV2.continueParsing | public void continueParsing(ByteBuffer in) throws SnowflakeSQLException
{
if (state == State.UNINITIALIZED)
{
throw new SnowflakeSQLException(SqlState.INTERNAL_ERROR,
ErrorCode.INTERNAL_ERROR.getMessageCode(),
"Json parser hasn'... | java | public void continueParsing(ByteBuffer in) throws SnowflakeSQLException
{
if (state == State.UNINITIALIZED)
{
throw new SnowflakeSQLException(SqlState.INTERNAL_ERROR,
ErrorCode.INTERNAL_ERROR.getMessageCode(),
"Json parser hasn'... | [
"public",
"void",
"continueParsing",
"(",
"ByteBuffer",
"in",
")",
"throws",
"SnowflakeSQLException",
"{",
"if",
"(",
"state",
"==",
"State",
".",
"UNINITIALIZED",
")",
"{",
"throw",
"new",
"SnowflakeSQLException",
"(",
"SqlState",
".",
"INTERNAL_ERROR",
",",
"E... | Continue parsing with the given data
@param in readOnly byteBuffer backed by an array (the data to be reed is from position to limit) | [
"Continue",
"parsing",
"with",
"the",
"given",
"data"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/ResultJsonParserV2.java#L96-L127 |
58,207 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/StmtUtil.java | StmtUtil.cancel | public static void cancel(StmtInput stmtInput) throws SFException,
SnowflakeSQLException
{
HttpPost httpRequest = null;
AssertUtil.assertTrue(stmtInput.serverUrl != null,
"Missing server url for statement execution");
Asse... | java | public static void cancel(StmtInput stmtInput) throws SFException,
SnowflakeSQLException
{
HttpPost httpRequest = null;
AssertUtil.assertTrue(stmtInput.serverUrl != null,
"Missing server url for statement execution");
Asse... | [
"public",
"static",
"void",
"cancel",
"(",
"StmtInput",
"stmtInput",
")",
"throws",
"SFException",
",",
"SnowflakeSQLException",
"{",
"HttpPost",
"httpRequest",
"=",
"null",
";",
"AssertUtil",
".",
"assertTrue",
"(",
"stmtInput",
".",
"serverUrl",
"!=",
"null",
... | Cancel a statement identifiable by a request id
@param stmtInput input statement
@throws SFException if there is an internal exception
@throws SnowflakeSQLException if failed to cancel the statement | [
"Cancel",
"a",
"statement",
"identifiable",
"by",
"a",
"request",
"id"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/StmtUtil.java#L706-L786 |
58,208 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/StmtUtil.java | StmtUtil.checkStageManageCommand | static public SFStatementType checkStageManageCommand(String sql)
{
if (sql == null)
{
return null;
}
String trimmedSql = sql.trim();
// skip commenting prefixed with //
while (trimmedSql.startsWith("//"))
{
logger.debug("skipping // comments in: \n{}", trimmedSql);
if... | java | static public SFStatementType checkStageManageCommand(String sql)
{
if (sql == null)
{
return null;
}
String trimmedSql = sql.trim();
// skip commenting prefixed with //
while (trimmedSql.startsWith("//"))
{
logger.debug("skipping // comments in: \n{}", trimmedSql);
if... | [
"static",
"public",
"SFStatementType",
"checkStageManageCommand",
"(",
"String",
"sql",
")",
"{",
"if",
"(",
"sql",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"trimmedSql",
"=",
"sql",
".",
"trim",
"(",
")",
";",
"// skip commenting prefix... | A simple function to check if the statement is related to manipulate stage.
@param sql a SQL statement/command
@return PUT/GET/LIST/RM if statment belongs to one of them, otherwise
return NULL | [
"A",
"simple",
"function",
"to",
"check",
"if",
"the",
"statement",
"is",
"related",
"to",
"manipulate",
"stage",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/StmtUtil.java#L795-L867 |
58,209 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryService.java | TelemetryService.flush | public void flush()
{
if (!enabled)
{
return;
}
if (!queue.isEmpty())
{
// start a new thread to upload without blocking the current thread
Runnable runUpload = new TelemetryUploader(this, exportQueueToString());
uploader.execute(runUpload);
}
} | java | public void flush()
{
if (!enabled)
{
return;
}
if (!queue.isEmpty())
{
// start a new thread to upload without blocking the current thread
Runnable runUpload = new TelemetryUploader(this, exportQueueToString());
uploader.execute(runUpload);
}
} | [
"public",
"void",
"flush",
"(",
")",
"{",
"if",
"(",
"!",
"enabled",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"queue",
".",
"isEmpty",
"(",
")",
")",
"{",
"// start a new thread to upload without blocking the current thread",
"Runnable",
"runUpload",
"=",... | force to flush events in the queue | [
"force",
"to",
"flush",
"events",
"in",
"the",
"queue"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryService.java#L352-L364 |
58,210 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryService.java | TelemetryService.exportQueueToString | public String exportQueueToString()
{
JSONArray logs = new JSONArray();
while (!queue.isEmpty())
{
logs.add(queue.poll());
}
return SecretDetector.maskAWSSecret(logs.toString());
} | java | public String exportQueueToString()
{
JSONArray logs = new JSONArray();
while (!queue.isEmpty())
{
logs.add(queue.poll());
}
return SecretDetector.maskAWSSecret(logs.toString());
} | [
"public",
"String",
"exportQueueToString",
"(",
")",
"{",
"JSONArray",
"logs",
"=",
"new",
"JSONArray",
"(",
")",
";",
"while",
"(",
"!",
"queue",
".",
"isEmpty",
"(",
")",
")",
"{",
"logs",
".",
"add",
"(",
"queue",
".",
"poll",
"(",
")",
")",
";"... | convert a list of json objects to a string
@return the result json string | [
"convert",
"a",
"list",
"of",
"json",
"objects",
"to",
"a",
"string"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryService.java#L371-L379 |
58,211 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryService.java | TelemetryService.logHttpRequestTelemetryEvent | public void logHttpRequestTelemetryEvent(
String eventName,
HttpRequestBase request,
int injectSocketTimeout,
AtomicBoolean canceling,
boolean withoutCookies,
boolean includeRetryParameters,
boolean includeRequestGuid,
CloseableHttpResponse response,
final Exception... | java | public void logHttpRequestTelemetryEvent(
String eventName,
HttpRequestBase request,
int injectSocketTimeout,
AtomicBoolean canceling,
boolean withoutCookies,
boolean includeRetryParameters,
boolean includeRequestGuid,
CloseableHttpResponse response,
final Exception... | [
"public",
"void",
"logHttpRequestTelemetryEvent",
"(",
"String",
"eventName",
",",
"HttpRequestBase",
"request",
",",
"int",
"injectSocketTimeout",
",",
"AtomicBoolean",
"canceling",
",",
"boolean",
"withoutCookies",
",",
"boolean",
"includeRetryParameters",
",",
"boolean... | log error http response to telemetry | [
"log",
"error",
"http",
"response",
"to",
"telemetry"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryService.java#L469-L532 |
58,212 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeResultChunk.java | SnowflakeResultChunk.getCell | public final Object getCell(int rowIdx, int colIdx)
{
if (resultData != null)
{
return extractCell(resultData, rowIdx, colIdx);
}
return data.get(colCount * rowIdx + colIdx);
} | java | public final Object getCell(int rowIdx, int colIdx)
{
if (resultData != null)
{
return extractCell(resultData, rowIdx, colIdx);
}
return data.get(colCount * rowIdx + colIdx);
} | [
"public",
"final",
"Object",
"getCell",
"(",
"int",
"rowIdx",
",",
"int",
"colIdx",
")",
"{",
"if",
"(",
"resultData",
"!=",
"null",
")",
"{",
"return",
"extractCell",
"(",
"resultData",
",",
"rowIdx",
",",
"colIdx",
")",
";",
"}",
"return",
"data",
".... | Creates a String object for the given cell
@param rowIdx zero based row
@param colIdx zero based column
@return String | [
"Creates",
"a",
"String",
"object",
"for",
"the",
"given",
"cell"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeResultChunk.java#L140-L147 |
58,213 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeResultChunk.java | SnowflakeResultChunk.ensureRowsComplete | public final void ensureRowsComplete() throws SnowflakeSQLException
{
// Check that all the rows have been decoded, raise an error if not
if (rowCount != currentRow)
{
throw
new SnowflakeSQLException(
SqlState.INTERNAL_ERROR,
ErrorCode.INTERNAL_ERROR
... | java | public final void ensureRowsComplete() throws SnowflakeSQLException
{
// Check that all the rows have been decoded, raise an error if not
if (rowCount != currentRow)
{
throw
new SnowflakeSQLException(
SqlState.INTERNAL_ERROR,
ErrorCode.INTERNAL_ERROR
... | [
"public",
"final",
"void",
"ensureRowsComplete",
"(",
")",
"throws",
"SnowflakeSQLException",
"{",
"// Check that all the rows have been decoded, raise an error if not",
"if",
"(",
"rowCount",
"!=",
"currentRow",
")",
"{",
"throw",
"new",
"SnowflakeSQLException",
"(",
"SqlS... | Checks that all data has been added after parsing.
@throws SnowflakeSQLException when rows are not all downloaded | [
"Checks",
"that",
"all",
"data",
"has",
"been",
"added",
"after",
"parsing",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeResultChunk.java#L211-L226 |
58,214 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/HttpUtil.java | HttpUtil.buildHttpClient | static CloseableHttpClient buildHttpClient(
boolean insecureMode, File ocspCacheFile, boolean useOcspCacheServer)
{
// set timeout so that we don't wait forever.
// Setup the default configuration for all requests on this client
DefaultRequestConfig =
RequestConfig.custom()
.setC... | java | static CloseableHttpClient buildHttpClient(
boolean insecureMode, File ocspCacheFile, boolean useOcspCacheServer)
{
// set timeout so that we don't wait forever.
// Setup the default configuration for all requests on this client
DefaultRequestConfig =
RequestConfig.custom()
.setC... | [
"static",
"CloseableHttpClient",
"buildHttpClient",
"(",
"boolean",
"insecureMode",
",",
"File",
"ocspCacheFile",
",",
"boolean",
"useOcspCacheServer",
")",
"{",
"// set timeout so that we don't wait forever.",
"// Setup the default configuration for all requests on this client",
"De... | Build an Http client using our set of default.
@param insecureMode skip OCSP revocation check if true or false.
@param ocspCacheFile OCSP response cache file. If null, the default
OCSP response file will be used.
@return HttpClient object | [
"Build",
"an",
"Http",
"client",
"using",
"our",
"set",
"of",
"default",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/HttpUtil.java#L98-L181 |
58,215 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/HttpUtil.java | HttpUtil.initHttpClient | public static CloseableHttpClient initHttpClient(boolean insecureMode, File ocspCacheFile)
{
if (httpClient == null)
{
synchronized (HttpUtil.class)
{
if (httpClient == null)
{
httpClient = buildHttpClient(
insecureMode,
ocspCacheFile,
... | java | public static CloseableHttpClient initHttpClient(boolean insecureMode, File ocspCacheFile)
{
if (httpClient == null)
{
synchronized (HttpUtil.class)
{
if (httpClient == null)
{
httpClient = buildHttpClient(
insecureMode,
ocspCacheFile,
... | [
"public",
"static",
"CloseableHttpClient",
"initHttpClient",
"(",
"boolean",
"insecureMode",
",",
"File",
"ocspCacheFile",
")",
"{",
"if",
"(",
"httpClient",
"==",
"null",
")",
"{",
"synchronized",
"(",
"HttpUtil",
".",
"class",
")",
"{",
"if",
"(",
"httpClien... | Accessor for the HTTP client singleton.
@param insecureMode skip OCSP revocation check if true.
@param ocspCacheFile OCSP response cache file name. if null, the default
file will be used.
@return HttpClient object shared across all connections | [
"Accessor",
"for",
"the",
"HTTP",
"client",
"singleton",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/HttpUtil.java#L201-L217 |
58,216 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/HttpUtil.java | HttpUtil.getDefaultRequestConfigWithSocketTimeout | public static RequestConfig
getDefaultRequestConfigWithSocketTimeout(int soTimeoutMs,
boolean withoutCookies)
{
getHttpClient();
final String cookieSpec = withoutCookies ? IGNORE_COOKIES : DEFAULT;
return RequestConfig.copy(DefaultRequestConfig)
.setSoc... | java | public static RequestConfig
getDefaultRequestConfigWithSocketTimeout(int soTimeoutMs,
boolean withoutCookies)
{
getHttpClient();
final String cookieSpec = withoutCookies ? IGNORE_COOKIES : DEFAULT;
return RequestConfig.copy(DefaultRequestConfig)
.setSoc... | [
"public",
"static",
"RequestConfig",
"getDefaultRequestConfigWithSocketTimeout",
"(",
"int",
"soTimeoutMs",
",",
"boolean",
"withoutCookies",
")",
"{",
"getHttpClient",
"(",
")",
";",
"final",
"String",
"cookieSpec",
"=",
"withoutCookies",
"?",
"IGNORE_COOKIES",
":",
... | Return a request configuration inheriting from the default request
configuration of the shared HttpClient with a different socket timeout.
@param soTimeoutMs - custom socket timeout in milli-seconds
@param withoutCookies - whether this request should ignore cookies or not
@return RequestConfig object | [
"Return",
"a",
"request",
"configuration",
"inheriting",
"from",
"the",
"default",
"request",
"configuration",
"of",
"the",
"shared",
"HttpClient",
"with",
"a",
"different",
"socket",
"timeout",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/HttpUtil.java#L250-L260 |
58,217 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/HttpUtil.java | HttpUtil.executeRequestWithoutCookies | static String executeRequestWithoutCookies(HttpRequestBase httpRequest,
int retryTimeout,
int injectSocketTimeout,
AtomicBoolean canceling)
throws SnowflakeSQLException, IOException
... | java | static String executeRequestWithoutCookies(HttpRequestBase httpRequest,
int retryTimeout,
int injectSocketTimeout,
AtomicBoolean canceling)
throws SnowflakeSQLException, IOException
... | [
"static",
"String",
"executeRequestWithoutCookies",
"(",
"HttpRequestBase",
"httpRequest",
",",
"int",
"retryTimeout",
",",
"int",
"injectSocketTimeout",
",",
"AtomicBoolean",
"canceling",
")",
"throws",
"SnowflakeSQLException",
",",
"IOException",
"{",
"return",
"execute... | Executes a HTTP request with the cookie spec set to IGNORE_COOKIES
@param httpRequest HttpRequestBase
@param retryTimeout retry timeout
@param injectSocketTimeout injecting socket timeout
@param canceling canceling?
@return response
@throws SnowflakeSQLException if Snowflake error occurs
@thro... | [
"Executes",
"a",
"HTTP",
"request",
"with",
"the",
"cookie",
"spec",
"set",
"to",
"IGNORE_COOKIES"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/HttpUtil.java#L319-L333 |
58,218 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/HttpUtil.java | HttpUtil.executeRequest | public static String executeRequest(HttpRequestBase httpRequest,
int retryTimeout,
int injectSocketTimeout,
AtomicBoolean canceling)
throws SnowflakeSQLException, IOException
{
return executeRequest... | java | public static String executeRequest(HttpRequestBase httpRequest,
int retryTimeout,
int injectSocketTimeout,
AtomicBoolean canceling)
throws SnowflakeSQLException, IOException
{
return executeRequest... | [
"public",
"static",
"String",
"executeRequest",
"(",
"HttpRequestBase",
"httpRequest",
",",
"int",
"retryTimeout",
",",
"int",
"injectSocketTimeout",
",",
"AtomicBoolean",
"canceling",
")",
"throws",
"SnowflakeSQLException",
",",
"IOException",
"{",
"return",
"executeRe... | Executes a HTTP request for Snowflake.
@param httpRequest HttpRequestBase
@param retryTimeout retry timeout
@param injectSocketTimeout injecting socket timeout
@param canceling canceling?
@return response
@throws SnowflakeSQLException if Snowflake error occurs
@throws IOException rai... | [
"Executes",
"a",
"HTTP",
"request",
"for",
"Snowflake",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/HttpUtil.java#L346-L358 |
58,219 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/HttpUtil.java | HttpUtil.configureCustomProxyProperties | public static void configureCustomProxyProperties(
Map<SFSessionProperty, Object> connectionPropertiesMap)
{
if (connectionPropertiesMap.containsKey(SFSessionProperty.USE_PROXY))
{
useProxy = (boolean) connectionPropertiesMap.get(
SFSessionProperty.USE_PROXY);
}
if (useProxy)
... | java | public static void configureCustomProxyProperties(
Map<SFSessionProperty, Object> connectionPropertiesMap)
{
if (connectionPropertiesMap.containsKey(SFSessionProperty.USE_PROXY))
{
useProxy = (boolean) connectionPropertiesMap.get(
SFSessionProperty.USE_PROXY);
}
if (useProxy)
... | [
"public",
"static",
"void",
"configureCustomProxyProperties",
"(",
"Map",
"<",
"SFSessionProperty",
",",
"Object",
">",
"connectionPropertiesMap",
")",
"{",
"if",
"(",
"connectionPropertiesMap",
".",
"containsKey",
"(",
"SFSessionProperty",
".",
"USE_PROXY",
")",
")",... | configure custom proxy properties from connectionPropertiesMap | [
"configure",
"custom",
"proxy",
"properties",
"from",
"connectionPropertiesMap"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/HttpUtil.java#L580-L603 |
58,220 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeUtil.java | SnowflakeUtil.checkErrorAndThrowExceptionSub | static private void checkErrorAndThrowExceptionSub(
JsonNode rootNode, boolean raiseReauthenticateError)
throws SnowflakeSQLException
{
// no need to throw exception if success
if (rootNode.path("success").asBoolean())
{
return;
}
String errorMessage;
String sqlState;
int er... | java | static private void checkErrorAndThrowExceptionSub(
JsonNode rootNode, boolean raiseReauthenticateError)
throws SnowflakeSQLException
{
// no need to throw exception if success
if (rootNode.path("success").asBoolean())
{
return;
}
String errorMessage;
String sqlState;
int er... | [
"static",
"private",
"void",
"checkErrorAndThrowExceptionSub",
"(",
"JsonNode",
"rootNode",
",",
"boolean",
"raiseReauthenticateError",
")",
"throws",
"SnowflakeSQLException",
"{",
"// no need to throw exception if success",
"if",
"(",
"rootNode",
".",
"path",
"(",
"\"succe... | Check the error in the JSON node and generate an exception based on
information extracted from the node.
@param rootNode json object contains error information
@param raiseReauthenticateError raises SnowflakeReauthenticationRequest
if true
@throws SnowflakeSQLException the exception get from the error ... | [
"Check",
"the",
"error",
"in",
"the",
"JSON",
"node",
"and",
"generate",
"an",
"exception",
"based",
"on",
"information",
"extracted",
"from",
"the",
"node",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeUtil.java#L76-L141 |
58,221 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/AssertUtil.java | AssertUtil.assertTrue | static void assertTrue(boolean condition, String internalErrorMesg)
throws SFException
{
if (!condition)
{
throw new SFException(ErrorCode.INTERNAL_ERROR, internalErrorMesg);
}
} | java | static void assertTrue(boolean condition, String internalErrorMesg)
throws SFException
{
if (!condition)
{
throw new SFException(ErrorCode.INTERNAL_ERROR, internalErrorMesg);
}
} | [
"static",
"void",
"assertTrue",
"(",
"boolean",
"condition",
",",
"String",
"internalErrorMesg",
")",
"throws",
"SFException",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"SFException",
"(",
"ErrorCode",
".",
"INTERNAL_ERROR",
",",
"internalError... | Assert the condition is true, otherwise throw an internal error
exception with the given message.
@param condition
@param internalErrorMesg
@throws SFException | [
"Assert",
"the",
"condition",
"is",
"true",
"otherwise",
"throw",
"an",
"internal",
"error",
"exception",
"with",
"the",
"given",
"message",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/AssertUtil.java#L22-L29 |
58,222 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/MatDesc.java | MatDesc.parse | public static MatDesc parse(String matdesc)
{
if (matdesc == null)
{
return null;
}
try
{
JsonNode jsonNode = mapper.readTree(matdesc);
JsonNode queryIdNode = jsonNode.path(QUERY_ID);
if (queryIdNode.isMissingNode() || queryIdNode.isNull())
{
return null;
... | java | public static MatDesc parse(String matdesc)
{
if (matdesc == null)
{
return null;
}
try
{
JsonNode jsonNode = mapper.readTree(matdesc);
JsonNode queryIdNode = jsonNode.path(QUERY_ID);
if (queryIdNode.isMissingNode() || queryIdNode.isNull())
{
return null;
... | [
"public",
"static",
"MatDesc",
"parse",
"(",
"String",
"matdesc",
")",
"{",
"if",
"(",
"matdesc",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"JsonNode",
"jsonNode",
"=",
"mapper",
".",
"readTree",
"(",
"matdesc",
")",
";",
"JsonNod... | Try to parse the material descriptor string.
@param matdesc string
@return The material description or null | [
"Try",
"to",
"parse",
"the",
"material",
"descriptor",
"string",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/MatDesc.java#L94-L126 |
58,223 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java | SnowflakeDatabaseMetaData.applySessionContext | private SFPair<String, String> applySessionContext(String catalog,
String schemaPattern)
{
if (catalog == null && metadataRequestUseConnectionCtx)
{
catalog = session.getDatabase();
if (schemaPattern == null)
{
schemaPattern = ses... | java | private SFPair<String, String> applySessionContext(String catalog,
String schemaPattern)
{
if (catalog == null && metadataRequestUseConnectionCtx)
{
catalog = session.getDatabase();
if (schemaPattern == null)
{
schemaPattern = ses... | [
"private",
"SFPair",
"<",
"String",
",",
"String",
">",
"applySessionContext",
"(",
"String",
"catalog",
",",
"String",
"schemaPattern",
")",
"{",
"if",
"(",
"catalog",
"==",
"null",
"&&",
"metadataRequestUseConnectionCtx",
")",
"{",
"catalog",
"=",
"session",
... | apply session context when catalog is unspecified | [
"apply",
"session",
"context",
"when",
"catalog",
"is",
"unspecified"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java#L1190-L1203 |
58,224 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java | SnowflakeDatabaseMetaData.getForeignKeyConstraintProperty | private short getForeignKeyConstraintProperty(
String property_name, String property)
{
short result = 0;
switch (property_name)
{
case "update":
case "delete":
switch (property)
{
case "NO ACTION":
result = importedKeyNoAction;
break;
... | java | private short getForeignKeyConstraintProperty(
String property_name, String property)
{
short result = 0;
switch (property_name)
{
case "update":
case "delete":
switch (property)
{
case "NO ACTION":
result = importedKeyNoAction;
break;
... | [
"private",
"short",
"getForeignKeyConstraintProperty",
"(",
"String",
"property_name",
",",
"String",
"property",
")",
"{",
"short",
"result",
"=",
"0",
";",
"switch",
"(",
"property_name",
")",
"{",
"case",
"\"update\"",
":",
"case",
"\"delete\"",
":",
"switch"... | Returns the JDBC standard property string for the property string used
in our show constraint commands
@param property_name operation type
@param property property value
@return metdata property value | [
"Returns",
"the",
"JDBC",
"standard",
"property",
"string",
"for",
"the",
"property",
"string",
"used",
"in",
"our",
"show",
"constraint",
"commands"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java#L2052-L2093 |
58,225 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java | SnowflakeDatabaseMetaData.executeAndReturnEmptyResultIfNotFound | private ResultSet executeAndReturnEmptyResultIfNotFound(Statement statement, String sql,
DBMetadataResultSetMetadata metadataType)
throws SQLException
{
ResultSet resultSet;
try
{
resultSet = statement.executeQuery(sql);
}
catch (Sn... | java | private ResultSet executeAndReturnEmptyResultIfNotFound(Statement statement, String sql,
DBMetadataResultSetMetadata metadataType)
throws SQLException
{
ResultSet resultSet;
try
{
resultSet = statement.executeQuery(sql);
}
catch (Sn... | [
"private",
"ResultSet",
"executeAndReturnEmptyResultIfNotFound",
"(",
"Statement",
"statement",
",",
"String",
"sql",
",",
"DBMetadataResultSetMetadata",
"metadataType",
")",
"throws",
"SQLException",
"{",
"ResultSet",
"resultSet",
";",
"try",
"{",
"resultSet",
"=",
"st... | A small helper function to execute show command to get metadata,
And if object does not exist, return an empty result set instead of
throwing a SnowflakeSQLException | [
"A",
"small",
"helper",
"function",
"to",
"execute",
"show",
"command",
"to",
"get",
"metadata",
"And",
"if",
"object",
"does",
"not",
"exist",
"return",
"an",
"empty",
"result",
"set",
"instead",
"of",
"throwing",
"a",
"SnowflakeSQLException"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeDatabaseMetaData.java#L2813-L2835 |
58,226 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtil.java | SessionUtil.getAuthenticator | static private ClientAuthnDTO.AuthenticatorType getAuthenticator(
LoginInput loginInput)
{
if (loginInput.getAuthenticator() != null)
{
if (loginInput.getAuthenticator().equalsIgnoreCase(
ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER.name()))
{
// SAML 2.0 compliant serv... | java | static private ClientAuthnDTO.AuthenticatorType getAuthenticator(
LoginInput loginInput)
{
if (loginInput.getAuthenticator() != null)
{
if (loginInput.getAuthenticator().equalsIgnoreCase(
ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER.name()))
{
// SAML 2.0 compliant serv... | [
"static",
"private",
"ClientAuthnDTO",
".",
"AuthenticatorType",
"getAuthenticator",
"(",
"LoginInput",
"loginInput",
")",
"{",
"if",
"(",
"loginInput",
".",
"getAuthenticator",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"loginInput",
".",
"getAuthenticator",
... | Returns Authenticator type
@param loginInput login information
@return Authenticator type | [
"Returns",
"Authenticator",
"type"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L171-L208 |
58,227 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtil.java | SessionUtil.openSession | static public LoginOutput openSession(LoginInput loginInput)
throws SFException, SnowflakeSQLException
{
AssertUtil.assertTrue(loginInput.getServerUrl() != null,
"missing server URL for opening session");
AssertUtil.assertTrue(loginInput.getAppId() != null,
... | java | static public LoginOutput openSession(LoginInput loginInput)
throws SFException, SnowflakeSQLException
{
AssertUtil.assertTrue(loginInput.getServerUrl() != null,
"missing server URL for opening session");
AssertUtil.assertTrue(loginInput.getAppId() != null,
... | [
"static",
"public",
"LoginOutput",
"openSession",
"(",
"LoginInput",
"loginInput",
")",
"throws",
"SFException",
",",
"SnowflakeSQLException",
"{",
"AssertUtil",
".",
"assertTrue",
"(",
"loginInput",
".",
"getServerUrl",
"(",
")",
"!=",
"null",
",",
"\"missing serve... | Open a new session
@param loginInput login information
@return information get after login such as token information
@throws SFException if unexpected uri syntax
@throws SnowflakeSQLException if failed to establish connection with snowflake | [
"Open",
"a",
"new",
"session"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L218-L266 |
58,228 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtil.java | SessionUtil.issueSession | static public LoginOutput issueSession(LoginInput loginInput)
throws SFException, SnowflakeSQLException
{
return tokenRequest(loginInput, TokenRequestType.ISSUE);
} | java | static public LoginOutput issueSession(LoginInput loginInput)
throws SFException, SnowflakeSQLException
{
return tokenRequest(loginInput, TokenRequestType.ISSUE);
} | [
"static",
"public",
"LoginOutput",
"issueSession",
"(",
"LoginInput",
"loginInput",
")",
"throws",
"SFException",
",",
"SnowflakeSQLException",
"{",
"return",
"tokenRequest",
"(",
"loginInput",
",",
"TokenRequestType",
".",
"ISSUE",
")",
";",
"}"
] | Issue a session
@param loginInput login information
@return login output
@throws SFException if unexpected uri information
@throws SnowflakeSQLException if failed to renew the session | [
"Issue",
"a",
"session"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L913-L917 |
58,229 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtil.java | SessionUtil.closeSession | static public void closeSession(LoginInput loginInput)
throws SFException, SnowflakeSQLException
{
logger.debug(" public void close() throws SFException");
// assert the following inputs are valid
AssertUtil.assertTrue(loginInput.getServerUrl() != null,
"missing server URL for... | java | static public void closeSession(LoginInput loginInput)
throws SFException, SnowflakeSQLException
{
logger.debug(" public void close() throws SFException");
// assert the following inputs are valid
AssertUtil.assertTrue(loginInput.getServerUrl() != null,
"missing server URL for... | [
"static",
"public",
"void",
"closeSession",
"(",
"LoginInput",
"loginInput",
")",
"throws",
"SFException",
",",
"SnowflakeSQLException",
"{",
"logger",
".",
"debug",
"(",
"\" public void close() throws SFException\"",
")",
";",
"// assert the following inputs are valid",
"A... | Close a session
@param loginInput login information
@throws SnowflakeSQLException if failed to close session
@throws SFException if failed to close session | [
"Close",
"a",
"session"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L1064-L1133 |
58,230 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtil.java | SessionUtil.federatedFlowStep3 | private static String federatedFlowStep3(LoginInput loginInput, String tokenUrl)
throws SnowflakeSQLException
{
String oneTimeToken = "";
try
{
URL url = new URL(tokenUrl);
URI tokenUri = url.toURI();
final HttpPost postRequest = new HttpPost(tokenUri);
StringEntity params = ne... | java | private static String federatedFlowStep3(LoginInput loginInput, String tokenUrl)
throws SnowflakeSQLException
{
String oneTimeToken = "";
try
{
URL url = new URL(tokenUrl);
URI tokenUri = url.toURI();
final HttpPost postRequest = new HttpPost(tokenUri);
StringEntity params = ne... | [
"private",
"static",
"String",
"federatedFlowStep3",
"(",
"LoginInput",
"loginInput",
",",
"String",
"tokenUrl",
")",
"throws",
"SnowflakeSQLException",
"{",
"String",
"oneTimeToken",
"=",
"\"\"",
";",
"try",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"tokenUrl"... | Query IDP token url to authenticate and retrieve access token
@param loginInput
@param tokenUrl
@return
@throws SnowflakeSQLException | [
"Query",
"IDP",
"token",
"url",
"to",
"authenticate",
"and",
"retrieve",
"access",
"token"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L1206-L1242 |
58,231 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtil.java | SessionUtil.federatedFlowStep1 | private static JsonNode federatedFlowStep1(LoginInput loginInput)
throws SnowflakeSQLException
{
JsonNode dataNode = null;
try
{
URIBuilder fedUriBuilder = new URIBuilder(loginInput.getServerUrl());
fedUriBuilder.setPath(SF_PATH_AUTHENTICATOR_REQUEST);
URI fedUrlUri = fedUriBuilder.bui... | java | private static JsonNode federatedFlowStep1(LoginInput loginInput)
throws SnowflakeSQLException
{
JsonNode dataNode = null;
try
{
URIBuilder fedUriBuilder = new URIBuilder(loginInput.getServerUrl());
fedUriBuilder.setPath(SF_PATH_AUTHENTICATOR_REQUEST);
URI fedUrlUri = fedUriBuilder.bui... | [
"private",
"static",
"JsonNode",
"federatedFlowStep1",
"(",
"LoginInput",
"loginInput",
")",
"throws",
"SnowflakeSQLException",
"{",
"JsonNode",
"dataNode",
"=",
"null",
";",
"try",
"{",
"URIBuilder",
"fedUriBuilder",
"=",
"new",
"URIBuilder",
"(",
"loginInput",
"."... | Query Snowflake to obtain IDP token url and IDP SSO url
@param loginInput
@throws SnowflakeSQLException | [
"Query",
"Snowflake",
"to",
"obtain",
"IDP",
"token",
"url",
"and",
"IDP",
"SSO",
"url"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L1287-L1341 |
58,232 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtil.java | SessionUtil.handleFederatedFlowError | private static void handleFederatedFlowError(LoginInput loginInput, Exception ex)
throws SnowflakeSQLException
{
if (ex instanceof IOException)
{
logger.error("IOException when authenticating with " +
loginInput.getAuthenticator(), ex);
throw new SnowflakeSQLException(ex, Sql... | java | private static void handleFederatedFlowError(LoginInput loginInput, Exception ex)
throws SnowflakeSQLException
{
if (ex instanceof IOException)
{
logger.error("IOException when authenticating with " +
loginInput.getAuthenticator(), ex);
throw new SnowflakeSQLException(ex, Sql... | [
"private",
"static",
"void",
"handleFederatedFlowError",
"(",
"LoginInput",
"loginInput",
",",
"Exception",
"ex",
")",
"throws",
"SnowflakeSQLException",
"{",
"if",
"(",
"ex",
"instanceof",
"IOException",
")",
"{",
"logger",
".",
"error",
"(",
"\"IOException when au... | Logs an error generated during the federated authentication flow and
re-throws it as a SnowflakeSQLException.
Note that we seperate IOExceptions since those tend to be network related.
@param loginInput
@param ex
@throws SnowflakeSQLException | [
"Logs",
"an",
"error",
"generated",
"during",
"the",
"federated",
"authentication",
"flow",
"and",
"re",
"-",
"throws",
"it",
"as",
"a",
"SnowflakeSQLException",
".",
"Note",
"that",
"we",
"seperate",
"IOExceptions",
"since",
"those",
"tend",
"to",
"be",
"netw... | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L1352-L1371 |
58,233 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtil.java | SessionUtil.getSamlResponseUsingOkta | static private String getSamlResponseUsingOkta(LoginInput loginInput)
throws SnowflakeSQLException
{
JsonNode dataNode = federatedFlowStep1(loginInput);
String tokenUrl = dataNode.path("tokenUrl").asText();
String ssoUrl = dataNode.path("ssoUrl").asText();
federatedFlowStep2(loginInput, tokenUrl, ss... | java | static private String getSamlResponseUsingOkta(LoginInput loginInput)
throws SnowflakeSQLException
{
JsonNode dataNode = federatedFlowStep1(loginInput);
String tokenUrl = dataNode.path("tokenUrl").asText();
String ssoUrl = dataNode.path("ssoUrl").asText();
federatedFlowStep2(loginInput, tokenUrl, ss... | [
"static",
"private",
"String",
"getSamlResponseUsingOkta",
"(",
"LoginInput",
"loginInput",
")",
"throws",
"SnowflakeSQLException",
"{",
"JsonNode",
"dataNode",
"=",
"federatedFlowStep1",
"(",
"loginInput",
")",
";",
"String",
"tokenUrl",
"=",
"dataNode",
".",
"path",... | FEDERATED FLOW
See SNOW-27798 for additional details.
@return saml response
@throws SnowflakeSQLException | [
"FEDERATED",
"FLOW",
"See",
"SNOW",
"-",
"27798",
"for",
"additional",
"details",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L1380-L1391 |
58,234 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtil.java | SessionUtil.isPrefixEqual | static boolean isPrefixEqual(String aUrlStr, String bUrlStr)
throws MalformedURLException
{
URL aUrl = new URL(aUrlStr);
URL bUrl = new URL(bUrlStr);
int aPort = aUrl.getPort();
int bPort = bUrl.getPort();
if (aPort == -1 && "https".equals(aUrl.getProtocol()))
{
// default port number ... | java | static boolean isPrefixEqual(String aUrlStr, String bUrlStr)
throws MalformedURLException
{
URL aUrl = new URL(aUrlStr);
URL bUrl = new URL(bUrlStr);
int aPort = aUrl.getPort();
int bPort = bUrl.getPort();
if (aPort == -1 && "https".equals(aUrl.getProtocol()))
{
// default port number ... | [
"static",
"boolean",
"isPrefixEqual",
"(",
"String",
"aUrlStr",
",",
"String",
"bUrlStr",
")",
"throws",
"MalformedURLException",
"{",
"URL",
"aUrl",
"=",
"new",
"URL",
"(",
"aUrlStr",
")",
";",
"URL",
"bUrl",
"=",
"new",
"URL",
"(",
"bUrlStr",
")",
";",
... | Verify if two input urls have the same protocol, host, and port.
@param aUrlStr a source URL string
@param bUrlStr a target URL string
@return true if matched otherwise false
@throws MalformedURLException raises if a URL string is not valid. | [
"Verify",
"if",
"two",
"input",
"urls",
"have",
"the",
"same",
"protocol",
"host",
"and",
"port",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L1401-L1422 |
58,235 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtil.java | SessionUtil.getPostBackUrlFromHTML | static private String getPostBackUrlFromHTML(String html)
{
Document doc = Jsoup.parse(html);
Elements e1 = doc.getElementsByTag("body");
Elements e2 = e1.get(0).getElementsByTag("form");
String postBackUrl = e2.first().attr("action");
return postBackUrl;
} | java | static private String getPostBackUrlFromHTML(String html)
{
Document doc = Jsoup.parse(html);
Elements e1 = doc.getElementsByTag("body");
Elements e2 = e1.get(0).getElementsByTag("form");
String postBackUrl = e2.first().attr("action");
return postBackUrl;
} | [
"static",
"private",
"String",
"getPostBackUrlFromHTML",
"(",
"String",
"html",
")",
"{",
"Document",
"doc",
"=",
"Jsoup",
".",
"parse",
"(",
"html",
")",
";",
"Elements",
"e1",
"=",
"doc",
".",
"getElementsByTag",
"(",
"\"body\"",
")",
";",
"Elements",
"e... | Extracts post back url from the HTML returned by the IDP
@param html
@return | [
"Extracts",
"post",
"back",
"url",
"from",
"the",
"HTML",
"returned",
"by",
"the",
"IDP"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L1430-L1437 |
58,236 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtil.java | SessionUtil.getCommonParams | public static Map<String, Object> getCommonParams(JsonNode paramsNode)
{
Map<String, Object> parameters = new HashMap<>();
for (JsonNode child : paramsNode)
{
// If there isn't a name then the response from GS must be erroneous.
if (!child.hasNonNull("name"))
{
logger.error("Com... | java | public static Map<String, Object> getCommonParams(JsonNode paramsNode)
{
Map<String, Object> parameters = new HashMap<>();
for (JsonNode child : paramsNode)
{
// If there isn't a name then the response from GS must be erroneous.
if (!child.hasNonNull("name"))
{
logger.error("Com... | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"getCommonParams",
"(",
"JsonNode",
"paramsNode",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"JsonNode",
"child",... | Helper function to parse a JsonNode from a GS response
containing CommonParameters, emitting an EnumMap of parameters
@param paramsNode parameters in JSON form
@return map object including key and value pairs | [
"Helper",
"function",
"to",
"parse",
"a",
"JsonNode",
"from",
"a",
"GS",
"response",
"containing",
"CommonParameters",
"emitting",
"an",
"EnumMap",
"of",
"parameters"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L1446-L1493 |
58,237 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtilExternalBrowser.java | SessionUtilExternalBrowser.getServerSocket | protected ServerSocket getServerSocket() throws SFException
{
try
{
return new ServerSocket(
0, // free port
0, // default number of connections
InetAddress.getByName("localhost"));
}
catch (IOException ex)
{
throw new SFException(ex, ErrorCode.NETWORK_ERR... | java | protected ServerSocket getServerSocket() throws SFException
{
try
{
return new ServerSocket(
0, // free port
0, // default number of connections
InetAddress.getByName("localhost"));
}
catch (IOException ex)
{
throw new SFException(ex, ErrorCode.NETWORK_ERR... | [
"protected",
"ServerSocket",
"getServerSocket",
"(",
")",
"throws",
"SFException",
"{",
"try",
"{",
"return",
"new",
"ServerSocket",
"(",
"0",
",",
"// free port",
"0",
",",
"// default number of connections",
"InetAddress",
".",
"getByName",
"(",
"\"localhost\"",
"... | Gets a free port on localhost
@return port number
@throws SFException raised if an error occurs. | [
"Gets",
"a",
"free",
"port",
"on",
"localhost"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtilExternalBrowser.java#L155-L168 |
58,238 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtilExternalBrowser.java | SessionUtilExternalBrowser.getSSOUrl | private String getSSOUrl(int port) throws SFException, SnowflakeSQLException
{
try
{
String serverUrl = loginInput.getServerUrl();
String authenticator = loginInput.getAuthenticator();
URIBuilder fedUriBuilder = new URIBuilder(serverUrl);
fedUriBuilder.setPath(SessionUtil.SF_PATH_AUTH... | java | private String getSSOUrl(int port) throws SFException, SnowflakeSQLException
{
try
{
String serverUrl = loginInput.getServerUrl();
String authenticator = loginInput.getAuthenticator();
URIBuilder fedUriBuilder = new URIBuilder(serverUrl);
fedUriBuilder.setPath(SessionUtil.SF_PATH_AUTH... | [
"private",
"String",
"getSSOUrl",
"(",
"int",
"port",
")",
"throws",
"SFException",
",",
"SnowflakeSQLException",
"{",
"try",
"{",
"String",
"serverUrl",
"=",
"loginInput",
".",
"getServerUrl",
"(",
")",
";",
"String",
"authenticator",
"=",
"loginInput",
".",
... | Gets SSO URL and proof key
@return SSO URL.
@throws SFException if Snowflake error occurs
@throws SnowflakeSQLException if Snowflake SQL error occurs | [
"Gets",
"SSO",
"URL",
"and",
"proof",
"key"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtilExternalBrowser.java#L188-L254 |
58,239 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtilExternalBrowser.java | SessionUtilExternalBrowser.processSamlToken | private void processSamlToken(String[] rets, Socket socket) throws IOException, SFException
{
String targetLine = null;
String userAgent = null;
boolean isPost = false;
for (String line : rets)
{
if (line.length() > PREFIX_GET.length() &&
line.substring(0, PREFIX_GET.length()).equa... | java | private void processSamlToken(String[] rets, Socket socket) throws IOException, SFException
{
String targetLine = null;
String userAgent = null;
boolean isPost = false;
for (String line : rets)
{
if (line.length() > PREFIX_GET.length() &&
line.substring(0, PREFIX_GET.length()).equa... | [
"private",
"void",
"processSamlToken",
"(",
"String",
"[",
"]",
"rets",
",",
"Socket",
"socket",
")",
"throws",
"IOException",
",",
"SFException",
"{",
"String",
"targetLine",
"=",
"null",
";",
"String",
"userAgent",
"=",
"null",
";",
"boolean",
"isPost",
"=... | Receives SAML token from Snowflake via web browser
@param socket socket
@throws IOException if any IO error occurs
@throws SFException if a HTTP request from browser is invalid | [
"Receives",
"SAML",
"token",
"from",
"Snowflake",
"via",
"web",
"browser"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtilExternalBrowser.java#L418-L492 |
58,240 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtilExternalBrowser.java | SessionUtilExternalBrowser.returnToBrowser | private void returnToBrowser(Socket socket) throws IOException
{
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
List<String> content = new ArrayList<>();
content.add("HTTP/1.0 200 OK");
content.add("Content-Type: text/html");
String responseText;
if (this.origin != null)
... | java | private void returnToBrowser(Socket socket) throws IOException
{
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
List<String> content = new ArrayList<>();
content.add("HTTP/1.0 200 OK");
content.add("Content-Type: text/html");
String responseText;
if (this.origin != null)
... | [
"private",
"void",
"returnToBrowser",
"(",
"Socket",
"socket",
")",
"throws",
"IOException",
"{",
"PrintWriter",
"out",
"=",
"new",
"PrintWriter",
"(",
"socket",
".",
"getOutputStream",
"(",
")",
",",
"true",
")",
";",
"List",
"<",
"String",
">",
"content",
... | Output the message to the browser
@param socket client socket
@throws IOException if any IO error occurs | [
"Output",
"the",
"message",
"to",
"the",
"browser"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtilExternalBrowser.java#L527-L567 |
58,241 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/telemetry/TelemetryUtil.java | TelemetryUtil.buildJobData | public static TelemetryData buildJobData(String queryId, TelemetryField field, long value)
{
ObjectNode obj = mapper.createObjectNode();
obj.put(TYPE, field.toString());
obj.put(QUERY_ID, queryId);
obj.put(VALUE, value);
return new TelemetryData(obj, System.currentTimeMillis());
} | java | public static TelemetryData buildJobData(String queryId, TelemetryField field, long value)
{
ObjectNode obj = mapper.createObjectNode();
obj.put(TYPE, field.toString());
obj.put(QUERY_ID, queryId);
obj.put(VALUE, value);
return new TelemetryData(obj, System.currentTimeMillis());
} | [
"public",
"static",
"TelemetryData",
"buildJobData",
"(",
"String",
"queryId",
",",
"TelemetryField",
"field",
",",
"long",
"value",
")",
"{",
"ObjectNode",
"obj",
"=",
"mapper",
".",
"createObjectNode",
"(",
")",
";",
"obj",
".",
"put",
"(",
"TYPE",
",",
... | Create a simple TelemetryData instance for Job metrics using given parameters
@param queryId the id of the query
@param field the field to log (represents the "type" field in telemetry)
@param value the value to log for the field
@return TelemetryData instance constructed from parameters | [
"Create",
"a",
"simple",
"TelemetryData",
"instance",
"for",
"Job",
"metrics",
"using",
"given",
"parameters"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/telemetry/TelemetryUtil.java#L24-L31 |
58,242 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3Client.java | SnowflakeS3Client.download | @Override
public void download(SFSession connection,
String command,
String localLocation,
String destFileName,
int parallelism,
String remoteStorageLocation,
String stageFilePath,... | java | @Override
public void download(SFSession connection,
String command,
String localLocation,
String destFileName,
int parallelism,
String remoteStorageLocation,
String stageFilePath,... | [
"@",
"Override",
"public",
"void",
"download",
"(",
"SFSession",
"connection",
",",
"String",
"command",
",",
"String",
"localLocation",
",",
"String",
"destFileName",
",",
"int",
"parallelism",
",",
"String",
"remoteStorageLocation",
",",
"String",
"stageFilePath",... | Download a file from S3.
@param connection connection object
@param command command to download file
@param localLocation local file path
@param destFileName destination file name
@param parallelism number of threads for parallel downloading
@param remoteStorageLocat... | [
"Download",
"a",
"file",
"from",
"S3",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeS3Client.java#L268-L350 |
58,243 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.resetOCSPResponseCacherServerURL | static void resetOCSPResponseCacherServerURL(String ocspCacheServerUrl)
{
if (ocspCacheServerUrl == null || SF_OCSP_RESPONSE_CACHE_SERVER_RETRY_URL_PATTERN != null)
{
return;
}
SF_OCSP_RESPONSE_CACHE_SERVER_URL = ocspCacheServerUrl;
if (!SF_OCSP_RESPONSE_CACHE_SERVER_URL.startsWith(DEFAULT_O... | java | static void resetOCSPResponseCacherServerURL(String ocspCacheServerUrl)
{
if (ocspCacheServerUrl == null || SF_OCSP_RESPONSE_CACHE_SERVER_RETRY_URL_PATTERN != null)
{
return;
}
SF_OCSP_RESPONSE_CACHE_SERVER_URL = ocspCacheServerUrl;
if (!SF_OCSP_RESPONSE_CACHE_SERVER_URL.startsWith(DEFAULT_O... | [
"static",
"void",
"resetOCSPResponseCacherServerURL",
"(",
"String",
"ocspCacheServerUrl",
")",
"{",
"if",
"(",
"ocspCacheServerUrl",
"==",
"null",
"||",
"SF_OCSP_RESPONSE_CACHE_SERVER_RETRY_URL_PATTERN",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"SF_OCSP_RESPONSE_CACHE... | Reset OCSP Cache server URL
@param ocspCacheServerUrl OCSP Cache server URL | [
"Reset",
"OCSP",
"Cache",
"server",
"URL"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L443-L476 |
58,244 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.getTrustManager | private X509TrustManager getTrustManager(String algorithm)
{
try
{
TrustManagerFactory factory = TrustManagerFactory.getInstance(algorithm);
factory.init((KeyStore) null);
X509TrustManager ret = null;
for (TrustManager tm : factory.getTrustManagers())
{
// Multiple TrustM... | java | private X509TrustManager getTrustManager(String algorithm)
{
try
{
TrustManagerFactory factory = TrustManagerFactory.getInstance(algorithm);
factory.init((KeyStore) null);
X509TrustManager ret = null;
for (TrustManager tm : factory.getTrustManagers())
{
// Multiple TrustM... | [
"private",
"X509TrustManager",
"getTrustManager",
"(",
"String",
"algorithm",
")",
"{",
"try",
"{",
"TrustManagerFactory",
"factory",
"=",
"TrustManagerFactory",
".",
"getInstance",
"(",
"algorithm",
")",
";",
"factory",
".",
"init",
"(",
"(",
"KeyStore",
")",
"... | Get TrustManager for the algorithm.
This is mainly used to get the JVM default trust manager and
cache all of the root CA.
@param algorithm algorithm.
@return TrustManager object. | [
"Get",
"TrustManager",
"for",
"the",
"algorithm",
".",
"This",
"is",
"mainly",
"used",
"to",
"get",
"the",
"JVM",
"default",
"trust",
"manager",
"and",
"cache",
"all",
"of",
"the",
"root",
"CA",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L486-L525 |
58,245 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.validateRevocationStatus | void validateRevocationStatus(X509Certificate[] chain, String peerHost) throws CertificateException
{
final List<Certificate> bcChain = convertToBouncyCastleCertificate(chain);
final List<SFPair<Certificate, Certificate>> pairIssuerSubjectList =
getPairIssuerSubject(bcChain);
if (peerHost.startsW... | java | void validateRevocationStatus(X509Certificate[] chain, String peerHost) throws CertificateException
{
final List<Certificate> bcChain = convertToBouncyCastleCertificate(chain);
final List<SFPair<Certificate, Certificate>> pairIssuerSubjectList =
getPairIssuerSubject(bcChain);
if (peerHost.startsW... | [
"void",
"validateRevocationStatus",
"(",
"X509Certificate",
"[",
"]",
"chain",
",",
"String",
"peerHost",
")",
"throws",
"CertificateException",
"{",
"final",
"List",
"<",
"Certificate",
">",
"bcChain",
"=",
"convertToBouncyCastleCertificate",
"(",
"chain",
")",
";"... | Certificate Revocation checks
@param chain chain of certificates attached.
@param peerHost Hostname of the server
@throws CertificateException if any certificate validation fails | [
"Certificate",
"Revocation",
"checks"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L585-L631 |
58,246 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.executeRevocationStatusChecks | private void executeRevocationStatusChecks(
List<SFPair<Certificate, Certificate>> pairIssuerSubjectList, String peerHost)
throws CertificateException
{
long currentTimeSecond = new Date().getTime() / 1000L;
try
{
for (SFPair<Certificate, Certificate> pairIssuerSubject : pairIssuerSubjectLis... | java | private void executeRevocationStatusChecks(
List<SFPair<Certificate, Certificate>> pairIssuerSubjectList, String peerHost)
throws CertificateException
{
long currentTimeSecond = new Date().getTime() / 1000L;
try
{
for (SFPair<Certificate, Certificate> pairIssuerSubject : pairIssuerSubjectLis... | [
"private",
"void",
"executeRevocationStatusChecks",
"(",
"List",
"<",
"SFPair",
"<",
"Certificate",
",",
"Certificate",
">",
">",
"pairIssuerSubjectList",
",",
"String",
"peerHost",
")",
"throws",
"CertificateException",
"{",
"long",
"currentTimeSecond",
"=",
"new",
... | Executes the revocation status checks for all chained certificates
@param pairIssuerSubjectList a list of pair of issuer and subject certificates.
@throws CertificateException raises if any error occurs. | [
"Executes",
"the",
"revocation",
"status",
"checks",
"for",
"all",
"chained",
"certificates"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L639-L655 |
58,247 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.encodeCacheKey | private static String encodeCacheKey(OcspResponseCacheKey ocsp_cache_key)
{
try
{
DigestCalculator digest = new SHA1DigestCalculator();
AlgorithmIdentifier algo = digest.getAlgorithmIdentifier();
ASN1OctetString nameHash = ASN1OctetString.getInstance(ocsp_cache_key.nameHash);
ASN1Octet... | java | private static String encodeCacheKey(OcspResponseCacheKey ocsp_cache_key)
{
try
{
DigestCalculator digest = new SHA1DigestCalculator();
AlgorithmIdentifier algo = digest.getAlgorithmIdentifier();
ASN1OctetString nameHash = ASN1OctetString.getInstance(ocsp_cache_key.nameHash);
ASN1Octet... | [
"private",
"static",
"String",
"encodeCacheKey",
"(",
"OcspResponseCacheKey",
"ocsp_cache_key",
")",
"{",
"try",
"{",
"DigestCalculator",
"digest",
"=",
"new",
"SHA1DigestCalculator",
"(",
")",
";",
"AlgorithmIdentifier",
"algo",
"=",
"digest",
".",
"getAlgorithmIdent... | Convert cache key to base64 encoded
cert id
@param ocsp_cache_key Cache key to encode | [
"Convert",
"cache",
"key",
"to",
"base64",
"encoded",
"cert",
"id"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L663-L680 |
58,248 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.isCached | private boolean isCached(List<SFPair<Certificate, Certificate>> pairIssuerSubjectList)
{
long currentTimeSecond = new Date().getTime() / 1000L;
boolean isCached = true;
try
{
for (SFPair<Certificate, Certificate> pairIssuerSubject : pairIssuerSubjectList)
{
OCSPReq req = createRequ... | java | private boolean isCached(List<SFPair<Certificate, Certificate>> pairIssuerSubjectList)
{
long currentTimeSecond = new Date().getTime() / 1000L;
boolean isCached = true;
try
{
for (SFPair<Certificate, Certificate> pairIssuerSubject : pairIssuerSubjectList)
{
OCSPReq req = createRequ... | [
"private",
"boolean",
"isCached",
"(",
"List",
"<",
"SFPair",
"<",
"Certificate",
",",
"Certificate",
">",
">",
"pairIssuerSubjectList",
")",
"{",
"long",
"currentTimeSecond",
"=",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
"/",
"1000L",
";",
"bool... | Is OCSP Response cached?
@param pairIssuerSubjectList a list of pair of issuer and subject certificates
@return true if all of OCSP response are cached else false | [
"Is",
"OCSP",
"Response",
"cached?"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L844-L894 |
58,249 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.CertificateIDToString | private static String CertificateIDToString(CertificateID certificateID)
{
return String.format("CertID. NameHash: %s, KeyHash: %s, Serial Number: %s",
byteToHexString(certificateID.getIssuerNameHash()),
byteToHexString(certificateID.getIssuerKeyHash()),
... | java | private static String CertificateIDToString(CertificateID certificateID)
{
return String.format("CertID. NameHash: %s, KeyHash: %s, Serial Number: %s",
byteToHexString(certificateID.getIssuerNameHash()),
byteToHexString(certificateID.getIssuerKeyHash()),
... | [
"private",
"static",
"String",
"CertificateIDToString",
"(",
"CertificateID",
"certificateID",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"CertID. NameHash: %s, KeyHash: %s, Serial Number: %s\"",
",",
"byteToHexString",
"(",
"certificateID",
".",
"getIssuerNameHash",... | CertificateID to string
@param certificateID CertificateID
@return a string representation of CertificateID | [
"CertificateID",
"to",
"string"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L903-L911 |
58,250 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.decodeCacheFromJSON | private static SFPair<OcspResponseCacheKey, SFPair<Long, String>>
decodeCacheFromJSON(Map.Entry<String, JsonNode> elem) throws IOException
{
long currentTimeSecond = new Date().getTime() / 1000;
byte[] certIdDer = Base64.decodeBase64(elem.getKey());
DLSequence rawCertId = (DLSequence) ASN1ObjectIdentifi... | java | private static SFPair<OcspResponseCacheKey, SFPair<Long, String>>
decodeCacheFromJSON(Map.Entry<String, JsonNode> elem) throws IOException
{
long currentTimeSecond = new Date().getTime() / 1000;
byte[] certIdDer = Base64.decodeBase64(elem.getKey());
DLSequence rawCertId = (DLSequence) ASN1ObjectIdentifi... | [
"private",
"static",
"SFPair",
"<",
"OcspResponseCacheKey",
",",
"SFPair",
"<",
"Long",
",",
"String",
">",
">",
"decodeCacheFromJSON",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"JsonNode",
">",
"elem",
")",
"throws",
"IOException",
"{",
"long",
"current... | Decodes OCSP Response Cache key from JSON
@param elem A JSON element
@return OcspResponseCacheKey object | [
"Decodes",
"OCSP",
"Response",
"Cache",
"key",
"from",
"JSON"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L919-L952 |
58,251 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.encodeCacheToJSON | private static ObjectNode encodeCacheToJSON()
{
try
{
ObjectNode out = OBJECT_MAPPER.createObjectNode();
for (Map.Entry<OcspResponseCacheKey, SFPair<Long, String>> elem :
OCSP_RESPONSE_CACHE.entrySet())
{
OcspResponseCacheKey key = elem.getKey();
SFPair<Long, String... | java | private static ObjectNode encodeCacheToJSON()
{
try
{
ObjectNode out = OBJECT_MAPPER.createObjectNode();
for (Map.Entry<OcspResponseCacheKey, SFPair<Long, String>> elem :
OCSP_RESPONSE_CACHE.entrySet())
{
OcspResponseCacheKey key = elem.getKey();
SFPair<Long, String... | [
"private",
"static",
"ObjectNode",
"encodeCacheToJSON",
"(",
")",
"{",
"try",
"{",
"ObjectNode",
"out",
"=",
"OBJECT_MAPPER",
".",
"createObjectNode",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"OcspResponseCacheKey",
",",
"SFPair",
"<",
"Long",
",... | Encode OCSP Response Cache to JSON
@return JSON object | [
"Encode",
"OCSP",
"Response",
"Cache",
"to",
"JSON"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L959-L991 |
58,252 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.validateRevocationStatusMain | private void validateRevocationStatusMain(
SFPair<Certificate, Certificate> pairIssuerSubject,
String ocspRespB64) throws CertificateException
{
try
{
OCSPResp ocspResp = b64ToOCSPResp(ocspRespB64);
Date currentTime = new Date();
BasicOCSPResp basicOcspResp = (BasicOCSPResp) (ocs... | java | private void validateRevocationStatusMain(
SFPair<Certificate, Certificate> pairIssuerSubject,
String ocspRespB64) throws CertificateException
{
try
{
OCSPResp ocspResp = b64ToOCSPResp(ocspRespB64);
Date currentTime = new Date();
BasicOCSPResp basicOcspResp = (BasicOCSPResp) (ocs... | [
"private",
"void",
"validateRevocationStatusMain",
"(",
"SFPair",
"<",
"Certificate",
",",
"Certificate",
">",
"pairIssuerSubject",
",",
"String",
"ocspRespB64",
")",
"throws",
"CertificateException",
"{",
"try",
"{",
"OCSPResp",
"ocspResp",
"=",
"b64ToOCSPResp",
"(",... | Validates the certificate revocation status
@param pairIssuerSubject a pair of issuer and subject certificates
@param ocspRespB64 Base64 encoded OCSP Response object
@throws CertificateException raises if any other error occurs | [
"Validates",
"the",
"certificate",
"revocation",
"status"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L1240-L1296 |
58,253 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.validateBasicOcspResponse | private void validateBasicOcspResponse(
Date currentTime, BasicOCSPResp basicOcspResp)
throws CertificateEncodingException
{
for (SingleResp singleResps : basicOcspResp.getResponses())
{
Date thisUpdate = singleResps.getThisUpdate();
Date nextUpdate = singleResps.getNextUpdate();
LOG... | java | private void validateBasicOcspResponse(
Date currentTime, BasicOCSPResp basicOcspResp)
throws CertificateEncodingException
{
for (SingleResp singleResps : basicOcspResp.getResponses())
{
Date thisUpdate = singleResps.getThisUpdate();
Date nextUpdate = singleResps.getNextUpdate();
LOG... | [
"private",
"void",
"validateBasicOcspResponse",
"(",
"Date",
"currentTime",
",",
"BasicOCSPResp",
"basicOcspResp",
")",
"throws",
"CertificateEncodingException",
"{",
"for",
"(",
"SingleResp",
"singleResps",
":",
"basicOcspResp",
".",
"getResponses",
"(",
")",
")",
"{... | Validates OCSP Basic OCSP response.
@param currentTime the current timestamp.
@param basicOcspResp BasicOcspResponse data.
@throws CertificateEncodingException raises if any failure occurs. | [
"Validates",
"OCSP",
"Basic",
"OCSP",
"response",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L1305-L1355 |
58,254 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.verifySignature | private static void verifySignature(
X509CertificateHolder cert,
byte[] sig, byte[] data, AlgorithmIdentifier idf) throws CertificateException
{
try
{
String algorithm = SIGNATURE_OID_TO_STRING.get(idf.getAlgorithm());
if (algorithm == null)
{
throw new NoSuchAlgorithmExc... | java | private static void verifySignature(
X509CertificateHolder cert,
byte[] sig, byte[] data, AlgorithmIdentifier idf) throws CertificateException
{
try
{
String algorithm = SIGNATURE_OID_TO_STRING.get(idf.getAlgorithm());
if (algorithm == null)
{
throw new NoSuchAlgorithmExc... | [
"private",
"static",
"void",
"verifySignature",
"(",
"X509CertificateHolder",
"cert",
",",
"byte",
"[",
"]",
"sig",
",",
"byte",
"[",
"]",
"data",
",",
"AlgorithmIdentifier",
"idf",
")",
"throws",
"CertificateException",
"{",
"try",
"{",
"String",
"algorithm",
... | Verifies the signature of the data
@param cert a certificate for public key.
@param sig signature in a byte array.
@param data data in a byte array.
@param idf algorithm identifier object.
@throws CertificateException raises if the verification fails. | [
"Verifies",
"the",
"signature",
"of",
"the",
"data"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L1366-L1397 |
58,255 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.byteToHexString | private static String byteToHexString(byte[] bytes)
{
final char[] hexArray = "0123456789ABCDEF".toCharArray();
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++)
{
int v = bytes[j] & 0xFF;
hexChars[j * 2] = hexArray[v >>> 4];
hexChars[j * 2 + 1] = h... | java | private static String byteToHexString(byte[] bytes)
{
final char[] hexArray = "0123456789ABCDEF".toCharArray();
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++)
{
int v = bytes[j] & 0xFF;
hexChars[j * 2] = hexArray[v >>> 4];
hexChars[j * 2 + 1] = h... | [
"private",
"static",
"String",
"byteToHexString",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"final",
"char",
"[",
"]",
"hexArray",
"=",
"\"0123456789ABCDEF\"",
".",
"toCharArray",
"(",
")",
";",
"char",
"[",
"]",
"hexChars",
"=",
"new",
"char",
"[",
"byt... | Converts Byte array to hex string
@param bytes a byte array
@return a string in hexadecimal code | [
"Converts",
"Byte",
"array",
"to",
"hex",
"string"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L1405-L1416 |
58,256 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.createRequest | private OCSPReq createRequest(
SFPair<Certificate, Certificate> pairIssuerSubject)
{
Certificate issuer = pairIssuerSubject.left;
Certificate subject = pairIssuerSubject.right;
OCSPReqBuilder gen = new OCSPReqBuilder();
try
{
DigestCalculator digest = new SHA1DigestCalculator();
... | java | private OCSPReq createRequest(
SFPair<Certificate, Certificate> pairIssuerSubject)
{
Certificate issuer = pairIssuerSubject.left;
Certificate subject = pairIssuerSubject.right;
OCSPReqBuilder gen = new OCSPReqBuilder();
try
{
DigestCalculator digest = new SHA1DigestCalculator();
... | [
"private",
"OCSPReq",
"createRequest",
"(",
"SFPair",
"<",
"Certificate",
",",
"Certificate",
">",
"pairIssuerSubject",
")",
"{",
"Certificate",
"issuer",
"=",
"pairIssuerSubject",
".",
"left",
";",
"Certificate",
"subject",
"=",
"pairIssuerSubject",
".",
"right",
... | Creates a OCSP Request
@param pairIssuerSubject a pair of issuer and subject certificates
@return OCSPReq object | [
"Creates",
"a",
"OCSP",
"Request"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L1424-L1443 |
58,257 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.convertToBouncyCastleCertificate | private List<Certificate> convertToBouncyCastleCertificate(
X509Certificate[] chain)
{
final List<Certificate> bcChain = new ArrayList<>();
for (X509Certificate cert : chain)
{
try
{
bcChain.add(Certificate.getInstance(cert.getEncoded()));
}
catch (CertificateEncoding... | java | private List<Certificate> convertToBouncyCastleCertificate(
X509Certificate[] chain)
{
final List<Certificate> bcChain = new ArrayList<>();
for (X509Certificate cert : chain)
{
try
{
bcChain.add(Certificate.getInstance(cert.getEncoded()));
}
catch (CertificateEncoding... | [
"private",
"List",
"<",
"Certificate",
">",
"convertToBouncyCastleCertificate",
"(",
"X509Certificate",
"[",
"]",
"chain",
")",
"{",
"final",
"List",
"<",
"Certificate",
">",
"bcChain",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"X509Certificate... | Converts X509Certificate to Bouncy Castle Certificate
@param chain an array of X509Certificate
@return a list of Bouncy Castle Certificate | [
"Converts",
"X509Certificate",
"to",
"Bouncy",
"Castle",
"Certificate"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L1452-L1468 |
58,258 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.getPairIssuerSubject | private List<SFPair<Certificate, Certificate>> getPairIssuerSubject(
List<Certificate> bcChain)
{
List<SFPair<Certificate, Certificate>> pairIssuerSubject = new ArrayList<>();
for (int i = 0, len = bcChain.size(); i < len; ++i)
{
Certificate bcCert = bcChain.get(i);
if (bcCert.getIssuer(... | java | private List<SFPair<Certificate, Certificate>> getPairIssuerSubject(
List<Certificate> bcChain)
{
List<SFPair<Certificate, Certificate>> pairIssuerSubject = new ArrayList<>();
for (int i = 0, len = bcChain.size(); i < len; ++i)
{
Certificate bcCert = bcChain.get(i);
if (bcCert.getIssuer(... | [
"private",
"List",
"<",
"SFPair",
"<",
"Certificate",
",",
"Certificate",
">",
">",
"getPairIssuerSubject",
"(",
"List",
"<",
"Certificate",
">",
"bcChain",
")",
"{",
"List",
"<",
"SFPair",
"<",
"Certificate",
",",
"Certificate",
">",
">",
"pairIssuerSubject",... | Creates a pair of Issuer and Subject certificates
@param bcChain a list of bouncy castle Certificate
@return a list of paif of Issuer and Subject certificates | [
"Creates",
"a",
"pair",
"of",
"Issuer",
"and",
"Subject",
"certificates"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L1476-L1507 |
58,259 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.getOcspUrls | private Set<String> getOcspUrls(Certificate bcCert)
{
TBSCertificate bcTbsCert = bcCert.getTBSCertificate();
Extensions bcExts = bcTbsCert.getExtensions();
if (bcExts == null)
{
throw new RuntimeException("Failed to get Tbs Certificate.");
}
Set<String> ocsp = new HashSet<>();
for (... | java | private Set<String> getOcspUrls(Certificate bcCert)
{
TBSCertificate bcTbsCert = bcCert.getTBSCertificate();
Extensions bcExts = bcTbsCert.getExtensions();
if (bcExts == null)
{
throw new RuntimeException("Failed to get Tbs Certificate.");
}
Set<String> ocsp = new HashSet<>();
for (... | [
"private",
"Set",
"<",
"String",
">",
"getOcspUrls",
"(",
"Certificate",
"bcCert",
")",
"{",
"TBSCertificate",
"bcTbsCert",
"=",
"bcCert",
".",
"getTBSCertificate",
"(",
")",
";",
"Extensions",
"bcExts",
"=",
"bcTbsCert",
".",
"getExtensions",
"(",
")",
";",
... | Gets OCSP URLs associated with the certificate.
@param bcCert Bouncy Castle Certificate
@return a set of OCSP URLs | [
"Gets",
"OCSP",
"URLs",
"associated",
"with",
"the",
"certificate",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L1515-L1550 |
58,260 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.isValidityRange | private static boolean isValidityRange(Date currentTime, Date thisUpdate, Date nextUpdate)
{
long tolerableValidity = calculateTolerableVadility(thisUpdate, nextUpdate);
return thisUpdate.getTime() - MAX_CLOCK_SKEW_IN_MILLISECONDS <= currentTime.getTime() &&
currentTime.getTime() <= nextUpdate.getT... | java | private static boolean isValidityRange(Date currentTime, Date thisUpdate, Date nextUpdate)
{
long tolerableValidity = calculateTolerableVadility(thisUpdate, nextUpdate);
return thisUpdate.getTime() - MAX_CLOCK_SKEW_IN_MILLISECONDS <= currentTime.getTime() &&
currentTime.getTime() <= nextUpdate.getT... | [
"private",
"static",
"boolean",
"isValidityRange",
"(",
"Date",
"currentTime",
",",
"Date",
"thisUpdate",
",",
"Date",
"nextUpdate",
")",
"{",
"long",
"tolerableValidity",
"=",
"calculateTolerableVadility",
"(",
"thisUpdate",
",",
"nextUpdate",
")",
";",
"return",
... | Checks the validity
@param currentTime the current time
@param thisUpdate the last update timestamp
@param nextUpdate the next update timestamp
@return true if valid or false | [
"Checks",
"the",
"validity"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L1592-L1597 |
58,261 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.processKeyUpdateDirective | private void processKeyUpdateDirective(String issuer, String ssd)
{
try
{
/**
* Get unverified part of the JWT to extract issuer.
*
*/
//PlainJWT jwt_unverified = PlainJWT.parse(ssd);
SignedJWT jwt_signed = SignedJWT.parse(ssd);
String jwt_issuer = (String) jwt_sig... | java | private void processKeyUpdateDirective(String issuer, String ssd)
{
try
{
/**
* Get unverified part of the JWT to extract issuer.
*
*/
//PlainJWT jwt_unverified = PlainJWT.parse(ssd);
SignedJWT jwt_signed = SignedJWT.parse(ssd);
String jwt_issuer = (String) jwt_sig... | [
"private",
"void",
"processKeyUpdateDirective",
"(",
"String",
"issuer",
",",
"String",
"ssd",
")",
"{",
"try",
"{",
"/**\n * Get unverified part of the JWT to extract issuer.\n *\n */",
"//PlainJWT jwt_unverified = PlainJWT.parse(ssd);",
"SignedJWT",
"jwt_signed",
... | SSD Processing Code | [
"SSD",
"Processing",
"Code"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L1602-L1683 |
58,262 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.ocspResponseToB64 | private String ocspResponseToB64(OCSPResp ocspResp)
{
if (ocspResp == null)
{
return null;
}
try
{
return Base64.encodeBase64String(ocspResp.getEncoded());
}
catch (Throwable ex)
{
LOGGER.debug("Could not convert OCSP Response to Base64");
return null;
}
} | java | private String ocspResponseToB64(OCSPResp ocspResp)
{
if (ocspResp == null)
{
return null;
}
try
{
return Base64.encodeBase64String(ocspResp.getEncoded());
}
catch (Throwable ex)
{
LOGGER.debug("Could not convert OCSP Response to Base64");
return null;
}
} | [
"private",
"String",
"ocspResponseToB64",
"(",
"OCSPResp",
"ocspResp",
")",
"{",
"if",
"(",
"ocspResp",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"return",
"Base64",
".",
"encodeBase64String",
"(",
"ocspResp",
".",
"getEncoded",
"(",
... | OCSP Response Utils | [
"OCSP",
"Response",
"Utils"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L1794-L1809 |
58,263 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/HeartbeatBackground.java | HeartbeatBackground.scheduleHeartbeat | private void scheduleHeartbeat()
{
// elapsed time in seconds since the last heartbeat
long elapsedSecsSinceLastHeartBeat =
System.currentTimeMillis() / 1000 - lastHeartbeatStartTimeInSecs;
/*
* The initial delay for the new scheduling is 0 if the elapsed
* time is more than the heartbe... | java | private void scheduleHeartbeat()
{
// elapsed time in seconds since the last heartbeat
long elapsedSecsSinceLastHeartBeat =
System.currentTimeMillis() / 1000 - lastHeartbeatStartTimeInSecs;
/*
* The initial delay for the new scheduling is 0 if the elapsed
* time is more than the heartbe... | [
"private",
"void",
"scheduleHeartbeat",
"(",
")",
"{",
"// elapsed time in seconds since the last heartbeat",
"long",
"elapsedSecsSinceLastHeartBeat",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"/",
"1000",
"-",
"lastHeartbeatStartTimeInSecs",
";",
"/*\n * The ini... | Schedule the next heartbeat | [
"Schedule",
"the",
"next",
"heartbeat"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/HeartbeatBackground.java#L175-L196 |
58,264 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java | StorageClientFactory.createClient | public SnowflakeStorageClient createClient(StageInfo stage,
int parallel,
RemoteStoreFileEncryptionMaterial encMat)
throws SnowflakeSQLException
{
logger.debug("createClient client type={}", stage.getStageType().name());
... | java | public SnowflakeStorageClient createClient(StageInfo stage,
int parallel,
RemoteStoreFileEncryptionMaterial encMat)
throws SnowflakeSQLException
{
logger.debug("createClient client type={}", stage.getStageType().name());
... | [
"public",
"SnowflakeStorageClient",
"createClient",
"(",
"StageInfo",
"stage",
",",
"int",
"parallel",
",",
"RemoteStoreFileEncryptionMaterial",
"encMat",
")",
"throws",
"SnowflakeSQLException",
"{",
"logger",
".",
"debug",
"(",
"\"createClient client type={}\"",
",",
"st... | Creates a storage client based on the value of stageLocationType
@param stage the stage properties
@param parallel the degree of parallelism to be used by the client
@param encMat encryption material for the client
@return a SnowflakeStorageClient interface to the instance created
@throws SnowflakeSQLException if... | [
"Creates",
"a",
"storage",
"client",
"based",
"on",
"the",
"value",
"of",
"stageLocationType"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java#L57-L79 |
58,265 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java | StorageClientFactory.createS3Client | private SnowflakeS3Client createS3Client(Map stageCredentials,
int parallel,
RemoteStoreFileEncryptionMaterial encMat,
String stageRegion)
throws SnowflakeSQLException
{
final int S3_... | java | private SnowflakeS3Client createS3Client(Map stageCredentials,
int parallel,
RemoteStoreFileEncryptionMaterial encMat,
String stageRegion)
throws SnowflakeSQLException
{
final int S3_... | [
"private",
"SnowflakeS3Client",
"createS3Client",
"(",
"Map",
"stageCredentials",
",",
"int",
"parallel",
",",
"RemoteStoreFileEncryptionMaterial",
"encMat",
",",
"String",
"stageRegion",
")",
"throws",
"SnowflakeSQLException",
"{",
"final",
"int",
"S3_TRANSFER_MAX_RETRIES"... | Creates a SnowflakeS3ClientObject which encapsulates
the Amazon S3 client
@param stageCredentials Map of stage credential properties
@param parallel degree of parallelism
@param encMat encryption material for the client
@param stageRegion the region where the stage is located
@return the Snowfla... | [
"Creates",
"a",
"SnowflakeS3ClientObject",
"which",
"encapsulates",
"the",
"Amazon",
"S3",
"client"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java#L92-L128 |
58,266 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java | StorageClientFactory.createStorageMetadataObj | public StorageObjectMetadata createStorageMetadataObj(StageInfo.StageType stageType)
{
switch (stageType)
{
case S3:
return new S3ObjectMetadata();
case AZURE:
return new AzureObjectMetadata();
default:
// An unsupported remote storage client type was specified
... | java | public StorageObjectMetadata createStorageMetadataObj(StageInfo.StageType stageType)
{
switch (stageType)
{
case S3:
return new S3ObjectMetadata();
case AZURE:
return new AzureObjectMetadata();
default:
// An unsupported remote storage client type was specified
... | [
"public",
"StorageObjectMetadata",
"createStorageMetadataObj",
"(",
"StageInfo",
".",
"StageType",
"stageType",
")",
"{",
"switch",
"(",
"stageType",
")",
"{",
"case",
"S3",
":",
"return",
"new",
"S3ObjectMetadata",
"(",
")",
";",
"case",
"AZURE",
":",
"return",... | Creates a storage provider specific metadata object,
accessible via the platform independent interface
@param stageType determines the implementation to be created
@return the implementation of StorageObjectMetadata | [
"Creates",
"a",
"storage",
"provider",
"specific",
"metadata",
"object",
"accessible",
"via",
"the",
"platform",
"independent",
"interface"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java#L137-L154 |
58,267 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java | StorageClientFactory.createAzureClient | private SnowflakeAzureClient createAzureClient(StageInfo stage,
RemoteStoreFileEncryptionMaterial encMat)
throws SnowflakeSQLException
{
logger.debug("createAzureClient encryption={}", (encMat == null ? "no" : "yes"));
//TODO: implement support for encryptio... | java | private SnowflakeAzureClient createAzureClient(StageInfo stage,
RemoteStoreFileEncryptionMaterial encMat)
throws SnowflakeSQLException
{
logger.debug("createAzureClient encryption={}", (encMat == null ? "no" : "yes"));
//TODO: implement support for encryptio... | [
"private",
"SnowflakeAzureClient",
"createAzureClient",
"(",
"StageInfo",
"stage",
",",
"RemoteStoreFileEncryptionMaterial",
"encMat",
")",
"throws",
"SnowflakeSQLException",
"{",
"logger",
".",
"debug",
"(",
"\"createAzureClient encryption={}\"",
",",
"(",
"encMat",
"==",
... | Creates a SnowflakeAzureClientObject which encapsulates
the Azure Storage client
@param stage Stage information
@param encMat encryption material for the client
@return the SnowflakeS3Client instance created | [
"Creates",
"a",
"SnowflakeAzureClientObject",
"which",
"encapsulates",
"the",
"Azure",
"Storage",
"client"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java#L164-L186 |
58,268 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.newInstance | public synchronized static BindUploader newInstance(SFSession session, String stageDir)
throws BindException
{
try
{
Path bindDir = Files.createTempDirectory(PREFIX);
return new BindUploader(session, stageDir, bindDir);
}
catch (IOException ex)
{
throw new BindException(
... | java | public synchronized static BindUploader newInstance(SFSession session, String stageDir)
throws BindException
{
try
{
Path bindDir = Files.createTempDirectory(PREFIX);
return new BindUploader(session, stageDir, bindDir);
}
catch (IOException ex)
{
throw new BindException(
... | [
"public",
"synchronized",
"static",
"BindUploader",
"newInstance",
"(",
"SFSession",
"session",
",",
"String",
"stageDir",
")",
"throws",
"BindException",
"{",
"try",
"{",
"Path",
"bindDir",
"=",
"Files",
".",
"createTempDirectory",
"(",
"PREFIX",
")",
";",
"ret... | Create a new BindUploader which will upload to the given stage path
Ensure temporary directory for file writing exists
@param session the session to use for uploading binds
@param stageDir the stage path to upload to
@return BindUploader instance
@throws BindException if temporary directory could not be created | [
"Create",
"a",
"new",
"BindUploader",
"which",
"will",
"upload",
"to",
"the",
"given",
"stage",
"path",
"Ensure",
"temporary",
"directory",
"for",
"file",
"writing",
"exists"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L174-L187 |
58,269 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.upload | public void upload(Map<String, ParameterBindingDTO> bindValues) throws BindException
{
if (!closed)
{
serializeBinds(bindValues);
putBinds();
}
} | java | public void upload(Map<String, ParameterBindingDTO> bindValues) throws BindException
{
if (!closed)
{
serializeBinds(bindValues);
putBinds();
}
} | [
"public",
"void",
"upload",
"(",
"Map",
"<",
"String",
",",
"ParameterBindingDTO",
">",
"bindValues",
")",
"throws",
"BindException",
"{",
"if",
"(",
"!",
"closed",
")",
"{",
"serializeBinds",
"(",
"bindValues",
")",
";",
"putBinds",
"(",
")",
";",
"}",
... | Upload the bindValues to stage
@param bindValues the bind map to upload
@throws BindException if the bind map could not be serialized or upload
fails | [
"Upload",
"the",
"bindValues",
"to",
"stage"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L196-L203 |
58,270 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.serializeBinds | private void serializeBinds(Map<String, ParameterBindingDTO> bindValues) throws BindException
{
List<ColumnTypeDataPair> columns = getColumnValues(bindValues);
List<String[]> rows = buildRows(columns);
writeRowsToCSV(rows);
} | java | private void serializeBinds(Map<String, ParameterBindingDTO> bindValues) throws BindException
{
List<ColumnTypeDataPair> columns = getColumnValues(bindValues);
List<String[]> rows = buildRows(columns);
writeRowsToCSV(rows);
} | [
"private",
"void",
"serializeBinds",
"(",
"Map",
"<",
"String",
",",
"ParameterBindingDTO",
">",
"bindValues",
")",
"throws",
"BindException",
"{",
"List",
"<",
"ColumnTypeDataPair",
">",
"columns",
"=",
"getColumnValues",
"(",
"bindValues",
")",
";",
"List",
"<... | Save the binds to disk
@param bindValues the bind map to serialize
@throws BindException if bind map improperly formed or writing binds fails | [
"Save",
"the",
"binds",
"to",
"disk"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L211-L216 |
58,271 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.getColumnValues | private List<ColumnTypeDataPair> getColumnValues(Map<String, ParameterBindingDTO> bindValues) throws BindException
{
List<ColumnTypeDataPair> columns = new ArrayList<>(bindValues.size());
for (int i = 1; i <= bindValues.size(); i++)
{
// bindValues should have n entries with string keys 1 ... n and ... | java | private List<ColumnTypeDataPair> getColumnValues(Map<String, ParameterBindingDTO> bindValues) throws BindException
{
List<ColumnTypeDataPair> columns = new ArrayList<>(bindValues.size());
for (int i = 1; i <= bindValues.size(); i++)
{
// bindValues should have n entries with string keys 1 ... n and ... | [
"private",
"List",
"<",
"ColumnTypeDataPair",
">",
"getColumnValues",
"(",
"Map",
"<",
"String",
",",
"ParameterBindingDTO",
">",
"bindValues",
")",
"throws",
"BindException",
"{",
"List",
"<",
"ColumnTypeDataPair",
">",
"columns",
"=",
"new",
"ArrayList",
"<>",
... | Convert bind map to a list of values for each column
Perform necessary type casts and invariant checks
@param bindValues the bind map to convert
@return list of values for each column
@throws BindException if bind map is improperly formed | [
"Convert",
"bind",
"map",
"to",
"a",
"list",
"of",
"values",
"for",
"each",
"column",
"Perform",
"necessary",
"type",
"casts",
"and",
"invariant",
"checks"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L226-L271 |
58,272 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.buildRows | private List<String[]> buildRows(List<ColumnTypeDataPair> columns) throws BindException
{
List<String[]> rows = new ArrayList<>();
int numColumns = columns.size();
// columns should have binds
if (columns.get(0).data.isEmpty())
{
throw new BindException("No binds found in first column", Bin... | java | private List<String[]> buildRows(List<ColumnTypeDataPair> columns) throws BindException
{
List<String[]> rows = new ArrayList<>();
int numColumns = columns.size();
// columns should have binds
if (columns.get(0).data.isEmpty())
{
throw new BindException("No binds found in first column", Bin... | [
"private",
"List",
"<",
"String",
"[",
"]",
">",
"buildRows",
"(",
"List",
"<",
"ColumnTypeDataPair",
">",
"columns",
")",
"throws",
"BindException",
"{",
"List",
"<",
"String",
"[",
"]",
">",
"rows",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int"... | Transpose a list of columns and their values to a list of rows
@param columns the list of columns to transpose
@return list of rows
@throws BindException if columns improperly formed | [
"Transpose",
"a",
"list",
"of",
"columns",
"and",
"their",
"values",
"to",
"a",
"list",
"of",
"rows"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L280-L314 |
58,273 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.writeRowsToCSV | private void writeRowsToCSV(List<String[]> rows) throws BindException
{
int numBytes;
int rowNum = 0;
int fileCount = 0;
while (rowNum < rows.size())
{
File file = getFile(++fileCount);
try (OutputStream out = openFile(file))
{
// until we reach the last row or the file... | java | private void writeRowsToCSV(List<String[]> rows) throws BindException
{
int numBytes;
int rowNum = 0;
int fileCount = 0;
while (rowNum < rows.size())
{
File file = getFile(++fileCount);
try (OutputStream out = openFile(file))
{
// until we reach the last row or the file... | [
"private",
"void",
"writeRowsToCSV",
"(",
"List",
"<",
"String",
"[",
"]",
">",
"rows",
")",
"throws",
"BindException",
"{",
"int",
"numBytes",
";",
"int",
"rowNum",
"=",
"0",
";",
"int",
"fileCount",
"=",
"0",
";",
"while",
"(",
"rowNum",
"<",
"rows",... | Write the list of rows to compressed CSV files in the temporary directory
@param rows the list of rows to write out to a file
@throws BindException if exception occurs while writing rows out | [
"Write",
"the",
"list",
"of",
"rows",
"to",
"compressed",
"CSV",
"files",
"in",
"the",
"temporary",
"directory"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L322-L350 |
58,274 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.openFile | private OutputStream openFile(File file) throws BindException
{
try
{
return new GZIPOutputStream(new FileOutputStream(file));
}
catch (IOException ex)
{
throw new BindException(
String.format("Failed to create output file %s: %s", file.toString(), ex.getMessage()), BindExcep... | java | private OutputStream openFile(File file) throws BindException
{
try
{
return new GZIPOutputStream(new FileOutputStream(file));
}
catch (IOException ex)
{
throw new BindException(
String.format("Failed to create output file %s: %s", file.toString(), ex.getMessage()), BindExcep... | [
"private",
"OutputStream",
"openFile",
"(",
"File",
"file",
")",
"throws",
"BindException",
"{",
"try",
"{",
"return",
"new",
"GZIPOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"file",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
... | Create a new output stream for the given file
@param file the file to write out to
@return output stream
@throws BindException raises if it fails to create an output file. | [
"Create",
"a",
"new",
"output",
"stream",
"for",
"the",
"given",
"file"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L370-L381 |
58,275 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.createCSVRecord | private byte[] createCSVRecord(String[] data)
{
StringBuilder sb = new StringBuilder(1024);
for (int i = 0; i < data.length; ++i)
{
if (i > 0)
{
sb.append(',');
}
sb.append(SnowflakeType.escapeForCSV(data[i]));
}
sb.append('\n');
return sb.toString().getBytes(U... | java | private byte[] createCSVRecord(String[] data)
{
StringBuilder sb = new StringBuilder(1024);
for (int i = 0; i < data.length; ++i)
{
if (i > 0)
{
sb.append(',');
}
sb.append(SnowflakeType.escapeForCSV(data[i]));
}
sb.append('\n');
return sb.toString().getBytes(U... | [
"private",
"byte",
"[",
"]",
"createCSVRecord",
"(",
"String",
"[",
"]",
"data",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"1024",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
"++",... | Serialize row to a csv
Duplicated from StreamLoader class
@param data the row to create a csv record from
@return serialized csv for row | [
"Serialize",
"row",
"to",
"a",
"csv",
"Duplicated",
"from",
"StreamLoader",
"class"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L390-L404 |
58,276 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.getPutStmt | private String getPutStmt(String bindDir, String stagePath)
{
return String.format(PUT_STMT, bindDir, File.separator, stagePath)
.replaceAll("\\\\", "\\\\\\\\");
} | java | private String getPutStmt(String bindDir, String stagePath)
{
return String.format(PUT_STMT, bindDir, File.separator, stagePath)
.replaceAll("\\\\", "\\\\\\\\");
} | [
"private",
"String",
"getPutStmt",
"(",
"String",
"bindDir",
",",
"String",
"stagePath",
")",
"{",
"return",
"String",
".",
"format",
"(",
"PUT_STMT",
",",
"bindDir",
",",
"File",
".",
"separator",
",",
"stagePath",
")",
".",
"replaceAll",
"(",
"\"\\\\\\\\\"... | Build PUT statement string. Handle filesystem differences and escaping backslashes.
@param bindDir the local directory which contains files with binds
@param stagePath the stage path to upload to
@return put statement for files in bindDir to stagePath | [
"Build",
"PUT",
"statement",
"string",
".",
"Handle",
"filesystem",
"differences",
"and",
"escaping",
"backslashes",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L413-L417 |
58,277 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.putBinds | private void putBinds() throws BindException
{
createStageIfNeeded();
String putStatement = getPutStmt(bindDir.toString(), stagePath);
for (int i = 0; i < PUT_RETRY_COUNT; i++)
{
try
{
SFStatement statement = new SFStatement(session);
SFBaseResultSet putResult = statement... | java | private void putBinds() throws BindException
{
createStageIfNeeded();
String putStatement = getPutStmt(bindDir.toString(), stagePath);
for (int i = 0; i < PUT_RETRY_COUNT; i++)
{
try
{
SFStatement statement = new SFStatement(session);
SFBaseResultSet putResult = statement... | [
"private",
"void",
"putBinds",
"(",
")",
"throws",
"BindException",
"{",
"createStageIfNeeded",
"(",
")",
";",
"String",
"putStatement",
"=",
"getPutStmt",
"(",
"bindDir",
".",
"toString",
"(",
")",
",",
"stagePath",
")",
";",
"for",
"(",
"int",
"i",
"=",
... | Upload binds from local file to stage
@throws BindException if uploading the binds fails | [
"Upload",
"binds",
"from",
"local",
"file",
"to",
"stage"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L424-L457 |
58,278 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.createStageIfNeeded | private void createStageIfNeeded() throws BindException
{
if (session.getArrayBindStage() != null)
{
return;
}
synchronized (session)
{
// another thread may have created the session by the time we enter this block
if (session.getArrayBindStage() == null)
{
try
... | java | private void createStageIfNeeded() throws BindException
{
if (session.getArrayBindStage() != null)
{
return;
}
synchronized (session)
{
// another thread may have created the session by the time we enter this block
if (session.getArrayBindStage() == null)
{
try
... | [
"private",
"void",
"createStageIfNeeded",
"(",
")",
"throws",
"BindException",
"{",
"if",
"(",
"session",
".",
"getArrayBindStage",
"(",
")",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"synchronized",
"(",
"session",
")",
"{",
"// another thread may have create... | Check whether the session's temporary stage has been created, and create it
if not.
@throws BindException if creating the stage fails | [
"Check",
"whether",
"the",
"session",
"s",
"temporary",
"stage",
"has",
"been",
"created",
"and",
"create",
"it",
"if",
"not",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L465-L492 |
58,279 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.arrayBindValueCount | public static int arrayBindValueCount(Map<String, ParameterBindingDTO> bindValues)
{
if (!isArrayBind(bindValues))
{
return 0;
}
else
{
ParameterBindingDTO bindSample = bindValues.values().iterator().next();
List<String> bindSampleValues = (List<String>) bindSample.getValue();
... | java | public static int arrayBindValueCount(Map<String, ParameterBindingDTO> bindValues)
{
if (!isArrayBind(bindValues))
{
return 0;
}
else
{
ParameterBindingDTO bindSample = bindValues.values().iterator().next();
List<String> bindSampleValues = (List<String>) bindSample.getValue();
... | [
"public",
"static",
"int",
"arrayBindValueCount",
"(",
"Map",
"<",
"String",
",",
"ParameterBindingDTO",
">",
"bindValues",
")",
"{",
"if",
"(",
"!",
"isArrayBind",
"(",
"bindValues",
")",
")",
"{",
"return",
"0",
";",
"}",
"else",
"{",
"ParameterBindingDTO"... | Compute the number of array bind values in the given bind map
@param bindValues the bind map
@return 0 if bindValues is null, has no binds, or is not an array bind
n otherwise, where n is the number of binds in the array bind | [
"Compute",
"the",
"number",
"of",
"array",
"bind",
"values",
"in",
"the",
"given",
"bind",
"map"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L568-L580 |
58,280 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.isArrayBind | public static boolean isArrayBind(Map<String, ParameterBindingDTO> bindValues)
{
if (bindValues == null || bindValues.size() == 0)
{
return false;
}
ParameterBindingDTO bindSample = bindValues.values().iterator().next();
return bindSample.getValue() instanceof List;
} | java | public static boolean isArrayBind(Map<String, ParameterBindingDTO> bindValues)
{
if (bindValues == null || bindValues.size() == 0)
{
return false;
}
ParameterBindingDTO bindSample = bindValues.values().iterator().next();
return bindSample.getValue() instanceof List;
} | [
"public",
"static",
"boolean",
"isArrayBind",
"(",
"Map",
"<",
"String",
",",
"ParameterBindingDTO",
">",
"bindValues",
")",
"{",
"if",
"(",
"bindValues",
"==",
"null",
"||",
"bindValues",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"false",
";... | Return whether the bind map uses array binds
@param bindValues the bind map
@return whether the bind map uses array binds | [
"Return",
"whether",
"the",
"bind",
"map",
"uses",
"array",
"binds"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L588-L596 |
58,281 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageObjectSummary.java | StorageObjectSummary.createFromS3ObjectSummary | public static StorageObjectSummary createFromS3ObjectSummary(S3ObjectSummary objSummary)
{
return new StorageObjectSummary(
objSummary.getBucketName(),
objSummary.getKey(),
// S3 ETag is not always MD5, but since this code path is only
// used in skip duplicate files in PUT comman... | java | public static StorageObjectSummary createFromS3ObjectSummary(S3ObjectSummary objSummary)
{
return new StorageObjectSummary(
objSummary.getBucketName(),
objSummary.getKey(),
// S3 ETag is not always MD5, but since this code path is only
// used in skip duplicate files in PUT comman... | [
"public",
"static",
"StorageObjectSummary",
"createFromS3ObjectSummary",
"(",
"S3ObjectSummary",
"objSummary",
")",
"{",
"return",
"new",
"StorageObjectSummary",
"(",
"objSummary",
".",
"getBucketName",
"(",
")",
",",
"objSummary",
".",
"getKey",
"(",
")",
",",
"// ... | Contructs a StorageObjectSummary object from the S3 equivalent S3ObjectSummary
@param objSummary the AWS S3 ObjectSummary object to copy from
@return the ObjectSummary object created | [
"Contructs",
"a",
"StorageObjectSummary",
"object",
"from",
"the",
"S3",
"equivalent",
"S3ObjectSummary"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageObjectSummary.java#L47-L59 |
58,282 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageObjectSummary.java | StorageObjectSummary.createFromAzureListBlobItem | public static StorageObjectSummary createFromAzureListBlobItem(ListBlobItem listBlobItem)
throws StorageProviderException
{
String location, key, md5;
long size;
// Retrieve the BLOB properties that we need for the Summary
// Azure Storage stores metadata inside each BLOB, therefore the listBlobIte... | java | public static StorageObjectSummary createFromAzureListBlobItem(ListBlobItem listBlobItem)
throws StorageProviderException
{
String location, key, md5;
long size;
// Retrieve the BLOB properties that we need for the Summary
// Azure Storage stores metadata inside each BLOB, therefore the listBlobIte... | [
"public",
"static",
"StorageObjectSummary",
"createFromAzureListBlobItem",
"(",
"ListBlobItem",
"listBlobItem",
")",
"throws",
"StorageProviderException",
"{",
"String",
"location",
",",
"key",
",",
"md5",
";",
"long",
"size",
";",
"// Retrieve the BLOB properties that we n... | Contructs a StorageObjectSummary object from Azure BLOB properties
Using factory methods to create these objects since Azure can throw,
while retrieving the BLOB properties
@param listBlobItem an Azure ListBlobItem object
@return the ObjectSummary object created | [
"Contructs",
"a",
"StorageObjectSummary",
"object",
"from",
"Azure",
"BLOB",
"properties",
"Using",
"factory",
"methods",
"to",
"create",
"these",
"objects",
"since",
"Azure",
"can",
"throw",
"while",
"retrieving",
"the",
"BLOB",
"properties"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageObjectSummary.java#L69-L102 |
58,283 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSession.java | SFSession.isSnowflakeAuthenticator | private boolean isSnowflakeAuthenticator()
{
String authenticator = (String) connectionPropertiesMap.get(
SFSessionProperty.AUTHENTICATOR);
PrivateKey privateKey = (PrivateKey) connectionPropertiesMap.get(
SFSessionProperty.PRIVATE_KEY);
return (authenticator == null && privateKey == nul... | java | private boolean isSnowflakeAuthenticator()
{
String authenticator = (String) connectionPropertiesMap.get(
SFSessionProperty.AUTHENTICATOR);
PrivateKey privateKey = (PrivateKey) connectionPropertiesMap.get(
SFSessionProperty.PRIVATE_KEY);
return (authenticator == null && privateKey == nul... | [
"private",
"boolean",
"isSnowflakeAuthenticator",
"(",
")",
"{",
"String",
"authenticator",
"=",
"(",
"String",
")",
"connectionPropertiesMap",
".",
"get",
"(",
"SFSessionProperty",
".",
"AUTHENTICATOR",
")",
";",
"PrivateKey",
"privateKey",
"=",
"(",
"PrivateKey",
... | If authenticator is null and private key is specified, jdbc will assume
key pair authentication
@return true if authenticator type is SNOWFLAKE (meaning password) | [
"If",
"authenticator",
"is",
"null",
"and",
"private",
"key",
"is",
"specified",
"jdbc",
"will",
"assume",
"key",
"pair",
"authentication"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSession.java#L333-L344 |
58,284 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSession.java | SFSession.isExternalbrowserAuthenticator | boolean isExternalbrowserAuthenticator()
{
String authenticator = (String) connectionPropertiesMap.get(
SFSessionProperty.AUTHENTICATOR);
return ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER.name()
.equalsIgnoreCase(authenticator);
} | java | boolean isExternalbrowserAuthenticator()
{
String authenticator = (String) connectionPropertiesMap.get(
SFSessionProperty.AUTHENTICATOR);
return ClientAuthnDTO.AuthenticatorType.EXTERNALBROWSER.name()
.equalsIgnoreCase(authenticator);
} | [
"boolean",
"isExternalbrowserAuthenticator",
"(",
")",
"{",
"String",
"authenticator",
"=",
"(",
"String",
")",
"connectionPropertiesMap",
".",
"get",
"(",
"SFSessionProperty",
".",
"AUTHENTICATOR",
")",
";",
"return",
"ClientAuthnDTO",
".",
"AuthenticatorType",
".",
... | Returns true If authenticator is EXTERNALBROWSER.
@return true if authenticator type is EXTERNALBROWSER | [
"Returns",
"true",
"If",
"authenticator",
"is",
"EXTERNALBROWSER",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSession.java#L351-L357 |
58,285 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSession.java | SFSession.renewSession | synchronized void renewSession(String prevSessionToken)
throws SFException, SnowflakeSQLException
{
if (sessionToken != null &&
!sessionToken.equals(prevSessionToken))
{
logger.debug("not renew session because session token has not been updated.");
return;
}
SessionUtil.LoginInp... | java | synchronized void renewSession(String prevSessionToken)
throws SFException, SnowflakeSQLException
{
if (sessionToken != null &&
!sessionToken.equals(prevSessionToken))
{
logger.debug("not renew session because session token has not been updated.");
return;
}
SessionUtil.LoginInp... | [
"synchronized",
"void",
"renewSession",
"(",
"String",
"prevSessionToken",
")",
"throws",
"SFException",
",",
"SnowflakeSQLException",
"{",
"if",
"(",
"sessionToken",
"!=",
"null",
"&&",
"!",
"sessionToken",
".",
"equals",
"(",
"prevSessionToken",
")",
")",
"{",
... | A helper function to call global service and renew session.
@param prevSessionToken the session token that has expired
@throws SnowflakeSQLException if failed to renew the session
@throws SFException if failed to renew the session | [
"A",
"helper",
"function",
"to",
"call",
"global",
"service",
"and",
"renew",
"session",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSession.java#L608-L638 |
58,286 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSession.java | SFSession.startHeartbeatForThisSession | protected void startHeartbeatForThisSession()
{
if (enableHeartbeat && !Strings.isNullOrEmpty(masterToken))
{
logger.debug("start heartbeat, master token validity: " +
masterTokenValidityInSeconds);
HeartbeatBackground.getInstance().addSession(this,
... | java | protected void startHeartbeatForThisSession()
{
if (enableHeartbeat && !Strings.isNullOrEmpty(masterToken))
{
logger.debug("start heartbeat, master token validity: " +
masterTokenValidityInSeconds);
HeartbeatBackground.getInstance().addSession(this,
... | [
"protected",
"void",
"startHeartbeatForThisSession",
"(",
")",
"{",
"if",
"(",
"enableHeartbeat",
"&&",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"masterToken",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"start heartbeat, master token validity: \"",
"+",
"master... | Start heartbeat for this session | [
"Start",
"heartbeat",
"for",
"this",
"session"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSession.java#L683-L697 |
58,287 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSession.java | SFSession.stopHeartbeatForThisSession | protected void stopHeartbeatForThisSession()
{
if (enableHeartbeat && !Strings.isNullOrEmpty(masterToken))
{
logger.debug("stop heartbeat");
HeartbeatBackground.getInstance().removeSession(this);
}
else
{
logger.debug("heartbeat not enabled for the session");
}
} | java | protected void stopHeartbeatForThisSession()
{
if (enableHeartbeat && !Strings.isNullOrEmpty(masterToken))
{
logger.debug("stop heartbeat");
HeartbeatBackground.getInstance().removeSession(this);
}
else
{
logger.debug("heartbeat not enabled for the session");
}
} | [
"protected",
"void",
"stopHeartbeatForThisSession",
"(",
")",
"{",
"if",
"(",
"enableHeartbeat",
"&&",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"masterToken",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"stop heartbeat\"",
")",
";",
"HeartbeatBackground",
".... | Stop heartbeat for this session | [
"Stop",
"heartbeat",
"for",
"this",
"session"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSession.java#L702-L714 |
58,288 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSession.java | SFSession.heartbeat | protected void heartbeat() throws SFException, SQLException
{
logger.debug(" public void heartbeat()");
if (isClosed)
{
return;
}
HttpPost postRequest = null;
String requestId = UUID.randomUUID().toString();
boolean retry = false;
// the loop for retrying if it runs into ses... | java | protected void heartbeat() throws SFException, SQLException
{
logger.debug(" public void heartbeat()");
if (isClosed)
{
return;
}
HttpPost postRequest = null;
String requestId = UUID.randomUUID().toString();
boolean retry = false;
// the loop for retrying if it runs into ses... | [
"protected",
"void",
"heartbeat",
"(",
")",
"throws",
"SFException",
",",
"SQLException",
"{",
"logger",
".",
"debug",
"(",
"\" public void heartbeat()\"",
")",
";",
"if",
"(",
"isClosed",
")",
"{",
"return",
";",
"}",
"HttpPost",
"postRequest",
"=",
"null",
... | Send heartbeat for the session
@throws SFException exception raised from Snowflake
@throws SQLException exception raised from SQL generic layers | [
"Send",
"heartbeat",
"for",
"the",
"session"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSession.java#L722-L811 |
58,289 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFSession.java | SFSession.setCurrentObjects | void setCurrentObjects(
SessionUtil.LoginInput loginInput, SessionUtil.LoginOutput loginOutput)
{
this.sessionToken = loginOutput.sessionToken; // used to run the commands.
runInternalCommand(
"USE ROLE IDENTIFIER(?)", loginInput.getRole());
runInternalCommand(
"USE WAREHOUSE IDENTIF... | java | void setCurrentObjects(
SessionUtil.LoginInput loginInput, SessionUtil.LoginOutput loginOutput)
{
this.sessionToken = loginOutput.sessionToken; // used to run the commands.
runInternalCommand(
"USE ROLE IDENTIFIER(?)", loginInput.getRole());
runInternalCommand(
"USE WAREHOUSE IDENTIF... | [
"void",
"setCurrentObjects",
"(",
"SessionUtil",
".",
"LoginInput",
"loginInput",
",",
"SessionUtil",
".",
"LoginOutput",
"loginOutput",
")",
"{",
"this",
".",
"sessionToken",
"=",
"loginOutput",
".",
"sessionToken",
";",
"// used to run the commands.",
"runInternalComm... | Sets the current objects if the session is not up to date. It can happen
if the session is created by the id token, which doesn't carry the current
objects.
@param loginInput
@param loginOutput | [
"Sets",
"the",
"current",
"objects",
"if",
"the",
"session",
"is",
"not",
"up",
"to",
"date",
".",
"It",
"can",
"happen",
"if",
"the",
"session",
"is",
"created",
"by",
"the",
"id",
"token",
"which",
"doesn",
"t",
"carry",
"the",
"current",
"objects",
... | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFSession.java#L1199-L1227 |
58,290 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java | SnowflakeConnectionV1.executeImmediate | private void executeImmediate(String stmtText) throws SQLException
{
// execute the statement and auto-close it as well
try (final Statement statement = this.createStatement())
{
statement.execute(stmtText);
}
} | java | private void executeImmediate(String stmtText) throws SQLException
{
// execute the statement and auto-close it as well
try (final Statement statement = this.createStatement())
{
statement.execute(stmtText);
}
} | [
"private",
"void",
"executeImmediate",
"(",
"String",
"stmtText",
")",
"throws",
"SQLException",
"{",
"// execute the statement and auto-close it as well",
"try",
"(",
"final",
"Statement",
"statement",
"=",
"this",
".",
"createStatement",
"(",
")",
")",
"{",
"stateme... | Execute a statement where the result isn't needed, and the statement is
closed before this method returns
@param stmtText text of the statement
@throws SQLException exception thrown it the statement fails to execute | [
"Execute",
"a",
"statement",
"where",
"the",
"result",
"isn",
"t",
"needed",
"and",
"the",
"statement",
"is",
"closed",
"before",
"this",
"method",
"returns"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java#L275-L282 |
58,291 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java | SnowflakeConnectionV1.createStatement | @Override
public Statement createStatement() throws SQLException
{
raiseSQLExceptionIfConnectionIsClosed();
Statement stmt = createStatement(
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
openStatements.add(stmt);
return stmt;
} | java | @Override
public Statement createStatement() throws SQLException
{
raiseSQLExceptionIfConnectionIsClosed();
Statement stmt = createStatement(
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
openStatements.add(stmt);
return stmt;
} | [
"@",
"Override",
"public",
"Statement",
"createStatement",
"(",
")",
"throws",
"SQLException",
"{",
"raiseSQLExceptionIfConnectionIsClosed",
"(",
")",
";",
"Statement",
"stmt",
"=",
"createStatement",
"(",
"ResultSet",
".",
"TYPE_FORWARD_ONLY",
",",
"ResultSet",
".",
... | Create a statement
@return statement statement object
@throws SQLException if failed to create a snowflake statement | [
"Create",
"a",
"statement"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java#L290-L299 |
58,292 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java | SnowflakeConnectionV1.setTransactionIsolation | @Override
public void setTransactionIsolation(int level) throws SQLException
{
logger.debug(
"void setTransactionIsolation(int level), level = {}", level);
raiseSQLExceptionIfConnectionIsClosed();
if (level == Connection.TRANSACTION_NONE
|| level == Connection.TRANSACTION_READ_COMMITTED)... | java | @Override
public void setTransactionIsolation(int level) throws SQLException
{
logger.debug(
"void setTransactionIsolation(int level), level = {}", level);
raiseSQLExceptionIfConnectionIsClosed();
if (level == Connection.TRANSACTION_NONE
|| level == Connection.TRANSACTION_READ_COMMITTED)... | [
"@",
"Override",
"public",
"void",
"setTransactionIsolation",
"(",
"int",
"level",
")",
"throws",
"SQLException",
"{",
"logger",
".",
"debug",
"(",
"\"void setTransactionIsolation(int level), level = {}\"",
",",
"level",
")",
";",
"raiseSQLExceptionIfConnectionIsClosed",
... | Sets the transaction isolation level.
@param level transaction level: TRANSACTION_NONE or TRANSACTION_READ_COMMITTED
@throws SQLException if any SQL error occurs | [
"Sets",
"the",
"transaction",
"isolation",
"level",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java#L501-L519 |
58,293 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java | SnowflakeConnectionV1.downloadStream | public InputStream downloadStream(String stageName, String sourceFileName,
boolean decompress) throws SQLException
{
logger.debug("download data to stream: stageName={}" +
", sourceFileName={}",
stageName, sourceFileName);
if (Strings.isN... | java | public InputStream downloadStream(String stageName, String sourceFileName,
boolean decompress) throws SQLException
{
logger.debug("download data to stream: stageName={}" +
", sourceFileName={}",
stageName, sourceFileName);
if (Strings.isN... | [
"public",
"InputStream",
"downloadStream",
"(",
"String",
"stageName",
",",
"String",
"sourceFileName",
",",
"boolean",
"decompress",
")",
"throws",
"SQLException",
"{",
"logger",
".",
"debug",
"(",
"\"download data to stream: stageName={}\"",
"+",
"\", sourceFileName={}\... | Download file from the given stage and return an input stream
@param stageName stage name
@param sourceFileName file path in stage
@param decompress true if file compressed
@return an input stream
@throws SnowflakeSQLException if any SQL error occurs. | [
"Download",
"file",
"from",
"the",
"given",
"stage",
"and",
"return",
"an",
"input",
"stream"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeConnectionV1.java#L1100-L1179 |
58,294 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/EncryptionProvider.java | EncryptionProvider.decryptStream | public static InputStream decryptStream(InputStream inputStream,
String keyBase64,
String ivBase64,
RemoteStoreFileEncryptionMaterial encMat)
throws NoSuchPaddingException, NoSuchAlgorithmExce... | java | public static InputStream decryptStream(InputStream inputStream,
String keyBase64,
String ivBase64,
RemoteStoreFileEncryptionMaterial encMat)
throws NoSuchPaddingException, NoSuchAlgorithmExce... | [
"public",
"static",
"InputStream",
"decryptStream",
"(",
"InputStream",
"inputStream",
",",
"String",
"keyBase64",
",",
"String",
"ivBase64",
",",
"RemoteStoreFileEncryptionMaterial",
"encMat",
")",
"throws",
"NoSuchPaddingException",
",",
"NoSuchAlgorithmException",
",",
... | Decrypt a InputStream | [
"Decrypt",
"a",
"InputStream"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/EncryptionProvider.java#L52-L86 |
58,295 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/EventHandler.java | EventHandler.startFlusher | synchronized void startFlusher()
{
// Create a new scheduled executor service with a threadfactory that
// creates daemonized threads; this way if the user doesn't exit nicely
// the JVM Runtime won't hang
flusher =
Executors.newScheduledThreadPool(1,
n... | java | synchronized void startFlusher()
{
// Create a new scheduled executor service with a threadfactory that
// creates daemonized threads; this way if the user doesn't exit nicely
// the JVM Runtime won't hang
flusher =
Executors.newScheduledThreadPool(1,
n... | [
"synchronized",
"void",
"startFlusher",
"(",
")",
"{",
"// Create a new scheduled executor service with a threadfactory that",
"// creates daemonized threads; this way if the user doesn't exit nicely",
"// the JVM Runtime won't hang",
"flusher",
"=",
"Executors",
".",
"newScheduledThreadPo... | Creates and runs a new QueueFlusher thread | [
"Creates",
"and",
"runs",
"a",
"new",
"QueueFlusher",
"thread"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/EventHandler.java#L194-L217 |
58,296 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/EventHandler.java | EventHandler.dumpLogBuffer | public void dumpLogBuffer(String identifier)
{
final ArrayList<LogRecord> logBufferCopy;
final PrintWriter logDumper;
final OutputStream outStream;
Formatter formatter = this.getFormatter();
// Check if compression of dump file is enabled
boolean disableCompression =
System.getPropert... | java | public void dumpLogBuffer(String identifier)
{
final ArrayList<LogRecord> logBufferCopy;
final PrintWriter logDumper;
final OutputStream outStream;
Formatter formatter = this.getFormatter();
// Check if compression of dump file is enabled
boolean disableCompression =
System.getPropert... | [
"public",
"void",
"dumpLogBuffer",
"(",
"String",
"identifier",
")",
"{",
"final",
"ArrayList",
"<",
"LogRecord",
">",
"logBufferCopy",
";",
"final",
"PrintWriter",
"logDumper",
";",
"final",
"OutputStream",
"outStream",
";",
"Formatter",
"formatter",
"=",
"this",... | Dumps the contents of the in-memory log buffer to disk and clears the buffer.
@param identifier event id | [
"Dumps",
"the",
"contents",
"of",
"the",
"in",
"-",
"memory",
"log",
"buffer",
"to",
"disk",
"and",
"clears",
"the",
"buffer",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/EventHandler.java#L309-L385 |
58,297 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/EventHandler.java | EventHandler.cleanupSfDumps | protected void cleanupSfDumps(boolean deleteOldest)
{
// Check what the maximum number of dumpfiles and the max allowable
// aggregate dump file size is.
int maxDumpFiles =
System.getProperty(MAX_NUM_DUMP_FILES_PROP) != null ?
Integer.valueOf(System.getProperty(MAX_NUM_DUMP_FILES_PROP)) :
... | java | protected void cleanupSfDumps(boolean deleteOldest)
{
// Check what the maximum number of dumpfiles and the max allowable
// aggregate dump file size is.
int maxDumpFiles =
System.getProperty(MAX_NUM_DUMP_FILES_PROP) != null ?
Integer.valueOf(System.getProperty(MAX_NUM_DUMP_FILES_PROP)) :
... | [
"protected",
"void",
"cleanupSfDumps",
"(",
"boolean",
"deleteOldest",
")",
"{",
"// Check what the maximum number of dumpfiles and the max allowable",
"// aggregate dump file size is.",
"int",
"maxDumpFiles",
"=",
"System",
".",
"getProperty",
"(",
"MAX_NUM_DUMP_FILES_PROP",
")"... | Function to remove old Snowflake Dump files to make room for new ones.
@param deleteOldest if true, always deletes the oldest file found if max
number of dump files has been reached | [
"Function",
"to",
"remove",
"old",
"Snowflake",
"Dump",
"files",
"to",
"make",
"room",
"for",
"new",
"ones",
"."
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/EventHandler.java#L393-L466 |
58,298 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/EventHandler.java | EventHandler.needsToThrottle | private synchronized boolean needsToThrottle(String signature)
{
AtomicInteger sigCount;
// Are we already throttling this signature?
if (throttledIncidents.containsKey(signature))
{
// Lazily check if it's time to unthrottle
if (throttledIncidents.get(signature).plusHours(THROTTLE_DURATI... | java | private synchronized boolean needsToThrottle(String signature)
{
AtomicInteger sigCount;
// Are we already throttling this signature?
if (throttledIncidents.containsKey(signature))
{
// Lazily check if it's time to unthrottle
if (throttledIncidents.get(signature).plusHours(THROTTLE_DURATI... | [
"private",
"synchronized",
"boolean",
"needsToThrottle",
"(",
"String",
"signature",
")",
"{",
"AtomicInteger",
"sigCount",
";",
"// Are we already throttling this signature?",
"if",
"(",
"throttledIncidents",
".",
"containsKey",
"(",
"signature",
")",
")",
"{",
"// Laz... | Checks to see if the reporting of an incident should be throttled due
to the number of times the signature has been seen in the last hour
@param signature incident signature
@return true if incidents needs to be throttled | [
"Checks",
"to",
"see",
"if",
"the",
"reporting",
"of",
"an",
"incident",
"should",
"be",
"throttled",
"due",
"to",
"the",
"number",
"of",
"times",
"the",
"signature",
"has",
"been",
"seen",
"in",
"the",
"last",
"hour"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/EventHandler.java#L504-L540 |
58,299 | snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/loader/StreamLoader.java | StreamLoader.start | @Override
public void start()
{
LOGGER.debug("Start Loading");
// validate parameters
validateParameters();
if (_op == null)
{
this.abort(new ConnectionError("Loader started with no operation"));
return;
}
initDateFormats();
initQueues();
if (_is_first_start_call)... | java | @Override
public void start()
{
LOGGER.debug("Start Loading");
// validate parameters
validateParameters();
if (_op == null)
{
this.abort(new ConnectionError("Loader started with no operation"));
return;
}
initDateFormats();
initQueues();
if (_is_first_start_call)... | [
"@",
"Override",
"public",
"void",
"start",
"(",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Start Loading\"",
")",
";",
"// validate parameters",
"validateParameters",
"(",
")",
";",
"if",
"(",
"_op",
"==",
"null",
")",
"{",
"this",
".",
"abort",
"(",
"ne... | Starts the loader | [
"Starts",
"the",
"loader"
] | 98567b5a57753f29d51446809640b969a099658f | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/loader/StreamLoader.java#L361-L420 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.