Our JDK 1.6 and 1.7 builds began failing today with the message "Error: time is more
than 10 years from present: 1104530400000". At midnight Turkish time on Dec 31,
2004, the new Turkish lira (TRY) replaced the old lira (TRL) at 1,000,000:1. You may
note that this was exactly 10 years ago today.
Some enterprising long-ago coder included a sanity test that all currency conversions
happen within 10 years of the current moment, but clearly they must have meant "no
more than 10 years into the future". To correct this, I remove the Math.abs() from
the code in question.
I admit to not being familiar with the bug submission and patch submission
process for OpenJDK, but hopefully as a trivial fix there is no issue with
copyright assignment or other technicalities. I just submit this in hope that
it avoids more folks wasting their time on this issue.
---
openjdk/jdk/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java
2014-12-30 20:49:40.000000000 -0500
+++
openjdk/jdk/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java
2014-12-30 20:49:40.000000000 -0500
@@ -281,7 +281,7 @@
checkCurrencyCode(newCurrency);
String timeString = currencyInfo.substring(4, length - 4);
long time = format.parse(timeString).getTime();
- if (Math.abs(time - System.currentTimeMillis()) > ((long) 10) *
365 * 24 * 60 * 60 * 1000) {
+ if (time - System.currentTimeMillis() > ((long) 10) * 365 * 24 *
60 * 60 * 1000) {
throw new RuntimeException("time is more than 10 years from
present: " + time);
}
specialCaseCutOverTimes[specialCaseCount] = time;
--
Chris Metcalf, EZChip Semiconductor
http://www.ezchip.com