我有一段代码来读取 ofx 文件以检索多个标签(例如帐户编号、余额等)。我正在使用 net.sf.ofx4j
一段代码:
public void parse(String filename) throws OFXParseException, IOException, SQLException {
AggregateUnmarshaller<ResponseEnvelope> unmarshaller = new AggregateUnmarshaller<ResponseEnvelope>(
ResponseEnvelope.class);
FileInputStream file = null;
try {
file = new FileInputStream(filename);
ResponseEnvelope envelope = unmarshaller.unmarshal(file);
BankingResponseMessageSet messageSet = (BankingResponseMessageSet) envelope.getMessageSet(MessageSetType.banking);
List<BankStatementResponseTransaction> responses = messageSet.getStatementResponses();
for (BankStatementResponseTransaction response : responses) {
BankStatementResponse message = response.getMessage();
String currencyCode = message.getCurrencyCode();
String acct_number = message.getAccount().getAccountNumber();
double av = message.getAvailableBalance().getAmount();
double cur = message.getLedgerBalance().getAmount();
AccountType acct_type = message.getAccount().getAccountType();
}
} catch (OFXParseException e) {
System.out.println("Error: " + e.getMessage());
}
return null;
}
它工作正常,直到有一天它开始抛出以下异常:
net.sf.ofx4j.io.AggregateStackContentHandler onElement INFO:索引 70 处的聚合 SONRS(类 net.sf.ofx4j.domain.data.signon.SignonResponse)不支持元素 INTU.BID。
net.sf.ofx4j.io.AggregateStackContentHandler onElement INFO:索引 70 处的聚合 SONRS(类 net.sf.ofx4j.domain.data.signon.SignonResponse)不支持元素 INTU.USERID。
线程“main”中的异常 java.lang.IllegalStateException: java.io.IOException: Unexpected EOF
谢谢