public void process ( ) { LOGGER . debug ( "Beginning Composer lock processing" ) ; try { final JsonObject composer = jsonReader . readObject ( ) ; if ( composer . containsKey ( "packages" ) ) { LOGGER . debug ( "Found packages" ) ; final JsonArray packages = composer . getJsonArray ( "packages" ) ; for ( JsonObject pkg : packages . getValuesAs ( JsonObject . class ) ) { if ( pkg . containsKey ( "name" ) ) { final String groupName = pkg . getString ( "name" ) ; if ( groupName . indexOf ( ' ' ) >= 0 && groupName . indexOf ( ' ' ) <= groupName . length ( ) - 1 ) { if ( pkg . containsKey ( "version" ) ) { final String group = groupName . substring ( 0 , groupName . indexOf ( ' ' ) ) ; final String project = groupName . substring ( groupName . indexOf ( ' ' ) + 1 ) ; String version = pkg . getString ( "version" ) ; // Some version numbers begin with v - which doesn't end up matching CPE's if ( version . startsWith ( "v" ) ) { version = version . substring ( 1 ) ; } LOGGER . debug ( "Got package {}/{}/{}" , group , project , version ) ; composerDependencies . add ( new ComposerDependency ( group , project , version ) ) ; } else { LOGGER . debug ( "Group/package {} does not have a version" , groupName ) ; } } else { LOGGER . debug ( "Got a dependency with no name" ) ; } } } } } catch ( JsonParsingException jsonpe ) { throw new ComposerException ( "Error parsing stream" , jsonpe ) ; } catch ( JsonException jsone ) { throw new ComposerException ( "Error reading stream" , jsone ) ; } catch ( IllegalStateException ise ) { throw new ComposerException ( "Illegal state in composer stream" , ise ) ; } catch ( ClassCastException cce ) { throw new ComposerException ( "Not exactly composer lock" , cce ) ; } }
Process the input stream to create the list of dependencies .