NumberFormatException для входной строки импорта Junifer - PullRequest
0 голосов
/ 06 ноября 2019

У меня проблема с импортом файла 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>me@me.com</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>

По какой-то причине я 'm получает следующую ошибку:

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?

...