当我尝试助教保存一个新的记录在我的Grails应用程序我收到产生ArrayIndexOutOfBounds异常情况。
我已经收窄的问题只能够保存8个字段。
这里是我的域类:
package nhvr
class NhvrJourny {
static constraints = {
nhvrNo nullable:true
journeyId nullable:true
width nullable:true
vLength nullable:true
height nullable:true
rearOverhang nullable:true
}
Long nhvrNo
String journeyId
String title
BigDecimal width
BigDecimal vLength
BigDecimal height
BigDecimal rearOverhang
String toString(){
return "$nhvrNo $title"
}
}
通过即时通讯服务保存数据。 该方法是这样的:
def saveJourny(Map nhvrJourneyPars) {
if (nhvrJourneyPars?.dateArchived)
da = df.parse(nhvrJourneyPars.dateArchived)
Map journeyPars = [
journeyId : nhvrJourneyPars.journeyId,
title : nhvrJourneyPars.title,
nhvrNo : nhvrJourneyPars.nhvrNo,
width : nhvrJourneyPars.width,
vLength : nhvrJourneyPars.vLength,
height : nhvrJourneyPars.height,
rearOverhang : nhvrJourneyPars.rearOverhang
]
NhvrJourny nhvrJournyInstance = new NhvrJourny(journeyPars)
println "journeyPars:"
journeyPars.each{
println "${it.key}: ${it.value}"
}
if (nhvrJournyInstance == null) {
println "nhvrJournyInstance is null"
notFound()
return
}
if (!nhvrJournyInstance.validate()) {
if (nhvrJournyInstance.hasErrors()) {
println "Errors: ${nhvrJournyInstance.errors.allErrors}"
respond nhvrJournyInstance.errors, view: 'create'
return
}
}
else{
println "No errors in nhvrJourneysInstance."
}
println "nhvrJournyInstance.properties"
nhvrJournyInstance.properties.each{
println " ${it.key}: ${it.value}"
}
nhvrJournyInstance.save(flush:true)
return nhvrJournyInstance
}
我可以看到,在被传递的数据,它看起来OK:
nhvrJournyInstance: {"journeyId":"j1","title":"test","nhvrNo":"2","width":3,"height":3,"vLength":21,"rearOverhang":1}
这是目前返回时,我打电话nhvrJournyInstance.save产生ArrayIndexOutOfBounds异常(冲洗:真)
如果我从域类中删除领域之一,那么得到的数据保存。 注意:虽然只有7所示被自动添加了ID和版本字段。
使用运行的应用程序从Windows上的IntelliJ 13.1.4 7我的Grails版本,我一直在测试是2.4.2和Java版本是1.7.0_60数据库使用ojdbc6.jar的Oracle 11g
任何人都可以阐明这一些轻? 这是推动我坚果。
编辑 - 这里是堆栈跟踪:
14. Stacktrace follows:
Message: 14
Line | Method
->> 950 | computeBasicInfo in oracle.jdbc.driver.OracleSql
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 623 | getSqlKind in ''
| 1212 | <init> . . . . . . . . . in oracle.jdbc.driver.OraclePreparedStatement
| 28 | <init> in oracle.jdbc.driver.T4CPreparedStatement
| 68 | allocatePreparedStatement in oracle.jdbc.driver.T4CDriverExtension
| 3140 | prepareStatement in oracle.jdbc.driver.PhysicalConnection
| 3042 | prepareStatement . . . . in ''
| 6022 | prepareStatement in ''
| 699 | $tt__saveJourney . . . . in nhvr.NhvrService
| 58 | $tt__saveJourney in nhvr.NhvrJourneyController
| 198 | doFilter . . . . . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 1145 | runWorker . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . . . . . . . . in java.lang.Thread
enter code here