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
timob-7850: Convert fileType Number input to integer before processing it #1610
Conversation
CR/FR in progress |
|
||
//fileType can only accept an int, or a string representation of an int. | ||
//so if users input a number for fileType, we need to convert it to int before processing. | ||
if (key.equals("fileType") && (value instanceof Number)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the value is a string like the comment mentions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its fine if its a string, since this int will be converted to string anyways. The problem that caused this was when the user enter "fileType: 2". We recognized that "2" as a Double, so when we convert it to String, it becomes 2.0, which is an invalid fileType. So a String that is "2.0" would NOT work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix is to mainly address the issue when user types an int in JS, like "2", for fileType, we recognize that as a Double, while he/she thinks that this will be an integer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we even checking for fileType
here? fileType
isn't a standard property, it is specific to the bug in the test case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, you're right. I thought it was but this is user input, which means it should've worked in the first place. I just tested it on my phone and the original test case works... It wasn't working before. Something weird is going on. I'll investigate further on Sunday. Thanks for pointing this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point is, the change in place does not handle:
: "123"
because the value passed to the send() method on the java side see the value as java.lang.String and thus will never pass a instanceof check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hieupham007 when you investigate, if you can reproduce failure against master can you please attach the logcat output to the Jira ticket for reference?
Closing this PR. This fix is invalid. The bug is a much deeper issue. |
JIRA ticket: https://jira.appcelerator.org/browse/TIMOB-7850
Testing steps in JIRA