auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void setBatchStateBackendAndTimerService(StreamGraph graph) { boolean useStateBackend = configuration.get(ExecutionOptions.USE_BATCH_STATE_BACKEND); boolean sortInputs = configuration.get(ExecutionOptions.SORT_INPUTS); checkState( !useStateBackend || sortInputs, "Batch state backend requires the sorted inputs to be enabled!"); if (useStateBackend) { <START> LOG.debug("Using BATCH execution state backend."); <END> graph.setStateBackend(new BatchExecutionStateBackend()); graph.setTimerServiceProvider(BatchExecutionInternalTimeServiceManager::create); } }</code><technical_language>"Using BATCH execution state backend _and timer service_."</technical_language>

Target:
private void setBatchStateBackendAndTimerService(StreamGraph graph) { boolean useStateBackend = configuration.get(ExecutionOptions.USE_BATCH_STATE_BACKEND); boolean sortInputs = configuration.get(ExecutionOptions.SORT_INPUTS); checkState( !useStateBackend || sortInputs, "Batch state backend requires the sorted inputs to be enabled!"); if (useStateBackend) { LOG.debug("Using BATCH execution state backend and timer service."); graph.setStateBackend(new BatchExecutionStateBackend()); graph.setTimerServiceProvider(BatchExecutionInternalTimeServiceManager::create); } else { graph.setStateBackend(stateBackend); } }
Source:
<code>public void initialize() { final Set<MetricTracker> metricTrackerSet = new HashSet<>(1); metricTrackerSet.add(insertableMetricTracker); metricsCollector.registerTrackers(metricTrackerSet); final List<NMFData> dataValues = dataParser.parse(); final List<Long> dataKeys; try { dataKeys = idFactory.getIds(dataValues.size()); } catch (final IdGenerationException e) { throw new RuntimeException(e); } memoryStore.putList(dataKeys, dataValues); final Set<Integer> keys = new HashSet<>(); for (final NMFData datum : dataValues) { for (final Pair<Integer, Double> column : datum.getColumns()) { <START> keys.add(column.getFirst()); <END> } } LOG.log(Level.INFO, "Step size = {0}", stepSize); LOG.log(Level.INFO, "Batch size = {0}", batchSize); LOG.log(Level.INFO, "Total number of keys = {0}", keys.size()); LOG.log(Level.INFO, "Total number of input rows = {0}", dataValues.size()); }</code><technical_language>is this variable keys used? :)</technical_language>

Target:
public void initialize() { final Set<MetricTracker> metricTrackerSet = new HashSet<>(1); metricTrackerSet.add(insertableMetricTracker); metricsCollector.registerTrackers(metricTrackerSet); final List<NMFData> dataValues = dataParser.parse(); final List<Long> dataKeys; try { dataKeys = idFactory.getIds(dataValues.size()); } catch (final IdGenerationException e) { throw new RuntimeException(e); } memoryStore.putList(dataKeys, dataValues); LOG.log(Level.INFO, "Step size = {0}", stepSize); LOG.log(Level.INFO, "Batch size = {0}", batchSize); LOG.log(Level.INFO, "Total number of keys = {0}", getKeys(dataValues)); LOG.log(Level.INFO, "Total number of input rows = {0}", dataValues.size()); }
Source:
<code>public RedisMetadataReport(URL url) { super(url); <START> pool = new JedisPool(new JedisPoolConfig(), url.getHost(), url.getPort(), Protocol.DEFAULT_TIMEOUT, url.getPassword()); <END> }</code><technical_language>url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT). Get timeout url, if present, default value</technical_language>

Target:
public RedisMetadataReport(URL url) { super(url); int timeout = url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT); pool = new JedisPool(new JedisPoolConfig(), url.getHost(), url.getPort(), timeout, url.getPassword()); }
Source:
<code><START> public void setReason(String reason) { <END> this.reason = reason; }</code><technical_language>this setter need public</technical_language>

Target:
void setReason(String reason) { this.reason = reason; }
Source:
<code>private static void initSeverities() { initDefaultSeverities(); initNetworkSeverities(); initImportExportSeverities(); initEngineSeverities(); initVMsPoolSeverities(); initBookmarkSeverities(); initVMSeverities(); initQuotaSeverities(); initTagSeverities(); initClusterSeverities(); initMLASeverities(); initHostSeverities(); initStorageSeverities(); initTaskSeverities(); initGlusterVolumeSeverities(); initDwhSeverities(); initConfigSeverities(); initUserAccountSeverities(); checkSeverities(); <START> initGeneral(); <END> }</code><technical_language>call for checkSeverities(); call this method. this smells, please move static block, call initSeverities() ? a proper solution for this</technical_language>

Target:
private static void initSeverities() { initDefaultSeverities(); initNetworkSeverities(); initImportExportSeverities(); initEngineSeverities(); initVMsPoolSeverities(); initBookmarkSeverities(); initVMSeverities(); initQuotaSeverities(); initTagSeverities(); initClusterSeverities(); initMLASeverities(); initHostSeverities(); initStorageSeverities(); initTaskSeverities(); initGlusterVolumeSeverities(); initDwhSeverities(); initConfigSeverities(); initUserAccountSeverities(); initCommonSeverities(); checkSeverities(); }
Source:
<code>public void testAuthorizationHeaderIsAdded() { String session = UUID.randomUUID().toString(); accountManager.setUserData(account, AccountGeneral.USER_DATA_SESSION, session); StubFacade facade = new StubFacade(); interceptor.intercept(facade); assertThat(facade.headers).containsKey(ApiRequestInterceptor.HEADER_AUTHORIZATION); String value = facade.headers.get(ApiRequestInterceptor.HEADER_AUTHORIZATION); <START> assertThat(value).isEqualTo("session_token=" + session); <END> }</code><technical_language>AuthenticatedRequestInterceptor.SESSION_TOKEN constant</technical_language>

Target:
public void testAuthorizationHeaderIsAdded() { String session = UUID.randomUUID().toString(); accountManager.setUserData(account, AccountGeneral.USER_DATA_SESSION, session); StubFacade facade = new StubFacade(); interceptor.intercept(facade); assertThat(facade.headers).containsKey(ApiRequestInterceptor.HEADER_AUTHORIZATION); String value = facade.headers.get(ApiRequestInterceptor.HEADER_AUTHORIZATION); assertThat(value).isEqualTo(AuthenticatedRequestInterceptor.SESSION_TOKEN + "=" + session); }
Source:
<code>private static String remoteAddress( Channel channel ) { <START> InetSocketAddress remoteAddress = (InetSocketAddress) channel.remoteAddress(); <END> InetAddress address = remoteAddress.getAddress(); String hostAddress = address.getHostAddress(); int port = remoteAddress.getPort(); return format( "%s:%s", hostAddress, port ); }</code><technical_language>this cast fail</technical_language>

Target:
private static String remoteAddress( Channel channel ) { try { InetSocketAddress remoteAddress = (InetSocketAddress) channel.remoteAddress(); InetAddress address = remoteAddress.getAddress(); String hostAddress = address.getHostAddress(); int port = remoteAddress.getPort(); return format( "%s:%s", hostAddress, port ); } catch ( ClassCastException e ) { SocketAddress remoteAddress = channel.remoteAddress(); return remoteAddress.toString(); } }
Source:
<code>public void deleteEntriesUsingCachePolicy(int numRowsToDelete) { try { IndexEventHolder indexEventHolder = (IndexEventHolder) stateHolder.getState().getEventHolder(); Set<Object> keys = indexEventHolder.getAllPrimaryKeyValues(); long[] minTimestampArray = new long[numRowsToDelete]; Arrays.fill(minTimestampArray, Long.MAX_VALUE); Object[] keyOfMinTimestampArray = new Object[numRowsToDelete]; for (Object key: keys) { <START> Object[] data = indexEventHolder.getEvent(key).getOutputData(); <END> long timestamp = (long) data[cachePolicyAttributePosition]; for (int i = 0; i < numRowsToDelete; i++) { if (timestamp < minTimestampArray[i]) { minTimestampArray[i] = timestamp; keyOfMinTimestampArray[i] = key; } } } for (Object deleteKey: keyOfMinTimestampArray) { if (deleteKey != null) { indexEventHolder.deleteEvent(deleteKey); } } } catch (ClassCastException e) { log.error(siddhiAppContext + ": " + e.getMessage()); } }</code><technical_language>this logic is correct. a Tree structure add numRowsToDelete amount of events for add remove newest time. get list of numRowsToDelete amount of oldest events</technical_language>

Target:
public void deleteEntriesUsingCachePolicy(int numRowsToDelete) { IndexEventHolder indexEventHolder = (IndexEventHolder) stateHolder.getState().getEventHolder(); if (numRowsToDelete >= indexEventHolder.size()) { indexEventHolder.deleteAll(); } else { Set<Object> keys = indexEventHolder.getAllPrimaryKeyValues(); TreeMap<Long, Object> toDelete = new TreeMap<>(); for (Object key : keys) { if (toDelete.size() < numRowsToDelete) { toDelete.put((Long) indexEventHolder.getEvent(key).getOutputData()[cachePolicyAttributePosition], key); } else { Long timestamp = (Long) indexEventHolder.getEvent(key). getOutputData()[cachePolicyAttributePosition]; Long firstKey = toDelete.firstKey(); if (timestamp < firstKey) { toDelete.remove(firstKey); toDelete.put(timestamp, key); } } } for (Object deleteKey: toDelete.values()) { if (deleteKey != null) { indexEventHolder.deleteEvent(deleteKey); } } } }
Source:
<code>protected VDSReturnValue runVdsCommand(VDSCommandType commandType, VDSParametersBase parameters) throws VdcBLLException { <START> parameters.setCorrelationId(getCorrelationId()); <END> return getBackend().getResourceManager().RunVdsCommand(commandType, parameters); }</code><technical_language>this in thread local... is needed in this patch</technical_language>

Target:
protected VDSReturnValue runVdsCommand(VDSCommandType commandType, VDSParametersBase parameters) throws VdcBLLException { return getBackend().getResourceManager().RunVdsCommand(commandType, parameters); }
Source:
<code>public void should_fail_when_asserting_no_exception_raised_but_exception_occurs() { Exception exception = new Exception("boom"); ThrowingCallable boom = raisingException(exception); thrown.expectAssertionError(ShouldNotHaveThrown.shouldNotHaveThrown(exception)); <START> assertThatCode(boom).doesNotThrowAnyException(); <END> }</code><technical_language>removing as("Test") ? want error allows a description set</technical_language>

Target:
public void should_fail_when_asserting_no_exception_raised_but_exception_occurs() { Exception exception = new Exception("boom"); ThrowingCallable boom = raisingException(exception); thrown.expectAssertionError(shouldNotHaveThrown(exception)); assertThatCode(boom).doesNotThrowAnyException(); }
Source:
<code>protected void buildBasicValidationTable() { <START> for (String key : mVerbs.keySet()) { <END> final List<ValueValidationFunction> curList = new java.util.ArrayList<ValueValidationFunction>(); final Class<?> curType = mTypeDict.get(key); if (curType == java.math.BigDecimal.class) { curList.add(validDecimal); } else if (curType == Integer.class) { curList.add(validInteger); } else if (curType == java.util.Date.class) { curList.add(validDateTime); } else if (curType == TimeSpan.class) { curList.add(validTimeSpan); } else { curList.add(validCharacters); } final IConditionValueAutoCompleter tmp = getFieldValueAutoCompleter(key); if (tmp != null) { if (tmp.getClass() == DateEnumValueAutoCompleter.class) { curList.add(validateDateEnumValueByValueAC); } else { curList.add(validateFieldValueByValueAC); } } mValidationDict.put(key, curList); } }</code><technical_language>while it, kill java.util java.math FQCN notations replace imports</technical_language>

