Program: 94922
Project: 94922
Buggy source:
@Override public void run(){
  final ByteBuffer logBuffer=ByteBuffer.allocate(Long.SIZE / Byte.SIZE);
  logBuffer.order(ByteOrder.BIG_ENDIAN);
  try {
    while (mConnectionStatus.get() == MAVLINK_CONNECTED) {
      final byte[] packetData=mPacketsToLog.take();
      logBuffer.clear();
      logBuffer.putLong(System.currentTimeMillis() * 1000);
      for (      Map.Entry<String,Pair<String,BufferedOutputStream>> entry : loggingOutStreams.entrySet()) {
        final Pair<String,BufferedOutputStream> logInfo=entry.getValue();
        final String loggingFilePath=logInfo.first;
        try {
          BufferedOutputStream logWriter=logInfo.second;
          if (logWriter == null) {
            logWriter=new BufferedOutputStream(new FileOutputStream(loggingFilePath));
            loggingOutStreams.put(entry.getKey(),Pair.create(loggingFilePath,logWriter));
          }
          logWriter.write(logBuffer.array());
          logWriter.write(packetData);
        }
 catch (        IOException e) {
          mLogger.logErr(TAG,"String_Node_Str" + loggingFilePath,e);
        }
      }
    }
  }
 catch (  InterruptedException e) {
    final String errorMessage=e.getMessage();
    if (errorMessage != null)     mLogger.logVerbose(TAG,errorMessage);
  }
 finally {
    for (    Pair<String,BufferedOutputStream> entry : loggingOutStreams.values()) {
      final String loggingFilePath=entry.first;
      try {
        entry.second.close();
      }
 catch (      IOException e) {
        mLogger.logErr(TAG,"String_Node_Str" + loggingFilePath,e);
      }
    }
    loggingOutStreams.clear();
  }
}

Fixed version (ground truth):
@Override public void run(){
  final ByteBuffer logBuffer=ByteBuffer.allocate(Long.SIZE / Byte.SIZE);
  logBuffer.order(ByteOrder.BIG_ENDIAN);
  try {
    while (mConnectionStatus.get() == MAVLINK_CONNECTED) {
      final byte[] packetData=mPacketsToLog.take();
      logBuffer.clear();
      logBuffer.putLong(System.currentTimeMillis() * 1000);
      for (      Map.Entry<String,Pair<String,BufferedOutputStream>> entry : loggingOutStreams.entrySet()) {
        final Pair<String,BufferedOutputStream> logInfo=entry.getValue();
        final String loggingFilePath=logInfo.first;
        try {
          BufferedOutputStream logWriter=logInfo.second;
          if (logWriter == null) {
            logWriter=new BufferedOutputStream(new FileOutputStream(loggingFilePath));
            loggingOutStreams.put(entry.getKey(),Pair.create(loggingFilePath,logWriter));
          }
          logWriter.write(logBuffer.array());
          logWriter.write(packetData);
        }
 catch (        IOException e) {
          mLogger.logErr(TAG,"String_Node_Str" + loggingFilePath,e);
        }
      }
    }
  }
 catch (  InterruptedException e) {
    final String errorMessage=e.getMessage();
    if (errorMessage != null)     mLogger.logVerbose(TAG,errorMessage);
  }
 finally {
    for (    Pair<String,BufferedOutputStream> entry : loggingOutStreams.values()) {
      final String loggingFilePath=entry.first;
      try {
        if (entry.second != null)         entry.second.close();
      }
 catch (      IOException e) {
        mLogger.logErr(TAG,"String_Node_Str" + loggingFilePath,e);
      }
    }
    loggingOutStreams.clear();
  }
}