auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean addGitHubCommitters(Channel channel, User sender, List<String> collaborators, String justForThisRepo) { if (!isSenderAuthorized(channel,sender)) { insufficientPermissionError(channel); return false; } OutputChannel out = channel.send(); if (justForThisRepo == null) { <START> out.message("I'm not longer managing the Everyone team. Please add committers to specific repos."); <END> return false; } int passCount = 0; try { GitHub github = GitHub.connect(); GHOrganization o = github.getOrganization(IrcBotConfig.GITHUB_ORGANIZATION); GHRepository forThisRepo = o.getRepository(justForThisRepo); if (forThisRepo == null) { out.message("Could not find repository: " + justForThisRepo); return false; } for (String collaborator : collaborators) { try { GHUser c = github.getUser(collaborator); final GHTeam t; t = getOrCreateRepoLocalTeam(o, forThisRepo); if (t == null) { out.message("No team for " + justForThisRepo); continue; } t.add(c); out.message("Added "+collaborator+" as a GitHub committer for repository "+justForThisRepo); passCount++; } catch (IOException e) { out.message("Failed to add user '" + collaborator + "' to team: " + e.getMessage()); } } } catch(IOException e) { out.message("Error communicating with GitHub: "+e.getMessage()); } return passCount == collaborators.size(); }</code><technical_language>suggestion out.message("I'm longer managing team. Please add committers specific repos.");</technical_language>

Target:
private boolean addGitHubCommitters(Channel channel, User sender, List<String> collaborators, String justForThisRepo) { if (!isSenderAuthorized(channel,sender)) { insufficientPermissionError(channel); return false; } OutputChannel out = channel.send(); if (justForThisRepo == null) { out.message("I'm no longer managing the Everyone team. Please add committers to specific repos."); return false; } int passCount = 0; try { GitHub github = GitHub.connect(); GHOrganization o = github.getOrganization(IrcBotConfig.GITHUB_ORGANIZATION); GHRepository forThisRepo = o.getRepository(justForThisRepo); if (forThisRepo == null) { out.message("Could not find repository: " + justForThisRepo); return false; } for (String collaborator : collaborators) { try { GHUser c = github.getUser(collaborator); final GHTeam t; t = getOrCreateRepoLocalTeam(o, forThisRepo); if (t == null) { out.message("No team for " + justForThisRepo); continue; } t.add(c); out.message("Added "+collaborator+" as a GitHub committer for repository "+justForThisRepo); passCount++; } catch (IOException e) { out.message("Failed to add user '" + collaborator + "' to team: " + e.getMessage()); } } } catch(IOException e) { out.message("Error communicating with GitHub: "+e.getMessage()); } return passCount == collaborators.size(); }
Source:
<code>private void writeResponse( Exchange exchange, Object response ) { if (response instanceof ServiceResponse ) { ServiceResponse serviceResponse = (ServiceResponse) response; Message message = getResultMessage(exchange); message.setBody( serviceResponse.getResult() ); message.setHeader( KIE_HEADERS_PREFIX + "response.type", serviceResponse.getType() ); <START> message.setHeader( KIE_HEADERS_PREFIX + "response.message", serviceResponse.getMsg() ); <END> } else { getResultMessage(exchange).setBody( response ); } }</code><technical_language>a CamelKieConstants class declaring headers. convention is *camel* case (of :D) for values. CamelKieConstants.RESPONSE_TYPE --> "CamelKieResponseType"</technical_language>

Target:
private void writeResponse( Exchange exchange, Object response ) { if (response instanceof ServiceResponse ) { ServiceResponse serviceResponse = (ServiceResponse) response; Message message = getResultMessage(exchange); message.setBody( serviceResponse.getResult() ); message.setHeader( RESPONSE_TYPE, serviceResponse.getType() ); message.setHeader( RESPONSE_MESSAGE, serviceResponse.getMsg() ); } else { getResultMessage(exchange).setBody( response ); } }
Source:
<code>public SpongeMod() { super(new ModMetadata()); ModContainerFactory.instance().registerContainerType(Type.getType(Plugin.class), SpongePluginContainer.class); this.getMetadata().name = "SpongeAPIMod"; this.getMetadata().modId = "SpongeAPIMod"; SpongeMod.instance = this; <START> this.game = new SpongeGame(); <END> }</code><technical_language>this.game..</technical_language>

Target:
public SpongeMod() { super(new ModMetadata()); ModContainerFactory.instance().registerContainerType(Type.getType(Plugin.class), SpongePluginContainer.class); this.getMetadata().name = "SpongeAPIMod"; this.getMetadata().modId = "SpongeAPIMod"; SpongeMod.instance = this; game = new SpongeGame(); }
Source:
<code>public String getQuestionTypeChoiceOption() { <START> return "<li data-questionType = \"CONTRIB\"><a>" + Const.FeedbackQuestionTypeNames.CONTRIB + "</a></li>"; <END> }</code><technical_language>questionType is shown here, in test files, show questiontype. I data-questiontype instead, consistent test files</technical_language>

Target:
public String getQuestionTypeChoiceOption() { return "<li data-questiontype = \"CONTRIB\"><a>" + Const.FeedbackQuestionTypeNames.CONTRIB + "</a></li>"; }
Source:
<code>public Properties getProperties() { <START> return new Properties(properties); <END> }</code><technical_language>This do :wink: Also, need a copy assigning field construction protect mutation object received</technical_language>

Target:
public Properties getProperties() { return (Properties) properties.clone(); }
Source:
<code>public MambuAPIModule(Protocol protocol, String domain, String username, String password) { this.domain = Preconditions.checkNotNull(domain, "domain cannot be null"); this.username = Preconditions.checkNotNull(username, "username cannot be null"); this.password = Preconditions.checkNotNull(password, "password cannot be null"); <START> this.protocol = Preconditions.checkNotNull(protocol, "protocol cannot be null").name(); <END> }</code><technical_language>want consider making "protocol" line match params order</technical_language>

Target:
public MambuAPIModule(Protocol protocol, String domain, String username, String password) { this.protocol = Preconditions.checkNotNull(protocol, "protocol cannot be null").name(); this.domain = Preconditions.checkNotNull(domain, "domain cannot be null"); this.username = Preconditions.checkNotNull(username, "username cannot be null"); this.password = Preconditions.checkNotNull(password, "password cannot be null"); }
Source:
<code>public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartMessageEvent emptySubprocess = getStartNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, StartMessageEvent.class); assertGeneralSet(emptySubprocess.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); <START> assertMessageEventExecutionSet(emptySubprocess.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, ""); <END> assertDataIOSet(emptySubprocess.getDataIOSet(), EMPTY_VALUE); }</code><technical_language>suggestion assertMessageEventExecutionSet(emptySubprocess.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartMessageEvent emptySubprocess = getStartNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, StartMessageEvent.class); assertGeneralSet(emptySubprocess.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertMessageEventExecutionSet(emptySubprocess.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, EMPTY_VALUE); assertDataIOSet(emptySubprocess.getDataIOSet(), EMPTY_VALUE); }
Source:
<code>public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getUpsertRuntime(IDataSource<String> dataSource, IOperatorSchema inputSchema, IVariableTypeEnvironment typeEnv, List<LogicalVariable> keys, LogicalVariable payLoadVar, List<LogicalVariable> additionalFilterFields, List<LogicalVariable> additionalNonFilteringFields, RecordDescriptor recordDesc, JobGenContext context, JobSpecification jobSpec) throws AlgebricksException { <START> return null; <END> }</code><technical_language>UnsupportedOperationException reasonable here</technical_language>

Target:
public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getUpsertRuntime(IDataSource<String> dataSource, IOperatorSchema inputSchema, IVariableTypeEnvironment typeEnv, List<LogicalVariable> keys, LogicalVariable payLoadVar, List<LogicalVariable> additionalFilterFields, List<LogicalVariable> additionalNonFilteringFields, RecordDescriptor recordDesc, JobGenContext context, JobSpecification jobSpec) throws AlgebricksException { throw new UnsupportedOperationException(); }
Source:
<code>EventFnRoute(Function<E, I> fn) { <START> checkNotNull(fn); this.fn = (e, ctx) -> fn.apply(e); <END> }</code><technical_language>this((e, ctx) -> fn.apply(e)); instead</technical_language>

Target:
EventFnRoute(Function<E, I> fn) { this((e, ctx) -> fn.apply(e)); }
Source:
<code>public List<String> getHeaderFiles() { <START> return Collections.unmodifiableList(Arrays.asList("<unistd.h>")); <END> }</code><technical_language>I get IDE warning suggesting this: suggestion return Collections.unmodifiableList(Collections.singletonList("<unistd.h>"));</technical_language>

Target:
public List<String> getHeaderFiles() { return Collections.unmodifiableList(Collections.singletonList("<unistd.h>")); }
Source:
<code>public void serviceChanged(ServiceEvent event) { ServiceReference serviceRef = event.getServiceReference(); Object service = context.getService(serviceRef); if (service instanceof InjectableAttribute) { <START> int eventType = event.getType(); <END> if (eventType == ServiceEvent.REGISTERED) { registerAttribute(((InjectableAttribute) service).attribute()); } } }</code><technical_language>I eliminate eventType variable, add readability</technical_language>

Target:
public void serviceChanged(ServiceEvent event) { ServiceReference serviceRef = event.getServiceReference(); Object service = context.getService(serviceRef); if (service instanceof InjectableAttribute) { if (event.getType() == ServiceEvent.REGISTERED) { registerAttribute(((InjectableAttribute) service).attribute()); } } }
Source:
<code>public void shouldExposeRocksDBMetricsForSegmentedStateStoreBeforeAndAfterFailureWithEmptyStateDir() throws Exception { final Properties streamsConfiguration = streamsConfig(); IntegrationTestUtils.purgeLocalStreamsState(streamsConfiguration); final StreamsBuilder builder = builderForSegmentedStateStore(); final String metricsScope = "rocksdb-window-state-id"; <START> cleanUpStateRunAndVerify( builder, streamsConfiguration, LongDeserializer.class, LongDeserializer.class, this::verifyThatRocksDBMetricsAreExposed, metricsScope ); cleanUpStateRunAndVerify( builder, streamsConfiguration, LongDeserializer.class, LongDeserializer.class, this::verifyThatRocksDBMetricsAreExposed, metricsScope ); <END> }</code><technical_language>Do I read this right, exact twice</technical_language>

Target:
public void shouldExposeRocksDBMetricsForSegmentedStateStoreBeforeAndAfterFailureWithEmptyStateDir() throws Exception { final Properties streamsConfiguration = streamsConfig(); IntegrationTestUtils.purgeLocalStreamsState(streamsConfiguration); final StreamsBuilder builder = builderForSegmentedStateStore(); final String metricsScope = "rocksdb-window-state-id"; cleanUpStateRunVerifyAndClose( builder, streamsConfiguration, LongDeserializer.class, LongDeserializer.class, this::verifyThatRocksDBMetricsAreExposed, metricsScope ); cleanUpStateRunVerifyAndClose( builder, streamsConfiguration, LongDeserializer.class, LongDeserializer.class, this::verifyThatRocksDBMetricsAreExposed, metricsScope ); }
Source:
<code>public <R> Observable<R> scalarFlatMap(final Func1<? super T, ? extends Observable<? extends R>> func) { return create(new OnSubscribe<R>() { @Override public void call(final Subscriber<? super R> child) { Observable<? extends R> o = func.call(t); if (o.getClass() == ScalarSynchronousObservable.class) { child.onNext(((ScalarSynchronousObservable<? extends R>)o).t); child.onCompleted(); } else { <START> o.subscribe(new Subscriber<R>(child) { <END> @Override public void onNext(R v) { child.onNext(v); } @Override public void onError(Throwable e) { child.onError(e); } @Override public void onCompleted() { child.onCompleted(); } }); } } }); }</code><technical_language>this unsafeSubscribe</technical_language>

Target:
public <R> Observable<R> scalarFlatMap(final Func1<? super T, ? extends Observable<? extends R>> func) { return create(new OnSubscribe<R>() { @Override public void call(final Subscriber<? super R> child) { Observable<? extends R> o = func.call(t); if (o.getClass() == ScalarSynchronousObservable.class) { child.onNext(((ScalarSynchronousObservable<? extends R>)o).t); child.onCompleted(); } else { o.unsafeSubscribe(new Subscriber<R>(child) { @Override public void onNext(R v) { child.onNext(v); } @Override public void onError(Throwable e) { child.onError(e); } @Override public void onCompleted() { child.onCompleted(); } }); } } }); }
Source:
<code>public void sourceNoLongerAdvertised(AdvertisedDataSource source) { try { for (Pair<OutputStream, InputStream> streams : haplist.values()) { if (m_logger.isDebugEnabled()) { m_logger.debug("Flushing " + streams.getFirst() + " for source " + source); } streams.getFirst().flush(); streams.getFirst().close(); streams.getSecond().close(); } haplist.clear(); <START> } catch (IOException e) { <END> m_logger.error("Failed to close writers for " + source, e); } if (m_es != null) { m_es.shutdown(); try { m_es.awaitTermination(365, TimeUnit.DAYS); } catch (InterruptedException e) { throw new RuntimeException(e); } } }</code><technical_language>This for loop failure close socket other sockets close</technical_language>

Target:
public void sourceNoLongerAdvertised(AdvertisedDataSource source) { try { for (Pair<OutputStream, InputStream> streams : haplist.values()) { if (m_logger.isDebugEnabled()) { m_logger.debug("Flushing " + streams.getFirst() + " for source " + source); } try (OutputStream out = streams.getFirst(); InputStream in = streams.getSecond()) { streams.getFirst().flush(); } catch(IOException e) { m_logger.error("Failed to close streams for " + source, e); } } } finally { haplist.clear(); } if (m_es != null) { m_es.shutdown(); try { m_es.awaitTermination(365, TimeUnit.DAYS); } catch (InterruptedException e) { throw new RuntimeException(e); } } }
Source:
<code>public JsonValue getParameters() { <START> return parameters; <END> }</code><technical_language>I benefitial overloads (jsonObject, jsonarray), similar sdk</technical_language>

Target:
JsonValue getParameters() { return parameters; }
Source:
<code>private void updateIndex(Page page) { index.addPage(page); if (spillEnabled) { localRevocableMemoryContext.setBytes(index.getEstimatedSize().toBytes()); } else { long currentMemoryUsage = localUserMemoryContext.getBytes(); if (!localUserMemoryContext.trySetBytes(index.getEstimatedSize().toBytes())) { index.compact(); localUserMemoryContext.setBytes(index.getEstimatedSize().toBytes()); } <START> if (enforceBroadcastMemoryLimit) { <END> operatorContext.getDriverContext().getPipelineContext().getTaskContext().getQueryContext() .updateBroadcastMemory(index.getEstimatedSize().toBytes() - currentMemoryUsage); } } operatorContext.recordOutput(page.getSizeInBytes(), page.getPositionCount()); }</code><technical_language>want do this part of trySetBytes compact index if needed. I recommend overload of trySetbytes setBytes (and tryUpdateBytes updateBytes) takes in a boolean of enforce broadcast limit. Additionally calling full chain of operatorContext.getDriverContext()... here, this done localUserMemoryContext</technical_language>

Target:
private void updateIndex(Page page) { index.addPage(page); if (spillEnabled) { localRevocableMemoryContext.setBytes(index.getEstimatedSize().toBytes()); } else { if (!localUserMemoryContext.trySetBytes(index.getEstimatedSize().toBytes(), enforceBroadcastMemoryLimit)) { index.compact(); localUserMemoryContext.setBytes(index.getEstimatedSize().toBytes(), enforceBroadcastMemoryLimit); } } operatorContext.recordOutput(page.getSizeInBytes(), page.getPositionCount()); }
Source:
<code>public void distributionTarget(JoinQuery query) { final DataSourceWithSegmentSpec distributionTarget = query.getDistributionTarget(); builder.setDimension( "distributionTarget", <START> distributionTarget == null ? "" : DataSourceUtil.getMetricName(distributionTarget.getDataSource()) <END> ); }</code><technical_language>If distribution target is null, sense emit this dimension all</technical_language>

Target:
public void distributionTarget(JoinQuery query) { final DataSourceWithSegmentSpec distributionTarget = query.getDistributionTarget(); Preconditions.checkNotNull(distributionTarget, "distributionTarget"); builder.setDimension( "distributionTarget", DataSourceUtil.getMetricName(distributionTarget.getDataSource()) ); }
Source:
<code>private List<CodeSystemEntry> fetchCodeSystem(ServiceProvider context, String repositoryId) { return CodeSystemRequests.prepareSearchCodeSystem() .all() .build(repositoryId) <START> .execute(context.service(IEventBus.class)) <END> .getSync() .getItems(); }</code><technical_language>Execute search code system request synchronously current context</technical_language>

Target:
private List<CodeSystemEntry> fetchCodeSystem(ServiceProvider context, String repositoryId) { return CodeSystemRequests.prepareSearchCodeSystem() .all() .build(repositoryId) .getRequest() .execute(context) .getItems(); }
Source:
<code>public RemoteTableDescriptor<K, V> withWriteFunction(TableWriteFunction<K, V> writeFn) { Preconditions.checkNotNull(writeFn, "null write function"); this.writeFn = writeFn; <START> this.writeFn.setTableId(String.format("%s.%s", tableId, WRITE_FN)); <END> return this; }</code><technical_language>Is this anywhere</technical_language>

