什么是executionexception:boxed error?还有可能使它更可读或更具体吗?请看下面的代码。
有用提示:在我添加YRBuild之后,一切都会出错!
显示的错误为:

java.util.concurrent.ExecutionException: Boxed Error
    at scala.concurrent.impl.Promise$.resolver(Promise.scala:52) ~[scala-library.jar:na]
    at scala.concurrent.impl.Promise$.scala$concurrent$impl$Promise$$resolveTry(Promise.scala:44) ~[scala-library.jar:na]
    at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:116) ~[scala-library.jar:na]
    at scala.concurrent.Promise$class.complete(Promise.scala:55) ~[scala-library.jar:na]
    at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:58) ~[scala-library.jar:na]
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:23) [scala-library.jar:na]
Caused by: java.lang.Error: could not parse form
    at controllers.SnoopController$$anonfun$11.apply(SnoopController.scala:187) ~[classes/:na]
    at controllers.SnoopController$$anonfun$11.apply(SnoopController.scala:186) ~[classes/:na]
    at play.api.data.Form$$anonfun$fold$2.apply(Form.scala:134) ~[play_2.10-2.1.1.jar:2.1.1]
    at scala.Option.getOrElse(Option.scala:120) [scala-library.jar:na]
    at play.api.data.Form.fold(Form.scala:134) ~[play_2.10-2.1.1.jar:2.1.1]
    at controllers.SnoopController$.getPropertyFromRequest(SnoopController.scala:185) ~[classes/:na]

代码:
视图部分
<div class="inputGroup">
<div class="efInput">
<label for="year_built">Year Built:</label>
<input type="text" id="lotsize" name="year_built" value="@property.yrBuilt">
</div>
</div>

控制器部分:
    def getPropertyFromRequest(implicit request: Request[AnyContent]): (Property, Option[ObjectId], Option[ObjectId]) = {
        val p =
          Form(tuple(
            "desc" -> text,
            "url" -> text,
            "image" -> text,
            "price" -> text,
            "sqft" -> text,
            "address2" -> text,
            "lotsize" -> text,
            "taxes" -> text,
            "status" -> optional(text),
            "maint" -> text,
            "address" -> text,
            "mls" -> text,
            "baths" -> text,
            "beds" -> text,
            "partial_baths" -> text,
            "propertyId" -> optional(text),
            "snoopId" -> optional(text),
            "yrBuilt" -> text
          )).bindFromRequest().fold(
              errors => {Logger.error(errors.toString())
                throw new Error("could not parse form")},
              success => success
          )

          val a = GeoCoder.create(p._11 + " " + p._6)
          val property = Property(url = p._2,
            description = p._1,
            image = p._3,
            price = parseAmount(p._4).toDouble,
            sqft = p._5,
            lotSize = p._7,
            taxes = parseAmount(p._8),
            status = PropertyStatus.ACTIVE,
            maintenance = parseAmount(p._10),
            mls = p._12,
            baths = try{p._13.toDouble}catch{case e => 0},
            beds = try{p._14.toInt}catch{case e=> 0},
            partialBaths = try{p._15.toDouble}catch{case e => 0},
            address = a,
            yrBuilt = p._18)

          (property,p._16.map(new ObjectId(_)),p._17.map(new ObjectId(_)))
      }

模型零件:
case class Property(
  id: ObjectId = new ObjectId,
  parentId: Option[ObjectId] = None,
  url: String,
  price: Double,
  parentPrice: Option[Double] = None,
  beds: Int,
  baths: Double,
  partialBaths: Double = 0.0,
  address: Address,
  mls: String,
  sqft: String,
  lotSize: String,
  taxes: Int,
  maintenance: Int,
  description: String,
  image: String,
  status: PropertyStatus.Value = PropertyStatus.ACTIVE,
  updated: Date = new Date(),
  priceHistory: List[PriceChange] = Nil,
  failedSnoops: Int = 0,
  yrBuilt: String
) {
  def monthlyFees: Double = {
    val t = try { taxes / 12 } catch { case e: Exception => 0 }
    val m = try { maintenance / 12 } catch { case e: Exception => 0 }
    t + m
  }

  def diff(that: Property): List[(String,Any,Any)] = {
    var changes: List[(String,Any,Any)] = Nil
    if (this.url != that.url) changes = ("url", this.url, that.url) :: changes
    if (this.price != that.price) changes = ("price", this.price, that.price) :: changes
    if (this.beds != that.beds) changes = ("beds", this.beds, that.beds) :: changes
    if (this.baths != that.baths) changes = ("baths", this.baths, that.baths) :: changes
    if (this.partialBaths != that.partialBaths) changes = ("partialBaths", this.partialBaths, that.partialBaths) :: changes
    if (this.address != that.address) changes = ("address", this.address, that.address) :: changes
    if (this.mls != that.mls) changes = ("mls", this.mls, that.mls) :: changes
    if (this.sqft != that.sqft) changes = ("sqft", this.sqft, that.sqft) :: changes
    if (this.lotSize != that.lotSize) changes = ("lotSize", this.lotSize, that.lotSize) :: changes
    if (this.taxes != that.taxes) changes = ("taxes", this.taxes, that.taxes) :: changes
    if (this.maintenance != that.maintenance) changes = ("maintenance", this.maintenance, that.maintenance) :: changes
    if (this.description != that.description) changes = ("description", this.description, that.description) :: changes
    if (this.yrBuilt != that.yrBuilt) changes = ("yrBuilt", this.yrBuilt, that.yrBuilt) :: changes
    changes
  }
}

最佳答案

看起来它很难解析您的表单,原因可能是它找不到YRBuild字段。您已经覆盖了字段的默认id/名称。尝试:
<input type="text" id="yrBuilt" name="yrBuilt" value="@property.yrBuilt">

07-25 22:43