Program: 13160
Project: 13160
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);
    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);
    content=createResponse.getContent();
    resourceId=createResponse.getId();
    activityLogger.log(context,request,"String_Node_Str",managedId(resourceId).toString(),null,content,Status.SUCCESS);
    content.asMap().putAll(strippedRelationshipFields.asMap());
    content.asMap().putAll(persistRelationships(context,resourceId,value).asMap());
    execScript(context,ScriptHook.postCreate,content,prepareScriptBindings(context,request,resourceId,new JsonValue(null),content));
    performSyncAction(context,request,resourceId,SynchronizationService.SyncServiceAction.notifyCreate,new JsonValue(null),content);
    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);
    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);
    content=createResponse.getContent();
    resourceId=createResponse.getId();
    activityLogger.log(context,request,"String_Node_Str",managedId(resourceId).toString(),null,content,Status.SUCCESS);
    content.asMap().putAll(strippedRelationshipFields.asMap());
    content.asMap().putAll(persistRelationships(context,resourceId,content).asMap());
    execScript(context,ScriptHook.postCreate,content,prepareScriptBindings(context,request,resourceId,new JsonValue(null),content));
    performSyncAction(context,request,resourceId,SynchronizationService.SyncServiceAction.notifyCreate,new JsonValue(null),content);
    return prepareResponse(context,createResponse,request.getFields()).asPromise();
  }
 catch (  ResourceException e) {
    return e.asPromise();
  }
catch (  Exception e) {
    return new InternalServerErrorException(e.getMessage(),e).asPromise();
  }
}