@@ -75,19 +75,24 @@ object LicenseReport {
7575    makeReportImpl(report, configs, licenseSelection, overrides, log)
7676  }
7777  /**  
78-    * given a set of categories and an array of ivy-resolved licsenses , pick the first one from our list, or 
78+    * given a set of categories and an array of ivy-resolved licenses , pick the first one from our list, or 
7979   *  default to 'none specified'. 
8080   */  
8181  def  pickLicense (categories : Seq [LicenseCategory ])(licenses : Array [org.apache.ivy.core.module.descriptor.License ]):  LicenseInfo  =  {
82-     val  allMatchedLicenses  = 
83-       for  {
84-         //  We look for a lciense matching the category in the order they are defined.
85-         //  i.e. the user selects the licenses they prefer to use, in order, if an artifact is dual-licensed (or more)
86-         category <-  categories.toStream
87-         l <-  licenses
88-         if  category.unapply(l.getName)
89-       } yield  LicenseInfo (category, l.getName, l.getUrl)
90-     allMatchedLicenses.headOption getOrElse LicenseInfo (LicenseCategory .NoneSpecified , " "  , " "  )
82+     if  (licenses.isEmpty) {
83+       return  LicenseInfo (LicenseCategory .NoneSpecified , " "  , " "  )
84+     }
85+     //  We look for a license matching the category in the order they are defined.
86+     //  i.e. the user selects the licenses they prefer to use, in order, if an artifact is dual-licensed (or more)
87+     for  (category <-  categories) {
88+       for  (license <-  licenses) {
89+         if  (category.unapply(license.getName)) {
90+           return  LicenseInfo (category, license.getName, license.getUrl)
91+         }
92+       }
93+     }
94+     val  license  =  licenses(0 )
95+     LicenseInfo (LicenseCategory .Unrecognized , license.getName, license.getUrl)
9196  }
9297  /**  Picks a single license (or none) for this dependency. */  
9398  def  pickLicenseForDep (dep : IvyNode , configs : Set [String ], categories : Seq [LicenseCategory ]):  Option [DepLicense ] = 
0 commit comments