auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>void assign( Field field, AnyValue value ) { switch ( field ) { case hour: hour = assignment( field, hour, value ); break; case minute: minute = assignment( field, minute, value ); break; case second: second = assignment( field, second, value ); break; case millisecond: millisecond = assignment( field, millisecond, value ); break; case microsecond: microsecond = assignment( field, microsecond, value ); break; case nanosecond: nanosecond = assignment( field, nanosecond, value ); break; case time: case datetime: time = assignment( field, time, value ); break; default: <START> throw new UnsupportedTemporalUnitException( "Not a time field: " + field ); <END> } }</code><technical_language>concern above</technical_language>

Target:
void assign( Field field, AnyValue value ) { switch ( field ) { case hour: hour = assignment( field, hour, value ); break; case minute: minute = assignment( field, minute, value ); break; case second: second = assignment( field, second, value ); break; case millisecond: millisecond = assignment( field, millisecond, value ); break; case microsecond: microsecond = assignment( field, microsecond, value ); break; case nanosecond: nanosecond = assignment( field, nanosecond, value ); break; case time: case datetime: time = assignment( field, time, value ); break; default: throw new IllegalStateException( "Not a time field: " + field ); } }
Source:
<code>public void checkStateChanged(CheckStateChangedEvent event) { TmfXYChartViewer chartViewer = getChartViewer(); if (chartViewer == null) { return; } if (TmfTraceManager.getInstance().getActiveTrace() == null) { return; } ICheckable checkboxTree = event.getCheckable(); if (checkboxTree instanceof CheckboxTreeViewer) { <START> fTriStateFilteredCheckboxTree.setSubtreeChecked(event.getElement(), event.getChecked()); <END> Set<@NonNull Integer> quarks = new TreeSet<>(); for (Object checkedElement : fTriStateFilteredCheckboxTree.getCheckedElements()) { if (checkedElement instanceof CounterTreeViewerEntry) { quarks.add(((CounterTreeViewerEntry) checkedElement).getQuark()); } } if (chartViewer instanceof CounterChartViewer) { ((CounterChartViewer) chartViewer).updateChart(quarks); } } }</code><technical_language>This line longer needed TriStateFilteredCheckboxTree takes care of it</technical_language>

Target:
public void checkStateChanged(CheckStateChangedEvent event) { TmfXYChartViewer chartViewer = getChartViewer(); if (chartViewer == null) { return; } if (TmfTraceManager.getInstance().getActiveTrace() == null) { return; } ICheckable checkboxTree = event.getCheckable(); if (checkboxTree instanceof CheckboxTreeViewer) { Set<@NonNull Integer> quarks = new TreeSet<>(); for (Object checkedElement : fTriStateFilteredCheckboxTree.getCheckedElements()) { if (checkedElement instanceof CounterTreeViewerEntry) { quarks.add(((CounterTreeViewerEntry) checkedElement).getQuark()); } } if (chartViewer instanceof CounterChartViewer) { ((CounterChartViewer) chartViewer).updateChart(quarks); } } }
Source:
<code>private <T> void assertBlockPositions(Block block, Supplier<BlockBuilder> newBlockBuilder, T[] expectedValues) { <START> try { <END> assertEquals(block.getPositionCount(), expectedValues.length); } catch (Exception e) { e.printStackTrace(); } for (int position = 0; position < block.getPositionCount(); position++) { assertBlockPosition(block, newBlockBuilder, position, expectedValues[position], expectedValues.getClass().getComponentType()); } }</code><technical_language>I understand this change. explain</technical_language>

Target:
private <T> void assertBlockPositions(Block block, Supplier<BlockBuilder> newBlockBuilder, T[] expectedValues) { assertEquals(block.getPositionCount(), expectedValues.length); for (int position = 0; position < block.getPositionCount(); position++) { assertBlockPosition(block, newBlockBuilder, position, expectedValues[position], expectedValues.getClass().getComponentType()); } }
Source:
<code>public Promise<Void> setup(final DeploymentDescriptorModel model) { addWorkItemHandlerModal.setup(LibraryConstants.AddWorkItemHandler, LibraryConstants.Name, LibraryConstants.Value); if (model.getWorkItemHandlers() == null) { model.setWorkItemHandlers(new ArrayList<>()); } workItemHandlersListPresenter.setup( view.getWorkItemHandlersTable(), model.getWorkItemHandlers(), <START> (workItemHandler, presenter) -> presenter.init(LibraryConstants.AddWorkItemHandler, <END> LibraryConstants.Name, LibraryConstants.Value, workItemHandler, this)); return promises.resolve(); }</code><technical_language>EditWorkItemHandler</technical_language>

Target:
public Promise<Void> setup(final DeploymentDescriptorModel model) { addWorkItemHandlerModal.setup(LibraryConstants.AddWorkItemHandler, LibraryConstants.Name, LibraryConstants.Value); if (model.getWorkItemHandlers() == null) { model.setWorkItemHandlers(new ArrayList<>()); } workItemHandlersListPresenter.setup( view.getWorkItemHandlersTable(), model.getWorkItemHandlers(), (workItemHandler, presenter) -> presenter.setupSectionConfig(LibraryConstants.EditWorkItemHandler, LibraryConstants.Name, LibraryConstants.Value, workItemHandler, this)); return promises.resolve(); }
Source:
<code>private ServerConfiguration toServerConfiguration(Node node) { return new ServerConfiguration() { @Override public InetSocketAddress getTsaPort() { return InetSocketAddress.createUnresolved(substitutor.substitute(node.getBindAddress()), node.getPort()); } @Override public InetSocketAddress getGroupPort() { <START> int groupPort = groupPortMapper.getPeerGroupPort(node, nodeContextSupplier.get().getNode()); <END> return InetSocketAddress.createUnresolved(substitutor.substitute(node.getGroupBindAddress()), groupPort); } @Override public String getHost() { return node.getHostname(); } @Override public String getName() { return node.getName(); } @Override public int getClientReconnectWindow() { return nodeContextSupplier.get().getCluster().getClientReconnectWindow().getExactQuantity(TimeUnit.SECONDS).intValueExact(); } @Override public File getLogsLocation() { String sanitizedNodeName = node.getName().replace(":", "-"); return (unConfigured) ? null : substitutor.substitute(pathResolver.resolve(node.getLogDir().resolve(sanitizedNodeName))).toFile(); } @Override public String toString() { return node.getName() + "@" + node.getAddress(); } }; }</code><technical_language>nodeContextSupplier.get() in multiple places put in variable reused</technical_language>

Target:
private ServerConfiguration toServerConfiguration(Node node) { return new DynamicConfigServerConfiguration(node, nodeContextSupplier, substitutor, groupPortMapper, pathResolver, unConfigured); }
Source:
<code>public static boolean returnsVoid(Method method) { <START> return method.getReturnType().toString().equals("void"); <END> }</code><technical_language>method.getReturnType().equals(void.class)</technical_language>

Target:
public static boolean returnsVoid(Method method) { return method.getReturnType().equals(Void.TYPE); }
Source:
<code>public long getSize(Configuration configuration) { try { if (dataset instanceof AbstractRefinableView) { return ((AbstractRefinableView) dataset).getSize(); } else if (dataset instanceof AbstractDataset) { return ((AbstractDataset) dataset).getSize(); } } catch (UnsupportedOperationException e) { <START> } <END> logger.warn("Cannot determine size for dataset: " + toString()); return 1000L * 1000L * 1000L; }</code><technical_language>This simpler if a ReportsSize interface (with a name?): if (view instanceof ReportsSize) { return ((ReportsSize) view).getSize(); } else { return DEFAULT_DATASET_SIZE; }</technical_language>

Target:
public long getSize(Configuration configuration) { if (view instanceof SizeAccessor) { return ((SizeAccessor) view).getSize(); } logger.warn("Cannot determine size for view: " + toString()); return 1000L * 1000L * 1000L; }
Source:
<code>private SdxUpgradeReplaceVms shouldReplaceVmsAfterUpgrade(SdxUpgradeRequest upgradeRequest) { return Optional.ofNullable(upgradeRequest) .map(SdxUpgradeRequest::getReplaceVms) <START> .orElse(SdxUpgradeReplaceVms.ENABLED); <END> }</code><technical_language>pls log? useful: LOGGER.debug("VM-s replacement upgrade process is {}", replaceVms.name());</technical_language>

Target:
private SdxUpgradeReplaceVms shouldReplaceVmsAfterUpgrade(SdxUpgradeRequest upgradeRequest) { SdxUpgradeReplaceVms replaceVms = Optional.ofNullable(upgradeRequest) .map(SdxUpgradeRequest::getReplaceVms) .orElse(SdxUpgradeReplaceVms.ENABLED); LOGGER.debug("VM-s replacement after the upgrade process is {}", replaceVms.name()); return replaceVms; }
Source:
<code>public Cohort(String commaSeparatedIds) { this(); for (StringTokenizer st = new StringTokenizer(commaSeparatedIds, ","); st.hasMoreTokens();) { String id = st.nextToken(); Patient pid = new Patient(Integer.valueOf(id.trim())); <START> members.add(new CohortMembership(pid)); <END> } }</code><technical_language>call addMembership(CohortMembership), call addMembership() instead of adding members collection, adding member list happen in addMembership(CohortMembership) method responsible for setting cohort field membership</technical_language>

Target:
public Cohort(String commaSeparatedIds) { this(); for (StringTokenizer st = new StringTokenizer(commaSeparatedIds, ","); st.hasMoreTokens();) { String id = st.nextToken(); Patient pid = new Patient(Integer.valueOf(id.trim())); addMembership(new CohortMembership(pid)); } }
Source:
<code>public CorsConfiguration getCorsConfiguration(HttpServletRequest request) { String path = request.getPathInfo(); if (path.indexOf("/environments/") > -1) { int envIdStartIndex = path.indexOf("/environments/") + "/environments/".length(); <START> String environmentId = path.substring(envIdStartIndex, path.indexOf('/', envIdStartIndex)); <END> GraviteeCorsConfiguration corsConfiguration = corsConfigurationByEnvironment.get(environmentId); if (corsConfiguration == null) { corsConfiguration = new GraviteeCorsConfiguration(parameterService, eventManager, environmentId); this.corsConfigurationByEnvironment.put(environmentId, corsConfiguration); } return corsConfiguration; } return super.getCorsConfiguration(request); }</code><technical_language>remark for spring of apache uitility</technical_language>

Target:
public CorsConfiguration getCorsConfiguration(HttpServletRequest request) { String environmentId = computeEnvironmentId(request); if (environmentId != null) { GraviteeCorsConfiguration corsConfiguration = corsConfigurationByEnvironment.get(environmentId); if (corsConfiguration == null) { corsConfiguration = new GraviteeCorsConfiguration(parameterService, eventManager, environmentId); this.corsConfigurationByEnvironment.put(environmentId, corsConfiguration); } return corsConfiguration; } return super.getCorsConfiguration(request); }
Source:
<code>public void undoQuote() { PostgreSQLDbSupport dbSupport = new PostgreSQLDbSupport(null); assertEquals("abc", dbSupport.unQuote("\"abc\"")); <START> assertEquals("abc", dbSupport.unQuote("abc\"")); <END> assertEquals("abc", dbSupport.unQuote("\"abc")); assertEquals("a\"b\"c", dbSupport.unQuote("a\"b\"c")); assertEquals("a\"b\"c", dbSupport.unQuote("\"a\"b\"c")); }</code><technical_language>is this other cases line 34 37 necessary</technical_language>

Target:
public void undoQuote() { PostgreSQLDbSupport dbSupport = new PostgreSQLDbSupport(null); assertEquals("abc", dbSupport.unQuote("\"abc\"")); assertEquals("abc", dbSupport.unQuote("abc")); }
Source:
<code>public boolean needsInput() { <START> boolean stateNeedsInput = state == State.CONSUMING_INPUT <END> || (state == State.SPILLING_INPUT && spillInProgress.isDone()); return stateNeedsInput && !lookupSourceFactoryDestroyed.isDone(); }</code><technical_language>add parentheses</technical_language>

