auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void destroy(World world, int i, int j, int k){ TileEntityManaBattery te = getTileEntity(world, i, j, k); <START> <END> if (te != null && !world.isRemote){ float f = world.rand.nextFloat() * 0.8F + 0.1F; float f1 = world.rand.nextFloat() * 0.8F + 0.1F; float f2 = world.rand.nextFloat() * 0.8F + 0.1F; int dmg = (int)((PowerNodeRegistry.For(world).getPower(te, te.getPowerType()) / te.getCapacity()) * 100); if (dmg == 0) dmg = 1; ItemStack stack = new ItemStack(this); stack.damageItem(stack.getMaxDamage() - dmg, new EntityDummyCaster(world)); stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setFloat("mana_battery_charge", PowerNodeRegistry.For(world).getPower(te, te.getPowerType())); stack.stackTagCompound.setInteger("mana_battery_powertype", te.getPowerType().ID()); if (!stack.stackTagCompound.hasKey("Lore")) stack.stackTagCompound.setTag("Lore", new NBTTagList()); NBTTagList tagList = new NBTTagList(); PowerTypes powerType = te.getPowerType(); float amt = PowerNodeRegistry.For(world).getPower(te, powerType); tagList.appendTag(new NBTTagString(String.format("Contains %.2f %s%s etherium", amt, powerType.chatColor(), powerType.name()))); stack.stackTagCompound.setTag("Lore", tagList); EntityItem entityitem = new EntityItem(world, i + f, j + f1, k + f2, stack); float f3 = 0.05F; entityitem.motionX = (float)world.rand.nextGaussian() * f3; entityitem.motionY = (float)world.rand.nextGaussian() * f3 + 0.2F; entityitem.motionZ = (float)world.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); } }</code><technical_language>Close! extra line here</technical_language>

Target:
private void destroy(World world, int i, int j, int k){ float f = world.rand.nextFloat() * 0.8F + 0.1F; float f1 = world.rand.nextFloat() * 0.8F + 0.1F; float f2 = world.rand.nextFloat() * 0.8F + 0.1F; ItemStack stack = new ItemStack(this); EntityItem entityitem = new EntityItem(world, i + f, j + f1, k + f2, stack); float f3 = 0.05F; entityitem.motionX = (float)world.rand.nextGaussian() * f3; entityitem.motionY = (float)world.rand.nextGaussian() * f3 + 0.2F; entityitem.motionZ = (float)world.rand.nextGaussian() * f3; world.spawnEntityInWorld(entityitem); }
Source:
<code>protected InputField(Parcel in) { this.id = in.readInt(); this.concept = in.readString(); this.value = in.readDouble(); <START> this.isRed=(in.readInt()==1)?true:false; <END> }</code><technical_language>?true:false is redundant, in.readInt() is true is true (It sound silly :rofl:)</technical_language>

Target:
protected InputField(Parcel in) { this.id = in.readInt(); this.concept = in.readString(); this.value = in.readDouble(); this.isRed = (in.readInt()==1); }
Source:
<code>protected Watchers getWatchers(NotifyType type) throws OrmException { <START> ProjectWatch watch = <END> new ProjectWatch(args, project, projectState, changeData); return watch.getWatchers(type); }</code><technical_language>Is this reformatting necessary? diff view more messy</technical_language>

Target:
protected final Watchers getWatchers(NotifyType type) throws OrmException { ProjectWatch watch = new ProjectWatch(args, project, projectState, changeData); return watch.getWatchers(type); }
Source:
<code>public void return_all_projects() { <START> ComponentDto associatedProject = insertProject(ComponentTesting.newPublicProjectDto(organization)); <END> ComponentDto unassociatedProject = insertProject(ComponentTesting.newPublicProjectDto(organization)); associateProjectToQualitGate(associatedProject.getId()); Association result = underTest.find(dbSession, organization, builder() .gateId(Long.toString(qGate.getId())) .build()); Map<Long, ProjectQgateAssociation> projectsById = projectsById(result.projects()); assertThat(projectsById).hasSize(2); verifyProject(projectsById.get(associatedProject.getId()), true, associatedProject.name()); verifyProject(projectsById.get(unassociatedProject.getId()), false, unassociatedProject.name()); }</code><technical_language>In fact replace in code</technical_language>

