@@ -58,6 +58,11 @@ interface PlugRegistry {
58
58
// do the parsing again but this time disable caching
59
59
// https://stackoverflow.com/questions/36517604/closing-a-jarurlconnection
60
60
parseManifest(manifestUrl, false )
61
+ } catch (e: ZipException ) {
62
+ // When a JVM loads a jar, it mmaps the jar. If that jar changes
63
+ // (as it does when generating plugin metadata in a Gradle daemon)
64
+ // then you sometimes get ZipException after the change.
65
+ parseManifest(manifestUrl, false )
61
66
}
62
67
}
63
68
}
@@ -77,26 +82,12 @@ interface PlugRegistry {
77
82
for (service in
78
83
services.split(" ," .toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()) {
79
84
val servicePath = service.trim { it <= ' ' }
80
- try {
81
- if (servicePath.isNotEmpty()) {
82
- val asString = manifestUrl.toExternalForm()
83
- val component = parseComponent(asString, servicePath, allowCaching)
84
- synchronized(this ) {
85
- data.putDescriptor(component.provides, component)
86
- owners[component.provides]?.doRegister(component)
87
- }
88
- }
89
- } catch (e: ZipException ) {
90
- // When a JVM loads a jar, it mmaps the jar. If that jar changes
91
- // (as it does when generating plugin metadata in a Gradle daemon)
92
- // then you get ZipException after the change. The accuracy of the
93
- // registry is irrelevant during metadata generation - the registry
94
- // exists during metadata generation only because the `SocketOwner`s
95
- // register themselves in their constructors. Therefore, it is safe to
96
- // ignore these errors during metadata generation.
97
- val prop = System .getProperty(" atplug.generate" )
98
- if (prop != " true" ) {
99
- throw e
85
+ if (servicePath.isNotEmpty()) {
86
+ val asString = manifestUrl.toExternalForm()
87
+ val component = parseComponent(asString, servicePath, allowCaching)
88
+ synchronized(this ) {
89
+ data.putDescriptor(component.provides, component)
90
+ owners[component.provides]?.doRegister(component)
100
91
}
101
92
}
102
93
}
0 commit comments