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
()
| 82 | * @throws ConversionException If cross-references don't add up |
| 83 | */ |
| 84 | public void dereference() throws ConversionException |
| 85 | { |
| 86 | int maxDepth = 0; |
| 87 | |
| 88 | while (ProtocolConstants.TYPE_REFERENCE.equals(type)) |
| 89 | { |
| 90 | InboundVariable cd = context.getInboundVariable(formField.getString()); |
| 91 | if (cd == null) |
| 92 | { |
| 93 | throw new ConversionException(getClass(), "Found reference to variable named '" + formField.getString() + "', but no variable of that name could be found."); |
| 94 | } |
| 95 | |
| 96 | type = cd.type; |
| 97 | formField = cd.getFormField(); |
| 98 | |
| 99 | // For some reason we used to leave this until the loop finished |
| 100 | // and then only set it if the key was null. I think this logic |
| 101 | // may have been broken by named objects |
| 102 | key = cd.key; |
| 103 | |
| 104 | maxDepth++; |
| 105 | if (maxDepth > 20) |
| 106 | { |
| 107 | throw new ConversionException(getClass(), "Max depth exceeded when dereferencing " + formField.getString()); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | // For references without an explicit variable name, we use the |
| 112 | // name of the thing they point at |
| 113 | // if (key == null) |
| 114 | // { |
| 115 | // key = formField.getString(); |
| 116 | // } |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * @return Returns the lookup table. |
nothing calls this directly
no test coverage detected