Fixed mixup of start/end, moved more import files

This commit is contained in:
Karen Feng 2013-07-10 14:52:29 -07:00
parent dbe948d9a2
commit f5f3b272f8
3 changed files with 9 additions and 10 deletions

View file

@ -625,8 +625,8 @@ private object Utils extends Logging {
def offsetBytes(path: String, start: Long, end: Long): String = {
val file = new File(path)
val length = file.length()
val effectiveStart = math.min(length, start)
val effectiveEnd = math.max(0, end)
val effectiveEnd = math.min(length, end)
val effectiveStart = math.max(0, start)
val buff = new Array[Byte]((effectiveEnd-effectiveStart).toInt)
val stream = new FileInputStream(file)

View file

@ -1,12 +1,11 @@
package spark
import org.scalatest.FunSuite
import java.io.{ByteArrayOutputStream, ByteArrayInputStream}
import scala.util.Random
import com.google.common.io.Files
import org.apache.commons.io.FileUtils
import java.io.{FileOutputStream, File}
import com.google.common.base.Charsets
import com.google.common.io.Files
import java.io.{ByteArrayOutputStream, ByteArrayInputStream, FileOutputStream, File}
import org.scalatest.FunSuite
import org.apache.commons.io.FileUtils
import scala.util.Random
class UtilsSuite extends FunSuite {

View file

@ -1,9 +1,9 @@
package spark.ui
import scala.util.{Failure, Success, Try}
import java.net.ServerSocket
import org.scalatest.FunSuite
import org.eclipse.jetty.server.Server
import java.net.ServerSocket
import scala.util.{Failure, Success, Try}
class UISuite extends FunSuite {
test("jetty port increases under contention") {