Open cyrilc-pro opened 6 years ago
Due to the Groovy/Java mix, when the Groovy implementation of a method throws an IOException, the exception is actually wrapped in an InvocationTargetException.
IOException
InvocationTargetException
Example:
LocalRepository localRepository = RepositoryBuildersImpl.create().localRepositoryBuilder() .key(REPOSITORY) .repoLayoutRef(new GenericRepositorySettingsImpl().getRepoLayout()).build(); client.repositories().create(-1, localRepository);
The last line can throw IOException, but it is not declared in the interface method org.jfrog.artifactory.client.Repositories.create(int,Repository).
org.jfrog.artifactory.client.Repositories.create(int,Repository)
If the caller wishes to catch the exception, he needs to catch InvocationTargetException instead of IOException.
The fix simply consists of adding IOException to all interface methods whose implementation is actually a REST call.
Similar to #216
Due to the Groovy/Java mix, when the Groovy implementation of a method throws an
IOException
, the exception is actually wrapped in anInvocationTargetException
.Example:
The last line can throw
IOException
, but it is not declared in the interface methodorg.jfrog.artifactory.client.Repositories.create(int,Repository)
.If the caller wishes to catch the exception, he needs to catch
InvocationTargetException
instead ofIOException
.The fix simply consists of adding
IOException
to all interface methods whose implementation is actually a REST call.