Skip to content

7102969: currency.properties supercede not working correctly #660

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public class GenerateCurrencyData {

private static final int maxOtherCurrencies = 128;
private static int otherCurrenciesCount = 0;
private static StringBuffer otherCurrencies = new StringBuffer();
private static String[] otherCurrencies = new String[maxOtherCurrencies];
private static int[] otherCurrenciesDefaultFractionDigits = new int[maxOtherCurrencies];
private static int[] otherCurrenciesNumericCode= new int[maxOtherCurrencies];

Expand Down Expand Up @@ -323,10 +323,7 @@ private static void buildOtherTables() {
if (otherCurrenciesCount == maxOtherCurrencies) {
throw new RuntimeException("too many other currencies");
}
if (otherCurrencies.length() > 0) {
otherCurrencies.append('-');
}
otherCurrencies.append(currencyCode);
otherCurrencies[otherCurrenciesCount] = currencyCode;
otherCurrenciesDefaultFractionDigits[otherCurrenciesCount] = getDefaultFractionDigits(currencyCode);
otherCurrenciesNumericCode[otherCurrenciesCount] = getNumericCode(currencyCode);
otherCurrenciesCount++;
Expand Down Expand Up @@ -355,35 +352,41 @@ private static void writeOutput() throws IOException {
out.writeInt(Integer.parseInt(dataVersion));
writeIntArray(mainTable, mainTable.length);
out.writeInt(specialCaseCount);
writeLongArray(specialCaseCutOverTimes, specialCaseCount);
writeStringArray(specialCaseOldCurrencies, specialCaseCount);
writeStringArray(specialCaseNewCurrencies, specialCaseCount);
writeIntArray(specialCaseOldCurrenciesDefaultFractionDigits, specialCaseCount);
writeIntArray(specialCaseNewCurrenciesDefaultFractionDigits, specialCaseCount);
writeIntArray(specialCaseOldCurrenciesNumericCode, specialCaseCount);
writeIntArray(specialCaseNewCurrenciesNumericCode, specialCaseCount);
writeSpecialCaseEntries();
out.writeInt(otherCurrenciesCount);
out.writeUTF(otherCurrencies.toString());
writeIntArray(otherCurrenciesDefaultFractionDigits, otherCurrenciesCount);
writeIntArray(otherCurrenciesNumericCode, otherCurrenciesCount);
writeOtherCurrencies();
}

private static void writeIntArray(int[] ia, int count) throws IOException {
for (int i = 0; i < count; i ++) {
for (int i = 0; i < count; i++) {
out.writeInt(ia[i]);
}
}

private static void writeLongArray(long[] la, int count) throws IOException {
for (int i = 0; i < count; i ++) {
out.writeLong(la[i]);
private static void writeSpecialCaseEntries() throws IOException {
for (int index = 0; index < specialCaseCount; index++) {
out.writeLong(specialCaseCutOverTimes[index]);
String str = (specialCaseOldCurrencies[index] != null)
? specialCaseOldCurrencies[index] : "";
out.writeUTF(str);
str = (specialCaseNewCurrencies[index] != null)
? specialCaseNewCurrencies[index] : "";
out.writeUTF(str);
out.writeInt(specialCaseOldCurrenciesDefaultFractionDigits[index]);
out.writeInt(specialCaseNewCurrenciesDefaultFractionDigits[index]);
out.writeInt(specialCaseOldCurrenciesNumericCode[index]);
out.writeInt(specialCaseNewCurrenciesNumericCode[index]);
}
}

private static void writeStringArray(String[] sa, int count) throws IOException {
for (int i = 0; i < count; i ++) {
String str = (sa[i] != null) ? sa[i] : "";
private static void writeOtherCurrencies() throws IOException {
for (int index = 0; index < otherCurrenciesCount; index++) {
String str = (otherCurrencies[index] != null)
? otherCurrencies[index] : "";
out.writeUTF(str);
out.writeInt(otherCurrenciesDefaultFractionDigits[index]);
out.writeInt(otherCurrenciesNumericCode[index]);
}
}

}
Loading