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-11709] Android: String.formatTime causes app crash when date i… #9572
Conversation
…s string Update TitaniumModule.java
Generated by 🚫 dangerJS |
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.
@maggieaxway, fixing this on the Java side is definitely simpler. I'm just requesting a couple minor changes.
{ | ||
int style = DateFormat.SHORT; | ||
|
||
return (DateFormat.getTimeInstance(style)).format(time); | ||
if (time != null && time instanceof Date) { |
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.
You don't need to do a null
check. It's safe to pass a null
reference to instanceof
and it'll return false in that case. So, change to this...
if (time instanceof Date) {
return null; | ||
} | ||
}else { | ||
Log.e(TAG, "Error occurred while formatting time please provide a Date()"); |
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.
Let's change this error message from...
Log.e(TAG, "Error occurred while formatting time please provide a Date()");
...to...
Log.e(TAG, "The string.formatTime() function was given an invalid argument. Must be of type 'Date'.");
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.
CR: Pass
FR Passed.
No app crash seen. Studio Ver: 4.10.0.201709271713 |
…s string
Update TitaniumModule.java
JIRA: https://jira.appcelerator.org/browse/TIMOB-11709