protected final String updateMessage()

in src/main/java/com/univocity/parsers/common/DataProcessingException.java [287:324]


	protected final String updateMessage(String msg) {
		if (errorContentLength == 0 || msg == null) {
			return msg; //doesn't replace labels enclosed within { and }.
		}

		StringBuilder out = new StringBuilder(msg.length());

		int previous = 0;
		int start = 0;
		while (true) {
			start = msg.indexOf('{', start);
			if (start == -1) {
				break;
			}

			int end = msg.indexOf('}', start);
			if (end == -1) {
				break;
			}

			String label = msg.substring(start + 1, end);
			Object value = null;
			if ("value".equals(label)) {
				value = this.value;
			} else if (values.containsKey(label)) {
				value = values.get(label);
			}
			if (value != null) {
				String content = restrictContent(value);
				out.append(msg, previous, start);
				out.append(content);
				previous = end;
			}
			start = end;
		}
		out.append(msg, previous == 0 ? 0 : previous + 1, msg.length());
		return out.toString();
	}