Source:
<code>public static String expandBrackets(String pattern, Character keywordDelimiter, BibEntry entry, BibDatabase database) { Objects.requireNonNull(pattern); Objects.requireNonNull(entry); StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(pattern, "\\[]\"", true); while (st.hasMoreTokens()) { String token = st.nextToken(); if ("\"".equals(token)) { sb.append(token); while (st.hasMoreTokens()) { token = st.nextToken(); sb.append(token); if ("\"".equals(token)) { break; } } } else { if ("\\".equals(token)) { if (st.hasMoreTokens()) { sb.append(st.nextToken()); } } else { if ("[".equals(token)) { token = st.nextToken(); Boolean foundClosingBracket = false; while (st.hasMoreTokens()) { <START> String subtoken = st.nextToken(); <END> if ("\"".equals(subtoken)) { token = token + subtoken; while (st.hasMoreTokens()) { subtoken = st.nextToken(); token = token + subtoken; if ("\"".equals(subtoken)) { break; } } } else { if ("]".equals(subtoken)) { foundClosingBracket = true; break; } else { token = token + subtoken; } } } if (!foundClosingBracket) { LOGGER.warn("Missing closing bracket ']' in '" + pattern + "'"); } List<String> fieldParts = parseFieldMarker(token); if (fieldParts.size() <= 1) { sb.append(getFieldValue(entry, token, keywordDelimiter, database)); } else { String fieldValue = getFieldValue(entry, fieldParts.get(0), keywordDelimiter, database); sb.append(applyModifiers(fieldValue, fieldParts, 1)); } } else { sb.append(token); } } } } return sb.toString(); }</code><technical_language>Yes, I do log a warning. I a case for empty bracket, break parser</technical_language>

Target:
public static String expandBrackets(String pattern, Character keywordDelimiter, BibEntry entry, BibDatabase database) { Objects.requireNonNull(pattern); Objects.requireNonNull(entry); StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(pattern, "\\[]\"", true); while (st.hasMoreTokens()) { String token = st.nextToken(); if ("\"".equals(token)) { sb.append(token); while (st.hasMoreTokens()) { token = st.nextToken(); sb.append(token); if ("\"".equals(token)) { break; } } } else { if ("\\".equals(token)) { if (st.hasMoreTokens()) { sb.append(st.nextToken()); } } else { if ("[".equals(token)) { Boolean foundClosingBracket = false; token = st.nextToken(); if ("]".equals(token)) { LOGGER.warn("Found empty brackets \"[]\" in '" + pattern + "'"); foundClosingBracket = true; } while (st.hasMoreTokens() && !foundClosingBracket) { String subtoken = st.nextToken(); if ("\"".equals(subtoken)) { token = token + subtoken; while (st.hasMoreTokens()) { subtoken = st.nextToken(); token = token + subtoken; if ("\"".equals(subtoken)) { break; } } } else { if ("]".equals(subtoken)) { foundClosingBracket = true; break; } else { token = token + subtoken; } } } if (!foundClosingBracket) { LOGGER.warn("Missing closing bracket ']' in '" + pattern + "'"); } List<String> fieldParts = parseFieldMarker(token); if (fieldParts.size() <= 1) { sb.append(getFieldValue(entry, token, keywordDelimiter, database)); } else { String fieldValue = getFieldValue(entry, fieldParts.get(0), keywordDelimiter, database); sb.append(applyModifiers(fieldValue, fieldParts, 1)); } } else { sb.append(token); } } } } return sb.toString(); }