{"action":"created","comment":{"url":"https://api.github.com/repos/nuxeo/nuxeo/pulls/comments/208933191","pull_request_review_id":144844971,"id":208933191,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODkzMzE5MQ==","diff_hunk":"@@ -100,96 +103,41 @@\n \n     private static final String FORCE_NO_CACHE_ON_MSIE = \"org.nuxeo.download.force.nocache.msie\";\n \n-    private static final String XP = \"permissions\";\n-\n-    private static final String REDIRECT_RESOLVER = \"redirectResolver\";\n-\n     private static final String RUN_FUNCTION = \"run\";\n \n     private static final Pattern FILENAME_SANITIZATION_REGEX = Pattern.compile(\";\\\\w+=.*\");\n \n     protected enum Action {\n         DOWNLOAD, DOWNLOAD_FROM_DOC, INFO, BLOBSTATUS\n-    };\n-\n-    private DownloadPermissionRegistry registry = new DownloadPermissionRegistry();\n+    }\n \n-    private ScriptEngineManager scriptEngineManager;\n+    protected ScriptEngineManager scriptEngineManager = new ScriptEngineManager();\n \n     protected RedirectResolver redirectResolver = new DefaultRedirectResolver();\n \n-    protected List<RedirectResolverDescriptor> redirectResolverContributions = new ArrayList<>();\n-\n-    public static class DownloadPermissionRegistry extends SimpleContributionRegistry<DownloadPermissionDescriptor> {\n-\n-        @Override\n-        public String getContributionId(DownloadPermissionDescriptor contrib) {\n-            return contrib.getName();\n-        }\n-\n-        @Override\n-        public boolean isSupportingMerge() {\n-            return true;\n-        }\n-\n-        @Override\n-        public DownloadPermissionDescriptor clone(DownloadPermissionDescriptor orig) {\n-            return new DownloadPermissionDescriptor(orig);\n-        }\n-\n-        @Override\n-        public void merge(DownloadPermissionDescriptor src, DownloadPermissionDescriptor dst) {\n-            dst.merge(src);\n-        }\n-\n-        public DownloadPermissionDescriptor getDownloadPermissionDescriptor(String id) {\n-            return getCurrentContribution(id);\n-        }\n-\n-        /** Returns descriptors sorted by name. */\n-        public List<DownloadPermissionDescriptor> getDownloadPermissionDescriptors() {\n-            List<DownloadPermissionDescriptor> descriptors = new ArrayList<>(currentContribs.values());\n-            Collections.sort(descriptors);\n-            return descriptors;\n-        }\n-    }\n-\n-    public DownloadServiceImpl() {\n-        scriptEngineManager = new ScriptEngineManager();\n+    @Override\n+    protected String getName() {\n+        return COMPONENT_NAME;\n     }\n \n     @Override\n-    public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) {\n-        if (XP.equals(extensionPoint)) {\n-            DownloadPermissionDescriptor descriptor = (DownloadPermissionDescriptor) contribution;\n-            registry.addContribution(descriptor);\n-        } else if (REDIRECT_RESOLVER.equals(extensionPoint)) {\n-            redirectResolver = ((RedirectResolverDescriptor) contribution).getObject();\n-            // Save contribution\n-            redirectResolverContributions.add((RedirectResolverDescriptor) contribution);\n-        } else {\n-            throw new UnsupportedOperationException(extensionPoint);\n+    public void start(ComponentContext context) {\n+        super.start(context);\n+        List<RedirectResolverDescriptor> descriptors = getDescriptors(XP_REDIRECT_RESOLVER);\n+        if (!descriptors.isEmpty()) {\n+            RedirectResolverDescriptor descriptor = descriptors.get(descriptors.size() - 1);\n+            try {\n+                redirectResolver = descriptor.klass.newInstance();\n+            } catch (ReflectiveOperationException e) {\n+                getLog().error(e);\n+            }\n         }\n     }\n \n     @Override\n-    public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) {\n-        if (XP.equals(extensionPoint)) {\n-            DownloadPermissionDescriptor descriptor = (DownloadPermissionDescriptor) contribution;\n-            registry.removeContribution(descriptor);\n-        } else if (REDIRECT_RESOLVER.equals(extensionPoint)) {\n-            redirectResolverContributions.remove(contribution);\n-            if (redirectResolverContributions.size() == 0) {\n-                // If no more custom contribution go back to the default one\n-                redirectResolver = new DefaultRedirectResolver();\n-            } else {\n-                // Go back to the last contribution added\n-                redirectResolver = redirectResolverContributions.get(redirectResolverContributions.size() - 1)\n-                                                                .getObject();\n-            }\n-        } else {\n-            throw new UnsupportedOperationException(extensionPoint);\n-        }\n+    public void stop(ComponentContext context) throws InterruptedException {\n+        super.stop(context);\n+        redirectResolver = new DefaultRedirectResolver();","path":"nuxeo-core/nuxeo-core-io/src/main/java/org/nuxeo/ecm/core/io/download/DownloadServiceImpl.java","position":155,"original_position":155,"commit_id":"8804c456f69e13b3f3fa9de3b9ef609a2367ed3e","original_commit_id":"8804c456f69e13b3f3fa9de3b9ef609a2367ed3e","user":{"login":"pierre-gautier","id":26608043,"node_id":"MDQ6VXNlcjI2NjA4MDQz","avatar_url":"https://avatars0.githubusercontent.com/u/26608043?v=4","gravatar_id":"","url":"https://api.github.com/users/pierre-gautier","html_url":"https://github.com/pierre-gautier","followers_url":"https://api.github.com/users/pierre-gautier/followers","following_url":"https://api.github.com/users/pierre-gautier/following{/other_user}","gists_url":"https://api.github.com/users/pierre-gautier/gists{/gist_id}","starred_url":"https://api.github.com/users/pierre-gautier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierre-gautier/subscriptions","organizations_url":"https://api.github.com/users/pierre-gautier/orgs","repos_url":"https://api.github.com/users/pierre-gautier/repos","events_url":"https://api.github.com/users/pierre-gautier/events{/privacy}","received_events_url":"https://api.github.com/users/pierre-gautier/received_events","type":"User","site_admin":false},"body":"Actually it's an error, I should have (and now did) put the field to null there.","created_at":"2018-08-09T13:42:43Z","updated_at":"2018-08-09T13:42:43Z","html_url":"https://github.com/nuxeo/nuxeo/pull/2211#discussion_r208933191","pull_request_url":"https://api.github.com/repos/nuxeo/nuxeo/pulls/2211","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/nuxeo/nuxeo/pulls/comments/208933191"},"html":{"href":"https://github.com/nuxeo/nuxeo/pull/2211#discussion_r208933191"},"pull_request":{"href":"https://api.github.com/repos/nuxeo/nuxeo/pulls/2211"}},"in_reply_to_id":208638183},"pull_request":{"url":"https://api.github.com/repos/nuxeo/nuxeo/pulls/2211","id":205535678,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1NTM1Njc4","html_url":"https://github.com/nuxeo/nuxeo/pull/2211","diff_url":"https://github.com/nuxeo/nuxeo/pull/2211.diff","patch_url":"https://github.com/nuxeo/nuxeo/pull/2211.patch","issue_url":"https://api.github.com/repos/nuxeo/nuxeo/issues/2211","number":2211,"state":"open","locked":false,"title":"cleanup-NXP-25186-generic-descriptor-registry","user":{"login":"nuxeojenkins","id":925456,"node_id":"MDQ6VXNlcjkyNTQ1Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/925456?v=4","gravatar_id":"","url":"https://api.github.com/users/nuxeojenkins","html_url":"https://github.com/nuxeojenkins","followers_url":"https://api.github.com/users/nuxeojenkins/followers","following_url":"https://api.github.com/users/nuxeojenkins/following{/other_user}","gists_url":"https://api.github.com/users/nuxeojenkins/gists{/gist_id}","starred_url":"https://api.github.com/users/nuxeojenkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuxeojenkins/subscriptions","organizations_url":"https://api.github.com/users/nuxeojenkins/orgs","repos_url":"https://api.github.com/users/nuxeojenkins/repos","events_url":"https://api.github.com/users/nuxeojenkins/events{/privacy}","received_events_url":"https://api.github.com/users/nuxeojenkins/received_events","type":"User","site_admin":false},"body":"PR created from https://qa.nuxeo.org/jenkins/job/TestAndPush/job/ondemand-testandpush-pierregautier/125/","created_at":"2018-08-01T19:57:06Z","updated_at":"2018-08-09T13:42:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe8a0715cacc174d8719ceaccb2fd4ecde3eb77b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/nuxeo/nuxeo/pulls/2211/commits","review_comments_url":"https://api.github.com/repos/nuxeo/nuxeo/pulls/2211/comments","review_comment_url":"https://api.github.com/repos/nuxeo/nuxeo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nuxeo/nuxeo/issues/2211/comments","statuses_url":"https://api.github.com/repos/nuxeo/nuxeo/statuses/8804c456f69e13b3f3fa9de3b9ef609a2367ed3e","head":{"label":"nuxeo:cleanup-NXP-25186-generic-descriptor-registry","ref":"cleanup-NXP-25186-generic-descriptor-registry","sha":"8804c456f69e13b3f3fa9de3b9ef609a2367ed3e","user":{"login":"nuxeo","id":460607,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ2MDYwNw==","avatar_url":"https://avatars1.githubusercontent.com/u/460607?v=4","gravatar_id":"","url":"https://api.github.com/users/nuxeo","html_url":"https://github.com/nuxeo","followers_url":"https://api.github.com/users/nuxeo/followers","following_url":"https://api.github.com/users/nuxeo/following{/other_user}","gists_url":"https://api.github.com/users/nuxeo/gists{/gist_id}","starred_url":"https://api.github.com/users/nuxeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuxeo/subscriptions","organizations_url":"https://api.github.com/users/nuxeo/orgs","repos_url":"https://api.github.com/users/nuxeo/repos","events_url":"https://api.github.com/users/nuxeo/events{/privacy}","received_events_url":"https://api.github.com/users/nuxeo/received_events","type":"Organization","site_admin":false},"repo":{"id":2988101,"node_id":"MDEwOlJlcG9zaXRvcnkyOTg4MTAx","name":"nuxeo","full_name":"nuxeo/nuxeo","owner":{"login":"nuxeo","id":460607,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ2MDYwNw==","avatar_url":"https://avatars1.githubusercontent.com/u/460607?v=4","gravatar_id":"","url":"https://api.github.com/users/nuxeo","html_url":"https://github.com/nuxeo","followers_url":"https://api.github.com/users/nuxeo/followers","following_url":"https://api.github.com/users/nuxeo/following{/other_user}","gists_url":"https://api.github.com/users/nuxeo/gists{/gist_id}","starred_url":"https://api.github.com/users/nuxeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuxeo/subscriptions","organizations_url":"https://api.github.com/users/nuxeo/orgs","repos_url":"https://api.github.com/users/nuxeo/repos","events_url":"https://api.github.com/users/nuxeo/events{/privacy}","received_events_url":"https://api.github.com/users/nuxeo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nuxeo/nuxeo","description":"Content management platform to build modern business applications","fork":false,"url":"https://api.github.com/repos/nuxeo/nuxeo","forks_url":"https://api.github.com/repos/nuxeo/nuxeo/forks","keys_url":"https://api.github.com/repos/nuxeo/nuxeo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nuxeo/nuxeo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nuxeo/nuxeo/teams","hooks_url":"https://api.github.com/repos/nuxeo/nuxeo/hooks","issue_events_url":"https://api.github.com/repos/nuxeo/nuxeo/issues/events{/number}","events_url":"https://api.github.com/repos/nuxeo/nuxeo/events","assignees_url":"https://api.github.com/repos/nuxeo/nuxeo/assignees{/user}","branches_url":"https://api.github.com/repos/nuxeo/nuxeo/branches{/branch}","tags_url":"https://api.github.com/repos/nuxeo/nuxeo/tags","blobs_url":"https://api.github.com/repos/nuxeo/nuxeo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nuxeo/nuxeo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nuxeo/nuxeo/git/refs{/sha}","trees_url":"https://api.github.com/repos/nuxeo/nuxeo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nuxeo/nuxeo/statuses/{sha}","languages_url":"https://api.github.com/repos/nuxeo/nuxeo/languages","stargazers_url":"https://api.github.com/repos/nuxeo/nuxeo/stargazers","contributors_url":"https://api.github.com/repos/nuxeo/nuxeo/contributors","subscribers_url":"https://api.github.com/repos/nuxeo/nuxeo/subscribers","subscription_url":"https://api.github.com/repos/nuxeo/nuxeo/subscription","commits_url":"https://api.github.com/repos/nuxeo/nuxeo/commits{/sha}","git_commits_url":"https://api.github.com/repos/nuxeo/nuxeo/git/commits{/sha}","comments_url":"https://api.github.com/repos/nuxeo/nuxeo/comments{/number}","issue_comment_url":"https://api.github.com/repos/nuxeo/nuxeo/issues/comments{/number}","contents_url":"https://api.github.com/repos/nuxeo/nuxeo/contents/{+path}","compare_url":"https://api.github.com/repos/nuxeo/nuxeo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nuxeo/nuxeo/merges","archive_url":"https://api.github.com/repos/nuxeo/nuxeo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nuxeo/nuxeo/downloads","issues_url":"https://api.github.com/repos/nuxeo/nuxeo/issues{/number}","pulls_url":"https://api.github.com/repos/nuxeo/nuxeo/pulls{/number}","milestones_url":"https://api.github.com/repos/nuxeo/nuxeo/milestones{/number}","notifications_url":"https://api.github.com/repos/nuxeo/nuxeo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nuxeo/nuxeo/labels{/name}","releases_url":"https://api.github.com/repos/nuxeo/nuxeo/releases{/id}","deployments_url":"https://api.github.com/repos/nuxeo/nuxeo/deployments","created_at":"2011-12-15T14:35:41Z","updated_at":"2018-08-09T06:29:15Z","pushed_at":"2018-08-09T04:59:10Z","git_url":"git://github.com/nuxeo/nuxeo.git","ssh_url":"git@github.com:nuxeo/nuxeo.git","clone_url":"https://github.com/nuxeo/nuxeo.git","svn_url":"https://github.com/nuxeo/nuxeo","homepage":"http://www.nuxeo.com","size":232091,"stargazers_count":234,"watchers_count":234,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":159,"mirror_url":null,"archived":false,"open_issues_count":19,"license":null,"forks":159,"open_issues":19,"watchers":234,"default_branch":"master"}},"base":{"label":"nuxeo:master","ref":"master","sha":"9cfb702660cff7277c69ad11897c1b7cedac5d1f","user":{"login":"nuxeo","id":460607,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ2MDYwNw==","avatar_url":"https://avatars1.githubusercontent.com/u/460607?v=4","gravatar_id":"","url":"https://api.github.com/users/nuxeo","html_url":"https://github.com/nuxeo","followers_url":"https://api.github.com/users/nuxeo/followers","following_url":"https://api.github.com/users/nuxeo/following{/other_user}","gists_url":"https://api.github.com/users/nuxeo/gists{/gist_id}","starred_url":"https://api.github.com/users/nuxeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuxeo/subscriptions","organizations_url":"https://api.github.com/users/nuxeo/orgs","repos_url":"https://api.github.com/users/nuxeo/repos","events_url":"https://api.github.com/users/nuxeo/events{/privacy}","received_events_url":"https://api.github.com/users/nuxeo/received_events","type":"Organization","site_admin":false},"repo":{"id":2988101,"node_id":"MDEwOlJlcG9zaXRvcnkyOTg4MTAx","name":"nuxeo","full_name":"nuxeo/nuxeo","owner":{"login":"nuxeo","id":460607,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ2MDYwNw==","avatar_url":"https://avatars1.githubusercontent.com/u/460607?v=4","gravatar_id":"","url":"https://api.github.com/users/nuxeo","html_url":"https://github.com/nuxeo","followers_url":"https://api.github.com/users/nuxeo/followers","following_url":"https://api.github.com/users/nuxeo/following{/other_user}","gists_url":"https://api.github.com/users/nuxeo/gists{/gist_id}","starred_url":"https://api.github.com/users/nuxeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuxeo/subscriptions","organizations_url":"https://api.github.com/users/nuxeo/orgs","repos_url":"https://api.github.com/users/nuxeo/repos","events_url":"https://api.github.com/users/nuxeo/events{/privacy}","received_events_url":"https://api.github.com/users/nuxeo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nuxeo/nuxeo","description":"Content management platform to build modern business applications","fork":false,"url":"https://api.github.com/repos/nuxeo/nuxeo","forks_url":"https://api.github.com/repos/nuxeo/nuxeo/forks","keys_url":"https://api.github.com/repos/nuxeo/nuxeo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nuxeo/nuxeo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nuxeo/nuxeo/teams","hooks_url":"https://api.github.com/repos/nuxeo/nuxeo/hooks","issue_events_url":"https://api.github.com/repos/nuxeo/nuxeo/issues/events{/number}","events_url":"https://api.github.com/repos/nuxeo/nuxeo/events","assignees_url":"https://api.github.com/repos/nuxeo/nuxeo/assignees{/user}","branches_url":"https://api.github.com/repos/nuxeo/nuxeo/branches{/branch}","tags_url":"https://api.github.com/repos/nuxeo/nuxeo/tags","blobs_url":"https://api.github.com/repos/nuxeo/nuxeo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nuxeo/nuxeo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nuxeo/nuxeo/git/refs{/sha}","trees_url":"https://api.github.com/repos/nuxeo/nuxeo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nuxeo/nuxeo/statuses/{sha}","languages_url":"https://api.github.com/repos/nuxeo/nuxeo/languages","stargazers_url":"https://api.github.com/repos/nuxeo/nuxeo/stargazers","contributors_url":"https://api.github.com/repos/nuxeo/nuxeo/contributors","subscribers_url":"https://api.github.com/repos/nuxeo/nuxeo/subscribers","subscription_url":"https://api.github.com/repos/nuxeo/nuxeo/subscription","commits_url":"https://api.github.com/repos/nuxeo/nuxeo/commits{/sha}","git_commits_url":"https://api.github.com/repos/nuxeo/nuxeo/git/commits{/sha}","comments_url":"https://api.github.com/repos/nuxeo/nuxeo/comments{/number}","issue_comment_url":"https://api.github.com/repos/nuxeo/nuxeo/issues/comments{/number}","contents_url":"https://api.github.com/repos/nuxeo/nuxeo/contents/{+path}","compare_url":"https://api.github.com/repos/nuxeo/nuxeo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nuxeo/nuxeo/merges","archive_url":"https://api.github.com/repos/nuxeo/nuxeo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nuxeo/nuxeo/downloads","issues_url":"https://api.github.com/repos/nuxeo/nuxeo/issues{/number}","pulls_url":"https://api.github.com/repos/nuxeo/nuxeo/pulls{/number}","milestones_url":"https://api.github.com/repos/nuxeo/nuxeo/milestones{/number}","notifications_url":"https://api.github.com/repos/nuxeo/nuxeo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nuxeo/nuxeo/labels{/name}","releases_url":"https://api.github.com/repos/nuxeo/nuxeo/releases{/id}","deployments_url":"https://api.github.com/repos/nuxeo/nuxeo/deployments","created_at":"2011-12-15T14:35:41Z","updated_at":"2018-08-09T06:29:15Z","pushed_at":"2018-08-09T04:59:10Z","git_url":"git://github.com/nuxeo/nuxeo.git","ssh_url":"git@github.com:nuxeo/nuxeo.git","clone_url":"https://github.com/nuxeo/nuxeo.git","svn_url":"https://github.com/nuxeo/nuxeo","homepage":"http://www.nuxeo.com","size":232091,"stargazers_count":234,"watchers_count":234,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":159,"mirror_url":null,"archived":false,"open_issues_count":19,"license":null,"forks":159,"open_issues":19,"watchers":234,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nuxeo/nuxeo/pulls/2211"},"html":{"href":"https://github.com/nuxeo/nuxeo/pull/2211"},"issue":{"href":"https://api.github.com/repos/nuxeo/nuxeo/issues/2211"},"comments":{"href":"https://api.github.com/repos/nuxeo/nuxeo/issues/2211/comments"},"review_comments":{"href":"https://api.github.com/repos/nuxeo/nuxeo/pulls/2211/comments"},"review_comment":{"href":"https://api.github.com/repos/nuxeo/nuxeo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nuxeo/nuxeo/pulls/2211/commits"},"statuses":{"href":"https://api.github.com/repos/nuxeo/nuxeo/statuses/8804c456f69e13b3f3fa9de3b9ef609a2367ed3e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"pierre-gautier"}}