Skip to content

Commit

Permalink
Fix Spatial Resource API File Handling
Browse files Browse the repository at this point in the history
  • Loading branch information
AvocadoMoon committed Jan 29, 2025
1 parent 724ee59 commit 3db5539
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

package org.vcell.restclient.api;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.RandomStringUtils;
import org.vcell.restclient.ApiClient;
import org.vcell.restclient.ApiException;
import org.vcell.restclient.ApiResponse;
Expand Down Expand Up @@ -119,11 +121,14 @@ public ApiResponse<File> retrieveFiniteVolumeInputFromSpatialModelWithHttpInfo(F
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("retrieveFiniteVolumeInputFromSpatialModel", localVarResponse);
}
return new ApiResponse<File>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<File>() {}) // closes the InputStream
);
InputStream inputStream = localVarResponse.body();
File file = File.createTempFile("finite-volume-input-" + RandomStringUtils.randomAlphabetic(10), ".tmp");
FileUtils.copyInputStreamToFile(inputStream, file);
return new ApiResponse<File>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
localVarResponse.body() == null ? null : file // closes the InputStream
);
} finally {
}
} catch (IOException e) {
Expand Down

0 comments on commit 3db5539

Please sign in to comment.