NPE in CSS transforms when using attribute interpolation #1182

Closed
jeppenejsum opened this Issue Jan 11, 2012 · 3 comments

Comments

Projects
None yet
3 participants
@jeppenejsum
Owner

jeppenejsum commented Jan 11, 2012

def cssClass: Option[String] = None

scala> def listTemplate: NodeSeq =


listTemplate: scala.xml.NodeSeq

scala> val func = "#headerxx_item" #> "x"
func: net.liftweb.util.CssSel = CssBind(Full(#headerxx_item), Full(IdSelector(headerxx_item,Empty)))

scala> func(listTemplate)
java.lang.NullPointerException
at scala.xml.NodeSeq.iterator(NodeSeq.scala:51)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:73)
at scala.xml.NodeSeq.foreach(NodeSeq.scala:43)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
at scala.xml.NodeSeq.map(NodeSeq.scala:43)
at scala.xml.NodeSeq.text(NodeSeq.scala:152)
at scala.xml.MetaData$$anonfun$asAttrMap$1.apply(MetaData.scala:168)
at scala.xml.MetaData$$anonfun$asAttrMap$1.apply(MetaData.scala:168)
at scala.collection.Iterator$$anon$19.next(Iterator.scala:335)
at scala.collection.Iterator$class.foreach(Iterator.scala:660)
at scala.collection.Iterator$$anon$19.foreach(Iterator.scala:333)
at scala.collection.TraversableOnce$class.toMap(TraversableOnce.scala:256)
at scala.collection.Iterator$$anon$19.toMap(Iterator.scala:333)
at scala.xml.MetaData.asAttrMap(MetaData.scala:168)
at scala.xml.MetaData.strict_$eq$eq(MetaData.scala:137)
at scala.xml.Equality$class.doComparison(Equality.scala:103)
at scala.xml.Equality$class.equals(Equality.scala:92)
at scala.xml.MetaData.equals(MetaData.scala:74)
at net.liftweb.util.SelectorMap.slurpAttrs(BindHelpers.scala:2291)
at net.liftweb.util.SelectorMap.net$liftweb$util$SelectorMap$$treatElem(BindHelpers.scala:2324)
at net.liftweb.util.SelectorMap$$anonfun$net$liftweb$util$SelectorMap$$run$1.apply(BindHelpers.scala:2386)
at net.liftweb.util.SelectorMap$$anonfun$net$liftweb$util$SelectorMap$$run$1.apply(BindHelpers.scala:2384)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)
at scala.collection.Iterator$class.foreach(Iterator.scala:660)
at scala.collection.LinearSeqLike$$anon$1.foreach(LinearSeqLike.scala:50)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:73)
at scala.xml.NodeSeq.foreach(NodeSeq.scala:43)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:200)
at scala.xml.NodeSeq.flatMap(NodeSeq.scala:43)
at net.liftweb.util.SelectorMap.net$liftweb$util$SelectorMap$$run(BindHelpers.scala:2384)
at net.liftweb.util.SelectorMap.apply(BindHelpers.scala:2380)
at net.liftweb.util.CssBind$class.apply(BindHelpers.scala:2405)
at net.liftweb.util.CssBindImpl.apply(BindHelpers.scala:2461)
at net.liftweb.util.CssBindImpl.apply(BindHelpers.scala:2461)
at .(:21)
at .()
at .(:11)
at .()
at $print()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)
at scala.tools.nsc.interpreter.IMain$Request$$anonfun$14.apply(IMain.scala:920)
at scala.tools.nsc.interpreter.Line$$anonfun$1.apply$mcV$sp(Line.scala:43)
at scala.tools.nsc.io.package$$anon$2.run(package.scala:25)
at java.lang.Thread.run(Thread.java:680)

I realize I can use transforms to achieve this, but this was existing code :-)

@dpp

This comment has been minimized.

Show comment Hide comment
@dpp

dpp Jan 11, 2012

Owner

Looking at the line where the bug happened, this looks a whole lot like a Scala bug, not a Lift bug.

Owner

dpp commented Jan 11, 2012

Looking at the line where the bug happened, this looks a whole lot like a Scala bug, not a Lift bug.

@jeppenejsum

This comment has been minimized.

Show comment Hide comment
@jeppenejsum

jeppenejsum Jan 11, 2012

Owner

Agreed, but it seems we're working around other Scala lib "idiosyncrasies" elsewhere.

But it seems this is fixed in trunk https://issues.scala-lang.org/browse/SI-5052, so probably not worth it

Owner

jeppenejsum commented Jan 11, 2012

Agreed, but it seems we're working around other Scala lib "idiosyncrasies" elsewhere.

But it seems this is fixed in trunk https://issues.scala-lang.org/browse/SI-5052, so probably not worth it

@github-importer

This comment has been minimized.

Show comment Hide comment

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment