auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private String determineDeviceUUID() throws NotActiveException { DeviceUUIDsMap uuidsMap = new DeviceUUIDsMap(); uuidsMap.loadData(); String uuid = uuidsMap.getUUID(exactSdkVersion, deviceName); if (uuid == null) { throw new NotFoundException("Couldn't find UUID for device " + deviceName + " with SDK " + exactSdkVersion); } int countingTries = 0; String state = uuidsMap.getState(exactSdkVersion, deviceName); while (countingTries < NUMBER_TRIES_GETTING_UUID && state.equals("Shutting Down")) { log.info(String.format("Device is shutting down. Wait %d milliseconds.", SLEEP_TIME_BETWEEN_TRIES)); try { Thread.sleep(SLEEP_TIME_BETWEEN_TRIES); } catch (InterruptedException e) { } uuidsMap.loadData(); state = uuidsMap.getState(exactSdkVersion, deviceName); ++countingTries; } if (state.equals("Shutting down")) throw new NotActiveException("UUID for device " + deviceName + " with SDK " + exactSdkVersion <START> + " is not " + "available to use. " + "Current state:" + state); <END> return uuid; }</code><technical_language>+ " is use. Current state: " + state);</technical_language>

Target:
private String determineDeviceUUID() throws DeviceNotAvailableException { DeviceUUIDsMap uuidsMap = new DeviceUUIDsMap(); uuidsMap.loadData(); String uuid = uuidsMap.getUUID(exactSdkVersion, deviceName); if (uuid == null) { String message = "Couldn't find UUID for device " + deviceName + " with SDK " + exactSdkVersion; log.warning(message); throw new NotFoundException(message); } int countingTries = 0; String state = uuidsMap.getState(exactSdkVersion, deviceName); while ((countingTries < NUMBER_TRIES_GETTING_UUID) && (state.equals("Shutting Down"))) { log.info(String.format("Device is shutting down. Wait %d milliseconds.", SLEEP_TIME_BETWEEN_TRIES)); try { Thread.sleep(SLEEP_TIME_BETWEEN_TRIES); } catch (InterruptedException e) { } uuidsMap.loadData(); state = uuidsMap.getState(exactSdkVersion, deviceName); countingTries += 1; } if (state.equals("Shutting down")) { String message = "UUID for device " + deviceName + " with SDK " + exactSdkVersion + " is not available to use. Current state:" + state; log.warning(message); throw new DeviceNotAvailableException(message); } return uuid; }
Source:
<code>private void doRemove(final ApprovalDetail ad, final PushButton remove) { remove.setEnabled(false); PatchUtil.DETAIL_SVC.removeReviewer(changeId, ad.getAccount(), new GerritCallback<ReviewerResult>() { @Override public void onSuccess(ReviewerResult result) { if (result.getErrors().isEmpty()) { final ChangeDetail r = result.getChange(); display(r.getChange(), r.getMissingApprovals(), r.getApprovals()); } else { final ReviewerResult.Error resultError = result.getErrors().get(0); String message; switch (resultError.getType()) { case REMOVE_NOT_PERMITTED: <START> message = "Not allowed to remove reviewer"; <END> break; case COULD_NOT_REMOVE: default: message = "Could not remove reviewer"; } new ErrorDialog(message + " " + resultError.getName()).center(); } } @Override public void onFailure(final Throwable caught) { remove.setEnabled(true); super.onFailure(caught); } }); }</code><technical_language>a constants interface, ChangeConstants, property file ChangeConstants.properties</technical_language>

Target:
private void doRemove(final ApprovalDetail ad, final PushButton remove) { remove.setEnabled(false); PatchUtil.DETAIL_SVC.removeReviewer(changeId, ad.getAccount(), new GerritCallback<ReviewerResult>() { @Override public void onSuccess(ReviewerResult result) { if (result.getErrors().isEmpty()) { final ChangeDetail r = result.getChange(); display(r.getChange(), r.getMissingApprovals(), r.getApprovals()); } else { final ReviewerResult.Error resultError = result.getErrors().get(0); String message; switch (resultError.getType()) { case REMOVE_NOT_PERMITTED: message = Util.C.approvalTableRemoveNotPermitted(); break; case COULD_NOT_REMOVE: default: message = Util.C.approvalTableCouldNotRemove(); } new ErrorDialog(message + " " + resultError.getName()).center(); } } @Override public void onFailure(final Throwable caught) { remove.setEnabled(true); super.onFailure(caught); } }); }
Source:
<code>public RaptorSessionProperties(StorageManagerConfig config) { sessionProperties = ImmutableList.of( stringProperty( EXTERNAL_BATCH_ID, "Two-phase commit batch ID", null, true), dataSizeSessionProperty( READER_MAX_MERGE_DISTANCE, "Reader: Maximum size of gap between two reads to merge into a single read", config.getOrcMaxMergeDistance(), false), dataSizeSessionProperty( READER_MAX_READ_SIZE, "Reader: Maximum size of a single read", config.getOrcMaxReadSize(), false), dataSizeSessionProperty( READER_STREAM_BUFFER_SIZE, "Reader: Size of buffer for streaming reads", config.getOrcStreamBufferSize(), false), dataSizeSessionProperty( READER_TINY_STRIPE_THRESHOLD, "Reader: Threshold below which an ORC stripe or file will read in its entirety", config.getOrcTinyStripeThreshold(), false), booleanProperty( READER_LAZY_READ_SMALL_RANGES, "Experimental: Reader: Read small file segments lazily", config.isOrcLazyReadSmallRanges(), false), integerProperty( ONE_SPLIT_PER_BUCKET_THRESHOLD, "Experimental: Maximum bucket count at which to produce multiple splits per bucket", config.getOneSplitPerBucketThreshold(), false), booleanProperty( ORC_ZSTD_JNI_DECOMPRESSION_ENABLED, "use JNI based std decompression for reading ORC files", <START> false, <END> true)); }</code><technical_language>issue hive session property</technical_language>