Target:
public void return_all_projects() { OrganizationDto organization = dbTester.organizations().insert(); QualityGateDto qGate = dbTester.qualityGates().insertQualityGate(organization, qualityGateDto -> qualityGateDto.setName("Default Quality Gate").setUuid(Uuids.createFast())); dbTester.commit(); ComponentDto unassociatedProject = newPublicProjectDto(organization); dbTester.components().insertComponent(unassociatedProject); ComponentDto associatedProject = newPublicProjectDto(organization); dbTester.components().insertComponent(associatedProject); associateProjectToQualitGate(associatedProject, qGate); Association result = underTest.find(dbSession, organization, builder() .gateId(Long.toString(qGate.getId())) .build()); Map<Long, ProjectQgateAssociation> projectsById = projectsById(result.projects()); assertThat(projectsById).hasSize(2); verifyProject(projectsById.get(associatedProject.getId()), true, associatedProject.name()); verifyProject(projectsById.get(unassociatedProject.getId()), false, unassociatedProject.name()); }
Source:
<code>public void aSpareFollowedByZerosIsWorthTenPoints() { int[] rolls = { 6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; PlayGame(rolls); assertEquals(10, game.score()); <START> } <END></code><technical_language>improve readability a bit if expected score a variable instead</technical_language>

Target:
public void aSpareFollowedByZerosIsWorthTenPoints() { int[] rolls = {6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; playGame(rolls); assertEquals(10, game.score()); }
Source:
<code>Builder setClock(Clock clock) { <START> this.clock = clock; <END> return this; }</code><technical_language>Is a reason allow null clocks set system in getter? feels more thread safe</technical_language>

Target:
Builder setClock(Clock clock) { this.clock = Preconditions.checkNotNull(clock); return this; }
Source:
<code>public <T> T getAdapter(Class<T> adapter) { <START> if (adapter == UserWorkspaceServiceImplComponent.class) { <END> return (T) this; } if (adapter == UserWorkspaceService.class) { return adapter.cast(getUserWorkspaceService()); } if (adapter == CollectionLocationService.class) { return adapter.cast(getUserWorkspaceService()); } return null; }</code><technical_language>getClass()</technical_language>

Target:
public <T> T getAdapter(Class<T> adapter) { if (adapter == UserWorkspaceServiceImplComponent.class) { return adapter.cast(this); } else if (adapter == UserWorkspaceService.class) { return adapter.cast(getUserWorkspaceService()); } else if (adapter == CollectionLocationService.class) { return adapter.cast(getUserWorkspaceService()); } return null; }
Source:
<code>public void updateDiskCacheKey(MessageDigest messageDigest) { <START> messageDigest.update(ID_BYTES); <END> }</code><technical_language>of static import above, ID_BYTES is consistent getId(). of relation methods equals-hashCode</technical_language>

Target:
public void updateDiskCacheKey(MessageDigest messageDigest) { messageDigest.update(getId().getBytes(CHARSET)); }
Source:
<code>public void open(Map conf, final TopologyContext context, SpoutOutputCollector collector) { spoutService = context.getThisComponentId(); <START> this.setEventSender(); <END> delegate.open(conf, context, new SpoutOutputCollector(collector) { @Override public List<Integer> emit(String streamId, List<Object> tuple, Object messageId) { List<Integer> emitResult = super.emit(streamId, tuple, messageId); Monitor.getMonitor().startLatency(messageId); return emitResult; } @Override public void emitDirect(int taskId, String streamId, List<Object> tuple, Object messageId) { super.emitDirect(taskId, streamId, tuple, messageId); Monitor.getMonitor().startLatency(messageId); } }); }</code><technical_language>context.getComponentId() inject event sender</technical_language>

Target:
public void open(Map conf, final TopologyContext context, SpoutOutputCollector collector) { spoutService = context.getThisComponentId(); injectEventSender(delegate); delegate.open(conf, context, new SpoutOutputCollector(collector) { @Override public List<Integer> emit(String streamId, List<Object> tuple, Object messageId) { List<Integer> emitResult = super.emit(streamId, tuple, messageId); Monitor.getMonitor().startLatency(messageId); return emitResult; } @Override public void emitDirect(int taskId, String streamId, List<Object> tuple, Object messageId) { super.emitDirect(taskId, streamId, tuple, messageId); Monitor.getMonitor().startLatency(messageId); } }); }
Source:
<code>public String getDisplayString(Diagnosis diagnosis) { if (diagnosis.getDiagnosis() == null) { return ""; } else { <START> if (diagnosis.getDiagnosis().getCoded() != null) <END> return diagnosis.getDiagnosis().getCoded().getName().getName(); return diagnosis.getDiagnosis().getNonCoded(); } }</code><technical_language>curly braces? <LINK_0></technical_language>

Target:
public String getDisplayString(Diagnosis diagnosis) { if (diagnosis.getDiagnosis() == null) { return ""; } else { if (diagnosis.getDiagnosis().getCoded() != null) { return diagnosis.getDiagnosis().getCoded().getName().getName(); } return diagnosis.getDiagnosis().getNonCoded(); } }
Source:
<code>public void whenClientErrorResponseThenGetFeatureFlagsShouldThrow() throws Exception { <START> when(restTemplate.getForObject(FEATURE_FLAGS_URI_PATTERN, FeatureFlags.class, PROJECT_ID)) <END> .thenThrow(new RestClientException("")); service.listFeatureFlags(project); }</code><technical_language>missing matches()</technical_language>

Target:
public void whenClientErrorResponseThenGetFeatureFlagsShouldThrow() throws Exception { when(restTemplate.getForObject(new URI(FEATURE_FLAGS_URI), FeatureFlags.class)) .thenThrow(new RestClientException("")); service.listFeatureFlags(project); }
Source:
<code>private static void bootstrapLayoutServer(IClientRouter router, Layout layout) <START> throws ExecutionException, InterruptedException, AlreadyBootstrappedException, TimeoutException { LayoutClient layoutClient = new LayoutClient(router, layout.getEpoch()); try { CFUtils.getUninterruptibly(layoutClient.bootstrapLayout(layout), AlreadyBootstrappedException.class, TimeoutException.class); } catch (AlreadyBootstrappedException abe) { if (!layoutClient.getLayout().get().equals(layout)) { log.error("BootstrapUtil: Layout Server {}:{} already bootstrapped with different " + "layout.", router.getHost(), router.getPort()); throw abe; } } catch (TimeoutException toe){ log.error("BootstrapUtil: Layout Server {}:{} timeout occurred.", router.getHost(), router.getPort()); throw toe; <END> } }</code><technical_language>I understand need explicitly handle TimeoutException here. NetworkExceptions other exceptions? Besides, caller of this, BootstrapUtil.bootstrap() logs handles exceptions: <LINK_0></technical_language>

Target:
private static void bootstrapLayoutServer(IClientRouter router, Layout layout) throws ExecutionException, InterruptedException, AlreadyBootstrappedException { LayoutClient layoutClient = new LayoutClient(router, layout.getEpoch()); try { CFUtils.getUninterruptibly(layoutClient.bootstrapLayout(layout), AlreadyBootstrappedException.class); } catch (AlreadyBootstrappedException abe) { if (!layoutClient.getLayout().get().equals(layout)) { log.error("BootstrapUtil: Layout Server {}:{} already bootstrapped with different " + "layout.", router.getHost(), router.getPort()); throw abe; } } }
Source:
<code>private void setUpUserView(UserViewHolder viewHolder, Item item) { final User user = item.getUser(); viewHolder.mName.setText(user.getName()); if (user.getSchool() != null) { viewHolder.mSchool.setText(user.getSchool().getName()); } viewHolder.mView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onItemClick(user); } }); user.loadUserImage(mActivity, viewHolder.mImage); int role = user.getRole(); if (user.getDirectorId() != 0) { role = 3; } viewHolder.mUserType.setVisibility(View.VISIBLE); viewHolder.mBorder.setVisibility(View.VISIBLE); viewHolder.mUserType.setTypeface(null, Typeface.BOLD); GradientDrawable shape = (GradientDrawable) viewHolder.mUserType.getBackground(); viewHolder.mUserType.setText(ROLES[role]); <START> switch(role) { <END> case 0: if (user.getUserSemester() != null && !user.getUserSemester().isActive()) { shape.setColor(mActivity.getResources().getColor(R.color.red_endangered)); } else { viewHolder.mBorder.setVisibility(View.GONE); viewHolder.mUserType.setVisibility(View.GONE); } break; case 1: shape.setColor(mActivity.getResources().getColor(R.color.orange_admin)); break; case 2: shape.setColor(mActivity.getResources().getColor(R.color.blue_president)); break; case 3: shape.setColor(mActivity.getResources().getColor(R.color.turquoise_director)); break; } }</code><technical_language>i recommend moving this entire method a UserUtils file something, set background color similarly</technical_language>

