Program: 13178
Project: 13178
Buggy source:
@Override public Promise<ResourceResponse,ResourceException> createInstance(Context context,CreateRequest request){
  String resourceId=request.getNewResourceId();
  JsonValue content=request.getContent();
  if (!content.get(FIELD_CONTENT_ID).isNull()) {
    resourceId=content.get(FIELD_CONTENT_ID).asString();
  }
  logger.debug("String_Node_Str",name,resourceId);
  try {
    JsonValue value=decrypt(content);
    final JsonValue persistedRelationships=persistRelationships(context,resourceId,value);
    value.asMap().putAll(persistedRelationships.asMap());
    execScript(context,ScriptHook.onCreate,value,null);
    populateVirtualProperties(context,value);
    value=stripRelationshipFields(value);
    onStore(context,value);
    CreateRequest createRequest=Requests.newCreateRequest(repoId(null),resourceId,value);
    ResourceResponse createResponse=connectionFactory.getConnection().create(context,createRequest);
    activityLogger.log(context,request,"String_Node_Str",managedId(createResponse.getId()).toString(),null,createResponse.getContent(),Status.SUCCESS);
    createResponse.getContent().asMap().putAll(persistedRelationships.asMap());
    execScript(context,ScriptHook.postCreate,createResponse.getContent(),prepareScriptBindings(context,request,resourceId,new JsonValue(null),createResponse.getContent()));
    performSyncAction(context,request,createResponse.getId(),SynchronizationService.SyncServiceAction.notifyCreate,new JsonValue(null),createResponse.getContent());
    return prepareResponse(context,createResponse,request.getFields()).asPromise();
  }
 catch (  ResourceException e) {
    return e.asPromise();
  }
catch (  Exception e) {
    return new InternalServerErrorException(e.getMessage(),e).asPromise();
  }
}

Fixed version (ground truth):
@Override public Promise<ResourceResponse,ResourceException> createInstance(Context context,CreateRequest request){
  String resourceId=request.getNewResourceId();
  JsonValue content=request.getContent();
  if (!content.get(FIELD_CONTENT_ID).isNull()) {
    resourceId=content.get(FIELD_CONTENT_ID).asString();
  }
  logger.debug("String_Node_Str",name,resourceId);
  try {
    JsonValue value=decrypt(content);
    value.asMap().putAll(persistRelationships(context,resourceId,value).asMap());
    execScript(context,ScriptHook.onCreate,value,null);
    populateVirtualProperties(context,value);
    JsonValue strippedRelationshipFields=stripRelationshipFields(value);
    onStore(context,value);
    CreateRequest createRequest=Requests.newCreateRequest(repoId(null),resourceId,value);
    ResourceResponse createResponse=connectionFactory.getConnection().create(context,createRequest);
    activityLogger.log(context,request,"String_Node_Str",managedId(createResponse.getId()).toString(),null,createResponse.getContent(),Status.SUCCESS);
    createResponse.getContent().asMap().putAll(strippedRelationshipFields.asMap());
    execScript(context,ScriptHook.postCreate,createResponse.getContent(),prepareScriptBindings(context,request,resourceId,new JsonValue(null),createResponse.getContent()));
    performSyncAction(context,request,createResponse.getId(),SynchronizationService.SyncServiceAction.notifyCreate,new JsonValue(null),createResponse.getContent());
    return prepareResponse(context,createResponse,request.getFields()).asPromise();
  }
 catch (  ResourceException e) {
    return e.asPromise();
  }
catch (  Exception e) {
    return new InternalServerErrorException(e.getMessage(),e).asPromise();
  }
}