forked from I2P_Developers/i2p.i2p
Time: Fix crashes on old Androids (ticket #1976)
This commit is contained in:
@ -34,7 +34,10 @@ public class BuildTime {
|
|||||||
private static final long _latestTime;
|
private static final long _latestTime;
|
||||||
private static final long YEARS_25 = 25L*365*24*60*60*1000;
|
private static final long YEARS_25 = 25L*365*24*60*60*1000;
|
||||||
/** update this periodically */
|
/** update this periodically */
|
||||||
private static final String EARLIEST = "2016-02-19 12:00:00 UTC";
|
private static final String EARLIEST = "2017-03-27 12:00:00 UTC";
|
||||||
|
// fallback if parse fails ticket #1976
|
||||||
|
// date -d 201x-xx-xx +%s
|
||||||
|
private static final long EARLIEST_LONG = 1490587200 * 1000L;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// this is the standard format of build.timestamp as set in the top-level build.xml
|
// this is the standard format of build.timestamp as set in the top-level build.xml
|
||||||
@ -45,12 +48,15 @@ public class BuildTime {
|
|||||||
try {
|
try {
|
||||||
Date date = fmt.parse(EARLIEST);
|
Date date = fmt.parse(EARLIEST);
|
||||||
if (date == null)
|
if (date == null)
|
||||||
throw new RuntimeException("BuildTime FAIL");
|
min = EARLIEST_LONG;
|
||||||
min = date.getTime();
|
else
|
||||||
|
min = date.getTime();
|
||||||
} catch (ParseException pe) {
|
} catch (ParseException pe) {
|
||||||
System.out.println("BuildTime FAIL");
|
System.out.println("BuildTime FAIL");
|
||||||
pe.printStackTrace();
|
// Old Android, ticket #1976
|
||||||
throw new RuntimeException("BuildTime FAIL", pe);
|
//pe.printStackTrace();
|
||||||
|
//throw new RuntimeException("BuildTime FAIL", pe);
|
||||||
|
min = EARLIEST_LONG;
|
||||||
}
|
}
|
||||||
long max = min + YEARS_25;
|
long max = min + YEARS_25;
|
||||||
long build = getBuildTime(fmt, "i2p.jar");
|
long build = getBuildTime(fmt, "i2p.jar");
|
||||||
|
Reference in New Issue
Block a user