Target:
public boolean needsInput() { boolean stateNeedsInput = (state == State.CONSUMING_INPUT) || (state == State.SPILLING_INPUT && spillInProgress.isDone()); return stateNeedsInput && !lookupSourceFactoryDestroyed.isDone(); }
Source:
<code>public void handleLifecycleEvent(SaveablesLifecycleEvent event) { ISaveablesLifecycleListener lifecycleListener= getSite().getService(ISaveablesLifecycleListener.class); if (event.getEventType() == SaveablesLifecycleEvent.POST_CLOSE) { if (knownSaveables == null || knownSaveables.isEmpty()) return; <START> java.util.List<Saveable> result = new ArrayList<Saveable>(); <END> Saveable[] all = event.getSaveables(); for (int i = 0; i < all.length; i++) { Saveable saveable = all[i]; if (knownSaveables.contains(saveable)) result.add(saveable); knownSaveables.remove(saveable); } if (result.isEmpty()) return; event = new SaveablesLifecycleEvent(this, SaveablesLifecycleEvent.POST_CLOSE, result.toArray(new Saveable[result.size()]), false); } else if (event.getEventType() == SaveablesLifecycleEvent.POST_OPEN) { recordSaveables(event.getSaveables()); } lifecycleListener.handleLifecycleEvent(event); }</code><technical_language>new ArrayList<>();</technical_language>

Target:
public void handleLifecycleEvent(SaveablesLifecycleEvent event) { ISaveablesLifecycleListener lifecycleListener= getSite().getService(ISaveablesLifecycleListener.class); if (event.getEventType() == SaveablesLifecycleEvent.POST_CLOSE) { if (knownSaveables == null || knownSaveables.isEmpty()) return; java.util.List<Saveable> result = new ArrayList<>(); Saveable[] all = event.getSaveables(); for (int i = 0; i < all.length; i++) { Saveable saveable = all[i]; if (knownSaveables.contains(saveable)) result.add(saveable); knownSaveables.remove(saveable); } if (result.isEmpty()) return; event = new SaveablesLifecycleEvent(this, SaveablesLifecycleEvent.POST_CLOSE, result.toArray(new Saveable[result.size()]), false); } else if (event.getEventType() == SaveablesLifecycleEvent.POST_OPEN) { recordSaveables(event.getSaveables()); } lifecycleListener.handleLifecycleEvent(event); }
Source:
<code>private SolverManager<TestdataSolution, Integer> createSolverManagerTestableByDifferentConsumers() { final SolverConfig solverConfig = PlannerTestUtils.buildSolverConfig(TestdataSolution.class, TestdataEntity.class) .withPhases(new CustomPhaseConfig().withCustomPhaseCommands( <START> (ScoreDirector<TestdataSolution> scoreDirector) -> { TestdataSolution solution = scoreDirector.getWorkingSolution(); TestdataEntity entity = solution.getEntityList().get(0); scoreDirector.beforeVariableChanged(entity, "value"); entity.setValue(solution.getValueList().get(0)); scoreDirector.afterVariableChanged(entity, "value"); scoreDirector.triggerVariableListeners(); }), new CustomPhaseConfig().withCustomPhaseCommands( (ScoreDirector<TestdataSolution> scoreDirector) -> { TestdataSolution solution = scoreDirector.getWorkingSolution(); TestdataEntity entity = solution.getEntityList().get(1); scoreDirector.beforeVariableChanged(entity, "value"); entity.setValue(solution.getValueList().get(1)); scoreDirector.afterVariableChanged(entity, "value"); scoreDirector.triggerVariableListeners(); })); <END> SolverManagerConfig solverManagerConfig = new SolverManagerConfig(); return SolverManager.create(solverConfig, solverManagerConfig); }</code><technical_language>phase commands identical. Reuse</technical_language>

Target:
private SolverManager<TestdataSolution, Integer> createSolverManagerTestableByDifferentConsumers() { final SolverConfig solverConfig = PlannerTestUtils.buildSolverConfig(TestdataSolution.class, TestdataEntity.class) .withPhases(createGraduallyInitializedPhaseConfigs()); SolverManagerConfig solverManagerConfig = new SolverManagerConfig(); return SolverManager.create(solverConfig, solverManagerConfig); }
Source:
<code>protected boolean isInstalledPackage(String pkgName) { try { return service.getPersistence().getActivePackageId(pkgName) != null; } catch (PackageException e) { <START> log.error(e); <END> return false; } }</code><technical_language>log.error("Failed check package installation for: " + pkgName, e) informative a stack trace (log.error(e) e message throwable show stack trace)</technical_language>

