Program: 8817
Project: 8817
Buggy source:
private void registerNodeStore() throws IOException {
  String uri=PropertiesUtil.toString(prop(PROP_URI,FWK_PROP_URI),DEFAULT_URI);
  String db=PropertiesUtil.toString(prop(PROP_DB,FWK_PROP_DB),DEFAULT_DB);
  int offHeapCache=toInteger(prop(PROP_OFF_HEAP_CACHE),DEFAULT_OFF_HEAP_CACHE);
  int cacheSize=toInteger(prop(PROP_CACHE),DEFAULT_CACHE);
  int nodeCachePercentage=toInteger(prop(PROP_NODE_CACHE_PERCENTAGE),DEFAULT_NODE_CACHE_PERCENTAGE);
  int childrenCachePercentage=toInteger(prop(PROP_CHILDREN_CACHE_PERCENTAGE),DEFAULT_CHILDREN_CACHE_PERCENTAGE);
  int docChildrenCachePercentage=toInteger(prop(PROP_DOC_CHILDREN_CACHE_PERCENTAGE),DEFAULT_DOC_CHILDREN_CACHE_PERCENTAGE);
  int diffCachePercentage=toInteger(prop(PROP_DIFF_CACHE_PERCENTAGE),DEFAULT_DIFF_CACHE_PERCENTAGE);
  int changesSize=toInteger(prop(PROP_CHANGES_SIZE),DEFAULT_CHANGES_SIZE);
  int blobCacheSize=toInteger(prop(PROP_BLOB_CACHE_SIZE),DEFAULT_BLOB_CACHE_SIZE);
  String persistentCache=PropertiesUtil.toString(prop(PROP_PERSISTENT_CACHE),DEFAULT_PERSISTENT_CACHE);
  int cacheSegmentCount=toInteger(prop(PROP_CACHE_SEGMENT_COUNT),DEFAULT_CACHE_SEGMENT_COUNT);
  int cacheStackMoveDistance=toInteger(prop(PROP_CACHE_STACK_MOVE_DISTANCE),DEFAULT_CACHE_STACK_MOVE_DISTANCE);
  DocumentMK.Builder mkBuilder=new DocumentMK.Builder().memoryCacheSize(cacheSize * MB).memoryCacheDistribution(nodeCachePercentage,childrenCachePercentage,docChildrenCachePercentage,diffCachePercentage).setCacheSegmentCount(cacheSegmentCount).setCacheStackMoveDistance(cacheStackMoveDistance).offHeapCacheSize(offHeapCache * MB);
  if (persistentCache != null && persistentCache.length() > 0) {
    mkBuilder.setPersistentCache(persistentCache);
  }
  if (customBlobStore) {
    checkNotNull(blobStore,"String_Node_Str" + "String_Node_Str",CUSTOM_BLOB_STORE);
    mkBuilder.setBlobStore(blobStore);
  }
  if (documentStoreType == DocumentStoreType.RDB) {
    checkNotNull(dataSource,"String_Node_Str",PROP_DS_TYPE);
    if (!customBlobStore) {
      checkNotNull(blobDataSource,"String_Node_Str",PROP_DS_TYPE);
      mkBuilder.setRDBConnection(dataSource,blobDataSource);
      log.info("String_Node_Str",dataSource,blobDataSource);
    }
 else {
      if (blobDataSource != null && blobDataSource != dataSource) {
        log.info("String_Node_Str",blobDataSource);
      }
      mkBuilder.setRDBConnection(dataSource);
      log.info("String_Node_Str",dataSource);
    }
  }
 else {
    MongoClientOptions.Builder builder=MongoConnection.getDefaultBuilder();
    MongoClientURI mongoURI=new MongoClientURI(uri,builder);
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str" + "String_Node_Str",mongoURI.getHosts(),db,cacheSize,persistentCache,changesSize,blobCacheSize,maxReplicationLagInSecs);
      log.info("String_Node_Str",MongoConnection.toString(mongoURI.getOptions()));
    }
    MongoClient client=new MongoClient(mongoURI);
    DB mongoDB=client.getDB(db);
    mkBuilder.setMaxReplicationLag(maxReplicationLagInSecs,TimeUnit.SECONDS);
    mkBuilder.setMongoDB(mongoDB,changesSize,blobCacheSize);
    log.info("String_Node_Str",mongoDB);
  }
  mkBuilder.setExecutor(executor);
  mk=mkBuilder.open();
  if (SharedDataStoreUtils.isShared(blobStore)) {
    try {
      String repoId=ClusterRepositoryInfo.createId(mk.getNodeStore());
      ((SharedDataStore)blobStore).addMetadataRecord(new ByteArrayInputStream(new byte[0]),SharedDataStoreUtils.SharedStoreRecordType.REPOSITORY.getNameFromId(repoId));
    }
 catch (    Exception e) {
      throw new IOException("String_Node_Str",e);
    }
  }
  registerJMXBeans(mk.getNodeStore());
  registerLastRevRecoveryJob(mk.getNodeStore());
  registerJournalGC(mk.getNodeStore());
  NodeStore store;
  DocumentNodeStore mns=mk.getNodeStore();
  store=mns;
  observerTracker=new ObserverTracker(mns);
  observerTracker.start(context.getBundleContext());
  DocumentStore ds=mk.getDocumentStore();
  final long maxDiff=Long.parseLong(System.getProperty("String_Node_Str","String_Node_Str"));
  try {
    final long timeDiff=ds.determineServerTimeDifferenceMillis();
    log.info("String_Node_Str",timeDiff,maxDiff);
    if (Math.abs(timeDiff) > Math.abs(maxDiff)) {
      throw new IllegalStateException("String_Node_Str" + timeDiff + "String_Node_Str"+ maxDiff+ "String_Node_Str");
    }
  }
 catch (  RuntimeException e) {
    log.warn("String_Node_Str" + e,e);
  }
  Dictionary<String,Object> props=new Hashtable<String,Object>();
  props.put(Constants.SERVICE_PID,DocumentNodeStore.class.getName());
  props.put(DESCRIPTION,getMetadata(ds));
  reg=context.getBundleContext().registerService(NodeStore.class.getName(),store,props);
}

