idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
8,800
public void sendMessage ( String channel , Message message ) { ensureChannel ( channel ) ; admin . getRabbitTemplate ( ) . convertAndSend ( exchange . getName ( ) , channel , message ) ; }
Sends an event to the default exchange .
8,801
protected boolean putToQueue ( IQueueMessage < ID , DATA > msg ) { try { BytesMessage message = getProducerSession ( ) . createBytesMessage ( ) ; message . writeBytes ( serialize ( msg ) ) ; getMessageProducer ( ) . send ( message ) ; return true ; } catch ( Exception e ) { throw e instanceof QueueException ? ( QueueEx...
Puts a message to ActiveMQ queue .
8,802
public boolean hasException ( Class < ? extends Throwable > type ) { for ( Throwable exception : exceptions ) { if ( type . isInstance ( exception ) ) { return true ; } } return false ; }
Returns true if this instance contains an exception of the given type .
8,803
public StackTraceElement [ ] getStackTrace ( ) { ArrayList < StackTraceElement > stackTrace = new ArrayList < > ( ) ; for ( Throwable exception : exceptions ) { stackTrace . addAll ( Arrays . asList ( exception . getStackTrace ( ) ) ) ; } return stackTrace . toArray ( new StackTraceElement [ stackTrace . size ( ) ] ) ;...
Returns the stack trace which is the union of all stack traces of contained exceptions .
8,804
public int dot ( int [ ] other ) { int dot = 0 ; for ( int c = 0 ; c < used && indices [ c ] < other . length ; c ++ ) { if ( indices [ c ] > Integer . MAX_VALUE ) { break ; } dot += values [ c ] * other [ SafeCast . safeLongToInt ( indices [ c ] ) ] ; } return dot ; }
Computes the dot product of this vector with the given vector .
8,805
public int dot ( int [ ] [ ] matrix , int col ) { int ret = 0 ; for ( int c = 0 ; c < used && indices [ c ] < matrix . length ; c ++ ) { if ( indices [ c ] > Integer . MAX_VALUE ) { break ; } ret += values [ c ] * matrix [ SafeCast . safeLongToInt ( indices [ c ] ) ] [ col ] ; } return ret ; }
Computes the dot product of this vector with the column of the given matrix .
8,806
public static void copyResourceToFile ( String resourceAbsoluteClassPath , File targetFile ) throws IOException { InputStream is = ResourceUtil . class . getResourceAsStream ( resourceAbsoluteClassPath ) ; if ( is == null ) { throw new IOException ( "Resource not found! " + resourceAbsoluteClassPath ) ; } OutputStream ...
Copy resources to file system .
8,807
public static String getAbsolutePath ( String classPath ) { URL configUrl = Thread . currentThread ( ) . getContextClassLoader ( ) . getResource ( classPath . substring ( 1 ) ) ; if ( configUrl == null ) { configUrl = ResourceUtil . class . getResource ( classPath ) ; } if ( configUrl == null ) { return null ; } try { ...
Get absolute path in file system from a classPath . If this resource not exists return null .
8,808
public void setFocus ( ) { Radiobutton radio = editor . getSelected ( ) ; if ( radio == null ) { radio = ( Radiobutton ) editor . getChildren ( ) . get ( 0 ) ; } radio . setFocus ( true ) ; }
Sets focus to the selected radio button .
8,809
public static DesignContextMenu getInstance ( ) { Page page = ExecutionContext . getPage ( ) ; DesignContextMenu contextMenu = page . getAttribute ( DesignConstants . ATTR_DESIGN_MENU , DesignContextMenu . class ) ; if ( contextMenu == null ) { contextMenu = create ( ) ; page . setAttribute ( DesignConstants . ATTR_DES...
Returns an instance of the design context menu . This is a singleton with the page scope and is cached once created .
8,810
public static DesignContextMenu create ( ) { return PageUtil . createPage ( DesignConstants . RESOURCE_PREFIX + "designContextMenu.fsp" , ExecutionContext . getPage ( ) ) . get ( 0 ) . getAttribute ( "controller" , DesignContextMenu . class ) ; }
Creates an instance of the design context menu .
8,811
private void disable ( IDisable comp , boolean disabled ) { if ( comp != null ) { comp . setDisabled ( disabled ) ; if ( comp instanceof BaseUIComponent ) { ( ( BaseUIComponent ) comp ) . addStyle ( "opacity" , disabled ? ".2" : "1" ) ; } } }
Sets the disabled state of the specified component .
8,812
public static double logAdd ( double x , double y ) { if ( FastMath . useLogAddTable ) { return SmoothedLogAddTable . logAdd ( x , y ) ; } else { return FastMath . logAddExact ( x , y ) ; } }
Adds two probabilities that are stored as log probabilities .
8,813
public static int mod ( int val , int mod ) { val = val % mod ; if ( val < 0 ) { val += mod ; } return val ; }
Modulo operator where all numbers evaluate to a positive remainder .
8,814
protected void prepareXMLReader ( ) throws VerifierConfigurationException { try { SAXParserFactory factory = SAXParserFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; reader = factory . newSAXParser ( ) . getXMLReader ( ) ; } catch ( SAXException e ) { throw new VerifierConfigurationException ( e ) ; ...
Creates and sets a sole instance of XMLReader which will be used by this verifier .
8,815
private Mode makeBuiltinMode ( String name , Class cls ) { Mode mode = lookupCreateMode ( name ) ; ActionSet actions = new ActionSet ( ) ; ModeUsage modeUsage = new ModeUsage ( Mode . CURRENT , mode ) ; if ( cls == AttachAction . class ) actions . setResultAction ( new AttachAction ( modeUsage ) ) ; else if ( cls == Al...
Makes a built in mode .
8,816
SchemaFuture installHandlers ( XMLReader in , SchemaReceiverImpl sr ) { Handler h = new Handler ( sr ) ; in . setContentHandler ( h ) ; return h ; }
Installs the schema handler on the reader .
8,817
private Mode getModeAttribute ( Attributes attributes , String localName ) { return lookupCreateMode ( attributes . getValue ( "" , localName ) ) ; }
Get the mode specified by an attribute from no namespace .
8,818
private Mode lookupCreateMode ( String name ) { if ( name == null ) return null ; name = name . trim ( ) ; Mode mode = ( Mode ) modeMap . get ( name ) ; if ( mode == null ) { mode = new Mode ( name , defaultBaseMode ) ; modeMap . put ( name , mode ) ; } return mode ; }
Gets a mode with the given name from the mode map . If not present then it creates a new mode extending the default base mode .
8,819
private Date _advanceToNextDayOfWeekIfNecessary ( final Date aFireTime , final boolean forceToAdvanceNextDay ) { Date fireTime = aFireTime ; final TimeOfDay sTimeOfDay = getStartTimeOfDay ( ) ; final Date fireTimeStartDate = sTimeOfDay . getTimeOfDayForDate ( fireTime ) ; final Calendar fireTimeStartDateCal = _createCa...
Given fireTime time determine if it is on a valid day of week . If so simply return it unaltered if not advance to the next valid week day and set the time of day to the start time of day
8,820
public static IScheduler getScheduler ( final boolean bStartAutomatically ) { try { final IScheduler aScheduler = s_aSchedulerFactory . getScheduler ( ) ; if ( bStartAutomatically && ! aScheduler . isStarted ( ) ) aScheduler . start ( ) ; return aScheduler ; } catch ( final SchedulerException ex ) { throw new IllegalSt...
Get the underlying Quartz scheduler
8,821
public static SchedulerMetaData getSchedulerMetaData ( ) { try { return s_aSchedulerFactory . getScheduler ( ) . getMetaData ( ) ; } catch ( final SchedulerException ex ) { throw new IllegalStateException ( "Failed to get scheduler metadata" , ex ) ; } }
Get the metadata of the scheduler . The state of the scheduler is not changed within this method .
8,822
public void setCronExpression ( final String expression ) throws ParseException { final CronExpression newExp = new CronExpression ( expression ) ; setCronExpression ( newExp ) ; }
Sets the cron expression for the calendar to a new value
8,823
public static < T extends Key < T > > GroupMatcher < T > groupEquals ( final String compareTo ) { return new GroupMatcher < > ( compareTo , StringOperatorName . EQUALS ) ; }
Create a GroupMatcher that matches groups equaling the given string .
8,824
public static < T extends Key < T > > GroupMatcher < T > groupStartsWith ( final String compareTo ) { return new GroupMatcher < > ( compareTo , StringOperatorName . STARTS_WITH ) ; }
Create a GroupMatcher that matches groups starting with the given string .
8,825
public static < T extends Key < T > > GroupMatcher < T > groupEndsWith ( final String compareTo ) { return new GroupMatcher < > ( compareTo , StringOperatorName . ENDS_WITH ) ; }
Create a GroupMatcher that matches groups ending with the given string .
8,826
public static < T extends Key < T > > GroupMatcher < T > groupContains ( final String compareTo ) { return new GroupMatcher < > ( compareTo , StringOperatorName . CONTAINS ) ; }
Create a GroupMatcher that matches groups containing the given string .
8,827
public static < U extends Key < U > > KeyMatcher < U > keyEquals ( final U compareTo ) { return new KeyMatcher < > ( compareTo ) ; }
Create a KeyMatcher that matches Keys that equal the given key .
8,828
public static < T > T instantiate ( Class < T > clazz , CRestConfig crestConfig ) throws InvocationTargetException , IllegalAccessException , InstantiationException , NoSuchMethodException { try { return accessible ( clazz . getDeclaredConstructor ( CRestConfig . class ) ) . newInstance ( crestConfig ) ; } catch ( NoSu...
Instanciate the given component class passing the CRestConfig to the constructor if available otherwise uses the default empty constructor .
8,829
public Object doReverseOne ( JTransfo jTransfo , Object domainObject , SyntheticField toField , Class < ? > toType , String ... tags ) throws JTransfoException { return jTransfo . convertTo ( domainObject , jTransfo . getToSubType ( toType , domainObject ) , tags ) ; }
Do the actual reverse conversion of one object .
8,830
public void addJobChainLink ( final JobKey firstJob , final JobKey secondJob ) { ValueEnforcer . notNull ( firstJob , "FirstJob" ) ; ValueEnforcer . notNull ( firstJob . getName ( ) , "FirstJob.Name" ) ; ValueEnforcer . notNull ( secondJob , "SecondJob" ) ; ValueEnforcer . notNull ( secondJob . getName ( ) , "SecondJob...
Add a chain mapping - when the Job identified by the first key completes the job identified by the second key will be triggered .
8,831
private void checkM ( ) throws DatatypeException , IOException { if ( context . length ( ) == 0 ) { appendToContext ( current ) ; } current = reader . read ( ) ; appendToContext ( current ) ; skipSpaces ( ) ; checkArg ( 'M' , "x coordinate" ) ; skipCommaSpaces ( ) ; checkArg ( 'M' , "y coordinate" ) ; boolean expectNum...
Checks an M command .
8,832
private void checkC ( ) throws DatatypeException , IOException { if ( context . length ( ) == 0 ) { appendToContext ( current ) ; } current = reader . read ( ) ; appendToContext ( current ) ; skipSpaces ( ) ; boolean expectNumber = true ; for ( ; ; ) { switch ( current ) { default : if ( expectNumber ) reportNonNumber ...
Checks a C command .
8,833
public boolean before ( final TimeOfDay timeOfDay ) { if ( timeOfDay . m_nHour > m_nHour ) return true ; if ( timeOfDay . m_nHour < m_nHour ) return false ; if ( timeOfDay . m_nMinute > m_nMinute ) return true ; if ( timeOfDay . m_nMinute < m_nMinute ) return false ; if ( timeOfDay . m_nSecond > m_nSecond ) return true...
Determine with this time of day is before the given time of day .
8,834
public Date getTimeOfDayForDate ( final Date dateTime ) { if ( dateTime == null ) return null ; final Calendar cal = PDTFactory . createCalendar ( ) ; cal . setTime ( dateTime ) ; cal . set ( Calendar . HOUR_OF_DAY , m_nHour ) ; cal . set ( Calendar . MINUTE , m_nMinute ) ; cal . set ( Calendar . SECOND , m_nSecond ) ;...
Return a date with time of day reset to this object values . The millisecond value will be zero .
8,835
public Document parse ( InputSource inputsource ) throws SAXException , IOException { return verify ( _WrappedBuilder . parse ( inputsource ) ) ; }
Parses the given InputSource and validates the resulting DOM .
8,836
public Document parse ( File file ) throws SAXException , IOException { return verify ( _WrappedBuilder . parse ( file ) ) ; }
Parses the given File and validates the resulting DOM .
8,837
public Document parse ( InputStream strm ) throws SAXException , IOException { return verify ( _WrappedBuilder . parse ( strm ) ) ; }
Parses the given InputStream and validates the resulting DOM .
8,838
public Document parse ( String url ) throws SAXException , IOException { return verify ( _WrappedBuilder . parse ( url ) ) ; }
Parses the given url and validates the resulting DOM .
8,839
private int convertNonNegativeInteger ( String str ) { str = str . trim ( ) ; DecimalDatatype decimal = new DecimalDatatype ( ) ; if ( ! decimal . lexicallyAllows ( str ) ) return - 1 ; str = decimal . getValue ( str , null ) . toString ( ) ; if ( str . charAt ( 0 ) == '-' || str . indexOf ( '.' ) >= 0 ) return - 1 ; t...
Return Integer . MAX_VALUE for values that are too big
8,840
private void checkItem ( Element root , Deque < Element > parents ) throws SAXException { Deque < Element > pending = new ArrayDeque < Element > ( ) ; Set < Element > memory = new HashSet < Element > ( ) ; memory . add ( root ) ; for ( Element child : root . children ) { pending . push ( child ) ; } if ( root . itemRef...
Check itemref constraints .
8,841
public static < T > ContractCondition < T > condition ( final Predicate < T > condition , final Function < T , String > describer ) { return ContractCondition . of ( condition , describer ) ; }
Construct a predicate from the given predicate function and describer .
8,842
static int compare ( final Date nextFireTime1 , final int priority1 , final TriggerKey key1 , final Date nextFireTime2 , final int priority2 , final TriggerKey key2 ) { if ( nextFireTime1 != null || nextFireTime2 != null ) { if ( nextFireTime1 == null ) return 1 ; if ( nextFireTime2 == null ) return - 1 ; if ( nextFire...
This static method exists for comparator in TC clustered quartz
8,843
public List < Connector > getSipConnectors ( ) { List < Connector > connectors = new ArrayList < Connector > ( ) ; Connector [ ] conns = service . findConnectors ( ) ; for ( Connector conn : conns ) { if ( conn . getProtocolHandler ( ) instanceof SipProtocolHandler ) { connectors . add ( conn ) ; } } return connectors ...
Return the SipConnectors
8,844
void perform ( SectionState state ) throws SAXException { final ModeUsage modeUsage = getModeUsage ( ) ; state . reject ( ) ; state . addChildMode ( modeUsage , null ) ; state . addAttributeValidationModeUsage ( modeUsage ) ; }
Perform this action on the session state .
8,845
public Object getAttribute ( String key ) { Object result ; if ( attributes == null ) { result = null ; } else { result = attributes . get ( key ) ; } return result ; }
Gets an attribute attached to a call . Attributes are arbitrary contextual objects attached to a call .
8,846
private int reverseIndex ( int k ) { if ( reverseIndexMap == null ) { reverseIndexMap = new int [ attributes . getLength ( ) ] ; for ( int i = 0 , len = indexSet . size ( ) ; i < len ; i ++ ) reverseIndexMap [ indexSet . get ( i ) ] = i + 1 ; } return reverseIndexMap [ k ] - 1 ; }
Gets the index in the filtered set for a given real index . If the reverseIndexMap is not computed it computes it otherwise it just uses the previously computed map .
8,847
public String getURI ( int index ) { if ( index < 0 || index >= indexSet . size ( ) ) return null ; return attributes . getURI ( indexSet . get ( index ) ) ; }
Get the URI for the index - th attribute .
8,848
public String getLocalName ( int index ) { if ( index < 0 || index >= indexSet . size ( ) ) return null ; return attributes . getLocalName ( indexSet . get ( index ) ) ; }
Get the local name for the index - th attribute .
8,849
public String getQName ( int index ) { if ( index < 0 || index >= indexSet . size ( ) ) return null ; return attributes . getQName ( indexSet . get ( index ) ) ; }
Get the QName for the index - th attribute .
8,850
public String getType ( int index ) { if ( index < 0 || index >= indexSet . size ( ) ) return null ; return attributes . getType ( indexSet . get ( index ) ) ; }
Get the type for the index - th attribute .
8,851
public String getValue ( int index ) { if ( index < 0 || index >= indexSet . size ( ) ) return null ; return attributes . getValue ( indexSet . get ( index ) ) ; }
Get the value for the index - th attribute .
8,852
public String getType ( String uri , String localName ) { return attributes . getType ( getRealIndex ( uri , localName ) ) ; }
Get the type of the attribute .
8,853
public String getValue ( String uri , String localName ) { return attributes . getValue ( getRealIndex ( uri , localName ) ) ; }
Get the value of the attribute .
8,854
void perform ( SectionState state ) { state . addChildMode ( getModeUsage ( ) , null ) ; state . addAttributeValidationModeUsage ( getModeUsage ( ) ) ; }
Perform this action on the section state .
8,855
public CalendarIntervalScheduleBuilder withIntervalInSeconds ( final int intervalInSeconds ) { _validateInterval ( intervalInSeconds ) ; m_nInterval = intervalInSeconds ; m_eIntervalUnit = EIntervalUnit . SECOND ; return this ; }
Specify an interval in the IntervalUnit . SECOND that the produced Trigger will repeat at .
8,856
public CalendarIntervalScheduleBuilder withIntervalInMinutes ( final int intervalInMinutes ) { _validateInterval ( intervalInMinutes ) ; m_nInterval = intervalInMinutes ; m_eIntervalUnit = EIntervalUnit . MINUTE ; return this ; }
Specify an interval in the IntervalUnit . MINUTE that the produced Trigger will repeat at .
8,857
public CalendarIntervalScheduleBuilder withIntervalInHours ( final int intervalInHours ) { _validateInterval ( intervalInHours ) ; m_nInterval = intervalInHours ; m_eIntervalUnit = EIntervalUnit . HOUR ; return this ; }
Specify an interval in the IntervalUnit . HOUR that the produced Trigger will repeat at .
8,858
public CalendarIntervalScheduleBuilder withIntervalInDays ( final int intervalInDays ) { _validateInterval ( intervalInDays ) ; m_nInterval = intervalInDays ; m_eIntervalUnit = EIntervalUnit . DAY ; return this ; }
Specify an interval in the IntervalUnit . DAY that the produced Trigger will repeat at .
8,859
public CalendarIntervalScheduleBuilder withIntervalInWeeks ( final int intervalInWeeks ) { _validateInterval ( intervalInWeeks ) ; m_nInterval = intervalInWeeks ; m_eIntervalUnit = EIntervalUnit . WEEK ; return this ; }
Specify an interval in the IntervalUnit . WEEK that the produced Trigger will repeat at .
8,860
public CalendarIntervalScheduleBuilder withIntervalInMonths ( final int intervalInMonths ) { _validateInterval ( intervalInMonths ) ; m_nInterval = intervalInMonths ; m_eIntervalUnit = EIntervalUnit . MONTH ; return this ; }
Specify an interval in the IntervalUnit . MONTH that the produced Trigger will repeat at .
8,861
public CalendarIntervalScheduleBuilder withIntervalInYears ( final int intervalInYears ) { _validateInterval ( intervalInYears ) ; m_nInterval = intervalInYears ; m_eIntervalUnit = EIntervalUnit . YEAR ; return this ; }
Specify an interval in the IntervalUnit . YEAR that the produced Trigger will repeat at .
8,862
static int checkResult ( int result ) { if ( exceptionsEnabled && result != cusolverStatus . CUSOLVER_STATUS_SUCCESS ) { throw new CudaException ( cusolverStatus . stringFor ( result ) ) ; } return result ; }
If the given result is not cusolverStatus . CUSOLVER_STATUS_SUCCESS and exceptions have been enabled this method will throw a CudaException with an error message that corresponds to the given result code . Otherwise the given result is simply returned .
8,863
public NonBlockingProperties getPropertyGroup ( final String sPrefix , final boolean bStripPrefix , final String [ ] excludedPrefixes ) { final NonBlockingProperties group = new NonBlockingProperties ( ) ; String prefix = sPrefix ; if ( ! prefix . endsWith ( "." ) ) prefix += "." ; for ( final String key : m_aProps . k...
Get all properties that start with the given prefix .
8,864
public void partialDeserialize ( TBase < ? , ? > base , DBObject dbObject , TFieldIdEnum ... fieldIds ) throws TException { try { protocol_ . setDBOject ( dbObject ) ; protocol_ . setBaseObject ( base ) ; protocol_ . setFieldIdsFilter ( base , fieldIds ) ; base . read ( protocol_ ) ; } finally { protocol_ . reset ( ) ;...
Deserialize only a single Thrift object from a byte record .
8,865
public Verifier newVerifier ( String uri ) throws VerifierConfigurationException , SAXException , IOException { return compileSchema ( uri ) . newVerifier ( ) ; }
parses a schema at the specified location and returns a Verifier object that validates documents by using that schema .
8,866
public Verifier newVerifier ( File file ) throws VerifierConfigurationException , SAXException , IOException { return compileSchema ( file ) . newVerifier ( ) ; }
parses a schema from the specified file and returns a Verifier object that validates documents by using that schema .
8,867
public Verifier newVerifier ( InputSource source ) throws VerifierConfigurationException , SAXException , IOException { return compileSchema ( source ) . newVerifier ( ) ; }
parses a schema from the specified InputSource and returns a Verifier object that validates documents by using that schema .
8,868
public static VerifierFactory newInstance ( String language , ClassLoader classLoader ) throws VerifierConfigurationException { Iterator itr = providers ( VerifierFactoryLoader . class , classLoader ) ; while ( itr . hasNext ( ) ) { VerifierFactoryLoader loader = ( VerifierFactoryLoader ) itr . next ( ) ; try { Verifie...
Creates a new instance of a VerifierFactory for the specified schema language .
8,869
public void deleteUnpackedWAR ( StandardContext standardContext ) { File unpackDir = new File ( standardHost . getAppBase ( ) , standardContext . getPath ( ) . substring ( 1 ) ) ; if ( unpackDir . exists ( ) ) { ExpandWar . deleteDir ( unpackDir ) ; } }
Make sure an the unpacked WAR is not left behind you would think Tomcat would cleanup an unpacked WAR but it doesn t
8,870
public boolean sameValue ( Object value1 , Object value2 ) { return ( ( BigDecimal ) value1 ) . compareTo ( ( BigDecimal ) value2 ) == 0 ; }
BigDecimal . equals considers objects distinct if they have the different scales but the same mathematical value . Similarly for hashCode .
8,871
public void addSchema ( String uri , IslandSchema s ) { if ( schemata . containsKey ( uri ) ) throw new IllegalArgumentException ( ) ; schemata . put ( uri , s ) ; }
adds a new IslandSchema .
8,872
public String generateNonce ( ) { Date date = new Date ( ) ; long time = date . getTime ( ) ; Random rand = new Random ( ) ; long pad = rand . nextLong ( ) ; String nonceString = ( Long . valueOf ( time ) ) . toString ( ) + ( Long . valueOf ( pad ) ) . toString ( ) ; byte mdbytes [ ] = messageDigest . digest ( nonceStr...
Generate the challenge string .
8,873
public static String formatException ( final Exception e ) { final StringBuilder sb = new StringBuilder ( ) ; Throwable t = e ; while ( t != null ) { sb . append ( t . getMessage ( ) ) . append ( "\n" ) ; t = t . getCause ( ) ; } return sb . toString ( ) ; }
Formats the given exception in a multiline error message with all causes .
8,874
public DailyTimeIntervalScheduleBuilder onDaysOfTheWeek ( final Set < DayOfWeek > onDaysOfWeek ) { ValueEnforcer . notEmpty ( onDaysOfWeek , "OnDaysOfWeek" ) ; m_aDaysOfWeek = onDaysOfWeek ; return this ; }
Set the trigger to fire on the given days of the week .
8,875
public DailyTimeIntervalScheduleBuilder endingDailyAfterCount ( final int count ) { ValueEnforcer . isGT0 ( count , "Count" ) ; if ( m_aStartTimeOfDay == null ) throw new IllegalArgumentException ( "You must set the startDailyAt() before calling this endingDailyAfterCount()!" ) ; final Date today = new Date ( ) ; final...
Calculate and set the endTimeOfDay using count interval and starTimeOfDay . This means that these must be set before this method is call .
8,876
protected void onValidMarkup ( AppendingStringBuffer responseBuffer , ValidationReport report ) { IRequestablePage responsePage = getResponsePage ( ) ; DocType doctype = getDocType ( responseBuffer ) ; log . info ( "Markup for {} is valid {}" , responsePage != null ? responsePage . getClass ( ) . getName ( ) : "<unable...
Called when the validated markup does not contain any errors .
8,877
protected void onInvalidMarkup ( AppendingStringBuffer responseBuffer , ValidationReport report ) { String head = report . getHeadMarkup ( ) ; String body = report . getBodyMarkup ( ) ; int indexOfHeadClose = responseBuffer . lastIndexOf ( "</head>" ) ; responseBuffer . insert ( indexOfHeadClose , head ) ; int indexOfB...
Called when the validated markup contains errors .
8,878
< T > Class < T > loadClass ( String name ) throws ClassNotFoundException { ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( null == cl ) { cl = ToHelper . class . getClassLoader ( ) ; } return ( Class < T > ) cl . loadClass ( name ) ; }
Load class with given name from the correct class loader .
8,879
List < Field > getFields ( Class < ? > clazz ) { List < Field > result = new ArrayList < > ( ) ; Set < String > fieldNames = new HashSet < > ( ) ; Class < ? > searchType = clazz ; while ( ! Object . class . equals ( searchType ) && searchType != null ) { Field [ ] fields = searchType . getDeclaredFields ( ) ; for ( Fie...
Find all declared fields of a class . Fields which are hidden by a child class are not included .
8,880
Method getMethod ( Class < ? > type , Class < ? > returnType , String name , Class < ? > ... parameters ) { Method method = null ; try { method = type . getMethod ( name , parameters ) ; if ( null != returnType && ! returnType . isAssignableFrom ( method . getReturnType ( ) ) ) { method = null ; } } catch ( NoSuchMetho...
Get method with given name and parameters and given return type .
8,881
protected static void triggerCustomExceptionHandler ( final Throwable t , final String sJobClassName , final IJob aJob ) { exceptionCallbacks ( ) . forEach ( x -> x . onScheduledJobException ( t , sJobClassName , aJob ) ) ; }
Called when an exception of the specified type occurred
8,882
public static Response toResponse ( Response . Status status , String wwwAuthHeader ) { Response . ResponseBuilder rb = Response . status ( status ) ; if ( wwwAuthHeader != null ) { rb . header ( "WWW-Authenticate" , wwwAuthHeader ) ; } return rb . build ( ) ; }
Maps this exception to a response object .
8,883
public void execute ( final FifoTask < E > task ) throws InterruptedException { final int id ; synchronized ( this ) { id = idCounter ++ ; taskMap . put ( id , task ) ; while ( activeCounter >= maxThreads ) { wait ( ) ; } activeCounter ++ ; } this . threadPoolExecutor . execute ( new Runnable ( ) { public void run ( ) ...
Executes the submitted task . If the maximum number of pooled threads is in use this method blocks until one of a them is available .
8,884
public static String executeProcess ( Map < String , String > env , File workingFolder , String ... command ) throws ProcessException , InterruptedException { ProcessBuilder pb = new ProcessBuilder ( command ) ; if ( workingFolder != null ) { pb . directory ( workingFolder ) ; } if ( env != null ) { pb . environment ( ...
Executes a native process with small stdout and stderr payloads
8,885
public static int cusolverRfGetMatrixFormat ( cusolverRfHandle handle , int [ ] format , int [ ] diag ) { return checkResult ( cusolverRfGetMatrixFormatNative ( handle , format , diag ) ) ; }
CUSOLVERRF set and get input format
8,886
public static int cusolverRfSetNumericProperties ( cusolverRfHandle handle , double zero , double boost ) { return checkResult ( cusolverRfSetNumericPropertiesNative ( handle , zero , boost ) ) ; }
CUSOLVERRF set and get numeric properties
8,887
public static int cusolverRfSetAlgs ( cusolverRfHandle handle , int factAlg , int solveAlg ) { return checkResult ( cusolverRfSetAlgsNative ( handle , factAlg , solveAlg ) ) ; }
CUSOLVERRF choose the triangular solve algorithm
8,888
public static int cusolverRfSetupHost ( int n , int nnzA , Pointer h_csrRowPtrA , Pointer h_csrColIndA , Pointer h_csrValA , int nnzL , Pointer h_csrRowPtrL , Pointer h_csrColIndL , Pointer h_csrValL , int nnzU , Pointer h_csrRowPtrU , Pointer h_csrColIndU , Pointer h_csrValU , Pointer h_P , Pointer h_Q , cusolverRfHan...
CUSOLVERRF setup of internal structures from host or device memory
8,889
public static int cusolverRfBatchSetupHost ( int batchSize , int n , int nnzA , Pointer h_csrRowPtrA , Pointer h_csrColIndA , Pointer h_csrValA_array , int nnzL , Pointer h_csrRowPtrL , Pointer h_csrColIndL , Pointer h_csrValL , int nnzU , Pointer h_csrRowPtrU , Pointer h_csrColIndU , Pointer h_csrValU , Pointer h_P , ...
CUSOLVERRF - batch setup of internal structures from host
8,890
public static RegexPathTemplate create ( String urlTemplate ) { StringBuffer baseUrl = new StringBuffer ( ) ; Map < String , PathTemplate > templates = new HashMap < String , PathTemplate > ( ) ; CurlyBraceTokenizer t = new CurlyBraceTokenizer ( urlTemplate ) ; while ( t . hasNext ( ) ) { String tok = t . next ( ) ; if...
Creates a regex path template for the given URI template
8,891
public void addValidator ( Schema schema , ModeUsage modeUsage ) { schemas . addElement ( schema ) ; Validator validator = createValidator ( schema ) ; validators . addElement ( validator ) ; activeHandlers . addElement ( validator . getContentHandler ( ) ) ; activeHandlersAttributeModeUsage . addElement ( modeUsage ) ...
Adds a validator .
8,892
public static void writeStringToFile ( File file , String data , String charset ) throws IOException { FileOutputStream fos = openOutputStream ( file , false ) ; fos . write ( data . getBytes ( charset ) ) ; fos . close ( ) ; }
Writes a String to a file creating the file if it does not exist .
8,893
public static Thread pipeAsynchronously ( final InputStream is , final ErrorHandler errorHandler , final boolean closeResources , final OutputStream ... os ) { Thread t = new Thread ( ) { public void run ( ) { try { pipeSynchronously ( is , closeResources , os ) ; } catch ( Throwable th ) { if ( errorHandler != null ) ...
Asynchronous writing from is to os
8,894
public static File createFile ( String filePath ) throws IOException { boolean isDirectory = filePath . endsWith ( "/" ) || filePath . endsWith ( "\\" ) ; String formattedFilePath = formatFilePath ( filePath ) ; File f = new File ( formattedFilePath ) ; if ( f . exists ( ) ) { return f ; } if ( isDirectory ) { f . mkdi...
Creates a file in the specified path . Creates also any necessary folder needed to achieve the file level of nesting .
8,895
public boolean compete ( NamespaceSpecification other ) { if ( "" . equals ( other . wildcard ) ) { return covers ( other . ns ) ; } String [ ] otherParts = split ( other . ns , other . wildcard ) ; if ( otherParts . length == 1 ) { return covers ( other . ns ) ; } if ( "" . equals ( wildcard ) ) { return other . cover...
Check if this namespace specification competes with another namespace specification .
8,896
static private boolean matchPrefix ( String s1 , String s2 ) { return s1 . startsWith ( s2 ) || s2 . startsWith ( s1 ) ; }
Checks with either of the strings starts with the other .
8,897
public boolean covers ( String uri ) { if ( ANY_NAMESPACE . equals ( ns ) || "" . equals ( wildcard ) ) { return ns . equals ( uri ) ; } String [ ] parts = split ( ns , wildcard ) ; if ( parts . length == 1 ) { return ns . equals ( uri ) ; } if ( ! uri . startsWith ( parts [ 0 ] ) ) { return false ; } if ( ! uri . ends...
Checks if a namespace specification covers a specified URI . any namespace pattern covers only the any namespace uri .
8,898
public void reloadContext ( ) throws DeploymentException { Archive < ? > archive = mssContainer . getArchive ( ) ; deployableContainer . undeploy ( archive ) ; deployableContainer . deploy ( archive ) ; }
Context related methods
8,899
private Mode resolve ( Mode mode ) { if ( mode == Mode . CURRENT ) { return currentMode ; } if ( mode . isAnonymous ( ) && ! mode . isDefined ( ) ) { return currentMode ; } return mode ; }
Resolves the Mode . CURRENT to the currentMode for this mode usage . If Mode . CURRENT is not passed as argument then the same mode is returned with the exception of an anonymous mode that is not defined when we get also the current mode .