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

OFXHEADER value not trimmed #25

Open
bhecht opened this issue Aug 8, 2018 · 4 comments
Open

OFXHEADER value not trimmed #25

bhecht opened this issue Aug 8, 2018 · 4 comments

Comments

@bhecht
Copy link

bhecht commented Aug 8, 2018

I am dealing with a bank who sends the following header:

OFXHEADER: 100
DATA: OFXSGML
VERSION: 102
SECURITY: NONE
ENCODING: USASCII
CHARSET: 1252
COMPRESSION: NONE
OLDFILEUID: NONE
NEWFILEUID: NONE

Note that there is a space after the colon before the value. This is causing the following parse error:

java.lang.IllegalArgumentException: No enum constant net.sf.ofx4j.domain.data.ApplicationSecurity. NONE
at java.lang.Enum.valueOf(Enum.java:238)
at net.sf.ofx4j.io.DefaultStringConversion.fromString(DefaultStringConversion.java:81)
at net.sf.ofx4j.io.AggregateStackContentHandler.onHeader(AggregateStackContentHandler.java:50)
at net.sf.ofx4j.io.BaseOFXReader.processOFXv1Headers(BaseOFXReader.java:193)
at net.sf.ofx4j.io.BaseOFXReader.parse(BaseOFXReader.java:111)
at net.sf.ofx4j.io.BaseOFXReader.parse(BaseOFXReader.java:68)
at net.sf.ofx4j.io.AggregateUnmarshaller.unmarshal(AggregateUnmarshaller.java:44)

If I remove the space, it all parses fine. I looked at processOFXv1Headers and it does NOT trim the value. However, I also see that processOFXv2Headers DOES trim the header.

I looked at spec and it was unclear to me if v1 does NOT allow a space and v2 does?

So is this an issue the bank needs to fix or should OFX4J trim the v1 value also? Should this question be asked elsewhere?

@stoicflame
Copy link
Owner

It seems like we should just fix the code if someone is sending it that way. I'm happy to take and merge a pull request if you want to put one together.

@bhecht
Copy link
Author

bhecht commented Aug 8, 2018

I downloaded master, created a branch, committed the change to the branch. When I attempted to push the branch up, I got:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --set-upstream origin bug-OFXHEADER_Value_Trim:bug-OFXHEADER_Value_Trim
Fatal: HttpRequestException encountered.
An error occurred while sending the request.
remote: Permission to stoicflame/ofx4j.git denied to bhecht.
fatal: unable to access 'https://github.com/stoicflame/ofx4j.git/': The requested URL returned error: 403
Pushing to https://github.com/stoicflame/ofx4j.git
Completed with errors, see above

So I guess I need privileges to create a branch?

@bhecht bhecht closed this as completed Aug 8, 2018
@stoicflame
Copy link
Owner

You need to fork the project, push the changes to your fork, then create a pull request from that fork.

@bhecht
Copy link
Author

bhecht commented Aug 8, 2018

Looks like I accidentally closed this issue and I have now reopened it.

I've created the pull request.

@bhecht bhecht reopened this Aug 8, 2018
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