auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void journalBootstrapTest() throws StoreException, IOException { if (state.getMaxInMemElements() <= 1) { fail("This test can work only if the max in mem elements config > 1"); } if (state.index.getIndexSegments().lastEntry().getValue().getNumberOfItems() <= 1) { state.addPutEntries(1, PUT_RECORD_SIZE, Utils.Infinite_Time); } assertTrue("There should be more than one element in the last index segment for this test to work", state.index.getIndexSegments().lastEntry().getValue().getNumberOfItems() > 1); state.properties.put("store.index.max.number.of.inmem.elements", "1"); state.reloadIndex(true, false); int entriesInJournal = state.index.journal.getCurrentNumberOfEntries(); assertEquals("Number of entries in the journal should be equal to the number of elements in the last index segment", state.index.getIndexSegments().lastEntry().getValue().getNumberOfItems(), <START> state.index.journal.getCurrentNumberOfEntries()); <END> state.addPutEntries(3, PUT_RECORD_SIZE, Utils.Infinite_Time); assertEquals("Number of entries in the journal should not have changed", entriesInJournal, state.index.journal.getCurrentNumberOfEntries()); state.reloadIndex(true, false); assertEquals("Number of entries in the journal should be exactly 1", 1, state.index.journal.getCurrentNumberOfEntries()); }</code><technical_language>minor: entriesInJournal</technical_language>

Target:
public void journalBootstrapTest() throws StoreException, IOException { if (state.getMaxInMemElements() <= 1) { fail("This test can work only if the max in mem elements config > 1"); } if (state.index.getIndexSegments().lastEntry().getValue().getNumberOfItems() <= 1) { state.addPutEntries(1, PUT_RECORD_SIZE, Utils.Infinite_Time); } assertTrue("There should be more than one element in the last index segment for this test to work", state.index.getIndexSegments().lastEntry().getValue().getNumberOfItems() > 1); state.properties.put("store.index.max.number.of.inmem.elements", "1"); state.reloadIndex(true, false); int entriesInJournal = state.index.journal.getCurrentNumberOfEntries(); assertEquals("Number of entries in the journal should be equal to the number of elements in the last index segment", state.index.getIndexSegments().lastEntry().getValue().getNumberOfItems(), entriesInJournal); state.addPutEntries(1, PUT_RECORD_SIZE, Utils.Infinite_Time); assertEquals("Number of entries in the journal should not have changed", entriesInJournal, state.index.journal.getCurrentNumberOfEntries()); state.reloadIndex(true, false); assertEquals("Number of entries in the journal should be exactly 1", 1, state.index.journal.getCurrentNumberOfEntries()); }
Source:
<code>public static String convertToSimpleDate(String date) { try { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date startDate = DateUtil.convertToDate(date); <START> String formattedDate = dateFormat.format(startDate); <END> return formattedDate; } catch (Exception e) { logger.error(e); return ""; } }</code><technical_language>return value</technical_language>

Target:
public static String convertToSimpleDate(String date) { try { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date startDate = DateUtil.convertToDate(date); return dateFormat.format(startDate); } catch (Exception e) { logger.error(e); } return ""; }
Source:
<code>public TupleHashTable(final Schema schema, final int[] keyColumns) { this.keyColumns = keyColumns; data = new MutableTupleBuffer(schema); keyHashCodesToIndices = new IntObjectHashMap<IntArrayList>(); int numIntegers = 0, numLongs = 0, numStrings = 0; for (Type t : schema.getColumnTypes()) { if (t == Type.INT_TYPE || t == Type.FLOAT_TYPE) { <START> numIntegers += 1; <END> } if (t == Type.LONG_TYPE || t == Type.DOUBLE_TYPE) { numLongs += 1; } if (t == Type.STRING_TYPE) { numStrings += 1; } } stats = new HashMap<String, Integer>(); stats.put("numIntegers", numIntegers); stats.put("numLongs", numLongs); stats.put("numStrings", numStrings); stats.put("sumStrings", 0); }</code><technical_language>I numIntegers more accurately named num32BitTypes like</technical_language>

Target:
public TupleHashTable(final Schema schema, final int[] keyColumns) { this.keyColumns = keyColumns; data = new MutableTupleBuffer(schema); keyHashCodesToIndices = new IntObjectHashMap<IntArrayList>(); int num32BitTypes = 0, num64BitTypes = 0, numStrings = 0; for (Type t : schema.getColumnTypes()) { if (t == Type.INT_TYPE || t == Type.FLOAT_TYPE) { num32BitTypes += 1; } if (t == Type.LONG_TYPE || t == Type.DOUBLE_TYPE) { num64BitTypes += 1; } if (t == Type.STRING_TYPE) { numStrings += 1; } } stats = new HashMap<String, Integer>(); stats.put("num32BitTypes", num32BitTypes); stats.put("num64BitTypes", num64BitTypes); stats.put("numStrings", numStrings); stats.put("sumStrings", 0); }
Source:
<code>private void raiseViolationOnMissingAriaLabel(List<TagNode> nodes) { List<TagNode> matches = nodes.stream().filter(node -> !hasAriaLabel(node)).collect(Collectors.toList()); <START> raiseViolationOnSize(matches); <END> }</code><technical_language>I understand RSPEC is long more 1 nav/aside tag, aria label. currently works, if nav tags 1 label, raise issue</technical_language>

Target:
private void raiseViolationOnMissingAriaLabel(List<TagNode> nodes) { if (nodes.size() > 1) { nodes.stream().filter(node -> !hasAriaLabel(node)).forEach(node -> createViolation(node.getStartLinePosition(), "Add an \"aria-label\" or \"aria-labbelledby\" attribute to this element.")); } }
Source:
<code>public abstract long maxUpdateIndex() throws IOException; public abstract RefCursor allRefs() throws IOException; public abstract RefCursor seekRef(String refName) throws IOException; public abstract RefCursor seekRefsWithPrefix(String prefix) throws IOException; public abstract RefCursor byObjectId(AnyObjectId id) throws IOException; <START> abstract public boolean <END> hasObjectMap() throws IOException; public abstract LogCursor allLogs() throws IOException; public LogCursor seekLog(String refName) throws IOException { return seekLog(refName, Long.MAX_VALUE); }</code><technical_language>Swap order of modifiers, in other methods in this class</technical_language>

