{"action":"created","comment":{"url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/pulls/comments/27814014","id":27814014,"diff_hunk":"@@ -205,23 +205,27 @@ private void execute(URL src, Project project) throws IOException {\n      * server if the given timestamp is greater than 0.\n      * @param src the source URL to open a connection for\n      * @param timestamp the timestamp of the destination file\n+     * @param length the length of the destination file\n      * @param project the project to be built\n      * @return the URLConnection or null if the download should be skipped\n      * @throws IOException if the connection could not be opened\n      */\n-    private URLConnection openConnection(URL src, long timestamp,\n+    private URLConnection openConnection(URL src, long timestamp, long length,\n             Project project) throws IOException {\n         int redirects = MAX_NUMBER_OF_REDIRECTS;\n         \n         URLConnection uc = src.openConnection();\n         while (true) {\n-            if (uc instanceof HttpURLConnection) {\n+            long contentLength = parseContentLength(uc);\n+            uc = uc.getURL().openConnection();","path":"src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java","position":27,"original_position":27,"commit_id":"95837152dc4aa21375366b567dcb73f854ab1b41","original_commit_id":"95837152dc4aa21375366b567dcb73f854ab1b41","user":{"login":"michel-kraemer","id":295407,"avatar_url":"https://avatars.githubusercontent.com/u/295407?v=3","gravatar_id":"","url":"https://api.github.com/users/michel-kraemer","html_url":"https://github.com/michel-kraemer","followers_url":"https://api.github.com/users/michel-kraemer/followers","following_url":"https://api.github.com/users/michel-kraemer/following{/other_user}","gists_url":"https://api.github.com/users/michel-kraemer/gists{/gist_id}","starred_url":"https://api.github.com/users/michel-kraemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michel-kraemer/subscriptions","organizations_url":"https://api.github.com/users/michel-kraemer/orgs","repos_url":"https://api.github.com/users/michel-kraemer/repos","events_url":"https://api.github.com/users/michel-kraemer/events{/privacy}","received_events_url":"https://api.github.com/users/michel-kraemer/received_events","type":"User","site_admin":false},"body":"Wouldn't it be better to do the whole thing after line 160 where the content length is requested anyhow? Just guessing. I need to check this more in detail, but I guess it would make the code a lot more cleaner. WDYT?","created_at":"2015-04-06T17:45:41Z","updated_at":"2015-04-06T17:45:41Z","html_url":"https://github.com/michel-kraemer/gradle-download-task/pull/22#discussion_r27814014","pull_request_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/michel-kraemer/gradle-download-task/pulls/comments/27814014"},"html":{"href":"https://github.com/michel-kraemer/gradle-download-task/pull/22#discussion_r27814014"},"pull_request":{"href":"https://api.github.com/repos/michel-kraemer/gradle-download-task/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/pulls/22","id":32652483,"html_url":"https://github.com/michel-kraemer/gradle-download-task/pull/22","diff_url":"https://github.com/michel-kraemer/gradle-download-task/pull/22.diff","patch_url":"https://github.com/michel-kraemer/gradle-download-task/pull/22.patch","issue_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/issues/22","number":22,"state":"open","locked":false,"title":"onlyIfNewer with behavior like in wget","user":{"login":"tcury","id":7295526,"avatar_url":"https://avatars.githubusercontent.com/u/7295526?v=3","gravatar_id":"","url":"https://api.github.com/users/tcury","html_url":"https://github.com/tcury","followers_url":"https://api.github.com/users/tcury/followers","following_url":"https://api.github.com/users/tcury/following{/other_user}","gists_url":"https://api.github.com/users/tcury/gists{/gist_id}","starred_url":"https://api.github.com/users/tcury/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcury/subscriptions","organizations_url":"https://api.github.com/users/tcury/orgs","repos_url":"https://api.github.com/users/tcury/repos","events_url":"https://api.github.com/users/tcury/events{/privacy}","received_events_url":"https://api.github.com/users/tcury/received_events","type":"User","site_admin":false},"body":"If the sizes of the files do not match, download the remote file no matter what the time-stamps says.","created_at":"2015-04-05T18:40:55Z","updated_at":"2015-04-06T17:45:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8bc7d7a22c0edc47e094a7859abf7486128fdc74","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/pulls/22/commits","review_comments_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/pulls/22/comments","review_comment_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/pulls/comments{/number}","comments_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/issues/22/comments","statuses_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/statuses/95837152dc4aa21375366b567dcb73f854ab1b41","head":{"label":"tcury:master","ref":"master","sha":"95837152dc4aa21375366b567dcb73f854ab1b41","user":{"login":"tcury","id":7295526,"avatar_url":"https://avatars.githubusercontent.com/u/7295526?v=3","gravatar_id":"","url":"https://api.github.com/users/tcury","html_url":"https://github.com/tcury","followers_url":"https://api.github.com/users/tcury/followers","following_url":"https://api.github.com/users/tcury/following{/other_user}","gists_url":"https://api.github.com/users/tcury/gists{/gist_id}","starred_url":"https://api.github.com/users/tcury/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcury/subscriptions","organizations_url":"https://api.github.com/users/tcury/orgs","repos_url":"https://api.github.com/users/tcury/repos","events_url":"https://api.github.com/users/tcury/events{/privacy}","received_events_url":"https://api.github.com/users/tcury/received_events","type":"User","site_admin":false},"repo":{"id":33321649,"name":"gradle-download-task","full_name":"tcury/gradle-download-task","owner":{"login":"tcury","id":7295526,"avatar_url":"https://avatars.githubusercontent.com/u/7295526?v=3","gravatar_id":"","url":"https://api.github.com/users/tcury","html_url":"https://github.com/tcury","followers_url":"https://api.github.com/users/tcury/followers","following_url":"https://api.github.com/users/tcury/following{/other_user}","gists_url":"https://api.github.com/users/tcury/gists{/gist_id}","starred_url":"https://api.github.com/users/tcury/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcury/subscriptions","organizations_url":"https://api.github.com/users/tcury/orgs","repos_url":"https://api.github.com/users/tcury/repos","events_url":"https://api.github.com/users/tcury/events{/privacy}","received_events_url":"https://api.github.com/users/tcury/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tcury/gradle-download-task","description":"Adds a download task to Gradle that displays progress information","fork":true,"url":"https://api.github.com/repos/tcury/gradle-download-task","forks_url":"https://api.github.com/repos/tcury/gradle-download-task/forks","keys_url":"https://api.github.com/repos/tcury/gradle-download-task/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tcury/gradle-download-task/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tcury/gradle-download-task/teams","hooks_url":"https://api.github.com/repos/tcury/gradle-download-task/hooks","issue_events_url":"https://api.github.com/repos/tcury/gradle-download-task/issues/events{/number}","events_url":"https://api.github.com/repos/tcury/gradle-download-task/events","assignees_url":"https://api.github.com/repos/tcury/gradle-download-task/assignees{/user}","branches_url":"https://api.github.com/repos/tcury/gradle-download-task/branches{/branch}","tags_url":"https://api.github.com/repos/tcury/gradle-download-task/tags","blobs_url":"https://api.github.com/repos/tcury/gradle-download-task/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tcury/gradle-download-task/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tcury/gradle-download-task/git/refs{/sha}","trees_url":"https://api.github.com/repos/tcury/gradle-download-task/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tcury/gradle-download-task/statuses/{sha}","languages_url":"https://api.github.com/repos/tcury/gradle-download-task/languages","stargazers_url":"https://api.github.com/repos/tcury/gradle-download-task/stargazers","contributors_url":"https://api.github.com/repos/tcury/gradle-download-task/contributors","subscribers_url":"https://api.github.com/repos/tcury/gradle-download-task/subscribers","subscription_url":"https://api.github.com/repos/tcury/gradle-download-task/subscription","commits_url":"https://api.github.com/repos/tcury/gradle-download-task/commits{/sha}","git_commits_url":"https://api.github.com/repos/tcury/gradle-download-task/git/commits{/sha}","comments_url":"https://api.github.com/repos/tcury/gradle-download-task/comments{/number}","issue_comment_url":"https://api.github.com/repos/tcury/gradle-download-task/issues/comments{/number}","contents_url":"https://api.github.com/repos/tcury/gradle-download-task/contents/{+path}","compare_url":"https://api.github.com/repos/tcury/gradle-download-task/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tcury/gradle-download-task/merges","archive_url":"https://api.github.com/repos/tcury/gradle-download-task/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tcury/gradle-download-task/downloads","issues_url":"https://api.github.com/repos/tcury/gradle-download-task/issues{/number}","pulls_url":"https://api.github.com/repos/tcury/gradle-download-task/pulls{/number}","milestones_url":"https://api.github.com/repos/tcury/gradle-download-task/milestones{/number}","notifications_url":"https://api.github.com/repos/tcury/gradle-download-task/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tcury/gradle-download-task/labels{/name}","releases_url":"https://api.github.com/repos/tcury/gradle-download-task/releases{/id}","created_at":"2015-04-02T17:16:07Z","updated_at":"2015-04-05T18:33:29Z","pushed_at":"2015-04-05T18:33:27Z","git_url":"git://github.com/tcury/gradle-download-task.git","ssh_url":"git@github.com:tcury/gradle-download-task.git","clone_url":"https://github.com/tcury/gradle-download-task.git","svn_url":"https://github.com/tcury/gradle-download-task","homepage":null,"size":271,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"michel-kraemer:master","ref":"master","sha":"b7b53abaf05ce00f9f258786c0d2ecc2d7d49772","user":{"login":"michel-kraemer","id":295407,"avatar_url":"https://avatars.githubusercontent.com/u/295407?v=3","gravatar_id":"","url":"https://api.github.com/users/michel-kraemer","html_url":"https://github.com/michel-kraemer","followers_url":"https://api.github.com/users/michel-kraemer/followers","following_url":"https://api.github.com/users/michel-kraemer/following{/other_user}","gists_url":"https://api.github.com/users/michel-kraemer/gists{/gist_id}","starred_url":"https://api.github.com/users/michel-kraemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michel-kraemer/subscriptions","organizations_url":"https://api.github.com/users/michel-kraemer/orgs","repos_url":"https://api.github.com/users/michel-kraemer/repos","events_url":"https://api.github.com/users/michel-kraemer/events{/privacy}","received_events_url":"https://api.github.com/users/michel-kraemer/received_events","type":"User","site_admin":false},"repo":{"id":12539633,"name":"gradle-download-task","full_name":"michel-kraemer/gradle-download-task","owner":{"login":"michel-kraemer","id":295407,"avatar_url":"https://avatars.githubusercontent.com/u/295407?v=3","gravatar_id":"","url":"https://api.github.com/users/michel-kraemer","html_url":"https://github.com/michel-kraemer","followers_url":"https://api.github.com/users/michel-kraemer/followers","following_url":"https://api.github.com/users/michel-kraemer/following{/other_user}","gists_url":"https://api.github.com/users/michel-kraemer/gists{/gist_id}","starred_url":"https://api.github.com/users/michel-kraemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michel-kraemer/subscriptions","organizations_url":"https://api.github.com/users/michel-kraemer/orgs","repos_url":"https://api.github.com/users/michel-kraemer/repos","events_url":"https://api.github.com/users/michel-kraemer/events{/privacy}","received_events_url":"https://api.github.com/users/michel-kraemer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/michel-kraemer/gradle-download-task","description":"Adds a download task to Gradle that displays progress information","fork":false,"url":"https://api.github.com/repos/michel-kraemer/gradle-download-task","forks_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/forks","keys_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/keys{/key_id}","collaborators_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/teams","hooks_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/hooks","issue_events_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/issues/events{/number}","events_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/events","assignees_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/assignees{/user}","branches_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/branches{/branch}","tags_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/tags","blobs_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/git/refs{/sha}","trees_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/git/trees{/sha}","statuses_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/statuses/{sha}","languages_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/languages","stargazers_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/stargazers","contributors_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/contributors","subscribers_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/subscribers","subscription_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/subscription","commits_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/commits{/sha}","git_commits_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/git/commits{/sha}","comments_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/comments{/number}","issue_comment_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/issues/comments{/number}","contents_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/contents/{+path}","compare_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/compare/{base}...{head}","merges_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/merges","archive_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/downloads","issues_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/issues{/number}","pulls_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/pulls{/number}","milestones_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/milestones{/number}","notifications_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/labels{/name}","releases_url":"https://api.github.com/repos/michel-kraemer/gradle-download-task/releases{/id}","created_at":"2013-09-02T12:33:25Z","updated_at":"2015-03-27T02:27:26Z","pushed_at":"2015-04-05T18:40:56Z","git_url":"git://github.com/michel-kraemer/gradle-download-task.git","ssh_url":"git@github.com:michel-kraemer/gradle-download-task.git","clone_url":"https://github.com/michel-kraemer/gradle-download-task.git","svn_url":"https://github.com/michel-kraemer/gradle-download-task","homepage":null,"size":539,"stargazers_count":47,"watchers_count":47,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":6,"forks":7,"open_issues":6,"watchers":47,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/michel-kraemer/gradle-download-task/pulls/22"},"html":{"href":"https://github.com/michel-kraemer/gradle-download-task/pull/22"},"issue":{"href":"https://api.github.com/repos/michel-kraemer/gradle-download-task/issues/22"},"comments":{"href":"https://api.github.com/repos/michel-kraemer/gradle-download-task/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/michel-kraemer/gradle-download-task/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/michel-kraemer/gradle-download-task/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/michel-kraemer/gradle-download-task/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/michel-kraemer/gradle-download-task/statuses/95837152dc4aa21375366b567dcb73f854ab1b41"}}}}