Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Thondapu2015-01-28 07:10:41 -0500
committerArun Thondapu2015-01-28 07:10:41 -0500
commit2894268548362cd9628be0f826a70b427eab84d5 (patch)
treeb56a554f7f4a503fde964935f8ef2131ba37da88
parent113f52ff4ae2b841ea751ef15af879a2ce47d447 (diff)
downloadrt.equinox.framework-2894268548362cd9628be0f826a70b427eab84d5.tar.gz
rt.equinox.framework-2894268548362cd9628be0f826a70b427eab84d5.tar.xz
rt.equinox.framework-2894268548362cd9628be0f826a70b427eab84d5.zip
Bug 449990 - [1.9] --launcher.XXMaxPermSize should not pass
-XX:MaxPermSize= for Oracle VMs >= 8 Improved patch which includes better version checking and Windows implementation as well Change-Id: Iaa84d2a0e1fdf28276f338d4ff8f16b4865eb75a Signed-off-by: Arun Thondapu <arunkumar.thondapu@in.ibm.com>
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbon.c8
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/eclipseNix.c11
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/eclipseUnicode.h1
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c22
4 files changed, 29 insertions, 13 deletions
diff --git a/features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbon.c b/features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbon.c
index 500311abb..b76584a56 100644
--- a/features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbon.c
+++ b/features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbon.c
@@ -533,8 +533,12 @@ char * getJavaVersion(char* command) {
}
if (strstr(buffer, "Java HotSpot(TM)") || strstr(buffer, "OpenJDK")) {
if (version != NULL) {
- if (version[0] == '1' && ((int)(version[2] - '0') < 8)) {
- isSunMaxPermSizeVM = 1;
+ _TCHAR *value = strtok(version, ".");
+ if (value != NULL && (strtol(value, NULL, 10) == 1)) {
+ value = strtok(NULL, ".");
+ if (strtol(value, NULL, 10) < 8) {
+ isSunMaxPermSizeVM = 1;
+ }
}
}
break;
diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipseNix.c b/features/org.eclipse.equinox.executable.feature/library/eclipseNix.c
index a4439c752..c6062b258 100644
--- a/features/org.eclipse.equinox.executable.feature/library/eclipseNix.c
+++ b/features/org.eclipse.equinox.executable.feature/library/eclipseNix.c
@@ -175,6 +175,9 @@ JavaResults* startJavaVM( _TCHAR* libPath, _TCHAR* vmArgs[], _TCHAR* progArgs[],
}
int isMaxPermSizeVM( _TCHAR * javaVM, _TCHAR * jniLib ) {
+ if (javaVM == NULL) {
+ return 0;
+ }
FILE *fp = NULL;
_TCHAR buffer[4096];
_TCHAR *version = NULL, *firstChar;
@@ -199,8 +202,12 @@ int isMaxPermSizeVM( _TCHAR * javaVM, _TCHAR * jniLib ) {
}
if (_tcsstr(buffer, "Java HotSpot(TM)") || _tcsstr(buffer, "OpenJDK")) {
if (version != NULL) {
- if (version[0] == '1' && ((int)(version[2] - '0') < 8)) {
- result = 1;
+ _TCHAR *value = _tcstok(version, ".");
+ if (value != NULL && (_tcstol(value, NULL, 10) == 1)) {
+ value = _tcstok(NULL, ".");
+ if (_tcstol(value, NULL, 10) < 8) {
+ result = 1;
+ }
}
}
break;
diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipseUnicode.h b/features/org.eclipse.equinox.executable.feature/library/eclipseUnicode.h
index f98b77dc7..6d758b9b1 100644
--- a/features/org.eclipse.equinox.executable.feature/library/eclipseUnicode.h
+++ b/features/org.eclipse.equinox.executable.feature/library/eclipseUnicode.h
@@ -96,6 +96,7 @@
#define _tgetcwd getcwd
#define _tgetenv getenv
#define _tcstol strtol
+#define _tcstok strtok
#ifndef LINUX
#define _totupper toupper
#endif /* LINUX */
diff --git a/features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c b/features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c
index e93388257..f74fd6c04 100644
--- a/features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c
+++ b/features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c
@@ -78,6 +78,7 @@ typedef struct {
} TRANSLATIONS;
#define COMPANY_NAME_KEY _T_ECLIPSE("\\StringFileInfo\\%04x%04x\\CompanyName")
+#define PRODUCT_VERSION_KEY _T_ECLIPSE("\\StringFileInfo\\%04x%04x\\ProductVersion")
#define SUN_MICROSYSTEMS _T_ECLIPSE("Sun Microsystems")
#define ORACLE _T_ECLIPSE("Oracle")
@@ -584,9 +585,9 @@ int isMaxPermSizeVM( _TCHAR * javaVM, _TCHAR * jniLib ) {
DWORD handle;
void * info;
- _TCHAR * key, *value;
+ _TCHAR *key, *value, *versionKey, *version;
size_t i;
- int valueSize;
+ int valueSize, versionSize;
if (vm == NULL)
return 0;
@@ -600,20 +601,23 @@ int isMaxPermSizeVM( _TCHAR * javaVM, _TCHAR * jniLib ) {
VerQueryValue(info, _T_ECLIPSE("\\VarFileInfo\\Translation"), (void *) &translations, &translationsSize);
/* this size is only right because %04x is 4 characters */
- key = malloc( (_tcslen(COMPANY_NAME_KEY) + 1) * sizeof(_TCHAR));
+ key = malloc((_tcslen(COMPANY_NAME_KEY) + 1) * sizeof(_TCHAR));
+ versionKey = malloc((_tcslen(PRODUCT_VERSION_KEY) + 1) * sizeof(_TCHAR));
for (i = 0; i < (translationsSize / sizeof(TRANSLATIONS)); i++) {
_stprintf(key, COMPANY_NAME_KEY, translations[i].language, translations[i].codepage);
-
VerQueryValue(info, key, (void *)&value, &valueSize);
- if (_tcsncmp(value, SUN_MICROSYSTEMS, _tcslen(SUN_MICROSYSTEMS)) == 0) {
- result = 1;
- break;
- } else if (_tcsncmp(value, ORACLE, _tcslen(ORACLE)) == 0) {
- result = 1;
+
+ if ((_tcsncmp(value, SUN_MICROSYSTEMS, _tcslen(SUN_MICROSYSTEMS)) == 0) || (_tcsncmp(value, ORACLE, _tcslen(ORACLE)) == 0)) {
+ _stprintf(versionKey, PRODUCT_VERSION_KEY, translations[i].language, translations[i].codepage);
+ VerQueryValue(info, versionKey, (void *)&version, &versionSize);
+ if ((version[0] - '0') < 8) {
+ result = 1;
+ }
break;
}
}
free(key);
+ free(versionKey);
}
free(info);
}

Back to the top