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-17456]: Treat 'null' values as '' for searchableText #5949

Merged
merged 3 commits into from Aug 21, 2014

Conversation

hieupham007
Copy link
Contributor

testing steps in JIRA

//Handle case sensitivity
if (caseInsensitive) {
searchText = searchText.toLowerCase();
searchableText = searchableText.toLowerCase();
}
//String comparison
if (searchableText != null && searchableText.contains(searchText)) {
if (searchableText.contains(searchText)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it crash if searchableText is null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's handled above, converting null to ""

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 searchableText is null and searchText is ""? I think when searchableText is not specified, it means the search functionality is not enabled. No matter you want to show all the items or hide all the items in this case, you can treat this is a special situation and take care of it at the beginning so it does not need to go through all the following logic and code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will initialize searchableText to "" instead of null.

@pingwang2011
Copy link
Contributor

Ran the test case with this fix. The app still crashed.
E/TiApplication( 2264): java.lang.NullPointerException
E/TiApplication( 2264): at ti.modules.titanium.ui.widget.listview.ListSectionProxy.applyFilter(ListSectionProxy.java:939)
E/TiApplication( 2264): at ti.modules.titanium.ui.widget.listview.TiListView.reFilter(TiListView.java:543)
E/TiApplication( 2264): at ti.modules.titanium.ui.widget.listview.TiListView.filterBy(TiListView.java:851)

@pingwang2011
Copy link
Contributor

CR and FR passed. Accepted

pingwang2011 added a commit that referenced this pull request Aug 21, 2014
[TIMOB-17456]: Treat 'null' values as '' for searchableText
@pingwang2011 pingwang2011 merged commit 434fb36 into tidev:master Aug 21, 2014
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