This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 184513
Collapse All | Expand All

(-)a/o.n.bootstrap/launcher/windows/jvmlauncher.cpp (-15 / +19 lines)
Lines 121-136 Link Here
121
    return !javaPath.empty();
121
    return !javaPath.empty();
122
}
122
}
123
123
124
bool JvmLauncher::start(const char *mainClassName, list<string> args, list<string> options, bool &separateProcess, DWORD *retCode) {
124
bool JvmLauncher::start(const char *mainClassName, const list<string> &args, const list<string> &options, bool &separateProcess, DWORD *retCode) {
125
    assert(mainClassName);
125
    assert(mainClassName);
126
    logMsg("JvmLauncher::start()\n\tmainClassName: %s\n\tseparateProcess: %s",
126
    logMsg("JvmLauncher::start()\n\tmainClassName: %s\n\tseparateProcess: %s",
127
            mainClassName, separateProcess ? "true" : "false");
127
            mainClassName, separateProcess ? "true" : "false");
128
    logMsg("  args:");
128
    logMsg("  args:");
129
    for (list<string>::iterator it = args.begin(); it != args.end(); ++it) {
129
    for (list<string>::const_iterator it = args.begin(); it != args.end(); ++it) {
130
        logMsg("\t%s", it->c_str());
130
        logMsg("\t%s", it->c_str());
131
    }
131
    }
132
    logMsg("  options:");
132
    logMsg("  options:");
133
    for (list<string>::iterator it = options.begin(); it != options.end(); ++it) {
133
    for (list<string>::const_iterator it = options.begin(); it != options.end(); ++it) {
134
        logMsg("\t%s", it->c_str());
134
        logMsg("\t%s", it->c_str());
135
    }
135
    }
136
136
Lines 166-173 Link Here
166
            : startInProcJvm(mainClassName, args, options);
166
            : startInProcJvm(mainClassName, args, options);
167
}
167
}
168
168
169
bool JvmLauncher::findClientOption(list<string> &options) {
169
bool JvmLauncher::findClientOption(const list<string> &options) {
170
    for (list<string>::iterator it = options.begin(); it != options.end(); ++it) {
170
    for (list<string>::const_iterator it = options.begin(); it != options.end(); ++it) {
171
        if (*it == "-client") {
171
        if (*it == "-client") {
172
            return true;
172
            return true;
173
        }
173
        }
Lines 195-201 Link Here
195
    return *end == '\0';
195
    return *end == '\0';
196
}
196
}
197
197
198
bool JvmLauncher::startInProcJvm(const char *mainClassName, std::list<std::string> args, std::list<std::string> options) {
198
bool JvmLauncher::startInProcJvm(const char *mainClassName, const std::list<std::string> &args, const std::list<std::string> &options) {
199
199
200
    class Jvm {
200
    class Jvm {
201
    public:
201
    public:
Lines 228-234 Link Here
228
            }
228
            }
229
        }
229
        }
230
230
231
        bool init(list<string> options) {
231
        bool init(const list<string> &options) {
232
            logMsg("JvmLauncher::Jvm::init()");
232
            logMsg("JvmLauncher::Jvm::init()");
233
            logMsg("LoadLibrary(\"%s\")", jvmLauncher->javaDllPath.c_str());
233
            logMsg("LoadLibrary(\"%s\")", jvmLauncher->javaDllPath.c_str());
234
            {
234
            {
Lines 249-256 Link Here
249
            logMsg("JVM options:");
249
            logMsg("JVM options:");
250
            jvmOptions = new JavaVMOption[options.size()];
250
            jvmOptions = new JavaVMOption[options.size()];
251
            int i = 0;
251
            int i = 0;
252
            for (list<string>::iterator it = options.begin(); it != options.end(); ++it, ++i) {
252
            for (list<string>::const_iterator it = options.begin(); it != options.end(); ++it, ++i) {
253
                string &option = *it;
253
                const string &option = *it;
254
                logMsg("\t%s", option.c_str());
254
                logMsg("\t%s", option.c_str());
255
                jvmOptions[i].optionString = (char *) option.c_str();
255
                jvmOptions[i].optionString = (char *) option.c_str();
256
                jvmOptions[i].extraInfo = 0;
256
                jvmOptions[i].extraInfo = 0;
Lines 314-322 Link Here
314
        return false;
314
        return false;
315
    }
315
    }
316
    int i = 0;
316
    int i = 0;
317
    for (list<string>::iterator it = args.begin(); it != args.end(); ++it, ++i) {
317
    for (list<string>::const_iterator it = args.begin(); it != args.end(); ++it, ++i) {
318
        string &arg = *it;
318
        const string &arg = *it;
319
        jstring jstringArg = jvm.env->NewStringUTF(arg.c_str());
319
        const int len = 32*1024;
320
        char utf8[len] = "";
321
        if (convertAnsiToUtf8(arg.c_str(), utf8, len))
322
            logMsg("Conversion to UTF8 failed");
323
        jstring jstringArg = jvm.env->NewStringUTF(utf8);
320
        if (!jstringArg) {
324
        if (!jstringArg) {
321
            logErr(false, true, "NewStringUTF() failed");
325
            logErr(false, true, "NewStringUTF() failed");
322
            return false;
326
            return false;
Lines 329-338 Link Here
329
}
333
}
330
334
331
335
332
bool JvmLauncher::startOutProcJvm(const char *mainClassName, std::list<std::string> args, std::list<std::string> options, DWORD *retCode) {
336
bool JvmLauncher::startOutProcJvm(const char *mainClassName, const std::list<std::string> &args, const std::list<std::string> &options, DWORD *retCode) {
333
    string cmdLine = '\"' + (suppressConsole ? javawExePath : javaExePath) + '\"';
337
    string cmdLine = '\"' + (suppressConsole ? javawExePath : javaExePath) + '\"';
334
    cmdLine.reserve(32*1024);
338
    cmdLine.reserve(32*1024);
335
    for (list<string>::iterator it = options.begin(); it != options.end(); ++it) {
339
    for (list<string>::const_iterator it = options.begin(); it != options.end(); ++it) {
336
        cmdLine += " \"";
340
        cmdLine += " \"";
337
        cmdLine += *it;
341
        cmdLine += *it;
338
        cmdLine += "\"";
342
        cmdLine += "\"";
Lines 341-347 Link Here
341
    // mainClass and args
345
    // mainClass and args
342
    cmdLine += ' ';
346
    cmdLine += ' ';
343
    cmdLine += mainClassName;
347
    cmdLine += mainClassName;
344
    for (list<string>::iterator it = args.begin(); it != args.end(); ++it) {
348
    for (list<string>::const_iterator it = args.begin(); it != args.end(); ++it) {
345
        if (javaClientDllPath.empty() && *it == "-client") {
349
        if (javaClientDllPath.empty() && *it == "-client") {
346
            logMsg("Removing -client option, client java dll not found.");
350
            logMsg("Removing -client option, client java dll not found.");
347
            // remove client parameter, no client java found
351
            // remove client parameter, no client java found
(-)a/o.n.bootstrap/launcher/windows/jvmlauncher.h (-4 / +4 lines)
Lines 71-77 Link Here
71
71
72
    bool initialize(const char *javaPathOrMinVersion);
72
    bool initialize(const char *javaPathOrMinVersion);
73
    bool getJavaPath(std::string &path);
73
    bool getJavaPath(std::string &path);
74
    bool start(const char *mainClassName, std::list<std::string> args, std::list<std::string> options, bool &separateProcess, DWORD *retCode);
74
    bool start(const char *mainClassName, const std::list<std::string> &args, const std::list<std::string> &options, bool &separateProcess, DWORD *retCode);
75
75
76
    void setSuppressConsole(bool val) {
76
    void setSuppressConsole(bool val) {
77
        suppressConsole = val;
77
        suppressConsole = val;
Lines 83-93 Link Here
83
    bool checkJava(const char *javaPath, const char *prefix);
83
    bool checkJava(const char *javaPath, const char *prefix);
84
    bool findJava(const char *minJavaVersion);
84
    bool findJava(const char *minJavaVersion);
85
    bool findJava(const char *javaKey, const char *prefix, const char *minJavaVersion);
85
    bool findJava(const char *javaKey, const char *prefix, const char *minJavaVersion);
86
    bool startOutProcJvm(const char *mainClassName, std::list<std::string> args, std::list<std::string> options, DWORD *retCode);
86
    bool startOutProcJvm(const char *mainClassName, const std::list<std::string> &args, const std::list<std::string> &options, DWORD *retCode);
87
    bool startInProcJvm(const char *mainClassName, std::list<std::string> args, std::list<std::string> options);
87
    bool startInProcJvm(const char *mainClassName, const std::list<std::string> &args, const std::list<std::string> &options);
88
    bool isVersionString(const char *str);
88
    bool isVersionString(const char *str);
89
    bool canLoadJavaDll();
89
    bool canLoadJavaDll();
90
    bool findClientOption(std::list<std::string> &options);
90
    bool findClientOption(const std::list<std::string> &options);
91
91
92
private:
92
private:
93
    bool suppressConsole;
93
    bool suppressConsole;
(-)a/o.n.bootstrap/launcher/windows/platformlauncher.h (-1 / +1 lines)
Lines 110-120 Link Here
110
    bool restartRequested();
110
    bool restartRequested();
111
111
112
private:
112
private:
113
    bool exiting;
114
    bool separateProcess;
113
    bool separateProcess;
115
    bool suppressConsole;
114
    bool suppressConsole;
116
    bool heapDumpPathOptFound;
115
    bool heapDumpPathOptFound;
117
    bool nosplash;
116
    bool nosplash;
117
    bool exiting;
118
    std::string platformDir;
118
    std::string platformDir;
119
    std::string userDir;
119
    std::string userDir;
120
    std::string clusters;
120
    std::string clusters;
(-)a/o.n.bootstrap/launcher/windows/utilsfuncs.cpp (+11 lines)
Lines 455-457 Link Here
455
    }
455
    }
456
    return IsWow64;
456
    return IsWow64;
457
}
457
}
458
459
int convertAnsiToUtf8(const char *ansi, char *utf8, int utf8Len) {
460
    const int len = 32*1024;
461
    WCHAR tmp[len] = L"";
462
    if (MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, ansi, -1, tmp, len) == 0)
463
        return -1;
464
    if (WideCharToMultiByte(CP_UTF8, 0, tmp, -1, utf8, utf8Len, NULL, NULL) == 0)
465
        return -1;
466
    return 0;
467
}
468
(-)a/o.n.bootstrap/launcher/windows/utilsfuncs.h (+1 lines)
Lines 67-72 Link Here
67
bool printToConsole(const char *msg);
67
bool printToConsole(const char *msg);
68
bool getParentProcessID(DWORD &id);
68
bool getParentProcessID(DWORD &id);
69
bool isConsoleAttached();
69
bool isConsoleAttached();
70
int convertAnsiToUtf8(const char *ansi, char *utf8, int utf8Len);
70
71
71
#endif	/* _UTILSFUNCS_H */
72
#endif	/* _UTILSFUNCS_H */
72
73

Return to bug 184513