mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
ENT-6412: Upgrade ClassGraph 4.8.90 -> 4.8.135. (#6973)
This commit is contained in:
parent
18333b4860
commit
e93e7c2846
@ -21,7 +21,7 @@ jdkClassifier11=jdk11
|
|||||||
dockerJavaVersion=3.2.5
|
dockerJavaVersion=3.2.5
|
||||||
proguardVersion=6.1.1
|
proguardVersion=6.1.1
|
||||||
bouncycastleVersion=1.68
|
bouncycastleVersion=1.68
|
||||||
classgraphVersion=4.8.90
|
classgraphVersion=4.8.135
|
||||||
disruptorVersion=3.4.2
|
disruptorVersion=3.4.2
|
||||||
typesafeConfigVersion=1.3.4
|
typesafeConfigVersion=1.3.4
|
||||||
jsr305Version=3.0.2
|
jsr305Version=3.0.2
|
||||||
|
@ -11,9 +11,9 @@ import kotlin.concurrent.withLock
|
|||||||
private val pooledScanMutex = ReentrantLock()
|
private val pooledScanMutex = ReentrantLock()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this rather than the built in implementation of [scan] on [ClassGraph]. The built in implementation of [scan] creates
|
* Use this rather than the built-in implementation of [ClassGraph.scan]. The built-in implementation creates
|
||||||
* a thread pool every time resulting in too many threads. This one uses a mutex to restrict concurrency.
|
* a thread pool every time, resulting in too many threads. This one uses a mutex to restrict concurrency.
|
||||||
*/
|
*/
|
||||||
fun ClassGraph.pooledScan(): ScanResult {
|
fun ClassGraph.pooledScan(): ScanResult {
|
||||||
return pooledScanMutex.withLock { this@pooledScan.scan() }
|
return pooledScanMutex.withLock(::scan)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package net.corda.serialization.reproduction;
|
package net.corda.serialization.reproduction;
|
||||||
|
|
||||||
import com.google.common.io.LineProcessor;
|
|
||||||
import net.corda.client.rpc.CordaRPCClient;
|
import net.corda.client.rpc.CordaRPCClient;
|
||||||
import net.corda.core.concurrent.CordaFuture;
|
import net.corda.core.concurrent.CordaFuture;
|
||||||
import net.corda.node.services.Permissions;
|
import net.corda.node.services.Permissions;
|
||||||
|
@ -123,7 +123,10 @@ class CordaServiceTest {
|
|||||||
val identityService = makeTestIdentityService(dummyNotary.identity)
|
val identityService = makeTestIdentityService(dummyNotary.identity)
|
||||||
|
|
||||||
Assertions.assertThatThrownBy { MockServices(cordappPackages, dummyNotary, identityService, dummyCashIssuer.keyPair, bankOfCorda.keyPair) }
|
Assertions.assertThatThrownBy { MockServices(cordappPackages, dummyNotary, identityService, dummyCashIssuer.keyPair, bankOfCorda.keyPair) }
|
||||||
.isInstanceOf(ClassNotFoundException::class.java).hasMessage("Could not create jar file as the given package is not found on the classpath: com.r3.corda.sdk.tokens.money")
|
.isInstanceOf(ClassNotFoundException::class.java)
|
||||||
|
.hasMessageStartingWith("Could not create jar file as ")
|
||||||
|
.hasMessageContaining("com.r3.corda.sdk.tokens.money")
|
||||||
|
.hasMessageEndingWith(" not found on the classpath")
|
||||||
}
|
}
|
||||||
|
|
||||||
@StartableByService
|
@StartableByService
|
||||||
|
@ -59,6 +59,12 @@ data class CustomCordapp(
|
|||||||
}
|
}
|
||||||
|
|
||||||
classGraph.enableClassInfo().pooledScan().use { scanResult ->
|
classGraph.enableClassInfo().pooledScan().use { scanResult ->
|
||||||
|
if (scanResult.allResources.isEmpty()) {
|
||||||
|
throw ClassNotFoundException(
|
||||||
|
"Could not create jar file as the given classes(${classes.joinToString()}) / packages(${packages.joinToString()}) were not found on the classpath"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
val whitelistService = SerializationWhitelist::class.java.name
|
val whitelistService = SerializationWhitelist::class.java.name
|
||||||
val whitelists = scanResult.getClassesImplementing(whitelistService)
|
val whitelists = scanResult.getClassesImplementing(whitelistService)
|
||||||
|
|
||||||
@ -73,13 +79,9 @@ data class CustomCordapp(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scanResult.allResources.isEmpty()){
|
|
||||||
throw ClassNotFoundException("Could not create jar file as the given package is not found on the classpath: ${packages.toList()[0]}")
|
|
||||||
}
|
|
||||||
|
|
||||||
// The same resource may be found in different locations (this will happen when running from gradle) so just
|
// The same resource may be found in different locations (this will happen when running from gradle) so just
|
||||||
// pick the first one found.
|
// pick the first one found.
|
||||||
scanResult.allResources.asMap().forEach { path, resourceList ->
|
scanResult.allResourcesAsMap.forEach { (path, resourceList) ->
|
||||||
jos.addEntry(testEntry(path), resourceList[0].open())
|
jos.addEntry(testEntry(path), resourceList[0].open())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user