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

Dependency incompatibility when using Element.getOuterHTML #14180

Closed
mrgreywater opened this issue Jul 14, 2022 · 6 comments
Closed

Dependency incompatibility when using Element.getOuterHTML #14180

mrgreywater opened this issue Jul 14, 2022 · 6 comments
Milestone

Comments

@mrgreywater
Copy link

Description

When using placeholder items in VirtualList (and having a dependency to io.github.bonigarcia.webdrivermanager:4.4.0), the following exception is thrown:

java.lang.NullPointerException: Cannot invoke "org.jsoup.nodes.Element.isBlock()" because the return value of "org.jsoup.nodes.Element.parent()" is null
	at org.jsoup.nodes.Element.isInlineable(Element.java:1619) ~[jsoup-1.13.1.jar:na]
	at org.jsoup.nodes.Element.outerHtmlHead(Element.java:1479) ~[jsoup-1.13.1.jar:na]
	at org.jsoup.nodes.Node$OuterHtmlVisitor.head(Node.java:740) ~[jsoup-1.13.1.jar:na]
	at org.jsoup.select.NodeTraversor.traverse(NodeTraversor.java:25) ~[jsoup-1.13.1.jar:na]
	at org.jsoup.nodes.Node.outerHtml(Node.java:606) ~[jsoup-1.13.1.jar:na]
	at org.jsoup.nodes.Node.outerHtml(Node.java:601) ~[jsoup-1.13.1.jar:na]
	at com.vaadin.flow.dom.Element.getOuterHTML(Element.java:1293) ~[flow-server-23.1.3.jar:23.1.3]
	at com.vaadin.flow.component.virtuallist.VirtualList.updateTemplateInnerHtml(VirtualList.java:325) ~[vaadin-virtual-list-flow-23.1.3.jar:na]
	at com.vaadin.flow.component.virtuallist.VirtualList.lambda$registerTemplateUpdate$f7fe4649$1(VirtualList.java:295) ~[vaadin-virtual-list-flow-23.1.3.jar:na]
	at com.vaadin.flow.component.virtuallist.VirtualList.lambda$runBeforeClientResponse$34f88668$1(VirtualList.java:302) ~[vaadin-virtual-list-flow-23.1.3.jar:na]
	...

The dependency (and version) was in my pom because it was in a starter project of a previous version of vaadin. This incompatibility was difficult to find, as there is no good indication what's actually causing the problem.

Expected outcome

VirtualList is shown with placeholder items.

Minimal reproducible example

my-todo.zip

Steps to reproduce

Run the repro example and notice the Nullpointer Exception

Environment

Vaadin version(s): 23.1.3
OS: Windows 11

Browsers

No response

@web-padawan
Copy link
Member

Thanks for the issue. Moving to Flow repository as the Element.getOuterHTML() is a Flow API and it uses jsoup.

@web-padawan web-padawan transferred this issue from vaadin/flow-components Jul 18, 2022
@web-padawan
Copy link
Member

Possibly related: #12046

@web-padawan web-padawan changed the title VirtualList<T>::setPlaceholderItem Nullpointerexception / Dependency Incompatibility Dependency incompatibility when using Element.getOuterHTML Jul 18, 2022
@mcollovati
Copy link
Collaborator

Checking at the project it seems like that the webdrivermanager is not used at all and can be removed.
Otherwise it should be upgraded. Latest starter preset has version 5.1.1

@caalador
Copy link
Contributor

Closing issue as there is nothing specific we can do as the jsoup transitive dependency in webdrivermanager is found for a shorter path than the flow-server dependency.

\- io.github.bonigarcia:webdrivermanager:jar:4.4.0:test
   \- org.jsoup:jsoup:jar:1.13.1:compile

vs

+- com.vaadin:vaadin:jar:23.1.1:compile
 |  +- com.vaadin:vaadin-core:jar:23.1.1:compile
 |  |  +- com.vaadin:flow-server:jar:23.1.1:compile
 |  |  |  +- org.jsoup:jsoup:jar:1.14.3:compile

This works exactly as defined in Maven dependency doc even though the webdrivermanager is in the test scope.

@caalador caalador added this to the Abandoned milestone Aug 12, 2022
@mrgreywater
Copy link
Author

Well, one could add a dependency version check, similarly to how the version of node and npm is checked.
But probably the likelyhood of this issue occuring for someone else is low and if it happens hopefully he will find this issue report...

@caalador
Copy link
Contributor

As I can't find any documentation mentioning the 4.x version I would expect that not many encounter this.
Also the exception is quite specific so this issue is the only match if you search with the null pointer exception.

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

4 participants