--- old/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java 2016-05-19 11:27:35.196629000 +0530 +++ new/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java 2016-05-19 11:27:34.980629000 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -121,7 +121,7 @@ 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]; @@ -318,10 +318,7 @@ 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++; @@ -350,35 +347,41 @@ 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]); } } + }