Skip to content

Commit 31c22e3

Browse files
committed
Require controller constructor argument.
1 parent 92e4ef4 commit 31c22e3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

hub/src/main/java/cloud/katta/core/DeviceSetupCallbackFactory.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
package cloud.katta.core;
66

7+
import ch.cyberduck.core.Controller;
78
import ch.cyberduck.core.Factory;
89

910
import org.apache.commons.lang3.reflect.ConstructorUtils;
@@ -20,16 +21,16 @@ private DeviceSetupCallbackFactory() {
2021
super("factory.devicesetupcallback.class");
2122
}
2223

23-
public DeviceSetupCallback create() {
24+
public DeviceSetupCallback create(final Controller controller) {
2425
try {
2526
final Constructor<? extends DeviceSetupCallback> constructor
26-
= ConstructorUtils.getMatchingAccessibleConstructor(clazz);
27+
= ConstructorUtils.getMatchingAccessibleConstructor(clazz, controller.getClass());
2728
if(null == constructor) {
28-
log.warn("No default controller in {}", constructor.getClass());
29+
log.warn("No matching constructor for parameter {}", controller.getClass());
2930
// Call default constructor for disabled implementations
3031
return clazz.getDeclaredConstructor().newInstance();
3132
}
32-
return constructor.newInstance();
33+
return constructor.newInstance(controller);
3334
}
3435
catch(InstantiationException | InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
3536
log.error("Failure loading callback class {}. {}", clazz, e.getMessage());

0 commit comments

Comments
 (0)