Program: 180083
Project: 180083
Buggy source:
/** 
 * @param context if context is null, it will return a log service that uses stdout.
 * @return Either the first LogService available in the runtime if availableor a SysoutLogService.
 */
public static LogService getLogService(BundleContext context){
  final LogService logService;
  boolean created=false;
  ServiceReference sr=null;
  if (context != null)   sr=context.getServiceReference(LogService.class.getName());
  if (sr != null) {
    logService=(LogService)context.getService(sr);
  }
 else {
    logService=new LogService(){
      public void log(      int level,      String message){
        System.out.println(levelString(level) + message);
      }
      public void log(      int level,      String message,      Throwable exception){
        System.out.println(levelString(level) + message + "String_Node_Str"+ exception.toString());
        if (level == LogService.LOG_ERROR) {
          System.err.println(levelString(level) + message + "String_Node_Str"+ exception.toString());
        }
        exception.printStackTrace(new PrintWriter(System.out,true));
      }
      public void log(      ServiceReference sr,      int level,      String message){
        if (message == null)         message="String_Node_Str";
        System.out.println(levelString(level) + "String_Node_Str" + sr.toString()+ "String_Node_Str"+ message);
        if (level == LogService.LOG_ERROR) {
          System.err.println(levelString(level) + "String_Node_Str" + sr.toString()+ "String_Node_Str"+ message);
        }
      }
      public void log(      ServiceReference sr,      int level,      String message,      Throwable exception){
        if (exception == null) {
          log(sr,level,message);
          return;
        }
        System.out.println(levelString(level) + message + "String_Node_Str"+ exception.toString());
        exception.printStackTrace(new PrintWriter(System.out,true));
        if (level == LogService.LOG_ERROR) {
          System.err.println(levelString(level) + message + "String_Node_Str"+ exception.toString());
          exception.printStackTrace(new PrintWriter(System.err,true));
        }
      }
      private String levelString(      int level){
switch (level) {
case LogService.LOG_DEBUG:
          return "String_Node_Str";
case LogService.LOG_ERROR:
        return "String_Node_Str";
case LogService.LOG_INFO:
      return "String_Node_Str";
case LogService.LOG_WARNING:
    return "String_Node_Str";
default :
  return "String_Node_Str";
}
}
}
;
created=true;
}
if (created && context != null) {
context.registerService(LogService.class.getName(),logService,null);
}
return logService;
}

Fixed version (ground truth):
/** 
 * @param context if context is null, it will return a log service that uses stdout.
 * @return Either the first LogService available in the runtime if availableor a SysoutLogService.
 */
public static LogService getLogService(BundleContext context){
  final LogService logService;
  boolean created=false;
  ServiceReference sr=null;
  if (context != null)   sr=context.getServiceReference(LogService.class.getName());
  if (sr != null) {
    logService=(LogService)context.getService(sr);
  }
 else {
    logService=new LogService(){
      public void log(      int level,      String message){
        System.out.println(levelString(level) + message);
      }
      public void log(      int level,      String message,      Throwable exception){
        System.out.println(levelString(level) + message + "String_Node_Str"+ exception.toString());
        if (level == LogService.LOG_ERROR) {
          System.err.println(levelString(level) + message + "String_Node_Str"+ exception.toString());
        }
        exception.printStackTrace(new PrintWriter(System.out,true));
      }
      public void log(      ServiceReference sr,      int level,      String message){
        if (sr == null) {
          log(level,message);
          return;
        }
        if (message == null)         message="String_Node_Str";
        System.out.println(levelString(level) + "String_Node_Str" + sr.toString()+ "String_Node_Str"+ message);
        if (level == LogService.LOG_ERROR) {
          System.err.println(levelString(level) + "String_Node_Str" + sr.toString()+ "String_Node_Str"+ message);
        }
      }
      public void log(      ServiceReference sr,      int level,      String message,      Throwable exception){
        if (exception == null) {
          log(sr,level,message);
          return;
        }
        System.out.println(levelString(level) + message + "String_Node_Str"+ exception.toString());
        exception.printStackTrace(new PrintWriter(System.out,true));
        if (level == LogService.LOG_ERROR) {
          System.err.println(levelString(level) + message + "String_Node_Str"+ exception.toString());
          exception.printStackTrace(new PrintWriter(System.err,true));
        }
      }
      /** 
 * Convert the log level int into a human-readable string.  See org.osgi.service.log.LogService for details.
 * @param level log level
 * @return human-readable string
 */
      private String levelString(      int level){
switch (level) {
case LogService.LOG_DEBUG:
          return "String_Node_Str";
case LogService.LOG_ERROR:
        return "String_Node_Str";
case LogService.LOG_INFO:
      return "String_Node_Str";
case LogService.LOG_WARNING:
    return "String_Node_Str";
default :
  return "String_Node_Str";
}
}
}
;
created=true;
}
if (created && context != null) {
context.registerService(LogService.class.getName(),logService,null);
}
return logService;
}