I am calling a method that accepts InputStream
. Here is the method on github: https://github.com/drewnoakes/metadata-extractor/blob/2.8.0/Source/com/drew/imaging/ImageMetadataReader.java#L89
I am calling the method with BufferedInputStream
which should work since it is a child of InputStream
but I keep getting this error:
No signature of method: static com.drew.imaging.ImageMetadataReader.readMetadata() is applicable for argument types: (java.io.BufferedInputStream) values: [java.io.BufferedInputStream@74d4ec5f]
Possible solutions: readMetadata(java.io.File), readMetadata(java.io.BufferedInputStream, boolean). Stacktrace follows:
Message: No signature of method: static com.drew.imaging.ImageMetadataReader.readMetadata() is applicable for argument types: (java.io.BufferedInputStream) values: [java.io.BufferedInputStream@74d4ec5f]
Possible solutions: readMetadata(java.io.File), readMetadata(java.io.BufferedInputStream, boolean)
Line | Method
->> 137 | settings in com.foo.scanner.AdminController
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 198 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 53 | doFilter in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
| 62 | doFilter in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 59 | doFilter in grails.plugin.springsecurity.web.SecurityRequestHolderFilter
Here is my code:
println file62.name //prints name of the file
println file62.inputStream.getClass() //prints java.io.BufferedInputStream
InputStream is = (InputStream)file62.inputStream
Metadata metadata = com.drew.imaging.ImageMetadataReader.readMetadata(is) //readMetadata expects InputStream
Version of the library I have:
ā grails dependency-report | grep "drew"
+--- com.drewnoakes:metadata-extractor:2.9.1
+--- com.drewnoakes:metadata-extractor:2.9.1
+--- com.drewnoakes:metadata-extractor:2.9.1
and this is the method in 2.9.1: https://github.com/drewnoakes/metadata-extractor/blob/2.9.1/Source/com/drew/imaging/ImageMetadataReader.java#L88
The exception says that the method is expecting either a File
, or a BufferedInputStream
and a boolean. There is no overload that expects only a BufferedInputStream
.
If you're sure that the formal parameters and the actual parameters match, then the most likely reason for this sort of exception (caused by a formal parameter mismatch) is that there is an old jar lying around. Run mvn clean
, gradle clean
, check your web container's lib directory, and generally eliminate errant jars from your system.