@@ -58,6 +58,11 @@ interface PlugRegistry {
5858 // do the parsing again but this time disable caching
5959 // https://stackoverflow.com/questions/36517604/closing-a-jarurlconnection
6060 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 )
6166 }
6267 }
6368 }
@@ -77,26 +82,12 @@ interface PlugRegistry {
7782 for (service in
7883 services.split(" ," .toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()) {
7984 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)
10091 }
10192 }
10293 }
0 commit comments