Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ampersand in OFX v1 file not supported #63

Open
nicoepp opened this issue Oct 19, 2021 · 1 comment
Open

Ampersand in OFX v1 file not supported #63

nicoepp opened this issue Oct 19, 2021 · 1 comment

Comments

@nicoepp
Copy link

nicoepp commented Oct 19, 2021

An OFX v1 file downloaded from CIBC contained a line similar to the following

<MEMO>DEBIT MEMO 05987 EFT CREDIT PAYMENT REVERSAL ABM CHANNEL & CARD MANAGEMT SE

resulting in the following stacktrace:

Exception in thread "main" java.lang.IllegalStateException: java.io.IOException: Unexpected EOF
	at com.webcohesion.ofx4j.io.AggregateUnmarshaller.unmarshal(AggregateUnmarshaller.java:70)
	at com.plantango.ofx.App.main(App.java:38)
Caused by: java.io.IOException: Unexpected EOF
	at net.n3.nanoxml.StdXMLReader.read(Unknown Source)
	at net.n3.nanoxml.XMLUtil.read(Unknown Source)
	at net.n3.nanoxml.ContentReader.read(Unknown Source)
	at net.n3.nanoxml.ContentReaderBackdoor.read(ContentReaderBackdoor.java:24)
	at java.base/java.io.Reader.read(Reader.java:229)
	at com.webcohesion.ofx4j.io.nanoxml.NanoXMLOFXReader.readCharacters(NanoXMLOFXReader.java:200)
	at com.webcohesion.ofx4j.io.nanoxml.NanoXMLOFXReader.processOFXTag(NanoXMLOFXReader.java:173)
	at com.webcohesion.ofx4j.io.nanoxml.NanoXMLOFXReader.processOFXTag(NanoXMLOFXReader.java:150)
	at com.webcohesion.ofx4j.io.nanoxml.NanoXMLOFXReader.processOFXTag(NanoXMLOFXReader.java:150)
	at com.webcohesion.ofx4j.io.nanoxml.NanoXMLOFXReader.processOFXTag(NanoXMLOFXReader.java:150)
	at com.webcohesion.ofx4j.io.nanoxml.NanoXMLOFXReader.processOFXTag(NanoXMLOFXReader.java:150)
	at com.webcohesion.ofx4j.io.nanoxml.NanoXMLOFXReader.processOFXTag(NanoXMLOFXReader.java:150)
	at com.webcohesion.ofx4j.io.nanoxml.NanoXMLOFXReader.processOFXTag(NanoXMLOFXReader.java:150)
	at com.webcohesion.ofx4j.io.nanoxml.NanoXMLOFXReader.parseV1FromFirstElement(NanoXMLOFXReader.java:52)
	at com.webcohesion.ofx4j.io.BaseOFXReader.parse(BaseOFXReader.java:113)
	at com.webcohesion.ofx4j.io.AggregateUnmarshaller.unmarshal(AggregateUnmarshaller.java:63)
	... 1 more

Note the unescaped & in the memo. I tried parsing and converting with the Python library ofxtools which worked without issues. The OFX v1 spec itself doesn't seem to require escaping special symbols like & AFAIK.

Escaping ampersand by replacing the & with &amp; fixed the issue for me. I don't know if we wan't to fix this in the library (or just recommend preprocessing the file) but a better error message would definitively be helpful

@nicoepp nicoepp changed the title Ampersand in OFX file not supported Ampersand in OFX v1 file not supported Oct 19, 2021
@Luiz-Otavio-Dorigon
Copy link

What is the forecast for this correction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants