-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
googleapis/google-http-java-client
#916Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
The following code results in error message Provided CRC32C "..." doesn't match calculated CRC32C "...":
Storage storage;
String bucketName = "bucket";
String blobName = "gtest";
String GOOGLE_CREDENTIALS_SCOPE = "https://www.googleapis.com/auth/cloud-platform";
String APPLICATION_TYPE = "application/octet-stream";
String googleCredentialsJson = null;
ArrayList al = new ArrayList();
al.add(GOOGLE_CREDENTIALS_SCOPE);
String s = String.format("\r\n--__END_OF_PART__--\r\n01234");
googleCredentialsJson = new String ( Files.readAllBytes( Paths.get("google.json") ) );
GoogleCredentials credentials = GoogleCredentials.fromStream(new ByteArrayInputStream(googleCredentialsJson.getBytes()))
.createScoped(al);
storage = StorageOptions.newBuilder().setCredentials(credentials).build().getService();
BlobId blobId = BlobId.of(bucketName, blobName);
BlobInfo blobInfo = BlobInfo.newBuilder(blobId).setContentType(APPLICATION_TYPE).build();
storage.create(blobInfo, s.getBytes());
The issue is reproducible using example programs on Linux:
printf "\r\n--END_OF_PART--\r\n01234\n" > rr
java -jar ... com.google.cloud.examples.storage.StorageExample upload rr bucket
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.