idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
29,400
public boolean isApprovalNeeded ( final Rollout rollout ) { final UserDetails userDetails = this . getActor ( rollout ) ; final boolean approvalEnabled = this . tenantConfigurationManagement . getConfigurationValue ( TenantConfigurationKey . ROLLOUT_APPROVAL_ENABLED , Boolean . class ) . getValue ( ) ; return approvalE...
Returns true if rollout approval is enabled and rollout creator doesn t have approval role .
29,401
protected Date handleUnparsableDateString ( final String value ) throws ConversionException { try { return durationFormat . parse ( value ) ; } catch ( final ParseException e1 ) { try { return additionalFormat . parse ( "000000" . substring ( value . length ( ) <= 6 ? value . length ( ) : 6 ) + value ) ; } catch ( fina...
This method is called to handle a non - empty date string from the client if the client could not parse it as a Date . In the current case two different parsing schemas are tried . If parsing is not possible a ConversionException is thrown which marks the DurationField as invalid .
29,402
public void setDuration ( final Duration duration ) { if ( duration . compareTo ( MAXIMUM_DURATION ) > 0 ) { throw new IllegalArgumentException ( "The duaration has to be smaller than 23:59:59." ) ; } super . setValue ( durationToDate ( duration ) ) ; }
Sets the duration value
29,403
public void setMinimumDuration ( final Duration minimumDuration ) { if ( minimumDuration . compareTo ( MAXIMUM_DURATION ) > 0 ) { throw new IllegalArgumentException ( "The minimum duaration has to be smaller than 23:59:59." ) ; } this . minimumDuration = durationToDate ( minimumDuration ) ; }
Sets the minimal allowed duration value as a String
29,404
public void setMaximumDuration ( final Duration maximumDuration ) { if ( maximumDuration . compareTo ( MAXIMUM_DURATION ) > 0 ) { throw new IllegalArgumentException ( "The maximum duaration has to be smaller than 23:59:59." ) ; } this . maximumDuration = durationToDate ( maximumDuration ) ; }
Sets the maximum allowed duration value as a String
29,405
private int compareTimeOfDates ( final Date d1 , final Date d2 ) { final LocalTime lt1 = LocalDateTime . ofInstant ( d1 . toInstant ( ) , ZONEID_UTC ) . toLocalTime ( ) ; final LocalTime lt2 = LocalDateTime . ofInstant ( d2 . toInstant ( ) , ZONEID_UTC ) . toLocalTime ( ) ; return lt1 . compareTo ( lt2 ) ; }
Because parsing done by base class returns a different date than parsing done by the user or converting duration to a date . But for the DurationField comparison only the time is important . This function helps comparing the time and ignores the values for day month and year .
29,406
private void maxArtifactDetails ( ) { final Boolean flag = ( Boolean ) maxMinButton . getData ( ) ; if ( flag == null || Boolean . FALSE . equals ( flag ) ) { maximizedArtifactDetailsView ( ) ; } else { minimizedArtifactDetailsView ( ) ; } }
will be used by button click listener of action history expand icon .
29,407
public void createMaxArtifactDetailsTable ( ) { maxArtifactDetailsTable = createArtifactDetailsTable ( ) ; maxArtifactDetailsTable . setId ( UIComponentIdProvider . UPLOAD_ARTIFACT_DETAILS_TABLE_MAX ) ; maxArtifactDetailsTable . setContainerDataSource ( artifactDetailsTable . getContainerDataSource ( ) ) ; addGenerated...
Create Max artifact details Table .
29,408
public void populateArtifactDetails ( final SoftwareModule softwareModule ) { if ( softwareModule == null ) { populateArtifactDetails ( null , null ) ; } else { populateArtifactDetails ( softwareModule . getId ( ) , HawkbitCommonUtil . getFormattedNameVersion ( softwareModule . getName ( ) , softwareModule . getVersion...
Populate artifact details .
29,409
private void setTitleOfLayoutHeader ( ) { titleOfArtifactDetails . setValue ( HawkbitCommonUtil . getArtifactoryDetailsLabelId ( "" , i18n ) ) ; titleOfArtifactDetails . setContentMode ( ContentMode . HTML ) ; }
Set title of artifact details header layout .
29,410
public RolloutGroupConditionBuilder successCondition ( final RolloutGroupSuccessCondition condition , final String expression ) { conditions . setSuccessCondition ( condition ) ; conditions . setSuccessConditionExp ( expression ) ; return this ; }
Sets the finish condition and expression on the builder .
29,411
public RolloutGroupConditionBuilder successAction ( final RolloutGroupSuccessAction action , final String expression ) { conditions . setSuccessAction ( action ) ; conditions . setSuccessActionExp ( expression ) ; return this ; }
Sets the success action and expression on the builder .
29,412
public RolloutGroupConditionBuilder errorCondition ( final RolloutGroupErrorCondition condition , final String expression ) { conditions . setErrorCondition ( condition ) ; conditions . setErrorConditionExp ( expression ) ; return this ; }
Sets the error condition and expression on the builder .
29,413
public RolloutGroupConditionBuilder errorAction ( final RolloutGroupErrorAction action , final String expression ) { conditions . setErrorAction ( action ) ; conditions . setErrorActionExp ( expression ) ; return this ; }
Sets the error action and expression on the builder .
29,414
public RolloutGroupConditionBuilder withDefaults ( ) { successCondition ( RolloutGroupSuccessCondition . THRESHOLD , "50" ) ; successAction ( RolloutGroupSuccessAction . NEXTGROUP , "" ) ; errorCondition ( RolloutGroupErrorCondition . THRESHOLD , "50" ) ; errorAction ( RolloutGroupErrorAction . PAUSE , "" ) ; return th...
Sets condition defaults .
29,415
public AnonymousIpResponse anonymousIp ( InetAddress ipAddress ) throws IOException , GeoIp2Exception { return this . get ( ipAddress , AnonymousIpResponse . class , "GeoIP2-Anonymous-IP" ) ; }
Look up an IP address in a GeoIP2 Anonymous IP .
29,416
public AsnResponse asn ( InetAddress ipAddress ) throws IOException , GeoIp2Exception { return this . get ( ipAddress , AsnResponse . class , "GeoLite2-ASN" ) ; }
Look up an IP address in a GeoLite2 ASN database .
29,417
public ConnectionTypeResponse connectionType ( InetAddress ipAddress ) throws IOException , GeoIp2Exception { return this . get ( ipAddress , ConnectionTypeResponse . class , "GeoIP2-Connection-Type" ) ; }
Look up an IP address in a GeoIP2 Connection Type database .
29,418
public DomainResponse domain ( InetAddress ipAddress ) throws IOException , GeoIp2Exception { return this . get ( ipAddress , DomainResponse . class , "GeoIP2-Domain" ) ; }
Look up an IP address in a GeoIP2 Domain database .
29,419
public EnterpriseResponse enterprise ( InetAddress ipAddress ) throws IOException , GeoIp2Exception { return this . get ( ipAddress , EnterpriseResponse . class , "Enterprise" ) ; }
Look up an IP address in a GeoIP2 Enterprise database .
29,420
public IspResponse isp ( InetAddress ipAddress ) throws IOException , GeoIp2Exception { return this . get ( ipAddress , IspResponse . class , "GeoIP2-ISP" ) ; }
Look up an IP address in a GeoIP2 ISP database .
29,421
public void addListener ( Listener listener , long listenerCheckMillis ) { queue . add ( listener ) ; long newFrequency = Math . min ( MINIMUM_CHECK_DELAY_MILLIS , listenerCheckMillis ) ; if ( currentScheduledFrequency . get ( ) == - 1 ) { if ( currentScheduledFrequency . compareAndSet ( - 1 , newFrequency ) ) { fixedS...
Add listener to validation list .
29,422
public void removeListener ( Listener listener ) { queue . remove ( listener ) ; if ( queue . isEmpty ( ) ) { synchronized ( queue ) { if ( currentScheduledFrequency . get ( ) > 0 && queue . isEmpty ( ) ) { currentScheduledFrequency . set ( - 1 ) ; } } } }
Remove listener to validation list .
29,423
public TraceObject put ( TraceObject value ) { String key = increment . incrementAndGet ( ) + "- " + DateTimeFormatter . ISO_INSTANT . format ( Instant . now ( ) ) ; return put ( key , value ) ; }
Add value to map .
29,424
public synchronized String printStack ( ) { StringBuilder sb = new StringBuilder ( ) ; Set < Map . Entry < String , TraceObject > > set = entrySet ( ) ; for ( Map . Entry < String , TraceObject > entry : set ) { TraceObject traceObj = entry . getValue ( ) ; String key = entry . getKey ( ) ; String indicator = "" ; swit...
Value of trace cache in a readable format .
29,425
public synchronized void clearMemory ( ) { Collection < TraceObject > traceObjects = values ( ) ; for ( TraceObject traceObject : traceObjects ) { traceObject . remove ( ) ; } this . clear ( ) ; }
Permit to clear array s of array to help garbage .
29,426
private Object handleFailOver ( SQLException qe , Method method , Object [ ] args , Protocol protocol ) throws Throwable { HostAddress failHostAddress = null ; boolean failIsMaster = true ; if ( protocol != null ) { failHostAddress = protocol . getHostAddress ( ) ; failIsMaster = protocol . isMasterConnection ( ) ; } H...
After a connection exception launch failover .
29,427
public boolean hasToHandleFailover ( SQLException exception ) { return exception . getSQLState ( ) != null && ( exception . getSQLState ( ) . startsWith ( "08" ) || ( exception . getSQLState ( ) . equals ( "70100" ) && 1927 == exception . getErrorCode ( ) ) ) ; }
Check if this Sqlerror is a connection exception . if that s the case must be handle by failover
29,428
public void reconnect ( ) throws SQLException { try { listener . reconnect ( ) ; } catch ( SQLException e ) { ExceptionMapper . throwException ( e , null , null ) ; } }
Launch reconnect implementation .
29,429
public String readStringNullEnd ( final Charset charset ) { int initialPosition = position ; int cnt = 0 ; while ( remaining ( ) > 0 && ( buf [ position ++ ] != 0 ) ) { cnt ++ ; } return new String ( buf , initialPosition , cnt , charset ) ; }
Reads a string from the buffer looks for a 0 to end the string .
29,430
public byte [ ] readBytesNullEnd ( ) { int initialPosition = position ; int cnt = 0 ; while ( remaining ( ) > 0 && ( buf [ position ++ ] != 0 ) ) { cnt ++ ; } final byte [ ] tmpArr = new byte [ cnt ] ; System . arraycopy ( buf , initialPosition , tmpArr , 0 , cnt ) ; return tmpArr ; }
Reads a byte array from the buffer looks for a 0 to end the array .
29,431
public String readStringLengthEncoded ( final Charset charset ) { int length = ( int ) getLengthEncodedNumeric ( ) ; String string = new String ( buf , position , length , charset ) ; position += length ; return string ; }
Reads length - encoded string .
29,432
public String readString ( final int numberOfBytes ) { position += numberOfBytes ; return new String ( buf , position - numberOfBytes , numberOfBytes ) ; }
Read String with defined length .
29,433
public byte [ ] readRawBytes ( final int numberOfBytes ) { final byte [ ] tmpArr = new byte [ numberOfBytes ] ; System . arraycopy ( buf , position , tmpArr , 0 , numberOfBytes ) ; position += numberOfBytes ; return tmpArr ; }
Read raw data .
29,434
public void skipLengthEncodedBytes ( ) { int type = this . buf [ this . position ++ ] & 0xff ; switch ( type ) { case 251 : break ; case 252 : position += 2 + ( 0xffff & ( ( ( buf [ position ] & 0xff ) + ( ( buf [ position + 1 ] & 0xff ) << 8 ) ) ) ) ; break ; case 253 : position += 3 + ( 0xffffff & ( ( buf [ position ...
Skip next length encode binary data .
29,435
public byte [ ] getLengthEncodedBytes ( ) { int type = this . buf [ this . position ++ ] & 0xff ; int length ; switch ( type ) { case 251 : return null ; case 252 : length = 0xffff & readShort ( ) ; break ; case 253 : length = 0xffffff & read24bitword ( ) ; break ; case 254 : length = ( int ) ( ( buf [ position ++ ] & ...
Get next data bytes with length encoded prefix .
29,436
public void writeStringSmallLength ( byte [ ] value ) { int length = value . length ; while ( remaining ( ) < length + 1 ) { grow ( ) ; } buf [ position ++ ] = ( byte ) length ; System . arraycopy ( value , 0 , buf , position , length ) ; position += length ; }
Write value with length encoded prefix . value length MUST be less than 251 char
29,437
public void writeBytes ( byte header , byte [ ] bytes ) { int length = bytes . length ; while ( remaining ( ) < length + 10 ) { grow ( ) ; } writeLength ( length + 1 ) ; buf [ position ++ ] = header ; System . arraycopy ( bytes , 0 , buf , position , length ) ; position += length ; }
Write bytes .
29,438
public void writeLength ( long length ) { if ( length < 251 ) { buf [ position ++ ] = ( byte ) length ; } else if ( length < 65536 ) { buf [ position ++ ] = ( byte ) 0xfc ; buf [ position ++ ] = ( byte ) length ; buf [ position ++ ] = ( byte ) ( length >>> 8 ) ; } else if ( length < 16777216 ) { buf [ position ++ ] = (...
Write length .
29,439
public static void writeCmd ( final int statementId , final ParameterHolder [ ] parameters , final int parameterCount , ColumnType [ ] parameterTypeHeader , final PacketOutputStream pos , final byte cursorFlag ) throws IOException { pos . write ( Packet . COM_STMT_EXECUTE ) ; pos . writeInt ( statementId ) ; pos . writ...
Write COM_STMT_EXECUTE sub - command to output buffer .
29,440
public static void send ( final PacketOutputStream pos , final int statementId , final ParameterHolder [ ] parameters , final int parameterCount , ColumnType [ ] parameterTypeHeader , byte cursorFlag ) throws IOException { pos . startPacket ( 0 ) ; writeCmd ( statementId , parameters , parameterCount , parameterTypeHea...
Send a prepare statement binary stream .
29,441
private void execute ( String command ) throws XAException { try { connection . createStatement ( ) . execute ( command ) ; } catch ( SQLException sqle ) { throw mapXaException ( sqle ) ; } }
Execute a query .
29,442
private String exWithQuery ( String message , PrepareResult serverPrepareResult , ParameterHolder [ ] parameters ) { if ( options . dumpQueriesOnException ) { StringBuilder sql = new StringBuilder ( serverPrepareResult . getSql ( ) ) ; if ( serverPrepareResult . getParamCount ( ) > 0 ) { sql . append ( ", parameters ["...
Return exception message with query .
29,443
public byte [ ] getPacketArray ( boolean reUsable ) throws IOException { byte [ ] cachePacket = getNextCachePacket ( ) ; if ( cachePacket != null ) { return cachePacket ; } do { readBlocking ( header , 7 ) ; int compressedLength = ( header [ 0 ] & 0xff ) + ( ( header [ 1 ] & 0xff ) << 8 ) + ( ( header [ 2 ] & 0xff ) <<...
Get next packet . Packet can be compressed and if so can contain many standard packet .
29,444
public static void throwException ( SQLException exception , MariaDbConnection connection , MariaDbStatement statement ) throws SQLException { throw getException ( exception , connection , statement , false ) ; }
Helper to throw exception .
29,445
public static void checkConnectionException ( SQLException exception , MariaDbConnection connection ) { if ( exception . getSQLState ( ) != null ) { SqlStates state = SqlStates . fromString ( exception . getSQLState ( ) ) ; if ( SqlStates . CONNECTION_EXCEPTION . equals ( state ) ) { connection . setHostFailed ( ) ; if...
Check connection exception to report to poolConnection listeners .
29,446
public static MariaDbConnection newConnection ( UrlParser urlParser , GlobalStateInfo globalInfo ) throws SQLException { if ( urlParser . getOptions ( ) . pool ) { return Pools . retrievePool ( urlParser ) . getConnection ( ) ; } Protocol protocol = Utils . retrieveProxy ( urlParser , globalInfo ) ; return new MariaDbC...
Create new connection Object .
29,447
public static String unquoteIdentifier ( String string ) { if ( string != null && string . startsWith ( "`" ) && string . endsWith ( "`" ) && string . length ( ) >= 2 ) { return string . substring ( 1 , string . length ( ) - 1 ) . replace ( "``" , "`" ) ; } return string ; }
UnQuote string .
29,448
public ClientSidePreparedStatement clientPrepareStatement ( final String sql ) throws SQLException { return new ClientSidePreparedStatement ( this , sql , ResultSet . TYPE_FORWARD_ONLY , ResultSet . CONCUR_READ_ONLY , Statement . RETURN_GENERATED_KEYS ) ; }
Create a new client prepared statement .
29,449
public ServerSidePreparedStatement serverPrepareStatement ( final String sql ) throws SQLException { return new ServerSidePreparedStatement ( this , sql , ResultSet . TYPE_FORWARD_ONLY , ResultSet . CONCUR_READ_ONLY , Statement . RETURN_GENERATED_KEYS ) ; }
Create a new server prepared statement .
29,450
public PreparedStatement prepareStatement ( final String sql ) throws SQLException { return internalPrepareStatement ( sql , ResultSet . TYPE_FORWARD_ONLY , ResultSet . CONCUR_READ_ONLY , Statement . NO_GENERATED_KEYS ) ; }
creates a new prepared statement .
29,451
private PreparedStatement internalPrepareStatement ( final String sql , final int resultSetScrollType , final int resultSetConcurrency , final int autoGeneratedKeys ) throws SQLException { if ( sql != null ) { String sqlQuery = Utils . nativeSql ( sql , protocol . noBackslashEscapes ( ) ) ; if ( options . useServerPrep...
Send ServerPrepareStatement or ClientPrepareStatement depending on SQL query and options If server side and PREPARE can be delayed a facade will be return to have a fallback on client prepareStatement .
29,452
public void commit ( ) throws SQLException { lock . lock ( ) ; try { if ( protocol . inTransaction ( ) ) { try ( Statement st = createStatement ( ) ) { st . execute ( "COMMIT" ) ; } } } finally { lock . unlock ( ) ; } }
Sends commit to the server .
29,453
public void setReadOnly ( final boolean readOnly ) throws SQLException { try { logger . debug ( "conn={}({}) - set read-only to value {} {}" , protocol . getServerThreadId ( ) , protocol . isMasterConnection ( ) ? "M" : "S" , readOnly ) ; stateFlag |= ConnectionState . STATE_READ_ONLY ; protocol . setReadonly ( readOnl...
Sets whether this connection is read only .
29,454
public Properties getClientInfo ( ) throws SQLException { checkConnection ( ) ; Properties properties = new Properties ( ) ; try ( Statement statement = createStatement ( ) ) { try ( ResultSet rs = statement . executeQuery ( "SELECT @ApplicationName, @ClientUser, @ClientHostname" ) ) { if ( rs . next ( ) ) { if ( rs . ...
Returns a list containing the name and current value of each client info property supported by the driver . The value of a client info property may be null if the property has not been set and does not have a default value .
29,455
public void setNetworkTimeout ( Executor executor , final int milliseconds ) throws SQLException { if ( this . isClosed ( ) ) { throw ExceptionMapper . getSqlException ( "Connection.setNetworkTimeout cannot be called on a closed connection" ) ; } if ( milliseconds < 0 ) { throw ExceptionMapper . getSqlException ( "Conn...
Change network timeout .
29,456
public void reset ( ) throws SQLException { boolean useComReset = options . useResetConnection && ( ( protocol . isServerMariaDb ( ) && protocol . versionGreaterOrEqual ( 10 , 2 , 4 ) ) || ( ! protocol . isServerMariaDb ( ) && protocol . versionGreaterOrEqual ( 5 , 7 , 3 ) ) ) ; if ( useComReset ) { protocol . reset ( ...
Reset connection set has it was after creating a fresh new connection . defaultTransactionIsolation must have been initialized .
29,457
public int getIndex ( String name ) throws SQLException { if ( name == null ) { throw new SQLException ( "Column name cannot be null" ) ; } String lowerName = name . toLowerCase ( Locale . ROOT ) ; if ( aliasMap == null ) { aliasMap = new HashMap < > ( ) ; int counter = 0 ; for ( ColumnInformation ci : columnInfo ) { S...
Get column index by name .
29,458
public long getPrecision ( ) { switch ( type ) { case OLDDECIMAL : case DECIMAL : if ( isSigned ( ) ) { return length - ( ( decimals > 0 ) ? 2 : 1 ) ; } else { return length - ( ( decimals > 0 ) ? 1 : 0 ) ; } default : return length ; } }
Return metadata precision .
29,459
public int getDisplaySize ( ) { int vtype = type . getSqlType ( ) ; if ( vtype == Types . VARCHAR || vtype == Types . CHAR ) { int maxWidth = maxCharlen [ charsetNumber & 0xff ] ; if ( maxWidth == 0 ) { maxWidth = 1 ; } return ( int ) length / maxWidth ; } return ( int ) length ; }
Get column size .
29,460
public void addStats ( long updateCount , long insertId , boolean moreResultAvailable ) { if ( cmdInformation == null ) { if ( batch ) { cmdInformation = new CmdInformationBatch ( expectedSize , autoIncrement ) ; } else if ( moreResultAvailable ) { cmdInformation = new CmdInformationMultiple ( expectedSize , autoIncrem...
Add execution statistics .
29,461
public void addStatsError ( boolean moreResultAvailable ) { if ( cmdInformation == null ) { if ( batch ) { cmdInformation = new CmdInformationBatch ( expectedSize , autoIncrement ) ; } else if ( moreResultAvailable ) { cmdInformation = new CmdInformationMultiple ( expectedSize , autoIncrement ) ; } else { cmdInformatio...
Indicate that result is an Error to set appropriate results .
29,462
public void addResultSet ( SelectResultSet resultSet , boolean moreResultAvailable ) { if ( resultSet . isCallableResult ( ) ) { callableResultSet = resultSet ; return ; } if ( executionResults == null ) { executionResults = new ArrayDeque < > ( ) ; } executionResults . add ( resultSet ) ; if ( cmdInformation == null )...
Add resultSet to results .
29,463
public boolean isFullyLoaded ( Protocol protocol ) { if ( fetchSize == 0 || resultSet == null ) { return true ; } return resultSet . isFullyLoaded ( ) && executionResults . isEmpty ( ) && ! protocol . hasMoreResults ( ) ; }
Indicate if result contain result - set that is still streaming from server .
29,464
public boolean getMoreResults ( final int current , Protocol protocol ) throws SQLException { if ( fetchSize != 0 && resultSet != null ) { protocol . getLock ( ) . lock ( ) ; try { if ( current == Statement . CLOSE_CURRENT_RESULT && resultSet != null ) { resultSet . close ( ) ; } else { resultSet . fetchRemaining ( ) ;...
Position to next resultSet .
29,465
public String getDatabaseName ( ) { if ( database != null ) { return database ; } return ( urlParser != null && urlParser . getDatabase ( ) != null ) ? urlParser . getDatabase ( ) : "" ; }
Gets the name of the database .
29,466
public String getUser ( ) { if ( user != null ) { return user ; } return urlParser != null ? urlParser . getUsername ( ) : null ; }
Gets the username .
29,467
public int getPort ( ) { if ( port != null && port != 0 ) { return port ; } return urlParser != null ? urlParser . getHostAddresses ( ) . get ( 0 ) . port : 3306 ; }
Returns the port number .
29,468
public String getServerName ( ) { if ( hostname != null ) { return hostname ; } boolean hasHost = urlParser != null && this . urlParser . getHostAddresses ( ) . get ( 0 ) . host != null ; return ( hasHost ) ? this . urlParser . getHostAddresses ( ) . get ( 0 ) . host : "localhost" ; }
Returns the name of the database server .
29,469
public static void send ( final PacketOutputStream pos , final String database ) throws IOException { pos . startPacket ( 0 ) ; pos . write ( Packet . COM_INIT_DB ) ; pos . write ( database . getBytes ( "UTF-8" ) ) ; pos . flush ( ) ; }
Send a COM_INIT_DB request to specify the default schema for the connection .
29,470
public static GssapiAuth getAuthenticationMethod ( ) { try { if ( Platform . isWindows ( ) ) { try { Class . forName ( "waffle.windows.auth.impl.WindowsAuthProviderImpl" ) ; return new WindowsNativeSspiAuthentication ( ) ; } catch ( ClassNotFoundException cle ) { } } } catch ( Throwable cle ) { } return new StandardGss...
Get authentication method according to classpath . Windows native authentication is using Waffle - jna .
29,471
public void writeTo ( final PacketOutputStream pos ) throws IOException { pos . write ( BINARY_INTRODUCER ) ; if ( length == Long . MAX_VALUE ) { pos . write ( is , true , noBackslashEscapes ) ; } else { pos . write ( is , length , true , noBackslashEscapes ) ; } pos . write ( QUOTE ) ; }
Write stream in text format .
29,472
public void writeTo ( final PacketOutputStream pos ) throws IOException { pos . write ( BINARY_INTRODUCER ) ; pos . writeBytesEscaped ( bytes , bytes . length , noBackslashEscapes ) ; pos . write ( QUOTE ) ; }
Write data to socket in text format .
29,473
@ SuppressWarnings ( "unchecked" ) public static void init ( boolean mustLog ) { if ( ( hasToLog == null || hasToLog != mustLog ) && mustLog ) { synchronized ( LoggerFactory . class ) { if ( hasToLog == null || hasToLog != mustLog ) { try { Class . forName ( "org.slf4j.LoggerFactory" ) ; hasToLog = Boolean . TRUE ; } c...
Initialize factory .
29,474
public static Logger getLogger ( Class < ? > clazz ) { if ( hasToLog != null && hasToLog ) { return new Slf4JLogger ( org . slf4j . LoggerFactory . getLogger ( clazz ) ) ; } else { return NO_LOGGER ; } }
Initialize logger .
29,475
public static Socket standardSocket ( UrlParser urlParser , String host ) throws IOException { SocketFactory socketFactory ; String socketFactoryName = urlParser . getOptions ( ) . socketFactory ; if ( socketFactoryName != null ) { try { @ SuppressWarnings ( "unchecked" ) Class < ? extends SocketFactory > socketFactory...
Use standard socket implementation .
29,476
public static String escapeString ( String value , boolean noBackslashEscapes ) { if ( ! value . contains ( "'" ) ) { if ( noBackslashEscapes ) { return value ; } if ( ! value . contains ( "\\" ) ) { return value ; } } String escaped = value . replace ( "'" , "''" ) ; if ( noBackslashEscapes ) { return escaped ; } retu...
Escape String .
29,477
public static byte [ ] encryptPassword ( final String password , final byte [ ] seed , String passwordCharacterEncoding ) throws NoSuchAlgorithmException , UnsupportedEncodingException { if ( password == null || password . isEmpty ( ) ) { return new byte [ 0 ] ; } final MessageDigest messageDigest = MessageDigest . get...
Encrypts a password .
29,478
public static byte [ ] copyWithLength ( byte [ ] orig , int length ) { byte [ ] result = new byte [ length ] ; int howMuchToCopy = length < orig . length ? length : orig . length ; System . arraycopy ( orig , 0 , result , 0 , howMuchToCopy ) ; return result ; }
Copies the original byte array content to a new byte array . The resulting byte array is always length size . If length is smaller than the original byte array the resulting byte array is truncated . If length is bigger than the original byte array the resulting byte array is filled with zero bytes .
29,479
public static byte [ ] copyRange ( byte [ ] orig , int from , int to ) { int length = to - from ; byte [ ] result = new byte [ length ] ; int howMuchToCopy = orig . length - from < length ? orig . length - from : length ; System . arraycopy ( orig , from , result , 0 , howMuchToCopy ) ; return result ; }
Copies from original byte array to a new byte array . The resulting byte array is always to - from size .
29,480
public static Protocol retrieveProxy ( final UrlParser urlParser , final GlobalStateInfo globalInfo ) throws SQLException { final ReentrantLock lock = new ReentrantLock ( ) ; Protocol protocol ; switch ( urlParser . getHaMode ( ) ) { case AURORA : return getProxyLoggingIfNeeded ( urlParser , ( Protocol ) Proxy . newPro...
Retrieve protocol corresponding to the failover options . if no failover option protocol will not be proxied . if a failover option is precised protocol will be proxied so that any connection error will be handle directly .
29,481
public static Socket createSocket ( UrlParser urlParser , String host ) throws IOException { return socketHandler . apply ( urlParser , host ) ; }
Create socket accordingly to options .
29,482
public static String parseSessionVariables ( String sessionVariable ) { StringBuilder out = new StringBuilder ( ) ; StringBuilder sb = new StringBuilder ( ) ; Parse state = Parse . Normal ; boolean iskey = true ; boolean singleQuotes = true ; boolean first = true ; String key = null ; char [ ] chars = sessionVariable ....
Parse the option sessionVariable to ensure having no injection . semi - column not in string will be replaced by comma .
29,483
public static int transactionFromString ( String txIsolation ) throws SQLException { switch ( txIsolation ) { case "READ-UNCOMMITTED" : return Connection . TRANSACTION_READ_UNCOMMITTED ; case "READ-COMMITTED" : return Connection . TRANSACTION_READ_COMMITTED ; case "REPEATABLE-READ" : return Connection . TRANSACTION_REP...
Traduce a String value of transaction isolation to corresponding java value .
29,484
private void validAllParameters ( ) throws SQLException { setInputOutputParameterMap ( ) ; for ( int index = 0 ; index < params . size ( ) ; index ++ ) { if ( ! params . get ( index ) . isInput ( ) ) { super . setParameter ( index + 1 , new NullParameter ( ) ) ; } } validParameters ( ) ; }
Valid that all parameters are set .
29,485
public static int equal ( int b , int c ) { int result = 0 ; int xor = b ^ c ; for ( int i = 0 ; i < 8 ; i ++ ) { result |= xor >> i ; } return ( result ^ 0x01 ) & 0x01 ; }
Constant - time byte comparison .
29,486
public static String bytesToHex ( byte [ ] raw ) { if ( raw == null ) { return null ; } final StringBuilder hex = new StringBuilder ( 2 * raw . length ) ; for ( final byte b : raw ) { hex . append ( Character . forDigit ( ( b & 0xF0 ) >> 4 , 16 ) ) . append ( Character . forDigit ( ( b & 0x0F ) , 16 ) ) ; } return hex ...
Converts bytes to a hex string .
29,487
private HostAddress findClusterHostAddress ( UrlParser urlParser ) throws SQLException { List < HostAddress > hostAddresses = urlParser . getHostAddresses ( ) ; Matcher matcher ; for ( HostAddress hostAddress : hostAddresses ) { matcher = auroraDnsPattern . matcher ( hostAddress . host ) ; if ( matcher . find ( ) ) { i...
Retrieves the cluster host address from the UrlParser instance .
29,488
public void retrieveAllEndpointsAndSet ( Protocol protocol ) throws SQLException { if ( clusterDnsSuffix != null ) { List < String > endpoints = getCurrentEndpointIdentifiers ( protocol ) ; setUrlParserFromEndpoints ( endpoints , protocol . getPort ( ) ) ; } }
Retrieves the information necessary to add a new endpoint . Calls the methods that retrieves the instance identifiers and sets urlParser accordingly .
29,489
private List < String > getCurrentEndpointIdentifiers ( Protocol protocol ) throws SQLException { List < String > endpoints = new ArrayList < > ( ) ; try { proxy . lock . lock ( ) ; try { Results results = new Results ( ) ; protocol . executeQuery ( false , results , "select server_id, session_id from information_schem...
Retrieves all endpoints of a cluster from the appropriate database table .
29,490
private void setUrlParserFromEndpoints ( List < String > endpoints , int port ) { List < HostAddress > addresses = new ArrayList < > ( ) ; for ( String endpoint : endpoints ) { HostAddress newHostAddress = new HostAddress ( endpoint , port , null ) ; addresses . add ( newHostAddress ) ; } synchronized ( urlParser ) { u...
Sets urlParser accordingly to discovered hosts .
29,491
public static org . mariadb . jdbc . internal . com . send . authentication . ed25519 . math . GroupElement p2 ( final Curve curve , final FieldElement X , final FieldElement Y , final FieldElement Z ) { return new org . mariadb . jdbc . internal . com . send . authentication . ed25519 . math . GroupElement ( curve , R...
Creates a new group element in P2 representation .
29,492
public static org . mariadb . jdbc . internal . com . send . authentication . ed25519 . math . GroupElement p1p1 ( final Curve curve , final FieldElement X , final FieldElement Y , final FieldElement Z , final FieldElement T ) { return new org . mariadb . jdbc . internal . com . send . authentication . ed25519 . math ....
Creates a new group element in P1P1 representation .
29,493
public static org . mariadb . jdbc . internal . com . send . authentication . ed25519 . math . GroupElement precomp ( final Curve curve , final FieldElement ypx , final FieldElement ymx , final FieldElement xy2d ) { return new org . mariadb . jdbc . internal . com . send . authentication . ed25519 . math . GroupElement...
Creates a new group element in PRECOMP representation .
29,494
public static org . mariadb . jdbc . internal . com . send . authentication . ed25519 . math . GroupElement cached ( final Curve curve , final FieldElement YpX , final FieldElement YmX , final FieldElement Z , final FieldElement T2d ) { return new org . mariadb . jdbc . internal . com . send . authentication . ed25519 ...
Creates a new group element in CACHED representation .
29,495
public byte [ ] toByteArray ( ) { switch ( this . repr ) { case P2 : case P3 : FieldElement recip = Z . invert ( ) ; FieldElement x = X . multiply ( recip ) ; FieldElement y = Y . multiply ( recip ) ; byte [ ] s = y . toByteArray ( ) ; s [ s . length - 1 ] |= ( x . isNegative ( ) ? ( byte ) 0x80 : 0 ) ; return s ; defa...
Converts the group element to an encoded point on the curve .
29,496
public org . mariadb . jdbc . internal . com . send . authentication . ed25519 . math . GroupElement toP2 ( ) { return toRep ( Representation . P2 ) ; }
Converts the group element to the P2 representation .
29,497
public org . mariadb . jdbc . internal . com . send . authentication . ed25519 . math . GroupElement toP3 ( ) { return toRep ( Representation . P3 ) ; }
Converts the group element to the P3 representation .
29,498
public org . mariadb . jdbc . internal . com . send . authentication . ed25519 . math . GroupElement toCached ( ) { return toRep ( Representation . CACHED ) ; }
Converts the group element to the CACHED representation .
29,499
public boolean isOnCurve ( Curve curve ) { switch ( repr ) { case P2 : case P3 : FieldElement recip = Z . invert ( ) ; FieldElement x = X . multiply ( recip ) ; FieldElement y = Y . multiply ( recip ) ; FieldElement xx = x . square ( ) ; FieldElement yy = y . square ( ) ; FieldElement dxxyy = curve . getD ( ) . multipl...
Verify that a point is on the curve .