billbarker    2003/12/30 20:58:31

  Modified:    daemon/src/native/unix/native arguments.c debug.h home.c
  Log:
  Avoid NPEs when JAVA_HOME is not defined on debug build.
  
  Fix for Bug #23722
  
  Revision  Changes    Path
  1.2       +6 -6      jakarta-commons/daemon/src/native/unix/native/arguments.c
  
  Index: arguments.c
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/daemon/src/native/unix/native/arguments.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- arguments.c       4 Sep 2003 23:28:20 -0000       1.1
  +++ arguments.c       31 Dec 2003 04:58:31 -0000      1.2
  @@ -286,15 +286,15 @@
   
           log_debug("| Remove service:  %s",IsYesNo(args->remove));
   
  -        log_debug("| JVM Name:        \"%s\"",args->name);
  -        log_debug("| Java Home:       \"%s\"",args->home);
  -        log_debug("| PID File:        \"%s\"",args->pidf);
  -        log_debug("| User Name:       \"%s\"",args->user);
  +        log_debug("| JVM Name:        \"%s\"",PRINT_NULL(args->name));
  +        log_debug("| Java Home:       \"%s\"",PRINT_NULL(args->home));
  +        log_debug("| PID File:        \"%s\"",PRINT_NULL(args->pidf));
  +        log_debug("| User Name:       \"%s\"",PRINT_NULL(args->user));
   
           log_debug("| Extra Options:   %d",args->onum);
           for (x=0; x<args->onum; x++) log_debug("|   \"%s\"",args->opts[x]);
   
  -        log_debug("| Class Invoked:   \"%s\"",args->clas);
  +        log_debug("| Class Invoked:   \"%s\"",PRINT_NULL(args->clas));
   
           log_debug("| Class Arguments: %d",args->anum);
           for (x=0; x<args->anum; x++)log_debug("|   \"%s\"",args->args[x]);
  
  
  
  1.2       +6 -1      jakarta-commons/daemon/src/native/unix/native/debug.h
  
  Index: debug.h
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/daemon/src/native/unix/native/debug.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- debug.h   4 Sep 2003 23:28:20 -0000       1.1
  +++ debug.h   31 Dec 2003 04:58:31 -0000      1.2
  @@ -73,6 +73,11 @@
   extern char *log_prog;
   
   /**
  + * Helper macro to avoid NPEs in printf.
  + */
  +#define PRINT_NULL(x) ((x) == NULL ? "null" : (x))
  +
  +/**
    * Dump a debug message.
    *
    * @param fmt The printf style message format.
  
  
  
  1.3       +3 -3      jakarta-commons/daemon/src/native/unix/native/home.c
  
  Index: home.c
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/daemon/src/native/unix/native/home.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- home.c    31 Dec 2003 04:52:30 -0000      1.2
  +++ home.c    31 Dec 2003 04:58:31 -0000      1.3
  @@ -267,8 +267,8 @@
   
       if (log_debug_flag==true) {
           log_debug("+-- DUMPING JAVA HOME STRUCTURE ------------------------");
  -        log_debug("| Java Home:       \"%s\"",data->path);
  -        log_debug("| Java VM Config.: \"%s\"",data->cfgf);
  +        log_debug("| Java Home:       \"%s\"",PRINT_NULL(data->path));
  +        log_debug("| Java VM Config.: \"%s\"",PRINT_NULL(data->cfgf));
           log_debug("| Found JVMs:      %d",data->jnum);
           for (x=0; x<data->jnum; x++) {
               home_jvm *jvm=data->jvms[x];
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to