private Object checkForDepthMismatch()

in taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/InputsHandler.java [263:285]


	private Object checkForDepthMismatch(int inputDepth, int portDepth, String inputName,
			Object inputValue) throws InvalidOptionException {
		if (inputDepth != portDepth) {
			if (inputDepth < portDepth) {
				logger.warn("Wrapping input for '" + inputName + "' from a depth of " + inputDepth
						+ " to the required depth of " + portDepth);
				while (inputDepth < portDepth) {
					List<Object> l = new ArrayList<Object>();
					l.add(inputValue);
					inputValue = l;
					inputDepth++;
				}
			} else {
				String msg = "There is a mismatch between depth of the list for the input port '"
						+ inputName + "' and the data presented. The input port requires a "
						+ depthToString(portDepth) + " and the data presented is a "
						+ depthToString(inputDepth);
				throw new InvalidOptionException(msg);
			}
		}

		return inputValue;
	}