Target:
public RaptorSessionProperties(StorageManagerConfig config) { sessionProperties = ImmutableList.of( stringProperty( EXTERNAL_BATCH_ID, "Two-phase commit batch ID", null, true), dataSizeSessionProperty( READER_MAX_MERGE_DISTANCE, "Reader: Maximum size of gap between two reads to merge into a single read", config.getOrcMaxMergeDistance(), false), dataSizeSessionProperty( READER_MAX_READ_SIZE, "Reader: Maximum size of a single read", config.getOrcMaxReadSize(), false), dataSizeSessionProperty( READER_STREAM_BUFFER_SIZE, "Reader: Size of buffer for streaming reads", config.getOrcStreamBufferSize(), false), dataSizeSessionProperty( READER_TINY_STRIPE_THRESHOLD, "Reader: Threshold below which an ORC stripe or file will read in its entirety", config.getOrcTinyStripeThreshold(), false), booleanProperty( READER_LAZY_READ_SMALL_RANGES, "Experimental: Reader: Read small file segments lazily", config.isOrcLazyReadSmallRanges(), false), integerProperty( ONE_SPLIT_PER_BUCKET_THRESHOLD, "Experimental: Maximum bucket count at which to produce multiple splits per bucket", config.getOneSplitPerBucketThreshold(), false), booleanProperty( ORC_ZSTD_JNI_DECOMPRESSION_ENABLED, "use JNI based std decompression for reading ORC files", config.isZstdJniDecompressionEnabled(), true)); }
Source:
<code>private String getBaseUrlString(ChangeSet changeSet) throws MalformedURLException { String baseUrl; if (url != null) { baseUrl = DescriptorImpl.getBaseUrl(url); } else { String scmUrl = getServerConfiguration(changeSet); if (scmUrl.endsWith("/")) { baseUrl = scmUrl; } else { baseUrl = String.format("%s/", scmUrl); <START> } <END> } return baseUrl; }</code><technical_language>This "ensureTrailingSlash" logic is duplicated in DescriptorImpl#getBaseUrl below. Consider calling method extracting a helper sites call</technical_language>

Target:
private String getBaseUrlString(ChangeSet changeSet) throws MalformedURLException { String baseUrl = url; if (baseUrl == null) { baseUrl = getServerConfiguration(changeSet); } baseUrl = normalizeToEndWithSlash(new URL(baseUrl)).toString(); return baseUrl; }
Source:
<code>protected Connection openConnection() throws IOException { CallbackHandler callbackHandler = null; SSLContext sslContext = null; if (realm != null) { sslContext = realm.getSSLContext(); CallbackHandlerFactory handlerFactory = realm.getSecretCallbackHandlerFactory(); if (handlerFactory != null) { String username = this.username != null ? this.username : localHostName; callbackHandler = handlerFactory.getCallbackHandler(username); } } final ProtocolConnectionConfiguration config = ProtocolConnectionConfiguration.copy(configuration); config.setCallbackHandler(callbackHandler); config.setSslContext(sslContext); config.setUri(uri); config.setSslEnabled(Protocol.HTTP_REMOTING != Protocol.forName(uri.getScheme())); <START> config.setUseStartTLS(Protocol.HTTPS_REMOTING != Protocol.forName(uri.getScheme())); <END> return ProtocolConnectionUtils.connectSync(config); }</code><technical_language>If put this ProtocolConnectionConfiguration.setURI() rid of new setters, I more robust</technical_language>

Target:
protected Connection openConnection() throws IOException { CallbackHandler callbackHandler = null; SSLContext sslContext = null; if (realm != null) { sslContext = realm.getSSLContext(); CallbackHandlerFactory handlerFactory = realm.getSecretCallbackHandlerFactory(); if (handlerFactory != null) { String username = this.username != null ? this.username : localHostName; callbackHandler = handlerFactory.getCallbackHandler(username); } } final ProtocolConnectionConfiguration config = ProtocolConnectionConfiguration.copy(configuration); config.setCallbackHandler(callbackHandler); config.setSslContext(sslContext); config.setUri(uri); return ProtocolConnectionUtils.connectSync(config); }
Source:
<code>public String getInterfaceNames() { return node.getDefiningType().getCodeUnitDetails().getInterfaceTypeRefs().stream() .map(TypeRef::getNames).map(it -> it.stream().map(Identifier::getValue).collect(Collectors.joining("."))) <START> .collect(Collectors.joining(",")); <END> }</code><technical_language>reason comma-separated instead of returning List<String> / Set<String></technical_language>

Target:
public List<String> getInterfaceNames() { return node.getDefiningType().getCodeUnitDetails().getInterfaceTypeRefs().stream() .map(TypeRef::getNames).map(it -> it.stream().map(Identifier::getValue).collect(Collectors.joining("."))) .collect(Collectors.toList()); }
Source:
<code>public Object sample_value() { checkHasParams(); if (s.isEmpty()) { return Model.NULL; } int n = Util.randInt(s.size()); Iterator<?> it = s.iterator(); while (it.hasNext()) { if (n == 0) return (Object) it.next(); --n; it.next(); } <START> return null; <END> }</code><technical_language>This is O(1) in setParams O(n) in sample_value. convert collection a list in setParams. O(n) in setParams O(1) in sample_value</technical_language>

Target:
public Object sample_value() { checkHasParams(); if (elements.length <= 0) { return Model.NULL; } int n = Util.randInt(elements.length); return elements[n]; }
Source:
<code>public static Throwable getError(Task<?> t) { if (t==null) return null; if (!t.isDone()) return null; if (t.isCancelled()) return new CancellationException(); try { t.get(); return null; } catch (Throwable error) { <START> Exceptions.propagateIfFatal(error); <END> return error; } }</code><technical_language>I want propagate exception in this thread. want return throwable. this thread error</technical_language>

