auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public SslCertResponse uploadSslCert(final UploadSslCertCmd certCmd) { <END> try { final String cert = certCmd.getCert(); final String key = certCmd.getKey(); final String password = certCmd.getPassword(); final String chain = certCmd.getChain(); validate(cert, key, password, chain); s_logger.debug("Certificate Validation succeeded"); final String fingerPrint = generateFingerPrint(parseCertificate(cert)); final CallContext ctx = CallContext.current(); final Account caller = ctx.getCallingAccount(); Account owner = null; if (certCmd.getAccountName() != null && certCmd.getDomainId() != null || certCmd.getProjectId() != null) { owner = _accountMgr.finalizeOwner(caller, certCmd.getAccountName(), certCmd.getDomainId(), certCmd.getProjectId()); } else { owner = caller; } final Long accountId = owner.getId(); final Long domainId = owner.getDomainId(); final SslCertVO certVO = new SslCertVO(cert, key, password, chain, accountId, domainId, fingerPrint); _sslCertDao.persist(certVO); return createCertResponse(certVO, null); } catch (final Exception e) { throw new CloudRuntimeException("Error parsing certificate data " + e.getMessage()); } }</code><technical_language>Please consider adding a Preconditions.checkArgument check certCmd is null</technical_language>

Target:
public SslCertResponse uploadSslCert(final UploadSslCertCmd certCmd) { Preconditions.checkNotNull(certCmd); final String cert = certCmd.getCert(); final String key = certCmd.getKey(); final String password = certCmd.getPassword(); final String chain = certCmd.getChain(); validate(cert, key, password, chain); s_logger.debug("Certificate Validation succeeded"); final String fingerPrint = CertificateHelper.generateFingerPrint(parseCertificate(cert)); final CallContext ctx = CallContext.current(); final Account caller = ctx.getCallingAccount(); Account owner = null; if (!Strings.isNullOrEmpty(certCmd.getAccountName()) && certCmd.getDomainId() != null || certCmd.getProjectId() != null) { owner = _accountMgr.finalizeOwner(caller, certCmd.getAccountName(), certCmd.getDomainId(), certCmd.getProjectId()); } else { owner = caller; } final Long accountId = owner.getId(); final Long domainId = owner.getDomainId(); final SslCertVO certVO = new SslCertVO(cert, key, password, chain, accountId, domainId, fingerPrint); _sslCertDao.persist(certVO); return createCertResponse(certVO, null); }
Source:
<code><START> public Map<String, String> serializeJetpackParams() { <END> Map<String, String> params = new HashMap<>(); params.put(JP_MONITOR_ACTIVE_KEY, String.valueOf(mSettings.monitorActive)); params.put(JP_MONITOR_EMAIL_NOTES_KEY, String.valueOf(mSettings.emailNotifications)); params.put(JP_MONITOR_WP_NOTES_KEY, String.valueOf(mSettings.wpNotifications)); return params; }</code><technical_language>private here</technical_language>

Target:
private Map<String, String> serializeJetpackParams() { Map<String, String> params = new HashMap<>(); params.put(JP_MONITOR_ACTIVE_KEY, String.valueOf(mSettings.monitorActive)); params.put(JP_MONITOR_EMAIL_NOTES_KEY, String.valueOf(mSettings.emailNotifications)); params.put(JP_MONITOR_WP_NOTES_KEY, String.valueOf(mSettings.wpNotifications)); return params; }
Source:
<code><START> public String[] getDetailedLoad() { <END> return null; }</code><technical_language>do return fDetailedLoad; if is null for</technical_language>

Target:
public Map<String,String> getDetailedLoad() { return fDetailedLoad; }
Source:
<code>public void testToJSONFunctionExtension3() throws InterruptedException { log.info("ToJSONFunctionExtension TestCase with test attributeExpressionExecutors length"); SiddhiManager siddhiManager = new SiddhiManager(); siddhiManager.setExtension("str:concat", ConcatFunctionExtension.class); String inStreamDefinition = "\ndefine stream inputStream (symbol string, price long, volume long);"; String query = ("@info(name = 'query1') from inputStream select " + "map:createFromJSON(\"{'symbol':'WSO2','price':100,'volume':100,'last5val':{'price':150,'volume':200}}\") as hashMap insert into outputStream;" + "from outputStream " + "select map:toJSON() as jsonString " + "insert into outputStream2"); ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query); <START> InputHandler inputHandler = executionPlanRuntime.getInputHandler("inputStream"); <END> executionPlanRuntime.start(); executionPlanRuntime.shutdown(); }</code><technical_language>lines needed. createExecutionplanRuntime throw exception</technical_language>

Target:
public void testToJSONFunctionExtension3() throws InterruptedException { log.info("ToJSONFunctionExtension TestCase with test attributeExpressionExecutors length"); SiddhiManager siddhiManager = new SiddhiManager(); siddhiManager.setExtension("str:concat", ConcatFunctionExtension.class); String inStreamDefinition = "\ndefine stream inputStream (symbol string, price long, volume long);"; String query = ("@info(name = 'query1') from inputStream select " + "map:createFromJSON(\"{'symbol':'WSO2','price':100,'volume':100,'last5val':{'price':150,'volume'" + ":200}}\") as hashMap insert into outputStream;" + "from outputStream " + "select map:toJSON() as jsonString " + "insert into outputStream2"); ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query); executionPlanRuntime.start(); executionPlanRuntime.shutdown(); }
Source:
<code>public void testJvmtiAgentAppExternal() throws Exception { runJvmtiAgentLoadTest((ITestDevice device, String pkg, String apk, String abiName) -> { try { <START> String pwd = device.executeShellCommand( "run-as " + pkg + " --user " + mCurrentUser + " pwd"); if (pwd == null) { throw new RuntimeException("pwd failed"); } pwd = pwd.trim(); if (pwd.isEmpty()) { throw new RuntimeException("pwd failed"); } <END> String libInDataData = AGENT.substring(0, AGENT.length() - ".so".length()) + "2.so"; String agentInDataData = installLibToDataData(device, pkg, abiName, apk, pwd, AGENT, libInDataData); String setAgentAppCmd = "cmd activity set-agent-app " + pkg + " " + agentInDataData; device.executeShellCommand(setAgentAppCmd); } catch (Exception e) { throw new RuntimeException("Failed running set-agent-app", e); } try { runAttachTestCmd(device, pkg, ""); runAttachTestCmd(device, pkg, ""); } catch (Exception e) { throw new RuntimeException("Failed agent-app attaching", e); } }); }</code><technical_language>factor out of 'pwd'</technical_language>

Target:
public void testJvmtiAgentAppExternal() throws Exception { runJvmtiAgentLoadTest((ITestDevice device, String pkg, String apk, String abiName) -> { try { String pwd = getPwd(device, pkg); String libInDataData = AGENT.substring(0, AGENT.length() - ".so".length()) + "2.so"; String agentInDataData = installLibToDataData(device, pkg, abiName, apk, pwd, AGENT, libInDataData); String setAgentAppCmd = "cmd activity set-agent-app " + pkg + " " + agentInDataData; device.executeShellCommand(setAgentAppCmd); } catch (Exception e) { throw new RuntimeException("Failed running set-agent-app", e); } try { runAttachTestCmd(device, pkg, ""); runAttachTestCmd(device, pkg, ""); } catch (Exception e) { throw new RuntimeException("Failed agent-app attaching", e); } }); }
Source:
<code>public void selectPhotosOnly() { <START> filterPhotos.click(); <END> }</code><technical_language>log()</technical_language>

Target:
public void selectPhotosOnly() { filterPhotos.click(); PageObjectLogging.log("selectPhotosOnly", "Photos option is selected", true, driver); }
Source:
<code>public <T, ASSERT extends AbstractAssert<?, ?>> ASSERT extracting(Function<? super ACTUAL, T> extractor, InstanceOfAssertFactory<?, ASSERT> assertFactory) { <START> return extracting(extractor, this::newObjectAssert).asInstanceOf(assertFactory); <END> }</code><technical_language>I assume this be: java return extracting(extractor, assertFactory); is, create ObjectAssert map a assert type</technical_language>

Target:
public <T, ASSERT extends AbstractAssert<?, ?>> ASSERT extracting(Function<? super ACTUAL, T> extractor, InstanceOfAssertFactory<?, ASSERT> assertFactory) { return super.extracting(extractor, this::newObjectAssert).asInstanceOf(assertFactory); }
Source:
<code>public GenieResourceHttpRequestHandler(final DirectoryWriter directoryWriter, final JobFileService jobFileService) { super(); this.directoryWriter = directoryWriter; this.jobFileService = jobFileService; <START> try { <END> this.jobFileService.createJobDirectory(V4_MOCK_JOB_ID); } catch (final IOException ioe) { log.error( "Unable to create V4 placeholder job directory. All requests for V4 output will return 404.", ioe ); } }</code><technical_language>create empty stdout stderr kinda part of contract files exist. API, downstream crawlers *assume* exist, wrong normally</technical_language>

Target:
public GenieResourceHttpRequestHandler(final DirectoryWriter directoryWriter, final JobFileService jobFileService) { super(); this.directoryWriter = directoryWriter; this.jobFileService = jobFileService; try { this.jobFileService.createJobDirectory(V4_MOCK_JOB_ID); this.jobFileService.updateFile(V4_MOCK_JOB_ID, JobConstants.STDOUT_LOG_FILE_NAME, 0L, new byte[0]); this.jobFileService.updateFile(V4_MOCK_JOB_ID, JobConstants.STDERR_LOG_FILE_NAME, 0L, new byte[0]); this.jobFileService.updateFile(V4_MOCK_JOB_ID, JobConstants.GENIE_JOB_LAUNCHER_SCRIPT, 0L, new byte[0]); } catch (final IOException ioe) { log.error( "Unable to create V4 placeholder job directory. All requests for V4 output will return 404.", ioe ); } }
Source:
<code>public Set<String> committers() { <START> return getCommitters(build); <END> }</code><technical_language>extract this logic a separate class? worried BuildView is a already</technical_language>

Target:
public Set<String> committers() { return buildCulpritsRetriever.getCommitters(build); }
Source:
<code>private boolean isOwn() { return (reviewitem != null) && (reviewitem.getReview() != null) && (reviewitem.getReview().getRepository() != null) <START> && (reviewitem.getReview().getRepository() != null) <END> && (reviewitem.getReview().getRepository().getTaskRepository() != null) && (reviewitem.getReview() .getRepository() .getTaskRepository() .getCredentials(AuthenticationType.REPOSITORY) != null) && (reviewitem.getReview() .getRepository() .getTaskRepository() .getCredentials(AuthenticationType.REPOSITORY) .getUserName() .compareTo(currentAuthor) == 0); }</code><technical_language>dup lines</technical_language>

Target:
private boolean isOwn() { return (reviewitem != null) && (reviewitem.getReview() != null) && (reviewitem.getReview().getRepository() != null) && (reviewitem.getReview().getRepository().getTaskRepository() != null) && (reviewitem.getReview() .getRepository() .getTaskRepository() .getCredentials(AuthenticationType.REPOSITORY) != null) && (reviewitem.getReview() .getRepository() .getTaskRepository() .getCredentials(AuthenticationType.REPOSITORY) .getUserName() .compareTo(currentAuthor) == 0); }
Source:
<code>public void recycleAttributes(long ts) { <START> fPoolAttributes.entrySet().stream().forEach(e <END> -> { NonNullUtils.checkNotNull(e.getKey()).recycle(e.getValue(), ts); }); }</code><technical_language>stream? entrySet is iterable</technical_language>

Target:
public void recycleAttributes(long ts) { fPoolAttributes.entrySet().forEach(e -> { NonNullUtils.checkNotNull(e.getKey()).recycle(e.getValue(), ts); }); }
Source:
<code>private void updateEventMask() { if (this.status == ACTIVE && (this.endOfStream || this.sslEngine.isInboundDone())) { this.status = CLOSING; } if (this.status == CLOSING && !this.outEncrypted.hasData()) { this.sslEngine.closeOutbound(); final int n = this.outboundClosedCount.incrementAndGet(); <START> if (n > 5) { <END> this.status = CLOSED; } } if (this.status == CLOSING && this.sslEngine.isOutboundDone() && (this.endOfStream || this.sslEngine.isInboundDone())) { this.status = CLOSED; } if (this.status <= CLOSING && this.endOfStream && this.sslEngine.getHandshakeStatus() == HandshakeStatus.NEED_UNWRAP) { this.status = CLOSED; } if (this.status == CLOSED) { this.session.close(); if (disconnectedCallback != null) { disconnectedCallback.execute(this); } return; } final int oldMask = this.session.getEventMask(); int newMask = oldMask; switch (this.sslEngine.getHandshakeStatus()) { case NEED_WRAP: newMask = EventMask.READ_WRITE; break; case NEED_UNWRAP: newMask = EventMask.READ; break; case NOT_HANDSHAKING: newMask = this.appEventMask; break; case NEED_TASK: break; case FINISHED: break; } if (this.endOfStream) { newMask = newMask & ~EventMask.READ; } if (this.outEncrypted.hasData()) { newMask = newMask | EventMask.WRITE; } if (oldMask != newMask) { this.session.setEventMask(newMask); } }</code><technical_language>Stupid question, 5 from? this a static final int</technical_language>

Target:
private void updateEventMask() { if (this.status == ACTIVE && (this.endOfStream || this.sslEngine.isInboundDone())) { this.status = CLOSING; } if (this.status == CLOSING && !this.outEncrypted.hasData()) { this.sslEngine.closeOutbound(); this.outboundClosedCount.incrementAndGet(); } if (this.status == CLOSING && this.sslEngine.isOutboundDone() && (this.endOfStream || this.sslEngine.isInboundDone())) { this.status = CLOSED; } if (this.status <= CLOSING && this.endOfStream && this.sslEngine.getHandshakeStatus() == HandshakeStatus.NEED_UNWRAP) { this.status = CLOSED; } if (this.status == CLOSED) { this.session.close(); if (disconnectedCallback != null) { disconnectedCallback.execute(this); } return; } final int oldMask = this.session.getEventMask(); int newMask = oldMask; switch (this.sslEngine.getHandshakeStatus()) { case NEED_WRAP: newMask = EventMask.READ_WRITE; break; case NEED_UNWRAP: newMask = EventMask.READ; break; case NOT_HANDSHAKING: newMask = this.appEventMask; break; case NEED_TASK: break; case FINISHED: break; } if (this.endOfStream && !this.inPlain.hasData()) { newMask = newMask & ~EventMask.READ; } if (this.outEncrypted.hasData()) { newMask = newMask | EventMask.WRITE; } if (oldMask != newMask) { this.session.setEventMask(newMask); } }
Source:
<code>public Object execute(ExecutionEvent aEvent) throws ExecutionException { GerritTableView reviewTableView = GerritTableView.getActiveView(); <START> GerritUi.Ftracer.traceInfo(NLS.bind(Messages.AllReviewsHandler_executeCommand, <END> GerritQuery.QUERY_ALL_ABANDONED_CHANGES)); reviewTableView.processCommands(GerritQuery.QUERY_ALL_ABANDONED_CHANGES); return null; }</code><technical_language>Strings displayed users internationalized</technical_language>

Target:
public Object execute(ExecutionEvent aEvent) throws ExecutionException { GerritTableView reviewTableView = GerritTableView.getActiveView(); reviewTableView.processCommands(GerritQuery.QUERY_ALL_ABANDONED_CHANGES); return null; }
Source:
<code>static HttpClient createFixed(HttpClientConfig httpClientConfig) { if (httpClientConfig.getConfigs() == null) { throw new IllegalArgumentException("HttpClientConfig is null"); } <START> Integer maxIdleConnectionTimeoutInMillis = 60 * 1000; <END> if (httpClientConfig.getMaxIdleConnectionTimeoutInMillis() != null) { maxIdleConnectionTimeoutInMillis = httpClientConfig.getMaxIdleConnectionTimeoutInMillis(); } Integer maxPoolSize = 500; if (httpClientConfig.getMaxPoolSize() != null) { maxPoolSize = httpClientConfig.getMaxPoolSize(); } int connectionAcquireTimeoutInMillis = 45 * 1000; ConnectionProvider fixedConnectionProvider = ConnectionProvider.fixed(httpClientConfig.getConfigs().getReactorNettyConnectionPoolName(), maxPoolSize, connectionAcquireTimeoutInMillis, Duration.ofMillis(maxIdleConnectionTimeoutInMillis)); return ReactorNettyClient.createWithConnectionProvider(fixedConnectionProvider, httpClientConfig); }</code><technical_language>defined constant</technical_language>

Target:
static HttpClient createFixed(HttpClientConfig httpClientConfig) { if (httpClientConfig.getConfigs() == null) { throw new IllegalArgumentException("HttpClientConfig is null"); } Integer maxIdleConnectionTimeoutInMillis = httpClientConfig.getConfigs().getMaxIdleConnectionTimeoutInMillis(); if (httpClientConfig.getMaxIdleConnectionTimeoutInMillis() != null) { maxIdleConnectionTimeoutInMillis = httpClientConfig.getMaxIdleConnectionTimeoutInMillis(); } Integer maxPoolSize = httpClientConfig.getConfigs().getReactorNettyMaxConnectionPoolSize(); if (httpClientConfig.getMaxPoolSize() != null) { maxPoolSize = httpClientConfig.getMaxPoolSize(); } int connectionAcquireTimeoutInMillis = httpClientConfig.getConfigs().getConnectionAcquireTimeoutInMillis(); ConnectionProvider fixedConnectionProvider = ConnectionProvider.fixed(httpClientConfig.getConfigs().getReactorNettyConnectionPoolName(), maxPoolSize, connectionAcquireTimeoutInMillis, Duration.ofMillis(maxIdleConnectionTimeoutInMillis)); return ReactorNettyClient.createWithConnectionProvider(fixedConnectionProvider, httpClientConfig); }
Source:
<code>protected void writeValue( VarValueDef value) { ConditionWriter conditionWriter = new ConditionWriter( value.getCondition()); xmlWriter_.writeElement( VALUE_TAG, MapBuilder .of( NAME_ATR, String.valueOf( value.getName())) <START> .putIf( FAILURE_ATR, Optional.ofNullable( value.getType() == FAILURE? "true" : null)) <END> .putIf( ONCE_ATR, Optional.ofNullable( value.getType() == ONCE? "true" : null)) .putIf( WHEN_ATR, conditionWriter.getWhenAttribute()) .putIf( PROPERTY_ATR, propertyList( toStream( value.getProperties().getProperties()))) .build(), () -> { writeAnnotations( value); conditionWriter.writeWhenElement(); }); }</code><technical_language>I avoid creating new Optionals pass arguments. More this</technical_language>

Target:
protected void writeValue( VarValueDef value) { ConditionWriter conditionWriter = new ConditionWriter( value.getCondition()); xmlWriter_ .element( VALUE_TAG) .attribute( NAME_ATR, String.valueOf( value.getName())) .attributeIf( value.getType() == FAILURE, FAILURE_ATR, "true") .attributeIf( value.getType() == ONCE, ONCE_ATR, "true") .attributeIf( WHEN_ATR, conditionWriter.getWhenAttribute()) .attributeIf( PROPERTY_ATR, propertyList( toStream( value.getProperties().getProperties()))) .content( () -> { writeAnnotations( value); conditionWriter.writeWhenElement(); }) .write(); }
Source:
<code>public void remove() { <START> throw new RuntimeException("Removal of records not implemented."); <END> }</code><technical_language>UnsupportedOperationException</technical_language>

Target:
public void remove() { throw new UnsupportedOperationException("Removal of records not implemented."); }
Source:
<code>protected void onUpdateElement(Rule oldElement, Rule element) throws IllegalArgumentException { String uid = element.getUID(); ruleEngine.updateRule(element, (disabledRulesStorage != null && disabledRulesStorage.get(uid) == null)); String templateUID = element.getTemplateUID(); if (templateUID != null) { synchronized (this) { Set<String> ruleUIDs = mapTemplateToRules.get(templateUID); if (ruleUIDs != null) { ruleUIDs.remove(uid); } } } <START> postRuleUpdatedEvent(element, oldElement); <END> }</code><technical_language>move updated</technical_language>

Target:
protected void onUpdateElement(Rule oldElement, Rule element) throws IllegalArgumentException { String uid = element.getUID(); ruleEngine.updateRule(element, (disabledRulesStorage != null && disabledRulesStorage.get(uid) == null)); String templateUID = element.getTemplateUID(); if (templateUID != null) { synchronized (this) { Set<String> ruleUIDs = mapTemplateToRules.get(templateUID); if (ruleUIDs != null) { ruleUIDs.remove(uid); } } } }
Source:
<code>private void refreshPackages(Bundle[] bundles, BundleContext context) { if (bundles.length == 0 || packageAdminService == null) { return; } CountDownLatch latch = new CountDownLatch(1); <START> <END> FrameworkListener listener = event -> { if (event.getType() == FrameworkEvent.PACKAGES_REFRESHED) { latch.countDown(); } }; context.addFrameworkListener(listener); packageAdminService.refreshPackages(bundles); try { latch.await(); } catch (InterruptedException e) { } context.removeFrameworkListener(listener); }</code><technical_language>This is preserving logic method is handled bundles p2 installed, for loop search for other bundles installed possibly add refreshed if BSN</technical_language>

