| 40 | #include <QRegularExpression> |
| 41 | |
| 42 | bool JavaCommon::checkJVMArgs(QString jvmargs, QWidget* parent) |
| 43 | { |
| 44 | if (jvmargs.contains("-XX:PermSize=") || jvmargs.contains(QRegularExpression("-Xm[sx]")) || jvmargs.contains("-XX-MaxHeapSize") || |
| 45 | jvmargs.contains("-XX:InitialHeapSize")) { |
| 46 | auto warnStr = QObject::tr( |
| 47 | "You tried to manually set a JVM memory option (using \"-XX:PermSize\", \"-XX-MaxHeapSize\", \"-XX:InitialHeapSize\", \"-Xmx\" " |
| 48 | "or \"-Xms\").\n" |
| 49 | "There are dedicated boxes for these in the settings (Java tab, in the Memory group at the top).\n" |
| 50 | "This message will be displayed until you remove them from the JVM arguments."); |
| 51 | CustomMessageBox::selectable(parent, QObject::tr("JVM arguments warning"), warnStr, QMessageBox::Warning)->exec(); |
| 52 | return false; |
| 53 | } |
| 54 | // block lunacy with passing required version to the JVM |
| 55 | if (jvmargs.contains(QRegularExpression("-version:.*"))) { |
| 56 | auto warnStr = QObject::tr( |
| 57 | "You tried to pass required Java version argument to the JVM (using \"-version:xxx\"). This is not safe and will not be " |
| 58 | "allowed.\n" |
| 59 | "This message will be displayed until you remove this from the JVM arguments."); |
| 60 | CustomMessageBox::selectable(parent, QObject::tr("JVM arguments warning"), warnStr, QMessageBox::Warning)->exec(); |
| 61 | return false; |
| 62 | } |
| 63 | return true; |
| 64 | } |
| 65 | |
| 66 | void JavaCommon::javaWasOk(QWidget* parent, const JavaChecker::Result& result) |
| 67 | { |
nothing calls this directly
no test coverage detected