I wonder if anyone else finds this stack trace familiar. As often is
the case with non-mainstream languages, Google turns up nothing of
value. The code fragment goes below. If I comment out the code inside
the finally statement, everything compiles fine. If I keep it, I get
the stack trace below. I have tried to create a minimal repro, but did
not have any success. I understand this is not a Lift issue, but this
group has a sizable chunk of Scala enthusiasts, so hopefully someone
has encountered something like this

block #9 :
  CONSTANT (Constant(null))
  LOAD_LOCAL variable t
  DUP
  STORE_LOCAL variable eqEqTemp$2
  CZJUMP (REFERENCE(java.lang.Object))EQ ? 13 : 15
Successors:  3 15 13 3
trying to emit: DROP REFERENCE(scala.Null)
java.lang.reflect.InvocationTargetException
        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 org.scala_tools.maven.executions.MainHelper.runMain
(MainHelper.java:151)
        at org.scala_tools.maven.executions.MainWithArgsInFile.main
(MainWithArgsInFile.java:26)
Caused by: java.lang.AssertionError: assertion failed: BasicBlock
closed
        at scala.Predef$.assert(Predef.scala:92)
        at scala.tools.nsc.backend.icode.BasicBlocks$BasicBlock.emit
(BasicBlocks.scala:327)
        at scala.tools.nsc.backend.icode.BasicBlocks$BasicBlock.emit
(BasicBlocks.scala:317)
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.adapt
(GenICode.scala:1006)
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala
$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:
496)
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala
$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:
447)
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala
$tools$nsc$backend$icode$GenICode$ICodePhase$$genStat(GenICode.scala:
183)
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun
$genStat$1.apply(GenICode.scala:146)
        at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun
$genStat$1.apply(GenICode.scala:145)
etc, etc...

The code fragment:

    def findTagWithName(tags: List[Tag], name: String) : Tag = {
        val t = tags.find(x => x.name == name)
        return t.getOrElse(null)
    }

    def getCookieValue(name: String, default: String) : String = {
        for(cookie <- S.findCookie(name); v <- cookie.value) {
            return v
        }
        return default
    }

    def getParamValue(name: String, default: String) : String = {
        for(v <- S.param(name)) {
            return v
        }
        return default
    }

    def getSelectedTag(tags: List[Tag], cookieName: String, urlParam:
String) : Tag = {
        var t : Tag = null
        try {
            if(tags.length == 0) {
                return null
            }

            // See if tag name is present in the URL
            val tagName = getParamValue(urlParam, "")
            // If yes, check if a tag with this name is present in
tags
            t = findTagWithName(tags, tagName)
            // If it is, write out the right cookie and return
            if(t != null) {
                return t
            }

            // if no, check the corresponding cookie
            val cv = getCookieValue(cookieName, "")
            if(cv != null) {
                // and check if the tag with a name stored in cookie
is present in tags
                t = findTagWithName(tags, cv)
                if(t != null) {
                    return t
                }
            }

            // otherwise just select the last tag from the list and
write out the cookie
            t = tags.last
            return t
        } finally {
            if(t != null) {
                var c = HTTPCookie(cookieName, t.name).setMaxAge(365 *
24 * 60 * 60)
                S.addCookie(c)
            }
        }
    }

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=.


Reply via email to