Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating new PdfViewer + adding to Layout result in ERROR (UI not working) #23

Open
scrmtrey91 opened this issue Oct 16, 2022 · 3 comments

Comments

@scrmtrey91
Copy link

Creating new PdfViewer + adding to Layout result in ERROR (UI not working)

PdfViewer predogled = new PdfViewer();
layout.add(predogled);
 java.lang.IllegalArgumentException: Href must not be null
	at com.vaadin.flow.component.html.Anchor.setHref(Anchor.java:147)
	at com.vaadin.flow.component.html.Anchor.<init>(Anchor.java:72)
	at com.vaadin.componentfactory.pdfviewer.PdfViewer.addDownloadButton(PdfViewer.java:255)
	at com.vaadin.componentfactory.pdfviewer.PdfViewer.onAttach(PdfViewer.java:243)
	at com.vaadin.flow.component.ComponentUtil.onComponentAttach(ComponentUtil.java:232)
	at com.vaadin.flow.internal.nodefeature.ComponentMapping.lambda$onAttach$0(ComponentMapping.java:104)
	at java.base/java.util.Optional.ifPresent(Optional.java:178)
	at com.vaadin.flow.internal.nodefeature.ComponentMapping.onAttach(ComponentMapping.java:103)
	at com.vaadin.flow.internal.StateNode.lambda$fireAttachListeners$8(StateNode.java:847)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at com.vaadin.flow.internal.StateNode.forEachFeature(StateNode.java:359)
	at com.vaadin.flow.internal.StateNode.fireAttachListeners(StateNode.java:847)
	at com.vaadin.flow.internal.StateNode.onAttach(StateNode.java:328)
	at com.vaadin.flow.internal.StateNode.setParent(StateNode.java:280)
	at com.vaadin.flow.internal.nodefeature.NodeFeature.attachPotentialChild(NodeFeature.java:80)
	at com.vaadin.flow.internal.nodefeature.StateNodeNodeList.add(StateNodeNodeList.java:55)
	at com.vaadin.flow.internal.nodefeature.ElementChildrenList.add(ElementChildrenList.java:44)
	at com.vaadin.flow.dom.impl.AbstractNodeStateProvider.insertChild(AbstractNodeStateProvider.java:104)
	at com.vaadin.flow.dom.Node.insertChild(Node.java:386)
	at com.vaadin.flow.dom.Node.appendChild(Node.java:163)
	at com.vaadin.flow.dom.Node.appendChild(Node.java:147)
	at com.vaadin.flow.component.HasComponents.lambda$add$1(HasComponents.java:71)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at com.vaadin.flow.component.HasComponents.add(HasComponents.java:71)
	at com.vaadin.flow.component.HasComponents.add(HasComponents.java:54)
	at com.vaadin.flow.component.UI.add(UI.java:1199)
	at com.vaadin.flow.component.UI.addToModalComponent(UI.java:1474)
	at com.vaadin.flow.component.dialog.Dialog.lambda$ensureAttached$7923d3bb$1(Dialog.java:754)
	at com.vaadin.flow.internal.StateTree.lambda$runExecutionsBeforeClientResponse$2(StateTree.java:392)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at com.vaadin.flow.internal.StateTree.runExecutionsBeforeClientResponse(StateTree.java:389)
	at com.vaadin.flow.server.communication.UidlWriter.encodeChanges(UidlWriter.java:390)
	at com.vaadin.flow.server.communication.UidlWriter.createUidl(UidlWriter.java:174)
	at com.vaadin.flow.server.communication.UidlRequestHandler.createUidl(UidlRequestHandler.java:158)
	at com.vaadin.flow.server.communication.UidlRequestHandler.writeUidl(UidlRequestHandler.java:146)
	at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:116)
	at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
	at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1564)
	at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:369)
	at com.vaadin.cdi.CdiVaadinServlet.service(CdiVaadinServlet.java:67)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1637)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:331)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211)
	at org.glassfish.tyrus.servlet.TyrusServletFilter.doFilter(TyrusServletFilter.java:282)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:253)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:757)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:577)
	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:158)
	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:372)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:239)
	at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217)
	at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:200)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
	at java.base/java.lang.Thread.run(Thread.java:833)
]]

Line of code where error is happening :
image

Solution:

  1. add download / print button or recreate download / print button every time when source is set instead of onAttach method
@scrmtrey91
Copy link
Author

Probably linked #11

@scrmtrey91
Copy link
Author

any news about that ?

@paodb
Copy link
Collaborator

paodb commented Feb 24, 2023

Please try version 2.7.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants