artifactory-client-java
artifactory-client-java copied to clipboard
No signature of method: org.jfrog.artifactory.client.impl.ArtifactoryImpl.getInputStream() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl)
I have a Groovy script that does a simple test on download using version 2.6.2, but I am getting the following error. I'm not sure why I'm getting this given that I'm passing in a String.
Artifactory artifactory = ArtifactoryClientBuilder.create().setUrl(url).setUsername("").setPassword(apiKey).build() InputStream is = artifactory.repository(repository).download(remoteFile).doDownload()
The stack trace is:
Caught: groovy.lang.MissingMethodException: No signature of method: org.jfrog.artifactory.client.impl.ArtifactoryImpl.getInputStream() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [/sys-dbb-ga-generic-local/1.0.1/GA/dbb-core-javadoc-1.0.1.zip] groovy.lang.MissingMethodException: No signature of method: org.jfrog.artifactory.client.impl.ArtifactoryImpl.getInputStream() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [/sys-dbb-ga-generic-local/1.0.1/GA/dbb-core-javadoc-1.0.1.zip] at org.jfrog.artifactory.client.impl.DownloadableArtifactImpl.doDownload(DownloadableArtifactImpl.groovy:27) at org.jfrog.artifactory.client.DownloadableArtifact$doDownload.call(Unknown Source)
It looks like the variable remoteFile
(set to /sys-dbb-ga-generic-local/1.0.1/GA/dbb-core-javadoc-1.0.1.zip
) is a GString and not a String hence the error.
Can you change your code as below ?
Artifactory artifactory = ArtifactoryClientBuilder.create().setUrl(url).setUsername("").setPassword(apiKey).build()
InputStream is = artifactory.repository(repository).download(remoteFile.toString()).doDownload()
Sure @fritaly. We'll push a commit with this change soon and let you know when done. Thanks for letting us know!
For the sake of clarity, my comment was addressed to @hungvlam. I believe the fix is more on his side than the API's. This kind of error typically happens when mixing Groovy and Java classes. The usual fix is to ensure Groovy passes Strings (and not GStrings) to the Java class throwing the error.