我在将XML文件导入到名为Junifer的外部系统中时遇到问题。系统已设置为根据我们预先定义的内容接受某些字符串,整数和值。
正在上传的XML文件如下:
<Customer>
<UniqueId>1001</UniqueId>
<ContractId>10012</ContractId>
<ExternalCustomerReference>CustomerREF</ExternalCustomerReference>
<CustomerReference></CustomerReference>
<CompanyName>Name of Company</CompanyName>
<CompanyRegistrationNumber>0000000</CompanyRegistrationNumber>
<CustomerClass>Non Micro</CustomerClass>
<CreditScore></CreditScore>
<BusinessStartDate>12/05/2009</BusinessStartDate>
<BusinessType>Limited</BusinessType>
<Account>
<Contact>
<ContactType>Primary Customer</ContactType>
<IsPrimaryContact>True</IsPrimaryContact>
<ContactSurname>Surname</ContactSurname>
<ContactFirstname>Name</ContactFirstname>
<ContactTitle>Mr</ContactTitle>
<ContactEmailAddress>[email protected]</ContactEmailAddress>
<ContactDateOfBirth></ContactDateOfBirth>
<ContactPrimaryTelephoneNumber>01234567890</ContactPrimaryTelephoneNumber>
<ContactSecondaryTelephoneNumber>01234567890</ContactSecondaryTelephoneNumber>
<BillDeliveryMethod>E-bill</BillDeliveryMethod>
<CommunicationDeliveryMethod>Email</CommunicationDeliveryMethod>
<Address1>Line1</Address1>
<Address2>Line2</Address2>
<Address3>Line3</Address3>
<Address4>Line4</Address4>
<Address5></Address5>
<AddressPostcode>PC1 2PC</AddressPostcode>
</Contact>
<PaymentMethod>
<PaymentMethod>Direct Debit</PaymentMethod>
<BillingCycle></BillingCycle>
<BankAccountName>Bank</BankAccountName>
<BankAccountNumber>22222222</BankAccountNumber>
<BankSortCode>111111</BankSortCode>
<DirectDebitPaymentDay>1</DirectDebitPaymentDay>
<DirectDebitPayment>339.204</DirectDebitPayment>
</PaymentMethod>
<Property>
<PropertyAddress1>Property</PropertyAddress1>
<PropertyAddress2></PropertyAddress2>
<PropertyAddress3>Property3</PropertyAddress3>
<PropertyAddress4>Property4</PropertyAddress4>
<PropertyAddress5>Property5</PropertyAddress5>
<PropertyAddressPostcode>PC1 2PC</PropertyAddressPostcode>
<SupplyCapacity>0.00</SupplyCapacity>
<MeterPoint>
<MeterPointIdentifier>1234567890</MeterPointIdentifier>
<ProfileClass>03</ProfileClass>
<Fuel>Electricity</Fuel>
<TprMappingSet>Tracker</TprMappingSet>
<HhRateDefinition></HhRateDefinition>
<AnnualConsumptions>
<Consumption>20000kWh</Consumption>
<RateName>Standard</RateName>
</AnnualConsumptions>
<Agreement>
<AgreementReference>0.0</AgreementReference>
<AgreementStartDate>27/11/2019</AgreementStartDate>
<AgreementEndDate>26/11/2022</AgreementEndDate>
<AgreementTerm>36</AgreementTerm>
<ProductBundleRef>ElecTracker</ProductBundleRef>
<BrokerCode>BROKER1</BrokerCode>
<BrokerAgentReference>0.0</BrokerAgentReference>
<BrokerReference>Broker</BrokerReference>
<DateOfSale>28/10/2019</DateOfSale>
<ProductItems>
<ProductItem>
<ProductItemReference>ENERGY</ProductItemReference>
<Rates>
<Rate>
<Rate>19.75</Rate>
<RateName>Standard</RateName>
</Rate>
</Rates>
</ProductItem>
<ProductItem>
<ProductItemReference>STANDING-CHARGE</ProductItemReference>
<Rates>
<Rate>
<Rate>33.00</Rate>
</Rate>
</Rates>
</ProductItem>
</ProductItems>
</Agreement>
</MeterPoint>
</Property>
</Account>
</Customer>
</Customers>
由于某些原因,我收到以下错误:
java.lang.NumberFormatException: For input string: "
"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at com.junifer.thor.processing.task.enrolment.CommercialEnrolmentContext.getInteger(CommercialEnrolmentContext.java:492)
at com.junifer.thor.processing.task.enrolment.CommercialEnrolmentContext.resolveCustomerElement(CommercialEnrolmentContext.java:140)
at com.junifer.thor.processing.task.enrolment.CommercialEnrolmentContext.build(CommercialEnrolmentContext.java:94)
at com.junifer.thor.processing.task.enrolment.CommercialEnrolmentOperationsImpl.lambda$buildEnrolmentContextsFromFile$933(CommercialEnrolmentOperationsImpl.java:185)
at com.junifer.thor.processing.task.core.DefaultTaskExecutionContext.executeSubTask(DefaultTaskExecutionContext.java:132)
at com.junifer.thor.processing.task.core.DefaultTaskExecutionContext.executeSubTask(DefaultTaskExecutionContext.java:119)
at com.junifer.thor.processing.task.enrolment.CommercialEnrolmentOperationsImpl.buildEnrolmentContextsFromFile(CommercialEnrolmentOperationsImpl.java:181)
at com.junifer.thor.processing.task.enrolment.CommercialEnrolmentImportTask.executeProcessFile(CommercialEnrolmentImportTask.java:49)
at com.junifer.thor.processing.task.core.LogicalFileBatchTaskComponent.lambda$execute$17(LogicalFileBatchTaskComponent.java:80)
at com.junifer.thor.processing.task.core.DefaultTaskExecutionContext.executeSubTask(DefaultTaskExecutionContext.java:132)
at com.junifer.thor.processing.task.core.LogicalFileBatchTaskComponent.execute(LogicalFileBatchTaskComponent.java:71)
at com.junifer.thor.processing.task.core.TaskExecutor$TaskRunnable.executeTask(TaskExecutor.java:674)
at com.junifer.thor.processing.task.core.TaskExecutor$TaskRunnable.runWithLogging(TaskExecutor.java:623)
at com.junifer.thor.processing.task.core.TaskExecutor$TaskRunnable.run(TaskExecutor.java:595)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:113)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
有人根据XML中提供的信息对如何获得成功的阅读有任何建议吗?
基于该堆栈跟踪,我想说<CreditScore></CreditScore>
应该包含一个整数值,例如<CreditScore>0</CreditScore>
顺便说一下,£339.204对于<DirectDebitPayment>
似乎太小数了
[<AgreementReference>
和<BrokerAgentReference>
是可为空的文本字段,因此不太可能(尽管不是错误)它们需要包含十进制值。