Target:
protected void buildBasicValidationTable() { for (String key : mVerbs.keySet()) { final List<ValueValidationFunction> curList = new ArrayList<ValueValidationFunction>(); final Class<?> curType = mTypeDict.get(key); if (curType == java.math.BigDecimal.class) { curList.add(validDecimal); } else if (curType == Integer.class) { curList.add(validInteger); } else if (curType == Date.class) { curList.add(validDateTime); } else if (curType == TimeSpan.class) { curList.add(validTimeSpan); } else { curList.add(validCharacters); } final IConditionValueAutoCompleter tmp = getFieldValueAutoCompleter(key); if (tmp != null) { if (tmp.getClass() == DateEnumValueAutoCompleter.class) { curList.add(validateDateEnumValueByValueAC); } else { curList.add(validateFieldValueByValueAC); } } mValidationDict.put(key, curList); } }
Source:
<code>private static void makeDataUnitsInteger(final List<OptimizedComputeTask> optimizedComputeTasks, final int totalDataUnits) { int sum = 0; for (final OptimizedComputeTask cmpTask : optimizedComputeTasks) { if (!cmpTask.getParticipateValue()) { continue; } cmpTask.getRequestedDataVariable().setValue( BigDecimal.valueOf(Math.round(cmpTask.getRequestedDataVariable().getValue().doubleValue()))); sum += cmpTask.getRequestedDataValue(); } final int diff = totalDataUnits - sum; for (final OptimizedComputeTask cmpTask : optimizedComputeTasks) { if (!cmpTask.getParticipateValue()) { continue; } <START> if (cmpTask.getRequestedDataValue() + diff >= 0) { <END> cmpTask.getRequestedDataVariable().setValue(BigDecimal.valueOf(cmpTask.getRequestedDataValue() + diff)); return; } } }</code><technical_language>assume exists task this condition is true</technical_language>

Target:
private static void makeDataUnitsInteger(final List<OptimizedComputeTask> optimizedComputeTasks, final int totalDataUnits) { int sum = 0; for (final OptimizedComputeTask cmpTask : optimizedComputeTasks) { if (!cmpTask.getParticipateValue()) { continue; } cmpTask.getRequestedDataVariable().setValue( BigDecimal.valueOf(Math.floor(cmpTask.getRequestedDataVariable().getValue().doubleValue()))); sum += cmpTask.getRequestedDataValue(); } for (final OptimizedComputeTask cmpTask : optimizedComputeTasks) { if (cmpTask.getParticipateValue()) { cmpTask.getRequestedDataVariable().setValue( BigDecimal.valueOf(cmpTask.getRequestedDataValue() + (totalDataUnits - sum))); return; } } }
Source:
<code>public EnumTemperature getTemperature() { <START> return EnumTemperature.getFromValue(ForestryAPI.climateManager.getTemperature(world, pos)); <END> }</code><technical_language>Replace this line EnumTemperature.getFromBiome(Biome Biome, World world, BlockPos pos) detect EnumTemperature.HELLISH</technical_language>

Target:
public EnumTemperature getTemperature() { return EnumTemperature.getFromBiome(world.getBiome(pos), world, pos); }
Source:
<code>public static SortedMap<Short, List<MappeableContainer>> groupByKey( ImmutableRoaringBitmap... bitmaps) { Map<Short, List<MappeableContainer>> grouped = new HashMap<>(); for (ImmutableRoaringBitmap bitmap : bitmaps) { MappeableContainerPointer it = bitmap.highLowContainer.getContainerPointer(); <START> while (null != it.getContainer()) { <END> MappeableContainer container = it.getContainer(); short key = it.key(); List<MappeableContainer> slice = grouped.computeIfAbsent(key, k -> new ArrayList<>()); slice.add(container); it.advance(); } } SortedMap<Short, List<MappeableContainer>> sorted = new TreeMap<>(BufferUtil::compareUnsigned); sorted.putAll(grouped); return sorted; }</code><technical_language>Likewise</technical_language>

Target:
public static SortedMap<Short, List<MappeableContainer>> groupByKey( ImmutableRoaringBitmap... bitmaps) { Map<Short, List<MappeableContainer>> grouped = new HashMap<>(); for (ImmutableRoaringBitmap bitmap : bitmaps) { MappeableContainerPointer it = bitmap.highLowContainer.getContainerPointer(); while (null != it.getContainer()) { MappeableContainer container = it.getContainer(); Short key = it.key(); List<MappeableContainer> slice = grouped.get(key); if (null == slice) { slice = new ArrayList<>(); grouped.put(key, slice); } slice.add(container); it.advance(); } } SortedMap<Short, List<MappeableContainer>> sorted = new TreeMap<>(BufferUtil::compareUnsigned); sorted.putAll(grouped); return sorted; }
Source:
<code><START> public final synchronized void addFunctions(List<? extends SqlFunction> functions) <END> { addFunctions(TEMP_DEFAULT_CATALOG, functions); }</code><technical_language>mark methods final</technical_language>

Target:
public void addFunctions(List<? extends SqlFunction> functions) { addFunctions(TEMP_DEFAULT_CATALOG, functions); }
Source:
<code>public final Collection<Session> listSessions() throws SubscriptionNotInitializedException, NakadiRuntimeException, ServiceTemporarilyUnavailableException { getLog().info("fetching sessions information"); final List<String> zkSessions; try { zkSessions = getCurator().getChildren().forPath(getSubscriptionPath("/sessions")); } catch (final KeeperException.NoNodeException e) { throw new SubscriptionNotInitializedException(getSubscriptionId()); } catch (Exception ex) { throw new NakadiRuntimeException(ex); } return loadDataAsync( zkSessions, key -> getSubscriptionPath("/sessions/" + key), (key, data) -> { try { return deserializeSession(key, data); } catch (final IOException e) { <START> throw new NakadiRuntimeException(e); <END> } }).values(); }</code><technical_language>put level of deserialisation</technical_language>

Target:
public final Collection<Session> listSessions() throws SubscriptionNotInitializedException, NakadiRuntimeException, ServiceTemporarilyUnavailableException { getLog().info("fetching sessions information"); final List<String> zkSessions; try { zkSessions = getCurator().getChildren().forPath(getSubscriptionPath("/sessions")); } catch (final KeeperException.NoNodeException e) { throw new SubscriptionNotInitializedException(getSubscriptionId()); } catch (Exception ex) { throw new NakadiRuntimeException(ex); } return loadDataAsync( zkSessions, key -> getSubscriptionPath("/sessions/" + key), this::deserializeSession ).values(); }
Source:
<code>public void getAccountByIdShouldReturnTheAccountWithId() throws Exception { <START> String responseString = "{ \"id\": \"FOOBAR\" }"; <END> MockRestAdapter<Account> adapter = new MockRestAdapter<>("foobar", responseString, null); adapter.request(new RepromiseFunction<UpholdRestAdapter, Account>() { @Override public Promise<Account> call(UpholdRestAdapter adapter) { User user = Fixtures.loadUser(); user.setUpholdRestAdapter(adapter); return user.getAccountById("FOOBAR"); } }); Account account = adapter.getResult(); Request request = adapter.getRequest(); Assert.assertEquals(request.getMethod(), "GET"); Assert.assertEquals(request.getUrl(), String.format("%s/v0/me/accounts/FOOBAR", BuildConfig.API_SERVER_URL)); Assert.assertEquals(account.getId(), "FOOBAR"); }</code><technical_language>This test done a full account json test json is correctly matched model</technical_language>

Target:
public void getAccountByIdShouldReturnTheAccountWithId() throws Exception { String responseString = "{ \"currency\": \"FOO\", \"id\": \"FOOBAR\", \"label\": \"BAR\", \"status\": \"FOO BAR\", \"type\": \"Bar\" }"; MockRestAdapter<Account> adapter = new MockRestAdapter<>("foobar", responseString, null); adapter.request(new RepromiseFunction<UpholdRestAdapter, Account>() { @Override public Promise<Account> call(UpholdRestAdapter adapter) { User user = Fixtures.loadUser(); user.setUpholdRestAdapter(adapter); return user.getAccountById("FOOBAR"); } }); Account account = adapter.getResult(); Request request = adapter.getRequest(); Assert.assertEquals(request.getMethod(), "GET"); Assert.assertEquals(request.getUrl(), String.format("%s/v0/me/accounts/FOOBAR", BuildConfig.API_SERVER_URL)); Assert.assertEquals(account.getCurrency(), "FOO"); Assert.assertEquals(account.getId(), "FOOBAR"); Assert.assertEquals(account.getLabel(), "BAR"); Assert.assertEquals(account.getStatus(), "FOO BAR"); Assert.assertEquals(account.getType(), "Bar"); }
Source:
<code>public String encodeTarget(String target){ <START> target= StringUtils.replace(target,"[", "%5B"); <END> target= StringUtils.replace(target,"]", "%5D"); return target; }</code><technical_language>this method handle other characters <LINK_0></technical_language>

Target:
public String encodeTarget(String target){ try{ return URLEncoder.encode(target, StandardCharsets.UTF_8.toString()); }catch(UnsupportedEncodingException ex){ return target; } }
Source:
<code>public ListBoxModel doFillHardwareIdItems( @QueryParameter String hardwareId, @QueryParameter String endPointUrl, @QueryParameter String identity, @QueryParameter String credential, @QueryParameter String zone ) { ListBoxModel m = new ListBoxModel(); m.add("None specified", ""); final String valueOrEmpty = Util.fixNull(hardwareId); boolean existingValueFound = valueOrEmpty.isEmpty(); try { if (haveServerDetails(endPointUrl, identity, credential, zone)) { final Openstack openstack = Openstack.Factory.get(endPointUrl, identity, credential, zone); for (Flavor flavor : openstack.getSortedFlavors()) { final String value = flavor.getId(); final String displayText = String.format("%s (%s)", flavor.getName(), value); m.add(displayText, value); existingValueFound |= valueOrEmpty.equals(value); } } } catch (AuthenticationException | FormValidation | ConnectionException ex) { LOGGER.log(Level.FINEST, "Openstack call failed", ex); } catch (Exception ex) { LOGGER.log(Level.SEVERE, ex.getMessage(), ex); } <START> if (!existingValueFound) { <END> m.add(hardwareId); } return m; }</code><technical_language>changes ensure configured added twice</technical_language>

Target:
public ListBoxModel doFillHardwareIdItems( @QueryParameter String hardwareId, @QueryParameter String endPointUrl, @QueryParameter String identity, @QueryParameter String credential, @QueryParameter String zone ) { ListBoxModel m = new ListBoxModel(); m.add("None specified", ""); final String valueOrEmpty = Util.fixNull(hardwareId); try { if (haveAuthDetails(endPointUrl, identity, credential, zone)) { final Openstack openstack = Openstack.Factory.get(endPointUrl, identity, credential, zone); for (Flavor flavor : openstack.getSortedFlavors()) { final String value = flavor.getId(); final String displayText = String.format("%s (%s)", flavor.getName(), value); m.add(displayText, value); } } } catch (AuthenticationException | FormValidation | ConnectionException ex) { LOGGER.log(Level.FINEST, "Openstack call failed", ex); } catch (Exception ex) { LOGGER.log(Level.SEVERE, ex.getMessage(), ex); } if (!hasValue(m, valueOrEmpty)) { m.add(hardwareId); } return m; }
Source:
<code>public void preProcessModule(Module module) { Properties props = new Properties(); ContainerAttributes attributes = getApplicationContext().getBean(ContainerAttributes.class); for (String key : attributes.keySet()) { <START> props.put(ModulePlaceholders.XD_CONTAINER_PREFIX_KEY + key, attributes.get(key)); <END> } module.addProperties(props); }</code><technical_language>setProperty instead of put</technical_language>

Target:
public void preProcessModule(Module module) { Properties props = new Properties(); for (String key : attributes.keySet()) { props.setProperty(ModulePlaceholders.XD_CONTAINER_KEY_PREFIX + key, attributes.get(key)); } module.addProperties(props); }
Source:
<code>private boolean shouldRetry(HttpResponse response, int tryCount) { int code = response.statusCode(); return tryCount < maxRetries && (code == 408 <START> || (code >= 500) END> && code != 501 && code != 505); }</code><technical_language>Parenthesis changed</technical_language>

