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

Fix StringIndexOutOfBoundsException #2

Merged
merged 1 commit into from
Nov 6, 2015

Conversation

maddie
Copy link
Contributor

@maddie maddie commented Nov 6, 2015

In some locales (e.g. Chinese), the method getShortWeekdays() in
DateFormatSymbols used in the CalendarView class will return an array
of string which are only two characters long.

In this case, String.substring() method in the loop, which was
hardcoded with parameter (0, 3) will throw a StringIndexOutOfBoundsException
since there is only two characters in the returned string.

This commit fixes this behavior by first determining the length of the
string, then use either the length of the string or 3 as the second
parameter to the substring() method.

In some locales (e.g. Chinese), the method getShortWeekdays() in
 ateFormatSymbols used in the CaldarView class will return an array
of string which are only two characters long.

In this case, String.substring() method in the loop, which was
hardcoded with parameter (0, 3) will throw a StringIndexOutOfBoundsException
since there is only two characters in the returned string.

This commit fixes this behavior by first determining the length of the
string, then use either the length of the string or 3 as the second
parameter to the substring() method.
@maddie
Copy link
Contributor Author

maddie commented Nov 6, 2015

Fixes issue #1

JonatanSalas pushed a commit that referenced this pull request Nov 6, 2015
Fix StringIndexOutOfBoundsException
@JonatanSalas JonatanSalas merged commit 913b106 into BlackBoxVision:master Nov 6, 2015
@JonatanSalas
Copy link
Member

Thanks for your help! :)

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.

2 participants