Target:
public abstract long maxUpdateIndex() throws IOException; public abstract RefCursor allRefs() throws IOException; public abstract RefCursor seekRef(String refName) throws IOException; public abstract RefCursor seekRefsWithPrefix(String prefix) throws IOException; public abstract RefCursor byObjectId(AnyObjectId id) throws IOException; public abstract boolean hasObjectMap() throws IOException; public abstract LogCursor allLogs() throws IOException; public LogCursor seekLog(String refName) throws IOException { return seekLog(refName, Long.MAX_VALUE); }
Source:
<code>public void dispose() { this.jmxRegistration.unregisterMBean(MBEAN_NAME); for (MentionsConsumer consumer : this.consumers) { consumer.halt(); <START> this.queue.add(new MentionsData().stop()); <END> } }</code><technical_language>sense create a new instance of MentionsData return a static</technical_language>

Target:
public void dispose() { this.jmxRegistration.unregisterMBean(MBEAN_NAME); for (MentionsConsumer consumer : this.consumers) { consumer.halt(); this.queue.add(MentionsData.STOP); } }
Source:
<code>public HTMLPanel getSizeWidget(ChangeInfo c) { int largeChangeSize = Gerrit.getConfig().getLargeChangeSize(); int changedLines = c.insertions() + c.deletions(); int p = 100; if (changedLines < largeChangeSize) { p = Math.round(changedLines * 100 / largeChangeSize); } int width = Math.max(2, 70 * p / 100); int red = p > 50 ? 255 : (int) Math.round((p) * 5.12); int green = p < 50 ? 255 : (int) Math.round(256 - (p - 50) * 5.12); <START> SafeHtmlBuilder sb = new SafeHtmlBuilder(); sb.openDiv() .setStyleName(Gerrit.RESOURCES.css().changeSize()) .setAttribute("style", "width:" + width + "px; " + "background-color: #" + toHex(red) + toHex(green) + "00;") .closeDiv(); <END> HTMLPanel panel = new HTMLPanel(sb); panel.setTitle(Util.M.insertionsAndDeletions(c.insertions(), c.deletions())); return panel; }</code><technical_language>I set properties element's Style child</technical_language>

Target:
private static Widget getSizeWidget(ChangeInfo c) { int largeChangeSize = Gerrit.getConfig().getLargeChangeSize(); int changedLines = c.insertions() + c.deletions(); int p = 100; if (changedLines < largeChangeSize) { p = Math.round(changedLines * 100 / largeChangeSize); } int width = Math.max(2, 70 * p / 100); int red = p > 50 ? 255 : (int) Math.round((p) * 5.12); int green = p < 50 ? 255 : (int) Math.round(256 - (p - 50) * 5.12); String bg = "#" + toHex(red) + toHex(green) + "00"; SimplePanel panel = new SimplePanel(); panel.setStyleName(Gerrit.RESOURCES.css().changeSize()); panel.setWidth(width + "px"); panel.getElement().getStyle().setBackgroundColor(bg); panel.setTitle(Util.M.insertionsAndDeletions(c.insertions(), c.deletions())); return panel; }
Source:
<code>public Map<List<Object>, Integer> processMessage(Message<?> message) { if (this.routingSlip == null) { synchronized (this) { if (this.routingSlip == null) { List<Object> routingSlipValues = new ArrayList<Object>(this.routingSlipPath.size()); for (String path : this.routingSlipPath) { if (this.beanFactory.containsBean(path)) { Object bean = this.beanFactory.getBean(path); Assert.state(bean instanceof MessageChannel || bean instanceof RoutingSlipRouteStrategy, <START> "The RotingSlip can contain only bean names of MessageChannel or " + <END> "RoutingSlipRouteStrategy: " + bean); routingSlipValues.add(path); } else { ExpressionEvaluationRoutingSlipRouteStrategy strategy = new ExpressionEvaluationRoutingSlipRouteStrategy(path); strategy.setIntegrationEvaluationContext(this.evaluationContext); routingSlipValues.add(strategy); } } this.routingSlip = Collections.singletonMap(Collections.unmodifiableList(routingSlipValues), 0); } } } return this.routingSlip; }</code><technical_language>s/Rot/Rout/</technical_language>

Target:
public Map<List<Object>, Integer> processMessage(Message<?> message) { if (this.routingSlip == null) { synchronized (this) { if (this.routingSlip == null) { List<Object> routingSlipValues = new ArrayList<Object>(this.routingSlipPath.size()); for (String path : this.routingSlipPath) { if (this.beanFactory.containsBean(path)) { Object bean = this.beanFactory.getBean(path); Assert.state(bean instanceof MessageChannel || bean instanceof RoutingSlipRouteStrategy, "The RoutingSlip can contain only bean names of MessageChannel or " + "RoutingSlipRouteStrategy: " + bean); routingSlipValues.add(path); } else { ExpressionEvaluationRoutingSlipRouteStrategy strategy = new ExpressionEvaluationRoutingSlipRouteStrategy(path); strategy.setIntegrationEvaluationContext(this.evaluationContext); routingSlipValues.add(strategy); } } this.routingSlip = Collections.singletonMap(Collections.unmodifiableList(routingSlipValues), 0); } } } return this.routingSlip; }
Source:
<code>public static int searchResultCount(Context context, String query) throws SQLException { String dbquery = "%"+query.toLowerCase()+"%"; Long count; Integer int_param; try { int_param = Integer.valueOf(query); } catch (NumberFormatException e) { int_param = Integer.valueOf(-1); } TableRow row = DatabaseManager.querySingle(context, "SELECT count(*) as epcount FROM eperson " + "WHERE eperson_id = ? OR " + "LOWER((select text_value from metadatavalue where resource_id=? and resource_type_id=? and metadata_field_id=?)) LIKE LOWER(?) " + "OR LOWER((select text_value from metadatavalue where resource_id=? and resource_type_id=? and metadata_field_id=?)) LIKE LOWER(?) " + "OR LOWER(eperson.email) LIKE LOWER(?)", new Object[] { int_param, int_param, Constants.EPERSON, MetadataField.findByElement(context, MetadataSchema.find(context, "eperson").getSchemaID(), "firstname", null).getFieldID(), dbquery, int_param, Constants.EPERSON, MetadataField.findByElement(context, MetadataSchema.find(context, "eperson").getSchemaID(), "lastname", null).getFieldID(), dbquery, dbquery }); <START> if ("oracle".equals(ConfigurationManager.getProperty("db.name"))) <END> { count = Long.valueOf(row.getIntColumn("epcount")); } else { count = Long.valueOf(row.getLongColumn("epcount")); } return count.intValue(); }</code><technical_language>DatabaseManager.isOracle()</technical_language>

