// the old API does not have the threadIO parameter, so its only 7 parameters
return ctr.newInstance(commandProcessor,
in,
pipedOut,
pipedOut,
new WebTerminal(TERM_WIDTH, TERM_HEIGHT),
null,
last);
} else {
LOG.debug("Using new Karaf 2.x Console API");
// last parameter may be BundleContext if its redhat version of karaf
// for ASF releases its a Runnable, and we should pass in null
Object last = null;
Class<?> type = ctr.getParameterTypes()[8];
if (type != null && type.getSimpleName().equals("BundleContext")) {
last = bundleContext;
}
// the new API has the threadIO parameter, so it has 9 parameters
return ctr.newInstance(commandProcessor,
threadIO,
in,
pipedOut,
pipedOut,
new WebTerminal(TERM_WIDTH, TERM_HEIGHT),
null,
null,
last);
}
}