Target:
public RemoteTableDescriptor<K, V> withWriteFunction(TableWriteFunction<K, V> writeFn) { Preconditions.checkNotNull(writeFn, "null write function"); this.writeFn = writeFn; return this; }
Source:
<code>private boolean canCompactTopOfStack(ReftableConfig cfg) throws IOException { ReftableStack stack = refdb.stack(); List<Reftable> readers = stack.readers(); if (readers.isEmpty()) { return false; } int lastIdx = readers.size() - 1; DfsReftable last = stack.files().get(lastIdx); DfsPackDescription desc = last.getPackDescription(); if (desc.getPackSource() != PackSource.INSERT) { return false; } <START> for (PackExt ext : PackExt.values()) { <END> if (ext != REFTABLE && desc.hasFileExt(ext)) { return false; } } Reftable table = readers.get(lastIdx); int bs = cfg.getRefBlockSize(); return table instanceof ReftableReader && ((ReftableReader) table).size() <= 3 * bs; }</code><technical_language>This puzzling. Extracting a "packOnlyContainsReftable()" function clearer</technical_language>

Target:
private boolean canCompactTopOfStack(ReftableConfig cfg) throws IOException { ReftableStack stack = refdb.stack(); List<Reftable> readers = stack.readers(); if (readers.isEmpty()) { return false; } int lastIdx = readers.size() - 1; DfsReftable last = stack.files().get(lastIdx); DfsPackDescription desc = last.getPackDescription(); if (desc.getPackSource() != PackSource.INSERT || !packOnlyContainsReftable(desc)) { return false; } Reftable table = readers.get(lastIdx); int bs = cfg.getRefBlockSize(); return table instanceof ReftableReader && ((ReftableReader) table).size() <= 3 * bs; }
Source:
<code>pushLanguageConnectionContextFromActivation(Activation activation, ContextManager cm) throws StandardException { boolean lccPushed = false; try { LanguageConnectionContext currentLCC = ConnectionUtil.getCurrentLCC(); if (activation != null && activation.getLanguageConnectionContext() != null) { LanguageConnectionContext lcc = activation.getLanguageConnectionContext(); if (lcc != currentLCC) { <START> cm.pushContext(activation.getLanguageConnectionContext()); <END> lccPushed = true; } } } catch (SQLException e) { if (activation != null && activation.getLanguageConnectionContext() != null) { lccPushed = true; cm.pushContext(activation.getLanguageConnectionContext()); } } return lccPushed; }</code><technical_language>pushContext(lcc)</technical_language>

Target:
pushLanguageConnectionContextFromActivation(Activation activation, ContextManager cm) throws StandardException { boolean lccPushed = false; try { LanguageConnectionContext currentLCC = ConnectionUtil.getCurrentLCC(); if (activation != null && activation.getLanguageConnectionContext() != null) { LanguageConnectionContext lcc = activation.getLanguageConnectionContext(); if (lcc != currentLCC) { cm.pushContext(lcc); lccPushed = true; } } } catch (SQLException e) { if (activation != null && activation.getLanguageConnectionContext() != null) { lccPushed = true; cm.pushContext(activation.getLanguageConnectionContext()); } } return lccPushed; }
Source:
<code>public <T> T flopAndFail(String msg) { try { fail(msg); } catch (Throwable t) { asyncErrors.add(t); <START> fail(msg); <END> } return null; }</code><technical_language>throw t</technical_language>

Target:
public <T> T flopAndFail(String msg) { try { fail(msg); } catch (Throwable t) { asyncErrors.add(t); fail(msg, t); } return null; }
Source:
<code>private URI toURI(IPath path) { URI baseURI = getWorkingDirectoryURI(); String uriString = path.toString(); <START> if (path.isAbsolute() && uriString.charAt(0) != IPath.SEPARATOR) <END> uriString = IPath.SEPARATOR + uriString; return EFSExtensionManager.getDefault().createNewURIFromPath(baseURI, uriString); }</code><technical_language>Please bring braces back</technical_language>

Target:
private URI toURI(IPath path) { URI baseURI = getWorkingDirectoryURI(); String uriString = path.toString(); if (path.isAbsolute() && uriString.charAt(0) != IPath.SEPARATOR) { uriString = IPath.SEPARATOR + uriString; } return EFSExtensionManager.getDefault().createNewURIFromPath(baseURI, uriString); }
Source:
<code>public void setTaskContext(TaskContext taskContext) { id = taskContext.getParameters() .map( p -> p.get( "id" ) ) .map( Integer.class::cast ) .orElseThrow( () -> new RuntimeException( "missing parameter 'id'" ) ); title = taskContext.getParameters() .map( p -> p.get( "title" ) ) .map( String.class::cast ) <START> .orElseThrow( () -> new RuntimeException( "missing parameter 'title'" ) ); <END> }</code><technical_language>nice a similar behaviour of js file: __resultSetProcedure.js__. In term of write read data a real cache</technical_language>

Target:
public void setTaskContext(TaskContext taskContext) { cache = (Cache<Object, Object>) taskContext.getCache() .orElseThrow( () -> new RuntimeException( "missing cache" ) ); id = taskContext.getParameters() .map( p -> p.get( "id" ) ) .map( Integer.class::cast ) .orElseThrow( () -> new RuntimeException( "missing parameter 'id'" ) ); title = taskContext.getParameters() .map( p -> p.get( "title" ) ) .map( String.class::cast ) .orElseThrow( () -> new RuntimeException( "missing parameter 'title'" ) ); }
Source:
<code>public void setExcludeFirstHeading() { IncludeMacroParameters parameters = new IncludeMacroParameters(); parameters.setExcludeFirstHeading(true); <START> assertSame(true, parameters.excludeFirstHeading()); <END> }</code><technical_language>practice. care if object.... This is a boolean, need test for equality. assertTrue..</technical_language>

