* @param wholeTime a time for the action to be finished.
* @return an action result.
*/
protected Object produceTimeRestricted(Action action, final Object param,
long wholeTime) {
ActionProducer producer = new ActionProducer(action);
producer.setOutput(getOutput().createErrorOutput());
producer.setTimeouts(getTimeouts().cloneThis());
producer.getTimeouts().setTimeout("ActionProducer.MaxActionTime", wholeTime);
try {
Object result = producer.produceAction(param);
Throwable exception = producer.getException();
if(exception != null) {
if(exception instanceof JemmyException) {
throw((JemmyException)exception);
} else {
throw(new JemmyException("Exception during " + action.getDescription(),