protected static Cpe parse23 ( String cpeString , boolean lenient ) throws CpeParsingException { if ( cpeString == null || cpeString . isEmpty ( ) ) { throw new CpeParsingException ( "CPE String is null ir enpty - unable to parse" ) ; } CpeBuilder cb = new CpeBuilder ( ) ; Cpe23PartIterator cpe = new Cpe23PartIterator ( cpeString ) ; try { cb . part ( cpe . next ( ) ) ; cb . wfVendor ( Convert . fsToWellFormed ( cpe . next ( ) , lenient ) ) ; cb . wfProduct ( Convert . fsToWellFormed ( cpe . next ( ) , lenient ) ) ; cb . wfVersion ( Convert . fsToWellFormed ( cpe . next ( ) , lenient ) ) ; cb . wfUpdate ( Convert . fsToWellFormed ( cpe . next ( ) , lenient ) ) ; cb . wfEdition ( Convert . fsToWellFormed ( cpe . next ( ) , lenient ) ) ; cb . wfLanguage ( Convert . fsToWellFormed ( cpe . next ( ) , lenient ) ) ; cb . wfSwEdition ( Convert . fsToWellFormed ( cpe . next ( ) , lenient ) ) ; cb . wfTargetSw ( Convert . fsToWellFormed ( cpe . next ( ) , lenient ) ) ; cb . wfTargetHw ( Convert . fsToWellFormed ( cpe . next ( ) , lenient ) ) ; cb . wfOther ( Convert . fsToWellFormed ( cpe . next ( ) , lenient ) ) ; } catch ( NoSuchElementException ex ) { throw new CpeParsingException ( "Invalid CPE (too few components): " + cpeString ) ; } if ( cpe . hasNext ( ) ) { throw new CpeParsingException ( "Invalid CPE (too many components): " + cpeString ) ; } try { return cb . build ( ) ; } catch ( CpeValidationException ex ) { throw new CpeParsingException ( ex . getMessage ( ) ) ; } }
Parses a CPE 2 . 3 Formatted String .