public List < Feature > parseJsonFiles ( List < String > jsonFiles ) { if ( jsonFiles . isEmpty ( ) ) { throw new ValidationException ( "None report file was added!" ) ; } List < Feature > featureResults = new ArrayList <> ( ) ; for ( int i = 0 ; i < jsonFiles . size ( ) ; i ++ ) { String jsonFile = jsonFiles . get ( i ) ; // if file is empty (is not valid JSON report), check if should be skipped or not if ( new File ( jsonFile ) . length ( ) == 0 && configuration . containsReducingMethod ( ReducingMethod . SKIP_EMPTY_JSON_FILES ) ) { continue ; } Feature [ ] features = parseForFeature ( jsonFile ) ; LOG . log ( Level . INFO , String . format ( "File '%s' contains %d features" , jsonFile , features . length ) ) ; featureResults . addAll ( Arrays . asList ( features ) ) ; } // report that has no features seems to be not valid if ( featureResults . isEmpty ( ) ) { throw new ValidationException ( "Passed files have no features!" ) ; } return featureResults ; }
Parsed passed files and extracts features files .