Skip to content

Commit 2fa69eb

Browse files
committed
check for null etag
1 parent 5a2db0a commit 2fa69eb

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/streams/AnalyticsStream.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,18 @@ private void onReadFailure(IOException ioe) throws IOException {
203203
}
204204

205205
private OpenStreamInformation buildOpenStreamInformation(ObjectReadParameters parameters) {
206-
OpenStreamInformation openFileInformation = OpenStreamInformation.builder().inputPolicy(mapS3AInputPolicyToAAL(parameters.getContext()
207-
.getInputPolicy()))
208-
.objectMetadata(ObjectMetadata.builder()
209-
.contentLength(parameters.getObjectAttributes().getLen())
210-
.etag(parameters.getObjectAttributes().getETag()).build())
211-
.build();
212-
213-
return openFileInformation;
206+
OpenStreamInformation.OpenStreamInformationBuilder openStreamInformationBuilder =
207+
OpenStreamInformation.builder()
208+
.inputPolicy(mapS3AInputPolicyToAAL(parameters.getContext()
209+
.getInputPolicy()));
210+
211+
if (parameters.getObjectAttributes().getETag() != null) {
212+
openStreamInformationBuilder.objectMetadata(ObjectMetadata.builder()
213+
.contentLength(parameters.getObjectAttributes().getLen())
214+
.etag(parameters.getObjectAttributes().getETag()).build());
215+
}
216+
217+
return openStreamInformationBuilder.build();
214218
}
215219

216220
/**

0 commit comments

Comments
 (0)