我正在开发内部具有多个网格的Vaadin Flow(10.0.5)应用程序。所有这些都使用Viritin的ListDataProvider。
引起我头痛的通常由200-300行组成(某些情况下多达1200行)并且有13列。所有列都是可调整大小和可排序的,并且第二个标题行包含每列的过滤器,就像应用程序中的所有其他网格一样。
当我滚动网格时,有时会生成一个NPE:
java.lang.NullPointerException
at sun.reflect.GeneratedMethodAccessor403.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.__invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.vaadin.flow.data.binder.BeanPropertySet.invokeWrapExceptions(BeanPropertySet.java:516)
at com.vaadin.flow.data.binder.BeanPropertySet.access$600(BeanPropertySet.java:48)
at com.vaadin.flow.data.binder.BeanPropertySet$NestedBeanPropertyDefinition.lambda$getGetter$3ec26976$1(BeanPropertySet.java:200)
at com.vaadin.flow.component.grid.Grid.runPropertyValueGetter(Grid.java:1137)
at com.vaadin.flow.component.grid.Grid.lambda$addColumn$cb98939f$1(Grid.java:1119)
at com.vaadin.flow.component.grid.Grid.lambda$addColumn$c3690ee2$1(Grid.java:923)
at com.vaadin.flow.data.renderer.Renderer$TemplateRendering.lambda$null$2db14883$1(Renderer.java:261)
at com.vaadin.flow.data.provider.CompositeDataGenerator.lambda$generateData$0(CompositeDataGenerator.java:47)
at java.lang.Iterable.forEach(Unknown Source)
at com.vaadin.flow.data.provider.CompositeDataGenerator.generateData(CompositeDataGenerator.java:47)
at com.vaadin.flow.data.provider.CompositeDataGenerator.lambda$generateData$0(CompositeDataGenerator.java:47)
at java.lang.Iterable.forEach(Unknown Source)
at com.vaadin.flow.data.provider.CompositeDataGenerator.generateData(CompositeDataGenerator.java:47)
at com.vaadin.flow.data.provider.DataCommunicator.generateJson(DataCommunicator.java:627)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.stream.IntPipeline$4$1.accept(Unknown Source)
at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Unknown Source)
at java.util.Spliterator$OfInt.forEachRemaining(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.collect(Unknown Source)
at com.vaadin.flow.data.provider.DataCommunicator.getJsonItems(DataCommunicator.java:587)
at com.vaadin.flow.data.provider.DataCommunicator.lambda$collectChangesToSend$2(DataCommunicator.java:550)
at com.vaadin.flow.data.provider.DataCommunicator.applyIfNotEmpty(DataCommunicator.java:601)
at com.vaadin.flow.data.provider.DataCommunicator.withMissing(DataCommunicator.java:595)
at com.vaadin.flow.data.provider.DataCommunicator.collectChangesToSend(DataCommunicator.java:549)
at com.vaadin.flow.data.provider.DataCommunicator.flush(DataCommunicator.java:452)
at com.vaadin.flow.data.provider.DataCommunicator.lambda$requestFlush$2f364bb9$1(DataCommunicator.java:409)
at com.vaadin.flow.internal.StateTree.lambda$runExecutionsBeforeClientResponse$1(StateTree.java:350)
at java.util.ArrayList.forEach(Unknown Source)
at com.vaadin.flow.internal.StateTree.runExecutionsBeforeClientResponse(StateTree.java:347)
at com.vaadin.flow.server.communication.UidlWriter.encodeChanges(UidlWriter.java:334)
at com.vaadin.flow.server.communication.UidlWriter.createUidl(UidlWriter.java:179)
at com.vaadin.flow.server.communication.UidlRequestHandler.writeUidl(UidlRequestHandler.java:119)
at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:91)
at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1486)
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:300)
但是其他具有更多列和更多数据的网格(在我的一种情况下为2000以上)绝对不会导致异常。 我检查了NPE发生时要从提供程序加载的最后一个数据库对象的ID(将网格页面设置为1以确保它是最后一个),它从来都不一样,并且对于从网格。
我正在填充网格,主要通过实体的propId设置列,其中一些是生成的列,例如其他两列的总和。
关于什么会导致这些随机异常的任何想法?
谢谢!