8212143: Remove native code that supports UserJvmOptionsService
Submitten-by: almatvee
Reviewed-by: herrick
--- a/src/jdk.packager/macosx/classes/jdk/packager/internal/mac/MacBaseInstallerBundler.java Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/macosx/classes/jdk/packager/internal/mac/MacBaseInstallerBundler.java Fri Oct 19 19:33:35 2018 -0400
@@ -87,20 +87,6 @@
},
(s, p) -> new File(s));
- public final BundlerParamInfo<File> DAEMON_IMAGE_BUILD_ROOT =
- new StandardBundlerParam<>(
- I18N.getString("param.daemon-image-build-root.name"),
- I18N.getString("param.daemon-image-build-root.description"),
- "mac.daemon.image",
- File.class,
- params -> {
- File imageDir = IMAGES_ROOT.fetchFrom(params);
- if (!imageDir.exists()) imageDir.mkdirs();
- return new File(imageDir, getID()+ ".daemon");
- },
- (s, p) -> new File(s));
-
-
public static final BundlerParamInfo<File> CONFIG_ROOT =
new StandardBundlerParam<>(
I18N.getString("param.config-root.name"),
--- a/src/jdk.packager/macosx/native/library/MacPlatform.mm Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/macosx/native/library/MacPlatform.mm Fri Oct 19 19:33:35 2018 -0400
@@ -288,10 +288,6 @@
AppendPListArrayToIniFile(infoDictionary, result,
keys[CONFIG_SECTION_JVMOPTIONS]);
- // jvmuserargs
- AppendPListDictionaryToIniFile(infoDictionary, result,
- keys[CONFIG_SECTION_JVMUSEROPTIONS]);
-
// Generate AppCDS Cache
AppendPListDictionaryToIniFile(infoDictionary, result,
keys[CONFIG_SECTION_APPCDSJVMOPTIONS]);
@@ -386,11 +382,6 @@
keys.insert(std::map<TString, TString>::value_type(
CONFIG_SECTION_JVMOPTIONS, _T("JVMOptions")));
keys.insert(std::map<TString, TString>::value_type(
- CONFIG_SECTION_JVMUSEROPTIONS, _T("JVMUserOptions")));
- keys.insert(std::map<TString, TString>::value_type(
- CONFIG_SECTION_JVMUSEROVERRIDESOPTIONS,
- _T("JVMUserOverrideOptions")));
- keys.insert(std::map<TString, TString>::value_type(
CONFIG_SECTION_APPCDSJVMOPTIONS, _T("AppCDSJVMOptions")));
keys.insert(std::map<TString, TString>::value_type(
CONFIG_SECTION_APPCDSGENERATECACHEJVMOPTIONS,
@@ -428,239 +419,4 @@
}
#endif //DEBUG
-class UserDefaults {
-private:
- OrderedMap<TString, TString> FData;
- TString FDomainName;
-
- bool ReadDictionary(NSDictionary *Items, OrderedMap<TString,
- TString> &Data) {
- bool result = false;
-
- for (id key in Items) {
- id option = [Items valueForKey:key];
-
- if ([key isKindOfClass:[NSString class]] &&
- [option isKindOfClass:[NSString class]]) {
- TString name = [key UTF8String];
- TString value = [option UTF8String];
-
- if (name.empty() == false) {
- Data.Append(name, value);
- }
- }
- }
-
- return result;
- }
-
- // Open and read the defaults file specified by domain.
- bool ReadPreferences(NSDictionary *Defaults, std::list<TString> Keys,
- OrderedMap<TString, TString> &Data) {
- bool result = false;
-
- if (Keys.size() > 0 && Defaults != NULL) {
- NSDictionary *node = Defaults;
-
- while (Keys.size() > 0 && node != NULL) {
- TString key = Keys.front();
- Keys.pop_front();
- NSString *tempKey = StringToNSString(key);
- node = [node valueForKey:tempKey];
-
- if (Keys.size() == 0) {
- break;
- }
- }
-
- if (node != NULL) {
- result = ReadDictionary(node, Data);
- }
- }
-
- return result;
- }
-
- NSDictionary* LoadPreferences(TString DomainName) {
- NSDictionary *result = NULL;
-
- if (DomainName.empty() == false) {
- NSUserDefaults *prefs = [[NSUserDefaults alloc] init];
-
- if (prefs != NULL) {
- NSString *lDomainName = StringToNSString(DomainName);
- result = [prefs persistentDomainForName: lDomainName];
- }
- }
-
- return result;
- }
-
-public:
- UserDefaults(TString DomainName) {
- FDomainName = DomainName;
- }
-
- bool Read(std::list<TString> Keys) {
- NSDictionary *defaults = LoadPreferences(FDomainName);
- return ReadPreferences(defaults, Keys, FData);
- }
-
- OrderedMap<TString, TString> GetData() {
- return FData;
- }
-};
-
-MacJavaUserPreferences::MacJavaUserPreferences(void) : JavaUserPreferences() {
-}
-
-TString toLowerCase(TString Value) {
- // Use Cocoa's lowercase method because it is better than
- // the ones provided by C/C++.
- NSString *temp = StringToNSString(Value);
- temp = [temp lowercaseString];
- TString result = [temp UTF8String];
- return result;
-}
-
-// Split the string Value into using Delimiter.
-std::list<TString> Split(TString Value, TString Delimiter) {
- std::list<TString> result;
- std::vector<char> buffer(Value.c_str(), Value.c_str() + Value.size() + 1);
- char *p = strtok(&buffer[0], Delimiter.data());
-
- while (p != NULL) {
- TString token = p;
- result.push_back(token);
- p = strtok(NULL, Delimiter.data());
- }
-
- return result;
-}
-
-// 1. If the path is fewer than three components (Example: one/two/three)
-// then the domain is the
-// default domain "com.apple.java.util.prefs" stored in the plist file
-// ~/Library/Preferences/com.apple.java.util.prefs.plist
-//
-// For example: If AppID = "hello", the path is "hello/JVMUserOptions and the
-// plist file is ~/Library/Preferences/com.apple.java.util.prefs.plist
-// containing the contents:
-//
-// <?xml version="1.0" encoding="UTF-8"?>
-// <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
-// "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-// <plist version="1.0">
-// <dict>
-// <key>/</key>
-// <dict>
-// <key>hello/</key>
-// <dict>
-// <key>JVMUserOptions/</key>
-// <dict>
-// <key>-DXmx</key>
-// <string>512m</string>
-// </dict>
-// </dict>
-// </dict>
-// </dict>
-// </plist>
-//
-// 2. If the path is three or more, the first three become the domain name (even
-// if shared across applicaitons) and the remaining become individual keys.
-//
-// For example: If AppID = "com/hello/foo", the path is
-// "hello/JVMUserOptions and the
-// domain is "com.hello.foo" stored in the plist file
-// ~/Library/Preferences/com.hello.foo.plist
-// containing the contents:
-//
-// <?xml version="1.0" encoding="UTF-8"?>
-// <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
-// "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-// <plist version="1.0">
-// <dict>
-// <key>/com/hello/foo/</key>
-// <dict>
-// <key>JVMUserOptions/</key>
-// <dict>
-// <key>-DXmx</key>
-// <string>512m</string>
-// </dict>
-// </dict>
-// </dict>
-// </plist>
-//
-// NOTE: To change these values use the command line utility "defaults":
-// Example: defaults read com.apple.java.util.prefs /
-// Since OS 10.9 Mavericks the defaults are cashed so directly modifying
-// the files is not recommended.
-bool MacJavaUserPreferences::Load(TString Appid) {
- bool result = false;
-
- if (Appid.empty() == false) {
- // This is for backwards compatability.
- // Older packaged applications have an
- // app.preferences.id that is delimited by period (".") rather than
- // slash ("/") so convert to newer style.
- TString path = Helpers::ReplaceString(Appid, _T("."), _T("/"));
-
- path = path + _T("/JVMUserOptions");
- TString domainName;
- std::list<TString> keys = Split(path, _T("/"));
-
- // If there are less than three parts to the path then use
- // the default preferences file.
- if (keys.size() < 3) {
- domainName = _T("com.apple.java.util.prefs");
-
- // Append slash to the end of each key.
- for (std::list<TString>::iterator iterator = keys.begin();
- iterator != keys.end(); iterator++) {
- TString item = *iterator;
- item = item + _T("/");
- *iterator = item;
- }
-
- // The root key is /.
- keys.push_front(_T("/"));
- }
- else {
- // Remove the first three keys and use them for the
- // root key and the preferencesID.
- TString one = keys.front();
- keys.pop_front();
- TString two = keys.front();
- keys.pop_front();
- TString three = keys.front();
- keys.pop_front();
- domainName = one + TString(".") + two + TString(".") + three;
- domainName = toLowerCase(domainName);
-
- // Append slash to the end of each key.
- for (std::list<TString>::iterator iterator = keys.begin();
- iterator != keys.end(); iterator++) {
- TString item = *iterator;
- item = item + _T("/");
- *iterator = item;
- }
-
- // The root key is /one/two/three/
- TString key = TString("/") + one + TString("/") + two
- + TString("/") + three + TString("/");
- keys.push_front(key);
- }
-
- UserDefaults userDefaults(domainName);
-
- if (userDefaults.Read(keys) == true) {
- result = true;
- FMap = userDefaults.GetData();
- }
- }
-
- return result;
-}
-
-
#endif //MAC
--- a/src/jdk.packager/share/native/library/common/Exports.cpp Fri Oct 19 19:29:20 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,251 +0,0 @@
-/*
- * Copyright (c) 2014, 2018, 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
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "Platform.h"
-#include "Package.h"
-#include "PlatformString.h"
-#include "PropertyFile.h"
-#include "Lock.h"
-#include "JavaTypes.h"
-
-#include "jni.h"
-
-
-class UserJVMArgsExports {
-private:
- // This is not a class to create an instance of.
- UserJVMArgsExports();
-
- static jobjectArray MapKeysToJObjectArray(JNIEnv *env, OrderedMap<TString, TString> map) {
- std::vector<TString> keys = map.GetKeys();
- JavaStringArray result(env, keys.size());
-
- for (unsigned int index = 0; index < keys.size(); index++) {
- PlatformString value(keys[index]);
- try {
- result.SetValue(index, value.toJString(env));
- }
- catch (const JavaException&) {}
- }
- return result.GetData();
- }
-
-public:
- static jstring _getUserJvmOptionDefaultValue(JNIEnv *env, jstring option) {
- if (env == NULL || option == NULL)
- return NULL;
-
- jstring result = NULL;
-
- Package& package = Package::GetInstance();
- OrderedMap<TString, TString> defaultuserargs =
- package.GetDefaultJVMUserArgs();
- TString loption = PlatformString(env, option).toString();
-
- TString temp;
- defaultuserargs.GetValue(loption, temp);
- PlatformString value = temp;
- try {
- result = value.toJString(env);
- }
- catch (const JavaException&) {
- }
-
- return result;
- }
-
- static jobjectArray _getUserJvmOptionDefaultKeys(JNIEnv *env) {
- if (env == NULL)
- return NULL;
-
- jobjectArray result = NULL;
-
- Package& package = Package::GetInstance();
-
- try {
- result = MapKeysToJObjectArray(
- env, package.GetDefaultJVMUserArgs());
- }
- catch (const JavaException&) {
- }
-
- return result;
- }
-
- static jstring _getUserJvmOptionValue(JNIEnv *env, jstring option) {
- if (env == NULL || option == NULL)
- return NULL;
-
- jstring result = NULL;
-
- Package& package = Package::GetInstance();
- OrderedMap<TString, TString> userargs = package.GetJVMUserArgs();
-
- try {
- TString loption = PlatformString(env, option).toString();
- TString temp;
- userargs.GetValue(loption, temp);
- PlatformString value = temp;
- result = value.toJString(env);
- }
- catch (const JavaException&) {
- }
-
- return result;
- }
-
- static void _setUserJvmKeysAndValues(
- JNIEnv *env, jobjectArray options, jobjectArray values) {
- if (env == NULL || options == NULL || values == NULL)
- return;
-
- Package& package = Package::GetInstance();
- OrderedMap<TString, TString> newMap;
-
- try {
- JavaStringArray loptions(env, options);
- JavaStringArray lvalues(env, values);
-
- for (unsigned int index = 0; index < loptions.Count(); index++) {
- TString name = PlatformString(
- env, loptions.GetValue(index)).toString();
- TString value = PlatformString(
- env, lvalues.GetValue(index)).toString();
- newMap.Append(name, value);
- }
- }
- catch (const JavaException&) {
- return;
- }
-
- package.SetJVMUserArgOverrides(newMap);
- }
-
- static jobjectArray _getUserJvmOptionKeys(JNIEnv *env) {
- if (env == NULL)
- return NULL;
-
- jobjectArray result = NULL;
-
- Package& package = Package::GetInstance();
-
- try {
- result = MapKeysToJObjectArray(env, package.GetJVMUserArgs());
- }
- catch (const JavaException&) {
- }
-
- return result;
- }
-};
-
-
-extern "C" {
- JNIEXPORT jstring JNICALL
- Java_jdk_packager_services_userjvmoptions_LauncherUserJvmOptions__1getUserJvmOptionDefaultValue(
- JNIEnv *env, jclass klass, jstring option) {
- return UserJVMArgsExports::_getUserJvmOptionDefaultValue(env, option);
- }
-
- JNIEXPORT jobjectArray JNICALL
- Java_jdk_packager_services_userjvmoptions_LauncherUserJvmOptions__1getUserJvmOptionDefaultKeys(
- JNIEnv *env, jclass klass) {
- return UserJVMArgsExports::_getUserJvmOptionDefaultKeys(env);
- }
-
- JNIEXPORT jstring JNICALL
- Java_jdk_packager_services_userjvmoptions_LauncherUserJvmOptions__1getUserJvmOptionValue(
- JNIEnv *env, jclass klass, jstring option) {
- return UserJVMArgsExports::_getUserJvmOptionValue(env, option);
- }
-
- JNIEXPORT void JNICALL
- Java_jdk_packager_services_userjvmoptions_LauncherUserJvmOptions__1setUserJvmKeysAndValues(
- JNIEnv *env, jclass klass, jobjectArray options,
- jobjectArray values) {
- UserJVMArgsExports::_setUserJvmKeysAndValues(env, options, values);
- }
-
- JNIEXPORT jobjectArray JNICALL
- Java_jdk_packager_services_userjvmoptions_LauncherUserJvmOptions__1getUserJvmOptionKeys(
- JNIEnv *env, jclass klass) {
- return UserJVMArgsExports::_getUserJvmOptionKeys(env);
- }
-}
-
-#ifdef DEBUG
-// Build with debug info. Create a class:
-//
-// package com;
-//
-// class DebugExports {
-// static {
-// System.loadLibrary("packager");
-// }
-//
-// public static native boolean isdebugged();
-//
-// public static native int getpid();
-// }
-//
-// Use the following in Java in the main or somewhere else:
-//
-// import com.DebugExports;
-// import java.util.Arrays;
-//
-// if (Arrays.asList(args).contains("-debug")) {
-// System.out.println("pid=" + getpid());
-//
-// while (true) {
-// if (isdebugged() == true) {
-// break;
-// }
-// }
-// }
-//
-// The call to isdebugger() will wait until a native debugger is attached.
-// The process identifier (pid) will be printed to the console
-// for you to attach your debugger to.
-extern "C" {
- JNIEXPORT jboolean JNICALL Java_com_DebugExports_isdebugged(
- JNIEnv *env, jclass klass) {
- jboolean result = false;
- Package& package = Package::GetInstance();
-
- if (package.Debugging() == dsNative) {
- Platform& platform = Platform::GetInstance();
- result = platform.GetDebugState() != dsNone;
- }
-
- return result;
- }
-
- JNIEXPORT jint JNICALL Java_com_DebugExports_getpid(
- JNIEnv *env, jclass klass) {
- Platform& platform = Platform::GetInstance();
- return platform.GetProcessID();
- }
-}
-#endif //DEBUG
--- a/src/jdk.packager/share/native/library/common/Exports.h Fri Oct 19 19:29:20 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2014, 2018, 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
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class jdk_packager_services_userjvmoptions_LauncherUserJvmOptions */
-
-#ifndef _Included_jdk_packager_services_userjvmoptions_LauncherUserJvmOptions
-#define _Included_jdk_packager_services_userjvmoptions_LauncherUserJvmOptions
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: jdk_packager_services_userjvmoptions_LauncherUserJvmOptions
- * Method: _getUserJvmOptionDefaultValue
- * Signature: (Ljava/lang/String;)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
- Java_jdk_packager_services_userjvmoptions_LauncherUserJvmOptions__1getUserJvmOptionDefaultValue(
- JNIEnv *, jclass, jstring);
-
-/*
- * Class: jdk_packager_services_userjvmoptions_LauncherUserJvmOptions
- * Method: _getUserJvmOptionDefaultKeys
- * Signature: ()[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL
- Java_jdk_packager_services_userjvmoptions_LauncherUserJvmOptions__1getUserJvmOptionDefaultKeys(
- JNIEnv *, jclass);
-
-/*
- * Class: jdk_packager_services_userjvmoptions_LauncherUserJvmOptions
- * Method: _getUserJvmOptionValue
- * Signature: (Ljava/lang/String;)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
- Java_jdk_packager_services_userjvmoptions_LauncherUserJvmOptions__1getUserJvmOptionValue(
- JNIEnv *, jclass, jstring);
-
-/*
- * Class: jdk_packager_services_userjvmoptions_LauncherUserJvmOptions
- * Method: _setUserJvmKeysAndValues
- * Signature: ([Ljava/lang/String;[Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL
- Java_jdk_packager_services_userjvmoptions_LauncherUserJvmOptions__1setUserJvmKeysAndValues(
- JNIEnv *, jclass, jobjectArray, jobjectArray);
-
-/*
- * Class: jdk_packager_services_userjvmoptions_LauncherUserJvmOptions
- * Method: _getUserJvmOptionKeys
- * Signature: ()[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL
- Java_jdk_packager_services_userjvmoptions_LauncherUserJvmOptions__1getUserJvmOptionKeys(
- JNIEnv *, jclass);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/src/jdk.packager/share/native/library/common/GenericPlatform.cpp Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/GenericPlatform.cpp Fri Oct 19 19:33:35 2018 -0400
@@ -210,12 +210,6 @@
TString>::value_type(CONFIG_SECTION_JVMOPTIONS,
_T("JVMOptions")));
keys.insert(std::map<TString,
- TString>::value_type(CONFIG_SECTION_JVMUSEROPTIONS,
- _T("JVMUserOptions")));
- keys.insert(std::map<TString,
- TString>::value_type(CONFIG_SECTION_JVMUSEROVERRIDESOPTIONS,
- _T("JVMUserOverrideOptions")));
- keys.insert(std::map<TString,
TString>::value_type(CONFIG_SECTION_APPCDSJVMOPTIONS,
_T("AppCDSJVMOptions")));
keys.insert(std::map<TString,
--- a/src/jdk.packager/share/native/library/common/Helpers.cpp Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/Helpers.cpp Fri Oct 19 19:33:35 2018 -0400
@@ -148,30 +148,6 @@
return result;
}
-OrderedMap<TString, TString>
- Helpers::GetJVMUserArgsFromConfig(IPropertyContainer* config) {
- OrderedMap<TString, TString> result;
-
- for (unsigned int index = 0; index < config->GetCount(); index++) {
- TString prefix = TString(_T("jvmuserarg."))
- + PlatformString(index + 1).toString();
- TString argname = prefix + _T(".name");
- TString argvalue = prefix + _T(".value");
- TString name;
- TString value;
-
- if ((config->GetValue(argname, name) == false) ||
- (config->GetValue(argvalue, value) == false)) {
- break;
- }
- else if ((name.empty() == false) && (value.empty() == false)) {
- result.Append(name, value);
- }
- }
-
- return result;
-}
-
std::list<TString> Helpers::GetArgsFromConfig(IPropertyContainer* config) {
std::list<TString> result;
@@ -227,12 +203,6 @@
Helpers::GetJVMArgsFromConfig(&propertyFile);
Container->AppendSection(keys[CONFIG_SECTION_JVMOPTIONS], JVMArgs);
- // JVMUserOptions Section
- OrderedMap<TString, TString> defaultJVMUserArgs =
- Helpers::GetJVMUserArgsFromConfig(&propertyFile);
- Container->AppendSection(keys[CONFIG_SECTION_JVMUSEROPTIONS],
- defaultJVMUserArgs);
-
// ArgOptions Section
std::list<TString> args = Helpers::GetArgsFromConfig(&propertyFile);
OrderedMap<TString, TString> convertedArgs;
--- a/src/jdk.packager/share/native/library/common/Helpers.h Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/Helpers.h Fri Oct 19 19:33:35 2018 -0400
@@ -53,8 +53,6 @@
static OrderedMap<TString, TString>
GetJVMArgsFromConfig(IPropertyContainer* config);
- static OrderedMap<TString, TString>
- GetJVMUserArgsFromConfig(IPropertyContainer* config);
static std::list<TString> GetArgsFromConfig(IPropertyContainer* config);
static void LoadOldConfigFile(TString FileName, IniFile* Container);
--- a/src/jdk.packager/share/native/library/common/JavaUserPreferences.cpp Fri Oct 19 19:29:20 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2014, 2018, 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
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "JavaUserPreferences.h"
-#include "Lock.h"
-
-#include "WindowsPlatform.h"
-#include "LinuxPlatform.h"
-#include "MacPlatform.h"
-
-
-JavaUserPreferences::JavaUserPreferences(void) {
-}
-
-JavaUserPreferences* JavaUserPreferences::CreateInstance(void) {
- JavaUserPreferences* result;
-#ifdef WINDOWS
- result = new WindowsJavaUserPreferences();
-#endif // WINDOWS
-#ifdef LINUX
- result = new LinuxJavaUserPreferences();
-#endif // LINUX
-#ifdef MAC
- result = new MacJavaUserPreferences();
-#endif // MAC
- return result;
-}
-
-JavaUserPreferences::~JavaUserPreferences(void){
-}
-
-OrderedMap<TString, TString> JavaUserPreferences::GetData() {
- return FMap;
-}
--- a/src/jdk.packager/share/native/library/common/JavaUserPreferences.h Fri Oct 19 19:29:20 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2014, 2018, 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
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef JAVAUSERPREFERENCES_H
-#define JAVAUSERPREFERENCES_H
-
-
-#include "Helpers.h"
-
-#include <map>
-
-
-class JavaUserPreferences {
-protected:
- TString FAppid;
- OrderedMap<TString, TString> FMap;
-
-public:
- static JavaUserPreferences* CreateInstance(void);
- JavaUserPreferences(void);
- virtual ~JavaUserPreferences(void);
-
- OrderedMap<TString, TString> GetData();
-
-public:
- virtual bool Load(TString Appid) = 0;
-};
-
-#endif //JAVAUSERPREFERENCES_H
--- a/src/jdk.packager/share/native/library/common/JavaVirtualMachine.cpp Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/JavaVirtualMachine.cpp Fri Oct 19 19:33:35 2018 -0400
@@ -174,46 +174,6 @@
return FItems.size();
}
-// jvmuserargs can have a trailing equals in the key. This needs to be
-// removed to use other parts of the launcher.
-OrderedMap<TString, TString> RemoveTrailingEquals(
- OrderedMap<TString, TString> Map) {
- OrderedMap<TString, TString> result;
-
- std::vector<TString> keys = Map.GetKeys();
-
- for (size_t index = 0; index < keys.size(); index++) {
- TString name = keys[index];
- TString value;
-
- if (Map.GetValue(name, value) == true) {
- // If the last character of the key is an equals, then remove it.
- // If there is no equals then combine the two as a key.
- TString::iterator i = name.end();
- i--;
-
- if (*i == '=') {
- name = name.substr(0, name.size() - 1);
- }
- else {
- i = value.begin();
-
- if (*i == '=') {
- value = value.substr(1, value.size() - 1);
- }
- else {
- name = name + value;
- value = _T("");
- }
- }
-
- result.Append(name, value);
- }
- }
-
- return result;
-}
-
//----------------------------------------------------------------------------
JavaVirtualMachine::JavaVirtualMachine() {
@@ -241,7 +201,6 @@
_T("-Djava.launcher.path"), package.GetPackageLauncherDirectory());
options.AppendValue(_T("-Dapp.preferences.id"), package.GetAppID());
options.AppendValues(package.GetJVMArgs());
- options.AppendValues(RemoveTrailingEquals(package.GetJVMUserArgs()));
#ifdef DEBUG
if (package.Debugging() == dsJava) {
--- a/src/jdk.packager/share/native/library/common/LinuxPlatform.cpp Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/LinuxPlatform.cpp Fri Oct 19 19:33:35 2018 -0400
@@ -30,7 +30,8 @@
#include "JavaVirtualMachine.h"
#include "LinuxPlatform.h"
#include "PlatformString.h"
-
+#include "IniFile.h"
+#include "Helpers.h"
#include <stdlib.h>
#include <pwd.h>
@@ -1017,94 +1018,6 @@
return (PACKAGER_STRNCMP(CDStart, p, size) == 0);
}
-//----------------------------------------------------------------------------
-
-LinuxJavaUserPreferences::LinuxJavaUserPreferences(void) :
- JavaUserPreferences() {
-}
-
-LinuxJavaUserPreferences::~LinuxJavaUserPreferences(void) {
-}
-
-TString LinuxJavaUserPreferences::GetUserPrefFileName(TString Appid) {
- TString result;
- struct passwd *pw = getpwuid(getuid());
- TString homedir = pw->pw_dir;
- TString userOverrideFileName = FilePath::IncludeTrailingSeparator(homedir)
- + FilePath::IncludeTrailingSeparator(_T(".java/.userPrefs"))
- + FilePath::IncludeTrailingSeparator(Appid)
- + _T("JVMUserOptions/prefs.xml");
-
- if (FilePath::FileExists(userOverrideFileName) == true) {
- result = userOverrideFileName;
- }
-
- return result;
-}
-
-OrderedMap<TString, TString> ReadNode(XMLNode* node) {
- OrderedMap<TString, TString> result;
- XMLNode* keyNode = FindXMLChild(node->_sub, _T("entry"));
-
- while (keyNode != NULL) {
- TString key = FindXMLAttribute(keyNode->_attributes, _T("key"));
- TString value = FindXMLAttribute(keyNode->_attributes, _T("value"));
- keyNode = keyNode->_next;
-
- if (key.empty() == false) {
- result.Append(key, value);
- }
- }
-
- return result;
-}
-
-OrderedMap<TString, TString> GetJvmUserArgs(TString filename) {
- OrderedMap<TString, TString> result;
- DynamicBuffer<char> buffer(fsize + 1);
- if (buffer.GetData() == NULL) {
- return result;
- }
-
- if (FilePath::FileExists(filename) == true) {
- //scan file for the key
- FILE* fp = fopen(PlatformString(filename).toPlatformString(), "r");
- if (fp != NULL) {
- fseek(fp, 0, SEEK_END);
- long fsize = ftell(fp);
- rewind(fp);
- fread(buffer.GetData(), fsize, 1, fp);
- fclose(fp);
- buffer[fsize] = 0;
-
- XMLNode* node = NULL;
- XMLNode* doc = ParseXMLDocument(buffer.GetData());
-
- if (doc != NULL) {
- node = FindXMLChild(doc, _T("map"));
-
- if (node != NULL) {
- result = ReadNode(node);
- }
- }
- }
- }
-
- return result;
-}
-
-bool LinuxJavaUserPreferences::Load(TString Appid) {
- bool result = false;
- TString filename = GetUserPrefFileName(Appid);
-
- if (FilePath::FileExists(filename) == true) {
- FMap = GetJvmUserArgs(filename);
- result = true;
- }
-
- return result;
-}
-
namespace {
template<class funcType>
class DllFunction {
--- a/src/jdk.packager/share/native/library/common/LinuxPlatform.h Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/LinuxPlatform.h Fri Oct 19 19:33:35 2018 -0400
@@ -32,7 +32,6 @@
#include "PosixPlatform.h"
#include "GenericPlatform.h"
-#include "JavaUserPreferences.h"
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <pthread.h>
@@ -79,18 +78,6 @@
#endif //DEBUG
};
-
-class LinuxJavaUserPreferences : public JavaUserPreferences {
-private:
- TString GetUserPrefFileName(TString Appid);
-
-public:
- LinuxJavaUserPreferences(void);
- ~LinuxJavaUserPreferences(void);
-
- virtual bool Load(TString Appid);
-};
-
class ProcessReactivator {
private:
void searchWindowHelper(Window w);
--- a/src/jdk.packager/share/native/library/common/MacPlatform.h Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/MacPlatform.h Fri Oct 19 19:33:35 2018 -0400
@@ -32,7 +32,6 @@
#include "GenericPlatform.h"
#include "PosixPlatform.h"
-#include "JavaUserPreferences.h"
class MacPlatform : virtual public Platform, GenericPlatform, PosixPlatform {
@@ -77,13 +76,6 @@
};
-class MacJavaUserPreferences : public JavaUserPreferences {
-public:
- MacJavaUserPreferences(void);
-
- virtual bool Load(TString Appid);
-};
-
#endif // MACPLATFORM_H
#endif // MAC
--- a/src/jdk.packager/share/native/library/common/Package.cpp Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/Package.cpp Fri Oct 19 19:33:35 2018 -0400
@@ -26,7 +26,6 @@
#include "Package.h"
#include "Lock.h"
#include "Helpers.h"
-#include "JavaUserPreferences.h"
#include "Macros.h"
#include "IniFile.h"
@@ -178,36 +177,6 @@
}
}
- // Read jvmuserarg defaults.
- config->GetSection(keys[CONFIG_SECTION_JVMUSEROPTIONS],
- FDefaultJVMUserArgs);
-
- // Load JVM user overrides.
- TString jvmUserArgsConfigFileName = GetJVMUserArgsConfigFileName();
-
- if (FilePath::FileExists(jvmUserArgsConfigFileName) == true) {
- // Load new location for user VM overrides.
- IniFile userConfig;
-
- if (userConfig.LoadFromFile(jvmUserArgsConfigFileName) == false) {
- // New property file format was not found,
- // attempt to load old property file format.
- userConfig.GetSection(keys[CONFIG_SECTION_JVMUSEROVERRIDESOPTIONS],
- FJVMUserArgsOverrides);
- }
-
- userConfig.GetSection(keys[CONFIG_SECTION_JVMUSEROVERRIDESOPTIONS],
- FJVMUserArgsOverrides);
- } else {
- // Attemp to load java.util.prefs for legacy JVM user overrides.
- AutoFreePtr<JavaUserPreferences> javaPreferences(
- JavaUserPreferences::CreateInstance());
-
- if (javaPreferences->Load(GetAppID()) == true) {
- FJVMUserArgsOverrides = javaPreferences->GetData();
- }
- }
-
// Auto Memory.
TString autoMemory;
@@ -240,15 +209,10 @@
keys[CONFIG_APP_DEBUG], debug) == true) {
FBootFields->FArgs.push_back(debug);
}
-
- MergeJVMDefaultsWithOverrides();
}
void Package::Clear() {
FreeBootFields();
- FJVMUserArgsOverrides.Clear();
- FDefaultJVMUserArgs.Clear();
- FJVMUserArgs.Clear();
FInitialized = false;
}
@@ -429,14 +393,6 @@
return FBootFields->FJVMArgs;
}
-OrderedMap<TString, TString> Package::GetDefaultJVMUserArgs() {
- return FDefaultJVMUserArgs;
-}
-
-OrderedMap<TString, TString> Package::GetJVMUserArgOverrides() {
- return FJVMUserArgsOverrides;
-}
-
std::vector<TString> GetKeysThatAreNotDuplicates(OrderedMap<TString,
TString> &Defaults, OrderedMap<TString, TString> &Overrides) {
std::vector<TString> result;
@@ -474,38 +430,6 @@
return result;
}
-void Package::SetJVMUserArgOverrides(OrderedMap<TString, TString> Value) {
- OrderedMap<TString, TString> defaults = GetDefaultJVMUserArgs();
- OrderedMap<TString, TString> overrides = Value;
-
- // 1. Remove entries in the overrides that are the same as the defaults.
- std::vector<TString> overrideKeys =
- GetKeysThatAreNotDuplicates(defaults, overrides);
-
- // 2. Create an ordered map from the overrides that weren't removed.
- FJVMUserArgsOverrides =
- CreateOrderedMapFromKeyList(overrides, overrideKeys);
-
- // 3. Overwrite JVM user config overrides with provided key/value pair.
- SaveJVMUserArgOverrides(FJVMUserArgsOverrides);
-
- // 4. Merge defaults and overrides to produce FJVMUserArgs.
- MergeJVMDefaultsWithOverrides();
-}
-
-void Package::SaveJVMUserArgOverrides(OrderedMap<TString, TString> Data) {
- IniFile userConfig;
- Platform& platform = Platform::GetInstance();
- std::map<TString, TString> keys = platform.GetKeys();
- userConfig.AppendSection(
- keys[CONFIG_SECTION_JVMUSEROVERRIDESOPTIONS], Data);
- userConfig.SaveToFile(GetJVMUserArgsConfigFileName());
-}
-
-OrderedMap<TString, TString> Package::GetJVMUserArgs() {
- return FJVMUserArgs;
-}
-
std::vector<TString> GetKeysThatAreNotOverridesOfDefaultValues(
OrderedMap<TString, TString> &Defaults, OrderedMap<TString,
TString> &Overrides) {
@@ -531,40 +455,6 @@
return result;
}
-void Package::MergeJVMDefaultsWithOverrides() {
- // Merge jvmuserarg defaults and jvmuserarg overrides to populate
- // FJVMUserArgs.
- // 1. If the key is in the config file and not the
- // java.user.preferences the default value is used,
- // the one from the config file.
- // 2. If the key is in the java.user.preferences then the value
- // from the java.user.preferences is used and
- // the config file value is ignored.
- // 3. If the key is not in the config file but it is in
- // the java.user.preferences then it is added anyway.
- // And if it is removed it won't show back up.
- FJVMUserArgs.Clear();
- FJVMUserArgs.Append(FDefaultJVMUserArgs);
-
- OrderedMap<TString, TString> overrides = GetJVMUserArgOverrides();
-
- // 1. Iterate over all elements in overrides to see if any items
- // override a default value.
- std::vector<TString> keys =
- GetKeysThatAreNotOverridesOfDefaultValues(FJVMUserArgs, overrides);
-
-
- // 2. All remaining items in overrides are appended to the end.
- for (unsigned int index = 0; index< keys.size(); index++) {
- TString key = keys[index];
- TString value;
-
- if (overrides.GetValue(key, value) == true) {
- FJVMUserArgs.Append(key, value);
- }
- }
-}
-
std::list<TString> Package::GetArgs() {
assert(FBootFields != NULL);
return FBootFields->FArgs;
@@ -590,21 +480,6 @@
return FBootFields->FAppDataDirectory;
}
-TString Package::GetJVMUserArgsConfigFileName() {
- if (FJVMUserArgsConfigFileName.empty()) {
- Platform& platform = Platform::GetInstance();
-
- FJVMUserArgsConfigFileName = FilePath::IncludeTrailingSeparator(
- platform.GetAppDataDirectory())
- + FilePath::IncludeTrailingSeparator(
- GetPackageAppDataDirectory())
- + FilePath::IncludeTrailingSeparator(_T("packager"))
- + _T("jvmuserargs.cfg");
- }
-
- return FJVMUserArgsConfigFileName;
-}
-
TString Package::GetAppCDSCacheDirectory() {
if (FAppCDSCacheDirectory.empty()) {
Platform& platform = Platform::GetInstance();
--- a/src/jdk.packager/share/native/library/common/Package.h Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/Package.h Fri Oct 19 19:33:35 2018 -0400
@@ -75,22 +75,13 @@
private:
bool FInitialized;
PackageBootFields* FBootFields;
- TString FJVMUserArgsConfigFileName;
TString FAppCDSCacheDirectory;
DebugState FDebugging;
- OrderedMap<TString, TString> FJVMUserArgsOverrides;
- // Contains JVM user defaults
- OrderedMap<TString, TString> FDefaultJVMUserArgs;
- // Contains a merge of JVM defaults and user overrides
- OrderedMap<TString, TString> FJVMUserArgs;
-
Package(void);
- void MergeJVMDefaultsWithOverrides();
TString GetMainJar();
- void SaveJVMUserArgOverrides(OrderedMap<TString, TString> Data);
void ReadJVMArgs(ISectionalPropertyContainer* Config);
void PromoteAppCDSState(ISectionalPropertyContainer* Config);
@@ -106,10 +97,6 @@
void SetCommandLineArguments(int argc, TCHAR* argv[]);
OrderedMap<TString, TString> GetJVMArgs();
- OrderedMap<TString, TString> GetDefaultJVMUserArgs();
- OrderedMap<TString, TString> GetJVMUserArgOverrides();
- void SetJVMUserArgOverrides(OrderedMap<TString, TString> Value);
- OrderedMap<TString, TString> GetJVMUserArgs();
TString GetMainModule();
std::list<TString> GetArgs();
@@ -119,7 +106,6 @@
TString GetPackageLauncherDirectory();
TString GetAppDataDirectory();
- TString GetJVMUserArgsConfigFileName();
TString GetAppCDSCacheDirectory();
TString GetAppCDSCacheFileName();
--- a/src/jdk.packager/share/native/library/common/Platform.h Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/Platform.h Fri Oct 19 19:33:35 2018 -0400
@@ -84,10 +84,6 @@
typedef ULONGLONG TPlatformNumber;
typedef DWORD TProcessID;
-#if defined _DEBUG && !defined DEBUG
- #define DEBUG
-#endif
-
#endif //WINDOWS
@@ -122,11 +118,8 @@
// Config file sections
#define CONFIG_SECTION_APPLICATION _T("CONFIG_SECTION_APPLICATION")
#define CONFIG_SECTION_JVMOPTIONS _T("CONFIG_SECTION_JVMOPTIONS")
-#define CONFIG_SECTION_JVMUSEROPTIONS _T("CONFIG_SECTION_JVMUSEROPTIONS")
#define CONFIG_SECTION_APPCDSJVMOPTIONS _T("CONFIG_SECTION_APPCDSJVMOPTIONS")
#define CONFIG_SECTION_ARGOPTIONS _T("CONFIG_SECTION_ARGOPTIONS")
-#define CONFIG_SECTION_JVMUSEROVERRIDESOPTIONS \
- _T("CONFIG_SECTION_JVMUSEROVERRIDESOPTIONS")
#define CONFIG_SECTION_APPCDSGENERATECACHEJVMOPTIONS \
_T("CONFIG_SECTION_APPCDSGENERATECACHEJVMOPTIONS")
@@ -424,11 +417,9 @@
bool &release) = 0;
// Returns:
- // Windows=C:\Users\<username>\AppData\Local\<app.identifier>
- // \packager\jvmuserargs.cfg
- // Linux=~/.local/<app.identifier>/packager/jvmuserargs.cfg
- // Mac=~/Library/Application Support/<app.identifier>
- // /packager/jvmuserargs.cfg
+ // Windows=C:\Users\<username>\AppData\Local
+ // Linux=~/.local
+ // Mac=~/Library/Application Support
virtual TString GetAppDataDirectory() = 0;
virtual TString GetPackageAppDirectory() = 0;
--- a/src/jdk.packager/share/native/library/common/WindowsPlatform.cpp Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/WindowsPlatform.cpp Fri Oct 19 19:33:35 2018 -0400
@@ -487,117 +487,6 @@
#endif //DEBUG
-WindowsJavaUserPreferences::WindowsJavaUserPreferences(void) :
- JavaUserPreferences() {
-}
-
-WindowsJavaUserPreferences::~WindowsJavaUserPreferences(void) {
-}
-
-// Java Preferences API encodes it's strings, so we need to match what
-// Java does to work with Java.
-// CAVEAT: Java also does unicode encoding which this doesn't do yet.
-// Should be sufficient for jvm args.
-// See WindowsPreferences.java toWindowsName()
-TString ConvertStringToJavaEcodedString(TString Value) {
- TString result;
- TCHAR* p = (TCHAR*)Value.c_str();
- TCHAR c = *p;
-
- while (c != 0) {
- switch (c) {
- case '\\':
- result += _T("//");
- break;
-
- case '/':
- result += '\\';
- break;
- default:
- if ((c >= 'A') && (c <= 'Z')) {
- result += '/';
- result += c;
- }
- else
- result += c;
- break;
- }
-
- p++;
- c = *p;
- }
-
- return result;
-}
-
-// Java Preferences API encodes it's strings,
-// so we need to match what Java does to work with Java.
-// CAVEAT: Java also does unicode encoding which this doesn't do yet.
-// Should be sufficient for jvm args.
-// See WindowsPreferences.java toJavaName()
-TString ConvertJavaEcodedStringToString(TString Value) {
- TString result;
-
- for (size_t index = 0; index < Value.length(); index++) {
- TCHAR c = Value[index];
-
- switch (c) {
- case '/':
- if ((index + 1) < Value.length()) {
- index++;
- TCHAR nextc = Value[index];
-
- if (nextc >= 'A' && nextc <= 'Z') {
- result += nextc;
- }
- else if (nextc == '/') {
- result += '\\';
- }
- }
- break;
- case '\\':
- result += '/';
- break;
- default:
- result += c;
- break;
- }
- }
-
- return result;
-}
-
-bool WindowsJavaUserPreferences::Load(TString Appid) {
- bool result = false;
- TString lappid = Helpers::ConvertIdToFilePath(Appid);
- lappid = ConvertStringToJavaEcodedString(Appid);
- TString registryKey = TString(_T("SOFTWARE\\JavaSoft\\Prefs\\"))
- + lappid + TString(_T("\\/J/V/M/User/Options"));
- Registry registry(HKEY_CURRENT_USER);
-
- if (registry.Open(registryKey) == true) {
- std::list<TString> keys = registry.GetKeys();
- OrderedMap<TString, TString> mapOfKeysAndValues;
-
- for (std::list<TString>::const_iterator iterator = keys.begin();
- iterator != keys.end(); iterator++) {
- TString key = *iterator;
- TString value = registry.ReadString(key);
- key = ConvertJavaEcodedStringToString(key);
- value = ConvertJavaEcodedStringToString(value);
-
- if (key.empty() == false) {
- mapOfKeysAndValues.Append(key, value);
- result = true;
- }
- }
-
- FMap = mapOfKeysAndValues;
- }
-
- return result;
-}
-
FileHandle::FileHandle(std::wstring FileName) {
FHandle = ::CreateFile(FileName.data(), GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
--- a/src/jdk.packager/share/native/library/common/WindowsPlatform.h Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/share/native/library/common/WindowsPlatform.h Fri Oct 19 19:33:35 2018 -0400
@@ -31,7 +31,6 @@
#define WINDOWSPLATFORM_H
#include "GenericPlatform.h"
-#include "JavaUserPreferences.h"
#include <Windows.h>
@@ -127,15 +126,6 @@
#pragma warning( pop ) // C4250
-class WindowsJavaUserPreferences : public JavaUserPreferences {
-public:
- WindowsJavaUserPreferences(void);
- ~WindowsJavaUserPreferences(void);
-
- virtual bool Load(TString Appid);
-};
-
-
class FileHandle {
private:
HANDLE FHandle;
--- a/src/jdk.packager/windows/native/jpackager/jpackager.cpp Fri Oct 19 19:29:20 2018 -0400
+++ b/src/jdk.packager/windows/native/jpackager/jpackager.cpp Fri Oct 19 19:33:35 2018 -0400
@@ -31,9 +31,7 @@
#include "IconSwap.h"
#include "VersionInfoSwap.h"
-#define _DEBUG true
-
-#ifdef _DEBUG
+#ifdef DEBUG
#include <iostream>
#include <sstream>
#endif
@@ -83,7 +81,7 @@
// Load the library.
hInst = LoadLibraryA("ntdsbmsg.dll");
if (NULL == hInst) {
-#ifdef _DEBUG
+#ifdef DEBUG
cerr << "cannot load ntdsbmsg.dll\n";
#endif
return;
@@ -104,7 +102,7 @@
}
// Display the error message, or generic text if not found.
-#ifdef _DEBUG
+#ifdef DEBUG
cerr << "Error value: " << dwErr << " Message: " << ((dwChars > 0) ? wszMsgBuff : "Error message not found.") << endl;
#endif
}
@@ -225,7 +223,7 @@
RegCloseKey(hKey);
}
else {
-#ifdef _DEBUG
+#ifdef DEBUG
cerr << "Can not open registry key" << endl;
#endif
result = false;
@@ -380,34 +378,34 @@
&ftLastWriteTime);
if (retCode == ERROR_SUCCESS) {
-#ifdef _DEBUG
+#ifdef DEBUG
cout << achKey << endl;
#endif
JavaVersion * nv = parseName(achKey);
bool isHome = checkJavaHome(key, sKey, achKey, nv);
-#ifdef _DEBUG
+#ifdef DEBUG
wcout << nv->home << " " << isHome << endl;
#endif
if (isHome)
if (result == NULL) {
result = nv;
-#ifdef _DEBUG
+#ifdef DEBUG
cout << "NEW" << endl;
#endif
}
else {
if (nv != NULL) {
if (*nv > *result) {
-#ifdef _DEBUG
+#ifdef DEBUG
cout << "REPLACE" << endl;
#endif
delete result;
result = nv;
}
else {
-#ifdef _DEBUG
+#ifdef DEBUG
cout << "NO" << endl;
#endif
delete nv;
@@ -552,7 +550,7 @@
L" -m jdk.packager/jdk.packager.main.Main" +
L" " + args;
-#ifdef _DEBUG
+#ifdef DEBUG
fwprintf (stdout, TEXT("%s\n"), cmd.c_str());
#endif
@@ -563,7 +561,7 @@
if (!CreateProcess(NULL, (wchar_t *) cmd.data(),
NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, &start, &pi)) {
-#ifdef _DEBUG
+#ifdef DEBUG
fprintf(stderr, "Cannot start java.exe");
#endif
return EXIT_FAILURE;