Target:
public void setExcludeFirstHeading() { IncludeMacroParameters parameters = new IncludeMacroParameters(); parameters.setExcludeFirstHeading(true); assertTrue(parameters.isExcludeFirstHeading()); }
Source:
<code>public Result authenticate(Request request, ContentResponse response, HeaderInfo headerInfo, Attributes attributes) { URI requestUri = request.getURI(); String servicePrincipal = makeServicePrincipal(remoteServiceName, requestUri.getHost()); GSSContext context = doAs(loginContext.getSubject(), () -> { GSSContext result = GSS_MANAGER.createContext( GSS_MANAGER.createName(servicePrincipal, null), SPNEGO_OID, clientCredential, INDEFINITE_LIFETIME); result.requestMutualAuth(true); result.requestConf(true); result.requestInteg(true); result.requestCredDeleg(false); return result; }); try { byte[] token = context.initSecContext(new byte[0], 0, 0); if (token == null) { <START> throw new AuthenticationException(format("Failed to establish GSSContext for request %s", requestUri)); <END> } return new SpnegoResult( UriUtil.normalizedUri(requestUri), headerInfo.getHeader(), format("%s %s", NEGOTIATE, Base64.getEncoder().encodeToString(token))); } catch (GSSException e) { throw new AuthenticationException(format("Failed to establish GSSContext for request %s", requestUri), e); } finally { try { context.dispose(); } catch (GSSException e) { } } }</code><technical_language>making this exception message a one. Suggested: token generated GSSContext for request %s</technical_language>

Target:
public Result authenticate(Request request, ContentResponse response, HeaderInfo headerInfo, Attributes attributes) { URI requestUri = request.getURI(); String servicePrincipal = makeServicePrincipal(remoteServiceName, requestUri.getHost()); GSSContext context = doAs(loginContext.getSubject(), () -> { GSSContext result = GSS_MANAGER.createContext( GSS_MANAGER.createName(servicePrincipal, null), SPNEGO_OID, clientCredential, INDEFINITE_LIFETIME); result.requestMutualAuth(true); result.requestConf(true); result.requestInteg(true); result.requestCredDeleg(false); return result; }); try { byte[] token = context.initSecContext(new byte[0], 0, 0); if (token == null) { throw new AuthenticationException(format("No token generated from GSSContext for request %s", requestUri)); } return new SpnegoResult( UriUtil.normalizedUri(requestUri), headerInfo.getHeader(), format("%s %s", NEGOTIATE, Base64.getEncoder().encodeToString(token))); } catch (GSSException e) { throw new AuthenticationException(format("Failed to establish GSSContext for request %s", requestUri), e); } finally { try { context.dispose(); } catch (GSSException e) { } } }
Source:
<code>public void setUp() { if (CASE_DIRECTORY_PATH.toFile().exists()) { try { FileUtils.deleteDirectory(CASE_DIRECTORY_PATH.toFile()); } catch (IOException ex) { Exceptions.printStackTrace(ex); Assert.fail(ex); } } assertFalse("Unable to delete existing test directory", CASE_DIRECTORY_PATH.toFile().exists()); CASE_DIRECTORY_PATH.toFile().mkdirs(); assertTrue("Unable to create test directory", CASE_DIRECTORY_PATH.toFile().exists()); try { Case.createAsCurrentCase(Case.CaseType.SINGLE_USER_CASE, CASE_DIRECTORY_PATH.toString(), new CaseDetails(CASE_NAME)); } catch (CaseActionException ex) { Exceptions.printStackTrace(ex); Assert.fail(ex); } assertTrue(CASE_DIR.exists()); ImageDSProcessor dataSourceProcessor = new ImageDSProcessor(); try { ProcessorCallback callBack = DataSourceProcessorRunner.runDataSourceProcessor(dataSourceProcessor, IMAGE_PATH); List<Content> dataSourceContent = callBack.getDataSourceContent(); assertEquals(1, dataSourceContent.size()); List<String> errorMessages = callBack.getErrorMessages(); <START> assertEquals(0, errorMessages.size()); <END> } catch (AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException | InterruptedException ex) { Exceptions.printStackTrace(ex); Assert.fail(ex); } }</code><technical_language>assertEquals includes a message argument log a failure reason instead of exceptions stack trace</technical_language>

Target:
public void setUp() { if (CASE_DIRECTORY_PATH.toFile().exists()) { try { FileUtils.deleteDirectory(CASE_DIRECTORY_PATH.toFile()); } catch (IOException ex) { Exceptions.printStackTrace(ex); Assert.fail(ex); } } assertFalse(String.format("Unable to delete existing test directory '%s'.", CASE_DIRECTORY_PATH.toString()), CASE_DIRECTORY_PATH.toFile().exists()); CASE_DIRECTORY_PATH.toFile().mkdirs(); assertTrue(String.format("Unable to create test directory '%s'.", CASE_DIRECTORY_PATH.toString()), CASE_DIRECTORY_PATH.toFile().exists()); try { Case.createAsCurrentCase(Case.CaseType.SINGLE_USER_CASE, CASE_DIRECTORY_PATH.toString(), new CaseDetails(CASE_NAME)); } catch (CaseActionException ex) { Exceptions.printStackTrace(ex); Assert.fail(ex); } assertTrue(CASE_DIR.exists()); ImageDSProcessor dataSourceProcessor = new ImageDSProcessor(); try { ProcessorCallback callBack = DataSourceProcessorRunner.runDataSourceProcessor(dataSourceProcessor, IMAGE_PATH); List<Content> dataSourceContentList = callBack.getDataSourceContent(); String errorMessage = String.format("The data source processor callback should produce 1 data source Content object, but the actual count was %d.", dataSourceContentList.size()); assertEquals(errorMessage, 1, dataSourceContentList.size()); List<String> callbackErrorMessageList = callBack.getErrorMessages(); errorMessage = String.format("The data source processor callback produced %d error messages.", callbackErrorMessageList.size()); assertEquals(errorMessage, 0, callbackErrorMessageList.size()); } catch (AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException | InterruptedException ex) { Exceptions.printStackTrace(ex); Assert.fail(ex); } }
Source:
<code>public void doTable(Parse table) { super.doTable(table); if(counts.wrong == 0 && counts.exceptions == 0) { <START> table.parts.more = this.getSummary(); <END> } }</code><technical_language>Similar here: summary is added end is replacing existing rows</technical_language>

Target:
public void doTable(Parse table) { super.doTable(table); table.parts.last().more = getSummary(); }
Source:
<code>public void dispose () { if (parent != null && !parent.isDisposed()) { for (int <START> element : <END> EVENTS) { parent.removeListener (element, controlListener); } ScrollBar hBar = parent.getHorizontalBar (); if (hBar != null) hBar.removeListener (SWT.Selection, scrollbarListener); ScrollBar vBar = parent.getVerticalBar (); if (vBar != null) vBar.removeListener (SWT.Selection, scrollbarListener); } parent = null; editor = null; hadFocus = false; controlListener = null; scrollbarListener = null; }</code><technical_language>rename event</technical_language>

Target:
public void dispose () { if (parent != null && !parent.isDisposed()) { for (int event : EVENTS) { parent.removeListener (event, controlListener); } ScrollBar hBar = parent.getHorizontalBar (); if (hBar != null) hBar.removeListener (SWT.Selection, scrollbarListener); ScrollBar vBar = parent.getVerticalBar (); if (vBar != null) vBar.removeListener (SWT.Selection, scrollbarListener); } parent = null; editor = null; hadFocus = false; controlListener = null; scrollbarListener = null; }
Source:
<code>protected Command doGetCommand(Request request, EditPart targetEditPart) { boolean canHandle = false; if (!(targetEditPart instanceof DiagramEditPart) && !(targetEditPart instanceof CompartmentEditPart)) { if (request instanceof DropObjectsRequest && !getSourceEObjects(request).isEmpty()) { List<Collaboration> droppedProtocols = getSourceEObjects(request).stream().filter(Collaboration.class::isInstance) .map(Collaboration.class::cast) .collect(Collectors.toList()); if <START> (droppedProtocols != null && <END> !droppedProtocols.isEmpty()) { canHandle = canDrop(droppedProtocols); } } } return canHandle ? super.doGetCommand(request, targetEditPart) : null; }</code><technical_language>null, construction</technical_language>

Target:
protected Command doGetCommand(Request request, EditPart targetEditPart) { boolean canHandle = false; if (!(targetEditPart instanceof DiagramEditPart) && !(targetEditPart instanceof CompartmentEditPart)) { if (request instanceof DropObjectsRequest && !getSourceEObjects(request).isEmpty()) { List<Collaboration> droppedProtocols = getSourceEObjects(request).stream().filter(Collaboration.class::isInstance) .map(Collaboration.class::cast) .collect(Collectors.toList()); if (!droppedProtocols.isEmpty()) { canHandle = canDrop(droppedProtocols); } } } return canHandle ? super.doGetCommand(request, targetEditPart) : null; }
Source:
<code>private List<LicensedComponent> createLicensedComponents() { final List<LicensedComponent> components = new ArrayList<>(); try { components.add(LicensedComponent.create("DMDirc", getLicences(FileUtils .getPathForResource(getClass().getResource("/com/dmdirc/licences"))))); pluginManager.getPluginInfos().forEach(p -> { final List<Licence> componentLicences = getLicences( <START> p.getPath("/META-INF/licenses/")); <END> if (!componentLicences.isEmpty()) { components.add(LicensedComponent .create(p.getMetaData().getFriendlyName(), componentLicences)); } } ); } catch (URISyntaxException ex) { LOGGER.warn("Unable to create component", ex); } return components; }</code><technical_language>licences is misspelled - intentional</technical_language>

Target:
private List<LicensedComponent> createLicensedComponents() { final List<LicensedComponent> components = new ArrayList<>(); try { components.add(LicensedComponent.create("DMDirc", getLicences(FileUtils .getPathForResource(getClass().getResource("/com/dmdirc/licences"))))); pluginManager.getPluginInfos().forEach(p -> { final List<Licence> componentLicences = getLicences( p.getPath("/META-INF/licences/")); if (!componentLicences.isEmpty()) { components.add(LicensedComponent .create(p.getMetaData().getFriendlyName(), componentLicences)); } } ); } catch (URISyntaxException ex) { LOGGER.warn("Unable to create component", ex); } return components; }
Source:
<code>public static String getMessagesFromThrowable(Throwable t){ final StringBuilder buf = new StringBuilder(); if (t.getLocalizedMessage() != null) { buf.append(t.getLocalizedMessage()); } else { buf.append(t.getClass().getName()); } Throwable t1 = t.getCause(); while (t1 != null) { if (t1.getLocalizedMessage() != null) { buf.append(": ").append(t1.getLocalizedMessage()); } else { buf.append(": ").append(t1.getClass().getName()); } t1 = t1.getCause(); } for (Throwable suppressed : t.getSuppressed()) { <START> buf.append("\n").append(suppressed.getLocalizedMessage()); <END> } return buf.toString(); }</code><technical_language>this some sort of explanatory text suppressed exceptions? do for getCause() handling, 2 types of extra information get more confusing? this recursive:? buf.append("\n").append(getMessagesFromThrowable(suppressed)); If if (t1.getLocalizedMessage() != null) { ... } else {...} handling do above? getLocalizedMessage() null if details provided exception constructor</technical_language>

Target:
public static String getMessagesFromThrowable(Throwable t){ final StringBuilder buf = new StringBuilder(); if (t.getLocalizedMessage() != null) { buf.append(t.getLocalizedMessage()); } else { buf.append(t.getClass().getName()); } Throwable t1 = t.getCause(); while (t1 != null) { if (t1.getLocalizedMessage() != null) { buf.append(": ").append(t1.getLocalizedMessage()); } else { buf.append(": ").append(t1.getClass().getName()); } t1 = t1.getCause(); } for (Throwable suppressed : t.getSuppressed()) { if (suppressed.getLocalizedMessage() != null) { buf.append("\n").append(suppressed.getLocalizedMessage()); } else { buf.append("\n").append(suppressed.getClass().getName()); } } return buf.toString(); }
Source:
<code><START> public static File createOutputFile(File folderFile, String fileName, String prefix) throws IOException { <END> if (folderFile == null) { throw new IllegalArgumentException("Incorrect path to folder."); } if (fileName == null || fileName.trim().isEmpty()) { throw new IllegalArgumentException("Incorrect file name"); } if (prefix == null) { throw new IllegalArgumentException("Incorrect prefix is used"); } StringBuilder resultPath = new StringBuilder(); resultPath.append(folderFile.getAbsoluteFile().getAbsolutePath()) .append(File.separator) .append(prefix); String extension = getExtension(fileName, resultPath); return createOutputFile(resultPath.toString(), extension, 0); }</code><technical_language>remove</technical_language>

Target:
public static File createOutputFile(File folderFile, String fileName, String prefix) { if (folderFile == null) { throw new IllegalArgumentException("Incorrect path to folder."); } if (fileName == null || fileName.trim().isEmpty()) { throw new IllegalArgumentException("Incorrect file name"); } if (prefix == null) { throw new IllegalArgumentException("Incorrect prefix is used"); } StringBuilder resultPath = new StringBuilder(); resultPath.append(folderFile.getAbsoluteFile().getAbsolutePath()) .append(File.separator) .append(prefix); String extension = getExtension(fileName, resultPath); return createOutputFile(resultPath.toString(), extension, 0); }
Source:
<code>public static void setSchemaSupplier(Supplier<AvroSchemaHolder> factory) { if (threadSchemaSupplierFactory == null) { threadSchemaSupplierFactory = new ThreadLocal<Supplier<AvroSchemaHolder>>(); } <START> if (LazyAvroCoder.threadSchemaSupplierFactory.get() != null) { <END> throw BeamAdapterErrorCode.createSchemaSupplierAlreadyExists(null, threadSchemaSupplierFactory.get().toString()); } threadSchemaSupplierFactory.set(factory); }</code><technical_language>else if if if block LazyAvroCoder.threadSchemaSupplierFactory.get() return null</technical_language>

Target:
public static void setSchemaSupplier(Supplier<AvroSchemaHolder> factory) { if (threadSchemaSupplierFactory == null) { threadSchemaSupplierFactory = new ThreadLocal<Supplier<AvroSchemaHolder>>(); } else if (LazyAvroCoder.threadSchemaSupplierFactory.get() != null) { throw BeamAdapterErrorCode.createSchemaSupplierAlreadyExists(null, threadSchemaSupplierFactory.get().toString()); } threadSchemaSupplierFactory.set(factory); }
Source:
<code>private NMFTrainer(final ParameterWorker<Integer, Vector, Vector> parameterWorker, final VectorFactory vectorFactory, @Parameter(Rank.class) final int rank, @Parameter(StepSize.class) final double stepSize, @Parameter(Lambda.class) final double lambda, @Parameter(DecayRate.class) final double decayRate, @Parameter(DecayPeriod.class) final int decayPeriod, @Parameter(Parameters.MiniBatchSize.class) final int miniBatchSize, @Parameter(PrintMatrices.class) final boolean printMatrices, final NMFModelGenerator modelGenerator, final MemoryStore<Long> memoryStore, final TrainingDataProvider<Long, NMFData> trainingDataProvider, final MetricsMsgSender<WorkerMetrics> metricsMsgSender) { this.parameterWorker = parameterWorker; this.vectorFactory = vectorFactory; this.rank = rank; this.stepSize = stepSize; this.lambda = lambda; this.decayRate = decayRate; <START> if (decayRate < 0.0 || decayRate > 1.0) { <END> throw new RuntimeException("decay_rate must be a value between 0 and 1"); } this.decayPeriod = decayPeriod; if (decayPeriod < 0) { throw new RuntimeException("decay_period must a non-negative value"); } this.miniBatchSize = miniBatchSize; this.printMatrices = printMatrices; this.modelGenerator = modelGenerator; this.memoryStore = memoryStore; this.trainingDataProvider = trainingDataProvider; this.metricsMsgSender = metricsMsgSender; this.rMatrix = Maps.newHashMap(); this.gradients = Maps.newHashMap(); this.pushTracer = new Tracer(); this.pullTracer = new Tracer(); this.computeTracer = new Tracer(); }</code><technical_language>allows 0.0 1.0. means for decay rate</technical_language>

Target:
private NMFTrainer(final ParameterWorker<Integer, Vector, Vector> parameterWorker, final VectorFactory vectorFactory, @Parameter(Rank.class) final int rank, @Parameter(StepSize.class) final double stepSize, @Parameter(Lambda.class) final double lambda, @Parameter(DecayRate.class) final double decayRate, @Parameter(DecayPeriod.class) final int decayPeriod, @Parameter(Parameters.MiniBatchSize.class) final int miniBatchSize, @Parameter(PrintMatrices.class) final boolean printMatrices, final NMFModelGenerator modelGenerator, final MemoryStore<Long> memoryStore, final TrainingDataProvider<Long, NMFData> trainingDataProvider, final MetricsMsgSender<WorkerMetrics> metricsMsgSender) { this.parameterWorker = parameterWorker; this.vectorFactory = vectorFactory; this.rank = rank; this.stepSize = stepSize; this.lambda = lambda; this.decayRate = decayRate; if (decayRate <= 0.0 || decayRate > 1.0) { throw new IllegalArgumentException("decay_rate must be larger than 0 and less than or equal to 1"); } this.decayPeriod = decayPeriod; if (decayPeriod <= 0) { throw new IllegalArgumentException("decay_period must be a positive value"); } this.miniBatchSize = miniBatchSize; this.printMatrices = printMatrices; this.modelGenerator = modelGenerator; this.memoryStore = memoryStore; this.trainingDataProvider = trainingDataProvider; this.metricsMsgSender = metricsMsgSender; this.rMatrix = Maps.newHashMap(); this.gradients = Maps.newHashMap(); this.pushTracer = new Tracer(); this.pullTracer = new Tracer(); this.computeTracer = new Tracer(); }
Source:
<code>public void testAddSubrepoWithDirNoGitlinks() throws Exception { createNestedRepo("nested-repo"); StoredConfig config = db.getConfig(); config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_DIRNOGITLINKS, true); config.save(); assert (db.getConfig().get(WorkingTreeOptions.KEY).isDirNoGitLinks()); try (Git git = new Git(db)) { git.add().addFilepattern("nested-repo").call(); assertEquals( "[nested-repo/README1.md, mode:100644]" + "[nested-repo/README2.md, mode:100644]", indexState(0)); } config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_DIRNOGITLINKS, false); config.save(); <START> File readme3 = new File(db.getWorkTree(), "nested-repo/README3.md"); FileUtils.createNewFile(readme3); PrintWriter writer = new PrintWriter(readme3); writer.print("content"); writer.close(); <END> try (Git git = new Git(db)) { git.add().addFilepattern("nested-repo").call(); assertEquals( "[nested-repo/README1.md, mode:100644]" + "[nested-repo/README2.md, mode:100644]" + "[nested-repo/README3.md, mode:100644]", indexState(0)); } }</code><technical_language>writeTrashFile shorten this: File readme3 = writeTrashFile("nested-repo", "README3.md", "content");</technical_language>

Target:
public void testAddSubrepoWithDirNoGitlinks() throws Exception { createNestedRepo("nested-repo"); StoredConfig config = db.getConfig(); config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_DIRNOGITLINKS, true); config.save(); assert (db.getConfig().get(WorkingTreeOptions.KEY).isDirNoGitLinks()); try (Git git = new Git(db)) { git.add().addFilepattern("nested-repo").call(); assertEquals( "[nested-repo/README1.md, mode:100644]" + "[nested-repo/README2.md, mode:100644]", indexState(0)); } config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_DIRNOGITLINKS, false); config.save(); writeTrashFile("nested-repo", "README3.md", "content"); try (Git git = new Git(db)) { git.add().addFilepattern("nested-repo").call(); assertEquals( "[nested-repo/README1.md, mode:100644]" + "[nested-repo/README2.md, mode:100644]" + "[nested-repo/README3.md, mode:100644]", indexState(0)); } }
Source:
<code>protected void onBindDialogView(View view) { super.onBindDialogView(view); listView = (FilterListView) view.findViewById(android.R.id.list); clickedItemIndex = findIndexOfValue(mValue); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { <START> clickedItemIndex = findIndexByLabel((String) parent.getItemAtPosition(position)); <END> LocationListPreference.this.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); getDialog().dismiss(); } } ); listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); CheckedItemAdapter adapter = new CheckedItemAdapter( getContext(), android.R.layout.simple_list_item_single_choice, android.R.id.text1, getEntries() ); listView.setAdapter(adapter); clickedItemIndex = findIndexOfValue(getPersistedString(null)); listView.setSelection(clickedItemIndex); listView.setItemChecked(clickedItemIndex, true); listView.setTextFilterEnabled(true); listView.setFilterListener( new Filter.FilterListener() { @Override public void onFilterComplete(int count) { int index = findIndexByLabelInFilteredListView(getPersistedString(null)); listView.setItemChecked(index, true); } } ); EditText editText = (EditText) view.findViewById(R.id.filter); editText.addTextChangedListener( new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable editable) { listView.setFilterText(editable.toString()); } } ); editText.requestFocus(); }</code><technical_language>If LocationListPreference implements OnItemClickListener lines cleaner. do think</technical_language>

Target:
protected void onBindDialogView(View view) { super.onBindDialogView(view); listView = (FilterListView) view.findViewById(android.R.id.list); clickedItemIndex = findIndexOfValue(mValue); listView.setOnItemClickListener(this); listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); final CheckedItemAdapter adapter = new CheckedItemAdapter( getContext(), android.R.layout.simple_list_item_single_choice, android.R.id.text1, getEntries() ); listView.setAdapter(adapter); clickedItemIndex = findIndexOfValue(getPersistedString(null)); listView.setSelection(clickedItemIndex); listView.setItemChecked(clickedItemIndex, true); final Filter.FilterListener filterListener = new Filter.FilterListener() { @Override public void onFilterComplete(int count) { int index = findIndexByLabelInFilteredListView(getPersistedString(null)); listView.setItemChecked(index, true); } }; SearchView cityNameSearchView = (SearchView) view.findViewById(R.id.filter); cityNameSearchView.setOnQueryTextListener( new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { adapter.getFilter().filter(newText, filterListener); return true; } } ); cityNameSearchView.requestFocus(); }
Source:
<code>public void whenPropertyIsVerySimpleThenTypeInfoIsCorrect() { PropertyMetaModel bert = new PropertyMetaModel(null, "bert", int.class, Optional.empty(), false, false, false, false); assertEquals("int", bert.getTypeName()); <START> assertEquals("int", bert.getTypeNameGenericsed()); <END> assertEquals("int", bert.getTypeNameForGetter()); assertEquals("int", bert.getTypeNameForSetter()); }</code><technical_language>assertEquals("int", bert.getTypeNameGenericsed()); sed stand for? GenericSeed GenericSet</technical_language>

Target:
public void whenPropertyIsVerySimpleThenTypeInfoIsCorrect() { PropertyMetaModel bert = new PropertyMetaModel(null, "bert", int.class, Optional.empty(), false, false, false, false); assertEquals("int", bert.getTypeName()); assertEquals("int", bert.getTypeNameGenerified()); assertEquals("int", bert.getTypeNameForGetter()); assertEquals("int", bert.getTypeNameForSetter()); }
Source:
<code>public void dispose() { session.removeListener(this); SessionManager.INSTANCE.removeSessionsListener(this); session = null; treeViewer = null; manageSessionActionProvider = null; siriusCommonContentModelProvider = null; <START> menuManager = null; <END> }</code><technical_language>good set null toolkit</technical_language>

Target:
public void dispose() { session.removeListener(this); SessionManager.INSTANCE.removeSessionsListener(this); session = null; treeViewer = null; manageSessionActionProvider = null; siriusCommonContentModelProvider = null; menuManager = null; toolkit = null; }