auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void rewriteImports(TextChangeManager changeManager, IProgressMonitor pm) throws CoreException { for (Entry<ICompilationUnit, ImportChange> entry : fImportChanges.entrySet()) { ICompilationUnit cu= entry.getKey(); ImportChange importChange= entry.getValue(); ImportRewrite importRewrite= StubUtility.createImportRewrite(cu, true); importRewrite.setFilterImplicitImports(false); for (String <START> string : <END> importChange.fStaticToRemove) { importRewrite.removeStaticImport(string); } for (String string : importChange.fToRemove) { importRewrite.removeImport(string); } for (String[] toAdd : importChange.fStaticToAdd) { importRewrite.addStaticImport(toAdd[0], toAdd[1], true); } for (String string : importChange.fToAdd) { importRewrite.addImport(string); } if (importRewrite.hasRecordedChanges()) { TextEdit importEdit= importRewrite.rewriteImports(pm); String name= RefactoringCoreMessages.RenamePackageRefactoring_update_imports; try { TextChangeCompatibility.addTextEdit(changeManager.get(cu), name, importEdit); } catch (MalformedTreeException e) { JavaPlugin.logErrorMessage("MalformedTreeException while processing cu " + cu); throw e; } } } }</code><technical_language>rename toRemove</technical_language>

Target:
public void rewriteImports(TextChangeManager changeManager, IProgressMonitor pm) throws CoreException { for (Entry<ICompilationUnit, ImportChange> entry : fImportChanges.entrySet()) { ICompilationUnit cu= entry.getKey(); ImportChange importChange= entry.getValue(); ImportRewrite importRewrite= StubUtility.createImportRewrite(cu, true); importRewrite.setFilterImplicitImports(false); for (String toRemove : importChange.fStaticToRemove) { importRewrite.removeStaticImport(toRemove); } for (String toRemove : importChange.fToRemove) { importRewrite.removeImport(toRemove); } for (String[] toAdd : importChange.fStaticToAdd) { importRewrite.addStaticImport(toAdd[0], toAdd[1], true); } for (String toAdd : importChange.fToAdd) { importRewrite.addImport(toAdd); } if (importRewrite.hasRecordedChanges()) { TextEdit importEdit= importRewrite.rewriteImports(pm); String name= RefactoringCoreMessages.RenamePackageRefactoring_update_imports; try { TextChangeCompatibility.addTextEdit(changeManager.get(cu), name, importEdit); } catch (MalformedTreeException e) { JavaPlugin.logErrorMessage("MalformedTreeException while processing cu " + cu); throw e; } } } }
Source:
<code>protected byte[] findBasesByMD5(String md5) throws MalformedURLException, IOException { <START> String url = String.format("<LINK_0>", md5); <END> for (int i = 0; i < downloadTriesBeforeFailing; i++) { InputStream is = new URL(url).openStream(); if (is == null) return null; log.info("Downloading reference sequence: " + url); byte[] data = ByteBufferUtils.readFully(is); log.info("Downloaded " + data.length + " bytes for md5 " + md5); is.close(); try { String downloadedMD5 = Utils.calculateMD5String(data); if (md5.equals(downloadedMD5)) { return data; } else { String message = String .format("Downloaded sequence is corrupt: requested md5=%s, received md5=%s", md5, downloadedMD5); log.error(message); } } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } throw new RuntimeException("Giving up on downloading sequence for md5 " + md5); }</code><technical_language>point_up: this references ebi? Put in Defaults.java</technical_language>

Target:
protected byte[] findBasesByMD5(String md5) throws MalformedURLException, IOException { String url = String.format(Defaults.EBI_REFERENCE_SEVICE_URL_MASK, md5); for (int i = 0; i < downloadTriesBeforeFailing; i++) { InputStream is = new URL(url).openStream(); if (is == null) return null; log.debug("Downloading reference sequence: " + url); byte[] data = ByteBufferUtils.readFully(is); log.debug("Downloaded " + data.length + " bytes for md5 " + md5); is.close(); try { String downloadedMD5 = SequenceUtil.calculateMD5String(data); if (md5.equals(downloadedMD5)) { return data; } else { String message = String .format("Downloaded sequence is corrupt: requested md5=%s, received md5=%s", md5, downloadedMD5); log.error(message); } } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } throw new RuntimeException("Giving up on downloading sequence for md5 " + md5); }
Source:
<code>public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, DSpaceRestPermission permission) { DSpaceRestPermission restPermission = DSpaceRestPermission.convert(permission); if (!DSpaceRestPermission.READ.equals(restPermission) || !StringUtils.equalsIgnoreCase(targetType, AuthorizationRest.NAME)) { return false; } Request request = requestService.getCurrentRequest(); Context context = ContextUtil.obtainContext(request.getServletRequest()); try { if (authorizeService.isAdmin(context)) { return true; } EPerson ePerson = authorizationRestUtil.getEperson(context, targetId.toString()); EPerson currUser = null; <START> currUser = ePersonService.findByEmail(context, (String) authentication.getPrincipal()); <END> if (ePerson == null) { return true; } else { if (currUser != null && currUser.getID().equals(ePerson.getID())) { return true; } } } catch (SQLException e) { log.error(e.getMessage(), e); } return false; }</code><technical_language>is this based context.getCurrentUser()</technical_language>

Target:
public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, DSpaceRestPermission permission) { DSpaceRestPermission restPermission = DSpaceRestPermission.convert(permission); if (!DSpaceRestPermission.READ.equals(restPermission) || !StringUtils.equalsIgnoreCase(targetType, AuthorizationRest.NAME)) { return false; } Request request = requestService.getCurrentRequest(); Context context = ContextUtil.obtainContext(request.getServletRequest()); try { if (authorizeService.isAdmin(context)) { return true; } EPerson ePerson = authorizationRestUtil.getEperson(context, targetId.toString()); EPerson currUser = context.getCurrentUser(); if (ePerson == null) { return true; } else { if (currUser != null && currUser.getID().equals(ePerson.getID())) { return true; } } } catch (SQLException e) { log.error(e.getMessage(), e); } return false; }
Source:
<code>private ConfigurationImpl() { this.validationBootstrapParameters = new ValidationBootstrapParameters(); <START> this.validationBootstrapParameters.addValidatedValueHandler( new JavaFXPropertyValueUnwrapper() ); <END> if (Version.getJavaRelease() >= 8) { this.validationBootstrapParameters.addValidatedValueHandler( new OptionalValueUnwrapper() ); } this.defaultResourceBundleLocator = new PlatformResourceBundleLocator( ResourceBundleMessageInterpolator.USER_VALIDATION_MESSAGES ); this.defaultTraversableResolver = new DefaultTraversableResolver(); this.defaultConstraintValidatorFactory = new ConstraintValidatorFactoryImpl(); this.defaultParameterNameProvider = new DefaultParameterNameProvider(); this.defaultMessageInterpolator = new ResourceBundleMessageInterpolator( defaultResourceBundleLocator ); }</code><technical_language>I sense register this unwrapper if JavaFX is present. HV currently runs Java 6 later, 6 (and earlier releases of 7) JavaFX is present default</technical_language>

Target:
private ConfigurationImpl() { this.validationBootstrapParameters = new ValidationBootstrapParameters(); if (isJavaFxInClasspath()) { this.validationBootstrapParameters.addValidatedValueHandler( new JavaFXPropertyValueUnwrapper() ); } if (Version.getJavaRelease() >= 8) { this.validationBootstrapParameters.addValidatedValueHandler( new OptionalValueUnwrapper() ); } this.defaultResourceBundleLocator = new PlatformResourceBundleLocator( ResourceBundleMessageInterpolator.USER_VALIDATION_MESSAGES ); this.defaultTraversableResolver = new DefaultTraversableResolver(); this.defaultConstraintValidatorFactory = new ConstraintValidatorFactoryImpl(); this.defaultParameterNameProvider = new DefaultParameterNameProvider(); this.defaultMessageInterpolator = new ResourceBundleMessageInterpolator( defaultResourceBundleLocator ); }
Source:
<code>private void runInternal() { <START> for (Map.Entry<String, ClockService> entry : monitors.entrySet()) { <END> String server = entry.getKey(); ClockService monitor = entry.getValue(); long localTimeAtStart = System.nanoTime(); long remoteSystemTime = monitor.getSystemTimeInNanos(); long localTimeAtEnd = System.nanoTime(); RequestTime previousRequest = previousRequests.get(server); RequestTime newRequest = new RequestTime(localTimeAtStart, localTimeAtEnd, remoteSystemTime); compareClockSkew(server, newRequest, previousRequest); } }</code><technical_language>nit: monitors.forEach((server, monitor) -> { ... })</technical_language>

Target:
private void runInternal() { monitorByServer.forEach((server, remoteClockService) -> { long localTimeAtStart = localClockService.getSystemTimeInNanos(); long remoteSystemTime = remoteClockService.getSystemTimeInNanos(); long localTimeAtEnd = localClockService.getSystemTimeInNanos(); RequestTime previousRequest = previousRequestsByServer.get(server); RequestTime newRequest = new RequestTime(localTimeAtStart, localTimeAtEnd, remoteSystemTime); if (!previousRequest.equals(RequestTime.EMPTY)) { new ClockSkewComparer(server, events, previousRequest, newRequest).compare(); } previousRequestsByServer.put(server, newRequest); }); }
Source:
<code>protected Warning createWarning(final Matcher matcher) { String fileName = "*.xdm"; int lineNumber = 0; String type = matcher.group(1); String category = matcher.group(2); String message = matcher.group(4); Priority priority; if (type.equals("ERROR")) { priority = Priority.HIGH; } if (type.equals("INFO")) { priority = Priority.NORMAL; for (int index = 0; index < TRESOS_INFO_MSGS_IGNORE.length; index++) { <START> if (category.equals(TRESOS_INFO_MSGS_IGNORE[index])) { <END> priority = Priority.LOW; message = "really unimportant tresos message"; fileName = "unimportant.file"; lineNumber = 1; break; } } } else { priority = Priority.HIGH; } Warning warning = createWarning(fileName, lineNumber, category, message, priority); return warning; }</code><technical_language>is safer constant left of equals</technical_language>

Target:
protected Warning createWarning(final Matcher matcher) { String fileName = "*.xdm"; int lineNumber = 0; String type = matcher.group(1); String category = matcher.group(2); String message = matcher.group(4); Priority priority; if (type.equals("ERROR")) { priority = Priority.HIGH; } if (type.equals("INFO")) { priority = Priority.NORMAL; for (String tresosMsgCategory : TRESOS_INFO_MSGS_IGNORE) { if (tresosMsgCategory.equals(category)) { priority = Priority.LOW; message = "really unimportant tresos message"; fileName = "unimportant.file"; lineNumber = 1; break; } } } else { priority = Priority.HIGH; } return createWarning(fileName, lineNumber, category, message, priority); }
Source:
<code><START> public void testGetSSPMetadataShouldTerminateAfterFiniteRetriesOnException() throws Exception{ <END> SystemStreamPartition oneSSP = new SystemStreamPartition(TEST_SYSTEM, VALID_TOPIC, new Partition(0)); SystemStreamPartition otherSSP = new SystemStreamPartition(TEST_SYSTEM, "otherTopic", new Partition(1)); ImmutableSet<SystemStreamPartition> ssps = ImmutableSet.of(oneSSP, otherSSP); List<TopicPartition> topicPartitions = ssps.stream() .map(ssp -> new TopicPartition(ssp.getStream(), ssp.getPartition().getPartitionId())) .collect(Collectors.toList()); when(mockKafkaConsumer.beginningOffsets(topicPartitions)).thenThrow(new RuntimeException()) .thenThrow(new RuntimeException()) .thenThrow(new RuntimeException()) .thenThrow(new RuntimeException()) .thenThrow(new RuntimeException()); kafkaSystemAdmin.getSSPMetadata(ssps); }</code><technical_language>reason I suggested retry method package private write tests is override policy for tests. current setup, this test is ~ 16 seconds regardless. builds impacted due tests, suggest override defaults smaller multipliers values for tests</technical_language>

