Merge pull request #1302 from mfietz/issue/1301-out-of-bounds
Fix datetime parsing StringIndexOutOfBoundsException
This commit is contained in:
commit
e830a0fbfc
|
@ -88,9 +88,13 @@ public class DateUtils {
|
||||||
for(String pattern : patterns) {
|
for(String pattern : patterns) {
|
||||||
parser.applyPattern(pattern);
|
parser.applyPattern(pattern);
|
||||||
pos.setIndex(0);
|
pos.setIndex(0);
|
||||||
Date result = parser.parse(date, pos);
|
try {
|
||||||
if(result != null && pos.getIndex() == date.length()) {
|
Date result = parser.parse(date, pos);
|
||||||
return result;
|
if (result != null && pos.getIndex() == date.length()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
Log.e(TAG, Log.getStackTraceString(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue