47
48 while ((line = in.readLine()) != null) {
49 if (line.startsWith(FILEVERSIONKEY)) {
50 fileVersion = line.substring(FILEVERSIONKEY.length());
51 }
52 if (line.startsWith(DATAVERSIONKEY)) {
53 dataVersion = line.substring(DATAVERSIONKEY.length());
54 }
55 if (fileVersion != null && dataVersion != null) {
56 break;
57 }
58 }
59 } catch (IOException ioe) {
60 throw new RuntimeException(ioe);
61 }
62
63 AccessController.doPrivileged(new PrivilegedAction<Object>() {
64 public Object run() {
65 try {
66 String sep = File.separator;
67 DataInputStream dis = new DataInputStream(new FileInputStream(System.getProperty("java.home")+sep+"lib"+sep+"currency.data"));
68 int magic = dis.readInt();
69 if (magic != 0x43757244) {
70 throw new RuntimeException("The magic number in the JRE's currency data is incorrect. Expected: 0x43757244, Got: 0x"+magic);
71 }
72 int fileVerNumber = dis.readInt();
73 int dataVerNumber = dis.readInt();
74 if (Integer.parseInt(fileVersion) != fileVerNumber ||
75 Integer.parseInt(dataVersion) != dataVerNumber) {
76 throw new RuntimeException("Test data and JRE's currency data are inconsistent. test: (file: "+fileVersion+" data: "+dataVersion+"), JRE: (file: "+fileVerNumber+" data: "+dataVerNumber+")");
77 }
78 System.out.println("test: (file: "+fileVersion+" data: "+dataVersion+"), JRE: (file: "+fileVerNumber+" data: "+dataVerNumber+")");
79 } catch (IOException ioe) {
80 throw new RuntimeException(ioe);
81 }
82 return null;
83 }
84 });
85 checked = true;
86 }
87 }
|
47
48 while ((line = in.readLine()) != null) {
49 if (line.startsWith(FILEVERSIONKEY)) {
50 fileVersion = line.substring(FILEVERSIONKEY.length());
51 }
52 if (line.startsWith(DATAVERSIONKEY)) {
53 dataVersion = line.substring(DATAVERSIONKEY.length());
54 }
55 if (fileVersion != null && dataVersion != null) {
56 break;
57 }
58 }
59 } catch (IOException ioe) {
60 throw new RuntimeException(ioe);
61 }
62
63 AccessController.doPrivileged(new PrivilegedAction<Object>() {
64 public Object run() {
65 try {
66 String sep = File.separator;
67 DataInputStream dis = new DataInputStream(
68 new BufferedInputStream(getClass().getResourceAsStream("/java/util/currency.data")));
69 int magic = dis.readInt();
70 if (magic != 0x43757244) {
71 throw new RuntimeException("The magic number in the JRE's currency data is incorrect. Expected: 0x43757244, Got: 0x"+magic);
72 }
73 int fileVerNumber = dis.readInt();
74 int dataVerNumber = dis.readInt();
75 if (Integer.parseInt(fileVersion) != fileVerNumber ||
76 Integer.parseInt(dataVersion) != dataVerNumber) {
77 throw new RuntimeException("Test data and JRE's currency data are inconsistent. test: (file: "+fileVersion+" data: "+dataVersion+"), JRE: (file: "+fileVerNumber+" data: "+dataVerNumber+")");
78 }
79 System.out.println("test: (file: "+fileVersion+" data: "+dataVersion+"), JRE: (file: "+fileVerNumber+" data: "+dataVerNumber+")");
80 } catch (IOException ioe) {
81 throw new RuntimeException(ioe);
82 }
83 return null;
84 }
85 });
86 checked = true;
87 }
88 }
|