@@ -80,29 +80,25 @@ public boolean isExtracted() {
8080 return isExtracted ;
8181 }
8282
83- private void readCrate (String location ) {
84- try {
85- File folder = temporaryFolder .toFile ();
86- // ensure the directory is clean
87- if (folder .isDirectory ()) {
88- FileUtils .cleanDirectory (folder );
89- } else if (folder .isFile ()) {
90- FileUtils .delete (folder );
91- }
92- // extract
93- try (ZipFile zf = new ZipFile (location )) {
94- zf .extractAll (temporaryFolder .toAbsolutePath ().toString ());
95- this .isExtracted = true ;
96- }
97- // register deletion on exit
98- FileUtils .forceDeleteOnExit (folder );
99- } catch (IOException e ) {
100- e .printStackTrace ();
83+ private void readCrate (String location ) throws IOException {
84+ File folder = temporaryFolder .toFile ();
85+ // ensure the directory is clean
86+ if (folder .isDirectory ()) {
87+ FileUtils .cleanDirectory (folder );
88+ } else if (folder .isFile ()) {
89+ FileUtils .delete (folder );
10190 }
91+ // extract
92+ try (ZipFile zf = new ZipFile (location )) {
93+ zf .extractAll (temporaryFolder .toAbsolutePath ().toString ());
94+ this .isExtracted = true ;
95+ }
96+ // register deletion on exit
97+ FileUtils .forceDeleteOnExit (folder );
10298 }
10399
104100 @ Override
105- public ObjectNode readMetadataJson (String location ) {
101+ public ObjectNode readMetadataJson (String location ) throws IOException {
106102 if (!isExtracted ) {
107103 this .readCrate (location );
108104 }
@@ -123,17 +119,12 @@ public ObjectNode readMetadataJson(String location) {
123119 .orElseThrow (() -> new IllegalStateException ("No %s found in zip file" .formatted (JsonDescriptor .ID )));
124120 jsonMetadata = firstSubdir .toPath ().resolve (JsonDescriptor .ID ).toFile ();
125121 }
126-
127- try {
128- return objectMapper .readTree (jsonMetadata ).deepCopy ();
129- } catch (IOException e ) {
130- e .printStackTrace ();
131- return null ;
132- }
122+
123+ return objectMapper .readTree (jsonMetadata ).deepCopy ();
133124 }
134125
135126 @ Override
136- public File readContent (String location ) {
127+ public File readContent (String location ) throws IOException {
137128 if (!isExtracted ) {
138129 this .readCrate (location );
139130 }
0 commit comments