Target:
public void testGetSSPMetadataShouldTerminateAfterFiniteRetriesOnException() throws Exception{ SystemStreamPartition oneSSP = new SystemStreamPartition(TEST_SYSTEM, VALID_TOPIC, new Partition(0)); SystemStreamPartition otherSSP = new SystemStreamPartition(TEST_SYSTEM, "otherTopic", new Partition(1)); ImmutableSet<SystemStreamPartition> ssps = ImmutableSet.of(oneSSP, otherSSP); List<TopicPartition> topicPartitions = ssps.stream() .map(ssp -> new TopicPartition(ssp.getStream(), ssp.getPartition().getPartitionId())) .collect(Collectors.toList()); when(mockKafkaConsumer.beginningOffsets(topicPartitions)).thenThrow(new RuntimeException()) .thenThrow(new RuntimeException()); kafkaSystemAdmin.getSSPMetadata(ssps, new ExponentialSleepStrategy(2, 1, 1)); }
Source:
<code>private ElasticSearchIndexerProcessor(final LogIndexer<LoggingProtos.BatchLogMessage> senseLogElasticSearchIndexer){ this.senseLogElasticSearchIndexer = senseLogElasticSearchIndexer; <START> this.senseLogs= Metrics.defaultRegistry().newMeter(LogIndexerProcessor.class, "sense-logs", "sense-processed", TimeUnit.SECONDS); <END> }</code><technical_language>add a es- prefix values change LogIndexerProcessor.class ElasticSearchIndexerProcessor.class</technical_language>

Target:
private ElasticSearchIndexerProcessor(final LogIndexer<LoggingProtos.BatchLogMessage> senseLogElasticSearchIndexer){ this.senseLogElasticSearchIndexer = senseLogElasticSearchIndexer; this.senseLogs= Metrics.defaultRegistry().newMeter(ElasticSearchIndexerProcessor.class, "es-sense-logs", "es-sense-processed", TimeUnit.SECONDS); }
Source:
<code>private void notifyClick(final Point p) { notify(SWT.MouseEnter); notify(SWT.Activate); notify(SWT.FocusIn); <START> notify(SWT.Selection); <END> notify(SWT.MouseDown, createMouseEvent(p.x, p.y, 1, SWT.NONE, 1)); notify(SWT.MouseUp, createMouseEvent(p.x, p.y, 1, SWT.BUTTON1, 1)); }</code><technical_language>I a SWT.Selection event I click, if a non-empty selection before, clicking clears selection</technical_language>

Target:
private void notifyClick(final Point p) { notify(SWT.MouseEnter); notify(SWT.Activate); notify(SWT.FocusIn); notify(SWT.MouseDown, createMouseEvent(p.x, p.y, 1, SWT.NONE, 1)); notify(SWT.MouseUp, createMouseEvent(p.x, p.y, 1, SWT.BUTTON1, 1)); }
Source:
<code>private long getRetryPeriodMs() { <START> return Math.round(_retryPeriodMs * RandomUtils.nextDouble(0.6, 1.4)) + 1; <END> }</code><technical_language>If do this, retryPeriodMs exceed retryTimeoutMs? Is ok</technical_language>

Target:
private long getRetryPeriodMs() { return Math.min(Math.round(_retryPeriodMs * RandomUtils.nextDouble(0.6, 1.4)) + 1, _retryTimeoutMs); }
Source:
<code>public NavigationService createService(EMFFormsViewContext emfFormsViewContext) { if (ViewModelContext.class.isInstance(emfFormsViewContext)) { <START> final DefaultNavigationService drs = new DefaultNavigationService(); <END> drs.instantiate(ViewModelContext.class.cast(emfFormsViewContext)); return drs; } throw new IllegalStateException("The provided context is not a ViewModelContext."); }</code><technical_language>drs dns ;-) other name, drs fit</technical_language>

Target:
public NavigationService createService(EMFFormsViewContext emfFormsViewContext) { if (ViewModelContext.class.isInstance(emfFormsViewContext)) { final DefaultNavigationService dns = new DefaultNavigationService(); dns.instantiate(ViewModelContext.class.cast(emfFormsViewContext)); return dns; } throw new IllegalStateException("The provided context is not a ViewModelContext."); }
Source:
<code>public ListenableFuture<GuidePostsInfo> reload( final GuidePostsKey key, GuidePostsInfo prevGuidepostInfo) { <START> ListenableFutureTask<GuidePostsInfo> task = <END> ListenableFutureTask.create( new Callable<GuidePostsInfo>() { public GuidePostsInfo call() { try { return statsLoader.loadStats(key, prevGuidepostInfo); } catch (Exception e) { logger.warn("Unable to load stats from table: " + key.toString(), e); return prevGuidepostInfo; } } } ); executor.execute(task); return task; }</code><technical_language>currently StatsLoaderImpl#needsLoad() is hardcoded true, called first</technical_language>

Target:
public ListenableFuture<GuidePostsInfo> reload( final GuidePostsKey key, GuidePostsInfo prevGuidepostInfo) { if (statsLoader.needsLoad()) { ListenableFutureTask<GuidePostsInfo> task = ListenableFutureTask.create(new Callable<GuidePostsInfo>() { public GuidePostsInfo call() { try { return statsLoader.loadStats(key, prevGuidepostInfo); } catch (Exception e) { logger.warn("Unable to load stats from table: " + key.toString(), e); return prevGuidepostInfo; } } }); executor.execute(task); return task; } else { return Futures.immediateFuture(prevGuidepostInfo); } }
Source:
<code>public static void first() throws Exception { String candybeanConfigStr = System.getProperty("candybean_config"); <START> if (candybeanConfigStr == null) candybeanConfigStr = AbstractTest.CONFIG_DIR.getCanonicalPath() + File.separator + "candybean.config"; <END> System.out.println("candybeanConfigPath: " + candybeanConfigStr); Configuration candybeanConfig = new Configuration(new File(Utils.adjustPath(candybeanConfigStr))); candybean = Candybean.getInstance(candybeanConfig); iface = candybean.getInterface(); iface.start(); }</code><technical_language>reason named CB short statically referenced. But, -- biggie..</technical_language>

