You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Class cast exception in BatchPublisherWithContext or MappedBatchPublisherWithContext #208
Describe the bug
The two reactive batch loaders that take a context object throw a class cast exception if used.
The reason this is happening is that these methods missed the specific XXXContext methods and hence it falls through them and tries to cast them to BatchLoader
private boolean isMappedPublisher() {
return batchLoadFunction instanceof MappedBatchPublisher || batchLoadFunction instanceof MappedBatchPublisherWithContext;
}
**To Reproduce**
Kotlin example below but the same would happen in Java
val batchLoadFunction = MappedBatchPublisherWithContext<String, String?>
{ keys, subscriber, env ->
val map: Map<String, String?> = keys.associateBy({ it })
Flux.fromIterable(map.entries).subscribe(subscriber);
}
val dataLoader: DataLoader<String, String?> = DataLoaderFactory.newMappedPublisherDataLoader(batchLoadFunction)
val cfA = dataLoader.load("A")
val cfB = dataLoader.load("B")
dataLoader.dispatch()
assert(cfA.join().equals("A"))
assert(cfB.join().equals("B"))
Activity
#208 to ensure tests are in place
Merge pull request #211 from graphql-java/fixes-208-and-ensure-tests-…
dondonz commentedon Aug 16, 2025
@bbakerman checking in, has this issue been fixed with your PRs?
bbakerman commentedon Aug 16, 2025
Yes this is fixed