You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2010/12/08 17:12:20 UTC

MarkupUtil.isMarkupHtml5Compliant() bug ?!

Hi Juergen,

I just tried to use MarkupUtil.isMarkupHtml5Compliant() for the new HTML5
input types and it failed with:

Caused by: java.lang.NullPointerException
at org.apache.wicket.markup.html.MarkupUtil$1.component(MarkupUtil.java:56)
at org.apache.wicket.markup.html.MarkupUtil$1.component(MarkupUtil.java:1)
at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:142)
at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:118)
at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:919)
at
org.apache.wicket.markup.html.MarkupUtil.isMarkupHtml5Compliant(MarkupUtil.java:52)
at
org.wicketstuff.html5.markup.html.form.NumberField.onInitialize(NumberField.java:38)
at org.apache.wicket.Component.fireInitialize(Component.java:989)
at org.apache.wicket.MarkupContainer.initialize(MarkupContainer.java:992)
at
org.apache.wicket.MarkupContainer.addedComponent(MarkupContainer.java:972)
at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:162)
at
org.wicketstuff.html5.markup.html.form.NumberFieldDemo.<init>(NumberFieldDemo.java:19)


So I changed MarkupUtil line 56:
MarkupResourceStream rs =
comp.getAssociatedMarkup().getMarkupResourceStream();
with
MarkupResourceStream rs = comp.getMarkup().getMarkupResourceStream();

and now there is no NPE but it returns "null" for doctype.

The page HTML looks like:

http://pastie.org/1359239

The code is at
https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/jdk-1.6-parent/wicket-html5-parent
see NumberFieldDemo in examples and NumberField in impl project.

martin-g