Target:
public static void first() throws Exception { String candybeanConfigStr = System.getProperty("candybean_config"); if (candybeanConfigStr == null) candybeanConfigStr = Candybean.CONFIG_DIR.getCanonicalPath() + File.separator + "candybean.config"; System.out.println("candybeanConfigPath: " + candybeanConfigStr); Configuration candybeanConfig = new Configuration(new File(Utils.adjustPath(candybeanConfigStr))); candybean = Candybean.getInstance(candybeanConfig); iface = candybean.getInterface(); iface.start(); }
Source:
<code>public void end() throws Exception { <START> super.init(); <END> super.cleanup(); }</code><technical_language>Is this necessary</technical_language>

Target:
public void end() throws Exception { super.cleanup(); }
Source:
<code><START> public static final void setUp(final Map<String, String>... propertyMaps) { <END> Properties properties = new Properties(); for (Map<String, String> map: propertyMaps) { for (Map.Entry<String, String> entry : map.entrySet()) { properties.setProperty(entry.getKey(), entry.getValue()); } } ConfigurationHolder.initFromProperties(properties); }</code><technical_language>Please change static. is a bad design decision. Static classes methods complicate tests</technical_language>

Target:
public final void setUp(final Map<String, String>... propertyMaps) { Properties properties = new Properties(); for (Map<String, String> map: propertyMaps) { for (Map.Entry<String, String> entry : map.entrySet()) { properties.setProperty(entry.getKey(), entry.getValue()); } } ConfigurationHolder.initFromProperties(properties); }
Source:
<code><START> public void testRemoveValueEqualStoreEntryCacheAccessExceptionUnequalCacheWriterEntry() throws Exception { <END> final MockStore realStore = new MockStore(Collections.singletonMap("key", "value")); this.store = spy(realStore); doThrow(new CacheAccessException("")).when(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); final MockCacheWriter realCache = new MockCacheWriter(Collections.singletonMap("key", "unequalValue")); this.cacheWriter = spy(realCache); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); assertFalse(ehcache.remove("key", "value")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verify(this.spiedResilienceStrategy) .removeFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(false)); assertThat(realCache.getEntries().get("key"), is(equalTo("unequalValue"))); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }</code><technical_language>initial state of this test represents out of sync cache-through setup. want try sense of behaviour a broken initial setup</technical_language>

Target:
public void testRemoveValueEqualStoreEntryCacheAccessExceptionUnequalCacheWriterEntry() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.singletonMap("key", "value")); this.store = spy(fakeStore); doThrow(new CacheAccessException("")).when(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); final FakeCacheWriter fakeWriter = new FakeCacheWriter(Collections.singletonMap("key", "unequalValue")); this.cacheWriter = spy(fakeWriter); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); ehcache.remove("key", "value"); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verify(this.spiedResilienceStrategy) .removeFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(false)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }
Source:
<code><START> public void testAmazonUndergroundInstallSourceIsParsedCorrectly() { <END> final InstallSource installSource = InstallSource.fromInstallerPackageName("com.amazon.mshop.android"); assertTrue(installSource instanceof AmazonUndergroundInstallSource); assertEquals("Amazon Underground", installSource.toString()); }</code><technical_language><b>Reporter: </b>PMD<br /><b>Violation: </b><a target="_blank" href="<LINK_0>">JUnitTestContainsTooManyAsserts</a><br /><b>Notes: </b>JUnit tests more 1 assert(s)</technical_language>

Target:
public void testAmazonUndergroundInstallSourceIsParsedCorrectly() { final InstallSource installSource = InstallSource.fromInstallerPackageName("com.amazon.mshop.android"); assertTrue( "Package name is correctly identified as belonging to Amazon Underground", installSource instanceof AmazonUndergroundInstallSource); assertEquals( "Amazon Underground install source has correct description", "Amazon Underground", installSource.toString()); }
Source:
<code>public void tearDown() { executorService.shutdown(); try { executorService.awaitTermination(1, TimeUnit.SECONDS); } catch (InterruptedException ex) { <START> throw new RuntimeException(ex); <END> } }</code><technical_language>InterruptedException handled this eats interrupted flag. for other catch InterruptedException's in code handle properly</technical_language>

Target:
public void tearDown() throws InterruptedException { executorService.shutdownNow(); if (!executorService.awaitTermination(1, TimeUnit.MILLISECONDS)) { logger.warn("Thread pool didn't terminate within the timeout."); } }
Source:
<code>public void testSuccessfulStartTransport() { try { CustomCarbonTransport carbonTransport = new CustomCarbonTransport("dummyTransport"); transportManager.registerTransport(carbonTransport); transportManager.startTransport("dummyTransport"); <START> } catch (IllegalArgumentException e) { <END> Assert.assertTrue(false); } Assert.assertTrue(true); }</code><technical_language>throw this error, handled test runtime</technical_language>

Target:
public void testSuccessfulStartTransport() { CustomCarbonTransport carbonTransport = new CustomCarbonTransport("dummyTransport"); transportManager.registerTransport(carbonTransport); transportManager.startTransport("dummyTransport"); }
Source:
<code>public void buildInsertOptionsMutate() { InsertOptions insertOptions = InsertOptions.builder() .ttl(10) .timestamp(1519222753) .withIfNotExists() .build(); InsertOptions mutated = insertOptions.mutate().ttl(Duration.ofSeconds(5)).timestamp(1519200753).build(); assertThat(mutated).isNotNull(); assertThat(mutated).isNotSameAs(insertOptions); assertThat(mutated.getTtl()).isEqualTo(Duration.ofSeconds(5)); <START> assertThat(mutated.getTimestamp() == 1519200753); <END> assertThat(mutated.isIfNotExists()).isTrue(); }</code><technical_language>assertThat(mutated.getTimestamp()).isEqualTo(1519200753)</technical_language>

