src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java Tue Oct 15 14:00:04 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java Wed Oct 16 09:57:23 2019 -0400
@@ -87,92 +87,6 @@
}
}
- protected InputStream locateResource(String publicName, String category,
- String defaultName, File customFile,
- boolean verbose, File publicRoot) throws IOException {
- InputStream is = null;
- boolean customFromClasspath = false;
- boolean customFromFile = false;
- if (publicName != null) {
- if (publicRoot != null) {
- File publicResource = new File(publicRoot, publicName);
- if (publicResource.exists() && publicResource.isFile()) {
- is = new FileInputStream(publicResource);
- }
- } else {
- is = getResourceAsStream(publicName);
- }
- customFromClasspath = (is != null);
- }
- if (is == null && customFile != null) {
- is = new FileInputStream(customFile);
- customFromFile = (is != null);
- }
- if (is == null && defaultName != null) {
- is = getResourceAsStream(defaultName);
- }
- if (verbose) {
- String msg = null;
- if (customFromClasspath) {
- msg = MessageFormat.format(I18N.getString(
- "message.using-custom-resource"),
- category == null ? "" : "[" + category + "] ", publicName);
- } else if (customFromFile) {
- msg = MessageFormat.format(I18N.getString(
- "message.using-custom-resource-from-file"),
- category == null ? "" : "[" + category + "] ",
- customFile.getAbsoluteFile());
- } else if (is != null) {
- msg = MessageFormat.format(I18N.getString(
- "message.using-default-resource"),
- defaultName,
- category == null ? "" : "[" + category + "] ",
- publicName);
- } else {
- msg = MessageFormat.format(I18N.getString(
- "message.no-default-resource"),
- defaultName == null ? "" : defaultName,
- category == null ? "" : "[" + category + "] ",
- publicName);
- }
- if (msg != null) {
- Log.verbose(msg);
- }
- }
- return is;
- }
-
-
- protected String preprocessTextResource(String publicName, String category,
- String defaultName, Map<String, String> pairs,
- boolean verbose, File publicRoot) throws IOException {
- InputStream inp = locateResource(publicName, category,
- defaultName, null, verbose, publicRoot);
- if (inp == null) {
- throw new RuntimeException(
- "Module corrupt? No "+defaultName+" resource!");
- }
-
- try (InputStream is = inp) {
- //read fully into memory
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- byte[] buffer = new byte[1024];
- int length;
- while ((length = is.read(buffer)) != -1) {
- baos.write(buffer, 0, length);
- }
-
- //substitute
- String result = new String(baos.toByteArray());
- for (Map.Entry<String, String> e : pairs.entrySet()) {
- if (e.getValue() != null) {
- result = result.replace(e.getKey(), e.getValue());
- }
- }
- return result;
- }
- }
-
public void writeCfgFile(Map<String, ? super Object> params,
File cfgFileName) throws IOException {
cfgFileName.getParentFile().mkdirs();