Target:
private void setUpUserView(UserViewHolder viewHolder, Item item) { final User user = item.getUser(); viewHolder.mName.setText(user.getName()); if (user.getSchool() != null) { viewHolder.mSchool.setText(user.getSchool().getName()); } viewHolder.mView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onItemClick(user); } }); user.loadUserImage(mActivity, viewHolder.mImage); UserUtils.setType(mActivity, user, viewHolder.mUserType, viewHolder.mBorder, user.ABBREV_ROLES_LABEL); }
Source:
<code>public void testOpenTransientSession() { SWTBotTreeItem projectTreeItemBot = modelExplorerViewBot.tree().expandNode(getProjectName(), true); SWTBotTreeItem modelResourceTreeItemBot = projectTreeItemBot.getNode(SEMANTIC_RESOURCE_NAME); modelResourceTreeItemBot.select(); SWTBotUtils.clickContextMenu(modelResourceTreeItemBot, "Sirius Ecore Editor"); SWTBotUtils.waitAllUiEvents(); bot.waitUntil(new ICondition() { @Override public boolean test() throws Exception { return bot.editors().size() == 1; } @Override public void init(SWTBot bot) { } @Override public String getFailureMessage() { return "Sirius Ecore Editor should be opened"; } <START> }); <END> modelResourceTreeItemBot.select().doubleClick(); assertEquals("Double click on the opened model should not open a second editor", 1, bot.editors().size()); assertEquals("The double click action should not open a second session", 1, localSession.getOpenedSession().getAllSessionResources().size()); }</code><technical_language>NumberOfOpenedEditorsCondition instead of this anonymous condition</technical_language>

Target:
public void testOpenTransientSession() { SWTBotTreeItem projectTreeItemBot = modelExplorerViewBot.tree().expandNode(getProjectName(), true); SWTBotTreeItem modelResourceTreeItemBot = projectTreeItemBot.getNode(SEMANTIC_RESOURCE_NAME); modelResourceTreeItemBot.select(); SWTBotUtils.clickContextMenu(modelResourceTreeItemBot, "Sirius Ecore Editor"); bot.waitUntil(new NumberOfOpenedEditorsCondition(bot, 1)); modelResourceTreeItemBot.select().doubleClick(); assertEquals("Double click on the opened model should not open a second editor", 1, bot.editors().size()); assertEquals("The double click action should not open a second session", 1, localSession.getOpenedSession().getAllSessionResources().size()); }
Source:
<code>public void backPressed() { if (mediaDetails != null) { if (mediaDetails.isVisible()) { ((BookmarkFragment) getParentFragment()).tabLayout.setVisibility(View.VISIBLE); removeFragment(mediaDetails); setFragment(listFragment, mediaDetails); ((MainActivity) getActivity()).showTabs(); } else { <START> ((MainActivity) getActivity()).setSelectedItemId(NavTab.CONTRIBUTIONS.code()); <END> ((MainActivity) getActivity()).showTabs(); } } else { ((MainActivity) getActivity()).setSelectedItemId(NavTab.CONTRIBUTIONS.code()); ((MainActivity) getActivity()).showTabs(); } }</code><technical_language>avoid code duplication (lines 184 188) combining if statements</technical_language>

Target:
public void backPressed() { if (mediaDetails != null) { if (mediaDetails.isVisible()) { ((BookmarkFragment) getParentFragment()).tabLayout.setVisibility(View.VISIBLE); removeFragment(mediaDetails); setFragment(listFragment, mediaDetails); ((MainActivity) getActivity()).showTabs(); } else { moveToContributionsFragment(); } } else { moveToContributionsFragment(); } }
Source:
<code>public void setSwingHand(boolean value) { <START> if(isPickBlock()) throw new UnsupportedOperationException("The hand swing can't be disabled if this is a pick block input."); <END> handSwing = value; }</code><technical_language>I argue is point punishing modders for this. put in method doc changing this affect for pick blocks</technical_language>

Target:
public void setSwingHand(boolean value) { handSwing = value; }
Source:
<code>protected void onResume() { super.onResume(); <START> if (!PrefUtils.isFirstStartDone(this)) { <END> mDrawerLayout.openDrawer(Gravity.START); } }</code><technical_language>I this is broken, navdrawer is openning everytime I open app</technical_language>

Target:
protected void onResume() { super.onResume(); if (PrefUtils.shouldOpenDrawerOnStart(this)) { mDrawerLayout.openDrawer(Gravity.START); } }
Source:
<code>public void configureCredentialFactory(final ChainingRestHttpRequestCredentialFactory factory) { val restProperties = casProperties.getRest(); val extractor = x509CertificateExtractor.getIfAvailable(); val headerAuth = restProperties.isHeaderAuth(); val bodyAuth = restProperties.isBodyAuth(); val tlsClientAuth = restProperties.isTlsClientAuth(); <START> LOGGER.debug("is certificate extractor available? = {}, headerAuth = {}, bodyAuth = {}, tlsClientAuth = {}", <END> extractor, headerAuth, bodyAuth, tlsClientAuth); if (tlsClientAuth && (headerAuth || bodyAuth)) { LOGGER.warn("X509 REST configuration seems inconsistant as activating headerAuth or bodyAuth supposes " + "that the CAS server is not directly reachable by clients (see security warning in the " +"documentation) and activating tlsClientAuth suppose the opposite."); } if (extractor != null && headerAuth) { factory.registerCredentialFactory(x509RestRequestHeader()); } if (bodyAuth) { factory.registerCredentialFactory(x509RestMultipartBody()); } if (tlsClientAuth) { factory.registerCredentialFactory(x509RestTlsClientCert()); } }</code><technical_language>switch trace capitalize log statement</technical_language>

