There is a slightly more scala-centric way to deal with potentially null variables here. You could use this for both offset and lineLength.

   val getLineLength = Option(request.getParameter("lineLength")).map(_.toInt).getOrElse(0)