make/jdk/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java
branchJDK-8215445-branch
changeset 57083 947cfcf92dbe
parent 57074 12615de8335e
equal deleted inserted replaced
57082:dc3a6c647672 57083:947cfcf92dbe
   134     private static String[] currenciesWithDefinedMinorUnitDecimals =
   134     private static String[] currenciesWithDefinedMinorUnitDecimals =
   135         new String[SIMPLE_CASE_COUNTRY_MAX_DEFAULT_DIGITS + 1];
   135         new String[SIMPLE_CASE_COUNTRY_MAX_DEFAULT_DIGITS + 1];
   136     private static String currenciesWithMinorUnitsUndefined;
   136     private static String currenciesWithMinorUnitsUndefined;
   137 
   137 
   138     public static void main(String[] args) {
   138     public static void main(String[] args) {
   139 	    InputStream in = System.in;
   139         InputStream in = System.in;
   140         // Look for "-o outputfilename" option
   140         // Look for "-o outputfilename" option
   141         for (int n = 0; n < args.length; ++n) {
   141         for (int n = 0; n < args.length; ++n) {
   142             if (args[n].equals("-o")) {
   142             if (args[n].equals("-o")) {
   143 				++n;
   143                 ++n;
   144 				if (n >= args.length) {
   144                 if (n >= args.length) {
   145 					System.err.println("Error: Invalid argument format");
   145                     System.err.println("Error: Invalid argument format");
   146 					System.exit(1);
   146                     System.exit(1);
   147 				}
   147                 }
   148 				try {
   148                 try {
   149 					out = new DataOutputStream(new FileOutputStream(args[n]));
   149                     out = new DataOutputStream(new FileOutputStream(args[n]));
   150 				} catch ( FileNotFoundException e ) {
   150                 } catch ( FileNotFoundException e ) {
   151 					System.err.println("Error: " + e.getMessage());
   151                     System.err.println("Error: " + e.getMessage());
   152 					e.printStackTrace(System.err);
   152                     e.printStackTrace(System.err);
   153 					System.exit(1);
   153                     System.exit(1);
   154 				}
   154                 }
   155 			} else if (args[n].equals("-i")) {
   155             } else if (args[n].equals("-i")) {
   156 				++n;
   156                 ++n;
   157 				if (n >= args.length) {
   157                 if (n >= args.length) {
   158 					System.err.println("Error: Invalid argument format");
   158                     System.err.println("Error: Invalid argument format");
   159 					System.exit(1);
   159                     System.exit(1);
   160 				}
   160                 }
   161 				try {
   161                 try {
   162 					in = new FileInputStream(args[n]);
   162                     in = new FileInputStream(args[n]);
   163 				} catch ( FileNotFoundException e ) {
   163                 } catch ( FileNotFoundException e ) {
   164 					System.err.println("Error: " + e.getMessage());
   164                     System.err.println("Error: " + e.getMessage());
   165 					e.printStackTrace(System.err);
   165                     e.printStackTrace(System.err);
   166 					System.exit(1);
   166                     System.exit(1);
   167 				}
   167                 }
   168 			} else {
   168             } else {
   169 				System.err.println("Error: Invalid argument " + args[n]);
   169                 System.err.println("Error: Invalid argument " + args[n]);
   170 				System.exit(1);
   170                 System.exit(1);
   171 			}
   171             }
   172         }
   172         }
   173 
   173 
   174         if (out == null) {
   174         if (out == null) {
   175 			System.err.println("Error: Invalid argument format");
   175             System.err.println("Error: Invalid argument format");
   176 			System.exit(1);
   176             System.exit(1);
   177         }
   177         }
   178 
   178 
   179         format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.US);
   179         format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.US);
   180         format.setTimeZone(TimeZone.getTimeZone("GMT"));
   180         format.setTimeZone(TimeZone.getTimeZone("GMT"));
   181         format.setLenient(false);
   181         format.setLenient(false);