Target:
public static int searchResultCount(Context context, String query) throws SQLException { String dbquery = "%"+query.toLowerCase()+"%"; Long count; Integer int_param; try { int_param = Integer.valueOf(query); } catch (NumberFormatException e) { int_param = Integer.valueOf(-1); } TableRow row = DatabaseManager.querySingle(context, "SELECT count(*) as epcount FROM eperson " + "WHERE eperson_id = ? OR " + "LOWER((select text_value from metadatavalue where resource_id=? and resource_type_id=? and metadata_field_id=?)) LIKE LOWER(?) " + "OR LOWER((select text_value from metadatavalue where resource_id=? and resource_type_id=? and metadata_field_id=?)) LIKE LOWER(?) " + "OR LOWER(eperson.email) LIKE LOWER(?)", new Object[] { int_param, int_param, Constants.EPERSON, MetadataField.findByElement(context, MetadataSchema.find(context, "eperson").getSchemaID(), "firstname", null).getFieldID(), dbquery, int_param, Constants.EPERSON, MetadataField.findByElement(context, MetadataSchema.find(context, "eperson").getSchemaID(), "lastname", null).getFieldID(), dbquery, dbquery }); if (DatabaseManager.isOracle()) { count = Long.valueOf(row.getIntColumn("epcount")); } else { count = Long.valueOf(row.getLongColumn("epcount")); } return count.intValue(); }
Source:
<code>public boolean buildDirectory(String directory, boolean absolute) throws GenericFileOperationFailedException { ObjectHelper.notNull(endpoint, "endpoint"); if (endpoint.isAutoCreate() && !endpoint.getFile().exists()) { LOG.trace("Building starting directory: {}", endpoint.getFile()); buildDirectory(endpoint.getFile(), endpoint.getDirectoryPermissions(), absolute); } if (ObjectHelper.isEmpty(directory)) { return true; } File endpointPath = endpoint.getFile(); File target = new File(directory); <START> boolean isPath = Math.max(directory.lastIndexOf("/"), directory.lastIndexOf("\\")) != -1; <END> File path; if (absolute) { path = target; } else if (endpointPath.equals(target)) { path = endpointPath; } else if (isPath) { String afterRoot = StringHelper.after(directory, endpointPath.getPath() + File.separator); if (ObjectHelper.isNotEmpty(afterRoot)) { path = new File(endpoint.getFile(), afterRoot); } else { path = new File(directory); } } else { path = new File(endpoint.getFile(), directory); } synchronized (this) { if (path.isDirectory() && path.exists()) { return true; } else { LOG.trace("Building directory: {}", path); return buildDirectory(path, endpoint.getDirectoryPermissions(), absolute); } } }</code><technical_language>lastIndexOf? contains check if is a slash</technical_language>

Target:
public boolean buildDirectory(String directory, boolean absolute) throws GenericFileOperationFailedException { ObjectHelper.notNull(endpoint, "endpoint"); if (endpoint.isAutoCreate() && !endpoint.getFile().exists()) { LOG.trace("Building starting directory: {}", endpoint.getFile()); buildDirectory(endpoint.getFile(), endpoint.getDirectoryPermissions(), absolute); } if (ObjectHelper.isEmpty(directory)) { return true; } File endpointPath = endpoint.getFile(); File target = new File(directory); boolean isPath = directory.contains("/") || directory.contains("\\"); File path; if (absolute) { path = target; } else if (endpointPath.equals(target)) { path = endpointPath; } else if (isPath) { String afterRoot = StringHelper.after(directory, endpointPath.getPath() + File.separator); if (ObjectHelper.isNotEmpty(afterRoot)) { path = new File(endpoint.getFile(), afterRoot); } else { path = new File(directory); } } else { path = new File(endpoint.getFile(), directory); } synchronized (this) { if (path.isDirectory() && path.exists()) { return true; } else { LOG.trace("Building directory: {}", path); return buildDirectory(path, endpoint.getDirectoryPermissions(), absolute); } } }
Source:
<code>public static int toCoapCode(int lwm2mCode) { int codeClass = lwm2mCode / 100; int codeDetail = lwm2mCode % 100; if (codeClass > 7 || codeDetail > 31) <START> throw new IllegalArgumentException("Could not be translate in a valid CoAP code"); <END> return codeClass << 5 | codeDetail; }</code><technical_language>"Could translated a valid COAP code"</technical_language>

Target:
public static int toCoapCode(int lwm2mCode) { int codeClass = lwm2mCode / 100; int codeDetail = lwm2mCode % 100; if (codeClass > 7 || codeDetail > 31) throw new IllegalArgumentException("Could not be translated into a valid COAP code"); return codeClass << 5 | codeDetail; }
Source:
<code>public Slice regexpReplace( @SqlType("varchar") Slice source, @SqlType(Re2JRegexpType.NAME) Re2JRegexp pattern, @SqlType("function(array(varchar), varchar(x))") UnaryFunctionInterface replaceFunction) { if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); Matcher matcher = pattern.re2jPattern.matcher(source); SliceOutput output = new DynamicSliceOutput(source.length()); int groupCount = matcher.groupCount(); int appendPos = 0; while (matcher.find()) { int start = matcher.start(); int end = matcher.end(); if (appendPos < start) { output.writeBytes(source, appendPos, start - appendPos); } appendPos = end; for (int i = 1; i <= groupCount; i++) { Slice matchedGroupSlice = matcher.group(i); if (matchedGroupSlice != null) { <START> VARCHAR.writeSlice(blockBuilder, matchedGroupSlice, 0, matchedGroupSlice.length()); <END> } else { blockBuilder.appendNull(); } } pageBuilder.declarePositions(groupCount); Block target = blockBuilder.getRegion(blockBuilder.getPositionCount() - groupCount, groupCount); Slice replaced = (Slice) replaceFunction.apply(target); if (replaced == null) { return null; } output.appendBytes(replaced); } output.writeBytes(source, appendPos, source.length() - appendPos); return output.slice(); }</code><technical_language>arguments removed</technical_language>

Target:
public Slice regexpReplace( @SqlType("varchar") Slice source, @SqlType(Re2JRegexpType.NAME) Re2JRegexp pattern, @SqlType("function(array(varchar), varchar(x))") UnaryFunctionInterface replaceFunction) { Matcher matcher = pattern.re2jPattern.matcher(source); if (!matcher.find()) { return source; } SliceOutput output = new DynamicSliceOutput(source.length()); if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); int groupCount = matcher.groupCount(); int appendPosition = 0; do { int start = matcher.start(); int end = matcher.end(); if (appendPosition < start) { output.writeBytes(source, appendPosition, start - appendPosition); } appendPosition = end; for (int i = 1; i <= groupCount; i++) { Slice matchedGroupSlice = matcher.group(i); if (matchedGroupSlice != null) { VARCHAR.writeSlice(blockBuilder, matchedGroupSlice); } else { blockBuilder.appendNull(); } } pageBuilder.declarePositions(groupCount); Block target = blockBuilder.getRegion(blockBuilder.getPositionCount() - groupCount, groupCount); Slice replaced = (Slice) replaceFunction.apply(target); if (replaced == null) { return null; } output.appendBytes(replaced); } while (matcher.find()); output.writeBytes(source, appendPosition, source.length() - appendPosition); return output.slice(); }
Source:
<code><START> private AuthenticationProvider getAuthenticationProvider(OAuth2Authentication oauth2User) { <END> if (oauth2User.getName().startsWith("S-")) { return AuthenticationProvider.BOSCH; } return AuthenticationProvider.GITHUB; }</code><technical_language>Authentication Provider identified issuer in token, right</technical_language>

Target:
private String getAuthenticationProvider(OAuth2Authentication oauth2User) { if (oauth2User.getName().startsWith("S-")) { return AuthenticationProvider.BOSCH.name(); } return AuthenticationProvider.GITHUB.name(); }
Source:
<code>public void setTimerServiceProvider(InternalTimeServiceManager.Provider timerServiceProvider) { <START> this.timerServiceProvider = timerServiceProvider; <END> }</code><technical_language>I add a checkNotNull()</technical_language>

Target:
public void setTimerServiceProvider(InternalTimeServiceManager.Provider timerServiceProvider) { this.timerServiceProvider = checkNotNull(timerServiceProvider); }
Source:
<code>public Iterable<DocumentRevsList> bulkReadDocsWithOpenRevisions(List<BulkGetRequest> request, boolean pullAttachmentsInline) { Map<String, Object> options = new HashMap<String, Object>(); options.put("revs", true); if (pullAttachmentsInline) { options.put("attachments", true); } else { options.put("attachments", false); options.put("att_encoding_info", true); } URI bulkGet = this.uriHelper.documentUri("_bulk_get", options); HttpConnection connection = Http.POST(bulkGet, "application/json"); Map<String, List<BulkGetRequest>> jsonRequest = new HashMap<String, List<BulkGetRequest>>(); jsonRequest.put("docs", request); connection.setRequestBody(jsonHelper.toJson(jsonRequest)); BulkGetResponse response = executeToJsonObjectWithRetry(connection, BulkGetResponse.class); Map<String,ArrayList<DocumentRevs>> revsMap = new HashMap<String,ArrayList<DocumentRevs>>(); for (BulkGetResponse.Result result : response.results) { for (BulkGetResponse.Doc doc : result.docs) { if (doc.ok != null){ String id = doc.ok.getId(); if (!revsMap.containsKey(id)) { revsMap.put(id, new ArrayList<DocumentRevs>()); } revsMap.get(id).add(doc.ok); } else { @SuppressWarnings("unchecked") <START> String id = (String)doc.error.get("id"); <END> DocumentRevs revs = new DocumentRevs(); revs.setId(id); revs.setRev((String)doc.error.get("rev")); if (!revsMap.containsKey(id)) { revsMap.put(id, new ArrayList<DocumentRevs>()); } revsMap.get(id).add(revs); } } } List<DocumentRevsList> allRevs = new ArrayList<DocumentRevsList>(); for (ArrayList<DocumentRevs> value : revsMap.values()) { allRevs.add(new DocumentRevsList(value)); } return allRevs; }</code><technical_language>define class for error BulkGetResponse deserialisation done for you. need casts @SuppressWarnings("unchecked")</technical_language>

Target:
public Iterable<DocumentRevsList> bulkReadDocsWithOpenRevisions(List<BulkGetRequest> request, boolean pullAttachmentsInline) { Map<String, Object> options = new HashMap<String, Object>(); options.put("revs", true); if (pullAttachmentsInline) { options.put("attachments", true); } else { options.put("attachments", false); options.put("att_encoding_info", true); } URI bulkGet = this.uriHelper.documentUri("_bulk_get", options); HttpConnection connection = Http.POST(bulkGet, "application/json"); Map<String, List<BulkGetRequest>> jsonRequest = new HashMap<String, List<BulkGetRequest>>(); jsonRequest.put("docs", request); connection.setRequestBody(jsonHelper.toJson(jsonRequest)); BulkGetResponse response = executeToJsonObjectWithRetry(connection, BulkGetResponse.class); Map<String,ArrayList<DocumentRevs>> revsMap = new HashMap<String,ArrayList<DocumentRevs>>(); for (BulkGetResponse.Result result : response.results) { for (BulkGetResponse.Doc doc : result.docs) { if (doc.ok != null) { String id = doc.ok.getId(); if (!revsMap.containsKey(id)) { revsMap.put(id, new ArrayList<DocumentRevs>()); } revsMap.get(id).add(doc.ok); } } } List<DocumentRevsList> allRevs = new ArrayList<DocumentRevsList>(); for (ArrayList<DocumentRevs> value : revsMap.values()) { allRevs.add(new DocumentRevsList(value)); } return allRevs; }
Source:
<code>protected static SqlParts selectStatementForTextClause(Object clause, String indexName) { if (clause == null) { return null; } if (indexName == null || indexName.isEmpty()) { return null; } if (!(clause instanceof Map)) { return null; } Map<String, Object> textClause = (Map<String, Object>) clause; Map<String, String> searchClause = (Map<String, String>) textClause.get(TEXT); String tableName = IndexManager.tableNameForIndex(indexName); String search = searchClause.get(SEARCH); String sql = String.format("SELECT _id FROM %s WHERE %s MATCH ?", tableName, tableName); <START> return SqlParts.partsForSql(sql, new String[]{ String.format("'%s'", search) }); <END> }</code><technical_language>Is this placeholder correct, if search includes a ' I SQL inject here</technical_language>

Target:
protected static SqlParts selectStatementForTextClause(Object clause, String indexName) { if (clause == null) { return null; } if (indexName == null || indexName.isEmpty()) { return null; } if (!(clause instanceof Map)) { return null; } Map<String, Object> textClause = (Map<String, Object>) clause; Map<String, String> searchClause = (Map<String, String>) textClause.get(TEXT); String tableName = IndexManager.tableNameForIndex(indexName); String search = searchClause.get(SEARCH); search = search.replace("'", "''"); String sql = String.format("SELECT _id FROM %s WHERE %s MATCH ?", tableName, tableName); return SqlParts.partsForSql(sql, new String[]{ String.format("'%s'", search) }); }
Source:
<code>public static void setProperties() { Map<String, String> oldProperties = new HashMap<>(); overrideProperty(oldProperties, TCPropertiesConsts.L1_SHUTDOWN_THREADGROUP_GRACETIME, "1000"); overrideProperty(oldProperties, TCPropertiesConsts.TC_TRANSPORT_HANDSHAKE_TIMEOUT, "1000"); <START> overrideProperty(oldProperties, TCPropertiesConsts.CLIENT_MAX_PENDING_REQUESTS, "" + CLIENT_MAX_PENDING_REQUESTS); <END> OLD_PROPERTIES = oldProperties; }</code><technical_language>Pet peave of mine. prefer Integer.toString(CLIENT_MAX_PENDING_REQUESTS)</technical_language>

Target:
public static void setProperties() { Map<String, String> oldProperties = new HashMap<>(); overrideProperty(oldProperties, TCPropertiesConsts.L1_SHUTDOWN_THREADGROUP_GRACETIME, "1000"); overrideProperty(oldProperties, TCPropertiesConsts.TC_TRANSPORT_HANDSHAKE_TIMEOUT, "1000"); overrideProperty(oldProperties, TCPropertiesConsts.CLIENT_MAX_PENDING_REQUESTS, Integer.toString(CLIENT_MAX_PENDING_REQUESTS)); OLD_PROPERTIES = oldProperties; }
Source:
<code>static SameSite of(String name) { if (name != null) { try { return SameSite.valueOf(name); } catch (IllegalArgumentException e) { for (SameSite each : SameSite.class.getEnumConstants()) { if (each.name().equalsIgnoreCase(name)) { return each; } <START> } <END> } } return null; }</code><technical_language>regrow e if find a match</technical_language>

Target:
static SameSite of(String name) { if (name != null) { for (SameSite each : SameSite.class.getEnumConstants()) { if (each.name().equalsIgnoreCase(name)) { return each; } } } return null; }
Source:
<code>public void shouldIndentedWhenEnvironmentReturnsTrue() { <START> when(environment.supports(anyString())).thenReturn(true); <END> serialization.init(); String expectedResult = "<order>\n <price>15.0</price>\n <comments>pack it nicely, please</comments>\n</order>"; Order order = new Order(new Client("guilherme silveira"), 15.0, "pack it nicely, please"); serialization.from(order).serialize(); assertThat(result(), is(equalTo(expectedResult))); }</code><technical_language>reference config constant instead of anyString()</technical_language>

Target:
public void shouldIndentedWhenEnvironmentReturnsTrue() { when(environment.supports(ENVIRONMENT_INDENTED_KEY)).thenReturn(true); serialization.init(); String expectedResult = "<order>\n <price>15.0</price>\n <comments>pack it nicely, please</comments>\n</order>"; Order order = new Order(new Client("guilherme silveira"), 15.0, "pack it nicely, please"); serialization.from(order).serialize(); assertThat(result(), is(equalTo(expectedResult))); }
Source:
<code>public Void call() { SLAVE_LOG_HANDLER = new RingBufferLogHandler(ringBufferSize) { Formatter dummy = new SimpleFormatter(); @Override <START> public void publish(LogRecord record) { <END> if (record.getMessage() != null && record.getParameters() != null && Stream.of(record.getParameters()).anyMatch(p -> p != null && !(p instanceof String))) { record.setMessage(dummy.formatMessage(record)); record.setParameters(null); } super.publish(record); } }; for (Handler h : LOGGER.getHandlers()) { if (h.getClass().getName().equals(SLAVE_LOG_HANDLER.getClass().getName())) LOGGER.removeHandler(h); } LOGGER.addHandler(SLAVE_LOG_HANDLER); try { Security.removeProvider("SunPKCS11-Solaris"); } catch (SecurityException e) { } try { getChannelOrFail().setProperty("slave",Boolean.TRUE); } catch (ChannelClosedException e) { throw new IllegalStateException(e); } return null; }</code><technical_language>I this solve problem, because, say, super is synchronized. deadlock is caused RemoteClassLoader is involved loading new overloaded RingBufferLogHandler publish synchronized call. if a separate new FormattedRingBufferLogHandler loaded earlier, lock RemoteClassLoader time publish synchronized lock</technical_language>

Target:
public Void call() { SLAVE_LOG_HANDLER = new RingBufferLogHandler(ringBufferSize) { ThreadLocal<Formatter> dummy = ThreadLocal.withInitial(() -> new SimpleFormatter()); @Override public void publish(LogRecord record) { if (record.getMessage() != null && record.getParameters() != null && Stream.of(record.getParameters()).anyMatch(p -> p != null && !(p instanceof String))) { record.setMessage(dummy.get().formatMessage(record)); record.setParameters(null); } super.publish(record); } }; for (Handler h : LOGGER.getHandlers()) { if (h.getClass().getName().equals(SLAVE_LOG_HANDLER.getClass().getName())) LOGGER.removeHandler(h); } LOGGER.addHandler(SLAVE_LOG_HANDLER); try { Security.removeProvider("SunPKCS11-Solaris"); } catch (SecurityException e) { } try { getChannelOrFail().setProperty("slave",Boolean.TRUE); } catch (ChannelClosedException e) { throw new IllegalStateException(e); } return null; }
Source:
<code>private static void drawScale(PDPageContentStream stream, PrintRequest request) throws IOException { if (!request.isShowScale()) { return; } String units = getUnits(request.getSrsName()); if (units == null) { return; } double mppx; switch (units) { <START> case "m": <END> mppx = request.getResolution(); break; case "°": LOG.info("Map units is deegrees, not drawing Scale Line"); return; default: LOG.info("Unknown unit", units, "- not drawing Scale line"); return; } double mppt = mppx * Units.PDF_DPI / Units.OGC_DPI; double minDistance = mppt * 50; double distance = SCALE_LINE_DISTANCES_METRES[0]; for (int i = 1; i < SCALE_LINE_DISTANCES_METRES.length; i++) { double d = SCALE_LINE_DISTANCES_METRES[i]; if (d > minDistance) { distance = d; break; } } double pt = distance / mppt; float x1 = (float) OFFSET_SCALE_LEFT; float y1 = (float) OFFSET_SCALE_BOTTOM; float x2 = (float) (OFFSET_SCALE_LEFT + pt); float y2 = y1 + 10; if(request.isScaleText()) { float cx = x1 + ((x2 - x1) / 2); PDFBoxUtil.drawTextCentered(stream, request.getScaleText(), FONT, FONT_SIZE_SCALE, cx, y1 + 5); } else { String distanceStr; if (distance > 1000) { distanceStr = Math.round(distance / 1000) + " km"; } else { distanceStr = Math.round(distance) + " m"; } stream.moveTo(x1, y2); stream.lineTo(x1, y1); stream.lineTo(x2, y1); stream.lineTo(x2, y2); stream.stroke(); float cx = x1 + ((x2 - x1) / 2); PDFBoxUtil.drawTextCentered(stream, distanceStr, FONT, FONT_SIZE_SCALE, cx, y1 + 5); } }</code><technical_language>indent-only changes</technical_language>

Target:
private static void drawScale(PDPageContentStream stream, PrintRequest request) throws IOException { if (!request.isShowScale()) { return; } String units = getUnits(request.getSrsName()); if (units == null) { return; } double mppx; switch (units) { case "m": mppx = request.getResolution(); break; case "°": LOG.info("Map units is deegrees, not drawing Scale Line"); return; default: LOG.info("Unknown unit", units, "- not drawing Scale line"); return; } double mppt = mppx * Units.OGC_DPI / Units.PDF_DPI; double minDistance = mppt * 50; double distance = SCALE_LINE_DISTANCES_METRES[0]; for (int i = 1; i < SCALE_LINE_DISTANCES_METRES.length; i++) { double d = SCALE_LINE_DISTANCES_METRES[i]; if (d > minDistance) { distance = d; break; } } double pt = distance / mppt; float x1 = (float) OFFSET_SCALE_LEFT; float y1 = (float) OFFSET_SCALE_BOTTOM; float x2 = (float) (OFFSET_SCALE_LEFT + pt); float y2 = y1 + 10; if(request.isScaleText()) { float cx = x1 + ((x2 - x1) / 2); PDFBoxUtil.drawTextCentered(stream, request.getScaleText(), FONT, FONT_SIZE_SCALE, cx, y1 + 5); } else { String distanceStr; if (distance > 1000) { distanceStr = Math.round(distance / 1000) + " km"; } else { distanceStr = Math.round(distance) + " m"; } stream.moveTo(x1, y2); stream.lineTo(x1, y1); stream.lineTo(x2, y1); stream.lineTo(x2, y2); stream.stroke(); float cx = x1 + ((x2 - x1) / 2); PDFBoxUtil.drawTextCentered(stream, distanceStr, FONT, FONT_SIZE_SCALE, cx, y1 + 5); } }
Source:
<code>private static List<MethodMatcher> slf4jVariants(Supplier<MethodMatcher> prototype) { return ImmutableList.of( prototype.get().parameters(STRING), <START> prototype.get().parameters(STRING, TypeCriteria.anyType()), <END> prototype.get().parameters(STRING, TypeCriteria.anyType(), TypeCriteria.anyType()), prototype.get().parameters(STRING, OBJECT_ARR), prototype.get().parameters(MARKER, STRING), prototype.get().parameters(MARKER, STRING, TypeCriteria.anyType()), prototype.get().parameters(MARKER, STRING, TypeCriteria.anyType(), TypeCriteria.anyType()), prototype.get().parameters(MARKER, STRING, OBJECT_ARR) ); }</code><technical_language>I a static import of TypeCriteria.anyType() reduce a bit verbosity of block</technical_language>

Target:
private static List<MethodMatcher> slf4jVariants(Supplier<MethodMatcher> prototype) { return ImmutableList.of( prototype.get().parameters(STRING), prototype.get().parameters(STRING, anyType()), prototype.get().parameters(STRING, anyType(), anyType()), prototype.get().parameters(STRING, OBJECT_ARR), prototype.get().parameters(MARKER, STRING), prototype.get().parameters(MARKER, STRING, anyType()), prototype.get().parameters(MARKER, STRING, anyType(), anyType()), prototype.get().parameters(MARKER, STRING, OBJECT_ARR) ); }
Source:
<code>public Optional<MapBean> getMapLocallyFromName(String mapFolderName) { logger.debug("Trying to find map '{}' locally", mapFolderName); String mapFolderKey = mapFolderName.toLowerCase(); if (!mapsByFolderName.containsKey(mapFolderKey)) { return Optional.empty(); } else { MapBean mapBean = mapsByFolderName.get(mapFolderKey); <START> return Optional.of(mapBean); <END> } }</code><technical_language>remove else, abort condition swap if else around</technical_language>

Target:
public Optional<MapBean> getMapLocallyFromName(String mapFolderName) { logger.debug("Trying to find map '{}' locally", mapFolderName); String mapFolderKey = mapFolderName.toLowerCase(); return Optional.ofNullable(mapsByFolderName.get(mapFolderKey)); }
Source:
<code>default MessageId rootMessage() { return isImported() ? messageId() : context() .rootMessage() <START> .orElseThrow(IllegalStateException::new); <END> }</code><technical_language>a good idea throw exception here? return Optional. pretty uncommon throw exception Protobuf message</technical_language>

Target:
default MessageId rootMessage() { return context() .rootMessage() .orElseGet(this::messageId); }
Source:
<code>public void start(Integer port) throws IOException { server = HttpServer.create(new InetSocketAddress(port), 0); server.createContext("/" + GlobalSettings.TXTUML_DIAGNOSTICS_HTTP_PATH, new DiagnosticsHandler()); <START> server.createContext("/delay", new DelayHandler()); <END> server.setExecutor(null); server.start(); }</code><technical_language>Please introduce _"delay"_ a final field in GlobalSettings, row above</technical_language>

Target:
public void start(Integer port) throws IOException { server = HttpServer.create(new InetSocketAddress(port), 0); server.createContext("/" + TXTUML_DIAGNOSTICS_HTTP_PATH, new DiagnosticsHandler()); server.createContext("/" + TXTUML_DIAGNOSTICS_DELAY_PATH, new DelayHandler()); server.setExecutor(null); server.start(); }
Source:
<code>public boolean isADPCM() { <START> return getCodecA() != null && getCodecA().equalsIgnoreCase(FormatConfiguration.ADPCM); <END> }</code><technical_language>If i remember correctly, getCodecA is set in case IgnoreCase is need anymore</technical_language>

