jdk/test/java/util/Currency/CheckDataVersion.java
changeset 36511 9d0388c6b336
parent 25174 f861c3fec754
equal deleted inserted replaced
36510:043f1af70518 36511:9d0388c6b336
    27  */
    27  */
    28 
    28 
    29 import java.io.*;
    29 import java.io.*;
    30 import java.lang.reflect.*;
    30 import java.lang.reflect.*;
    31 import java.security.*;
    31 import java.security.*;
       
    32 import java.util.Currency;
    32 
    33 
    33 class CheckDataVersion {
    34 class CheckDataVersion {
    34     static final String datafile = "tablea1.txt";
    35     static final String datafile = "tablea1.txt";
    35     static final String FILEVERSIONKEY = "FILEVERSION=";
    36     static final String FILEVERSIONKEY = "FILEVERSION=";
    36     static final String DATAVERSIONKEY = "DATAVERSION=";
    37     static final String DATAVERSIONKEY = "DATAVERSION=";
    61             }
    62             }
    62 
    63 
    63             AccessController.doPrivileged(new PrivilegedAction<Object>() {
    64             AccessController.doPrivileged(new PrivilegedAction<Object>() {
    64                 public Object run() {
    65                 public Object run() {
    65                     try {
    66                     try {
       
    67                         InputStream in = Currency.class.getModule().getResourceAsStream("java/util/currency.data");
    66                         String sep = File.separator;
    68                         String sep = File.separator;
    67                         DataInputStream dis = new DataInputStream(
    69                         DataInputStream dis = new DataInputStream(in);
    68                              new BufferedInputStream(getClass().getResourceAsStream("/java/util/currency.data")));
       
    69                         int magic = dis.readInt();
    70                         int magic = dis.readInt();
    70                         if (magic != 0x43757244) {
    71                         if (magic != 0x43757244) {
    71                             throw new RuntimeException("The magic number in the JRE's currency data is incorrect.  Expected: 0x43757244, Got: 0x"+magic);
    72                             throw new RuntimeException("The magic number in the JRE's currency data is incorrect.  Expected: 0x43757244, Got: 0x"+magic);
    72                         }
    73                         }
    73                         int fileVerNumber = dis.readInt();
    74                         int fileVerNumber = dis.readInt();