Target:
protected boolean isInstalledPackage(String pkgName) { try { return service.getPersistence().getActivePackageId(pkgName) != null; } catch (PackageException e) { log.error("Error checking installation of package " + pkgName, e); return false; } }
Source:
<code>public void saveAccount(Account account) { StorageEditor editor = storage.edit(); <START> if (!accounts.containsKey(account.getUuid())) { <END> int accountNumber = generateAccountNumber(); account.setAccountNumber(accountNumber); } DI.get(AccountPreferenceSerializer.class).save(storage, editor, account); }</code><technical_language>new accounts added accounts uuids here. This results in new accounts -1 accountNumber. if (account.getAccountNumber() < 0) { instead work for me</technical_language>

Target:
public void saveAccount(Account account) { StorageEditor editor = storage.edit(); if (!accounts.containsKey(account.getUuid())) { int accountNumber = generateAccountNumber(); account.setAccountNumber(accountNumber); } processChangedValues(account); accountPreferenceSerializer.save(storage, editor, account); }
Source:
<code>public String getText(Object element) { <START> return "Change " + ((ActivityEvent) element).getAttributes().get("taskId") + ": " + ((ActivityEvent) element).getSummary(); END> }</code><technical_language>NLS.bind() construct string</technical_language>

Target:
public String getText(Object element) { return NLS.bind("Change {0}: {1}", ((ActivityEvent) element).getAttributes().get("taskId"), ((ActivityEvent) element).getSummary()); }
Source:
<code>private void checkAndUpdateProjectID(String projectID) { <START> if (!preferences.isAuthenticationEnabled() || !preferences.getOrCreateProjectSetting(WatchDogUtils.getProjectName()).enableWatchdog) { <END> preferences.registerProjectId(WatchDogUtils.getProjectName(), projectID); return; } if (projectID.length() < ID_LENGTH) { if(enableWatchdogInput.isSelected() && WatchDogUtils.isEmpty(projectIDInput.getText())) { new ProjectRegistrationWizard("Project Registration", WatchDogUtils.getProject()).show(); return; } Messages.showErrorDialog("Project ID must have 40 characters!", "Invalid Input"); isModified = true; } else { String url = NetworkUtils.buildExistingProjectURL(projectID); switch (NetworkUtils.urlExistsAndReturnsStatus200(url)) { case SUCCESSFUL: preferences.registerProjectId(WatchDogUtils.getProjectName(), projectID); break; case UNSUCCESSFUL: case NETWORK_ERROR: Messages.showErrorDialog("Project ID does not exist!", "Invalid Input"); isModified = true; break; } } }</code><technical_language>factor out projectName easier read</technical_language>

Target:
private void checkAndUpdateProjectID(String projectID) { String projectName = WatchDogUtils.getProjectName(); if (!preferences.isAuthenticationEnabled() || !preferences.getOrCreateProjectSetting(projectName).enableWatchdog) { preferences.registerProjectId(WatchDogUtils.getProjectName(), projectID); return; } if (projectID.length() < ID_LENGTH) { if(enableWatchdogInput.isSelected() && WatchDogUtils.isEmpty(projectIDInput.getText())) { new ProjectRegistrationWizard("Project Registration", WatchDogUtils.getProject()).show(); return; } Messages.showErrorDialog("Project ID must have 40 characters!", "Invalid Input"); isModified = true; } else { String url = NetworkUtils.buildExistingProjectURL(projectID); switch (NetworkUtils.urlExistsAndReturnsStatus200(url)) { case SUCCESSFUL: preferences.registerProjectId(WatchDogUtils.getProjectName(), projectID); break; case UNSUCCESSFUL: case NETWORK_ERROR: Messages.showErrorDialog("Project ID does not exist!", "Invalid Input"); isModified = true; break; } } }
Source:
<code>boolean match(AccountGroup.UUID uuid, boolean isChangeOwner) { if (AccountGroup.PROJECT_OWNERS.equals(uuid)) { return isDeclaredOwner(); } else if (AccountGroup.CHANGE_OWNERS.equals(uuid) && isChangeOwner) { <START> return true; <END> } else { return user.getEffectiveGroups().contains(uuid); } }</code><technical_language>sense continue else branch if AccountGroup.CHANGE_OWNERS.equals(uuid) isChangeOwner is false? I code this: } else if (AccountGroup.CHANGE_OWNERS.equals(uuid)) { return isChangeOwner; } else { ..</technical_language>

Target:
boolean match(AccountGroup.UUID uuid, boolean isChangeOwner) { if (AccountGroup.PROJECT_OWNERS.equals(uuid)) { return isDeclaredOwner(); } else if (AccountGroup.CHANGE_OWNERS.equals(uuid)) { return isChangeOwner; } else { return user.getEffectiveGroups().contains(uuid); } }
Source:
<code>private void configureCacheHeaders(final HttpServletResponse res, final String module) { final String cacheScopeProperty = String.format(CACHE_SCOPE_PROPERTY_FORMAT, module); final String cacheScopeValue = environment.getProperty(cacheScopeProperty); logger.debug("Selecting cacheScopeValue='{}' for property '{}'", cacheScopeValue, cacheScopeProperty); final String cacheMaxAgeProperty = String.format(CACHE_MAXAGE_PROPERTY_FORMAT, module); <START> final String cacheMaxAgeValue = environment.getProperty(cacheMaxAgeProperty); <END> logger.debug("Selecting cacheMaxAgeValue='{}' for property '{}'", cacheMaxAgeValue, cacheMaxAgeProperty); final String cacheControl = (StringUtils.isNotEmpty(cacheScopeValue) && StringUtils.isNotEmpty(cacheMaxAgeValue)) ? cacheScopeValue + ", max-age=" + cacheMaxAgeValue : CACHE_CONTROL_NOSTORE; logger.debug("Setting cache-control='{}' for module '{}'", cacheControl, module); res.setHeader(Headers.CACHE_CONTROL.getName(), cacheControl); }</code><technical_language>Max age integer representing seconds, reflected in type here? ref: <LINK_0></technical_language>

Target:
private void configureCacheHeaders(final HttpServletResponse res, final String module) { final String cacheScopeProperty = String.format(CACHE_SCOPE_PROPERTY_FORMAT, module); final String cacheScopeValue = environment.getProperty(cacheScopeProperty); logger.debug("Selecting cacheScopeValue='{}' for property '{}'", cacheScopeValue, cacheScopeProperty); final String cacheMaxAgeProperty = String.format(CACHE_MAXAGE_PROPERTY_FORMAT, module); final Integer cacheMaxAgeValueSeconds = environment.getProperty(cacheMaxAgeProperty, Integer.class); logger.debug("Selecting cacheMaxAgeValueSeconds='{}' for property '{}'", cacheMaxAgeValueSeconds, cacheMaxAgeProperty); final String cacheControl = (StringUtils.isNotEmpty(cacheScopeValue) && cacheMaxAgeValueSeconds != null) ? cacheScopeValue + ", max-age=" + cacheMaxAgeValueSeconds : CACHE_CONTROL_NOSTORE; logger.debug("Setting cache-control='{}' for module '{}'", cacheControl, module); res.setHeader(Headers.CACHE_CONTROL.getName(), cacheControl); }
Source:
<code>public Optional<PlanNode> apply(PlanNode node, Lookup lookup, PlanNodeIdAllocator idAllocator, SymbolAllocator symbolAllocator, Session session) { LateralJoinNode lateralJoinNode = (LateralJoinNode) node; <START> if (lateralJoinNode.getType() == JoinType.INNER) { <END> return Optional.empty(); } if (!lateralJoinNode.getCorrelation().isEmpty()) { return Optional.empty(); } return Optional.of(new JoinNode( idAllocator.getNextId(), JoinType.INNER, lateralJoinNode.getInput(), lateralJoinNode.getSubquery(), ImmutableList.of(), ImmutableList.<Symbol>builder() .addAll(lateralJoinNode.getInput().getOutputSymbols()) .addAll(lateralJoinNode.getSubquery().getOutputSymbols()) .build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty())); }</code><technical_language>!=</technical_language>

Target:
public Optional<PlanNode> apply(PlanNode node, Lookup lookup, PlanNodeIdAllocator idAllocator, SymbolAllocator symbolAllocator, Session session) { LateralJoinNode lateralJoinNode = (LateralJoinNode) node; if (lateralJoinNode.getType() != JoinType.INNER) { return Optional.empty(); } if (!lateralJoinNode.getCorrelation().isEmpty()) { return Optional.empty(); } return Optional.of(new JoinNode( idAllocator.getNextId(), JoinType.INNER, lateralJoinNode.getInput(), lateralJoinNode.getSubquery(), ImmutableList.of(), ImmutableList.<Symbol>builder() .addAll(lateralJoinNode.getInput().getOutputSymbols()) .addAll(lateralJoinNode.getSubquery().getOutputSymbols()) .build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty())); }
Source:
<code>public void canRetrieveUsers() throws Exception { MatcherAssert.assertThat( "Retrieved inexistent user", new User.Smart( new MkGithub().users().get("other") ).exists(), <START> new IsEqual<>(true) <END> ); }</code><technical_language>@paulodamaso but, ticket's [description](<LINK_0> this false user exist</technical_language>

Target:
public void canRetrieveUsers() throws Exception { MatcherAssert.assertThat( "Retrieved inexistent user", new User.Smart( new MkGithub().users().get("other") ).exists(), new IsEqual<Boolean>(false) ); }
Source:
<code>public static void main(String...argv) throws Exception { Preconditions.checkElementIndex(0, argv.length, "Must specify broker URL"); String url = argv[0]; System.setProperty(ClientProperties.AMQP_VERSION, "0-10"); System.setProperty(ClientProperties.DEST_SYNTAX, "ADDR"); AMQConnectionFactory factory = new AMQConnectionFactory(url); Connection connection = factory.createConnection(); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); System.out.printf("Waiting up to %s milliseconds to receive %s messages\n", MESSAGE_TIMEOUT_MILLIS, MESSAGE_COUNT); try { Queue destination = session.createQueue(QUEUE); MessageConsumer messageConsumer = session.createConsumer(destination); int n = MESSAGE_COUNT; do { TextMessage msg = (TextMessage) messageConsumer.receive(MESSAGE_TIMEOUT_MILLIS); if (msg == null) break; System.out.printf("Got message: '%s'\n", msg.getText()); <START> } while (--n > 0); <END> } catch (Exception e) { System.err.printf("Error while receiving - %s\n", e.getMessage()); System.err.printf("Cause: %s\n", Throwables.getStackTraceAsString(e)); } finally { session.close(); connection.close(); } }</code><technical_language>a for loop, I wonder? Also, write out if msg==null exiting. change System.out.printf("Got message %d: '%s'\n", n+1, msg.getText()); - assuming a for loop, count 0</technical_language>

Target:
public static void main(String...argv) throws Exception { Preconditions.checkElementIndex(0, argv.length, "Must specify broker URL"); String url = argv[0]; System.setProperty(ClientProperties.AMQP_VERSION, "0-10"); System.setProperty(ClientProperties.DEST_SYNTAX, "ADDR"); AMQConnectionFactory factory = new AMQConnectionFactory(url); Connection connection = factory.createConnection(); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); System.out.printf("Waiting up to %s milliseconds to receive %s messages\n", MESSAGE_TIMEOUT_MILLIS, MESSAGE_COUNT); try { Queue destination = session.createQueue(QUEUE); MessageConsumer messageConsumer = session.createConsumer(destination); for (int n = 0; n < MESSAGE_COUNT; n++) { TextMessage msg = (TextMessage) messageConsumer.receive(MESSAGE_TIMEOUT_MILLIS); if (msg == null) { System.out.printf("No message received in %s milliseconds, exiting", MESSAGE_TIMEOUT_MILLIS); break; } System.out.printf("Got message %d: '%s'\n", n+1, msg.getText()); } } catch (Exception e) { System.err.printf("Error while receiving - %s\n", e.getMessage()); System.err.printf("Cause: %s\n", Throwables.getStackTraceAsString(e)); } finally { session.close(); connection.close(); } }
Source:
<code>public BigDecimal getExchangeRateLast(String cryptoCurrency, String fiatCurrency) { if (!getFiatCurrencies().contains(fiatCurrency)) { return null; } <START> final BnbTickerData BTC_USD_Price = api.getTicker("BTCUSDT"); <END> final BnbTickerData Coin_BTC_Price = api.getTicker(cryptoCurrency + "BTC"); final List<Object> USDT_Fiat_data = api_tether.getTetherPrice(fiatCurrency.toLowerCase(), "tether"); if (USDT_Fiat_data != null && BTC_USD_Price.getPrice()!=null && Coin_BTC_Price.getPrice() !=null ) { final Map<String, Object> USDT_Fiat_json = (Map<String, Object>) USDT_Fiat_data.get(0); final Double USDT_Fiat = (Double) USDT_Fiat_json.get("current_price"); if (USDT_Fiat != 0) { final Float Coin_Fiat_Price = (float) (BTC_USD_Price.getPrice() * Coin_BTC_Price.getPrice() * USDT_Fiat); return new BigDecimal(String.format( "%.3f", Coin_Fiat_Price )); } else return null; } return null; }</code><technical_language>Change name (the price is in USDT, USD)</technical_language>

