< prev index next >

test/java/util/Currency/CheckDataVersion.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -26,10 +26,12 @@
  * Check the consistency between the regression tests and the currency data in the JRE
  */
 
 import java.io.*;
 import java.lang.reflect.*;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.security.*;
 import java.util.Currency;
 
 class CheckDataVersion {
     static final String datafile = "tablea1.txt";

@@ -62,13 +64,14 @@
             }
 
             AccessController.doPrivileged(new PrivilegedAction<Object>() {
                 public Object run() {
                     try {
-                        InputStream in = Currency.class.getModule().getResourceAsStream("java/util/currency.data");
-                        String sep = File.separator;
-                        DataInputStream dis = new DataInputStream(in);
+                        DataInputStream dis = new DataInputStream(
+                                new BufferedInputStream(Files.newInputStream(
+                                        Paths.get(System.getProperty("java.home"),
+                                                "lib", "currency.data"))));
                         int magic = dis.readInt();
                         if (magic != 0x43757244) {
                             throw new RuntimeException("The magic number in the JRE's currency data is incorrect.  Expected: 0x43757244, Got: 0x"+magic);
                         }
                         int fileVerNumber = dis.readInt();
< prev index next >