commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-commons-sandbox/daemon/src/native/nt/procrun procrun.c
Date Sat, 03 May 2003 18:35:11 GMT
mturk       2003/05/03 11:35:11

  Modified:    daemon/src/native/nt/procrun procrun.c
  Log:
  Fix the JAVA_HOME detection, and make that non mandatory.
  
  Revision  Changes    Path
  1.20      +21 -10    jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.c
  
  Index: procrun.c
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- procrun.c	3 May 2003 08:52:02 -0000	1.19
  +++ procrun.c	3 May 2003 18:35:11 -0000	1.20
  @@ -720,7 +720,7 @@
       if ((err = RegQueryValueEx(hkjs, "JavaHome", NULL, NULL, 
                                  (unsigned char *)jbin, 
                                  &klen)) != ERROR_SUCCESS) {
  -        DBPRINTF0("procrun_guess_jvm() failed obtaining Runtime Library\n");
  +        DBPRINTF0("procrun_guess_jvm() failed obtaining Java path\n");
           RegCloseKey(hkjs);
           return NULL;
       }
  @@ -739,6 +739,11 @@
       char *cver;
       unsigned long err, klen = MAX_PATH;
       
  +    if ((cver = getenv("JAVA_HOME")) != NULL) {
  +        strcpy(jbin, cver);
  +        strcat(jbin, "\\bin");
  +        return pool_strdup(proc->pool, jbin);
  +    }
       strcpy(reg, JAVAHOME_REGKEY);
       cver = &reg[sizeof(JAVAHOME_REGKEY)-1];
   
  @@ -750,14 +755,14 @@
       if ((err = RegQueryValueEx(hkjs, "CurrentVersion", NULL, NULL, 
                                  (unsigned char *)cver,
                                  &klen)) != ERROR_SUCCESS) {
  -        DBPRINTF0("procrun_guess_jvm() failed obtaining Current Java Version\n");
  +        DBPRINTF0("procrun_guess_jvm() failed obtaining Current Java SDK Version\n");
           RegCloseKey(hkjs);
           return NULL;
       }
       RegCloseKey(hkjs);
       
       if ((err = RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg,
  -                            0, KEY_READ, &hkjs) ) != ERROR_SUCCESS) {
  +                            0, KEY_READ, &hkjs)) != ERROR_SUCCESS) {
           DBPRINTF1("procrun_guess_jvm() failed to open Registry key %s\n", reg);
           return NULL;
       }
  @@ -765,7 +770,7 @@
       if ((err = RegQueryValueEx(hkjs, "JavaHome", NULL, NULL, 
                                  (unsigned char *)jbin, 
                                  &klen)) != ERROR_SUCCESS) {
  -        DBPRINTF0("procrun_guess_jvm() failed obtaining Runtime Library\n");
  +        DBPRINTF0("procrun_guess_jvm() failed obtaining Java Home\n");
           RegCloseKey(hkjs);
           return NULL;
       }
  @@ -1134,7 +1139,7 @@
                                        proc->java.stop_mid,
                                        jargs);
       }
  -    else if (!proc->java.jpath) {
  +    else if (!proc->java.jbin) {
           /* Call java.lang.System.exit(0) */
           jclass sysclass;
           jmethodID exitid;
  @@ -1255,7 +1260,7 @@
       /* check if we have java.exe as worker process 
        * in that case don't call the startup class. 
        */
  -    if (proc->java.jpath != NULL) {
  +    if (proc->java.jbin != NULL) {
           return 0;
       } 
       strclass = (*env)->FindClass(env, "java/lang/String");
  @@ -1402,7 +1407,8 @@
   
       if (!CreatePipe(&env->c->h_stdout[0],
                       &env->c->h_stdout[1], &sa, 0)) {
  -            return -1;
  +        DBPRINTF0(NULL);
  +        return -1;
       }
       SetStdHandle(STD_OUTPUT_HANDLE, env->c->h_stdout[1]);
       pool_handle(env->c->pool, env->c->h_stdout[1]);
  @@ -1412,6 +1418,7 @@
                            env->m->pinfo.hProcess,
                            &env->c->h_stdout[3], 
                            0, FALSE, DUPLICATE_SAME_ACCESS)) {
  +        DBPRINTF0(NULL);
           return -1;
       }
       CloseHandle(env->c->h_stdout[0]);
  @@ -1425,7 +1432,8 @@
   
       if (!CreatePipe(&env->c->h_stderr[0],
                       &env->c->h_stderr[1], &sa, 0)) {
  -            return -1;
  +        DBPRINTF0(NULL);
  +        return -1;
       }
       SetStdHandle(STD_ERROR_HANDLE, env->c->h_stderr[1]);
       pool_handle(env->c->pool, env->c->h_stderr[1]);
  @@ -1435,6 +1443,7 @@
                            env->m->pinfo.hProcess,
                            &env->c->h_stderr[3], 
                            0, FALSE, DUPLICATE_SAME_ACCESS)) {
  +        DBPRINTF0(NULL);
           return -1;
       }
       CloseHandle(env->c->h_stderr[0]);
  @@ -1448,7 +1457,8 @@
   
       if (!CreatePipe(&env->c->h_stdin[0],
                       &env->c->h_stdin[1], &sa, 0)) {
  -            return -1;
  +        DBPRINTF0(NULL);
  +        return -1;
       }
       SetStdHandle(STD_INPUT_HANDLE, env->c->h_stdin[0]);  
       pool_handle(env->c->pool, env->c->h_stdin[0]);
  @@ -1457,6 +1467,7 @@
                            env->m->pinfo.hProcess,
                            &env->c->h_stdin[3], 
                            0, FALSE, DUPLICATE_SAME_ACCESS)) {
  +        DBPRINTF0(NULL);
           return -1;
       }
       
  @@ -2368,7 +2379,7 @@
       report_service_status(SERVICE_START_PENDING, NO_ERROR, 3000,
                             g_env->m);
       if (g_env->m->java.dll) {
  -        if (g_env->m->java.jpath == NULL) {
  +        if (g_env->m->java.jbin == NULL) {
               DWORD id;
               HANDLE jh;
               jh = CreateThread(NULL, 0, java_thread, g_env, 0, &id);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message