bharatviswa504 commented on a change in pull request #1498:
URL: https://github.com/apache/ozone/pull/1498#discussion_r516426856
##########
File path:
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/AWSSignatureProcessor.java
##########
@@ -108,23 +109,29 @@ public void init()
this.method = context.getMethod();
String authHeader = headers.get(AUTHORIZATION_HEADER);
- String[] split = authHeader.split(" ");
- if (split[0].equals(AuthorizationHeaderV2.IDENTIFIER)) {
- if (v2Header == null) {
- v2Header = new AuthorizationHeaderV2(authHeader);
- }
- } else {
- if (v4Header == null) {
- v4Header = new AuthorizationHeaderV4(authHeader);
+ if (authHeader != null) {
+ String[] split = authHeader.split(" ");
+ if (split[0].equals(AuthorizationHeaderV2.IDENTIFIER)) {
+ if (v2Header == null) {
+ v2Header = new AuthorizationHeaderV2(authHeader);
+ }
+ } else {
+ if (v4Header == null) {
+ v4Header = new AuthorizationHeaderV4(authHeader);
+ }
+ parse();
}
- parse();
+ } else { // no auth header
+ v4Header = null;
+ v2Header = null;
}
}
- public void parse() throws Exception {
- StringBuilder strToSign = new StringBuilder();
+ private void parse() throws Exception {
+ Preconditions.checkNotNull(v4Header);
Review comment:
sorry missed this, parse we called only when authHeader!=null.
But anyway, even without this it will fail with NPE, and now this code has
moved to try catch and it is properly handled and this error is propagated to
OzoneClientProducer. So, the pending part is propagating error from
OzoneClientProducer to S3 clients.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]