Target:
public static Throwable getError(Task<?> t) { if (t==null) return null; if (!t.isDone()) return null; if (t.isCancelled()) return new CancellationException(); try { t.get(); return null; } catch (Throwable error) { return error; } }
Source:
<code>protected Object computeValue(PermanentProperty prop, Object value, Object last, Flag flag) { if (prop == Value.UPCOMING_JAM && !(value instanceof Jam)) { value = new JamImpl(this, getCurrentPeriod().getCurrentJam()); <START> } else if (prop == Value.NO_MORE_JAM) { <END> if (isInJam() || !isInPeriod()) { return false; } if (!getRulesets().getBoolean(Rule.PERIOD_END_BETWEEN_JAMS)) { return false; } Jam lastJam = getCurrentPeriod().getCurrentJam(); long pcRemaining = getClock(Clock.ID_PERIOD).getMaximumTime() - lastJam.getPeriodClockElapsedEnd(); if (pcRemaining > getRulesets().getLong(Rule.LINEUP_DURATION)) { return false; } boolean ttoForcesJam = getRulesets().getBoolean(Rule.STOP_PC_ON_TO) || getRulesets().getBoolean(Rule.STOP_PC_ON_TTO); boolean orForcesJam = getRulesets().getBoolean(Rule.STOP_PC_ON_TO) || getRulesets().getBoolean(Rule.STOP_PC_ON_OR); boolean otoForcesJam = getRulesets().getBoolean(Rule.EXTRA_JAM_AFTER_OTO) && (getRulesets().getBoolean(Rule.STOP_PC_ON_TO) || getRulesets().getBoolean(Rule.STOP_PC_ON_TTO)); for (ValueWithId v : lastJam.getAll(Jam.Child.TIMEOUTS_AFTER)) { Timeout t = (Timeout)v; if (t.getOwner() instanceof Team) { if (t.isReview() && orForcesJam) { return false; } if (!t.isReview() && ttoForcesJam) { return false; } } else if (otoForcesJam) { return false; } } return true; } return value; }</code><technical_language>logic right here, if I stop 30 red allowing another jam</technical_language>

Target:
protected Object computeValue(PermanentProperty prop, Object value, Object last, Flag flag) { if (prop == Value.UPCOMING_JAM && !(value instanceof Jam)) { value = new JamImpl(this, getCurrentPeriod().getCurrentJam()); } else if (prop == Value.NO_MORE_JAM) { if (isInJam() || !isInPeriod()) { return false; } if (!getRulesets().getBoolean(Rule.PERIOD_END_BETWEEN_JAMS)) { return false; } Jam lastJam = getCurrentPeriod().getCurrentJam(); long pcRemaining = getClock(Clock.ID_PERIOD).getMaximumTime() - lastJam.getPeriodClockElapsedEnd(); if (pcRemaining >= getRulesets().getLong(Rule.LINEUP_DURATION)) { return false; } boolean ttoForcesJam = getRulesets().getBoolean(Rule.STOP_PC_ON_TO) || getRulesets().getBoolean(Rule.STOP_PC_ON_TTO); boolean orForcesJam = getRulesets().getBoolean(Rule.STOP_PC_ON_TO) || getRulesets().getBoolean(Rule.STOP_PC_ON_OR); boolean otoForcesJam = getRulesets().getBoolean(Rule.EXTRA_JAM_AFTER_OTO) && (getRulesets().getBoolean(Rule.STOP_PC_ON_TO) || getRulesets().getBoolean(Rule.STOP_PC_ON_TTO)); for (ValueWithId v : lastJam.getAll(Jam.Child.TIMEOUTS_AFTER)) { Timeout t = (Timeout)v; if (t.getOwner() instanceof Team) { if (t.isReview() && orForcesJam) { return false; } if (!t.isReview() && ttoForcesJam) { return false; } } else if (otoForcesJam) { return false; } } return true; } return value; }
Source:
<code>public static AutoPreviewExtender create(PreviewConfig.Builder builder) { try { return new VendorAutoPreviewExtender(builder); } catch (NoClassDefFoundError e) { <START> Log.d(TAG, "No auto view finder extender found. Falling back to default."); <END> return new DefaultAutoPreviewExtender(); } }</code><technical_language>auto view finder extender found. -> auto preview extender found</technical_language>

Target:
public static AutoPreviewExtender create(PreviewConfig.Builder builder) { try { return new VendorAutoPreviewExtender(builder); } catch (NoClassDefFoundError e) { Log.d(TAG, "No auto preview extender found. Falling back to default."); return new DefaultAutoPreviewExtender(); } }
Source:
<code>private MaxLoadThreads(long maxLoadThreads) { if (maxLoadThreads <= 0) { throw new IllegalArgumentException( String.format("The maximum number of threads must be >= 0. Provided value is %s", maxLoadThreads)); <START> } <END> this.maxLoadThreads = maxLoadThreads; }</code><technical_language>Incorrect message. Shoul ></technical_language>