Target:
public void configureCredentialFactory(final ChainingRestHttpRequestCredentialFactory factory) { val restProperties = casProperties.getRest(); val extractor = x509CertificateExtractor.getIfAvailable(); val headerAuth = restProperties.isHeaderAuth(); val bodyAuth = restProperties.isBodyAuth(); val tlsClientAuth = restProperties.isTlsClientAuth(); LOGGER.trace("Is certificate extractor available? = {}, headerAuth = {}, bodyAuth = {}, tlsClientAuth = {}", extractor, headerAuth, bodyAuth, tlsClientAuth); if (tlsClientAuth && (headerAuth || bodyAuth)) { LOGGER.warn("The X.509 feature over REST using \"headerAuth\" or \"bodyAuth\" provides a tremendously " + "convenient target for claiming user identities or obtaining TGTs without proof of private " + "key ownership. To securely use this feature, network configuration MUST allow connections " + "to the CAS server only from trusted hosts which in turn have strict security limitations " + "and logging. Thus, \"tlsClientAuth\" shouldn't be activated together with \"headerAuth\" " + "or \"bodyAuth\""); } if (extractor != null && headerAuth) { factory.registerCredentialFactory(x509RestRequestHeader()); } if (bodyAuth) { factory.registerCredentialFactory(x509RestMultipartBody()); } if (tlsClientAuth) { factory.registerCredentialFactory(x509RestTlsClientCert()); } }
Source:
<code>public void testThumbLargeRouteNoForceFileExists() throws Exception { String derivativePath = idToPath(fileID, HASHED_PATH_DEPTH, HASHED_PATH_SIZE); File existingFile = new File("target/" + derivativePath + "/" + fileID + ".png"); FileUtils.writeStringToFile(existingFile, "extracted text", "utf-8"); createContext(largeThumbRoute); getMockEndpoint("mock:exec:/bin/sh").expectedMessageCount(0); Map<String, Object> headers = createEvent(fileID, eventTypes, "false"); template.sendBodyAndHeaders("", headers); <START> doThrow(Exception.class).when(addLargeThumbnailProcessor).process(any(Exchange.class)); <END> verify(addLargeThumbnailProcessor, never()).process(any(Exchange.class)); assertMockEndpointsSatisfied(); existingFile.delete(); }</code><technical_language>question for this throw, remove delete</technical_language>

Target:
public void testThumbLargeRouteNoForceFileExists() throws Exception { String derivativePath = idToPath(fileID, HASHED_PATH_DEPTH, HASHED_PATH_SIZE); File existingFile = new File("target/" + derivativePath + "/" + fileID + ".png"); FileUtils.writeStringToFile(existingFile, "extracted text", "utf-8"); createContext(largeThumbRoute); getMockEndpoint("mock:exec:/bin/sh").expectedMessageCount(0); Map<String, Object> headers = createEvent(fileID, eventTypes, "false"); template.sendBodyAndHeaders("", headers); doNothing().when(addLargeThumbnailProcessor).process(any(Exchange.class)); verify(addLargeThumbnailProcessor, never()).process(any(Exchange.class)); assertMockEndpointsSatisfied(); }
Source:
<code>public void testGenerateHiddenStateChainOnUninformativeHMM() { final int numStates = 3; final UninformativeTestHMModel model = new UninformativeTestHMModel(numStates); final int chainLength = 100000; final List<Integer> positions = IntStream.range(0, chainLength).boxed().collect(Collectors.toList()); final List<Integer> chain = model.generateHiddenStateChain(positions); Assert.assertEquals(chain.size(), positions.size()); final int[] counts = new int[numStates]; chain.stream().forEach(n -> counts[n]++); <START> final int expectedCountsPerSTate = chainLength / numStates; <END> final double averageCountDeviation = Arrays.stream(counts) .map(c -> Math.abs(c - expectedCountsPerSTate)).average().getAsDouble(); Assert.assertEquals(averageCountDeviation, 0, 200); }</code><technical_language>expectedCountsPerSTate -> expectedCountsPerState</technical_language>

Target:
public void testGenerateHiddenStateChainOnUninformativeHMM() { final int numStates = 3; final UninformativeTestHMModel model = new UninformativeTestHMModel(numStates); final int chainLength = 100000; final List<Integer> positions = IntStream.range(0, chainLength).boxed().collect(Collectors.toList()); final List<Integer> chain = model.generateHiddenStateChain(positions); Assert.assertEquals(chain.size(), positions.size()); final int[] counts = new int[numStates]; chain.stream().forEach(n -> counts[n]++); final int expectedCountsPerState = chainLength / numStates; final double averageCountDeviation = Arrays.stream(counts) .map(c -> Math.abs(c - expectedCountsPerState)).average().getAsDouble(); Assert.assertEquals(averageCountDeviation, 0, 200); }
Source:
<code>private HttpComponentsMessageSender webServiceMessageSender(final String keystore) throws GeneralSecurityException, IOException { final KeyStoreFactoryBean keyStoreFactory = new KeyStoreFactoryBean(); keyStoreFactory.setType(this.keyStoreType); keyStoreFactory.setLocation(new FileSystemResource(this.keyStoreLocation + "/" + keystore + ".pfx")); keyStoreFactory.setPassword(this.keyStorePassword); keyStoreFactory.afterPropertiesSet(); final KeyStore keyStore = keyStoreFactory.getObject(); if (keyStore == null || keyStore.size() == 0) { throw new KeyStoreException("Key store is empty"); } final HttpComponentsMessageSender sender = new HttpComponentsMessageSender(); final HttpClient client = sender.getHttpClient(); <START> final SSLSocketFactory socketFactory = new SSLSocketFactory(keyStore, this.keyStorePassword, <END> this.trustStoreFactory.getObject()); final Scheme scheme = new Scheme("https", 443, socketFactory); client.getConnectionManager().getSchemeRegistry().register(scheme); return sender; }</code><technical_language>This code is deprecated. deprecated tag class. is a user story [<LINK_0>](<LINK_0>) for this. Is idea update this well? I works also....</technical_language>

