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

fixed exception when String.format thought the binary data has formt placeholders #4191

Merged
merged 3 commits into from
Jan 13, 2019

Conversation

flocsy
Copy link
Contributor

@flocsy flocsy commented Jan 13, 2019

No description provided.

@tananaev
Copy link
Member

Please include unit test.

@flocsy
Copy link
Contributor Author

flocsy commented Jan 13, 2019

the existing unittest covers it, that's why the 1st commit failed

@tananaev
Copy link
Member

What is the difference then?

@flocsy
Copy link
Contributor Author

flocsy commented Jan 13, 2019

in org/traccar/StringProtocolEncoder.java:30 it might fail depending on the binary data that was concatenated to the format string. It happens in my case sometimes... But it's easy to see that it's not meant to have binary data in the format string

@tananaev
Copy link
Member

Well, can we have test case for the different behavior?

@flocsy
Copy link
Contributor Author

flocsy commented Jan 13, 2019

Added a test. It passes with:

return formatCommand(channel, command, "TK,%s", getBinaryData(command));

but fails with the old:

return formatCommand(channel, command, "TK," + getBinaryData(command));

@tananaev tananaev merged commit 4650b7f into traccar:master Jan 13, 2019
@tananaev
Copy link
Member

Merged, thanks.

@flocsy flocsy deleted the TK-binary branch January 13, 2019 22:17
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

Successfully merging this pull request may close these issues.

None yet

2 participants