Target:
public BigDecimal getExchangeRateLast(String cryptoCurrency, String fiatCurrency) { if (!getFiatCurrencies().contains(fiatCurrency)) { return null; } final BinanceTickerData btcUsdt = api.getTicker("BTCUSDT"); final BinanceTickerData lskBtc = api.getTicker(cryptoCurrency + "BTC"); CoinmarketcapRateSource coinMarketCapSource = new CoinmarketcapRateSource(fiatCurrency); BigDecimal lastUsdtFiat = coinMarketCapSource.getExchangeRateLast("USDT", fiatCurrency); if (lastUsdtFiat != null && btcUsdt.getPrice()!=null && lskBtc.getPrice() !=null ) { BigDecimal lastBtcPriceInUsdt = btcUsdt.getPrice(); BigDecimal lastLskPriceInBtc = lskBtc.getPrice(); BigDecimal lastLskPriceInUsdt = lastLskPriceInBtc.multiply(lastBtcPriceInUsdt); BigDecimal lastLskPriceInFiat = lastLskPriceInUsdt.multiply(lastUsdtFiat); return lastLskPriceInFiat; } return null; }
Source:
<code>public void start() { advancedListener = new AdvancedPurgeListener<>(expirationManager); preloaded = false; enabled = configuration.persistence().usingStores(); if (!enabled) return; try { createLoadersAndWriters(); Transaction xaTx = null; if (transactionManager != null) { xaTx = transactionManager.suspend(); } storesMutex.readLock().lock(); try { Set<Lifecycle> undelegated = new HashSet<>(); nonTxWriters.forEach(w -> startWriter(w, undelegated)); txWriters.forEach(w -> startWriter(w, undelegated)); loaders.forEach(l -> startLoader(l, undelegated)); <START> List<Observable<StoreAvailability>> availabilityChecks = storeStatuses.values().stream().map(s -> s.observable).collect(Collectors.toList()); <END> Observable.merge(availabilityChecks) .observeOn(Schedulers.from(persistenceExecutor)) .subscribe(storeAvailability -> { storesMutex.writeLock().lock(); try { StoreStatus storeStatus = storeStatuses.get(storeAvailability.store); if (storeStatus.available != storeAvailability.available) { storeStatus.available = storeAvailability.available; cacheNotifier.notifyPersistenceAvailabilityChanged(storeAvailability.available); for (StoreStatus s : storeStatuses.values()) { if (!s.available) { unavailableException = new StoreUnavailableException(String.format("Store %s is unavailable", storeAvailability.store)); managerAvailable = false; return; } } if (!managerAvailable) { managerAvailable = true; unavailableException = null; } } } finally { storesMutex.writeLock().unlock(); } }); } finally { if (xaTx != null) { transactionManager.resume(xaTx); } storesMutex.readLock().unlock(); } } catch (Exception e) { throw new CacheException("Unable to start cache loaders", e); } }</code><technical_language>Need reactive streams :) able <LINK_0> <LINK_1> instead of collecting a List</technical_language>

Target:
public void start() { advancedListener = new AdvancedPurgeListener<>(expirationManager); preloaded = false; enabled = configuration.persistence().usingStores(); if (!enabled) return; try { createLoadersAndWriters(); Transaction xaTx = null; if (transactionManager != null) { xaTx = transactionManager.suspend(); } storesMutex.writeLock().lock(); try { Set<Lifecycle> undelegated = new HashSet<>(); nonTxWriters.forEach(w -> startWriter(w, undelegated)); txWriters.forEach(w -> startWriter(w, undelegated)); loaders.forEach(l -> startLoader(l, undelegated)); pollStoreAvailability(); long interval = configuration.persistence().availabilityInterval(); availabilityFuture = persistenceExecutor.scheduleAtFixedRate(this::pollStoreAvailability, interval, interval, TimeUnit.MILLISECONDS); } finally { if (xaTx != null) { transactionManager.resume(xaTx); } storesMutex.writeLock().unlock(); } } catch (Exception e) { throw new CacheException("Unable to start cache loaders", e); } }
Source:
<code>private void signJar(File outputFile) { SecurityLogger.audit("Signing exported data. file: [{}]", outputFile.getName()); console.println("Signing zip file..."); Instant start = Instant.now(); jarSigner.signJar( outputFile, <START> System.getProperty(SystemBaseUrl.EXTERNAL_HOST), <END> AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword")), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStore")), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword"))); console.println("zip file signed in: " + getFormattedDuration(start)); }</code><technical_language>Missed this one</technical_language>

Target:
private void signJar(File outputFile) { SecurityLogger.audit("Signing exported data. file: [{}]", outputFile.getName()); console.println("Signing zip file..."); Instant start = Instant.now(); jarSigner.signJar( outputFile, AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SystemBaseUrl.EXTERNAL_HOST)), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword")), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStore")), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword"))); console.println("zip file signed in: " + getFormattedDuration(start)); }
Source:
<code>protected void end() { <START> log.debug("end called"); <END> if(execThread != null) { log.debug("Interrupting exec thread"); this.execThread.interrupt(); } log.debug("Cancelling invoked commands"); if(this.invokedCommands != null) { for(Command command : invokedCommands) { command.cancel(); } this.invokedCommands = null; } }</code><technical_language>in one-time call methods, interrupted & end, info logging, spam logs</technical_language>

Target:
public void end() { log.info("Ending"); if(execThread != null) { log.debug("Interrupting exec thread"); this.execThread.interrupt(); } log.debug("Cancelling invoked commands"); if(this.invokedCommands != null) { for(BaseCommand command : invokedCommands) { log.info("Cancelling command " + command); command.cancel(); } this.invokedCommands = null; } else { log.info("No invoked commands to cancel"); } }
Source:
<code>public boolean canLogAtLevel(LogLevel logLevel) { <START> switch (logLevel) { <END> case VERBOSE: return logger.isDebugEnabled(); case INFORMATIONAL: return logger.isInfoEnabled(); case WARNING: return logger.isWarnEnabled(); case ERROR: return logger.isErrorEnabled(); default: return false; } }</code><technical_language>This null check is required a NPE</technical_language>

Target:
public boolean canLogAtLevel(LogLevel logLevel) { if (logLevel == null) { return false; } switch (logLevel) { case VERBOSE: return logger.isDebugEnabled(); case INFORMATIONAL: return logger.isInfoEnabled(); case WARNING: return logger.isWarnEnabled(); case ERROR: return logger.isErrorEnabled(); default: return false; } }
Source:
<code>public static long millisUntilNextAvailableRequest(long secondsToNextAvailableRequest) { <START> return secondsToNextAvailableRequest * 8000; <END> }</code><technical_language>This return seconds next request. previous looked OK, configures exact returned provider in response headers</technical_language>

Target:
public static long millisUntilNextAvailableRequest(long secondsToNextAvailableRequest) { return secondsToNextAvailableRequest * 1000; }
Source:
<code>private static void registerSpellcasterFactionNpc() { NpcFactionDeclaration reg; <START> Supplier<Runnable> register_wizardry_spellcaster = () -> () -> { <END> wizreg = new NpcFactionDeclaration(NpcFactionSpellcasterWizardry.class, AWEntityRegistry.NPC_FACTION_SPELLCASTER, SPELLCASTER_SUBTYPE); addNpcRegistration(wizreg); }; if (Loader.isModLoaded("ebwizardry")) { register_wizardry_spellcaster.get().run(); } else { reg = new NpcFactionDeclaration(NpcFactionSpellcaster.class, AWEntityRegistry.NPC_FACTION_SPELLCASTER, SPELLCASTER_SUBTYPE); addNpcRegistration(reg); } }</code><technical_language>Camel case variable</technical_language>