Target:
private HttpComponentsMessageSender webServiceMessageSender(final String keystore) throws GeneralSecurityException, IOException { final KeyStoreFactoryBean keyStoreFactory = new KeyStoreFactoryBean(); keyStoreFactory.setType(this.keyStoreType); keyStoreFactory.setLocation(new FileSystemResource(this.keyStoreLocation + "/" + keystore + ".pfx")); keyStoreFactory.setPassword(this.keyStorePassword); keyStoreFactory.afterPropertiesSet(); final KeyStore keyStore = keyStoreFactory.getObject(); if (keyStore == null || keyStore.size() == 0) { throw new KeyStoreException("Key store is empty"); } SSLContext sslContext = SSLContexts.custom() .loadKeyMaterial(keyStore , this.keyStorePassword.toCharArray()) .loadTrustMaterial(this.trustStoreFactory.getObject(), new TrustSelfSignedStrategy()) .build(); HttpClientBuilder clientbuilder = HttpClientBuilder.create(); SSLConnectionSocketFactory connectionFactory = new SSLConnectionSocketFactory(sslContext, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); clientbuilder.setSSLSocketFactory(connectionFactory); clientbuilder.addInterceptorLast(new HttpComponentsMessageSender.RemoveSoapHeadersInterceptor()); return new HttpComponentsMessageSender(clientbuilder.build()); }
Source:
<code>public void saveAllConfigs(Configs configs) { List<Config> allConfigs = configs.getConfigs(); if (configs.getByName(configs.getDefaultConfigName()) != null) { this.configs.setDefaultConfigName(configs.getDefaultConfigName()); } <START> for (int i=0; i<configs.getConfigs().size(); i++) { <END> addConfig(allConfigs.get(i)); } }</code><technical_language>a for-each</technical_language>

Target:
public void saveAllConfigs(Configs configs) { this.configs.setDefaultConfigName(configs.getDefaultConfigName()); for (Config config : configs.getConfigs()) { addConfig(config); } }
Source:
<code>public OutputStream createOutput(final String blobName) throws IOException { deleteBlob(blobName); final PipedInputStream in = new PipedInputStream(); <START> final Thread transport = new Thread(new Runnable(){ <END> public void run(){ blobStore.swift().getObject(buildKey(blobName)).uploadObject(in); } }); transport.start(); return new PipedOutputStream(in) { @Override public void close() throws IOException { super.close(); } }; }</code><technical_language>I if this Runnable submitted of Elasticsearch's thread pools fly spawned thread. Probaly big deal do in fly thread. name thread though</technical_language>

Target:
public OutputStream createOutput(final String blobName) throws IOException { deleteBlob(blobName); final PipedInputStream in = new PipedInputStream(); final Thread transport = new Thread(new Runnable(){ public void run(){ blobStore.swift().getObject(buildKey(blobName)).uploadObject(in); } }); transport.start(); return new PipedOutputStream(in) { @Override public void close() throws IOException { try { super.close(); transport.join(); } catch(InterruptedException e) { throw new IOException("Swift input/output shenanigans."); } } }; }
Source:
<code>public File createFile(String pathname, Config config) { if <START> (config != null && isNfsSupportEnabled(config)) { <END> return new NFSFile(pathname, config); } return new File(pathname); }</code><technical_language>put check for config==null isNfsSupportEnabled. If config==null isNfsSupportEnabled return false</technical_language>

Target:
public File createFile(String pathname, Config config) { return isNfsSupportEnabled(config) ? new NFSFile(pathname, config) : new File(pathname); }
Source:
<code><START> public Object compute(final Map<String, Object> combinedAggregators) <END> { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); return sketch.getRetainedEntries(); }</code><technical_language>Please change return type Integer for type safety</technical_language>

Target:
public Integer compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); return sketch.getRetainedEntries(); }
Source:
<code>protected String selectSQL(SimpleFeatureType featureType, Query query) throws IOException, SQLException { StringBuffer sql = new StringBuffer(); sql.append("SELECT "); selectColumns(featureType, null, query, sql); sql.setLength(sql.length() - 1); dialect.encodePostSelect(featureType, sql); sql.append(" FROM "); encodeTableName(featureType.getTypeName(), sql, setKeepWhereClausePlaceHolderHint(query)); <START> optimizeSQL(featureType, query, sql); <END> Filter filter = query.getFilter(); if (filter != null && !Filter.INCLUDE.equals(filter)) { sql.append(" WHERE "); filter(featureType, filter, sql); } sort(featureType, query.getSortBy(), null, sql); applyLimitOffset(sql, query.getStartIndex(), query.getMaxFeatures()); applySearchHints(featureType, query, sql); return sql.toString(); }</code><technical_language>selectSQL method is called for normal data extraction, is a separate method handle visitors, problem is of wrappers GeoServer datastore is passing visitor breaks optimization</technical_language>

Target:
protected String selectSQL(SimpleFeatureType featureType, Query query) throws IOException, SQLException { StringBuffer sql = new StringBuffer(); sql.append("SELECT "); selectColumns(featureType, null, query, sql); sql.setLength(sql.length() - 1); dialect.encodePostSelect(featureType, sql); sql.append(" FROM "); encodeTableName(featureType.getTypeName(), sql, setKeepWhereClausePlaceHolderHint(query)); Filter filter = query.getFilter(); if (filter != null && !Filter.INCLUDE.equals(filter)) { sql.append(" WHERE "); filter(featureType, filter, sql); } sort(featureType, query.getSortBy(), null, sql); applyLimitOffset(sql, query.getStartIndex(), query.getMaxFeatures()); applySearchHints(featureType, query, sql); return sql.toString(); }
Source:
<code><START> public void validateFragmentContributions(IBuildEntry binIncludes) { <END> try { Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(PDEProject.getPluginXml(fProject).getContents()); XPath xpath = XPathFactory.newInstance().newXPath(); NodeList list = (NodeList) xpath.evaluate("/plugin/extension[@point='org.eclipse.e4.workbench.model']/fragment/@uri", doc, XPathConstants.NODESET); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); validateBinIncludes(binIncludes, node.getNodeValue()); } } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>this method private</technical_language>

