/** * Attempt to de-reference an inbound variable. * We try de-referencing as soon as possible (why? there is a good reason * for it, it fixes some bug, but I can't remember what right now) However * the referenced variable may not exist yet, so the de-referencing may * fail, requiring us to have another go later. * @throws ConversionException If cross-references don't add up */ public void dereference() throws ConversionException { int depth = 0; while (ProtocolConstants.TYPE_REFERENCE.equals(type)) { InboundVariable cd = context.getInboundVariable(formField.getString()); if (cd == null) { throw new ConversionException(getClass(), "Found reference to variable named '" + formField.getString() + "', but no variable of that name could be found."); } type = cd.type; formField = cd.getFormField(); key = cd.key; depth++; if (depth > 20) { throw new ConversionException(getClass(), "Max depth exceeded when dereferencing " + formField.getString()); } } dereferenced = true; }
public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException { if (data.isNull()) { return null; } if (data.getFormField().isFile()) { // Data from file uploads is not URL encoded return data.getValue(); } else { return data.urlDecode(); } }
final FormField formField = data.getFormField(); if (paramType == FileTransfer.class)