Grails Argument Type Mismatch

Plutiom

New Member
I have a Grails problem that has been picking my brain for a while. I have my domain:\[code\]class PropSoi {String bppdescriptionString bppamtString bppcoinsString bppvaluationString bpplossString bppguardString bppdedString bppblktString bppformString bldgdescriptionString bldgamtString bldgcoinsString bldgvaluationString bldglossString bldgguardString bldgdedString bldgblktString bldgformstatic belongsTo = PropBldgstatic constraints = { bppdescription(nullable:true) bppamt(nullable:true) bppcoins(nullable:true) bppvaluation(nullable:true) bpploss(nullable:true) bppguard(nullable:true) bppded(nullable:true) bppblkt(nullable:true) bppform(nullable:true) bldgdescription(nullable:true) bldgamt(nullable:true) bldgcoins(nullable:true) bldgvaluation(nullable:true) bldgloss(nullable:true) bldgguard(nullable:true) bldgded(nullable:true) bldgblkt(nullable:true) bldgform(nullable:true)}\[/code\]}and I have a service which loops through different portions of an XML file that I am given:\[code\]if (propinfo?.SubjectInsuranceCd?.text() == 'BPP'){ def soi = pbldg?.soi if (soi){ //THIS IS NOT WORKING soi.bppdescription = propinfo?.SubjectInsuranceCd?.text() soi.bppamt = propinfo?.CommlCoverage?.Limit.FormatInteger?.text() soi.bppcoins = propinfo?.CommlCoverageSupplement?.CoinsurancePct?.text() soi.bppvaluation = propinfo?.CommlCoverage?.Limit.ValuationCd?.text() soi.bpploss = propinfo?.CommlCoverage?.CoverageCd?.find{ it?.text() != 'INFL' }?.text() soi.bppguard = propinfo?.CommlCoverage?.find{ it?.CoverageCd?.text() == 'INFL'}?.Limit?.FormatInteger?.text() soi.bppded = propinfo?.CommlCoverage?.find{ it?.CoverageCd?.text() == 'INFL'}?.Deductible?.FormatInteger?.text() soi.bppblkt = propinfo?.CommlCoverageSupplement?.BlanketNumber?.text() soi.bppform = propinfo?.CommlCoverage?.Form?.FormNumber?.text() }else{ soi = new PropSoi() soi.bppdescription = propinfo?.SubjectInsuranceCd?.text() soi.bppamt = propinfo?.CommlCoverage?.Limit.FormatInteger?.text() soi.bppcoins = propinfo?.CommlCoverageSupplement?.CoinsurancePct?.text() soi.bppvaluation = propinfo?.CommlCoverage?.Limit.ValuationCd?.text() soi.bpploss = propinfo?.CommlCoverage?.CoverageCd?.find{ it?.text() != 'INFL' }?.text() soi.bppguard = propinfo?.CommlCoverage?.find{ it?.CoverageCd?.text() == 'INFL'}?.Limit?.FormatInteger?.text() soi.bppded = propinfo?.CommlCoverage?.find{ it?.CoverageCd?.text() == 'INFL'}?.Deductible?.FormatInteger?.text() soi.bppblkt = propinfo?.CommlCoverageSupplement?.BlanketNumber?.text() soi.bppform = propinfo?.CommlCoverage?.Form?.FormNumber?.text() pbldg?.addToSoi(soi) } }else if(propinfo?.SubjectInsuranceCd?.text() == 'BLDG'){ def soi = pbldg?.soi if (soi){ //THIS IS NOT WORKING soi.bldgdescription = propinfo?.SubjectInsuranceCd?.text() soi.bldgamt = propinfo?.CommlCoverage?.Limit.FormatInteger?.text() soi.bldgcoins = propinfo?.CommlCoverageSupplement?.CoinsurancePct?.text() soi.bldgvaluation = propinfo?.CommlCoverage?.Limit.ValuationCd?.text() soi.bldgloss = propinfo?.CommlCoverage?.CoverageCd?.find{ it?.text() != 'INFL' }?.text() soi.bldgguard = propinfo?.CommlCoverage?.find{ it?.CoverageCd?.text() == 'INFL'}?.Limit?.FormatInteger?.text() soi.bldgded = propinfo?.CommlCoverage?.find{ it?.CoverageCd?.text() == 'INFL'}?.Deductible?.FormatInteger?.text() soi.bldgblkt = propinfo?.CommlCoverageSupplement?.BlanketNumber?.text() soi.bldgform = propinfo?.CommlCoverage?.Form?.FormNumber?.text() }else{ soi = new PropSoi() soi.bldgdescription = propinfo?.SubjectInsuranceCd?.text() soi.bldgamt = propinfo?.CommlCoverage?.Limit.FormatInteger?.text() soi.bldgcoins = propinfo?.CommlCoverageSupplement?.CoinsurancePct?.text() soi.bldgvaluation = propinfo?.CommlCoverage?.Limit.ValuationCd?.text() soi.bldgloss = propinfo?.CommlCoverage?.CoverageCd?.find{ it?.text() != 'INFL' }?.text() soi.bldgguard = propinfo?.CommlCoverage?.find{ it?.CoverageCd?.text() == 'INFL'}?.Limit?.FormatInteger?.text() soi.bldgded = propinfo?.CommlCoverage?.find{ it?.CoverageCd?.text() == 'INFL'}?.Deductible?.FormatInteger?.text() soi.bldgblkt = propinfo?.CommlCoverageSupplement?.BlanketNumber?.text() soi.bldgform = propinfo?.CommlCoverage?.Form?.FormNumber?.text() pbldg?.addToSoi(soi) }\[/code\]The point is that when the first loop is run there is no PropSoi, so it creates a new one and fills it with the data from the XML. This works just fine. When it loops through the second time, the PropSoi now exists and it tries to fill in the other half (if BPP already exists it fills BLDG and vise-versa). But when the second loop executes, I get an error stating:\[code\]Error 500: Executing action [readxml] of controller [MainController] caused exception: argument type mismatchServlet: grailsURI: /NonProfitFinal/grails/main/readxml.dispatchException Message: argument type mismatch Caused by: argument type mismatch \[/code\]Does anyone know why this is occurring? If only BPP exists or only BLDG, it works just fine. But if both exist I get this error.
 
Back
Top