Target:
private void validateFragmentContributions(IBuildEntry binIncludes) { try { Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(PDEProject.getPluginXml(fProject).getContents()); XPath xpath = XPathFactory.newInstance().newXPath(); NodeList list = (NodeList) xpath.evaluate("/plugin/extension[@point='org.eclipse.e4.workbench.model']/fragment/@uri", doc, XPathConstants.NODESET); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); validateBinIncludes(binIncludes, node.getNodeValue()); } } catch (Exception e) { e.printStackTrace(); } }
Source:
<code>protected String createPayload(Nic.Request.CreatePayload payload) { checkNotNull(payload, "payload"); checkNotNull(payload.dataCenterId(), "dataCenterId"); checkNotNull(payload.serverId(), "serverId"); dataCenterId = payload.dataCenterId(); serverId = payload.serverId(); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("lan", payload.lan()); if (payload.name() != null) properties.put("name", payload.name()); if (payload.ips() != null && !payload.ips().isEmpty()) properties.put("ips", payload.ips()); if (payload.dhcp() != null) properties.put("dhcp", payload.dhcp()); if (payload.firewallActive() != null) properties.put("firewallActive", payload.firewallActive()); if (payload.firewallrules() != null) { Map<String, Object> entities = new HashMap<String, Object>(); entities.put("firewallrules", payload.firewallrules()); properties.put("entities", entities); } requestBuilder.put("properties", properties); <START> return (new Gson()).toJson(requestBuilder); <END> }</code><technical_language>injected Json</technical_language>

Target:
protected String createPayload(Nic.Request.CreatePayload payload) { checkNotNull(payload, "payload"); checkNotNull(payload.dataCenterId(), "dataCenterId"); checkNotNull(payload.serverId(), "serverId"); dataCenterId = payload.dataCenterId(); serverId = payload.serverId(); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("lan", payload.lan()); if (payload.name() != null) properties.put("name", payload.name()); if (payload.ips() != null && !payload.ips().isEmpty()) properties.put("ips", payload.ips()); if (payload.dhcp() != null) properties.put("dhcp", payload.dhcp()); if (payload.firewallActive() != null) properties.put("firewallActive", payload.firewallActive()); if (payload.firewallrules() != null) { Map<String, Object> entities = new HashMap<String, Object>(); entities.put("firewallrules", payload.firewallrules()); properties.put("entities", entities); } requestBuilder.put("properties", properties); return jsonBinder.toJson(requestBuilder); }
Source:
<code>public String getInfo() { if (aggregate.getID().equals(AverageAggregate.ID)) { return Localization.getString("UniqueFilter.Average"); } else if (aggregate.getID().equals(CountAggregate.ID)) { <START> return Localization.getString("UniqueFilter.Average"); END> } else if (aggregate.getID().equals(MaxAggregate.ID)) { return Localization.getString("UniqueFilter.Average"); } else if (aggregate.getID().equals(MinAggregate.ID)) { return Localization.getString("UniqueFilter.Average"); } else if (aggregate.getID().equals(SumAggregate.ID)) { return Localization.getString("UniqueFilter.Average"); } return Localization.getString("UniqueFilter.Other"); }</code><technical_language>this UniqueFilter.Count ?.. applies rest</technical_language>

Target:
public String getInfo() { if (aggregate.getID().equals(AverageAggregate.ID)) { return Localization.getString("UniqueFilter.Average"); } else if (aggregate.getID().equals(CountAggregate.ID)) { return Localization.getString("UniqueFilter.Count"); } else if (aggregate.getID().equals(MaxAggregate.ID)) { return Localization.getString("UniqueFilter.Max"); } else if (aggregate.getID().equals(MinAggregate.ID)) { return Localization.getString("UniqueFilter.Min"); } else if (aggregate.getID().equals(SumAggregate.ID)) { return Localization.getString("UniqueFilter.Sum"); } return Localization.getString("UniqueFilter.Other"); }
Source:
<code>private List<Entity> generateEntities(String extensionName, HttpServletRequest request) throws FalconException, IOException { Properties properties = new Properties(); properties.load(request.getInputStream()); List<Entity> entities = extension.getEntities(extensionName, properties); for (Entity entity : entities) { String tags = entity.getTags(); <START> if (!StringUtils.isEmpty(tags)) { <END> if (tags.contains(TAG_PREFIX_EXTENSION_NAME)) { throw new FalconException("Generated extention entity " + entity.getName() + " should not contain tag prefix " + TAG_PREFIX_EXTENSION_NAME); } if (tags.contains(TAG_PREFIX_EXTENSION_JOB)) { throw new FalconException("Generated extention entity " + entity.getName() + " should not contain tag prefix " + TAG_PREFIX_EXTENSION_JOB); } setEntityTags(entity, tags + TAG_SEPARATOR + TAG_PREFIX_EXTENSION_NAME + extensionName + TAG_SEPARATOR + TAG_PREFIX_EXTENSION_JOB + properties.getProperty(ExtensionProperties.JOB_NAME.getName())); } else { setEntityTags(entity, TAG_PREFIX_EXTENSION_NAME + extensionName + TAG_SEPARATOR + TAG_PREFIX_EXTENSION_JOB + properties.getProperty(ExtensionProperties.JOB_NAME.getName())); } } return entities; }</code><technical_language>StringUtils.isNotEmpty</technical_language>