Target:
private static void registerSpellcasterFactionNpc() { NpcFactionDeclaration reg; Supplier<Runnable> registerWizardrySpellcaster = () -> () -> { wizreg = new NpcFactionDeclaration(NpcFactionSpellcasterWizardry.class, AWEntityRegistry.NPC_FACTION_SPELLCASTER, SPELLCASTER_SUBTYPE); addNpcRegistration(wizreg); }; if (Loader.isModLoaded("ebwizardry")) { registerWizardrySpellcaster.get().run(); } else { reg = new NpcFactionDeclaration(NpcFactionSpellcaster.class, AWEntityRegistry.NPC_FACTION_SPELLCASTER, SPELLCASTER_SUBTYPE); addNpcRegistration(reg); } }
Source:
<code>private boolean updateParameters() { for (MoveDiskParameters moveDiskParameters : getParameters().getParametersList()) { DiskImage diskImage = getDiskImageDao().getAncestor(moveDiskParameters.getImageId()); if (diskImage == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } List<VM> allVms = getVmDAO().getVmsListForDisk(diskImage.getId()); VM vm = !allVms.isEmpty() ? allVms.get(0) : null; SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); if (vm != null && !validate(snapshotsValidator.vmNotInPreview(vm.getId()))) { return false; } <START> else if (vm == null || isVmDown(vm)) { <END> moveParametersList.add(moveDiskParameters); } else if (isVmRunning(vm)) { MultiValueMapUtils.addToMap(vm.getId(), createLiveMigrateDiskParameters(moveDiskParameters, vm.getId()), vmsLiveMigrateParametersMap); } else { addCanDoActionMessage(String.format("$%1$s %2$s", "VmName", vm.getVmName())); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP); } } return true; }</code><technical_language>redundant 'else' removed</technical_language>

Target:
private boolean updateParameters() { for (MoveDiskParameters moveDiskParameters : getParameters().getParametersList()) { DiskImage diskImage = getDiskImageDao().get(moveDiskParameters.getImageId()); if (diskImage == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } List<VM> allVms = getVmDAO().getVmsListForDisk(diskImage.getId()); VM vm = !allVms.isEmpty() ? allVms.get(0) : null; SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); if (vm != null && !validate(snapshotsValidator.vmNotInPreview(vm.getId()))) { return false; } if (vm == null || isVmDown(vm)) { moveParametersList.add(moveDiskParameters); } else if (isVmRunning(vm)) { MultiValueMapUtils.addToMap(vm.getId(), createLiveMigrateDiskParameters(moveDiskParameters, vm.getId()), vmsLiveMigrateParametersMap); } else { addCanDoActionMessage(String.format("$%1$s %2$s", "VmName", vm.getVmName())); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP); } } return true; }
Source:
<code>public String getContent() { String contentUrl = this.getAsString(WikiXPath.enclosureUrl); StringWriter writer = new StringWriter(); try { InputStream contentStream = (InputStream)getService().getEndpoint().xhrGet(contentUrl).getData(); IOUtils.copy(contentStream, writer, "UTF-8"); <START> contentStream.close(); <END> } catch (IOException e) { e.printStackTrace(); } catch (ClientServicesException e) { e.printStackTrace(); } String content = writer.toString(); return content; }</code><technical_language>Move contentStream.close(); finally{ } block</technical_language>

Target:
public String getContent() { if (fields.containsKey(AtomXPath.content.getName())){ Object value = fields.get(AtomXPath.content.getName()); return (value == null) ? null : value.toString(); } String content = ""; try { content = getHtmlMarkup(); } catch (ClientServicesException e) { e.printStackTrace(); } return content; }
Source:
<code>private void notifySerialDataReceived(final String address, final byte[] data) { logger.info("Serial data received from >> {}.", address, HexUtils.prettyHexString(HexUtils.byteArrayToHexString(data))); try { synchronized (serialDataReceiveListeners) { ScheduledExecutorService executor = Executors.newScheduledThreadPool(Math.min(MAXIMUM_PARALLEL_LISTENER_THREADS, serialDataReceiveListeners.size())); for (final ISerialDataReceiveListener listener:serialDataReceiveListeners) { executor.execute(new Runnable() { public void run() { listener.serialDataReceived(address, data); } }); } executor.shutdown(); } <START> } catch (Exception e) { <END> logger.error(e.getMessage(), e); } }</code><technical_language>@rubenmoral, @diescalo, @daescalona curious, expecting thrown here? Curiosity more else..</technical_language>

Target:
private void notifySerialDataReceived(final String address, final byte[] data) { logger.info(connectionInterface.toString() + "Serial data received from >> {}.", address, HexUtils.prettyHexString(HexUtils.byteArrayToHexString(data))); try { synchronized (serialDataReceiveListeners) { ScheduledExecutorService executor = Executors.newScheduledThreadPool(Math.min(MAXIMUM_PARALLEL_LISTENER_THREADS, serialDataReceiveListeners.size())); for (final ISerialDataReceiveListener listener:serialDataReceiveListeners) { executor.execute(new Runnable() { public void run() { listener.serialDataReceived(address, data); } }); } executor.shutdown(); } } catch (Exception e) { logger.error(e.getMessage(), e); } }
Source:
<code>private UnbackedAnnotatedType(AnnotatedType<X> source, AnnotatedTypeIdentifier identifier, SharedObjectCache cache) { super(source.getBaseType(), source.getTypeClosure(), source.getAnnotations()); this.javaClass = source.getJavaClass(); Set<AnnotatedConstructor<X>> constructors = new HashSet<AnnotatedConstructor<X>>(source.getConstructors().size()); for (AnnotatedConstructor<X> constructor : source.getConstructors()) { constructors.add(UnbackedAnnotatedConstructor.of(constructor, this, cache)); } <START> this.constructors = immutableSet(constructors); <END> Set<AnnotatedMethod<? super X>> methods = new HashSet<AnnotatedMethod<? super X>>(source.getMethods().size()); for (AnnotatedMethod<? super X> originalMethod : source.getMethods()) { methods.add(UnbackedAnnotatedMethod.of(originalMethod, this, cache)); } this.methods = immutableSet(methods); Set<AnnotatedField<? super X>> fields = new HashSet<AnnotatedField<? super X>>(source.getFields().size()); for (AnnotatedField<? super X> originalField : source.getFields()) { fields.add(UnbackedAnnotatedField.of(originalField, this, cache)); } this.fields = immutableSet(fields); this.identifier = identifier; }</code><technical_language>org.jboss.weld.util.collections.ImmutableSet.Builder below..</technical_language>