Fixed version (ground truth):
private void registerNodeStore() throws IOException {
  String uri=PropertiesUtil.toString(prop(PROP_URI,FWK_PROP_URI),DEFAULT_URI);
  String db=PropertiesUtil.toString(prop(PROP_DB,FWK_PROP_DB),DEFAULT_DB);
  int offHeapCache=toInteger(prop(PROP_OFF_HEAP_CACHE),DEFAULT_OFF_HEAP_CACHE);
  int cacheSize=toInteger(prop(PROP_CACHE),DEFAULT_CACHE);
  int nodeCachePercentage=toInteger(prop(PROP_NODE_CACHE_PERCENTAGE),DEFAULT_NODE_CACHE_PERCENTAGE);
  int childrenCachePercentage=toInteger(prop(PROP_CHILDREN_CACHE_PERCENTAGE),DEFAULT_CHILDREN_CACHE_PERCENTAGE);
  int docChildrenCachePercentage=toInteger(prop(PROP_DOC_CHILDREN_CACHE_PERCENTAGE),DEFAULT_DOC_CHILDREN_CACHE_PERCENTAGE);
  int diffCachePercentage=toInteger(prop(PROP_DIFF_CACHE_PERCENTAGE),DEFAULT_DIFF_CACHE_PERCENTAGE);
  int changesSize=toInteger(prop(PROP_CHANGES_SIZE),DEFAULT_CHANGES_SIZE);
  int blobCacheSize=toInteger(prop(PROP_BLOB_CACHE_SIZE),DEFAULT_BLOB_CACHE_SIZE);
  String persistentCache=PropertiesUtil.toString(prop(PROP_PERSISTENT_CACHE),DEFAULT_PERSISTENT_CACHE);
  int cacheSegmentCount=toInteger(prop(PROP_CACHE_SEGMENT_COUNT),DEFAULT_CACHE_SEGMENT_COUNT);
  int cacheStackMoveDistance=toInteger(prop(PROP_CACHE_STACK_MOVE_DISTANCE),DEFAULT_CACHE_STACK_MOVE_DISTANCE);
  DocumentMK.Builder mkBuilder=new DocumentMK.Builder().memoryCacheSize(cacheSize * MB).memoryCacheDistribution(nodeCachePercentage,childrenCachePercentage,docChildrenCachePercentage,diffCachePercentage).setCacheSegmentCount(cacheSegmentCount).setCacheStackMoveDistance(cacheStackMoveDistance).offHeapCacheSize(offHeapCache * MB);
  if (persistentCache != null && persistentCache.length() > 0) {
    mkBuilder.setPersistentCache(persistentCache);
  }
  if (customBlobStore) {
    checkNotNull(blobStore,"String_Node_Str" + "String_Node_Str",CUSTOM_BLOB_STORE);
    mkBuilder.setBlobStore(blobStore);
  }
  if (documentStoreType == DocumentStoreType.RDB) {
    checkNotNull(dataSource,"String_Node_Str",PROP_DS_TYPE);
    if (!customBlobStore) {
      checkNotNull(blobDataSource,"String_Node_Str",PROP_DS_TYPE);
      mkBuilder.setRDBConnection(dataSource,blobDataSource);
      log.info("String_Node_Str",dataSource,blobDataSource);
    }
 else {
      if (blobDataSource != null && blobDataSource != dataSource) {
        log.info("String_Node_Str",blobDataSource);
      }
      mkBuilder.setRDBConnection(dataSource);
      log.info("String_Node_Str",dataSource);
    }
  }
 else {
    MongoClientOptions.Builder builder=MongoConnection.getDefaultBuilder();
    MongoClientURI mongoURI=new MongoClientURI(uri,builder);
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str" + "String_Node_Str",mongoURI.getHosts(),db,cacheSize,persistentCache,changesSize,blobCacheSize,maxReplicationLagInSecs);
      log.info("String_Node_Str",MongoConnection.toString(mongoURI.getOptions()));
    }
    MongoClient client=new MongoClient(mongoURI);
    DB mongoDB=client.getDB(db);
    mkBuilder.setMaxReplicationLag(maxReplicationLagInSecs,TimeUnit.SECONDS);
    mkBuilder.setMongoDB(mongoDB,changesSize,blobCacheSize);
    log.info("String_Node_Str",mongoDB);
  }
  mkBuilder.setExecutor(executor);
  mk=mkBuilder.open();
  if (SharedDataStoreUtils.isShared(blobStore)) {
    try {
      String repoId=ClusterRepositoryInfo.createId(mk.getNodeStore());
      ((SharedDataStore)blobStore).addMetadataRecord(new ByteArrayInputStream(new byte[0]),SharedDataStoreUtils.SharedStoreRecordType.REPOSITORY.getNameFromId(repoId));
    }
 catch (    Exception e) {
      throw new IOException("String_Node_Str",e);
    }
  }
  registerJMXBeans(mk.getNodeStore());
  registerLastRevRecoveryJob(mk.getNodeStore());
  registerJournalGC(mk.getNodeStore());
  NodeStore store;
  DocumentNodeStore mns=mk.getNodeStore();
  store=mns;
  observerTracker=new ObserverTracker(mns);
  observerTracker.start(context.getBundleContext());
  DocumentStore ds=mk.getDocumentStore();
  final long maxDiff=Long.parseLong(System.getProperty("String_Node_Str","String_Node_Str"));
  try {
    final long timeDiff=ds.determineServerTimeDifferenceMillis();
    log.info("String_Node_Str",timeDiff,maxDiff);
    if (Math.abs(timeDiff) > Math.abs(maxDiff)) {
      throw new AssertionError("String_Node_Str" + timeDiff + "String_Node_Str"+ maxDiff+ "String_Node_Str");
    }
  }
 catch (  RuntimeException e) {
    log.warn("String_Node_Str" + e,e);
  }
  Dictionary<String,Object> props=new Hashtable<String,Object>();
  props.put(Constants.SERVICE_PID,DocumentNodeStore.class.getName());
  props.put(DESCRIPTION,getMetadata(ds));
  reg=context.getBundleContext().registerService(NodeStore.class.getName(),store,props);
}