public static LicenseChoice resolve ( String licenseString ) { try { return resolveSpdxLicenseString ( licenseString ) ; } catch ( InvalidLicenseStringException e1 ) { final LicenseChoice licenseChoice = resolveViaAlternativeMapping ( licenseString ) ; if ( licenseChoice != null ) { return licenseChoice ; } try { new URL ( licenseString ) ; // We want to throw an exception if its not a valid URL, as the remaining block may impact performance final LicenseChoice choice = new LicenseChoice ( ) ; choice . addLicense ( parseLicenseByUrl ( licenseString ) ) ; return choice ; } catch ( MalformedURLException | InvalidLicenseStringException e2 ) { // throw it away } } return null ; }
Attempts to resolve the specified license string via SPDX license identifier and expression parsing first . If SPDX resolution is not successful the method will attempt fuzzy matching .