Source:
<code>void updateQueueNamesInQueuesAndBindings() throws SQLException { getConnection(); try { PreparedStatement getBindingsStatement = conn.prepareStatement(GET_BINDINGS); ResultSet bindingsResultSet = getBindingsStatement.executeQuery(); PreparedStatement removeBindingsStatement = conn.prepareStatement(DELETE_ALL_BINDINGS); removeBindingsStatement.executeUpdate(); updateQueueNamesInQueues(); while (bindingsResultSet.next()) { String queueName = bindingsResultSet.getString(QUEUE_NAME); String bindingData = bindingsResultSet.getString(BINDING_DETAILS); if (queueNameHasCapitals(queueName)) { String newQueueName = queueName.toLowerCase(); bindingData = bindingData.replaceAll(String.format("queueName=%s", queueName), String.format <START> ("queueName=%s", newQueueName)); <END> bindingData = bindingData.replaceAll(String.format("boundQueueName=%s", queueName), String.format ("boundQueueName=%s", newQueueName)); queueName = newQueueName; } Pattern pattern = Pattern.compile("bindingKey=.*"); Matcher matcher = pattern.matcher(bindingData); if (matcher.find()) { String bindingKey = matcher.group(0).split("=")[1]; System.out.println(""+bindingKey); if(bindingKeyHasCapitals(bindingKey)) { String newBindingKey = bindingKey.toLowerCase(); bindingData = bindingData.replaceAll(String.format("bindingKey=%s", bindingKey), String.format ("bindingKey=%s", newBindingKey)); } } PreparedStatement addBindingsStatement = conn.prepareStatement(INSERT_BINDING); addBindingsStatement.setString(1, bindingsResultSet.getString(EXCHANGE_NAME)); addBindingsStatement.setString(2, queueName); addBindingsStatement.setString(3, bindingData); addBindingsStatement.executeUpdate(); } } catch (SQLException e) { e.printStackTrace(); } finally { conn.close(); } }</code><technical_language>add strings "queueName=%s" constants, repeating</technical_language>

Target:
void updateQueueNamesInQueuesAndBindings() throws SQLException { getConnection(); try { PreparedStatement getBindingsStatement = conn.prepareStatement(GET_BINDINGS); ResultSet bindingsResultSet = getBindingsStatement.executeQuery(); PreparedStatement removeBindingsStatement = conn.prepareStatement(DELETE_ALL_BINDINGS); removeBindingsStatement.executeUpdate(); updateQueueNamesInQueues(); while (bindingsResultSet.next()) { String queueName = bindingsResultSet.getString(QUEUE_NAME); String bindingData = bindingsResultSet.getString(BINDING_DETAILS); if (queueNameHasCapitals(queueName)) { String newQueueName = queueName.toLowerCase(); bindingData = bindingData.replaceAll(generateQueueNameString(queueName), generateQueueNameString(newQueueName)); bindingData = bindingData.replaceAll(generateBoundQueueNameDataString(queueName), generateBoundQueueNameDataString(newQueueName)); queueName = newQueueName; } Pattern pattern = Pattern.compile("bindingKey=.*"); Matcher matcher = pattern.matcher(bindingData); if (matcher.find()) { String bindingKey = matcher.group(0).split("=")[1]; if(bindingKeyHasCapitals(bindingKey)) { String newBindingKey = bindingKey.toLowerCase(); bindingData = bindingData.replaceAll(generateBindingKeyDataString(bindingKey), generateBindingKeyDataString(newBindingKey)); } } PreparedStatement addBindingsStatement = conn.prepareStatement(INSERT_BINDING); addBindingsStatement.setString(1, bindingsResultSet.getString(EXCHANGE_NAME)); addBindingsStatement.setString(2, queueName); addBindingsStatement.setString(3, bindingData); addBindingsStatement.executeUpdate(); } } catch (SQLException e) { e.printStackTrace(); } finally { conn.close(); } }