Target:
public void buildInsertOptionsMutate() { InsertOptions insertOptions = InsertOptions.builder() .ttl(10) .timestamp(1519222753) .withIfNotExists() .build(); InsertOptions mutated = insertOptions.mutate().ttl(Duration.ofSeconds(5)).timestamp(1519200753).build(); assertThat(mutated).isNotNull(); assertThat(mutated).isNotSameAs(insertOptions); assertThat(mutated.getTtl()).isEqualTo(Duration.ofSeconds(5)); assertThat(mutated.getTimestamp()).isEqualTo(1519200753); assertThat(mutated.isIfNotExists()).isTrue(); }
Source:
<code>public List<Service> getAssignedServices(PerunSession sess, Facility facility) throws InternalErrorException, FacilityNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); getFacilitiesManagerBl().checkFacilityExists(sess, facility); <START> if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, facility) <END> && !AuthzResolver.isAuthorized(sess, Role.VOOBSERVER, facility) && !AuthzResolver.isAuthorized(sess, Role.ENGINE) && !AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility) ) { throw new PrivilegeException(sess, "getAssignedServices"); } return getFacilitiesManagerBl().getAssignedServices(sess, facility); }</code><technical_language>I think, VOADMIN VOOBSERVER able this. For Resource ok, manage Resource, facility settings belong facility manager</technical_language>

Target:
public List<Service> getAssignedServices(PerunSession sess, Facility facility) throws InternalErrorException, FacilityNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); getFacilitiesManagerBl().checkFacilityExists(sess, facility); if (!AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { throw new PrivilegeException(sess, "getAssignedServices"); } return getFacilitiesManagerBl().getAssignedServices(sess, facility); }
Source:
<code>protected boolean canDoAction() { if (getSnapshot() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_SNAPSHOT_DOES_NOT_EXIST); return false; } vmFromConfiguration = getVmFromConfiguration(); if (vmFromConfiguration == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_SNAPSHOT_HAS_NO_CONFIGURATION); <START> addCanDoActionMessage(String.format("VmName %1$s", getVmName())); <END> addCanDoActionMessage(String.format("SnapshotName %1$s", getSnapshotName())); return false; } if (!super.canDoAction()) { return false; } if (!canLockSnapshot()) { return false; } return true; }</code><technical_language>I correct format is $Var, ie: $VmName</technical_language>

Target:
protected boolean canDoAction() { if (getSnapshot() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_SNAPSHOT_DOES_NOT_EXIST); return false; } vmFromConfiguration = getVmFromConfiguration(); if (vmFromConfiguration == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_SNAPSHOT_HAS_NO_CONFIGURATION); addCanDoActionMessage(String.format("$VmName %1$s", getVmName())); addCanDoActionMessage(String.format("$SnapshotName %1$s", getSnapshotName())); return false; } if (!super.canDoAction()) { return false; } if (!canLockSnapshot()) { return false; } return true; }
Source:
<code>private ArrayNode buildJsonArray(Object[] elements) throws SQLException { ArrayNode arrayNode = jsonNodeFactory.arrayNode(); for (Object v : elements) { if (v == null) { arrayNode.add(NullNode.getInstance()); continue; } if (v.getClass().isArray()) { arrayNode.add(buildJsonArray((Object[]) v)); } else { switch (value.getBaseType()) { case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: case Types.BIGINT: arrayNode.add(jsonNodeFactory.numberNode(((Number) v).longValue())); break; case Types.FLOAT: case Types.REAL: case Types.DOUBLE: arrayNode.add(jsonNodeFactory.numberNode(((Number) v).doubleValue())); break; case Types.BOOLEAN: case Types.BIT: arrayNode.add(jsonNodeFactory.booleanNode((Boolean) v)); break; case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.CLOB: case Types.NCHAR: case Types.NVARCHAR: case Types.LONGNVARCHAR: arrayNode.add(jsonNodeFactory.textNode((String) v)); break; default: arrayNode.add(jsonNodeFactory.textNode(v.toString())); } } } <START> return arrayNode; <END> }</code><technical_language>ArrayColumnGetter support array of decimal type. This change supports decimal array, decimal values converted string values "[""1.0"",""2.0"",""3.0""]". fix problem</technical_language>

Target:
private ArrayNode buildJsonArray(Object[] elements) throws SQLException { ArrayNode arrayNode = jsonNodeFactory.arrayNode(); for (Object v : elements) { if (v == null) { arrayNode.add(NullNode.getInstance()); continue; } if (v.getClass().isArray()) { arrayNode.add(buildJsonArray((Object[]) v)); } else { switch (value.getBaseType()) { case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: case Types.BIGINT: arrayNode.add(jsonNodeFactory.numberNode(((Number) v).longValue())); break; case Types.FLOAT: case Types.REAL: case Types.DOUBLE: arrayNode.add(jsonNodeFactory.numberNode(((Number) v).doubleValue())); break; case Types.BOOLEAN: case Types.BIT: arrayNode.add(jsonNodeFactory.booleanNode((Boolean) v)); break; case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.CLOB: case Types.NCHAR: case Types.NVARCHAR: case Types.LONGNVARCHAR: arrayNode.add(jsonNodeFactory.textNode((String) v)); break; case Types.DECIMAL: case Types.NUMERIC: arrayNode.add(jsonNodeFactory.numberNode((BigDecimal) v)); break; default: arrayNode.add(jsonNodeFactory.textNode(v.toString())); } } } return arrayNode; }
Source:
<code>public int getNumUserSessions(DbUser user) { Iterator<Entry<String, SessionInfo>> iter = sessionInfoMap.entrySet().iterator(); int numSessions = 0; <START> while (iter.hasNext()) { Entry<String, SessionInfo> entry = iter.next(); ConcurrentMap<String, Object> sessionMap = entry.getValue().contentOfSession; DbUser sessionUser = (DbUser) sessionMap.get(USER_PARAMETER_NAME); if (user.getId().equals(sessionUser.getId())) { numSessions += 1; } } <END> return numSessions; }</code><technical_language>Please sessions is valid getSessionValid(sessionId, false) sessions valid user logged out cleaned yet</technical_language>

Target:
public long getNumUserSessions(DbUser user) { return sessionInfoMap.entrySet().stream().filter ( map->((DbUser)map.getValue().contentOfSession .get(USER_PARAMETER_NAME)).getId().equals(user.getId()) && getSessionValid((String)map.getValue().contentOfSession.get(ENGINE_SESSION_ID), false) ).count(); }
Source:
<code>private FSDataInputStream openWithRetryFsInputStream(Path filePath) { FSDataInputStream in = null; try { in = fs.open(filePath); } catch (IOException e) { try { this.connect(); <START> fs.open(filePath); <END> } catch (IOException ex) { throw new RuntimeException(ex); } } return in; }</code><technical_language>in = fs.open(filePath)</technical_language>

