idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
127,700 | public void logout ( ) { if ( loginContext != null ) { try { loginContext . logout ( ) ; if ( logoutLogger . isDebugEnabled ( ) ) { logoutLogger . debug ( "[ws/#" + getId ( ) + "] Logout successful." ) ; } } catch ( LoginException e ) { logoutLogger . trace ( "[ws/#" + getId ( ) + "] Exception occurred logging out of t... | Log out of the login context associated with this WebSocket session . Used to clean up any login context state that should be cleaned up . |
127,701 | public static byte [ ] getOsVersion ( ) { String os = System . getProperty ( "os.name" ) ; if ( os == null || ! os . toUpperCase ( ) . contains ( "WINDOWS" ) ) { return DEFAULT_OS_VERSION ; } byte [ ] osVer = new byte [ 8 ] ; try { Process pr = Runtime . getRuntime ( ) . exec ( "cmd /C ver" ) ; BufferedReader reader = ... | Tries to return a valid OS version on Windows systems . If it fails to do so or if we re running on another OS then a fake Windows XP OS version is returned because the protocol uses it . |
127,702 | public static int writeSecurityBufferAndUpdatePointer ( ByteArrayOutputStream baos , short len , int pointer ) throws IOException { baos . write ( writeSecurityBuffer ( len , pointer ) ) ; return pointer + len ; } | Writes a security buffer and returns the pointer of the position where to write the next security buffer . |
127,703 | public static int extractFlagsFromType2Message ( byte [ ] msg ) { byte [ ] flagsBytes = new byte [ 4 ] ; System . arraycopy ( msg , 20 , flagsBytes , 0 , 4 ) ; ByteUtilities . changeWordEndianess ( flagsBytes , 0 , 4 ) ; return ByteUtilities . makeIntFromByte4 ( flagsBytes ) ; } | Extracts the NTLM flags from the type 2 message . |
127,704 | public static String extractTargetNameFromType2Message ( byte [ ] msg , Integer msgFlags ) throws UnsupportedEncodingException { byte [ ] targetName = readSecurityBufferTarget ( msg , 12 ) ; int flags = msgFlags == null ? extractFlagsFromType2Message ( msg ) : msgFlags ; if ( ByteUtilities . isFlagSet ( flags , FLAG_NE... | Extracts the target name from the type 2 message . |
127,705 | public static byte [ ] extractTargetInfoFromType2Message ( byte [ ] msg , Integer msgFlags ) { int flags = msgFlags == null ? extractFlagsFromType2Message ( msg ) : msgFlags ; if ( ! ByteUtilities . isFlagSet ( flags , FLAG_NEGOTIATE_TARGET_INFO ) ) return null ; int pos = 40 ; return readSecurityBufferTarget ( msg , p... | Extracts the target information block from the type 2 message . |
127,706 | private static void bind ( final NioDatagramChannel channel , final ChannelFuture future , final InetSocketAddress address ) { boolean bound = false ; boolean started = false ; try { channel . getDatagramChannel ( ) . socket ( ) . bind ( address ) ; bound = true ; future . setSuccess ( ) ; fireChannelBound ( channel , ... | Will bind the DatagramSocket to the passed - in address . Every call bind will spawn a new thread using the that basically in turn |
127,707 | public static IoBufferEx doEncode ( IoBufferAllocatorEx < ? > allocator , int flags , WsMessage message ) { IoBufferEx ioBuf = getBytes ( allocator , flags , message ) ; ByteBuffer buf = ioBuf . buf ( ) ; boolean mask = false ; boolean fin = message . isFin ( ) ; int maskValue = 0 ; int remaining = buf . remaining ( ) ... | Encode WebSocket message as a single frame |
127,708 | private List < PatternCacheControl > buildPatternsList ( ServiceProperties properties ) { Map < String , PatternCacheControl > patterns = new LinkedHashMap < > ( ) ; List < ServiceProperties > locationsList = properties . getNested ( "location" ) ; if ( locationsList != null && locationsList . size ( ) != 0 ) { for ( S... | Creates the list of PatternCacheControl objects |
127,709 | private void resolvePatternSpecificity ( Map < String , PatternCacheControl > patterns ) { List < String > patternList = new ArrayList < > ( ) ; patternList . addAll ( patterns . keySet ( ) ) ; int patternCount = patternList . size ( ) ; for ( int i = 0 ; i < patternCount - 1 ; i ++ ) { String specificPattern = pattern... | Matches the patterns from the map and determines each pattern s specificity |
127,710 | private void checkPatternMatching ( Map < String , PatternCacheControl > patterns , String specificPattern , String generalPattern ) { if ( PatternMatcherUtils . caseInsensitiveMatch ( specificPattern , generalPattern ) ) { PatternCacheControl specificPatternDirective = patterns . get ( specificPattern ) ; PatternCache... | Checks if the first pattern can be included in the second one and resolves directive conflicts if needed |
127,711 | private List < PatternCacheControl > sortByMatchingPatternCount ( Map < String , PatternCacheControl > unsortedMap ) { List < PatternCacheControl > list = new ArrayList < > ( unsortedMap . values ( ) ) ; Collections . sort ( list , PATTERN_CACHE_CONTROL_COMPARATOR ) ; return list ; } | Sorts the patterns map by the number of matching patterns and returns a list of sorted PatternCacheControl elements . The sorted list is used at request so that a file s URL can be matched to the most specific pattern . |
127,712 | private File toFile ( File rootDir , String location ) { File locationFile = rootDir ; if ( location != null ) { URI locationURI = URI . create ( location ) ; locationFile = new File ( locationURI . getPath ( ) ) ; if ( locationURI . getScheme ( ) == null ) { locationFile = new File ( rootDir , location ) ; } else if (... | Converts a location in the gateway configuration file into a file relative to a specified root directory . |
127,713 | public LoginContext createLoginContext ( Subject subject , final String username , final char [ ] password ) throws LoginException { final DefaultLoginResult loginResult = new DefaultLoginResult ( ) ; CallbackHandler handler = new CallbackHandler ( ) { public void handle ( Callback [ ] callbacks ) throws IOException , ... | For login context providers that can abstract their tokens into a username and password this is a utility method that can create the login context based on the provided username and password . |
127,714 | protected LoginContext createLoginContext ( Subject subject , CallbackHandler handler , DefaultLoginResult loginResult ) throws LoginException { return new ResultAwareLoginContext ( name , subject , handler , configuration , loginResult ) ; } | For login context providers that can abstract their tokens into a subject and a CallbackHandler that understands their token this is a utility method that can be called to construct a create login . |
127,715 | protected LoginContext createLoginContext ( CallbackHandler handler , final DefaultLoginResult loginResult ) throws LoginException { return createLoginContext ( null , handler , loginResult ) ; } | For login context providers that can abstract their tokens into a CallbackHandler that understands their token this is a utility method that can be called to construct a create login . |
127,716 | private void fireMemberAdded ( MemberId newMember ) { GL . debug ( GL . CLUSTER_LOGGER_NAME , "Firing member added for : {}" , newMember ) ; for ( MembershipEventListener listener : membershipEventListeners ) { try { listener . memberAdded ( newMember ) ; } catch ( Throwable e ) { GL . error ( GL . CLUSTER_LOGGER_NAME ... | Fire member added event |
127,717 | private void fireMemberRemoved ( MemberId exMember ) { GL . debug ( GL . CLUSTER_LOGGER_NAME , "Firing member removed for: {}" , exMember ) ; for ( MembershipEventListener listener : membershipEventListeners ) { try { listener . memberRemoved ( exMember ) ; } catch ( Throwable e ) { GL . error ( GL . CLUSTER_LOGGER_NAM... | Fire member removed event |
127,718 | public ChannelBuffer wrap ( ByteBuffer buffer ) { if ( buffer == null ) { throw new NullPointerException ( "buffer" ) ; } int position = buffer . position ( ) ; int limit = buffer . limit ( ) ; this . order = buffer . order ( ) ; this . buffer = buffer ; this . capacity = buffer . capacity ( ) ; setIndex ( position , l... | Creates a new buffer which wraps the specified buffer s slice . |
127,719 | private int toInt ( InetAddress inetAddress ) { byte [ ] address = inetAddress . getAddress ( ) ; int result = 0 ; for ( int i = 0 ; i < address . length ; i ++ ) { result <<= 8 ; result |= address [ i ] & BYTE_MASK ; } return result ; } | Converts an IP address into an integer |
127,720 | private Executor createDefaultExecutor ( int corePoolSize , int maximumPoolSize , long keepAliveTime , TimeUnit unit , ThreadFactory threadFactory , IoEventQueueHandler queueHandler ) { Executor executor = new OrderedThreadPoolExecutor ( corePoolSize , maximumPoolSize , keepAliveTime , unit , threadFactory , queueHandl... | Create an OrderedThreadPool executor . |
127,721 | private void initEventTypes ( IoEventType ... eventTypes ) { if ( ( eventTypes == null ) || ( eventTypes . length == 0 ) ) { eventTypes = DEFAULT_EVENT_SET ; } this . eventTypes = EnumSet . of ( eventTypes [ 0 ] , eventTypes ) ; if ( this . eventTypes . contains ( IoEventType . SESSION_CREATED ) ) { this . eventTypes =... | Create an EnumSet from an array of EventTypes and set the associated eventTypes field . |
127,722 | private void init ( Executor executor , boolean manageableExecutor , IoEventType ... eventTypes ) { if ( executor == null ) { throw new NullPointerException ( "executor" ) ; } initEventTypes ( eventTypes ) ; this . executor = executor ; this . manageableExecutor = manageableExecutor ; } | Creates a new instance of ExecutorFilter . This private constructor is called by all the public constructor . |
127,723 | public void putAll ( Map < ? extends K , ? extends V > newData ) { synchronized ( this ) { Map < K , V > newMap = new HashMap < > ( internalMap ) ; newMap . putAll ( newData ) ; internalMap = newMap ; } } | Inserts all the keys and values contained in the provided map to this map . |
127,724 | public void doSessionCreated ( SessionManagementBean sessionBean ) throws Exception { SessionMXBean sessionMxBean = managementServiceHandler . getSessionMXBean ( sessionBean . getId ( ) ) ; Map < String , String > userPrincipals = sessionBean . getUserPrincipalMap ( ) ; if ( userPrincipals != null ) { Map < String , Ma... | All of the following are expected to be OFF any session s IO thread . |
127,725 | public void doHandshake ( final NextFilter nextFilter ) throws ProxyAuthException { logger . debug ( " doHandshake()" ) ; if ( authHandler != null ) { authHandler . doHandshake ( nextFilter ) ; } else { if ( requestSent ) { throw new ProxyAuthException ( "Authentication request already sent" ) ; } logger . debug ( " s... | Performs the handshake processing . |
127,726 | public void handleResponse ( final HttpProxyResponse response ) throws ProxyAuthException { if ( ! isHandshakeComplete ( ) && ( "close" . equalsIgnoreCase ( StringUtilities . getSingleValuedHeader ( response . getHeaders ( ) , "Proxy-Connection" ) ) || "close" . equalsIgnoreCase ( StringUtilities . getSingleValuedHeade... | Handle a HTTP response from the proxy server . |
127,727 | public static String acceptHash ( String key ) { try { MessageDigest sha1 = MessageDigest . getInstance ( "SHA-1" ) ; sha1 . update ( key . getBytes ( UTF_8 ) ) ; sha1 . update ( WEBSOCKET_GUID ) ; byte [ ] hash = sha1 . digest ( ) ; byte [ ] output = Base64 . encodeBase64 ( hash ) ; return new String ( output ) ; } ca... | Compute the Sec - WebSocket - Accept header value as per RFC 6455 |
127,728 | protected boolean isConnectionOk ( IoSession session ) { SocketAddress remoteAddress = session . getRemoteAddress ( ) ; if ( remoteAddress instanceof InetSocketAddress ) { InetSocketAddress addr = ( InetSocketAddress ) remoteAddress ; long now = System . currentTimeMillis ( ) ; if ( clients . containsKey ( addr . getAd... | Method responsible for deciding if a connection is OK to continue |
127,729 | public static int getNextAvailable ( int fromPort ) { if ( fromPort < MIN_PORT_NUMBER || fromPort > MAX_PORT_NUMBER ) { throw new IllegalArgumentException ( "Invalid start port: " + fromPort ) ; } for ( int i = fromPort ; i <= MAX_PORT_NUMBER ; i ++ ) { if ( available ( i ) ) { return i ; } } throw new NoSuchElementExc... | Gets the next available port starting at a port . |
127,730 | public static boolean available ( int port ) { if ( port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER ) { throw new IllegalArgumentException ( "Invalid start port: " + port ) ; } ServerSocket ss = null ; DatagramSocket ds = null ; try { ss = new ServerSocket ( port ) ; ss . setReuseAddress ( true ) ; ds = new DatagramSo... | Checks to see if a specific port is available . |
127,731 | public static String getHost ( String uriString ) { try { URI uri = new URI ( uriString ) ; if ( uri . getHost ( ) == null ) { throw new IllegalArgumentException ( "Invalid URI syntax. Scheme and host must be provided (port number is optional): " + uriString ) ; } if ( uri . getAuthority ( ) . startsWith ( "@" ) && ! u... | Helper method for retrieving host |
127,732 | public static String getScheme ( String uriString ) { try { return ( new URI ( uriString ) ) . getScheme ( ) ; } catch ( URISyntaxException e ) { try { return ( new NetworkInterfaceURI ( uriString ) ) . getScheme ( ) ; } catch ( IllegalArgumentException ne ) { throw new IllegalArgumentException ( ne . getMessage ( ) , ... | Helper method for retrieving scheme |
127,733 | public static int getPort ( String uriString ) { try { return ( new URI ( uriString ) ) . getPort ( ) ; } catch ( URISyntaxException e ) { try { return ( new NetworkInterfaceURI ( uriString ) ) . getPort ( ) ; } catch ( IllegalArgumentException ne ) { throw new IllegalArgumentException ( ne . getMessage ( ) , ne ) ; } ... | Helper method for retrieving port |
127,734 | public static String resolve ( String uriInitial , String uriString ) { try { return uriToString ( ( new URI ( uriInitial ) ) . resolve ( uriString ) ) ; } catch ( URISyntaxException e ) { try { return ( new NetworkInterfaceURI ( uriInitial ) ) . resolve ( uriString ) ; } catch ( IllegalArgumentException ne ) { throw n... | Helper method for performing resolve as String |
127,735 | public static String modifyURIScheme ( String uri , String newScheme ) { try { URI uriObj = new URI ( uri ) ; return uriToString ( URLUtils . modifyURIScheme ( uriObj , newScheme ) ) ; } catch ( URISyntaxException e ) { try { return ( new NetworkInterfaceURI ( uri ) ) . modifyURIScheme ( newScheme ) ; } catch ( Illegal... | Helper method for modifying URI scheme |
127,736 | public static String modifyURIAuthority ( String uri , String newAuthority ) { try { URI uriObj = new URI ( uri ) ; Pattern pattern = Pattern . compile ( NETWORK_INTERFACE_AUTHORITY ) ; Matcher matcher = pattern . matcher ( newAuthority ) ; String matchedToken = MOCK_HOST ; if ( matcher . find ( ) ) { matchedToken = ma... | Helper method for modifying URI authority |
127,737 | public static String modifyURIPort ( String uri , int newPort ) { try { URI uriObj = new URI ( uri ) ; return uriToString ( URLUtils . modifyURIPort ( uriObj , newPort ) ) ; } catch ( URISyntaxException e ) { try { return ( new NetworkInterfaceURI ( uri ) ) . modifyURIPort ( newPort ) ; } catch ( IllegalArgumentExcepti... | Helper method for modifying URI port |
127,738 | public static String modifyURIPath ( String uri , String newPath ) { try { URI uriObj = new URI ( uri ) ; return uriToString ( URLUtils . modifyURIPath ( uriObj , newPath ) ) ; } catch ( URISyntaxException e ) { try { return ( new NetworkInterfaceURI ( uri ) ) . modifyURIPath ( newPath ) ; } catch ( IllegalArgumentExce... | Helper method for modiffying the URI path |
127,739 | private String getCertCN ( X509Certificate x509 ) throws CertificateParsingException { X500Principal principal = x509 . getSubjectX500Principal ( ) ; String subjectName = principal . getName ( ) ; String [ ] fields = subjectName . split ( "," ) ; for ( String field : fields ) { if ( field . startsWith ( "CN=" ) ) { Str... | Read the CN out of the cert |
127,740 | private Collection < String > getCertServerNames ( X509Certificate x509 ) throws CertificateParsingException { Collection < String > serverNames = new LinkedHashSet < > ( ) ; String certCN = getCertCN ( x509 ) ; serverNames . add ( certCN ) ; try { Collection < List < ? > > altNames = x509 . getSubjectAlternativeNames ... | Build up the list of server names represented by a certificate |
127,741 | public static BitSet decodeBitString ( ByteBuffer buf ) { DerId id = DerId . decode ( buf ) ; if ( ! id . matches ( DerId . TagClass . UNIVERSAL , DerId . EncodingType . PRIMITIVE , ASN1_BIT_STRING_TAG_NUM ) && ! id . matches ( DerId . TagClass . UNIVERSAL , DerId . EncodingType . CONSTRUCTED , ASN1_BIT_STRING_TAG_NUM ... | Decode an ASN . 1 BIT STRING . |
127,742 | public static Date decodeGeneralizedTime ( ByteBuffer buf ) { DerId id = DerId . decode ( buf ) ; if ( ! id . matches ( DerId . TagClass . UNIVERSAL , DerId . EncodingType . PRIMITIVE , ASN1_GENERALIZED_TIME_TAG_NUM ) ) { throw new IllegalArgumentException ( "Expected GeneralizedTime identifier, received " + id ) ; } i... | Decode an ASN . 1 GeneralizedTime . |
127,743 | public static String decodeIA5String ( ByteBuffer buf ) { DerId id = DerId . decode ( buf ) ; if ( ! id . matches ( DerId . TagClass . UNIVERSAL , DerId . EncodingType . PRIMITIVE , ASN1_IA5STRING_TAG_NUM ) ) { throw new IllegalArgumentException ( "Expected IA5String identifier, received " + id ) ; } int len = DerUtils... | Decode an ASN . 1 IA5String . |
127,744 | public static int decodeInteger ( ByteBuffer buf ) { DerId id = DerId . decode ( buf ) ; if ( ! id . matches ( DerId . TagClass . UNIVERSAL , DerId . EncodingType . PRIMITIVE , ASN1_INTEGER_TAG_NUM ) ) { throw new IllegalArgumentException ( "Expected INTEGER identifier, received " + id ) ; } int len = DerUtils . decode... | Decode an ASN . 1 INTEGER . |
127,745 | public static short [ ] decodeOctetString ( ByteBuffer buf ) { DerId id = DerId . decode ( buf ) ; if ( ! id . matches ( DerId . TagClass . UNIVERSAL , ASN1_OCTET_STRING_TAG_NUM ) ) { throw new IllegalArgumentException ( "Expected OCTET STRING identifier, received " + id ) ; } int len = DerUtils . decodeLength ( buf ) ... | Decode an ASN . 1 OCTET STRING . |
127,746 | public static int decodeSequence ( ByteBuffer buf ) { DerId id = DerId . decode ( buf ) ; if ( ! id . matches ( DerId . TagClass . UNIVERSAL , DerId . EncodingType . CONSTRUCTED , ASN1_SEQUENCE_TAG_NUM ) ) { throw new IllegalArgumentException ( "Expected SEQUENCE identifier, received " + id ) ; } int len = DerUtils . d... | Decode an ASN . 1 SEQUENCE by reading the identifier and length octets . The remaining data in the buffer is the SEQUENCE . |
127,747 | public static int encodeBitString ( BitSet value , int nbits , ByteBuffer buf ) { if ( value == null || nbits < value . length ( ) ) { throw new IllegalArgumentException ( ) ; } int pos = buf . position ( ) ; int contentLength = ( int ) Math . ceil ( nbits / 8.0d ) ; for ( int i = contentLength ; i > 0 ; i -- ) { byte ... | Encode an ASN . 1 BIT STRING . |
127,748 | public static int encodeGeneralizedTime ( Date date , ByteBuffer buf ) { if ( date == null ) { throw new IllegalArgumentException ( ) ; } int pos = buf . position ( ) ; SimpleDateFormat format = new SimpleDateFormat ( GENERALIZED_TIME_FORMAT ) ; format . setTimeZone ( TimeZone . getTimeZone ( "GMT" ) ) ; String value =... | Encode an ASN . 1 GeneralizedTime . |
127,749 | public static int encodeIA5String ( String value , ByteBuffer buf ) { int pos = buf . position ( ) ; byte [ ] data = ( value == null ) ? new byte [ 0 ] : value . getBytes ( ) ; for ( int i = data . length - 1 ; i >= 0 ; i -- ) { pos -- ; buf . put ( pos , data [ i ] ) ; } buf . position ( buf . position ( ) - data . le... | Encode an ASN . 1 IA5String . |
127,750 | public static int encodeInteger ( int value , ByteBuffer buf ) { int pos = buf . position ( ) ; int contentLength = 0 ; do { pos -- ; buf . put ( pos , ( byte ) ( value & 0xff ) ) ; value >>>= 8 ; contentLength ++ ; } while ( value != 0 ) ; buf . position ( buf . position ( ) - contentLength ) ; int headerLen = DerUtil... | Encode an ASN . 1 INTEGER . |
127,751 | public static int encodeOctetString ( short [ ] octets , ByteBuffer buf ) { if ( octets == null ) { octets = new short [ 0 ] ; } int pos = buf . position ( ) ; for ( int i = octets . length - 1 ; i >= 0 ; i -- ) { pos -- ; buf . put ( pos , ( byte ) octets [ i ] ) ; } buf . position ( buf . position ( ) - octets . leng... | Encode an ASN . 1 OCTET STRING . |
127,752 | public static int encodeSequence ( int contentLength , ByteBuffer buf ) { int headerLength = DerUtils . encodeIdAndLength ( DerId . TagClass . UNIVERSAL , DerId . EncodingType . CONSTRUCTED , ASN1_SEQUENCE_TAG_NUM , contentLength , buf ) ; return headerLength + contentLength ; } | Encode an ASN . 1 SEQUENCE . |
127,753 | public static int sizeOfBitString ( BitSet value , int nbits ) { return DerUtils . sizeOf ( ASN1_BIT_STRING_TAG_NUM , ( int ) Math . ceil ( nbits / 8.0d ) + 1 ) ; } | Size of an ASN . 1 BIT STRING . |
127,754 | public static int sizeOfIA5String ( String value ) { return DerUtils . sizeOf ( ASN1_IA5STRING_TAG_NUM , ( value == null ) ? 0 : value . getBytes ( ) . length ) ; } | Size of an ASN . 1 IA5String . |
127,755 | public static int sizeOfInteger ( int value ) { int contentLength = 0 ; do { value >>>= 8 ; contentLength ++ ; } while ( value != 0 ) ; return DerUtils . sizeOf ( ASN1_INTEGER_TAG_NUM , contentLength ) ; } | Size of an ASN . 1 INTEGER . |
127,756 | private byte [ ] pad ( ) { int pos = ( int ) ( msgLength % BYTE_BLOCK_LENGTH ) ; int padLength = ( pos < 56 ) ? ( 64 - pos ) : ( 128 - pos ) ; byte [ ] pad = new byte [ padLength ] ; pad [ 0 ] = ( byte ) 0x80 ; long bits = msgLength << 3 ; int index = padLength - 8 ; for ( int i = 0 ; i < 8 ; i ++ ) { pad [ index ++ ] ... | Pads the buffer by appending the byte 0x80 then append as many zero bytes as necessary to make the buffer length a multiple of 64 bytes . The last 8 bytes will be filled with the length of the buffer in bits . If there s no room to store the length in bits in the block i . e the block is larger than 56 bytes then an ad... |
127,757 | private static synchronized ProductInfo generateProductInfo ( ) { ProductInfo result = new ProductInfo ( ) ; boolean foundJar = false ; String [ ] pathEntries = System . getProperty ( "java.class.path" ) . split ( System . getProperty ( "path.separator" ) ) ; Map < String , Attributes > products = new TreeMap < > ( Col... | Find the product information from the server JAR MANIFEST files and store it in static variables here for later retrieval . |
127,758 | public AmqpTable addInteger ( String key , int value ) { this . add ( key , value , AmqpType . INT ) ; return this ; } | Adds an integer entry to the AmqpTable . |
127,759 | public AmqpTable addLongString ( String key , String value ) { this . add ( key , value , AmqpType . LONGSTRING ) ; return this ; } | Adds a long string entry to the AmqpTable . |
127,760 | private SessionTasksQueue getSessionTasksQueue ( IoSession session ) { SessionTasksQueue queue = ( SessionTasksQueue ) session . getAttribute ( TASKS_QUEUE ) ; if ( queue == null ) { queue = new SessionTasksQueue ( ) ; SessionTasksQueue oldQueue = ( SessionTasksQueue ) session . setAttributeIfAbsent ( TASKS_QUEUE , que... | Get the session s tasks queue . |
127,761 | private void print ( Queue < Runnable > queue , IoEvent event ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "Adding event " ) . append ( event . getType ( ) ) . append ( " to session " ) . append ( event . getSession ( ) . getId ( ) ) ; boolean first = true ; sb . append ( "\nQueue : [" ) ; for ( Runnabl... | A Helper class used to print the list of events being queued . |
127,762 | public static String createAuthorization ( final String username , final String password ) { return new String ( Base64 . encodeBase64 ( ( username + ":" + password ) . getBytes ( ) ) ) ; } | Computes the authorization header value . |
127,763 | public final void add ( final T session ) { if ( session . isIoAligned ( ) ) { verifyInIoThread ( session , session . getIoThread ( ) ) ; } add0 ( session ) ; } | until the processor is created and started |
127,764 | static SmushingRulesToApply getRulesToApply ( Integer oldLayout , Integer fullLayout ) { List < SmushingRule > horizontalSmushingRules = new ArrayList < SmushingRule > ( ) ; List < SmushingRule > verticalSmushingRules = new ArrayList < SmushingRule > ( ) ; SmushingRule . Layout horizontalLayout = null ; SmushingRule . ... | Return definition of smushing logic to be applied . |
127,765 | @ SuppressWarnings ( "StatementWithEmptyBody" ) private static int calculateOverlay ( FigletFont figletFont , char [ ] [ ] char1 , char [ ] [ ] char2 ) { if ( figletFont . smushingRulesToApply . getHorizontalLayout ( ) == SmushingRule . Layout . FULL_WIDTH ) { return 0 ; } int maxPotentialOverlay = figletFont . maxLine... | Workouts the amount of characters that can be smushed across all lines . |
127,766 | public String getCharLineString ( int c , int l ) { if ( font [ c ] [ l ] == null ) return null ; else { return new String ( font [ c ] [ l ] ) . replace ( hardblank , ' ' ) ; } } | Selects a single line from a character . |
127,767 | public void close ( ) throws IOException { if ( session != null && session . isConnected ( ) ) { session . disconnect ( ) ; } session = null ; for ( Tunnel tunnel : tunnels ) { tunnel . setAssignedLocalPort ( 0 ) ; } } | Closes the underlying ssh session causing all tunnels to be closed . |
127,768 | public void open ( ) throws JSchException { if ( isOpen ( ) ) { return ; } session = sessionFactory . newSession ( ) ; logger . debug ( "connecting session" ) ; session . connect ( ) ; for ( Tunnel tunnel : tunnels ) { int assignedPort = 0 ; if ( tunnel . getLocalAlias ( ) == null ) { assignedPort = session . setPortFo... | Opens a session and connects all of the tunnels . |
127,769 | public Session getSession ( ) throws JSchException { if ( session == null || ! session . isConnected ( ) ) { logger . debug ( "getting new session from factory session" ) ; session = sessionFactory . newSession ( ) ; logger . debug ( "connecting session" ) ; session . connect ( ) ; } return session ; } | Returns a connected session . |
127,770 | private static InputStreamReader decompressWith7Zip ( final String archivePath ) throws ConfigurationException { PATH_PROGRAM_7ZIP = ( String ) config . getConfigParameter ( ConfigurationKeys . PATH_PROGRAM_7ZIP ) ; if ( PATH_PROGRAM_7ZIP == null ) { throw ErrorFactory . createConfigurationException ( ErrorKeys . CONFI... | Starts a decompression process using the 7Zip program . |
127,771 | private static InputStreamReader decompressWithBZip2 ( final String archivePath ) throws ConfigurationException { Bzip2Archiver archiver = new Bzip2Archiver ( ) ; InputStreamReader reader = null ; try { reader = archiver . getDecompressionStream ( archivePath , WIKIPEDIA_ENCODING ) ; } catch ( IOException e ) { e . pri... | Starts a decompression process using the BZip2 program . |
127,772 | private static InputStreamReader readXMLFile ( final String archivePath ) { try { return new InputStreamReader ( new BufferedInputStream ( new FileInputStream ( archivePath ) ) , WIKIPEDIA_ENCODING ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } | Creates a reader for the xml file . |
127,773 | public static ArticleReaderInterface getTaskReader ( final ArchiveDescription archive ) throws ConfigurationException , ArticleReaderException { Reader reader = null ; switch ( archive . getType ( ) ) { case XML : reader = readXMLFile ( archive . getPath ( ) ) ; break ; case SEVENZIP : reader = decompressWith7Zip ( arc... | Returns an ArticleReader which reads the specified input file . |
127,774 | private void createSystemMenu ( ) { JMenu system = new JMenu ( "System" ) ; JMenuItem importConfig = new JMenuItem ( "Import Configuration" ) ; importConfig . addActionListener ( new ActionListener ( ) { public void actionPerformed ( final ActionEvent e ) { controller . loadConfiguration ( ) ; } } ) ; system . add ( im... | Creates the System menu and its menu items . |
127,775 | public void setConfigParameter ( final ConfigurationKeys key , Object value ) { if ( key == ConfigurationKeys . LOGGING_PATH_DEBUG || key == ConfigurationKeys . LOGGING_PATH_DIFFTOOL || key == ConfigurationKeys . PATH_OUTPUT_SQL_FILES ) { String v = ( String ) value ; if ( ! v . endsWith ( File . separator ) && v . con... | Assigns the given value to the the given key . |
127,776 | public Object getConfigParameter ( final ConfigurationKeys configParameter ) { if ( this . parameterMap . containsKey ( configParameter ) ) { return this . parameterMap . get ( configParameter ) ; } return null ; } | Returns the value related to the configuration key or null if the key is not contained . |
127,777 | public void defaultConfiguration ( ) { clear ( ) ; setConfigParameter ( ConfigurationKeys . VALUE_MINIMUM_LONGEST_COMMON_SUBSTRING , 12 ) ; setConfigParameter ( ConfigurationKeys . COUNTER_FULL_REVISION , 1000 ) ; setConfigParameter ( ConfigurationKeys . LIMIT_TASK_SIZE_REVISIONS , 5000000l ) ; setConfigParameter ( Con... | Applies the default single thread configuration of the DiffTool to this settings . |
127,778 | public void loadConfig ( final String path ) { try { ConfigurationReader reader = new ConfigurationReader ( path ) ; ConfigSettings settings = reader . read ( ) ; clear ( ) ; this . type = settings . type ; this . parameterMap = settings . parameterMap ; this . archives = settings . archives ; } catch ( Exception e ) {... | Loads the configuration settings from a file . |
127,779 | public static ConfigurationException createConfigurationException ( final ErrorKeys errorId , final String message ) { return new ConfigurationException ( errorId . toString ( ) + ":\r\n" + message ) ; } | Creates a ConfigurationException object . |
127,780 | public static LoggingException createLoggingException ( final ErrorKeys errorId , final Exception e ) { return new LoggingException ( errorId . toString ( ) , e ) ; } | Creates a LoggingException object . |
127,781 | public ConfigSettings read ( ) { ConfigSettings config = new ConfigSettings ( ConfigEnum . IMPORT ) ; String name ; Node node ; NodeList list = root . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { node = list . item ( i ) ; name = node . getNodeName ( ) . toUpperCase ( ... | Reads the input of the configuration file and parses the into the ConfigSettings object . |
127,782 | private void parseFilterConfig ( final Node node , final ConfigSettings config ) { String name ; Node nnode ; final NodeList list = node . getChildNodes ( ) ; final int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ; ... | Parses the filter parameter section . |
127,783 | private void parseNamespaceFilterConfig ( final Node node , final ConfigSettings config ) { String name ; Integer value ; Node nnode ; final NodeList list = node . getChildNodes ( ) ; final int length = list . getLength ( ) ; final Set < Integer > namespaces = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < length ... | Parses the namespaces parameter section . This is the subsection of filter . |
127,784 | private void parseModeConfig ( final Node node , final ConfigSettings config ) { String name ; Integer value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ... | Parses the mode parameter section . |
127,785 | private void parseExternalsConfig ( final Node node , final ConfigSettings config ) { String name , value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ; i... | Parses the externals parameter section . |
127,786 | private void parseInputConfig ( final Node node , final ConfigSettings config ) { String name , value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ; if ( ... | Parses the input parameter section . |
127,787 | private void parseInputArchive ( final Node node , final ConfigSettings config ) { String name ; InputType type = null ; String path = null ; long startPosition = 0 ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item (... | Parses the input archive subsection . |
127,788 | private void parseOutputConfig ( final Node node , final ConfigSettings config ) { String name ; Long lValue ; Boolean bValue ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) .... | Parses the output parameter section . |
127,789 | private void parseSQLConfig ( final Node node , final ConfigSettings config ) { String name , value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ; if ( na... | Parses the sql parameter section . |
127,790 | private void parseCacheConfig ( final Node node , final ConfigSettings config ) { String name ; Long lValue ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ;... | Parses the cache parameter section . |
127,791 | private void parseLoggingConfig ( final Node node , final ConfigSettings config ) { String name ; String value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ... | Parses the logging parameter section . |
127,792 | private void parseLoggerConfig ( final Node node , final ConfigSettings config , final ConfigurationKeys logPath , final ConfigurationKeys logLevel ) { String name , value ; Level level ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { ... | Parses the information for a logger . |
127,793 | private void parseDebugConfig ( final Node node , final ConfigSettings config ) { String name ; Boolean value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( )... | Parses the debug parameter section . |
127,794 | private void parseDebugOutputConfig ( final Node node , final ConfigSettings config ) { String name , value ; Node nnode ; NodeList list = node . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { nnode = list . item ( i ) ; name = nnode . getNodeName ( ) . toUpperCase ( ) ;... | Parses the debug output parameter subsection . |
127,795 | public NestedList getNestedList ( int i ) { if ( i < lists . size ( ) ) return lists . get ( i ) ; else return null ; } | Returns the NestedListContainer or NestedListElement at Positon i . |
127,796 | public void add ( final String word , final V value ) { char c = word . charAt ( 0 ) ; LetterNode < V > node = get ( c ) ; if ( node == null ) { node = new LetterNode < V > ( this . word + c ) ; } this . nodes . put ( c , node ) ; if ( word . length ( ) == 1 ) { node . isKeyword = true ; node . value = value ; return ;... | Adds a word and its related value . |
127,797 | public int compareTo ( final DiffBlock b ) { if ( ab ) { return this . revAStart - b . revAStart ; } else { return this . revBStart - b . revBStart ; } } | Compares the positions of both blocks . |
127,798 | public static ConfigurationManager getInstance ( ) throws ConfigurationException { if ( instance == null ) { throw ErrorFactory . createConfigurationException ( ErrorKeys . CONFIGURATION_CONFIGURATIONMANAGER_NOT_INITIALIZED ) ; } return instance ; } | Returns the reference to the instance of the ConfigurationManager . |
127,799 | public Object getConfigParameter ( final ConfigurationKeys configParameter ) throws ConfigurationException { Object o = this . config . getConfigParameter ( configParameter ) ; if ( o != null ) { return o ; } else if ( configParameter == ConfigurationKeys . LIMIT_SQL_ARCHIVE_SIZE ) { return Long . MAX_VALUE ; } else if... | Returns the value of the configuration parameter . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.