Target:
private List<Entity> generateEntities(String extensionName, HttpServletRequest request) throws FalconException, IOException { Properties properties = new Properties(); properties.load(request.getInputStream()); List<Entity> entities = extension.getEntities(extensionName, properties); for (Entity entity : entities) { String tags = entity.getTags(); if (StringUtils.isNotEmpty(tags)) { if (tags.contains(TAG_PREFIX_EXTENSION_NAME)) { throw new FalconException("Generated extention entity " + entity.getName() + " should not contain tag prefix " + TAG_PREFIX_EXTENSION_NAME); } if (tags.contains(TAG_PREFIX_EXTENSION_JOB)) { throw new FalconException("Generated extention entity " + entity.getName() + " should not contain tag prefix " + TAG_PREFIX_EXTENSION_JOB); } setEntityTags(entity, tags + TAG_SEPARATOR + TAG_PREFIX_EXTENSION_NAME + extensionName + TAG_SEPARATOR + TAG_PREFIX_EXTENSION_JOB + properties.getProperty(ExtensionProperties.JOB_NAME.getName())); } else { setEntityTags(entity, TAG_PREFIX_EXTENSION_NAME + extensionName + TAG_SEPARATOR + TAG_PREFIX_EXTENSION_JOB + properties.getProperty(ExtensionProperties.JOB_NAME.getName())); } } return entities; }
Source:
<code>protected void accept(Diff diff, boolean rightToLeft) { final Optional<OpaqueElementBodyChange> possibleBodyChange = getOpaqueElementBodyChange(diff); if (possibleBodyChange.isPresent()) { final OpaqueElementBodyChange bodyChange = getOpaqueElementBodyChange(diff).get(); if (LOGGER.isDebugEnabled()) { int refinedElementCount = bodyChange.getRefinedBy().size(); LOGGER.debug("accept(Diff, boolean) - " + refinedElementCount <START> + " refined diffs merged for diff " + diff.hashCode()); END> } switch (bodyChange.getKind()) { case ADD: acceptRefiningDiffs(bodyChange, rightToLeft); break; case DELETE: acceptRefiningDiffs(bodyChange, rightToLeft); break; case CHANGE: changeElement(bodyChange, rightToLeft); break; case MOVE: moveElement(bodyChange, rightToLeft); break; default: break; } } }</code><technical_language>Replace "merged" "to merge"</technical_language>

Target:
protected void accept(Diff diff, boolean rightToLeft) { final Optional<OpaqueElementBodyChange> possibleBodyChange = getOpaqueElementBodyChange(diff); if (possibleBodyChange.isPresent()) { final OpaqueElementBodyChange bodyChange = getOpaqueElementBodyChange(diff).get(); if (LOGGER.isDebugEnabled()) { int refinedElementCount = bodyChange.getRefinedBy().size(); LOGGER.debug("accept(Diff, boolean) - " + refinedElementCount + " refined diffs to merge for diff " + diff.hashCode()); } switch (bodyChange.getKind()) { case ADD: acceptRefiningDiffs(bodyChange, rightToLeft); break; case DELETE: acceptRefiningDiffs(bodyChange, rightToLeft); break; case CHANGE: changeElement(bodyChange, rightToLeft); break; case MOVE: moveElement(bodyChange, rightToLeft); break; default: break; } } }
Source:
<code>public Set<ScheduledTime> getScheduledTimes(ScheduledTime start, ScheduledTime end) { DateTime startDT = start.getDateTime(); DateTime endDT = end.getDateTime(); DateTime hour; <START> if (isFullHour(startDT)) { <END> hour = startDT; } else { hour = startDT.plusHours(1).withMillisOfSecond(0).withSecondOfMinute(0).withMinuteOfHour(0); } Set<ScheduledTime> hours = new HashSet<ScheduledTime>(); while(hour.isBefore(endDT)) { hours.add(new ScheduledTime(hour)); hour = hour.plusHours(1); } return hours; }</code><technical_language>Hourly jobs run hour? is, configured start at, say, 15 minutes hour? a huge limitation, curious if of existing jobs need it, Oozie supports it</technical_language>

Target:
public SortedSet<ScheduledTime> getScheduledTimes(ScheduledTime start, ScheduledTime end) { DateTime startDT = start.getDateTime(); DateTime endDT = end.getDateTime(); DateTime hour; if (isFullHour(startDT)) { hour = startDT; } else { hour = startDT.plusHours(1).withMillisOfSecond(0).withSecondOfMinute(0).withMinuteOfHour(0); } SortedSet<ScheduledTime> hours = new TreeSet<ScheduledTime>(); while(hour.isBefore(endDT)) { hours.add(new ScheduledTime(hour)); hour = hour.plusHours(1); } return hours; }
Source:
<code>default Option<T> reduceRightOption(BiFunction<? super T, ? super T, ? extends T> op) { <START> return reduceLeftOption(op); <END> }</code><technical_language>return getOption();</technical_language>

Target:
default Option<T> reduceRightOption(BiFunction<? super T, ? super T, ? extends T> op) { Objects.requireNonNull(op, "op is null"); return getOption(); }
Source:
<code>public static AttestationValue getValueFromCache(String key){ AttestationValue value = attestationValues.get(key); <START> return value; <END> }</code><technical_language>return statement line: return attestationValues.get(key);</technical_language>

Target:
public AttestationValue getValueFromCache(String key) { return attestationValues.get(key); }
Source:
<code>public static MessageNumberSet[] createMessageNumberSets(@Nonnull final long[] msgs) { final List<MessageNumberSet> v = new ArrayList<MessageNumberSet>(); int i = 0; while (i < msgs.length) { long start = msgs[i]; int j = i + 1; while (j < msgs.length && msgs[j] == msgs[j - 1] + 1) { j++; } long end = msgs[j - 1]; v.add(new MessageNumberSet(start, end)); i = j; } <START> return v.toArray(new MessageNumberSet[0]); <END> }</code><technical_language>good</technical_language>

Target:
public static MessageNumberSet[] createMessageNumberSets(@Nonnull final long[] msgs) { final List<MessageNumberSet> v = new ArrayList<MessageNumberSet>(); int i = 0; while (i < msgs.length) { long start = msgs[i]; int j = i + 1; while (j < msgs.length && msgs[j] == msgs[j - 1] + 1) { j++; } long end = msgs[j - 1]; v.add(new MessageNumberSet(start, end)); i = j; } return v.toArray(new MessageNumberSet[v.size()]); }
Source:
<code>public boolean maybePunctuateStreamTime() { <START> final long timestamp = partitionGroup.streamTime(); <END> if (timestamp == RecordQueue.UNKNOWN) { return false; } else { final boolean punctuated = streamTimePunctuationQueue.mayPunctuate(timestamp, PunctuationType.STREAM_TIME, this); if (punctuated) { commitNeeded = true; } return punctuated; } }</code><technical_language>rename timestamp streamTime (or taskTime)</technical_language>

