< prev index next >
src/java.base/share/classes/java/util/Currency.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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. Oracle designates this
@@ -31,10 +31,12 @@
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.InputStream;
import java.io.IOException;
import java.io.Serializable;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.concurrent.ConcurrentHashMap;
@@ -199,15 +201,14 @@
static {
AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public Void run() {
try {
- try (InputStream in = getClass().getResourceAsStream("/java/util/currency.data")) {
- if (in == null) {
- throw new InternalError("Currency data not found");
- }
- DataInputStream dis = new DataInputStream(new BufferedInputStream(in));
+ try (DataInputStream dis = new DataInputStream(
+ new BufferedInputStream(Files.newInputStream(Paths
+ .get(System.getProperty("java.home"),
+ "lib", "currency.data"))))) {
if (dis.readInt() != MAGIC_NUMBER) {
throw new InternalError("Currency data is possibly corrupted");
}
formatVersion = dis.readInt();
if (formatVersion != VALID_FORMAT_VERSION) {
< prev index next >