Target:
private MaxLoadThreads(long maxLoadThreads) { if (maxLoadThreads <= 0) { throw new IllegalArgumentException( String.format("The maximum number of threads must be > 0. Provided value is %s", maxLoadThreads)); } this.maxLoadThreads = maxLoadThreads; }
Source:
<code>public static ResourceIdentifier of(String service, String instance, String type, String context, String firstLocatorComponent, String... locatorComponents) { <START> StringBuilder builder = new StringBuilder().append(firstLocatorComponent); <END> for (String component : locatorComponents) { builder.append(SEPARATOR).append(component); } return of(service, instance, type, context, builder.toString()); }</code><technical_language>I more idiomatic new StringBuilder(firstLocatorComponent) (<LINK_0></technical_language>

Target:
public static ResourceIdentifier of(String service, String instance, String type, String context, String firstLocatorComponent, String... locatorComponents) { StringBuilder builder = new StringBuilder(firstLocatorComponent); for (String component : locatorComponents) { builder.append(SEPARATOR).append(component); } return of(service, instance, type, context, builder.toString()); }
Source:
<code>public void testOverriddenMethodWithSpecifyParamType() throws RemotingException { mockChannel = mock(Channel.class); <START> given(mockChannel.getAttribute("telnet.service")).willReturn("org.apache.dubbo.rpc.protocol.dubbo.support.DemoService"); <END> given(mockChannel.getLocalAddress()).willReturn(NetUtils.toAddress("127.0.0.1:5555")); given(mockChannel.getRemoteAddress()).willReturn(NetUtils.toAddress("127.0.0.1:20886")); ProviderModel providerModel = new ProviderModel("org.apache.dubbo.rpc.protocol.dubbo.support.DemoService", new DemoServiceImpl(), DemoService.class); ApplicationModel.initProviderModel("org.apache.dubbo.rpc.protocol.dubbo.support.DemoService", providerModel); String result = invoke.telnet(mockChannel, "DemoService.getPerson({\"name\":\"zhangsan\",\"age\":12,\"class\":\"org.apache.dubbo.rpc.protocol.dubbo.support.Person\"})"); assertTrue(result.contains("result: 12")); }</code><technical_language>rewritten given(mockChannel.getAttribute("telnet.service")).willReturn(DemoService.class.getName());</technical_language>

Target:
public void testOverriddenMethodWithSpecifyParamType() throws RemotingException { mockChannel = mock(Channel.class); given(mockChannel.getAttribute("telnet.service")).willReturn(DemoService.class.getName()); given(mockChannel.getLocalAddress()).willReturn(NetUtils.toAddress("127.0.0.1:5555")); given(mockChannel.getRemoteAddress()).willReturn(NetUtils.toAddress("127.0.0.1:20886")); ProviderModel providerModel = new ProviderModel(DemoService.class.getName(), new DemoServiceImpl(), DemoService.class); ApplicationModel.initProviderModel(DemoService.class.getName(), providerModel); String result = invoke.telnet(mockChannel, "getPerson({\"name\":\"zhangsan\",\"age\":12,\"class\":\"org.apache.dubbo.rpc.protocol.dubbo.support.Person\"})"); assertTrue(result.contains("result: 12")); }
Source:
<code>public void onClick(final View view) { <START> for (final View.OnClickListener listener: new ArrayList<View.OnClickListener>(listeners)) { <END> listener.onClick(view); } }</code><technical_language>This is extremely wasteful. Try a CopyOnWriteArrayList for listeners instead</technical_language>

Target:
public void onClick(final View view) { for (final View.OnClickListener listener : listeners) { listener.onClick(view); } }
Source:
<code>MetaStoreConfigAuthenticationProviderImpl(Configuration conf) throws AuthenticationException { userName = MetastoreConf.getVar(conf, MetastoreConf.ConfVars.THRIFT_AUTH_CONFIG_USERNAME); password = MetastoreConf.getVar(conf, MetastoreConf.ConfVars.THRIFT_AUTH_CONFIG_PASSWORD); if (null == userName || userName.isEmpty()) { throw new AuthenticationException("No username specified in " + MetastoreConf.ConfVars.THRIFT_AUTH_CONFIG_USERNAME); } <START> if (null == password || password.isEmpty()) { <END> throw new AuthenticationException("No password specified in " + MetastoreConf.ConfVars.THRIFT_AUTH_CONFIG_USERNAME); } }</code><technical_language>password empty</technical_language>

Target:
MetaStoreConfigAuthenticationProviderImpl(Configuration conf) throws AuthenticationException { userName = MetastoreConf.getVar(conf, MetastoreConf.ConfVars.THRIFT_AUTH_CONFIG_USERNAME); password = MetastoreConf.getVar(conf, MetastoreConf.ConfVars.THRIFT_AUTH_CONFIG_PASSWORD); if (null == userName || userName.isEmpty()) { throw new AuthenticationException("No username specified in " + MetastoreConf.ConfVars.THRIFT_AUTH_CONFIG_USERNAME); } if (null == password) { throw new AuthenticationException("No password specified in " + MetastoreConf.ConfVars.THRIFT_AUTH_CONFIG_PASSWORD); } }
Source:
<code>private void processOptions(RepositoryState state) throws NoMessageException { if (committer == null) committer = new PersonIdent(repo); if (author == null && !amend) author = committer; if (state == RepositoryState.MERGING_RESOLVED) { try { <START> RevWalk rw = new RevWalk(repo); <END> parents = repo.readMergeHeads(); if (parents != null) for (int i = 0; i < parents.size(); i++) { RevObject ro = rw.parseAny(parents.get(i)); if (ro instanceof RevTag) parents.set(i, rw.peel(ro)); } } catch (IOException e) { throw new JGitInternalException(MessageFormat.format( JGitText.get().exceptionOccurredDuringReadingOfGIT_DIR, Constants.MERGE_HEAD, e), e); } if (message == null) { try { message = repo.readMergeCommitMsg(); } catch (IOException e) { throw new JGitInternalException(MessageFormat.format( JGitText.get().exceptionOccurredDuringReadingOfGIT_DIR, Constants.MERGE_MSG, e), e); } } } else if (state == RepositoryState.SAFE && message == null) { try { message = repo.readSquashCommitMsg(); if (message != null) repo.writeSquashCommitMsg(null ); } catch (IOException e) { throw new JGitInternalException(MessageFormat.format( JGitText.get().exceptionOccurredDuringReadingOfGIT_DIR, Constants.MERGE_MSG, e), e); } } if (message == null) throw new NoMessageException(JGitText.get().commitMessageNotSpecified); }</code><technical_language>RevWalk needs released use, right</technical_language>

Target:
private void processOptions(RepositoryState state) throws NoMessageException { if (committer == null) committer = new PersonIdent(repo); if (author == null && !amend) author = committer; if (state == RepositoryState.MERGING_RESOLVED) { try { parents = repo.readMergeHeads(); if (parents != null) for (int i = 0; i < parents.size(); i++) { RevObject ro = rw.parseAny(parents.get(i)); if (ro instanceof RevTag) parents.set(i, rw.peel(ro)); } } catch (IOException e) { throw new JGitInternalException(MessageFormat.format( JGitText.get().exceptionOccurredDuringReadingOfGIT_DIR, Constants.MERGE_HEAD, e), e); } if (message == null) { try { message = repo.readMergeCommitMsg(); } catch (IOException e) { throw new JGitInternalException(MessageFormat.format( JGitText.get().exceptionOccurredDuringReadingOfGIT_DIR, Constants.MERGE_MSG, e), e); } } } else if (state == RepositoryState.SAFE && message == null) { try { message = repo.readSquashCommitMsg(); if (message != null) repo.writeSquashCommitMsg(null ); } catch (IOException e) { throw new JGitInternalException(MessageFormat.format( JGitText.get().exceptionOccurredDuringReadingOfGIT_DIR, Constants.MERGE_MSG, e), e); } } if (message == null) throw new NoMessageException(JGitText.get().commitMessageNotSpecified); }
Source:
<code>public void testSTPoint() throws Exception { <START> assertQuery("select st_as_text(st_point(1, 4))", "select 'POINT (1 4)'"); <END> }</code><technical_language>nit: perhaps, test floating points well: st_point(122.3, 10.55) Also, consider testing invalid WKT strings</technical_language>

Target:
public void testSTPoint() throws Exception { assertFunction("ST_AsText(ST_Point(1, 4))", VARCHAR, "POINT (1 4)"); assertFunction("ST_AsText(ST_Point(122.3, 10.55))", VARCHAR, "POINT (122.3 10.55)"); }
Source:
<code>private void handleBatchCallback( final SearchResult searchResult, final Repository repository, final NodeVersionQuery nodeVersionQuery ) { final List<NodeVersionDocumentId> toBeDeleted = Lists.newArrayList(); final long versionTotal = searchResult.getTotalHits(); if ( !this.repositoryCleanStarted ) { if ( listener != null ) { listener.vacuumingVersionRepository( repository.getId(), versionTotal ); } this.repositoryCleanStarted = true; } <START> if ( searchResult.getHits().getSize() == 0 ) <END> { return; } final NodeVersionQueryResult nodeVersionQueryResult = NodeVersionQueryResultFactory.create( nodeVersionQuery, searchResult ); nodeVersionQueryResult.getNodeVersionsMetadata().forEach( ( version ) -> { processVersion( repository, result, toBeDeleted, version ); if ( listener != null ) { listener.vacuumingVersion( 1L ); } } ); LOG.info( "Deleting: " + toBeDeleted.size() + " versions from repository: " + repository.getId() ); versionService.delete( toBeDeleted, InternalContext.from( ContextAccessor.current() ) ); }</code><technical_language>isEmpty</technical_language>

Target:
private void handleBatchCallback( final SearchResult searchResult, final Repository repository, final NodeVersionQuery nodeVersionQuery ) { final List<NodeVersionDocumentId> toBeDeleted = Lists.newArrayList(); final long versionTotal = searchResult.getTotalHits(); if ( !this.repositoryCleanStarted ) { if ( listener != null ) { listener.vacuumingVersionRepository( repository.getId(), versionTotal ); } this.repositoryCleanStarted = true; } if ( searchResult.isEmpty() ) { return; } final NodeVersionQueryResult nodeVersionQueryResult = NodeVersionQueryResultFactory.create( nodeVersionQuery, searchResult ); nodeVersionQueryResult.getNodeVersionsMetadata().forEach( ( version ) -> { processVersion( repository, result, toBeDeleted, version ); if ( listener != null ) { listener.vacuumingVersion( 1L ); } } ); LOG.info( "Deleting: " + toBeDeleted.size() + " versions from repository: " + repository.getId() ); versionService.delete( toBeDeleted, InternalContext.from( ContextAccessor.current() ) ); }
Source:
<code>public void getUserByActivationKey_shouldGetUserUsingActivationKey() { executeDataSet(XML_FILENAME); <START> <END> User user = userService.getUserByActivationKey("XbklsieiskeuztecEnPf"); assertNotNull("User with activationKey ", user); if(user!=null) { String[] tokens = user.getActivationKey().split(":"); assertEquals("XbklsieiskeuztecEnPf",tokens[0]); } }</code><technical_language>remove this space please</technical_language>

Target:
public void getUserByActivationKey_shouldGetUserUsingActivationKey() { executeDataSet(XML_FILENAME); String key="XbklsieiskeuztecEnPf"; User user = userService.getUserByActivationKey(key); assertNotNull("User with activationKey ", user); String[] tokens = user.getActivationKey().split(":"); assertEquals(key,tokens[0]); }
Source:
<code>private static List<File> listFiles(String directory, String suffix) { File dir = new File(directory); List<File> propFiles = new ArrayList<>(); if (!dir.exists()) { <START> logger.warn("Directory {0} doesn't exists.", directory); <END> return propFiles; } File[] dirFiles = dir.listFiles(); if (dirFiles != null) { for (File file : dirFiles) { if (file.getName().endsWith(suffix)) { propFiles.add(file); } } } return propFiles; }</code><technical_language>{}</technical_language>

Target:
private static List<File> listFiles(String directory, String suffix) { File dir = new File(directory); List<File> propFiles = new ArrayList<>(); if (!dir.exists()) { logger.warn("Directory doesn't exists.", directory); return propFiles; } File[] dirFiles = dir.listFiles(); if (dirFiles != null) { for (File file : dirFiles) { if (file.getName().endsWith(suffix)) { propFiles.add(file); } } } return propFiles; }
Source:
<code>public void findFiles(final FileSelector selector, final boolean depthwise, final List<FileObject> selected) throws FileSystemException { if (forkJoinPool == null) { super.findFiles(selector, depthwise, selected); <START> } else { <END> try { if (exists()) { final DefaultFileSelectorInfo info = new DefaultFileSelectorInfo(); info.setBaseFolder(this); info.setDepth(0); info.setFile(this); selected.addAll(forkJoinPool.invoke(new TraverseTask(info, selector, depthwise))); } } catch (final Exception e) { throw new FileSystemException("vfs.provider/find-files.error", getName(), e); } } }</code><technical_language>protect forkJoinPool accesses is static shared ProActiveFileObject</technical_language>

Target:
public void findFiles(final FileSelector selector, final boolean depthwise, final List<FileObject> selected) throws FileSystemException { if (forkJoinPool == null) { super.findFiles(selector, depthwise, selected); } else { try { if (exists()) { final DefaultFileSelectorInfo info = new DefaultFileSelectorInfo(); info.setBaseFolder(this); info.setDepth(0); info.setFile(this); selected.addAll(forkJoinPool.invoke(new TraverseFilesTask(info, selector, depthwise))); } } catch (final Exception e) { throw new FileSystemException("vfs.provider/find-files.error", getName(), e); } } }
Source:
<code>public void teardown() { <START> super.teardown(); <END> if (windowBoundedService != null) { windowBoundedService.teardown(); } }</code><technical_language>Is needed BoundedService teardown? teardown of operator service termination</technical_language>

Target:
public void teardown() { if (windowBoundedService != null) { windowBoundedService.teardown(); } super.teardown(); }
Source:
<code>public static void putObject_test6() throws Exception { if (!mintEnv) { System.out.println("Test: objectName with path segments: " + "putObject(String bucketName, String objectName, InputStream body, " + "long size, String contentType)"); } long startTime = System.currentTimeMillis(); try { String objectName = "/path/to/" + getRandomName(); <START> try (final InputStream is = new ContentInputStream(1 * MB)) { <END> client.putObject(bucketName, objectName, is, 1 * MB, customContentType); } client.removeObject(bucketName, objectName); mintSuccessLog("putObject(String bucketName, String objectName, InputStream body, long size," + " String contentType)", "size: 1 MB, contentType: " + customContentType, startTime); } catch (Exception e) { mintFailedLog("putObject(String bucketName, String objectName, InputStream body, long size," + " String contentType)", "size: 1 MB, contentType: " + customContentType, startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace())); throw e; } }</code><technical_language>3 * MB is set purposefully show oversized stream/less data read bigger stream</technical_language>

Target:
public static void putObject_test6() throws Exception { if (!mintEnv) { System.out.println("Test: objectName with path segments: " + "putObject(String bucketName, String objectName, InputStream body, " + "long size, String contentType)"); } long startTime = System.currentTimeMillis(); try { String objectName = "/path/to/" + getRandomName(); try (final InputStream is = new ContentInputStream(3 * MB)) { client.putObject(bucketName, objectName, is, 1 * MB, customContentType); } client.removeObject(bucketName, objectName); mintSuccessLog("putObject(String bucketName, String objectName, InputStream body, long size," + " String contentType)", "size: 1 MB, contentType: " + customContentType, startTime); } catch (Exception e) { mintFailedLog("putObject(String bucketName, String objectName, InputStream body, long size," + " String contentType)", "size: 1 MB, contentType: " + customContentType, startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace())); throw e; } }
Source:
<code>@Test public void numberToStringCoersion() throws Exception { <START> JsonReader reader = new JsonValueReader(Arrays.asList(0, 9223372036854775807L, 2.5d, 3.010f, "a", "5")); <END> reader.beginArray(); assertThat(reader.nextString()).isEqualTo("0"); assertThat(reader.nextString()).isEqualTo("9223372036854775807"); assertThat(reader.nextString()).isEqualTo("2.5"); assertThat(reader.nextString()).isEqualTo("3.01"); assertThat(reader.nextString()).isEqualTo("a"); assertThat(reader.nextString()).isEqualTo("5"); reader.endArray(); }</code><technical_language>is reason trailing 0 in 3.010f</technical_language>

Target:
@Test public void numberToStringCoersion() throws Exception { JsonReader reader = new JsonValueReader(Arrays.asList(0, 9223372036854775807L, 2.5d, 3.01f, "a", "5")); reader.beginArray(); assertThat(reader.nextString()).isEqualTo("0"); assertThat(reader.nextString()).isEqualTo("9223372036854775807"); assertThat(reader.nextString()).isEqualTo("2.5"); assertThat(reader.nextString()).isEqualTo("3.01"); assertThat(reader.nextString()).isEqualTo("a"); assertThat(reader.nextString()).isEqualTo("5"); reader.endArray(); }
Source:
<code>private void registerToServiceProvider(String hostName) throws Exception { <START> PqsZookeeperConf pqsZookeeperConf = new PqsZookeeperConfImpl(getConf()); <END> registry = new ZookeeperRegistry(); String zkConnectString = pqsZookeeperConf.getZkConnectString(); registry.registerServer(pqsZookeeperConf,getPort(),zkConnectString,hostName); }</code><technical_language>implementation in load balancer module interface def in query server module Correct. > load implementation in queryserver module service loader loadbalancer module Yup > do query server dependent load balancer module load balancer a dependency queryserver. Is plugin load jars loadbalancer queryserver target This is ServiceLoader solves. do understand ServiceLoader works? compile time, PQS interface. runtime, interface implementation present. ServiceLoader provides implementation of interface (based runtime classpath)</technical_language>

Target:
public boolean registerToServiceProvider(String hostName) { boolean success = true ; try { LoadBalanceZookeeperConf loadBalanceConfiguration = getLoadBalanceConfiguration(); Preconditions.checkNotNull(loadBalanceConfiguration); this.registry = getRegistry(); Preconditions.checkNotNull(registry); String zkConnectString = loadBalanceConfiguration.getZkConnectString(); this.registry.registerServer(loadBalanceConfiguration, getPort(), zkConnectString, hostName); } catch(Throwable ex){ LOG.error("error while trying to register ",ex); success = false; } finally { return success; } }
Source:
<code>private List<CloudResourceStatus> deleteResources(List<CloudResource> resources, CloudContext cloudContext, boolean force, AzureClient client, PersistenceNotifier persistenceNotifier) { List<CloudResourceStatus> deletedResourcesList = new ArrayList<>(); List<CloudResource> azureGenericResources = findResources(resources, List.of(AZURE_PRIVATE_ENDPOINT)); LOGGER.debug("Deleting dns zone groups and azure private endpoints {}", azureGenericResources); azureUtils.deleteGenericResources(client, azureGenericResources.stream().map(CloudResource::getReference).collect(Collectors.toList())); azureGenericResources.forEach(cr -> persistenceNotifier.notifyDeletion(cr, cloudContext)); <START> findResources(resources, List.of(AZURE_DATABASE)) .forEach(r -> { LOGGER.debug("Deleting postgres server {}", r.getReference()); azureUtils.deleteDatabaseServer(client, r.getReference(), force); persistenceNotifier.notifyDeletion(r, cloudContext); deletedResourcesList.add(new CloudResourceStatus(CloudResource.builder() .type(AZURE_DATABASE) .name(r.getReference()) .build(), ResourceStatus.DELETED)); }); <END> return deletedResourcesList; }</code><technical_language>I prefer stream+collect foreach adding element external list (please note default naming generated idea here): List<CloudResourceStatus> collect = findResources(resources, List.of(AZURE_DATABASE)) .stream() .map(r -> getCloudResourceStatus(cloudContext, force, client, persistenceNotifier, r)) .collect(Collectors.toList()); return collect; } private CloudResourceStatus getCloudResourceStatus(CloudContext cloudContext, boolean force, AzureClient client, PersistenceNotifier persistenceNotifier, CloudResource r) { LOGGER.debug("Deleting postgres server {}", r.getReference()); azureUtils.deleteDatabaseServer(client, r.getReference(), force); persistenceNotifier.notifyDeletion(r, cloudContext); return new CloudResourceStatus(CloudResource.builder() .type(AZURE_DATABASE) .name(r.getReference()) .build(), ResourceStatus.DELETED); }</technical_language>

Target:
private List<CloudResourceStatus> deleteResources(List<CloudResource> resources, CloudContext cloudContext, boolean force, AzureClient client, PersistenceNotifier persistenceNotifier) { List<CloudResource> azureGenericResources = findResources(resources, List.of(AZURE_PRIVATE_ENDPOINT)); LOGGER.debug("Deleting dns zone groups and azure private endpoints {}", azureGenericResources); azureUtils.deleteGenericResources(client, azureGenericResources.stream().map(CloudResource::getReference).collect(Collectors.toList())); azureGenericResources.forEach(cr -> persistenceNotifier.notifyDeletion(cr, cloudContext)); return findResources(resources, List.of(AZURE_DATABASE)).stream() .map(r -> deleteDatabaseServerAndNotify(r, cloudContext, client, persistenceNotifier, force)) .collect(Collectors.toList()); }
Source:
<code>private boolean autoGroupChanged(final ISPObsComponent oldObsComp, final TargetObsComp oldTOC) { final TargetObsComp newTOC = getDataObject(); if (oldTOC == null || newTOC == null) { return false; } final SPNodeKey oldNodeKey = ImOption.apply(oldObsComp).map(ISPObsComponent::getNodeKey).getOrNull(); final SPNodeKey newNodeKey = ImOption.apply(getNode()).map(ISPObsComponent::getNodeKey).getOrNull(); if (oldNodeKey == null || newNodeKey == null) { return false; } if (!oldNodeKey.equals(newNodeKey)) { return false; } final TargetEnvironment oldEnv = oldTOC.getTargetEnvironment(); final TargetEnvironment newEnv = newTOC.getTargetEnvironment(); final Option<GuideGroup> oldGpOpt = oldEnv.getGroups().headOption().filter(GuideGroup::isAutomatic); <START> final Option<GuideGroup> newGpOpt = newEnv.getGroups().headOption().filter(GuideGroup::isAutomatic); <END> return oldGpOpt.forall(oldGp -> newGpOpt.forall(newGp -> { final List<String> oldNames = oldGp.getTargets().map(SPTarget::getName).toList(); final List<String> newNames = newGp.getTargets().map(SPTarget::getName).toList(); return !(oldNames.size() == newNames.size() && oldNames.containsAll(newNames)); }) ); }</code><technical_language>add a getAutomaticGroup GuideEnvironment do this. GuideEnv a reference automatic group returned. like: scala def getAutomaticGroup: GuideGroup = { GuideGroup(guideEnv.auto) }</technical_language>

Target:
private boolean autoGroupChanged(final ISPObsComponent oldObsComp, final TargetObsComp oldTOC) { final TargetObsComp newTOC = getDataObject(); if (oldTOC == null || newTOC == null) { return false; } final SPNodeKey oldNodeKey = ImOption.apply(oldObsComp).map(ISPObsComponent::getNodeKey).getOrNull(); final SPNodeKey newNodeKey = ImOption.apply(getNode()).map(ISPObsComponent::getNodeKey).getOrNull(); if (oldNodeKey == null || newNodeKey == null) { return false; } if (!oldNodeKey.equals(newNodeKey)) { return false; } final GuideGroup oldAutoGroup = oldTOC.getTargetEnvironment().getGuideEnvironment().automaticGroup(); final GuideGroup newAutoGroup = newTOC.getTargetEnvironment().getGuideEnvironment().automaticGroup(); final Map<GuideProbe,Set<Target>> oldAutoTargets = extractGroupTargets(oldAutoGroup); final Map<GuideProbe,Set<Target>> newAutoTargets = extractGroupTargets(newAutoGroup); return !oldAutoTargets.equals(newAutoTargets); }
Source:
<code>public void testFilterOptionsForConstraintTypeLiteralWhenConstraintValueIsFormula() { when(plugin.constraintValue()).thenReturn(BaseSingleFieldConstraint.TYPE_RET_VALUE); final String[] result = page.filterOptionsForConstraintTypeLiteral(OperatorsOracle.EXPLICIT_LIST_OPERATORS); final List<String> operators = Arrays.asList(result); <START> assertFalse(operators.contains("in")); <END> assertFalse(operators.contains("not in")); assertEquals(0, operators.size()); }</code><technical_language>"contains" assertions necessary? checking operators.size() == 0</technical_language>

Target:
public void testFilterOptionsForConstraintTypeLiteralWhenConstraintValueIsFormula() { when(plugin.constraintValue()).thenReturn(BaseSingleFieldConstraint.TYPE_RET_VALUE); final String[] result = page.filterOptionsForConstraintTypeLiteral(OperatorsOracle.EXPLICIT_LIST_OPERATORS); final List<String> operators = Arrays.asList(result); assertEquals(0, operators.size()); }
Source:
<code>public void shouldReturnErrorOnHostNameWithHttpsProtocolValidation() throws OperationException { String invalidHostname = "<LINK_0>"; <START> ((InputValidator)presenter.hostNameValidator).validate(invalidHostname).getMessage(); <END> verify(constant).invalidHostName(); }</code><technical_language>check message</technical_language>

Target:
public void shouldReturnErrorOnHostNameWithHttpsProtocolValidation() throws OperationException { String invalidHostname = "<LINK_0>"; when(constant.invalidHostName()).thenReturn("ErrorMessage"); String errorMessage = ((InputValidator)presenter.hostNameValidator).validate(invalidHostname).getMessage(); assertEquals("ErrorMessage", errorMessage); }
Source:
<code>private static <T extends SpecificRecord>JavaRDD<T> filterAndParseResultToAvro(JavaRDD<? extends Result> source, ResultApprover resultApprover, OafEntityToAvroConverter<Result, T> entityConverter) { <START> return parseResultToAvro(source.filter(x -> resultApprover.approve(x)), entityConverter); <END> }</code><technical_language>IDE hints replace filter(x -> resultApprover.approve(x)) filter(resultApprover::approve)</technical_language>

Target:
private static <T extends SpecificRecord>JavaRDD<T> filterAndParseResultToAvro(JavaRDD<? extends Result> source, ResultApprover resultApprover, OafEntityToAvroConverter<Result, T> entityConverter) { return parseResultToAvro(source.filter(resultApprover::approve), entityConverter); }
Source:
<code><START> private Boolean isImageInFilteredList(List<Image> images, String expectedImageId) { <END> for (Image image : images) { if (expectedImageId.equals(image.getId())) { return true; } } return false; }</code><technical_language>primitive, sense in returning Object</technical_language>

Target:
private boolean isImageInFilteredList(List<Image> images, String expectedImageId) { for (Image image : images) { if (expectedImageId.equals(image.getId())) { return true; } } return false; }
Source:
<code>public static <K, V> LinkedHashMap<K, V> of(K key, V value) { final HashMap<K, V> map = HashMap.of(key, value); final Queue<Tuple2<K, V>> list = Queue.of(Tuple.of(key, value)); <START> return list.isEmpty() ? empty() : new LinkedHashMap<>(list, map); <END> }</code><technical_language>whooops :-)</technical_language>

Target:
public static <K, V> LinkedHashMap<K, V> of(K key, V value) { final HashMap<K, V> map = HashMap.of(key, value); final Queue<Tuple2<K, V>> list = Queue.of(Tuple.of(key, value)); return new LinkedHashMap<>(list, map); }
Source:
<code><START> void addSegment(LogSegment segment, boolean increaseUsedSegmentCount) { <END> if (increaseUsedSegmentCount) { remainingUnallocatedSegments.decrementAndGet(); } if (LogSegmentNameHelper.COMPARATOR.compare(segment.getName(), activeSegment.getName()) >= 0) { throw new IllegalArgumentException( "Cannot add segments past the current active segment. Active segment is [" + activeSegment.getName() + "]. Tried to add [" + segment.getName() + "]"); } segmentsByName.put(segment.getName(), segment); }</code><technical_language>parameter false in freeSegment()? more sense caller increment decrement add() free() is called</technical_language>

Target:
void addSegment(LogSegment segment, boolean increaseUsedSegmentCount) { if (increaseUsedSegmentCount && remainingUnallocatedSegments.decrementAndGet() < 0) { remainingUnallocatedSegments.incrementAndGet(); throw new IllegalArgumentException("Cannot add any more log segments that contribute to used segment count"); } if (LogSegmentNameHelper.COMPARATOR.compare(segment.getName(), activeSegment.getName()) >= 0) { throw new IllegalArgumentException( "Cannot add segments past the current active segment. Active segment is [" + activeSegment.getName() + "]. Tried to add [" + segment.getName() + "]"); } segmentsByName.put(segment.getName(), segment); }
Source:
<code>private boolean isEntityModelEmpty(EntityModel model) { <START> return !(model.getEntity() != null && !model.getEntity().equals("")); <END> }</code><technical_language>Save null check: !"".equals(model.getEntity())</technical_language>

Target:
private boolean isEntityModelEmpty(EntityModel model) { return !(!"".equals(model.getEntity())); }
Source:
<code>private void subscribeChildChange(String path, NotificationContext.Type callbackType) { if (callbackType == NotificationContext.Type.INIT || callbackType == NotificationContext.Type.CALLBACK) { if (logger.isDebugEnabled()) { logger.debug(_manager.getInstanceName() + " subscribes child-change. path: " + path + ", listener: " + _listener); } <START> if (callbackType == Type.INIT) { <END> _zkClient.subscribeChildChanges(path, this); } else { _zkClient.subscribeChildChanges(path, this, true); } } else if (callbackType == NotificationContext.Type.FINALIZE) { logger.info(_manager.getInstanceName() + " unsubscribe child-change. path: " + path + ", listener: " + _listener); _zkClient.unsubscribeChildChanges(path, this); } }</code><technical_language>need handle INIT differently</technical_language>

Target:
private void subscribeChildChange(String path, NotificationContext.Type callbackType) { if (callbackType == NotificationContext.Type.INIT || callbackType == NotificationContext.Type.CALLBACK) { if (logger.isDebugEnabled()) { logger.debug(_manager.getInstanceName() + " subscribes child-change. path: " + path + ", listener: " + _listener); } ChildrenSubscribeResult childrenSubscribeResult = _zkClient.subscribeChildChanges(path, this, callbackType != Type.INIT); logger.debug("CallbackHandler subscribe data path result {}", this, path, childrenSubscribeResult.isInstalled()); if (!childrenSubscribeResult.isInstalled()) { logger.info("CallbackHandler subscribe data path failed!", this, path); } } else if (callbackType == NotificationContext.Type.FINALIZE) { logger.info(_manager.getInstanceName() + " unsubscribe child-change. path: " + path + ", listener: " + _listener); _zkClient.unsubscribeChildChanges(path, this); } }
Source:
<code>public int moveOperations(final MemcachedNode toNode) { BlockingQueue<Operation> allOp = getAllOperations(); int opCount = allOp.size(); if (opCount > 0) { toNode.addAllOpToInputQ(allOp); <START> getLogger().info("Total %d operations have been moved to %s", allOp.size(), toNode); <END> } return opCount; }</code><technical_language>allOp.size() => opCount</technical_language>

Target:
public int moveOperations(final MemcachedNode toNode) { BlockingQueue<Operation> allOp = getAllOperations(); int opCount = allOp.size(); if (opCount > 0) { toNode.addAllOpToInputQ(allOp); getLogger().info("Total %d operations have been moved to %s", opCount, toNode); } return opCount; }
Source:
<code>public void init() { if (productInfo == null) { GWTServiceLookup.getSystemService().getProductInfo(new AsyncCallback<ProductInfo>() { @Override public void onFailure(Throwable caught) { CoreGUI.getErrorHandler().handleError(MSG.view_aboutBox_failedToLoad(), caught); buildCoreUI(); } @Override public void onSuccess(ProductInfo result) { productInfo = result; <START> isRHQ = (productInfo != null) && "RHQ".equals(productInfo.getShortName()); <END> Window.setTitle(productInfo.getName()); buildCoreUI(); } }); } else { buildCoreUI(); } }</code><technical_language>force is :-)</technical_language>

Target:
public void init() { if (productInfo == null) { GWTServiceLookup.getSystemService().getProductInfo(new AsyncCallback<ProductInfo>() { @Override public void onFailure(Throwable caught) { CoreGUI.getErrorHandler().handleError(MSG.view_aboutBox_failedToLoad(), caught); buildCoreUI(); } @Override public void onSuccess(ProductInfo result) { productInfo = result; rhq = (productInfo != null) && "RHQ".equals(productInfo.getShortName()); Window.setTitle(productInfo.getName()); buildCoreUI(); } }); } else { buildCoreUI(); } }