Target:
private boolean shouldRetry(HttpResponse response, int tryCount) { int code = response.statusCode(); return tryCount < maxRetries && (code == HttpURLConnection.HTTP_CLIENT_TIMEOUT || (code >= HttpURLConnection.HTTP_INTERNAL_ERROR && code != HttpURLConnection.HTTP_NOT_IMPLEMENTED && code != HttpURLConnection.HTTP_VERSION)); }
Source:
<code>public CliCommand init(final Arguments args) throws Exception { processCommandOptions(requiredArgs, optionalArgs, args); this.priority = args.getPriority(); this.bucketName = args.getBucket(); this.objectName = args.getObjectName(); this.objectPath = FileSystems.getDefault().getPath(this.objectName); this.prefix = args.getPrefix(); this.force = args.isForce(); <START> if (this.sync = args.isSync()) { <END> LOG.info("Using sync command"); } this.numberOfThreads = Integer.valueOf(args.getNumberOfThreads()); this.metadata = args.getMetadata(); return this; }</code><technical_language>this == instead of assignment</technical_language>

Target:
public CliCommand init(final Arguments args) throws Exception { processCommandOptions(requiredArgs, optionalArgs, args); this.priority = args.getPriority(); this.bucketName = args.getBucket(); this.objectName = args.getObjectName(); this.objectPath = FileSystems.getDefault().getPath(this.objectName); this.prefix = args.getPrefix(); this.force = args.isForce(); this.sync = args.isSync(); if (this.sync) { LOG.info("Using sync command"); } this.numberOfThreads = args.getNumberOfThreads(); this.metadata = args.getMetadata(); return this; }
Source:
<code>public void testCodeSpan() { <START> String html = parser.parseToHtml("Use the `printf()` function."); <END> TestUtil.println("HTML: " + content(html)); assertEquals("<p>Use the <code>printf()</code> function.</p>\n", content(html)); String html3 = parser.parseToHtml("`foo *bar* foo`"); TestUtil.println("HTML: " + content(html3)); assertEquals("<p><code>foo *bar* foo</code></p>\n", content(html3)); }</code><technical_language>Removed test is tested in testNoProcessingInCodeSpan() below</technical_language>

Target:
public void testCodeSpan() { String html = parseToHtml("Use the `printf()` function."); TestUtil.println("HTML: " + html); assertEquals("<p>Use the <code>printf()</code> function.</p>\n", html); }
Source:
<code>protected Optional<Enchantment> buildContent(DataView container) throws InvalidDataException { checkNotNull(container, "The data view cannot be null!"); <START> if (container.contains(Queries.ENCHANTMENT_ID, Queries.LEVEL)) { <END> final String id = DataUtil.getData(container, Queries.ENCHANTMENT_ID, String.class); final int level = DataUtil.getData(container, Queries.LEVEL, Integer.class); final Optional<EnchantmentType> enchantmentType = SpongeImpl.getRegistry().getType(EnchantmentType.class, id); if (enchantmentType.isPresent()) { return Optional.of(Enchantment.builder().type(enchantmentType.get()).level(level).build()); } } return Optional.empty(); }</code><technical_language>Invert if block, style change, I know, preference. Fail fast</technical_language>

Target:
protected Optional<Enchantment> buildContent(DataView container) throws InvalidDataException { checkNotNull(container, "The data view cannot be null!"); if (!container.contains(Queries.ENCHANTMENT_ID, Queries.LEVEL)) { return Optional.empty(); } final String id = DataUtil.getData(container, Queries.ENCHANTMENT_ID, String.class); final int level = DataUtil.getData(container, Queries.LEVEL, Integer.class); final Optional<EnchantmentType> enchantmentType = Sponge.getRegistry().getType(EnchantmentType.class, id); return enchantmentType.map(t -> Enchantment.builder().type(t).level(level).build()); }
Source:
<code>public void createTabs(ILaunchConfigurationDialog dialog, String mode) { <START> setTabs(new AbstractLaunchConfigurationTab[] { new RunImageMainTab(), <END> new RunImageVolumesTab(), new RunImagePortsTab(), new RunImageLinksTab(), new RunImageResourcesTab(), new RunImageEnvironmentTab() }); }</code><technical_language>if model initialized in createTabs method passed in constructor of tabs</technical_language>

Target:
public void createTabs(ILaunchConfigurationDialog dialog, String mode) { IDockerConnection[] connections = DockerConnectionManager.getInstance() .getConnections(); runSelectionModel = null; runVolumesModel = null; if (connections != null && connections.length > 0) { runSelectionModel = new ImageRunSelectionModel(connections[0]); try { runVolumesModel = new ImageRunResourceVolumesVariablesModel( connections[0]); } catch (DockerException e) { } } setTabs(new AbstractLaunchConfigurationTab[] { new RunImageMainTab(runSelectionModel, runVolumesModel), new RunImageVolumesTab(runVolumesModel), new RunImagePortsTab(runSelectionModel), new RunImageLinksTab(runSelectionModel), new RunImageResourcesTab(runVolumesModel), new RunImageEnvironmentTab(runVolumesModel) }); }
Source:
<code>public FrameworkMethod(Method method) { if (method == null) { <START> throw new IllegalArgumentException( <END> "FrameworkMethod cannot be created without an underlying method."); } fMethod = method; }</code><technical_language>NullPointerException</technical_language>

Target:
public FrameworkMethod(Method method) { if (method == null) { throw new NullPointerException( "FrameworkMethod cannot be created without an underlying method."); } fMethod = method; }
Source:
<code>protected void saveRequestedUrl(final C context, final List<Client> currentClients) throws HttpAction { <START> if (!ajaxRequestResolver.isAjax(context)) { <END> final String requestedUrl = context.getFullRequestURL(); logger.debug("requestedUrl: {}", requestedUrl); context.setSessionAttribute(Pac4jConstants.REQUESTED_URL, requestedUrl); } }</code><technical_language>This is a breaking change runtime. avoid it</technical_language>

Target:
protected void saveRequestedUrl(final C context, final List<Client> currentClients) throws HttpAction { if (this.saveRequestURLInSession) { final String requestedUrl = context.getFullRequestURL(); logger.debug("requestedUrl: {}", requestedUrl); context.setSessionAttribute(Pac4jConstants.REQUESTED_URL, requestedUrl); } }
Source:
<code>private void postDocumentChanged(final String documentID) { synchronized (lock) { if (!c4DocObservers.containsKey(documentID) || c4db == null) return; Set<DocumentChangeListenerToken> tokens = docListenerTokens.get(documentID); if (tokens != null) { <START> synchronized (tokens) { <END> DocumentChange change = new DocumentChange(documentID); for (DocumentChangeListenerToken token : tokens) token.notify(change); } } } }</code><technical_language>this is synchronized (lock), is this synchronized required</technical_language>

Target:
private void postDocumentChanged(final String documentID) { synchronized (lock) { if (!c4DocObservers.containsKey(documentID) || c4db == null) return; Set<DocumentChangeListenerToken> tokens = docListenerTokens.get(documentID); if (tokens != null) { DocumentChange change = new DocumentChange(documentID); for (DocumentChangeListenerToken token : tokens) token.notify(change); } } }
Source:
<code>public void testCreateWithWritePermissions() throws Exception { BaseUser user = server.addUser("test", "password", new WritePermission()); Configuration configuration = new Configuration(); configuration.set("fs.defaultFS", "ftp:/ configuration.set("fs.ftp.host", "localhost"); configuration.setInt("fs.ftp.host.port", server.getPort()); configuration.set("fs.ftp.user.localhost", user.getName()); configuration.set("fs.ftp.password.localhost", user.getPassword()); <START> configuration.set("fs.ftp.impl.disable.cache", "true"); <END> FileSystem fs = FileSystem.get(configuration); byte[] bytesExpected = "hello world".getBytes(StandardCharsets.UTF_8); try (FSDataOutputStream outputStream = fs.create(new Path("test1.txt"))) { outputStream.write(bytesExpected); } try (FSDataInputStream input = fs.open(new Path("test1.txt"))) { assertThat(bytesExpected, equalTo(IOUtils.readFullyToByteArray(input))); } }</code><technical_language>setBoolean()</technical_language>

Target:
public void testCreateWithWritePermissions() throws Exception { BaseUser user = server.addUser("test", "password", new WritePermission()); Configuration configuration = new Configuration(); configuration.set("fs.defaultFS", "ftp:/ configuration.set("fs.ftp.host", "localhost"); configuration.setInt("fs.ftp.host.port", server.getPort()); configuration.set("fs.ftp.user.localhost", user.getName()); configuration.set("fs.ftp.password.localhost", user.getPassword()); configuration.setBoolean("fs.ftp.impl.disable.cache", true); FileSystem fs = FileSystem.get(configuration); byte[] bytesExpected = "hello world".getBytes(StandardCharsets.UTF_8); try (FSDataOutputStream outputStream = fs.create(new Path("test1.txt"))) { outputStream.write(bytesExpected); } try (FSDataInputStream input = fs.open(new Path("test1.txt"))) { assertThat(bytesExpected, equalTo(IOUtils.readFullyToByteArray(input))); } }
Source:
<code>public void removeTreeItem() { TerminationTreeItemContent parent = ( treeItem.getParentItem() == null ? this : (TerminationTreeItemContent) treeItem.getParentItem().getUserObject() ); if ( terminationConfigOption == NESTED ) { parent.getModel().getTerminationConfigList().remove( model ); if ( parent.getModel().getTerminationConfigList().isEmpty() ) { parent.getModel().setTerminationConfigList( null ); } } else { <START> terminationOperationMap.get( terminationConfigOption ).removeModelValue(); <END> } parent.getView().addDropDownOption( terminationConfigOption ); treeItem.remove(); terminationConfigForm.displayEmptyTreeLabel( terminationConfigForm.getRootTreeItem().getChildCount() == 0 ); }</code><technical_language>@ge0ffrey IMO NPE's runtime in compiled JavaScript code do stick out a sore thumb - choose monitor browser's developer console stack trace is highly obfuscated... tend program overly defensively for client anyway</technical_language>

Target:
public void removeTreeItem() { TerminationTreeItemContent parent = ( treeItem.getParentItem() == null ? this : (TerminationTreeItemContent) treeItem.getParentItem().getUserObject() ); getTerminationManager( terminationConfigOption ).removeModelValue(); parent.getView().addDropDownOption( terminationConfigOption ); treeItem.remove(); terminationConfigForm.displayEmptyTreeLabel( terminationConfigForm.getRootTreeItem().getChildCount() == 0 ); }
Source:
<code>public void testConvertToLambda28() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test", false, null); <START> StringBuilder buf= new StringBuilder(); <END> buf.append("package test;\n"); buf.append("public class C1 {\n"); buf.append(" private final String s;\n"); buf.append(" Runnable run = new Runnable() {\n"); buf.append(" @Override\n"); buf.append(" public void run() {\n"); buf.append(" for (int i=0; i < s.length(); ++i) {\n"); buf.append(" int j = i;\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append(" };\n"); buf.append(" public C1() {\n"); buf.append(" s = \"abc\";\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("C1.java", buf.toString(), false, null); int offset= buf.toString().indexOf("new"); AssistContext context= getCorrectionContext(cu, offset, 0); assertNoErrors(context); List<IJavaCompletionProposal> proposals= collectAssists(context, false); assertNumberOfProposals(proposals, 0); }</code><technical_language>Hi, I suggest strings instead of StringBuilder, is done in CleanUpTest1d5.java . improves readability performance. A concatenation of literals is compiled a literal faster</technical_language>

Target:
public void testConvertToLambda28() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test", false, null); String buf= "package test;\n" + "public class C1 {\n" + " private final String s;\n" + " Runnable run = new Runnable() {\n" + " @Override\n" + " public void run() {\n" + " for (int i=0; i < s.length(); ++i) {\n" + " int j = i;\n" + " }\n" + " }\n" + " };\n" + " public C1() {\n" + " s = \"abc\";\n" + " }\n" + "}\n"; ICompilationUnit cu= pack1.createCompilationUnit("C1.java", buf, false, null); int offset= buf.toString().indexOf("new"); AssistContext context= getCorrectionContext(cu, offset, 0); assertNoErrors(context); List<IJavaCompletionProposal> proposals= collectAssists(context, false); assertNumberOfProposals(proposals, 0); }
Source:
<code>protected void firePropertyChange(String key, Object oldValue, Object newValue) { Object[] allListeners; synchronized(this) { allListeners = listeners.getListeners(); } final PropertyChangeEvent event = new PropertyChangeEvent(this, key, oldValue, newValue); for (Object <START> allListener : <END> allListeners) { final IPropertyChangeListener listener = (IPropertyChangeListener) allListener; SafeRunner.run(new ISafeRunnable() { @Override public void handleException(Throwable exception) { } @Override public void run() throws Exception { listener.propertyChange(event); } }); } }</code><technical_language>listener</technical_language>

Target:
protected void firePropertyChange(String key, Object oldValue, Object newValue) { Object[] allListeners; synchronized(this) { allListeners = listeners.getListeners(); } final PropertyChangeEvent event = new PropertyChangeEvent(this, key, oldValue, newValue); for (Object l : allListeners) { final IPropertyChangeListener listener = (IPropertyChangeListener)l; SafeRunner.run(new ISafeRunnable() { @Override public void handleException(Throwable exception) { } @Override public void run() throws Exception { listener.propertyChange(event); } }); } }
Source:
<code>public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent evt) throws Exception { final OslpEnvelope message = (OslpEnvelope) evt.getMessage(); OslpDevice oslpDevice; <START> oslpDevice = null; <END> if (message.getPayloadMessage().hasRegisterDeviceRequest()) { final String deviceIdentification = message.getPayloadMessage().getRegisterDeviceRequest() .getDeviceIdentification(); oslpDevice = this.oslpDeviceSettingsService.getDeviceByDeviceIdentification(deviceIdentification); } else { oslpDevice = this.oslpDeviceSettingsService .getDeviceByUid(Base64.encodeBase64String(message.getDeviceId())); } if (oslpDevice == null) { LOGGER.warn("Received message from unknown device."); } else if (oslpDevice.getPublicKey() == null) { LOGGER.warn("Received message from device without public key: {}", oslpDevice.getDeviceIdentification()); } if (oslpDevice != null && oslpDevice.getPublicKey() != null) { final PublicKey publicKey = CertificateHelper.createPublicKeyFromBase64(oslpDevice.getPublicKey(), this.oslpKeyType, this.oslpSignatureProvider); message.validate(publicKey); } ctx.sendUpstream(evt); }</code><technical_language>is this split 2 lines</technical_language>

Target:
public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent evt) throws Exception { final OslpEnvelope message = (OslpEnvelope) evt.getMessage(); OslpDevice oslpDevice; if (message.getPayloadMessage().hasRegisterDeviceRequest()) { final String deviceIdentification = message.getPayloadMessage().getRegisterDeviceRequest() .getDeviceIdentification(); oslpDevice = this.oslpDeviceSettingsService.getDeviceByDeviceIdentification(deviceIdentification); } else { oslpDevice = this.oslpDeviceSettingsService .getDeviceByUid(Base64.encodeBase64String(message.getDeviceId())); } if (oslpDevice == null) { LOGGER.warn("Received message from unknown device."); } else if (oslpDevice.getPublicKey() == null) { LOGGER.warn("Received message from device without public key: {}", oslpDevice.getDeviceIdentification()); } if (oslpDevice != null && oslpDevice.getPublicKey() != null) { final PublicKey publicKey = CertificateHelper.createPublicKeyFromBase64(oslpDevice.getPublicKey(), this.oslpKeyType, this.oslpSignatureProvider); message.validate(publicKey); } ctx.sendUpstream(evt); }
Source:
<code>public ActionResult execute() { String idOfCourseToDelete = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); CourseAttributes courseAttributes = logic.getCourse(idOfCourseToDelete); logic.deleteCourse(idOfCourseToDelete); <START> return new JsonResult(new CourseData(courseAttributes)); <END> }</code><technical_language>DELETE method a message right</technical_language>

Target:
public ActionResult execute() { String idOfCourseToDelete = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); logic.deleteCourse(idOfCourseToDelete); return new JsonResult(new MessageOutput("OK")); }
Source:
<code>public void testClientScopesPolicyWithPermittedScope() throws Exception { setTrustedHost("localhost"); <START> ClientScopeRepresentation clientTemplate = new ClientScopeRepresentation(); <END> clientTemplate.setName("foo"); Response response = realmResource().clientScopes().create(clientTemplate); String clientTemplateId = ApiUtil.getCreatedId(response); response.close(); ClientRepresentation clientRep = createRep("test-app"); clientRep.setDefaultClientScopes(Collections.singletonList("foo")); assertFail(ClientRegOp.CREATE, clientRep, 403, "Not permitted to use specified clientScope"); ComponentRepresentation clientTemplatesPolicyRep = findPolicyByProviderAndAuth(ClientScopesClientRegistrationPolicyFactory.PROVIDER_ID, getPolicyAnon()); clientTemplatesPolicyRep.getConfig().putSingle(ClientScopesClientRegistrationPolicyFactory.ALLOWED_CLIENT_SCOPES, "foo"); realmResource().components().component(clientTemplatesPolicyRep.getId()).update(clientTemplatesPolicyRep); ClientRepresentation registeredClient = reg.create(clientRep); Assert.assertNotNull(registeredClient.getRegistrationAccessToken()); ApiUtil.findClientResourceByClientId(realmResource(), "test-app").remove(); realmResource().clientScopes().get(clientTemplateId).remove(); }</code><technical_language>clientTemplate > clientScope</technical_language>

Target:
public void testClientScopesPolicyWithPermittedScope() throws Exception { setTrustedHost("localhost"); ClientScopeRepresentation clientScope = new ClientScopeRepresentation(); clientScope.setName("foo"); Response response = realmResource().clientScopes().create(clientScope); String clientScopeId = ApiUtil.getCreatedId(response); response.close(); ClientRepresentation clientRep = createRep("test-app"); clientRep.setDefaultClientScopes(Collections.singletonList("foo")); assertFail(ClientRegOp.CREATE, clientRep, 403, "Not permitted to use specified clientScope"); ComponentRepresentation clientScopesPolicyRep = findPolicyByProviderAndAuth(ClientScopesClientRegistrationPolicyFactory.PROVIDER_ID, getPolicyAnon()); clientScopesPolicyRep.getConfig().putSingle(ClientScopesClientRegistrationPolicyFactory.ALLOWED_CLIENT_SCOPES, "foo"); realmResource().components().component(clientScopesPolicyRep.getId()).update(clientScopesPolicyRep); ClientRepresentation registeredClient = reg.create(clientRep); Assert.assertNotNull(registeredClient.getRegistrationAccessToken()); ApiUtil.findClientResourceByClientId(realmResource(), "test-app").remove(); realmResource().clientScopes().get(clientScopeId).remove(); }
Source:
<code>private Optional<OperatingSystem> tryGetOperatingSystemFrom(final String imageId) { Set<OperatingSystem> operatingSystemsAvailable = createObjectOptionsSupplier.get().getVirtualGuestOperatingSystems(); <START> return tryFind(from(operatingSystemsAvailable) <END> .filter(new Predicate<OperatingSystem>() { @Override public boolean apply(OperatingSystem input) { return input.getId().contains(imageId); } }), Predicates.notNull()); }</code><technical_language>in favor of static imports, improve readability. In case of from, statically imported harder understand happening: operatingSystemsAvailable what? In this cases I tend avoid static imports in favor of a more readable code</technical_language>

Target:
private Optional<OperatingSystem> tryGetOperatingSystemFrom(final String imageId) { Set<OperatingSystem> operatingSystemsAvailable = createObjectOptionsSupplier.get().getVirtualGuestOperatingSystems(); return tryFind(FluentIterable.from(operatingSystemsAvailable) .filter(new Predicate<OperatingSystem>() { @Override public boolean apply(OperatingSystem input) { return input.getId().contains(imageId); } }), Predicates.notNull()); }
Source:
<code>private List<FieldChange> cleanupAllTextFields(BibEntry entry) { <START> return entry.getFields().stream() <END> .filter(field -> !FieldFactory.getNotTextFieldNames().contains(field)) .filter(field -> !field.equals(InternalField.KEY_FIELD)) .flatMap(field -> cleanupSingleField(field, entry).stream()) .collect(Collectors.toList()); }</code><technical_language>convention, I strive for converting for loop streams for sake of it. (Maybe personal bias I a harder time unravel a lot of filter/map combinations some old-fanished for loop ifs...)</technical_language>

Target:
private List<FieldChange> cleanupAllTextFields(BibEntry entry) { List<FieldChange> fieldChanges = new ArrayList<>(); Set<Field> fields = new HashSet<>(entry.getFields()); fields.removeAll(FieldFactory.getNotTextFieldNames()); for (Field fieldKey : fields) { if (!fieldKey.equals(InternalField.KEY_FIELD)) { fieldChanges.addAll(cleanupSingleField(fieldKey, entry)); } } return fieldChanges; }
Source:
<code>private SiriusServerDashboardDto getDashboard() { int projectsCount = this.getModelingProjects().mapToInt(e -> 1).sum(); int viewpointsCount = ViewpointRegistry.getInstance().getViewpoints().size(); int metamodelsCount = EPackage.Registry.INSTANCE.size(); List<SiriusServerDashboardProjectDto> projects = this.getModelingProjects() <START> .limit(7) <END> .map(this::convertToProject) .collect(Collectors.toList()); return new SiriusServerDashboardDto(projectsCount, viewpointsCount, metamodelsCount, projects); }</code><technical_language>I changed user interface of dashboard :p <LINK_0> I need spot for new project card, 7 spots for other projects</technical_language>

Target:
private SiriusServerDashboardDto getDashboard() { int projectsCount = Long.valueOf(this.getModelingProjects().count()).intValue(); int viewpointsCount = ViewpointRegistry.getInstance().getViewpoints().size(); int metamodelsCount = EPackage.Registry.INSTANCE.size(); List<SiriusServerDashboardProjectDto> projects = this.getModelingProjects() .limit(DASHBOARD_PROJECT_COUNT) .map(this::convertToProject) .collect(Collectors.toList()); return new SiriusServerDashboardDto(projectsCount, viewpointsCount, metamodelsCount, projects); }
Source:
<code>private void draw() { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); commonDrawer.begin(); if (solGame != null) { solGame.draw(); } uiDrawer.updateMtx(); inputManager.draw(uiDrawer, this); if (solGame != null) { solGame.drawDebugUi(uiDrawer); factionDisplay.drawFactionNames(solGame, uiDrawer, inputManager, solGame.getObjectManager()); } if (fatalErrorMsg != null) { <START> uiDrawer.draw(UiDrawer.whiteTexture, displayDimensions.getRatio(), .5f, 0, 0, 0, .25f, 0, SolColor.UI_BG); <END> uiDrawer.drawString(fatalErrorMsg, displayDimensions.getRatio(), .5f, FontSize.MENU, true, SolColor.WHITE); uiDrawer.drawString(fatalErrorTrace, .2f * displayDimensions.getRatio(), .6f, FontSize.DEBUG, false, SolColor.WHITE); } DebugCollector.draw(uiDrawer); if (solGame == null) { uiDrawer.drawString("v" + Const.VERSION, 0.01f, .974f, FontSize.DEBUG, UiDrawer.TextAlignment.LEFT, false, SolColor.WHITE); } commonDrawer.end(); }</code><technical_language>figure out this is here? Is this change useful</technical_language>

Target:
private void draw() { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); commonDrawer.begin(); if (solGame != null) { solGame.draw(); } uiDrawer.updateMtx(); inputManager.draw(uiDrawer, this); if (solGame != null) { solGame.drawDebugUi(uiDrawer); factionDisplay.drawFactionNames(solGame, uiDrawer, inputManager, solGame.getObjectManager()); } if (fatalErrorMsg != null) { uiDrawer.draw(uiDrawer.whiteTexture, displayDimensions.getRatio(), .5f, 0, 0, 0, .25f, 0, SolColor.UI_BG); uiDrawer.drawString(fatalErrorMsg, displayDimensions.getRatio(), .5f, FontSize.MENU, true, SolColor.WHITE); uiDrawer.drawString(fatalErrorTrace, .2f * displayDimensions.getRatio(), .6f, FontSize.DEBUG, false, SolColor.WHITE); } DebugCollector.draw(uiDrawer); if (solGame == null) { uiDrawer.drawString("v" + Const.VERSION, 0.01f, .974f, FontSize.DEBUG, UiDrawer.TextAlignment.LEFT, false, SolColor.WHITE); } commonDrawer.end(); }