{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/373","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/373/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/373/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/373/events","html_url":"https://github.com/GoogleCloudPlatform/gcloud-java/issues/373","id":116801658,"number":373,"title":"DefaultStorageRpc.read setting wrong range","user":{"login":"mziccard","id":450933,"avatar_url":"https://avatars.githubusercontent.com/u/450933?v=3","gravatar_id":"","url":"https://api.github.com/users/mziccard","html_url":"https://github.com/mziccard","followers_url":"https://api.github.com/users/mziccard/followers","following_url":"https://api.github.com/users/mziccard/following{/other_user}","gists_url":"https://api.github.com/users/mziccard/gists{/gist_id}","starred_url":"https://api.github.com/users/mziccard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mziccard/subscriptions","organizations_url":"https://api.github.com/users/mziccard/orgs","repos_url":"https://api.github.com/users/mziccard/repos","events_url":"https://api.github.com/users/mziccard/events{/privacy}","received_events_url":"https://api.github.com/users/mziccard/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/labels/storage","name":"storage","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-13T16:26:15Z","updated_at":"2015-11-13T17:29:52Z","closed_at":null,"body":"In [DefaultStorageRpc.read](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-storage/src/main/java/com/google/gcloud/spi/DefaultStorageRpc.java#L418) we set the content range as:\r\n```java\r\npublic byte[] read(StorageObject from, Map<Option, ?> options, long position, int bytes)\r\n    throws StorageException {\r\n  ...\r\n  downloader.setContentRange(position, (int) position + bytes);\r\n  ...\r\n}\r\n```\r\n\r\nAccorting to [here](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35) positions are inclusive, so we should probably do: `downloader.setContentRange(position, (int) position + bytes - 1);`"},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/comments/156494848","html_url":"https://github.com/GoogleCloudPlatform/gcloud-java/issues/373#issuecomment-156494848","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/373","id":156494848,"user":{"login":"aozarov","id":8921691,"avatar_url":"https://avatars.githubusercontent.com/u/8921691?v=3","gravatar_id":"","url":"https://api.github.com/users/aozarov","html_url":"https://github.com/aozarov","followers_url":"https://api.github.com/users/aozarov/followers","following_url":"https://api.github.com/users/aozarov/following{/other_user}","gists_url":"https://api.github.com/users/aozarov/gists{/gist_id}","starred_url":"https://api.github.com/users/aozarov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aozarov/subscriptions","organizations_url":"https://api.github.com/users/aozarov/orgs","repos_url":"https://api.github.com/users/aozarov/repos","events_url":"https://api.github.com/users/aozarov/events{/privacy}","received_events_url":"https://api.github.com/users/aozarov/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T17:29:52Z","updated_at":"2015-11-13T17:29:52Z","body":"Yes, I think you are right.\r\n\r\nI think consequences of this bug are minor and basically turns our chunkSize max to be `chunkSize + 1 ` or in the \"worse\" case when the given `byteBuffer` is more than `chunkSize` we will be left with one extra byte to be consumed by itself in the next read).\r\n\r\nAm I correct? Regardless, good catch and it should be fixed.\r\n\r\nI am actually more concern though about google/google-api-java-client#937 as it will impact large downloads. (maybe we should send them a PR...)"}}