Skip to content

Commit

Permalink
Merge pull request #1921 from variacode95/Rundeck-1894
Browse files Browse the repository at this point in the history
1894: Enhanced error message
  • Loading branch information
gschueler committed Jun 30, 2016
2 parents 09157ec + eed53cd commit 9a0ba56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -206,8 +206,8 @@ static <T,X extends T> T createProviderForClass(final PluggableService<T> servic
final String pluginname = annotation.name();

if (!service.isValidProviderClass(cls)) {
throw new PluginException("Class " + cls.getName() + " was not a valid plugin class for service: "
+ service.getName());
throw new PluginException("Class " + cls.getName() + " was not a valid plugin class for service: "
+ service.getName() + ". Expected class " + cls.getName() + ", with a public constructor with no parameter");
}
debug("Succeeded loading plugin " + cls.getName() + " for service: " + service.getName());
return service.createProviderInstance(cls, pluginname);
Expand Down
Expand Up @@ -312,7 +312,7 @@ public void testLoadInvalid() throws Exception {
} catch (ProviderLoaderException e) {
assertTrue(e.getCause() instanceof PluginException);
assertEquals(
"Class " + testProvider2.class.getName() + " was not a valid plugin class for service: TestService",
"Class " + testProvider2.class.getName() + " was not a valid plugin class for service: TestService. Expected class " + testProvider2.class.getName() + ", with a public constructor with no parameter",
e.getCause().getMessage());

}
Expand Down Expand Up @@ -379,7 +379,7 @@ public boolean isValidProviderClass(Class clazz) {
} catch (ProviderLoaderException e) {
assertTrue(e.getCause() instanceof PluginException);
assertEquals(
"Class " + testProvider1.class.getName() + " was not a valid plugin class for service: TestService",
"Class " + testProvider1.class.getName() + " was not a valid plugin class for service: TestService. Expected class " + testProvider1.class.getName() + ", with a public constructor with no parameter",
e.getCause().getMessage());
}
}
Expand Down Expand Up @@ -457,7 +457,7 @@ public boolean isValidProviderClass(Class clazz) {
fail("should fail");
} catch (PluginException e) {
assertEquals(
"Class " + testProvider2.class.getName() + " was not a valid plugin class for service: TestService",
"Class " + testProvider2.class.getName() + " was not a valid plugin class for service: TestService. Expected class " + testProvider2.class.getName() + ", with a public constructor with no parameter",
e.getMessage());
} catch (ProviderCreationException e) {
fail("unexpected: " + e.getMessage());
Expand Down

0 comments on commit 9a0ba56

Please sign in to comment.