Target:
public boolean isADPCM() { return FormatConfiguration.ADPCM.equalsIgnoreCase(getCodecA()); }
Source:
<code>public void close() { if (hasConnection.getAndSet(false)) { try { final AmqpConnection connection = connectionMono.block(timeout); if (connection != null) { connection.close(); } } catch (IOException exception) { <START> throw new AzureException("Unable to close connection to service", exception); <END> } } }</code><technical_language>this AmqpException</technical_language>

Target:
public void close() { if (hasConnection.getAndSet(false)) { try { final AmqpConnection connection = connectionMono.block(timeout); if (connection != null) { connection.close(); } } catch (IOException exception) { throw new AmqpException(false, "Unable to close connection to service", exception); } } }
Source:
<code>private void inspectModulesForTestClass(Class<?> testClass) { final List<Class<? extends Module>> moduleClasses = new ArrayList<>(); moduleClasses.addAll(getModulesForAnnotatedClass(testClass)); for (Class<?> parentClass : getAllSuperClassesInReverseOrder(testClass)) { moduleClasses.addAll(getModulesForAnnotatedClass(parentClass)); } for (Class<? extends Module> moduleClass : moduleClasses) { try { modulesForTestClass.add(moduleClass.newInstance()); } catch (InstantiationException | IllegalAccessException e) { try { <START> Constructor<?>[] declaredConstructors = moduleClass.getDeclaredConstructors(); <END> for(int i=0; i < declaredConstructors.length; i++) { if(declaredConstructors[i].getParameterCount() == 0) { Constructor<?> zeroArgConstructor = declaredConstructors[i]; zeroArgConstructor.setAccessible(true); modulesForTestClass.add((Module) zeroArgConstructor.newInstance()); break; } } } catch (Exception ex) { throw new RuntimeException("Error instantiating module " + moduleClass + ". Please ensure that the module is public and has a no-arg constructor", e); } } } }</code><technical_language>skip this loop calling Constructor<?> ctor = moduleClass.getDeclaredConstructor()</technical_language>

Target:
private void inspectModulesForTestClass(Class<?> testClass) { final List<Class<? extends Module>> moduleClasses = new ArrayList<>(); moduleClasses.addAll(getModulesForAnnotatedClass(testClass)); for (Class<?> parentClass : getAllSuperClassesInReverseOrder(testClass)) { moduleClasses.addAll(getModulesForAnnotatedClass(parentClass)); } for (Class<? extends Module> moduleClass : moduleClasses) { try { modulesForTestClass.add(moduleClass.newInstance()); } catch (InstantiationException | IllegalAccessException e) { try { Constructor<?> zeroArgConstructor = moduleClass.getDeclaredConstructor(); zeroArgConstructor.setAccessible(true); modulesForTestClass.add((Module) zeroArgConstructor.newInstance()); } catch (Exception ex) { throw new RuntimeException("Error instantiating module " + moduleClass + ". Please ensure that the module is public and has a no-arg constructor", e); } } } }
Source:
<code>public void testSqlCompletion() throws IOException { <START> verifySqlCompletion("", 0, Arrays.asList("SOURCE", "QUIT;", "RESET;"), Collections.emptyList()); <END> verifySqlCompletion("SOUR", 5, Collections.singletonList("SOURCE"), Collections.singletonList("QUIT;")); verifySqlCompletion("SOUR", 0, Collections.singletonList("SOURCE"), Collections.singletonList("QUIT;")); verifySqlCompletion("QU", 2, Collections.singletonList("QUIT;"), Collections.singletonList("SELECT")); verifySqlCompletion("qu", 2, Collections.singletonList("QUIT;"), Collections.singletonList("SELECT")); verifySqlCompletion(" qu", 2, Collections.singletonList("QUIT;"), Collections.singletonList("SELECT")); verifySqlCompletion("set ", 3, Collections.emptyList(), Collections.singletonList("SET")); verifySqlCompletion("show t ", 6, Collections.emptyList(), Collections.singletonList("SET")); }</code><technical_language>drop SELEC completion test</technical_language>

Target:
public void testSqlCompletion() throws IOException { verifySqlCompletion("", 0, Arrays.asList("SOURCE", "QUIT;", "RESET;"), Collections.emptyList()); verifySqlCompletion("SELE", 5, Collections.singletonList("HintA"), Collections.singletonList("QUIT;")); verifySqlCompletion("SOUR", 5, Collections.singletonList("SOURCE"), Collections.singletonList("QUIT;")); verifySqlCompletion("SOUR", 0, Collections.singletonList("SOURCE"), Collections.singletonList("QUIT;")); verifySqlCompletion("QU", 2, Collections.singletonList("QUIT;"), Collections.singletonList("SELECT")); verifySqlCompletion("qu", 2, Collections.singletonList("QUIT;"), Collections.singletonList("SELECT")); verifySqlCompletion(" qu", 2, Collections.singletonList("QUIT;"), Collections.singletonList("SELECT")); verifySqlCompletion("set ", 3, Collections.emptyList(), Collections.singletonList("SET")); verifySqlCompletion("show t ", 6, Collections.emptyList(), Collections.singletonList("SET")); verifySqlCompletion("show", 7, Collections.singletonList("MODULES;"), Collections.singletonList("QUIT;")); verifySqlCompletion("show ", 4, Collections.singletonList("MODULES;"), Collections.singletonList("QUIT;")); verifySqlCompletion("show modules", 13, Collections.emptyList(), Collections.singletonList("QUIT;")); }
Source:
<code>public ServiceBusSenderClient buildClient() { <START> return new ServiceBusSenderClient(buildAsyncClient(), MessageUtils.calcTotalTimeout(retryOptions)); <END> }</code><technical_language>getTotalTimeout more sense</technical_language>

Target:
public ServiceBusSenderClient buildClient() { return new ServiceBusSenderClient(buildAsyncClient(), MessageUtils.getTotalTimeout(retryOptions)); }
Source:
<code>public static Display[] getDisplays() { List<Display> displays = new ArrayList<>(); WinNT.HANDLE hDevInfo = SetupApi.INSTANCE.SetupDiGetClassDevs(GUID_DEVINTERFACE_MONITOR, null, null, SetupApi.DIGCF_PRESENT | SetupApi.DIGCF_DEVICEINTERFACE); if (!hDevInfo.equals(WinNT.INVALID_HANDLE_VALUE)) { SP_DEVICE_INTERFACE_DATA deviceInterfaceData = new SetupApi.SP_DEVICE_INTERFACE_DATA(); deviceInterfaceData.cbSize = deviceInterfaceData.size(); SP_DEVINFO_DATA info = new SetupApi.SP_DEVINFO_DATA(); for (int memberIndex = 0; SetupApi.INSTANCE.SetupDiEnumDeviceInfo(hDevInfo, memberIndex, info); memberIndex++) { HKEY key = SetupApi.INSTANCE.SetupDiOpenDevRegKey(hDevInfo, info, SetupApi.DICS_FLAG_GLOBAL, 0, SetupApi.DIREG_DEV, WinNT.KEY_QUERY_VALUE); byte[] edid = new byte[1]; Advapi32 advapi32 = Advapi32.INSTANCE; IntByReference pType = new IntByReference(); IntByReference lpcbData = new IntByReference(); if (advapi32.RegQueryValueEx(key, "EDID", 0, pType, edid, lpcbData) == WinError.ERROR_MORE_DATA) { edid = new byte[lpcbData.getValue()]; if (advapi32.RegQueryValueEx(key, "EDID", 0, pType, edid, lpcbData) == WinError.ERROR_SUCCESS) { Display display = new WindowsDisplay(edid); displays.add(display); } } Advapi32.INSTANCE.RegCloseKey(key); } } <START> SetupApi.INSTANCE.SetupDiDestroyDeviceInfoList(hDevInfo); <END> return displays.toArray(new Display[0]); }</code><technical_language>This needs conditional tests for INVALID_HANDLE_VALUE, releasing garbage</technical_language>

Target:
public static Display[] getDisplays() { List<Display> displays = new ArrayList<>(); WinNT.HANDLE hDevInfo = SetupApi.INSTANCE.SetupDiGetClassDevs(GUID_DEVINTERFACE_MONITOR, null, null, SetupApi.DIGCF_PRESENT | SetupApi.DIGCF_DEVICEINTERFACE); if (!hDevInfo.equals(WinNT.INVALID_HANDLE_VALUE)) { SP_DEVICE_INTERFACE_DATA deviceInterfaceData = new SetupApi.SP_DEVICE_INTERFACE_DATA(); deviceInterfaceData.cbSize = deviceInterfaceData.size(); SP_DEVINFO_DATA info = new SetupApi.SP_DEVINFO_DATA(); for (int memberIndex = 0; SetupApi.INSTANCE.SetupDiEnumDeviceInfo(hDevInfo, memberIndex, info); memberIndex++) { HKEY key = SetupApi.INSTANCE.SetupDiOpenDevRegKey(hDevInfo, info, SetupApi.DICS_FLAG_GLOBAL, 0, SetupApi.DIREG_DEV, WinNT.KEY_QUERY_VALUE); byte[] edid = new byte[1]; Advapi32 advapi32 = Advapi32.INSTANCE; IntByReference pType = new IntByReference(); IntByReference lpcbData = new IntByReference(); if (advapi32.RegQueryValueEx(key, "EDID", 0, pType, edid, lpcbData) == WinError.ERROR_MORE_DATA) { edid = new byte[lpcbData.getValue()]; if (advapi32.RegQueryValueEx(key, "EDID", 0, pType, edid, lpcbData) == WinError.ERROR_SUCCESS) { Display display = new WindowsDisplay(edid); displays.add(display); } } Advapi32.INSTANCE.RegCloseKey(key); } SetupApi.INSTANCE.SetupDiDestroyDeviceInfoList(hDevInfo); } return displays.toArray(new Display[0]); }
Source:
<code>public boolean supportsBitmapIndex(BitmapIndexSelector selector) { <START> if(selector.getBitmapIndex(dimension) == null) { <END> return false; } else { return true; } }</code><technical_language>formatting</technical_language>

Target:
public boolean supportsBitmapIndex(BitmapIndexSelector selector) { return selector.getBitmapIndex(dimension) != null; }
Source:
<code>public JmsConfiguration incomingOsgpCoreRequestsJmsConfiguration( final JmsConfigurationFactory jmsConfigurationFactory) { <START> return jmsConfigurationFactory.initializeConfiguration("jms.incoming.osgp.core.requests", <END> this.incomingOsgpCoreRequestMessageListener); }</code><technical_language>JMS Template needed here, initialize JMS Template</technical_language>

Target:
public JmsConfiguration incomingOsgpCoreRequestsJmsConfiguration( final JmsConfigurationFactory jmsConfigurationFactory) { return jmsConfigurationFactory.initializeReceiveConfiguration("jms.incoming.osgp.core.requests", this.incomingOsgpCoreRequestMessageListener); }
Source:
<code>public void deregisterMetricsWithPrefix(Class clazz, String prefix) { <START> String fqnPrefix = MetricRegistry.name(clazz, prefix); <END> Set<String> relevantMetrics = registeredMetrics.stream() .filter(metricName -> metricName.startsWith(fqnPrefix)) .collect(Collectors.toSet()); relevantMetrics.forEach(this::deregisterMetric); }</code><technical_language>nice a test for this</technical_language>

Target:
public void deregisterMetricsWithPrefix(Class clazz, String prefix) { String fqnPrefix = prefix.isEmpty() ? clazz.getName() + "." : MetricRegistry.name(clazz, prefix); Set<String> relevantMetrics = registeredMetrics.stream() .filter(metricName -> metricName.startsWith(fqnPrefix)) .collect(Collectors.toSet()); relevantMetrics.forEach(this::deregisterMetric); }
Source:
<code>public String get() { String terminalArchivePath = System.getProperty("user.home") + "\\AppData\\Local\\che\\terminal"; <START> return terminalArchivePath + ":/mnt/che/terminal"; <END> }</code><technical_language>in line</technical_language>

Target:
public String get() { return System.getProperty("user.home") + "\\AppData\\Local\\che\\terminal" + ":/mnt/che/terminal"; }
Source:
<code>public void zkConnection() throws Exception { commonspec.getLogger().debug("Closing zookeeper connection"); <START> if (!"".equals(System.getProperty("ZOOKEEPER_CONNECT",""))) { <END> if(commonspec.getZkClient().isConnected()){ commonspec.getZkClient().disconnect(); } } }</code><technical_language>KAFKA_ZOOKEEPER_CONNECT</technical_language>

Target:
public void zkConnection() throws Exception { commonspec.getLogger().debug("Closing zookeeper connection"); if (!"".equals(System.getProperty("ZOOKEEPER_HOSTS",""))) { if(commonspec.getZkClient().isConnected()){ commonspec.getZkClient().disconnect(); } } }