Target:
public boolean maybePunctuateStreamTime() { final long streamTime = partitionGroup.streamTime(); if (streamTime == RecordQueue.UNKNOWN) { return false; } else { final boolean punctuated = streamTimePunctuationQueue.mayPunctuate(streamTime, PunctuationType.STREAM_TIME, this); if (punctuated) { commitNeeded = true; } return punctuated; } }
Source:
<code>public T get() { <START> if ((value == null) && (supplier != null)) { <END> synchronized (this) { if (supplier != null) { value = supplier.get(); supplier = null; } } } return value; }</code><technical_language>Wonderful idea! I remarks: **1) supplier.get() return null** null-states: null undefined null initialized state. If is initialized null, get() calls slower in #1576. **2) reads main memory synchronized block** supplier is volatile, occurrences read main memory, in particular: - if (supplier != null) { ... } - = supplier.get(); solution solves 1) 2) fusing ideas of #1577 of #1576 additionally adding UNDEFINED object: java private static final Object UNDEFINED = new Object(); private transient volatile Supplier<? extends T> supplier; @SuppressWarnings("unchecked") private T = (T) UNDEFINED; public T get() { if (value == UNDEFINED && this.supplier != null) { synchronized(this) { final Supplier<? extends T> supplier = this.supplier; if (supplier != null) { = supplier.get(); this.supplier = null; } } } return value; } I ask if isEvaluated method this: java public boolean isEvaluated() { // fast read, memory synchronized volatile write of supplier return != UNDEFINED; } instead of java public boolean isEvaluated() { // slow read main memory return supplier == null; }</technical_language>

Target:
public T get() { return (supplier == null) ? value : computeValue(); }
Source:
<code>public static void setUpClass() throws Exception { service1 = ignite(); service1.port(1122); service1.init(); service1.awaitInitialization(); service2 = ignite(); <START> service2.port(70000); <END> service2.initExceptionHandler((e) -> errorMessage = "Custom init error"); service2.init(); service2.awaitInitialization(); }</code><technical_language>related change? I suppose a of testing fire instances though, I update test</technical_language>

Target:
public static void setUpClass() throws Exception { service = ignite(); service.port(NON_VALID_PORT); service.initExceptionHandler((e) -> errorMessage = "Custom init error"); service.init(); service.awaitInitialization(); }
Source:
<code>public static boolean isElementVisible(WebElement element, WebDriver webDriver) { webDriver.manage().timeouts().implicitlyWait(500, TimeUnit.MILLISECONDS); try { return element.isDisplayed(); <START> } catch (NoSuchElementException e) { <END> return false; } finally { webDriver.manage().timeouts().implicitlyWait(TIMEOUT, TimeUnit.SECONDS); } }</code><technical_language>catch StaleElementException</technical_language>

Target:
public static boolean isElementVisible(WebElement element, WebDriver webDriver) { webDriver.manage().timeouts().implicitlyWait(500, TimeUnit.MILLISECONDS); try { return element.isDisplayed(); } catch (NoSuchElementException | StaleElementReferenceException e) { return false; } finally { webDriver.manage().timeouts().implicitlyWait(TIMEOUT, TimeUnit.SECONDS); } }
Source:
<code>private void importPlugin(IPluginModelBase model, int importType, IProgressMonitor monitor) throws CoreException { try { <START> SubMonitor subMonitor = SubMonitor.convert(monitor, "", 5); END> IProject project = createProject(model, subMonitor.newChild(1)); if (project == null) { return; } if (Platform.inDevelopmentMode()) { File location = new File(model.getInstallLocation()); if (location.isDirectory()) { File classpathFile = new File(location, ".classpath"); File projectFile = new File(location, ".project"); if (classpathFile.exists() && classpathFile.isFile() && projectFile.exists() && projectFile.isFile()) { PluginImportHelper.importContent(location, project.getFullPath(), FileSystemStructureProvider.INSTANCE, null, subMonitor.newChild(4)); return; } } } Map<String, IPath> sourceMap = null; if (importType == IMPORT_BINARY || (importType == IMPORT_WITH_SOURCE && !canFindSource(model))) { sourceMap = importAsBinary(project, model, subMonitor.newChild(4)); } else if (importType == IMPORT_BINARY_WITH_LINKS) { sourceMap = importAsBinaryWithLinks(project, model, subMonitor.newChild(4)); } else if (importType == IMPORT_WITH_SOURCE) { importAsSource(project, model, subMonitor.newChild(4)); } setProjectNatures(project, model); if (project.hasNature(JavaCore.NATURE_ID) && project.findMember(".classpath") == null) fProjectClasspaths.put(project, ClasspathComputer.getClasspath(project, model, sourceMap, true, false)); } finally { monitor.done(); } }</code><technical_language>2-argument constructor</technical_language>

Target:
private void importPlugin(IPluginModelBase model, int importType, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 5); IProject project = createProject(model, subMonitor.newChild(1)); if (project == null) { return; } if (Platform.inDevelopmentMode()) { File location = new File(model.getInstallLocation()); if (location.isDirectory()) { File classpathFile = new File(location, ".classpath"); File projectFile = new File(location, ".project"); if (classpathFile.exists() && classpathFile.isFile() && projectFile.exists() && projectFile.isFile()) { PluginImportHelper.importContent(location, project.getFullPath(), FileSystemStructureProvider.INSTANCE, null, subMonitor.newChild(4)); return; } } } Map<String, IPath> sourceMap = null; if (importType == IMPORT_BINARY || (importType == IMPORT_WITH_SOURCE && !canFindSource(model))) { sourceMap = importAsBinary(project, model, subMonitor.newChild(4)); } else if (importType == IMPORT_BINARY_WITH_LINKS) { sourceMap = importAsBinaryWithLinks(project, model, subMonitor.newChild(4)); } else if (importType == IMPORT_WITH_SOURCE) { importAsSource(project, model, subMonitor.newChild(4)); } setProjectNatures(project, model); if (project.hasNature(JavaCore.NATURE_ID) && project.findMember(".classpath") == null) fProjectClasspaths.put(project, ClasspathComputer.getClasspath(project, model, sourceMap, true, false)); }