idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
146,200
public long [ ] keys ( ) { long [ ] values = new long [ size ] ; int idx = 0 ; for ( Entry entry : table ) { while ( entry != null ) { values [ idx ++ ] = entry . key ; entry = entry . next ; } } return values ; }
Returns all keys in no particular order .
63
8
146,201
public Entry < T > [ ] entries ( ) { @ SuppressWarnings ( "unchecked" ) Entry < T > [ ] entries = new Entry [ size ] ; int idx = 0 ; for ( Entry entry : table ) { while ( entry != null ) { entries [ idx ++ ] = entry ; entry = entry . next ; } } return entries ; }
Returns all entries in no particular order .
79
8
146,202
public boolean add ( long key ) { final int index = ( ( ( ( int ) ( key >>> 32 ) ) ^ ( ( int ) ( key ) ) ) & 0x7fffffff ) % capacity ; final Entry entryOriginal = table [ index ] ; for ( Entry entry = entryOriginal ; entry != null ; entry = entry . next ) { if ( entry . key == key ) { return false ; } } table [ index ] = new Entry ( key , entryOriginal ) ; size ++ ; if ( size > threshold ) { setCapacity ( 2 * capacity ) ; } return true ; }
Adds the given value to the set .
125
8
146,203
public boolean remove ( long key ) { int index = ( ( ( ( int ) ( key >>> 32 ) ) ^ ( ( int ) ( key ) ) ) & 0x7fffffff ) % capacity ; Entry previous = null ; Entry entry = table [ index ] ; while ( entry != null ) { Entry next = entry . next ; if ( entry . key == key ) { if ( previous == null ) { table [ index ] = next ; } else { previous . next = next ; } size -- ; return true ; } previous = entry ; entry = next ; } return false ; }
Removes the given value to the set .
123
9
146,204
public VALUE put ( KEY key , VALUE object ) { CacheEntry < VALUE > entry ; if ( referenceType == ReferenceType . WEAK ) { entry = new CacheEntry <> ( new WeakReference <> ( object ) , null ) ; } else if ( referenceType == ReferenceType . SOFT ) { entry = new CacheEntry <> ( new SoftReference <> ( object ) , null ) ; } else { entry = new CacheEntry <> ( null , object ) ; } countPutCountSinceEviction ++ ; countPut ++ ; if ( isExpiring && nextCleanUpTimestamp == 0 ) { nextCleanUpTimestamp = System . currentTimeMillis ( ) + expirationMillis + 1 ; } CacheEntry < VALUE > oldEntry ; synchronized ( this ) { if ( values . size ( ) >= maxSize ) { evictToTargetSize ( maxSize - 1 ) ; } oldEntry = values . put ( key , entry ) ; } return getValueForRemoved ( oldEntry ) ; }
Stores an new entry in the cache .
215
9
146,205
public void putAll ( Map < KEY , VALUE > mapDataToPut ) { int targetSize = maxSize - mapDataToPut . size ( ) ; if ( maxSize > 0 && values . size ( ) > targetSize ) { evictToTargetSize ( targetSize ) ; } Set < Entry < KEY , VALUE > > entries = mapDataToPut . entrySet ( ) ; for ( Entry < KEY , VALUE > entry : entries ) { put ( entry . getKey ( ) , entry . getValue ( ) ) ; } }
Stores all entries contained in the given map in the cache .
116
13
146,206
public VALUE get ( KEY key ) { CacheEntry < VALUE > entry ; synchronized ( this ) { entry = values . get ( key ) ; } VALUE value ; if ( entry != null ) { if ( isExpiring ) { long age = System . currentTimeMillis ( ) - entry . timeCreated ; if ( age < expirationMillis ) { value = getValue ( key , entry ) ; } else { countExpired ++ ; synchronized ( this ) { values . remove ( key ) ; } value = null ; } } else { value = getValue ( key , entry ) ; } } else { value = null ; } if ( value != null ) { countHit ++ ; } else { countMiss ++ ; } return value ; }
Get the cached entry or null if no valid cached entry is found .
157
14
146,207
public static int copyAllBytes ( InputStream in , OutputStream out ) throws IOException { int byteCount = 0 ; byte [ ] buffer = new byte [ BUFFER_SIZE ] ; while ( true ) { int read = in . read ( buffer ) ; if ( read == - 1 ) { break ; } out . write ( buffer , 0 , read ) ; byteCount += read ; } return byteCount ; }
Copies all available data from in to out without closing any stream .
87
14
146,208
public synchronized int get ( ) { if ( available == 0 ) { return - 1 ; } byte value = buffer [ idxGet ] ; idxGet = ( idxGet + 1 ) % capacity ; available -- ; return value ; }
Gets a single byte return or - 1 if no data is available .
50
15
146,209
public synchronized int get ( byte [ ] dst , int off , int len ) { if ( available == 0 ) { return 0 ; } // limit is last index to read + 1 int limit = idxGet < idxPut ? idxPut : capacity ; int count = Math . min ( limit - idxGet , len ) ; System . arraycopy ( buffer , idxGet , dst , off , count ) ; idxGet += count ; if ( idxGet == capacity ) { // Array end reached, check if we have more int count2 = Math . min ( len - count , idxPut ) ; if ( count2 > 0 ) { System . arraycopy ( buffer , 0 , dst , off + count , count2 ) ; idxGet = count2 ; count += count2 ; } else { idxGet = 0 ; } } available -= count ; return count ; }
Gets as many of the requested bytes as available from this buffer .
188
14
146,210
public synchronized boolean put ( byte value ) { if ( available == capacity ) { return false ; } buffer [ idxPut ] = value ; idxPut = ( idxPut + 1 ) % capacity ; available ++ ; return true ; }
Puts a single byte if the buffer is not yet full .
50
13
146,211
public synchronized int put ( byte [ ] src , int off , int len ) { if ( available == capacity ) { return 0 ; } // limit is last index to put + 1 int limit = idxPut < idxGet ? idxGet : capacity ; int count = Math . min ( limit - idxPut , len ) ; System . arraycopy ( src , off , buffer , idxPut , count ) ; idxPut += count ; if ( idxPut == capacity ) { // Array end reached, check if we have more int count2 = Math . min ( len - count , idxGet ) ; if ( count2 > 0 ) { System . arraycopy ( src , off + count , buffer , 0 , count2 ) ; idxPut = count2 ; count += count2 ; } else { idxPut = 0 ; } } available += count ; return count ; }
Puts as many of the given bytes as possible into this buffer .
188
14
146,212
public synchronized int skip ( int count ) { if ( count > available ) { count = available ; } idxGet = ( idxGet + count ) % capacity ; available -= count ; return count ; }
Skips the given count of bytes but at most the currently available count .
43
15
146,213
public static Object readObject ( File file ) throws IOException , ClassNotFoundException { FileInputStream fileIn = new FileInputStream ( file ) ; ObjectInputStream in = new ObjectInputStream ( new BufferedInputStream ( fileIn ) ) ; try { return in . readObject ( ) ; } finally { IoUtils . safeClose ( in ) ; } }
To read an object in a quick & dirty way . Prepare to handle failures when object serialization changes!
78
21
146,214
public static void writeObject ( File file , Object object ) throws IOException { FileOutputStream fileOut = new FileOutputStream ( file ) ; ObjectOutputStream out = new ObjectOutputStream ( new BufferedOutputStream ( fileOut ) ) ; try { out . writeObject ( object ) ; out . flush ( ) ; // Force sync fileOut . getFD ( ) . sync ( ) ; } finally { IoUtils . safeClose ( out ) ; } }
To store an object in a quick & dirty way .
97
11
146,215
public static void setTime ( Calendar calendar , int hourOfDay , int minute , int second , int millisecond ) { calendar . set ( Calendar . HOUR_OF_DAY , hourOfDay ) ; calendar . set ( Calendar . MINUTE , minute ) ; calendar . set ( Calendar . SECOND , second ) ; calendar . set ( Calendar . MILLISECOND , millisecond ) ; }
Sets hour minutes seconds and milliseconds to the given values . Leaves date info untouched .
83
17
146,216
public static int getDayAsReadableInt ( long time ) { Calendar cal = calendarThreadLocal . get ( ) ; cal . setTimeInMillis ( time ) ; return getDayAsReadableInt ( cal ) ; }
Readable yyyyMMdd int representation of a day which is also sortable .
48
18
146,217
public static int getDayAsReadableInt ( Calendar calendar ) { int day = calendar . get ( Calendar . DAY_OF_MONTH ) ; int month = calendar . get ( Calendar . MONTH ) + 1 ; int year = calendar . get ( Calendar . YEAR ) ; return year * 10000 + month * 100 + day ; }
Readable yyyyMMdd representation of a day which is also sortable .
70
17
146,218
public static String encodeUrlIso ( String stringToEncode ) { try { return URLEncoder . encode ( stringToEncode , "ISO-8859-1" ) ; } catch ( UnsupportedEncodingException e1 ) { throw new RuntimeException ( e1 ) ; } }
URL - encodes a given string using ISO - 8859 - 1 which may work better with web pages and umlauts compared to UTF - 8 . No UnsupportedEncodingException to handle as it is dealt with in this method .
63
48
146,219
public static String decodeUrl ( String stringToDecode ) { try { return URLDecoder . decode ( stringToDecode , "UTF-8" ) ; } catch ( UnsupportedEncodingException e1 ) { throw new RuntimeException ( e1 ) ; } }
URL - Decodes a given string using UTF - 8 . No UnsupportedEncodingException to handle as it is dealt with in this method .
57
29
146,220
public static String decodeUrlIso ( String stringToDecode ) { try { return URLDecoder . decode ( stringToDecode , "ISO-8859-1" ) ; } catch ( UnsupportedEncodingException e1 ) { throw new RuntimeException ( e1 ) ; } }
URL - Decodes a given string using ISO - 8859 - 1 . No UnsupportedEncodingException to handle as it is dealt with in this method .
62
32
146,221
public static String ellipsize ( String text , int maxLength , String end ) { if ( text != null && text . length ( ) > maxLength ) { return text . substring ( 0 , maxLength - end . length ( ) ) + end ; } return text ; }
Cuts the string at the end if it s longer than maxLength and appends the given end string to it . The length of the resulting string is always less or equal to the given maxLength . It s valid to pass a null text ; in this case null is returned .
59
57
146,222
public static String join ( Iterable < ? > iterable , String separator ) { if ( iterable != null ) { StringBuilder buf = new StringBuilder ( ) ; Iterator < ? > it = iterable . iterator ( ) ; char singleChar = separator . length ( ) == 1 ? separator . charAt ( 0 ) : 0 ; while ( it . hasNext ( ) ) { buf . append ( it . next ( ) ) ; if ( it . hasNext ( ) ) { if ( singleChar != 0 ) { // More efficient buf . append ( singleChar ) ; } else { buf . append ( separator ) ; } } } return buf . toString ( ) ; } else { return "" ; } }
Joins the given iterable objects using the given separator into a single string .
154
17
146,223
public static String join ( int [ ] array , String separator ) { if ( array != null ) { StringBuilder buf = new StringBuilder ( Math . max ( 16 , ( separator . length ( ) + 1 ) * array . length ) ) ; char singleChar = separator . length ( ) == 1 ? separator . charAt ( 0 ) : 0 ; for ( int i = 0 ; i < array . length ; i ++ ) { if ( i != 0 ) { if ( singleChar != 0 ) { // More efficient buf . append ( singleChar ) ; } else { buf . append ( separator ) ; } } buf . append ( array [ i ] ) ; } return buf . toString ( ) ; } else { return "" ; } }
Joins the given ints using the given separator into a single string .
160
16
146,224
protected void prepareForwardedResponseHeaders ( ResponseData response ) { HttpHeaders headers = response . getHeaders ( ) ; headers . remove ( TRANSFER_ENCODING ) ; headers . remove ( CONNECTION ) ; headers . remove ( "Public-Key-Pins" ) ; headers . remove ( SERVER ) ; headers . remove ( "Strict-Transport-Security" ) ; }
Remove any protocol - level headers from the remote server s response that do not apply to the new response we are sending .
87
24
146,225
protected void prepareForwardedRequestHeaders ( RequestData request , ForwardDestination destination ) { HttpHeaders headers = request . getHeaders ( ) ; headers . set ( HOST , destination . getUri ( ) . getAuthority ( ) ) ; headers . remove ( TE ) ; }
Remove any protocol - level headers from the clients request that do not apply to the new request we are sending to the remote server .
63
26
146,226
private String normalizePath ( String scriptPath ) { StringBuilder builder = new StringBuilder ( scriptPath . length ( ) + 1 ) ; if ( scriptPath . startsWith ( "/" ) ) { builder . append ( scriptPath . substring ( 1 ) ) ; } else { builder . append ( scriptPath ) ; } if ( ! scriptPath . endsWith ( "/" ) ) { builder . append ( "/" ) ; } return builder . toString ( ) ; }
Ensures that every path starts and ends with a slash character .
100
14
146,227
public List < DbMigration > getMigrationsSinceVersion ( int version ) { List < DbMigration > dbMigrations = new ArrayList <> ( ) ; migrationScripts . stream ( ) . filter ( script -> script . getVersion ( ) > version ) . forEach ( script -> { String content = loadScriptContent ( script ) ; dbMigrations . add ( new DbMigration ( script . getScriptName ( ) , script . getVersion ( ) , content ) ) ; } ) ; return dbMigrations ; }
Returns all migrations starting from and excluding the given version . Usually you want to provide the version of the database here to get all migrations that need to be executed . In case there is no script with a newer version than the one given an empty list is returned .
119
54
146,228
public int getVersion ( ) { ResultSet resultSet = session . execute ( format ( VERSION_QUERY , getTableName ( ) ) ) ; Row result = resultSet . one ( ) ; if ( result == null ) { return 0 ; } return result . getInt ( 0 ) ; }
Gets the current version of the database schema . This version is taken from the migration table and represent the latest successful entry .
63
25
146,229
private void logMigration ( DbMigration migration , boolean wasSuccessful ) { BoundStatement boundStatement = logMigrationStatement . bind ( wasSuccessful , migration . getVersion ( ) , migration . getScriptName ( ) , migration . getMigrationScript ( ) , new Date ( ) ) ; session . execute ( boundStatement ) ; }
Inserts the result of the migration into the migration table
73
11
146,230
public void migrate ( ) { if ( databaseIsUpToDate ( ) ) { LOGGER . info ( format ( "Keyspace %s is already up to date at version %d" , database . getKeyspaceName ( ) , database . getVersion ( ) ) ) ; return ; } List < DbMigration > migrations = repository . getMigrationsSinceVersion ( database . getVersion ( ) ) ; migrations . forEach ( database :: execute ) ; LOGGER . info ( format ( "Migrated keyspace %s to version %d" , database . getKeyspaceName ( ) , database . getVersion ( ) ) ) ; database . close ( ) ; }
Start the actual migration . Take the version of the database get all required migrations and execute them or do nothing if the DB is already up to date .
144
31
146,231
public Set < String > findResourceNames ( String location , URI locationUri ) throws IOException { String filePath = toFilePath ( locationUri ) ; File folder = new File ( filePath ) ; if ( ! folder . isDirectory ( ) ) { LOGGER . debug ( "Skipping path as it is not a directory: " + filePath ) ; return new TreeSet <> ( ) ; } String classPathRootOnDisk = filePath . substring ( 0 , filePath . length ( ) - location . length ( ) ) ; if ( ! classPathRootOnDisk . endsWith ( File . separator ) ) { classPathRootOnDisk = classPathRootOnDisk + File . separator ; } LOGGER . debug ( "Scanning starting at classpath root in filesystem: " + classPathRootOnDisk ) ; return findResourceNamesFromFileSystem ( classPathRootOnDisk , location , folder ) ; }
Scans a path on the filesystem for resources inside the given classpath location .
199
16
146,232
private Set < String > findResourceNamesFromFileSystem ( String classPathRootOnDisk , String scanRootLocation , File folder ) { LOGGER . debug ( "Scanning for resources in path: {} ({})" , folder . getPath ( ) , scanRootLocation ) ; File [ ] files = folder . listFiles ( ) ; if ( files == null ) { return emptySet ( ) ; } Set < String > resourceNames = new TreeSet <> ( ) ; for ( File file : files ) { if ( file . canRead ( ) ) { if ( file . isDirectory ( ) ) { resourceNames . addAll ( findResourceNamesFromFileSystem ( classPathRootOnDisk , scanRootLocation , file ) ) ; } else { resourceNames . add ( toResourceNameOnClasspath ( classPathRootOnDisk , file ) ) ; } } } return resourceNames ; }
Finds all the resource names contained in this file system folder .
187
13
146,233
private String toResourceNameOnClasspath ( String classPathRootOnDisk , File file ) { String fileName = file . getAbsolutePath ( ) . replace ( "\\" , "/" ) ; return fileName . substring ( classPathRootOnDisk . length ( ) ) ; }
Converts this file into a resource name on the classpath by cutting of the file path to the classpath root .
62
24
146,234
public static < T > T notNull ( T argument , String argumentName ) { if ( argument == null ) { throw new IllegalArgumentException ( "Argument " + argumentName + " must not be null." ) ; } return argument ; }
Checks if the given argument is null and throws an exception with a message containing the argument name if that it true .
52
24
146,235
public static String notNullOrEmpty ( String argument , String argumentName ) { if ( argument == null || argument . trim ( ) . isEmpty ( ) ) { throw new IllegalArgumentException ( "Argument " + argumentName + " must not be null or empty." ) ; } return argument ; }
Checks if the given String is null or contains only whitespaces . The String is trimmed before the empty check .
64
23
146,236
public static TestSuiteResult unmarshal ( File testSuite ) throws IOException { try ( InputStream stream = new FileInputStream ( testSuite ) ) { return unmarshal ( stream ) ; } }
Unmarshal test suite from given file .
46
10
146,237
public static List < TestSuiteResult > unmarshalSuites ( File ... directories ) throws IOException { List < TestSuiteResult > results = new ArrayList <> ( ) ; List < File > files = listTestSuiteFiles ( directories ) ; for ( File file : files ) { results . add ( unmarshal ( file ) ) ; } return results ; }
Find and unmarshal all test suite files in given directories .
80
13
146,238
public static List < File > listFilesByRegex ( String regex , File ... directories ) { return listFiles ( directories , new RegexFileFilter ( regex ) , CanReadFileFilter . CAN_READ ) ; }
Returns list of files matches specified regex in specified directories
46
10
146,239
public static List < File > listFiles ( File [ ] directories , IOFileFilter fileFilter , IOFileFilter dirFilter ) { List < File > files = new ArrayList <> ( ) ; for ( File directory : directories ) { if ( ! directory . isDirectory ( ) ) { continue ; } Collection < File > filesInDirectory = FileUtils . listFiles ( directory , fileFilter , dirFilter ) ; files . addAll ( filesInDirectory ) ; } return files ; }
Returns list of files matches filters in specified directories
102
9
146,240
private void populateAnnotations ( Collection < Annotation > annotations ) { for ( Annotation each : annotations ) { this . annotations . put ( each . annotationType ( ) , each ) ; } }
Used to populate Map with given annotations
41
7
146,241
public void setDefaults ( Annotation [ ] defaultAnnotations ) { if ( defaultAnnotations == null ) { return ; } for ( Annotation each : defaultAnnotations ) { Class < ? extends Annotation > key = each . annotationType ( ) ; if ( Title . class . equals ( key ) || Description . class . equals ( key ) ) { continue ; } if ( ! annotations . containsKey ( key ) ) { annotations . put ( key , each ) ; } } }
Set default values for annotations . Initial annotation take precedence over the default annotation when both annotation types are present
102
20
146,242
private static String getHostname ( ) { if ( Hostname == null ) { try { Hostname = InetAddress . getLocalHost ( ) . getHostName ( ) ; } catch ( Exception e ) { Hostname = "default" ; LOGGER . warn ( "Can not get current hostname" , e ) ; } } return Hostname ; }
Save current hostname and reuse it .
76
8
146,243
public static TestCaseStartedEvent withExecutorInfo ( TestCaseStartedEvent event ) { event . getLabels ( ) . add ( createHostLabel ( getHostname ( ) ) ) ; event . getLabels ( ) . add ( createThreadLabel ( format ( "%s.%s(%s)" , ManagementFactory . getRuntimeMXBean ( ) . getName ( ) , Thread . currentThread ( ) . getName ( ) , Thread . currentThread ( ) . getId ( ) ) ) ) ; return event ; }
Add information about host and thread to specified test case started event
115
12
146,244
private void openBrowser ( URI url ) throws IOException { if ( Desktop . isDesktopSupported ( ) ) { Desktop . getDesktop ( ) . browse ( url ) ; } else { LOGGER . error ( "Can not open browser because this capability is not supported on " + "your platform. You can use the link below to open the report manually." ) ; } }
Open the given url in default system browser .
77
9
146,245
private Server setUpServer ( ) { Server server = new Server ( port ) ; ResourceHandler handler = new ResourceHandler ( ) ; handler . setDirectoriesListed ( true ) ; handler . setWelcomeFiles ( new String [ ] { "index.html" } ) ; handler . setResourceBase ( getReportDirectoryPath ( ) . toAbsolutePath ( ) . toString ( ) ) ; HandlerList handlers = new HandlerList ( ) ; handlers . setHandlers ( new Handler [ ] { handler , new DefaultHandler ( ) } ) ; server . setStopAtShutdown ( true ) ; server . setHandler ( handlers ) ; return server ; }
Set up server for report directory .
137
7
146,246
private static boolean checkModifiers ( Class < ? extends AbstractPlugin > pluginClass ) { int modifiers = pluginClass . getModifiers ( ) ; return ! Modifier . isAbstract ( modifiers ) && ! Modifier . isInterface ( modifiers ) && ! Modifier . isPrivate ( modifiers ) ; }
Check given class modifiers . Plugin with resources plugin should not be private or abstract or interface .
62
18
146,247
@ Override public void fire ( StepStartedEvent event ) { for ( LifecycleListener listener : listeners ) { try { listener . fire ( event ) ; } catch ( Exception e ) { logError ( listener , e ) ; } } }
Invoke to tell listeners that an step started event processed
51
11
146,248
private void logError ( LifecycleListener listener , Exception e ) { LOGGER . error ( "Error for listener " + listener . getClass ( ) , e ) ; }
This method log given exception in specified listener
36
8
146,249
public static String cutEnd ( String data , int maxLength ) { if ( data . length ( ) > maxLength ) { return data . substring ( 0 , maxLength ) + "..." ; } else { return data ; } }
Cut all characters from maxLength and replace it with ...
49
11
146,250
public static < T > List < T > load ( ClassLoader classLoader , Class < T > serviceType ) { List < T > foundServices = new ArrayList <> ( ) ; Iterator < T > iterator = ServiceLoader . load ( serviceType , classLoader ) . iterator ( ) ; while ( checkHasNextSafely ( iterator ) ) { try { T item = iterator . next ( ) ; foundServices . add ( item ) ; LOGGER . debug ( String . format ( "Found %s [%s]" , serviceType . getSimpleName ( ) , item . toString ( ) ) ) ; } catch ( ServiceConfigurationError e ) { LOGGER . trace ( "Can't find services using Java SPI" , e ) ; LOGGER . error ( e . getMessage ( ) ) ; } } return foundServices ; }
Invoke to find all services for given service type using specified class loader
176
14
146,251
private static void unpackFace ( File outputDirectory ) throws IOException { ClassLoader loader = AllureMain . class . getClassLoader ( ) ; for ( ClassPath . ResourceInfo info : ClassPath . from ( loader ) . getResources ( ) ) { Matcher matcher = REPORT_RESOURCE_PATTERN . matcher ( info . getResourceName ( ) ) ; if ( matcher . find ( ) ) { String resourcePath = matcher . group ( 1 ) ; File dest = new File ( outputDirectory , resourcePath ) ; Files . createParentDirs ( dest ) ; try ( FileOutputStream output = new FileOutputStream ( dest ) ; InputStream input = info . url ( ) . openStream ( ) ) { IOUtils . copy ( input , output ) ; LOGGER . debug ( "{} successfully copied." , resourcePath ) ; } } } }
Unpack report face to given directory .
187
8
146,252
protected Path createTempDirectory ( String prefix ) { try { return Files . createTempDirectory ( tempDirectory , prefix ) ; } catch ( IOException e ) { throw new AllureCommandException ( e ) ; } }
Creates an temporary directory . The created directory will be deleted when command will ended .
45
17
146,253
private Level getLogLevel ( ) { return isQuiet ( ) ? Level . OFF : isVerbose ( ) ? Level . DEBUG : Level . INFO ; }
Get log level depends on provided client parameters such as verbose and quiet .
35
15
146,254
public static boolean isBadXmlCharacter ( char c ) { boolean cDataCharacter = c < ' ' && c != ' ' && c != ' ' && c != ' ' ; cDataCharacter |= ( c >= ' ' && c < ' ' ) ; cDataCharacter |= ( c == ' ' || c == ' ' ) ; return cDataCharacter ; }
Detect bad xml 1 . 0 characters
78
7
146,255
public static void replaceBadXmlCharactersBySpace ( char [ ] cbuf , int off , int len ) { for ( int i = off ; i < off + len ; i ++ ) { if ( isBadXmlCharacter ( cbuf [ i ] ) ) { cbuf [ i ] = ' ' ; } } }
Replace bad xml charactes in given array by space
69
11
146,256
@ Override public int read ( char [ ] cbuf , int off , int len ) throws IOException { int numChars = super . read ( cbuf , off , len ) ; replaceBadXmlCharactersBySpace ( cbuf , off , len ) ; return numChars ; }
Reads characters into a portion of an array then replace invalid XML characters
62
14
146,257
@ Override protected void runUnsafe ( ) throws Exception { Path reportDirectory = getReportDirectoryPath ( ) ; Files . walkFileTree ( reportDirectory , new DeleteVisitor ( ) ) ; LOGGER . info ( "Report directory <{}> was successfully cleaned." , reportDirectory ) ; }
Remove the report directory .
63
5
146,258
public static void main ( String [ ] args ) { if ( args . length < 2 ) { // NOSONAR LOGGER . error ( "There must be at least two arguments" ) ; return ; } int lastIndex = args . length - 1 ; AllureReportGenerator reportGenerator = new AllureReportGenerator ( getFiles ( Arrays . copyOf ( args , lastIndex ) ) ) ; reportGenerator . generate ( new File ( args [ lastIndex ] ) ) ; }
Generate Allure report data from directories with allure report results .
105
14
146,259
public static void setPropertySafely ( Marshaller marshaller , String name , Object value ) { try { marshaller . setProperty ( name , value ) ; } catch ( PropertyException e ) { LOGGER . warn ( String . format ( "Can't set \"%s\" property to given marshaller" , name ) , e ) ; } }
Try to set specified property to given marshaller
76
10
146,260
public static Attachment writeAttachmentWithErrorMessage ( Throwable throwable , String title ) { String message = throwable . getMessage ( ) ; try { return writeAttachment ( message . getBytes ( CONFIG . getAttachmentsEncoding ( ) ) , title ) ; } catch ( Exception e ) { e . addSuppressed ( throwable ) ; LOGGER . error ( String . format ( "Can't write attachment \"%s\"" , title ) , e ) ; } return new Attachment ( ) ; }
Write throwable as attachment .
109
6
146,261
public static String getExtensionByMimeType ( String type ) { MimeTypes types = getDefaultMimeTypes ( ) ; try { return types . forName ( type ) . getExtension ( ) ; } catch ( Exception e ) { LOGGER . warn ( "Can't detect extension for MIME-type " + type , e ) ; return "" ; } }
Generate attachment extension from mime type
79
8
146,262
@ Override public void process ( TestCaseResult context ) { context . getParameters ( ) . add ( new Parameter ( ) . withName ( getName ( ) ) . withValue ( getValue ( ) ) . withKind ( ParameterKind . valueOf ( getKind ( ) ) ) ) ; }
Add parameter to testCase
65
5
146,263
protected void validateResultsDirectories ( ) { for ( String result : results ) { if ( Files . notExists ( Paths . get ( result ) ) ) { throw new AllureCommandException ( String . format ( "Report directory <%s> not found." , result ) ) ; } } }
Throws an exception if at least one results directory is missing .
64
13
146,264
protected String getClasspath ( ) throws IOException { List < String > classpath = new ArrayList <> ( ) ; classpath . add ( getBundleJarPath ( ) ) ; classpath . addAll ( getPluginsPath ( ) ) ; return StringUtils . toString ( classpath . toArray ( new String [ classpath . size ( ) ] ) , " " ) ; }
Returns the classpath for executable jar .
85
8
146,265
protected String getExecutableJar ( ) throws IOException { Manifest manifest = new Manifest ( ) ; manifest . getMainAttributes ( ) . put ( Attributes . Name . MANIFEST_VERSION , "1.0" ) ; manifest . getMainAttributes ( ) . put ( Attributes . Name . MAIN_CLASS , MAIN ) ; manifest . getMainAttributes ( ) . put ( Attributes . Name . CLASS_PATH , getClasspath ( ) ) ; Path jar = createTempDirectory ( "exec" ) . resolve ( "generate.jar" ) ; try ( JarOutputStream output = new JarOutputStream ( Files . newOutputStream ( jar ) , manifest ) ) { output . putNextEntry ( new JarEntry ( "allure.properties" ) ) ; Path allureConfig = PROPERTIES . getAllureConfig ( ) ; if ( Files . exists ( allureConfig ) ) { byte [ ] bytes = Files . readAllBytes ( allureConfig ) ; output . write ( bytes ) ; } output . closeEntry ( ) ; } return jar . toAbsolutePath ( ) . toString ( ) ; }
Create an executable jar to generate the report . Created jar contains only allure configuration file .
238
18
146,266
protected String getBundleJarPath ( ) throws MalformedURLException { Path path = PROPERTIES . getAllureHome ( ) . resolve ( "app/allure-bundle.jar" ) . toAbsolutePath ( ) ; if ( Files . notExists ( path ) ) { throw new AllureCommandException ( String . format ( "Bundle not found by path <%s>" , path ) ) ; } return path . toUri ( ) . toURL ( ) . toString ( ) ; }
Returns the bundle jar classpath element .
114
8
146,267
protected List < String > getPluginsPath ( ) throws IOException { List < String > result = new ArrayList <> ( ) ; Path pluginsDirectory = PROPERTIES . getAllureHome ( ) . resolve ( "plugins" ) . toAbsolutePath ( ) ; if ( Files . notExists ( pluginsDirectory ) ) { return Collections . emptyList ( ) ; } try ( DirectoryStream < Path > plugins = Files . newDirectoryStream ( pluginsDirectory , JAR_FILES ) ) { for ( Path plugin : plugins ) { result . add ( plugin . toUri ( ) . toURL ( ) . toString ( ) ) ; } } return result ; }
Returns the plugins classpath elements .
144
7
146,268
protected String getJavaExecutablePath ( ) { String executableName = isWindows ( ) ? "bin/java.exe" : "bin/java" ; return PROPERTIES . getJavaHome ( ) . resolve ( executableName ) . toAbsolutePath ( ) . toString ( ) ; }
Returns the path to java executable .
64
7
146,269
@ Override public void run ( ) { for ( Map . Entry < String , TestSuiteResult > entry : testSuites ) { for ( TestCaseResult testCase : entry . getValue ( ) . getTestCases ( ) ) { markTestcaseAsInterruptedIfNotFinishedYet ( testCase ) ; } entry . getValue ( ) . getTestCases ( ) . add ( createFakeTestcaseWithWarning ( entry . getValue ( ) ) ) ; Allure . LIFECYCLE . fire ( new TestSuiteFinishedEvent ( entry . getKey ( ) ) ) ; } }
Mark unfinished test cases as interrupted for each unfinished test suite then write test suite result
131
16
146,270
public static void checkDirectory ( File directory ) { if ( ! ( directory . exists ( ) || directory . mkdirs ( ) ) ) { throw new ReportGenerationException ( String . format ( "Can't create data directory <%s>" , directory . getAbsolutePath ( ) ) ) ; } }
If directory doesn t exists try to create it .
65
10
146,271
public static int serialize ( final File directory , String name , Object obj ) { try ( FileOutputStream stream = new FileOutputStream ( new File ( directory , name ) ) ) { return serialize ( stream , obj ) ; } catch ( IOException e ) { throw new ReportGenerationException ( e ) ; } }
Serialize specified object to directory with specified name .
68
10
146,272
public static int serialize ( OutputStream stream , Object obj ) { ObjectMapper mapper = createMapperWithJaxbAnnotationInspector ( ) ; try ( DataOutputStream data = new DataOutputStream ( stream ) ; OutputStreamWriter writer = new OutputStreamWriter ( data , StandardCharsets . UTF_8 ) ) { mapper . writerWithDefaultPrettyPrinter ( ) . writeValue ( writer , obj ) ; return data . size ( ) ; } catch ( IOException e ) { throw new ReportGenerationException ( e ) ; } }
Serialize specified object to directory with specified name . Given output stream will be closed .
120
17
146,273
@ Override public void process ( Step step ) { step . setName ( getName ( ) ) ; step . setStatus ( Status . PASSED ) ; step . setStart ( System . currentTimeMillis ( ) ) ; step . setTitle ( getTitle ( ) ) ; }
Sets name status start time and title to specified step
60
11
146,274
@ Override protected Deque < Step > childValue ( Deque < Step > parentValue ) { Deque < Step > queue = new LinkedList <> ( ) ; queue . add ( parentValue . getFirst ( ) ) ; return queue ; }
In case parent thread spawn thread we need create a new queue for child thread but use the only one root step . In the end all steps will be children of root step all we need is sync adding steps
54
41
146,275
public Step createRootStep ( ) { return new Step ( ) . withName ( "Root step" ) . withTitle ( "Allure step processing error: if you see this step something went wrong." ) . withStart ( System . currentTimeMillis ( ) ) . withStatus ( Status . BROKEN ) ; }
Construct new root step . Used for inspect problems with Allure lifecycle
68
14
146,276
@ Override public void process ( Step context ) { Iterator < Attachment > iterator = context . getAttachments ( ) . listIterator ( ) ; while ( iterator . hasNext ( ) ) { Attachment attachment = iterator . next ( ) ; if ( pattern . matcher ( attachment . getSource ( ) ) . matches ( ) ) { deleteAttachment ( attachment ) ; iterator . remove ( ) ; } } for ( Step step : context . getSteps ( ) ) { process ( step ) ; } }
Remove attachments matches pattern from step and all step substeps
108
11
146,277
public void fire ( StepStartedEvent event ) { Step step = new Step ( ) ; event . process ( step ) ; stepStorage . put ( step ) ; notifier . fire ( event ) ; }
Process StepStartedEvent . New step will be created and added to stepStorage .
43
17
146,278
public void fire ( StepEvent event ) { Step step = stepStorage . getLast ( ) ; event . process ( step ) ; notifier . fire ( event ) ; }
Process any StepEvent . You can change last added to stepStorage step using this method .
36
18
146,279
public void fire ( StepFinishedEvent event ) { Step step = stepStorage . adopt ( ) ; event . process ( step ) ; notifier . fire ( event ) ; }
Process StepFinishedEvent . Change last added to stepStorage step and add it as child of previous step .
37
22
146,280
public void fire ( TestCaseStartedEvent event ) { //init root step in parent thread if needed stepStorage . get ( ) ; TestCaseResult testCase = testCaseStorage . get ( ) ; event . process ( testCase ) ; synchronized ( TEST_SUITE_ADD_CHILD_LOCK ) { testSuiteStorage . get ( event . getSuiteUid ( ) ) . getTestCases ( ) . add ( testCase ) ; } notifier . fire ( event ) ; }
Process TestCaseStartedEvent . New testCase will be created and added to suite as child .
106
20
146,281
public void fire ( TestCaseEvent event ) { TestCaseResult testCase = testCaseStorage . get ( ) ; event . process ( testCase ) ; notifier . fire ( event ) ; }
Process TestCaseEvent . You can change current testCase context using this method .
41
16
146,282
public void fire ( TestCaseFinishedEvent event ) { TestCaseResult testCase = testCaseStorage . get ( ) ; event . process ( testCase ) ; Step root = stepStorage . pollLast ( ) ; if ( Status . PASSED . equals ( testCase . getStatus ( ) ) ) { new RemoveAttachmentsEvent ( AllureConfig . newInstance ( ) . getRemoveAttachments ( ) ) . process ( root ) ; } testCase . getSteps ( ) . addAll ( root . getSteps ( ) ) ; testCase . getAttachments ( ) . addAll ( root . getAttachments ( ) ) ; stepStorage . remove ( ) ; testCaseStorage . remove ( ) ; notifier . fire ( event ) ; }
Process TestCaseFinishedEvent . Add steps and attachments from top step from stepStorage to current testCase then remove testCase and step from stores . Also remove attachments matches removeAttachments config .
159
39
146,283
public static String strMapToStr ( Map < String , String > map ) { StringBuilder sb = new StringBuilder ( ) ; if ( map == null || map . isEmpty ( ) ) return sb . toString ( ) ; for ( Entry < String , String > entry : map . entrySet ( ) ) { sb . append ( "< " + entry . getKey ( ) + ", " + entry . getValue ( ) + "> " ) ; } return sb . toString ( ) ; }
Str map to str .
109
5
146,284
public static String getAggregatedResultHuman ( Map < String , LinkedHashSet < String > > aggregateResultMap ) { StringBuilder res = new StringBuilder ( ) ; for ( Entry < String , LinkedHashSet < String > > entry : aggregateResultMap . entrySet ( ) ) { LinkedHashSet < String > valueSet = entry . getValue ( ) ; res . append ( "[" + entry . getKey ( ) + " COUNT: " + valueSet . size ( ) + " ]:\n" ) ; for ( String str : valueSet ) { res . append ( "\t" + str + "\n" ) ; } res . append ( "###################################\n\n" ) ; } return res . toString ( ) ; }
Get the aggregated result human readable string for easy display .
163
12
146,285
public static String renderJson ( Object o ) { Gson gson = new GsonBuilder ( ) . disableHtmlEscaping ( ) . setPrettyPrinting ( ) . create ( ) ; return gson . toJson ( o ) ; }
Render json .
54
3
146,286
public void sendMessageUntilStopCount ( int stopCount ) { // always send with valid data. for ( int i = processedWorkerCount ; i < workers . size ( ) ; ++ i ) { ActorRef worker = workers . get ( i ) ; try { /** * !!! This is a must; without this sleep; stuck occured at 5K. * AKKA seems cannot handle too much too fast message send out. */ Thread . sleep ( 1L ) ; } catch ( InterruptedException e ) { logger . error ( "sleep exception " + e + " details: " , e ) ; } // send as if the sender is the origin manager; so reply back to // origin manager worker . tell ( OperationWorkerMsgType . PROCESS_REQUEST , originalManager ) ; processedWorkerCount ++ ; if ( processedWorkerCount > stopCount ) { return ; } logger . debug ( "REQ_SENT: {} / {} taskId {}" , processedWorkerCount , requestTotalCount , taskIdTrim ) ; } // end for loop }
Note that if there is sleep in this method .
225
10
146,287
public void waitAndRetry ( ) { ContinueToSendToBatchSenderAsstManager continueToSendToBatchSenderAsstManager = new ContinueToSendToBatchSenderAsstManager ( processedWorkerCount ) ; logger . debug ( "NOW WAIT Another " + asstManagerRetryIntervalMillis + " MS. at " + PcDateUtils . getNowDateTimeStrStandard ( ) ) ; getContext ( ) . system ( ) . scheduler ( ) . scheduleOnce ( Duration . create ( asstManagerRetryIntervalMillis , TimeUnit . MILLISECONDS ) , getSelf ( ) , continueToSendToBatchSenderAsstManager , getContext ( ) . system ( ) . dispatcher ( ) , getSelf ( ) ) ; return ; }
Wait and retry .
174
5
146,288
public String getUuidFromResponse ( ResponseOnSingeRequest myResponse ) { String uuid = PcConstants . NA ; String responseBody = myResponse . getResponseBody ( ) ; Pattern regex = Pattern . compile ( getJobIdRegex ( ) ) ; Matcher matcher = regex . matcher ( responseBody ) ; if ( matcher . matches ( ) ) { uuid = matcher . group ( 1 ) ; } return uuid ; }
Gets the uuid from response .
98
8
146,289
public double getProgressFromResponse ( ResponseOnSingeRequest myResponse ) { double progress = 0.0 ; try { if ( myResponse == null || myResponse . isFailObtainResponse ( ) ) { return progress ; } String responseBody = myResponse . getResponseBody ( ) ; Pattern regex = Pattern . compile ( progressRegex ) ; Matcher matcher = regex . matcher ( responseBody ) ; if ( matcher . matches ( ) ) { String progressStr = matcher . group ( 1 ) ; progress = Double . parseDouble ( progressStr ) ; } } catch ( Exception t ) { logger . error ( "fail " + t ) ; } return progress ; }
Gets the progress from response .
144
7
146,290
public boolean ifTaskCompletedSuccessOrFailureFromResponse ( ResponseOnSingeRequest myResponse ) { boolean isCompleted = false ; try { if ( myResponse == null || myResponse . isFailObtainResponse ( ) ) { return isCompleted ; } String responseBody = myResponse . getResponseBody ( ) ; if ( responseBody . matches ( successRegex ) || responseBody . matches ( failureRegex ) ) { isCompleted = true ; } } catch ( Exception t ) { logger . error ( "fail " + t ) ; } return isCompleted ; }
If task completed success or failure from response .
118
9
146,291
public BoundRequestBuilder createRequest ( ) throws HttpRequestCreateException { BoundRequestBuilder builder = null ; getLogger ( ) . debug ( "AHC completeUrl " + requestUrl ) ; try { switch ( httpMethod ) { case GET : builder = client . prepareGet ( requestUrl ) ; break ; case POST : builder = client . preparePost ( requestUrl ) ; break ; case PUT : builder = client . preparePut ( requestUrl ) ; break ; case HEAD : builder = client . prepareHead ( requestUrl ) ; break ; case OPTIONS : builder = client . prepareOptions ( requestUrl ) ; break ; case DELETE : builder = client . prepareDelete ( requestUrl ) ; break ; default : break ; } PcHttpUtils . addHeaders ( builder , this . httpHeaderMap ) ; if ( ! Strings . isNullOrEmpty ( postData ) ) { builder . setBody ( postData ) ; String charset = "" ; if ( null != this . httpHeaderMap ) { charset = this . httpHeaderMap . get ( "charset" ) ; } if ( ! Strings . isNullOrEmpty ( charset ) ) { builder . setBodyEncoding ( charset ) ; } } } catch ( Exception t ) { throw new HttpRequestCreateException ( "Error in creating request in Httpworker. " + " If BoundRequestBuilder is null. Then fail to create." , t ) ; } return builder ; }
Creates the request .
312
5
146,292
public ResponseOnSingeRequest onComplete ( Response response ) { cancelCancellable ( ) ; try { Map < String , List < String > > responseHeaders = null ; if ( responseHeaderMeta != null ) { responseHeaders = new LinkedHashMap < String , List < String > > ( ) ; if ( responseHeaderMeta . isGetAll ( ) ) { for ( Map . Entry < String , List < String > > header : response . getHeaders ( ) ) { responseHeaders . put ( header . getKey ( ) . toLowerCase ( Locale . ROOT ) , header . getValue ( ) ) ; } } else { for ( String key : responseHeaderMeta . getKeys ( ) ) { if ( response . getHeaders ( ) . containsKey ( key ) ) { responseHeaders . put ( key . toLowerCase ( Locale . ROOT ) , response . getHeaders ( ) . get ( key ) ) ; } } } } int statusCodeInt = response . getStatusCode ( ) ; String statusCode = statusCodeInt + " " + response . getStatusText ( ) ; String charset = ParallecGlobalConfig . httpResponseBodyCharsetUsesResponseContentType && response . getContentType ( ) != null ? AsyncHttpProviderUtils . parseCharset ( response . getContentType ( ) ) : ParallecGlobalConfig . httpResponseBodyDefaultCharset ; if ( charset == null ) { getLogger ( ) . error ( "charset is not provided from response content type. Use default" ) ; charset = ParallecGlobalConfig . httpResponseBodyDefaultCharset ; } reply ( response . getResponseBody ( charset ) , false , null , null , statusCode , statusCodeInt , responseHeaders ) ; } catch ( IOException e ) { getLogger ( ) . error ( "fail response.getResponseBody " + e ) ; } return null ; }
On complete . Save response headers when needed .
422
9
146,293
public void onThrowable ( Throwable cause ) { this . cause = cause ; getSelf ( ) . tell ( RequestWorkerMsgType . PROCESS_ON_EXCEPTION , getSelf ( ) ) ; }
On throwable .
46
4
146,294
public static List < String > getNodeListFromStringLineSeperateOrSpaceSeperate ( String listStr , boolean removeDuplicate ) { List < String > nodes = new ArrayList < String > ( ) ; for ( String token : listStr . split ( "[\\r?\\n| +]+" ) ) { // 20131025: fix if fqdn has space in the end. if ( token != null && ! token . trim ( ) . isEmpty ( ) ) { nodes . add ( token . trim ( ) ) ; } } if ( removeDuplicate ) { removeDuplicateNodeList ( nodes ) ; } logger . info ( "Target hosts size : " + nodes . size ( ) ) ; return nodes ; }
Gets the node list from string line seperate or space seperate .
157
15
146,295
public static int removeDuplicateNodeList ( List < String > list ) { int originCount = list . size ( ) ; // add elements to all, including duplicates HashSet < String > hs = new LinkedHashSet < String > ( ) ; hs . addAll ( list ) ; list . clear ( ) ; list . addAll ( hs ) ; return originCount - list . size ( ) ; }
Removes the duplicate node list .
90
7
146,296
public ParallelTaskBuilder setResponseContext ( Map < String , Object > responseContext ) { if ( responseContext != null ) this . responseContext = responseContext ; else logger . error ( "context cannot be null. skip set." ) ; return this ; }
Sets the response context .
53
6
146,297
public ParallelTask execute ( ParallecResponseHandler handler ) { ParallelTask task = new ParallelTask ( ) ; try { targetHostMeta = new TargetHostMeta ( targetHosts ) ; final ParallelTask taskReal = new ParallelTask ( requestProtocol , concurrency , httpMeta , targetHostMeta , sshMeta , tcpMeta , udpMeta , pingMeta , handler , responseContext , replacementVarMapNodeSpecific , replacementVarMap , requestReplacementType , config ) ; task = taskReal ; logger . info ( "***********START_PARALLEL_HTTP_TASK_" + task . getTaskId ( ) + "***********" ) ; // throws ParallelTaskInvalidException task . validateWithFillDefault ( ) ; task . setSubmitTime ( System . currentTimeMillis ( ) ) ; if ( task . getConfig ( ) . isEnableCapacityAwareTaskScheduler ( ) ) { //late initialize the task scheduler ParallelTaskManager . getInstance ( ) . initTaskSchedulerIfNot ( ) ; // add task to the wait queue ParallelTaskManager . getInstance ( ) . getWaitQ ( ) . add ( task ) ; logger . info ( "Enabled CapacityAwareTaskScheduler. Submitted task to waitQ in builder.. " + task . getTaskId ( ) ) ; } else { logger . info ( "Disabled CapacityAwareTaskScheduler. Immediately execute task {} " , task . getTaskId ( ) ) ; Runnable director = new Runnable ( ) { public void run ( ) { ParallelTaskManager . getInstance ( ) . generateUpdateExecuteTask ( taskReal ) ; } } ; new Thread ( director ) . start ( ) ; } if ( this . getMode ( ) == TaskRunMode . SYNC ) { logger . info ( "Executing task {} in SYNC mode... " , task . getTaskId ( ) ) ; while ( task != null && ! task . isCompleted ( ) ) { try { Thread . sleep ( 500L ) ; } catch ( InterruptedException e ) { logger . error ( "InterruptedException " + e ) ; } } } } catch ( ParallelTaskInvalidException ex ) { logger . info ( "Request is invalid with missing parts. Details: " + ex . getMessage ( ) + " Cannot execute at this time. " + " Please review your request and try again.\nCommand:" + httpMeta . toString ( ) ) ; task . setState ( ParallelTaskState . COMPLETED_WITH_ERROR ) ; task . getTaskErrorMetas ( ) . add ( new TaskErrorMeta ( TaskErrorType . VALIDATION_ERROR , "validation eror" ) ) ; } catch ( Exception t ) { logger . error ( "fail task builder. Unknown error: " + t , t ) ; task . setState ( ParallelTaskState . COMPLETED_WITH_ERROR ) ; task . getTaskErrorMetas ( ) . add ( new TaskErrorMeta ( TaskErrorType . UNKNOWN , "unknown eror" , t ) ) ; } logger . info ( "***********FINISH_PARALLEL_HTTP_TASK_" + task . getTaskId ( ) + "***********" ) ; return task ; }
key function . first validate if the ACM has adequate data ; then execute it after the validation . the new ParallelTask task guareetee to have the targethost meta and command meta not null
697
40
146,298
public boolean validation ( ) throws ParallelTaskInvalidException { ParallelTask task = new ParallelTask ( ) ; targetHostMeta = new TargetHostMeta ( targetHosts ) ; task = new ParallelTask ( requestProtocol , concurrency , httpMeta , targetHostMeta , sshMeta , tcpMeta , udpMeta , pingMeta , null , responseContext , replacementVarMapNodeSpecific , replacementVarMap , requestReplacementType , config ) ; boolean valid = false ; try { valid = task . validateWithFillDefault ( ) ; } catch ( ParallelTaskInvalidException e ) { logger . info ( "task is invalid " + e ) ; } return valid ; }
add some validation to see if this miss anything .
137
10
146,299
public ParallelTaskBuilder setTargetHostsFromJsonPath ( String jsonPath , String sourcePath , HostsSourceType sourceType ) throws TargetHostsLoadException { this . targetHosts = targetHostBuilder . setTargetHostsFromJsonPath ( jsonPath , sourcePath , sourceType ) ; return this ; }
Sets the target hosts from json path .
68
9