Target:
private void refreshPackages(Bundle[] bundles, BundleContext context) { if (bundles.length == 0 || packageAdminService == null) return; CountDownLatch latch = new CountDownLatch(1); Set<Bundle> allSameBSNs = new LinkedHashSet<>(); for (Bundle bundle : bundles) { allSameBSNs.add(bundle); String bsn = bundle.getSymbolicName(); if (bsn != null) { Bundle[] sameBSNs = packageAdminService.getBundles(bsn, null); if (sameBSNs != null) { allSameBSNs.addAll(Arrays.asList(sameBSNs)); } } } final boolean[] flag = new boolean[] {false}; FrameworkListener listener = event -> { if (event.getType() == FrameworkEvent.PACKAGES_REFRESHED) { latch.countDown(); } }; context.addFrameworkListener(listener); packageAdminService.refreshPackages(allSameBSNs.toArray(new Bundle[0])); try { latch.await(); } catch (InterruptedException e) { } context.removeFrameworkListener(listener); }
Source:
<code>public ExecResponse create() throws Exception { try { session = acquire(execConnection()); Command output = session.exec(checkNotNull(command, "command")); String outputString = IOUtils.readFully(output.getInputStream()).toString(); output.join(sshClientConnection.getSessionTimeout(), TimeUnit.MILLISECONDS); <START> int errorStatus = output.getExitStatus() != null ? output.getExitStatus() : -1; <END> String errorString = IOUtils.readFully(output.getErrorStream()).toString(); return new ExecResponse(outputString, errorString, errorStatus); } finally { clear(); } }</code><technical_language>Move logic [ExecResponse constructor](<LINK_0> This approach ssh driver agnostic</technical_language>

Target:
public ExecResponse create() throws Exception { try { session = acquire(execConnection()); Command output = session.exec(checkNotNull(command, "command")); String outputString = IOUtils.readFully(output.getInputStream()).toString(); output.join(sshClientConnection.getSessionTimeout(), TimeUnit.MILLISECONDS); String errorString = IOUtils.readFully(output.getErrorStream()).toString(); return new ExecResponse(outputString, errorString, output.getExitStatus()); } finally { clear(); } }
Source:
<code><START> public void getPatientIdentifiers_shouldGetByPatients() { <END> List<Patient> patients = Arrays.asList( hibernatePatientDAO.getPatient(6), hibernatePatientDAO.getPatient(7) ); List<PatientIdentifier> identifiers = hibernatePatientDAO .getPatientIdentifiers(null, emptyList(), emptyList(), patients, null); List<Integer> identifierIds = identifiers.stream().map(identifier -> identifier.getId()) .collect(Collectors.toList()); Assert.assertEquals(2, identifiers.size()); Assert.assertEquals(true, identifierIds.contains(3)); Assert.assertEquals(true, identifierIds.contains(4)); }</code><technical_language>@vixus0 left other TODO in I think, if this is test for</technical_language>

Target:
public void getPatientIdentifiers_shouldGetByPatients() { List<Patient> patients = Arrays.asList( hibernatePatientDao.getPatient(6), hibernatePatientDao.getPatient(7) ); List<PatientIdentifier> identifiers = hibernatePatientDao .getPatientIdentifiers(null, emptyList(), emptyList(), patients, null); List<Integer> identifierIds = identifiers.stream().map(identifier -> identifier.getId()) .collect(Collectors.toList()); Assert.assertEquals(2, identifiers.size()); Assert.assertThat(identifierIds, hasItems(3, 4)); }
Source:
<code>public ResponseEntity harvestConfigurationMetadata(@RequestBody String configurationMetadataJsonPayload) { try { logger.debug(configurationMetadataJsonPayload); List<ConfigurationMetaData> configurationMetaDataList = this.mapper.readValue(configurationMetadataJsonPayload , mapper.getTypeFactory().constructCollectionType(List.class, ConfigurationMetaDataImpl.class)); this.configurationMetaDataBatchInsert.insert(configurationMetaDataList); } catch (Exception e) { <START> e.printStackTrace(); <END> throw new ResponseStatusException( HttpStatus.BAD_REQUEST, "An error has occurred attempting to perform a batch insert of ConfigurationMetaData!", e); } return new ResponseEntity("Configuration metadata successfully captured!", HttpStatus.OK); }</code><technical_language>is need print stacktrace is passed RsponseStatusException</technical_language>

Target:
public ResponseEntity harvestConfigurationMetadata(@RequestBody String configurationMetadataJsonPayload) { try { logger.debug(configurationMetadataJsonPayload); List<ConfigurationMetaData> configurationMetaDataList = this.mapper.readValue(configurationMetadataJsonPayload , mapper.getTypeFactory().constructCollectionType(List.class, ConfigurationMetaDataImpl.class)); this.configurationMetaDataBatchInsert.insert(configurationMetaDataList); } catch (Exception e) { throw new ResponseStatusException( HttpStatus.BAD_REQUEST, "An error has occurred attempting to perform a batch insert of ConfigurationMetaData!", e); } return new ResponseEntity("Configuration metadata successfully captured!", HttpStatus.OK); }
Source:
<code>public void test_evaluateAllDecisionsOnInputDataStringModel() { DMNContext dmnContext = dmnClient.newContext(); dmnContext.set( "Full Name", "John Doe" ); ServiceResponse<DMNResult> evaluateAllDecisions = dmnClient.evaluateAllDecisions(CONTAINER_1_ID, "<LINK_0>", "input-data-string", dmnContext); <START> <END> DMNResult dmnResult = evaluateAllDecisions.getResult(); assertThat( dmnResult.getDecisionResults().size(), is( 1 ) ); assertThat( dmnResult.getDecisionResultByName( "Greeting Message" ).getResult(), is( "Hello John Doe" ) ); DMNContext result = dmnResult.getContext(); assertThat( result.get( "Greeting Message" ), is( "Hello John Doe" ) ); }</code><technical_language>@tarilabs I check ServiceResponse succeeded other assertions. helps quickly narrow environment issues test suddenly starts failing for apparent reason</technical_language>

Target:
public void test_evaluateAllDecisionsOnInputDataStringModel() { DMNContext dmnContext = dmnClient.newContext(); dmnContext.set( "Full Name", "John Doe" ); ServiceResponse<DMNResult> evaluateAllDecisions = dmnClient.evaluateAllDecisions(CONTAINER_1_ID, "<LINK_0>", "input-data-string", dmnContext); assertEquals(ResponseType.SUCCESS, evaluateAllDecisions.getType()); DMNResult dmnResult = evaluateAllDecisions.getResult(); assertThat( dmnResult.getDecisionResults().size(), is( 1 ) ); assertThat( dmnResult.getDecisionResultByName( "Greeting Message" ).getResult(), is( "Hello John Doe" ) ); DMNContext result = dmnResult.getContext(); assertThat( result.get( "Greeting Message" ), is( "Hello John Doe" ) ); }
Source:
<code>public ClusterExecutor executor() { <START> if (!started) { <END> throw new IllegalStateException("CacheManager must be started before retrieving a ClusterExecutor!"); } JGroupsTransport transport = (JGroupsTransport) globalComponentRegistry.getComponent(Transport.class); if (transport != null) { long time = getCacheManagerConfiguration().transport().distributedSyncTimeout(); return new ClusterExecutorImpl(null, transport, time, TimeUnit.MILLISECONDS, globalComponentRegistry.getComponent(ExecutorService.class, KnownComponentNames.REMOTE_COMMAND_EXECUTOR)); } else { return new ClusterExecutorImpl(null, null, -1, TimeUnit.MILLISECONDS, ForkJoinPool.commonPool()); } }</code><technical_language>do "started" field check status of GCR</technical_language>

Target:
public ClusterExecutor executor() { if (globalComponentRegistry.getStatus() != ComponentStatus.RUNNING) { throw new IllegalStateException("CacheManager must be started before retrieving a ClusterExecutor!"); } JGroupsTransport transport = (JGroupsTransport) globalComponentRegistry.getComponent(Transport.class); if (transport != null) { long time = getCacheManagerConfiguration().transport().distributedSyncTimeout(); return new ClusterExecutorImpl(null, this, transport, time, TimeUnit.MILLISECONDS, globalComponentRegistry.getComponent(ExecutorService.class, KnownComponentNames.REMOTE_COMMAND_EXECUTOR)); } else { return new ClusterExecutorImpl(null, this, null, -1, TimeUnit.MILLISECONDS, ForkJoinPool.commonPool()); } }
Source:
<code>public boolean add(XWikiAttachment attachment) { <START> map.put(attachment.getFilename(), attachment); <END> this.list = new ArrayList<XWikiAttachment>(map.values()); onUpdate(); added(attachment); return true; }</code><technical_language>of method is a duplicate of #set() reuse instead</technical_language>

Target:
public boolean add(XWikiAttachment attachment) { XWikiAttachment set = set(attachment); return set != attachment; }
Source:
<code>public synchronized void load() throws IOException { UpdateSite defaultSite = new UpdateSite(LEGACY_ID_DEFAULT, config.getUpdateCenterUrl() + "update-center.json"); <START> XmlFile file = getConfigFile(); <END> if(file.exists()) { try { sites.replaceBy(((PersistedList)file.unmarshal(sites)).toList()); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load "+file, e); } for (UpdateSite site : sites) { if (site.isLegacyDefault()) { sites.remove(site); sites.add(defaultSite); break; } } } else { if (sites.isEmpty()) { sites.add(defaultSite); } } }</code><technical_language>I for creating a protected method creates UpdateSite default id (obtained system property) configuration arguments. This allows subclasses override creation. LEGACY_ID_DEFAULT referenced in UpdateSite#isLegacyDefault, it</technical_language>

Target:
public synchronized void load() throws IOException { XmlFile file = getConfigFile(); if(file.exists()) { try { sites.replaceBy(((PersistedList)file.unmarshal(sites)).toList()); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load "+file, e); } boolean defaultSiteExists = false; for (UpdateSite site : sites) { if (site.isLegacyDefault()) { sites.remove(site); } else if (ID_DEFAULT.equals(site.getId())) { defaultSiteExists = true; } } if (!defaultSiteExists) { sites.add(createDefaultUpdateSite()); } } else { if (sites.isEmpty()) { sites.add(createDefaultUpdateSite()); } } }
Source:
<code>public PatientProgram savePatientProgram(PatientProgram patientProgram) throws DAOException { if (patientProgram.getPatientProgramId() == null) { sessionFactory.getCurrentSession().save(patientProgram); } else { sessionFactory.getCurrentSession().merge(patientProgram); } <START> CustomDatatypeUtil.saveAttributesIfNecessary(patientProgram); <END> return patientProgram; }</code><technical_language>this done patientProgram is saved, instead of after</technical_language>

Target:
public PatientProgram savePatientProgram(PatientProgram patientProgram) throws DAOException { CustomDatatypeUtil.saveAttributesIfNecessary(patientProgram); if (patientProgram.getPatientProgramId() == null) { sessionFactory.getCurrentSession().save(patientProgram); } else { sessionFactory.getCurrentSession().merge(patientProgram); } return patientProgram; }
Source:
<code>public Collection<PatchSetApproval> currentApprovals(Provider<ReviewDb> db) throws OrmException { if (currentApprovals == null) { Change c = change(db); if (c == null) { currentApprovals = Collections.emptyList(); } else if (approvals != null) { currentApprovals = approvalsMap(db).get(c.currentPatchSetId()); if (currentApprovals == null) { <START> currentApprovals = Collections.emptyList(); <END> } } else { currentApprovals = db.get().patchSetApprovals() .byPatchSet(c.currentPatchSetId()).toList(); } } return currentApprovals; }</code><technical_language>want put in Map</technical_language>

Target:
public Collection<PatchSetApproval> currentApprovals(Provider<ReviewDb> db) throws OrmException { if (currentApprovals == null) { Change c = change(db); if (c == null) { currentApprovals = Collections.emptyList(); } else if (approvals != null) { Map<Id, Collection<PatchSetApproval>> map = approvalsMap(db); currentApprovals = map.get(c.currentPatchSetId()); if (currentApprovals == null) { currentApprovals = Collections.emptyList(); map.put(c.currentPatchSetId(), currentApprovals); } } else { currentApprovals = db.get().patchSetApprovals() .byPatchSet(c.currentPatchSetId()).toList(); } } return currentApprovals; }
Source:
<code>public void clearSort() { <START> ColumnSortInfo columnSortInfo2 = new ColumnSortInfo(null, false); <END> SSDataGrid.this.dataGrid.getColumnSortList().push(columnSortInfo2); }</code><technical_language>please a variable name. describes this does. Is a difference columnSortInfo columnSortInfo2</technical_language>

Target:
public void clearSort() { ColumnSortInfo columnSortInfo = new ColumnSortInfo(null, false); SSDataGrid.this.dataGrid.getColumnSortList().push(columnSortInfo); }
Source:
<code>public void deactivate() { <START> logger.debug("deactivate"); <END> smlDevices.clear(); }</code><technical_language>remove</technical_language>

Target:
public void deactivate() { smlDevices.clear(); }
Source:
<code>protected boolean isCookieSecure(final HttpServletRequest request, CookieConfig config) { boolean configSecure = config.isSecure(); Resolver<Boolean> resolver = getSecureCookieRequired(); boolean resolverSecure = resolver.get(request, null); boolean likelyLocalhost = resolver instanceof SecureRequiredExceptForLocalhostResolver; boolean warnable = !configSecure || (!resolverSecure && !likelyLocalhost); if (!secureWarned && warnable) { secureWarned = true; String msg = "INSECURE IDENTITY COOKIE CONFIGURATION: Your current Stormpath SDK account cookie " + "configuration allows insecure identity cookies (transmission over non-HTTPS connections)! " + "This should never occur on staging/production machines otherwise your users will be " + <START> "susceptible to man-in-the-middle attacks. If you see this warning on a development-only " + <END> "machine, you can likely safely ignore this message. For more information in Servlet-only " + "environments, please see the Security Notice here: " + "<LINK_4> and the " + "documentation on authentication state here: " + "<LINK_3> and here: " + "<LINK_5> (the " + "callout entitled 'Secure Cookies'). If you are using Spring Boot, Spring Boot-specific " + "documentation for these concepts are here: " + "<LINK_0> " + "<LINK_2> and " + "<LINK_1>"; log.warn(msg); } return configSecure && resolverSecure; }</code><technical_language>In a development environment _not_ localhost, situation account cookie set. sentence out</technical_language>

Target:
protected boolean isCookieSecure(final HttpServletRequest request, CookieConfig config) { boolean configSecure = config.isSecure(); Resolver<Boolean> resolver = getSecureCookieRequired(); boolean resolverSecure = resolver.get(request, null); boolean likelyLocalhost = resolver instanceof SecureRequiredExceptForLocalhostResolver; boolean warnable = !configSecure || (!resolverSecure && !likelyLocalhost); if (!secureWarned && warnable) { secureWarned = true; String msg = "INSECURE IDENTITY COOKIE CONFIGURATION: Your current Stormpath SDK account cookie " + "configuration allows insecure identity cookies (transmission over non-HTTPS connections)! " + "This should typically never occur otherwise your users will be " + "susceptible to man-in-the-middle attacks. For more information in Servlet-only " + "environments, please see the Security Notice here: " + "<LINK_4> and the " + "documentation on authentication state here: " + "<LINK_3> and here: " + "<LINK_5> (the " + "callout entitled 'Secure Cookies'). If you are using Spring Boot, Spring Boot-specific " + "documentation for these concepts are here: " + "<LINK_0> " + "<LINK_2> and " + "<LINK_1>"; log.warn(msg); } return configSecure && resolverSecure; }
Source:
<code>public static String getJar() { <START> final String command = getCommand(); <END> if (command != null) { final String[] segments = command.split(" "); if (segments.length >= 1) { if (segments[0].endsWith(".jar")) { return segments[0]; } } } else { String classpath = System.getProperty("java.class.path"); if (!classpath.isEmpty() && !classpath.contains(File.pathSeparator) && classpath.endsWith(".jar")) { return classpath; } } return null; }</code><technical_language>I getFirstSegmentOfCommand () in class achieve thing</technical_language>

Target:
public static String getJar() { String segment = getFirstSegmentOfCommand(); if (segment != null && segment.endsWith(".jar")) { return segment; } else { String classpath = System.getProperty("java.class.path"); if (!classpath.isEmpty() && !classpath.contains(File.pathSeparator) && classpath.endsWith(".jar")) { return classpath; } } return null; }
Source:
<code>protected void executeCommand() { List<VM> vms = runInternalQuery(VdcQueryType.GetVmsByStorageDomain, new IdQueryParameters(getStorageDomain().getId())) .getReturnValue(); Map<Guid, Guid> vmIdSnapshotIdMap = new HashMap<>(); for (VM vm : vms) { CreateAllSnapshotsFromVmParameters param = new CreateAllSnapshotsFromVmParameters(vm.getId(), vm.getName() + getStorageDomain().getName() + DR_SNAPSHOT_NAME_SUFFIX, false, vm.getDiskList()); Guid createdSnapshotId = runInternalAction(VdcActionType.CreateAllSnapshotsFromVm, param).getActionReturnValue(); vmIdSnapshotIdMap.put(vm.getId(), createdSnapshotId); } getParameters().setVmIdSnapshotIds(vmIdSnapshotIdMap); persistCommandIfNeeded(); if (getSession().getStatus() != GeoRepSessionStatus.ACTIVE) { Future<VdcReturnValueBase> geoRepCmd = CommandCoordinatorUtil.executeAsyncCommand(VdcActionType.StartGlusterVolumeGeoRep, new GlusterVolumeGeoRepSessionParameters(getSession().getMasterVolumeId(), getSession().getId()), cloneContext()); VdcReturnValueBase result; try { result = geoRepCmd.get(); if (!result.getSucceeded()) { propagateFailure(result); setSucceeded(false); return; } } catch (InterruptedException | ExecutionException e) { log.error("Exception", e); setSucceeded(false); return; } } GlusterVolumeGeoRepSessionConfigParameters configParams = new GlusterVolumeGeoRepSessionConfigParameters(getSession().getMasterVolumeId(), getSession().getId(), "checkpoint", <START> "now"); <END> VdcReturnValueBase result = runInternalAction(VdcActionType.SetGeoRepConfig, configParams); if (!result.getSucceeded()) { propagateFailure(result); return; } setSucceeded(true); }</code><technical_language>part of GlusterConstants</technical_language>

Target:
protected void executeCommand() { setSucceeded(false); List<VM> vms = runInternalQuery(VdcQueryType.GetVmsByStorageDomain, new IdQueryParameters(getStorageDomain().getId())) .getReturnValue(); Map<Guid, Guid> vmIdSnapshotIdMap = new HashMap<>(); for (VM vm : vms) { try { Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.CreateAllSnapshotsFromVm, getCreateSnapshotParameters(vm), cloneContextAndDetachFromParent()); vmIdSnapshotIdMap.put(vm.getId(), future.get().getActionReturnValue()); } catch (InterruptedException | ExecutionException e) { log.error("Error creating VM snapshots for DR sync", e.getMessage()); log.debug("Exception", e); endWithFailure(); getParameters().setTaskGroupSuccess(false); } } getParameters().setVmIdSnapshotIds(vmIdSnapshotIdMap); getParameters().setNextStep(DRStep.GEO_REP); persistCommandIfNeeded(); setSucceeded(true); }
Source:
<code><START> public static void loadFile(ScoreBoard scoreBoard, File f) throws Exception{ <END> JSONObject json = new JSONObject(FileUtils.readFileToString(f, "utf-8")); List<ScoreBoardJSONSetter.JSONSet> jsl = new ArrayList<>(); JSONObject state = json.getJSONObject("state"); for (String key: state.keySet()) { Object value = state.get(key); String v; if (value == JSONObject.NULL) { v = null; } else { v = value.toString(); } jsl.add(new ScoreBoardJSONSetter.JSONSet(key, v, Flag.FROM_AUTOSAVE)); } ScoreBoardJSONSetter.set(scoreBoard, jsl); }</code><technical_language>This duplicates code LoadJsonScoreBoard - factored ScoreBaordJSONSertter</technical_language>

Target:
public static void loadFile(ScoreBoard scoreBoard, File f) throws Exception { JSONObject json = new JSONObject(FileUtils.readFileToString(f, "utf-8")); ScoreBoardJSONSetter.set(scoreBoard, json); }
Source:
<code>public boolean matchesSafely(Engine.Searcher searcher) { try { <START> this.count = (int) searcher.searcher().count(query); <END> return count == totalHits; } catch (IOException e) { return false; } }</code><technical_language>Redundant cast int</technical_language>

Target:
public boolean matchesSafely(Engine.Searcher searcher) { try { this.count = searcher.searcher().count(query); return count == totalHits; } catch (IOException e) { return false; } }
Source:
<code>public void commandRun() { <START> if (zkServer == null) { <END> pw.print(ZK_NOT_SERVING); } else { List<ZxidDigest> digestLog = zkServer.getZKDatabase().getDataTree().getDigestLog(); for (ZxidDigest zd : digestLog) { pw.println(Long.toHexString(zd.getZxid()) + ": " + zd.getDigest()); } } }</code><technical_language>Please AbstractFourLetterCommand.isZKServerRunning instead, checks nullness checks isRunning of server</technical_language>

Target:
public void commandRun() { if (!isZKServerRunning()) { pw.print(ZK_NOT_SERVING); } else { List<ZxidDigest> digestLog = zkServer.getZKDatabase().getDataTree().getDigestLog(); for (ZxidDigest zd : digestLog) { pw.println(Long.toHexString(zd.getZxid()) + ": " + zd.getDigest()); } } }
Source:
<code><START> public InMemoryNoteBucket getRoot() { <END> return root; }</code><technical_language>This public, type returns public</technical_language>

Target:
InMemoryNoteBucket getRoot() { return root; }
Source:
<code>private EntityModelLabelEditor getInstanceOfDateEditor() { return new EntityModelLabelEditor(new EntityModelRenderer(){ @Override public String render(Object entity) { <START> return FullDateTimeRenderer.getLocalizedDateTimeFormat().format((Date) entity); <END> } }, new EntityModelParser()); }</code><technical_language>NPE if Date is null</technical_language>

Target:
private EntityModelLabelEditor getInstanceOfDateEditor() { return new EntityModelLabelEditor(new EntityModelRenderer(){ @Override public String render(Object entity) { if((Date) entity == null) { return ConstantsManager.getInstance().getConstants().notAvailableLabel(); } return FullDateTimeRenderer.getLocalizedDateTimeFormat().format((Date) entity); } }, new EntityModelParser()); }
Source:
<code>public void enableStatistics(Collection<String> cacheNames, boolean enabled) throws IgniteCheckedException { Collection<IgniteInternalCache> caches = manageStatisticsCaches(cacheNames); Collection<String> globalCaches = new HashSet<>(caches.size()); for (IgniteInternalCache cache : caches) { cache.context().statisticsEnabled(enabled); <START> if(!cache.context().isLocal()) <END> globalCaches.add(cache.name()); } if (globalCaches.isEmpty()) return; CacheStatisticsModeChangeMessage msg = new CacheStatisticsModeChangeMessage(UUID.randomUUID(), globalCaches, enabled); EnableStatisticsFuture fut = new EnableStatisticsFuture(msg.requestId()); manageStatisticsFuts.put(msg.requestId(), fut); ctx.grid().context().discovery().sendCustomEvent(msg); fut.get(); }</code><technical_language>Need space open brace</technical_language>

Target:
public void enableStatistics(Collection<String> cacheNames, boolean enabled) throws IgniteCheckedException { Collection<IgniteInternalCache> caches = manageStatisticsCaches(cacheNames); Collection<String> globalCaches = new HashSet<>(U.capacity(caches.size())); for (IgniteInternalCache cache : caches) { cache.context().statisticsEnabled(enabled); if (!cache.context().isLocal()) globalCaches.add(cache.name()); } if (globalCaches.isEmpty()) return; CacheStatisticsModeChangeMessage msg = new CacheStatisticsModeChangeMessage(UUID.randomUUID(), globalCaches, enabled); EnableStatisticsFuture fut = new EnableStatisticsFuture(msg.requestId()); manageStatisticsFuts.put(msg.requestId(), fut); ctx.grid().context().discovery().sendCustomEvent(msg); fut.get(); }
Source:
<code>public void createWebInfFolderIfNotExist() { <START> File folder = new File("target/test-classes/WEB-INF"); <END> if (!folder.exists()) { folder.mkdirs(); } }</code><technical_language>need get rid of slashes</technical_language>

Target:
public void createWebInfFolderIfNotExist() { File folder = new File(Paths.get("target", "test-classes", "WEB-INF").toString()); if (!folder.exists()) { folder.mkdirs(); } }
Source:
<code>public UnaryTestSubexpr visit(UnaryTestListNode n) { List<BaseNode> collect = new ArrayList<>(); for (BaseNode e : n.getElements()) { UnaryTestSubexpr accept = e.accept(this); if (accept.isWildcard()) { <START> collect.add(asWildcard(accept.node)); <END> } else if (!accept.isUnaryTest()) { collect.add(asUnaryEq(accept.node)); } else { collect.add(accept.node); } } return new TopLevel( ASTBuilderFactory.newUnaryTestListNode(n.getParserRuleContext(), collect, n.getState())); }</code><technical_language>want in-line this asWildcard() call</technical_language>

Target:
public UnaryTestSubexpr visit(UnaryTestListNode n) { List<BaseNode> collect = new ArrayList<>(); for (BaseNode e : n.getElements()) { UnaryTestSubexpr accept = e.accept(this); if (accept.isWildcard()) { collect.add(rewriteToUnaryTestExpr(accept.node)); } else if (!accept.isUnaryTest()) { collect.add(rewriteToUnaryEqInExpr(accept.node)); } else { collect.add(accept.node); } } return new TopLevel( ASTBuilderFactory.newUnaryTestListNode(n.getParserRuleContext(), collect, n.getState())); }
Source:
<code>private List<SectionMatcher> getLocalAccessSections() { List<SectionMatcher> sm = localAccessSections; if (sm == null) { Collection<AccessSection> fromConfig = config.getAccessSections(); sm = new ArrayList<SectionMatcher>(fromConfig.size()); for (AccessSection section : fromConfig) { if (isAllProjects) { for (final String permissionName : Permission.getPermissionNames()) { if (!Permission.canBeOnWildProject(section.getName(), permissionName)) { <START> section.removePermission(permissionName); <END> } } } SectionMatcher matcher = SectionMatcher.wrap(section); if (matcher != null) { sm.add(matcher); } } localAccessSections = sm; } return sm; }</code><technical_language>This is thread safe. need copy AccessSection making removals, elide a point in time in a thread-safe way. is currently safe multiple threads enter this method modify shared, visible other threads, ProjectConfig contained AccessSection. synchronize this method. need copy section, avoid this removal</technical_language>

Target:
private List<SectionMatcher> getLocalAccessSections() { List<SectionMatcher> sm = localAccessSections; if (sm == null) { Collection<AccessSection> fromConfig = config.getAccessSections(); sm = new ArrayList<SectionMatcher>(fromConfig.size()); for (AccessSection section : fromConfig) { if (isAllProjects) { final List<Permission> permissions = section.getPermissions(); section = new AccessSection(section.getName()); section.setPermissions(permissions); for (final String permissionName : Permission.getPermissionNames()) { if (!Permission.canBeOnAllProjects(section.getName(), permissionName)) { section.removePermission(permissionName); } } } SectionMatcher matcher = SectionMatcher.wrap(section); if (matcher != null) { sm.add(matcher); } } localAccessSections = sm; } return sm; }