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

timob-7850: Convert fileType Number input to integer before processing it #1610

Closed
wants to merge 1 commit into from

Conversation

hieupham007
Copy link
Contributor

JIRA ticket: https://jira.appcelerator.org/browse/TIMOB-7850
Testing steps in JIRA

@rusticphilosopher
Copy link
Contributor

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)) {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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?

@hieupham007
Copy link
Contributor Author

Closing this PR. This fix is invalid. The bug is a much deeper issue.

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

3 participants