Target:
private UnbackedAnnotatedType(AnnotatedType<X> source, AnnotatedTypeIdentifier identifier, SharedObjectCache cache) { super(source.getBaseType(), source.getTypeClosure(), source.getAnnotations()); this.javaClass = source.getJavaClass(); ImmutableSet.Builder<AnnotatedConstructor<X>> constructors = ImmutableSet.builder(); for (AnnotatedConstructor<X> constructor : source.getConstructors()) { constructors.add(UnbackedAnnotatedConstructor.of(constructor, this, cache)); } this.constructors = constructors.build(); ImmutableSet.Builder<AnnotatedMethod<? super X>> methods = ImmutableSet.builder(); for (AnnotatedMethod<? super X> originalMethod : source.getMethods()) { methods.add(UnbackedAnnotatedMethod.of(originalMethod, this, cache)); } this.methods = methods.build(); ImmutableSet.Builder<AnnotatedField<? super X>> fields = ImmutableSet.builder(); for (AnnotatedField<? super X> originalField : source.getFields()) { fields.add(UnbackedAnnotatedField.of(originalField, this, cache)); } this.fields = fields.build(); this.identifier = identifier; }
Source:
<code>public int hashCode() { <START> return Objects.hashCode( <END> address, emailAddress, firstName, gifterName, lastName, method, personalMessage ); }</code><technical_language>Missing deliverAt</technical_language>

Target:
public int hashCode() { return Objects.hashCode( address, deliverAt, emailAddress, firstName, gifterName, lastName, method, personalMessage ); }
Source:
<code>public static void init() { SQLUnitTest.init(); <START> requestHeaders.add("bypassingCache", "true"); <END> }</code><technical_language>bypassCache instead of bypassingCache</technical_language>

Target:
public static void init() { SQLUnitTest.init(); }
Source:
<code>public <T extends AbstractNodeMapping> void iterate(final MappingsListVisitor visitor, final DragAndDropTarget container) { <START> if (descriptionMappings.isLayerMode() && container instanceof DSemanticDecorator && !new DSemanticDecoratorQuery((DSemanticDecorator) container).hasDetachedTarget()) { <END> if (container instanceof DDiagram) { iterateOnMappings(getContainerMappings(), visitor); iterateOnMappings(getNodeMappings(), visitor); } else if (container instanceof DNodeContainer) { iterateOnMappings(getContainerMappings((DNodeContainer) container), visitor); iterateOnMappings(getNodeMappings((DNodeContainer) container), visitor); iterateOnMappings(getBorderedNodeMappings((DNodeContainer) container), visitor); } else if (container instanceof DNodeList) { iterateOnMappings(getNodeMappings((DNodeList) container), visitor); } else if (container instanceof DNode) { iterateOnMappings(getBorderedNodeMappings((DNode) container), visitor); } } }</code><technical_language>&& !(container instanceof DSemanticDecorator) && new...hasDetachedTarget) continue handle DSemanticDecorator case</technical_language>

Target:
public <T extends AbstractNodeMapping> void iterate(final MappingsListVisitor visitor, final DragAndDropTarget container) { if (descriptionMappings.isLayerMode()) { if (container instanceof DSemanticDecorator) { DSemanticDecorator dSemanticDecorator = (DSemanticDecorator) container; if (!new DSemanticDecoratorQuery(dSemanticDecorator).hasDetachedTarget()) { safeIterate(visitor, container); } } else { safeIterate(visitor, container); } } }
Source:
<code>public void onRefresh() { <START> mSwipeLayout.setRefreshing(false); <END> }</code><technical_language>This is unrelated</technical_language>

Target:
public void onRefresh() { supportInvalidateOptionsMenu(); mSwipeLayout.setRefreshing(false); }
Source:
<code>public void contextMenuDisabling_noIssueInListView_contextMenuItemsDisabled() { clickFilterTextFieldAtPanel(0); type("asdf"); push(KeyCode.ENTER); sleep(EVENT_DELAY); rightClickPanel(0); sleep(EVENT_DELAY); ContextMenu contextMenu = issuePanel.getContextMenu(); <START> assertNull(contextMenu.getItems().get(0).getText()); <END> }</code><technical_language>extract isDisabled method intent obvious. In method explain implementation is 'unusual'</technical_language>

Target:
public void contextMenuDisabling_noIssueInListView_contextMenuItemsDisabled() { clickFilterTextFieldAtPanel(0); type("asdf"); push(KeyCode.ENTER); sleep(EVENT_DELAY); rightClickPanel(0); sleep(EVENT_DELAY); ContextMenu contextMenu = issuePanel.getContextMenu(); isDisabledContextMenu(contextMenu); }
Source:
<code>static void updateThreadName(Request data) { String name = data.getName(); StringBuilder builder = BUILDER.get(); <START> builder.setLength(0); <END> builder.ensureCapacity(Utils.THREAD_PREFIX.length() + name.length()); builder.append(Utils.THREAD_PREFIX); builder.append(name); Thread.currentThread().setName(builder.toString()); }</code><technical_language>This is wasteful. add prefix time need clear it</technical_language>

Target:
static void updateThreadName(Request data) { String name = data.getName(); StringBuilder builder = NAME_BUILDER.get(); builder.ensureCapacity(Utils.THREAD_PREFIX.length() + name.length()); builder.replace(Utils.THREAD_PREFIX.length(), builder.length(), name); Thread.currentThread().setName(builder.toString()); }
Source:
<code><START> protected static void writeResource(String url, Object content) <END> throws RegistryResourceException { try { Gson gson = new Gson(); Resource resource = registry.newResource(); resource.setContent(gson.toJson(content)); resource.setMediaType("application/json"); registry.put(url, resource); } catch (Exception re) { String errorMessage = "Unable to write resource at url:" + url; logger.error(errorMessage); throw new RegistryResourceException(errorMessage); } }</code><technical_language>special reason this method protected</technical_language>

Target:
public static void writeResource(String url, Object content) throws RegistryException { Gson gson = new Gson(); Resource resource = registry.newResource(); resource.setContent(gson.toJson(content)); resource.setMediaType(APPLICATION_JSON); registry.put(url, resource); }