Target:
private FSDataInputStream openWithRetryFsInputStream(Path filePath) { FSDataInputStream in; try { in = fs.open(filePath); } catch (IOException e) { try { this.connect(); in = fs.open(filePath); } catch (IOException ex) { throw new RuntimeException(ex); } } return in; }
Source:
<code>static <T> Stream<T> gen(T head, Supplier<Stream<T>> tailSupplier) { Objects.requireNonNull(tailSupplier, "tailSupplier is null"); <START> return new Stream.Cons<>(head, () -> tailSupplier.get()); <END> }</code><technical_language>minor - this simplified java return new Stream.Cons<>(head, tailSupplier);</technical_language>

Target:
static <T> Stream<T> gen(T head, Supplier<Stream<T>> tailSupplier) { Objects.requireNonNull(tailSupplier, "tailSupplier is null"); return new Stream.Cons<>(head, tailSupplier); }
Source:
<code>private void checkForChanges() { final WatchKey key = folderWatcher.poll(); if (key != null) { for (WatchEvent<?> watchEvent : key.pollEvents()) { final Path filePath = (Path) watchEvent.context(); final WatchEvent.Kind<?> kind = watchEvent.kind(); log.fine(kind + " : " + filePath); handleFileChange(kind, new File(selendroidConfiguration.getAppFolderToMonitor(), filePath.getFileName().toString())); } boolean valid = key.reset(); if (!valid) { <START> log.warning("Can't monitor folder anymore; has it been deleted?"); <END> stop(); } } }</code><technical_language>Grammar. separate sentences. Personally, I change "Can't" "Can not" "Cannot"</technical_language>

Target:
private void checkForChanges() { final WatchKey key = folderWatcher.poll(); if (key != null) { for (WatchEvent<?> watchEvent : key.pollEvents()) { final Path filePath = (Path) watchEvent.context(); final WatchEvent.Kind<?> kind = watchEvent.kind(); log.fine(kind + " : " + filePath); handleFileChange(kind, new File(selendroidConfiguration.getAppFolderToMonitor(), filePath.getFileName().toString())); } boolean valid = key.reset(); if (!valid) { log.warning("Cannot monitor this folder anymore. Has it been deleted?"); stop(); } } }
Source:
<code>public MessageAttribute asMessageAttribute(ChangeMessage message) { MessageAttribute a = new MessageAttribute(); a.timestamp = message.getWrittenOn().getTime(); <START> a.author = accountCache.get(message.getAuthor()).getAccount().getFullName(); <END> a.message = message.getMessage(); return a; }</code><technical_language>users dealt line 239. I additionally prints email. Some users FullName, helps disambiguate</technical_language>

Target:
public MessageAttribute asMessageAttribute(ChangeMessage message) { MessageAttribute a = new MessageAttribute(); a.timestamp = message.getWrittenOn().getTime(); a.author = asAccountAttribute(message.getAuthor()); a.message = message.getMessage(); return a; }
Source:
<code>public void drawBackgroundPreWidgets(float f, int x, int y) { <START> drawTexturedModalRect(guiLeft + 75, guiTop + 58 - (fluidicCompressor.fill ? 39 : 0), 195, 99 - (fluidicCompressor.fill ? 16 : 0), 25, 9); <END> drawTexturedModalRect(guiLeft + 89, guiTop + 53, 176, 3, fluidicCompressor.getProgress(), 4); }</code><technical_language>widget draw this</technical_language>

Target:
public void drawBackgroundPreWidgets(float f, int x, int y) { drawTexturedModalRect(guiLeft + 75, guiTop + 58 - (fluidicCompressor.fill ? 39 : 0), 176, 78 - (fluidicCompressor.fill ? 9 : 0), 25, 9); drawTexturedModalRect(guiLeft + 89, guiTop + 53, 176, 3, fluidicCompressor.getProgress(), 4); }
Source:
<code>public Stream<CacheEntry<K, V>> buildStream(Set<Integer> segmentsToFilter, Set<?> keysToFilter) { Stream<CacheEntry<K, V>> stream; if (keysToFilter != null) { AdvancedCache<K, V> advancedCache = cache.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL); log.tracef("Applying key filtering %s", keysToFilter); stream = keysToFilter.stream().map(advancedCache::getCacheEntry).filter(e -> e != null); } else { stream = supplier.get(); } if (segmentsToFilter != null && hash != null) { log.tracef("Applying segment filter %s", segmentsToFilter); <START> BitSet bitSet = new BitSet(hash.getNumSegments()); <END> segmentsToFilter.forEach(bitSet::set); stream = stream.filter(k -> bitSet.get(hash.getSegment(k.getKey()))); } return stream; }</code><technical_language>BitSet a good idea. I worth changing StreamSupplier.buildStream a BitSet for segmentsToFilter. add a check for log.isTraceEnabled() avoid toString()</technical_language>

Target:
public Stream<CacheEntry<K, V>> buildStream(Set<Integer> segmentsToFilter, Set<?> keysToFilter) { Stream<CacheEntry<K, V>> stream; if (keysToFilter != null) { AdvancedCache<K, V> advancedCache = cache.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL); if (trace) { log.tracef("Applying key filtering %s", keysToFilter); } stream = keysToFilter.stream().map(advancedCache::getCacheEntry).filter(e -> e != null); } else { stream = supplier.get(); } if (segmentsToFilter != null && hash != null) { if (trace) { log.tracef("Applying segment filter %s", segmentsToFilter); } BitSet bitSet = new BitSet(hash.getNumSegments()); segmentsToFilter.forEach(bitSet::set); stream = stream.filter(k -> bitSet.get(hash.getSegment(k.getKey()))); } return stream; }
Source:
<code>private void testFileChecksum( GcsFileChecksumType checksumType, Function<String, byte[]> checksumFn) throws Exception { Configuration config = getConfigurationWtihImplementation(); config.set("fs.gs.checksum.type", checksumType.name()); GoogleHadoopFileSystem myGhfs = new GoogleHadoopFileSystem(); myGhfs.initialize(ghfs.getUri(), config); URI fileUri = GoogleCloudStorageFileSystemIntegrationTest.getTempFilePath(); Path filePath = ghfsHelper.castAsHadoopPath(fileUri); String fileContent = "foo-testFileChecksum-" + checksumType; ghfsHelper.writeFile(filePath, fileContent, 1, true); FileChecksum fileChecksum = myGhfs.getFileChecksum(filePath); assertThat(fileChecksum.getAlgorithmName()).isEqualTo(checksumType.getAlgorithmName()); assertThat(fileChecksum.getLength()).isEqualTo(checksumType.getByteLength()); assertThat(fileChecksum.getBytes()).isEqualTo(checksumFn.apply(fileContent)); <START> assertThat(fileChecksum.toString()).containsMatch(String.format("%s: *",checksumType.getAlgorithmName())); <END> assertThat(ghfs.delete(filePath, true)).isTrue(); }</code><technical_language>replace .contains(checksumType.getAlgorithmName()) confusing</technical_language>

Target:
private void testFileChecksum( GcsFileChecksumType checksumType, Function<String, byte[]> checksumFn) throws Exception { Configuration config = getConfigurationWtihImplementation(); config.set("fs.gs.checksum.type", checksumType.name()); GoogleHadoopFileSystem myGhfs = new GoogleHadoopFileSystem(); myGhfs.initialize(ghfs.getUri(), config); URI fileUri = GoogleCloudStorageFileSystemIntegrationTest.getTempFilePath(); Path filePath = ghfsHelper.castAsHadoopPath(fileUri); String fileContent = "foo-testFileChecksum-" + checksumType; ghfsHelper.writeFile(filePath, fileContent, 1, true); FileChecksum fileChecksum = myGhfs.getFileChecksum(filePath); assertThat(fileChecksum.getAlgorithmName()).isEqualTo(checksumType.getAlgorithmName()); assertThat(fileChecksum.getLength()).isEqualTo(checksumType.getByteLength()); assertThat(fileChecksum.getBytes()).isEqualTo(checksumFn.apply(fileContent)); assertThat(fileChecksum.toString()) .contains(String.format("%s: ", checksumType.getAlgorithmName())); assertThat(ghfs.delete(filePath, true)).isTrue(); }
Source:
<code>public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); <START> IteratorEnvironment sampleEnv = env.newIEWithSamplingEnabled(); <END> sampleDC = source.deepCopy(sampleEnv); }</code><technical_language>a huge fan of this method name. A bit obtuse :)</technical_language>

Target:
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); IteratorEnvironment sampleEnv = env.cloneWithSamplingEnabled(); sampleDC = source.deepCopy(sampleEnv); }
Source:
<code>public long advance() { long current = index; <START> long currentMax = iterators[0].getIndex(); <END> long max = AscendingLongIterator.END; while (currentMax != max) { max = currentMax; for (AscendingLongIterator iterator : iterators) { currentMax = iterator.advanceAtLeastTo(currentMax); if (currentMax == AscendingLongIterator.END) { index = AscendingLongIterator.END; return current; } } } iterators[0].advance(); index = max; return current; }</code><technical_language>a bit more advanced algorithm find a match. rely fact indexes (positions) returned iterators ordered ascending. In addition sort iterators current index (e.g. priority queue) try match iterator try perform firstIterator.advanceAtLeastTo(lastIterator.index) skipping matching iterators in between. OK, if find a match (index of iterator == index of iterator), firstIterator (because advanced current one) repeat process of matching iterators</technical_language>

Target:
public long advance() { long current = index; long min = first.iterator.getIndex(); long max = last.iterator.getIndex(); while (min != max && min != AscendingLongIterator.END && max != AscendingLongIterator.END) { max = first.iterator.advanceAtLeastTo(max); Node second = first.next; first.next = null; last.next = first; last = first; first = second; min = first.iterator.getIndex(); } if (max == AscendingLongIterator.END) { index = AscendingLongIterator.END; return current; } if (min != AscendingLongIterator.END) { last.iterator.advance(); } index = min; return current; }
Source:
<code>private LandmarkUpdateOperation createAddLandmarkMarkerOperation(final IInteractionElement node) { if (node == null || node.getContentType() == null) { return null; } if (JavaStructureBridge.CONTENT_TYPE.equals(node.getContentType())) { final IJavaElement element = JavaCore.create(node.getHandleIdentifier()); if (!element.exists()) { return null; } if (element instanceof IMember) { try { final ISourceRange range = ((IMember) element).getNameRange(); IResource resource = element.getUnderlyingResource(); if (resource instanceof IFile) { LandmarkUpdateOperation runnable = new LandmarkUpdateOperation(resource) { public void run(IProgressMonitor monitor) throws CoreException { try { IMarker marker = getResource().createMarker(ID_MARKER_LANDMARK); if (marker != null && range != null) { marker.setAttribute(IMarker.CHAR_START, range.getOffset()); marker.setAttribute(IMarker.CHAR_END, range.getOffset() + range.getLength()); marker.setAttribute(IMarker.MESSAGE, Messages.LandmarkMarkerManager_Mylyn_Landmark); marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO); markerMap.put(node, marker.getId()); } <START> } catch (Throwable t) { <END> StatusHandler.log(new Status(IStatus.ERROR, JavaUiBridgePlugin.ID_PLUGIN, "Could not create add landmark markers", t)); } } }; return runnable; } } catch (JavaModelException e) { StatusHandler .log(new Status(IStatus.ERROR, JavaUiBridgePlugin.ID_PLUGIN, "Could not update marker", e)); } } } return null; }</code><technical_language>catch Throwable ResourceException</technical_language>

Target:
private LandmarkUpdateOperation createAddLandmarkMarkerOperation(final IInteractionElement node) { if (node == null || node.getContentType() == null) { return null; } if (JavaStructureBridge.CONTENT_TYPE.equals(node.getContentType())) { final IJavaElement element = JavaCore.create(node.getHandleIdentifier()); if (!element.exists()) { return null; } if (element instanceof IMember) { try { final ISourceRange range = ((IMember) element).getNameRange(); IResource resource = element.getUnderlyingResource(); if (resource instanceof IFile) { LandmarkUpdateOperation runnable = new LandmarkUpdateOperation(resource) { public void run(IProgressMonitor monitor) throws CoreException { try { IMarker marker = getResource().createMarker(ID_MARKER_LANDMARK); if (marker != null && range != null) { marker.setAttribute(IMarker.CHAR_START, range.getOffset()); marker.setAttribute(IMarker.CHAR_END, range.getOffset() + range.getLength()); marker.setAttribute(IMarker.MESSAGE, Messages.LandmarkMarkerManager_Mylyn_Landmark); marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO); markerMap.put(node, marker.getId()); } } catch (CoreException e) { StatusHandler.log(new Status(IStatus.ERROR, JavaUiBridgePlugin.ID_PLUGIN, "Could not create add landmark markers", e)); } } }; return runnable; } } catch (JavaModelException e) { StatusHandler .log(new Status(IStatus.ERROR, JavaUiBridgePlugin.ID_PLUGIN, "Could not update marker", e)); } } } return null; }
Source:
<code>protected Config buildGlobalConfig() { return new Config.Builder() <START> .setSdk(21) <END> .setManifest(Config.NONE) .build(); }</code><technical_language>I Robolectric testing really. Do this should: a) Generally match targetSdkVersion? b) Generally match minimumVersion? c) consistent? Currently 21 building for 22. I assume scenarios want test a function need a version</technical_language>

Target:
protected Config buildGlobalConfig() { return new Config.Builder() .setSdk(22) .setManifest(Config.NONE) .build(); }
Source:
<code>public void testErrorReceived() { TestObserver<Object> ts = new TestObserver<Object>(); TestException ex = new TestException("boo"); Flowable.error(ex).ignoreElements().subscribe(ts); ts.assertNoValues(); <START> ts.assertTerminated();; <END> ts.assertError(TestException.class); ts.assertErrorMessage("boo"); }</code><technical_language>double ;</technical_language>

Target:
public void testErrorReceived() { TestObserver<Object> ts = new TestObserver<Object>(); TestException ex = new TestException("boo"); Flowable.error(ex).ignoreElements().subscribe(ts); ts.assertNoValues(); ts.assertTerminated(); ts.assertError(TestException.class); ts.assertErrorMessage("boo"); }
Source:
<code>private void doGet(File outputFile) throws Exception { String[] segments = this.url.split("/"); String file = segments[segments.length - 1]; String repoUrl = this.url.substring(0, this.url.length() - file.length() - 1); Repository repository = new Repository(repoUrl, repoUrl); Wagon wagon = this.wagonManager.getWagon(repository.getProtocol()); if (readTimeOut > 0) { wagon.setReadTimeout(readTimeOut); getLog().info( "Read Timeout is set to " + readTimeOut + " milliseconds (apprx " + Math.round(readTimeOut * 1.66667e-5) + " minutes)"); } <START> com.googlecode.ConsoleDownloadMonitor downloadMonitor = new com.googlecode.ConsoleDownloadMonitor(); <END> if (session.getSettings().isInteractiveMode()) { wagon.addTransferListener(downloadMonitor); } wagon.connect(repository, this.wagonManager.getProxy(repository.getProtocol())); wagon.get(file, outputFile); wagon.disconnect(); if (session.getSettings().isInteractiveMode()) { wagon.removeTransferListener(downloadMonitor); } }</code><technical_language>Instantiating download monitor in condition succeeded block</technical_language>

Target:
private void doGet(File outputFile) throws Exception { String[] segments = this.url.split("/"); String file = segments[segments.length - 1]; String repoUrl = this.url.substring(0, this.url.length() - file.length() - 1); Repository repository = new Repository(repoUrl, repoUrl); Wagon wagon = this.wagonManager.getWagon(repository.getProtocol()); if (readTimeOut > 0) { wagon.setReadTimeout(readTimeOut); getLog().info( "Read Timeout is set to " + readTimeOut + " milliseconds (apprx " + Math.round(readTimeOut * 1.66667e-5) + " minutes)"); } ConsoleDownloadMonitor downloadMonitor = null; if (this.session.getSettings().isInteractiveMode()) { downloadMonitor = new ConsoleDownloadMonitor(); wagon.addTransferListener(downloadMonitor); } wagon.connect(repository, this.wagonManager.getProxy(repository.getProtocol())); wagon.get(file, outputFile); wagon.disconnect(); if (downloadMonitor != null) { wagon.removeTransferListener(downloadMonitor); } }
Source:
<code>public File gitPrefix() throws IOException { String path = SystemReader.getInstance().getenv("PATH"); String gitExe = scanPath(path, "git.exe", "git.cmd"); if (gitExe != null) <START> return new File(gitExe).getAbsoluteFile().getParentFile() <END> .getParentFile(); return super.gitPrefix(); }</code><technical_language>This is line-wrapping ugly. prefer (assuming change scanPath return File): File gitExe = scanPath(...); if (gitExe != null) { gitExe = gitExe.getAbsoluteFile(); File bin = gitExe.getParentFile(); // discard "git.exe" return bin.getParentFile(); // discard "bin" }</technical_language>

Target:
public File gitPrefix() { String path = SystemReader.getInstance().getenv("PATH"); File gitExe = searchPath(path, "git.exe", "git.cmd"); if (gitExe != null) return gitExe.getParentFile().getParentFile(); return super.gitPrefix(); }
Source:
<code>SummedDistributedEphemeralCounter summedDistributedEphemeralCounter(ZookeeperClientManager manager) { <START> List<CuratorFramework> curatorClients = manager.getClients().stream() <END> .map(ZookeeperClient::getCuratorFramework) .collect(toList()); return new SummedDistributedEphemeralCounter(curatorClients); }</code><technical_language>extract this (and method above) a private method getCuratorClients(manager)</technical_language>

Target:
SummedDistributedEphemeralCounter summedDistributedEphemeralCounter(ZookeeperClientManager manager) { return new SummedDistributedEphemeralCounter(getCuratorClients(manager)); }