| 15 | } |
| 16 | |
| 17 | void JavaChecker::performCheck() |
| 18 | { |
| 19 | QString checkerJar = FS::PathCombine(APPLICATION->getJarsPath(), "JavaCheck.jar"); |
| 20 | |
| 21 | QStringList args; |
| 22 | |
| 23 | process.reset(new QProcess()); |
| 24 | if(m_args.size()) |
| 25 | { |
| 26 | auto extraArgs = Commandline::splitArgs(m_args); |
| 27 | args.append(extraArgs); |
| 28 | } |
| 29 | if(m_minMem != 0) |
| 30 | { |
| 31 | args << QString("-Xms%1m").arg(m_minMem); |
| 32 | } |
| 33 | if(m_maxMem != 0) |
| 34 | { |
| 35 | args << QString("-Xmx%1m").arg(m_maxMem); |
| 36 | } |
| 37 | if(m_permGen != 64) |
| 38 | { |
| 39 | args << QString("-XX:PermSize=%1m").arg(m_permGen); |
| 40 | } |
| 41 | |
| 42 | args.append({"-jar", checkerJar}); |
| 43 | process->setArguments(args); |
| 44 | process->setProgram(m_path); |
| 45 | process->setProcessChannelMode(QProcess::SeparateChannels); |
| 46 | process->setProcessEnvironment(CleanEnviroment()); |
| 47 | qDebug() << "Running java checker: " + m_path + args.join(" ");; |
| 48 | |
| 49 | connect(process.get(), SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(finished(int, QProcess::ExitStatus))); |
| 50 | connect(process.get(), SIGNAL(error(QProcess::ProcessError)), this, SLOT(error(QProcess::ProcessError))); |
| 51 | connect(process.get(), SIGNAL(readyReadStandardOutput()), this, SLOT(stdoutReady())); |
| 52 | connect(process.get(), SIGNAL(readyReadStandardError()), this, SLOT(stderrReady())); |
| 53 | connect(&killTimer, SIGNAL(timeout()), SLOT(timeout())); |
| 54 | killTimer.setSingleShot(true); |
| 55 | killTimer.start(15000); |
| 56 | process->start(); |
| 57 | } |
| 58 | |
| 59 | void JavaChecker::stdoutReady() |
| 60 | { |
no test coverage detected