Skip to content

Commit 16cd96b

Browse files
committed
fixing a logical issue with get on s3filestore
1 parent 3829ff1 commit 16cd96b

File tree

2 files changed

+10
-28
lines changed

2 files changed

+10
-28
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ publishing {
5151
}
5252

5353
group 'mil.army.usace.hec'
54-
version '0.0.55'
54+
version '0.0.56'
5555
}

src/main/java/usace/cc/plugin/FileDataStoreS3.java

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,36 +47,18 @@ public Boolean Copy(FileDataStore destStore, String srcPath, String destPath) {
4747
}
4848
@Override
4949
public InputStream Get(String path) {
50-
//byte[] data;
50+
S3Object fullObject = null;
51+
String key = postFix + "/" + path;
52+
System.out.println(path);
53+
System.out.println(bucket);
5154
try {
52-
S3Object fullObject = null;
53-
String key = postFix + "/" + path;
54-
System.out.println(path);
55-
System.out.println(bucket);
56-
try {
57-
fullObject = awsS3.getObject(new GetObjectRequest(bucket, key));
58-
System.out.println("Content-Type: " + fullObject.getObjectMetadata().getContentType());
59-
return fullObject.getObjectContent();
60-
} catch (Exception e) {
61-
throw e;
62-
} finally {
63-
// To ensure that the network connection doesn't remain open, close any open input streams.
64-
if (fullObject != null) {
65-
try {
66-
fullObject.close();
67-
} catch (Exception e) {
68-
System.out.println("key " + key + " failed to download.\n" + e.getMessage());
69-
throw e;
70-
71-
//return fullObject.getObjectContent();
72-
}
73-
}
74-
}
75-
76-
} catch (Exception e) {
55+
fullObject = awsS3.getObject(new GetObjectRequest(bucket, key));
56+
System.out.println("Content-Type: " + fullObject.getObjectMetadata().getContentType());
57+
return fullObject.getObjectContent();
58+
} catch (Exception e) {
7759
e.printStackTrace();
7860
return null;
79-
}
61+
}
8062
}
8163

8264
@Override

0 commit comments

Comments
 (0)