Skip to content

Commit 133e039

Browse files
DreierFvlsi
authored andcommitted
license-gather: fix license inference from Bundle-License MANIFEST entry
Previuosly, Bundle-License attribute was unexpectedly ignored
1 parent 1966327 commit 133e039

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

plugins/license-gather-plugin/src/main/kotlin/com/github/vlsi/gradle/license/GatherLicenseTask.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ open class GatherLicenseTask @Inject constructor(
484484
)
485485
continue
486486
}
487-
if (!file.endsWith(".jar")) {
487+
if (file.extension != "jar") {
488488
logger.debug(
489489
"File {} for artifact {} does not look like a JAR. Will skip MANIFEST.MF check",
490490
file,
@@ -500,7 +500,11 @@ open class GatherLicenseTask @Inject constructor(
500500
)
501501
JarFile(file).use { jar ->
502502
val bundleLicense = jar.manifest.mainAttributes.getValue("Bundle-License")
503-
val license = bundleLicense?.substringBefore(";")?.let {
503+
if (bundleLicense == null || bundleLicense.startsWith("http://") || bundleLicense.startsWith("https://")) {
504+
// Ignore URLs here as it will fail during parsing
505+
return
506+
}
507+
val license = bundleLicense.substringBefore(";")?.let {
504508
licenseExpressionParser.parse(it)
505509
}
506510
if (license != null) {

0 commit comments

Comments
 (0)