public QueryResult<File> link(String studyStr, URI uriOrigin, String pathDestiny, ObjectMap params, String sessionId) throws CatalogException, IOException { // We make two attempts to link to ensure the behaviour remains even if it is being called at the same time link from different // threads String userId = userManager.getUserId(sessionId); Study study = catalogManager.getStudyManager().resolveId(studyStr, userId); try { return privateLink(study, uriOrigin, pathDestiny, params, sessionId); } catch (CatalogException | IOException e) { return privateLink(study, uriOrigin, pathDestiny, params, sessionId); } }