-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
None
-
8u60
-
x86_64
-
linux
FULL PRODUCT VERSION :
java version "1.8.0_60-ea"
Java(TM) SE Runtime Environment (build 1.8.0_60-ea-b19)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b19, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux vagrant 3.13.0-49-generic #83-Ubuntu SMP Fri Apr 10 20:11:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The AWS S3 API creates and transmits http requests as part of its functioning. The request was malformed in some way that caused the recipient to alert that the Date/x-amz-date request header was malformed.
I was not able to trace the network traffic or do any debugging, but the problem does not occur with 8u40, and my best guess is that this is a problem with the Java date formatting library, or possibly somewhere in java.net.*.
REGRESSION. Last worked in version 8u40
ADDITIONAL REGRESSION INFORMATION:
openjdk version "1.8.0_40"
OpenJDK Runtime Environment (build 1.8.0_40-b25)
OpenJDK 64-Bit Server VM (build 25.40-b25, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Attempt to copy a file to an Amazon Web Services S3 bucket using any simple example program written for the purpose which uses the S3 API (no need to write any HTTP request writing code).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Successful file copy.
ACTUAL -
Caught an AmazonServiceException, which means your request made it to Amazon S3, but was rejected with an error response for some reason.
Error Message: AWS authentication requires a valid Date or x-amz-date header (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: 62A563E6B4142FAC)
HTTP Status Code: 403
AWS Error Code: AccessDenied
Error Type: Client
Request ID: 62A563E6B4142FAC
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
import java.io.File;
import java.io.IOException;
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.PutObjectRequest;
public class S3CopyProblemMine {
private static String bucketName = "*** bucket name goes here ***";
private static String awsAccessKey = "*** access key goes here ***";
private static String awsSecretKey = "*** secret key goes here ***";
private static String keyName = "*** destination bucket item name goes here ***";
private static String uploadFileName = "*** local filename goes here ***";
public static void main(final String[] args) throws IOException {
final AmazonS3 s3client = new AmazonS3Client(new BasicAWSCredentials(awsAccessKey,awsSecretKey));
try {
System.out.println("Uploading a new object to S3 from a file\n");
final File file = new File(uploadFileName);
s3client.putObject(new PutObjectRequest(
bucketName, keyName, file));
} catch (final AmazonServiceException ase) {
System.out.println("Caught an AmazonServiceException, which " +
"means your request made it " +
"to Amazon S3, but was rejected with an error response" +
" for some reason.");
System.out.println("Error Message: " + ase.getMessage());
System.out.println("HTTP Status Code: " + ase.getStatusCode());
System.out.println("AWS Error Code: " + ase.getErrorCode());
System.out.println("Error Type: " + ase.getErrorType());
System.out.println("Request ID: " + ase.getRequestId());
} catch (final AmazonClientException ace) {
System.out.println("Caught an AmazonClientException, which " +
"means the client encountered " +
"an internal error while trying to " +
"communicate with S3, " +
"such as not being able to access the network.");
System.out.println("Error Message: " + ace.getMessage());
}
}
}
---------- END SOURCE ----------
java version "1.8.0_60-ea"
Java(TM) SE Runtime Environment (build 1.8.0_60-ea-b19)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b19, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux vagrant 3.13.0-49-generic #83-Ubuntu SMP Fri Apr 10 20:11:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The AWS S3 API creates and transmits http requests as part of its functioning. The request was malformed in some way that caused the recipient to alert that the Date/x-amz-date request header was malformed.
I was not able to trace the network traffic or do any debugging, but the problem does not occur with 8u40, and my best guess is that this is a problem with the Java date formatting library, or possibly somewhere in java.net.*.
REGRESSION. Last worked in version 8u40
ADDITIONAL REGRESSION INFORMATION:
openjdk version "1.8.0_40"
OpenJDK Runtime Environment (build 1.8.0_40-b25)
OpenJDK 64-Bit Server VM (build 25.40-b25, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Attempt to copy a file to an Amazon Web Services S3 bucket using any simple example program written for the purpose which uses the S3 API (no need to write any HTTP request writing code).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Successful file copy.
ACTUAL -
Caught an AmazonServiceException, which means your request made it to Amazon S3, but was rejected with an error response for some reason.
Error Message: AWS authentication requires a valid Date or x-amz-date header (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: 62A563E6B4142FAC)
HTTP Status Code: 403
AWS Error Code: AccessDenied
Error Type: Client
Request ID: 62A563E6B4142FAC
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
import java.io.File;
import java.io.IOException;
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.PutObjectRequest;
public class S3CopyProblemMine {
private static String bucketName = "*** bucket name goes here ***";
private static String awsAccessKey = "*** access key goes here ***";
private static String awsSecretKey = "*** secret key goes here ***";
private static String keyName = "*** destination bucket item name goes here ***";
private static String uploadFileName = "*** local filename goes here ***";
public static void main(final String[] args) throws IOException {
final AmazonS3 s3client = new AmazonS3Client(new BasicAWSCredentials(awsAccessKey,awsSecretKey));
try {
System.out.println("Uploading a new object to S3 from a file\n");
final File file = new File(uploadFileName);
s3client.putObject(new PutObjectRequest(
bucketName, keyName, file));
} catch (final AmazonServiceException ase) {
System.out.println("Caught an AmazonServiceException, which " +
"means your request made it " +
"to Amazon S3, but was rejected with an error response" +
" for some reason.");
System.out.println("Error Message: " + ase.getMessage());
System.out.println("HTTP Status Code: " + ase.getStatusCode());
System.out.println("AWS Error Code: " + ase.getErrorCode());
System.out.println("Error Type: " + ase.getErrorType());
System.out.println("Request ID: " + ase.getRequestId());
} catch (final AmazonClientException ace) {
System.out.println("Caught an AmazonClientException, which " +
"means the client encountered " +
"an internal error while trying to " +
"communicate with S3, " +
"such as not being able to access the network.");
System.out.println("Error Message: " + ace.getMessage());
}
}
}
---------- END SOURCE ----------