artifactory-client-java
artifactory-client-java copied to clipboard
IOExceptions are thrown as InvocationTargetException
Due to the Groovy/Java mix, when the Groovy implementation of a method throws an IOException
, the exception is actually wrapped in an 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)
.
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