Closed mbazos closed 2 years ago
As this code was written years ago, the isFile
method wasn't present back then (it was added in 5.0 if I read the docs). As we now use Spring Batch 4.3 which in turn uses Spring 5.3 we should be able to safely refactor this.
Thanks for the report.
I've implemented this with the isFile check. If you checkout the sources and build a version for yourself you could test this.
@mdeinum tested the fix and it works great, do you know when this will be released so I can pull it from maven central?
I'll go through the issues see if there are some more low hanging fruit swe can fix and release a 0.1.1 version. Shouldn't be too long.
The following code is used to read the excel sheets:
StreamingXlsxItemReader.java
:PoiItemReader.java
:It's nice that there is a fallback to attempt to use
resource.getInputStream()
but I ran into a problem with this spring-cloud project which uses aGoogleStorageResource
and the issue is that the exception being thrown isUnsupportedOperationException
which isn't handled by the code above. Please see here: https://github.com/spring-attic/spring-cloud-gcp/blob/main/spring-cloud-gcp-storage/src/main/java/org/springframework/cloud/gcp/storage/GoogleStorageResource.java#L244To fix this wondering if it makes sense to check the Resource if it's a file and if that's true call getFile() otherwise attempt to use getInputStream(). So it would look like this: