auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public @NonNull CTFCallsite parse(CommonTree tree, ICommonTreeParserParameter param) { final String emptyString = ""; final String regex = "^\"|\"$"; String fileName = null, funcName = null, name = null; <START> long lineNumber =-1, ip = -1; <END> List<CommonTree> children = tree.getChildren(); for (CommonTree child : children) { String left = child.getChild(0).getChild(0).getChild(0).getText(); if (left.equals(NAME)) { name = child.getChild(1).getChild(0).getChild(0).getText().replaceAll(regex, emptyString); } else if (left.equals(FUNC)) { funcName = child.getChild(1).getChild(0).getChild(0).getText().replaceAll(regex, emptyString); } else if (left.equals(IP)) { ip = Long.decode(child.getChild(1).getChild(0).getChild(0).getText()); } else if (left.equals(FILE)) { fileName = child.getChild(1).getChild(0).getChild(0).getText().replaceAll(regex, emptyString); } else if (left.equals(LINE)) { lineNumber = Long.parseLong(child.getChild(1).getChild(0).getChild(0).getText()); } } if (name == null || funcName == null || fileName == null) { throw new NullPointerException("CTFCallsite parameters shouldn't be null!"); } return new CTFCallsite(name, funcName, ip, fileName, lineNumber); }</code><technical_language>please var line</technical_language>

Target:
public @NonNull CTFCallsite parse(CommonTree tree, ICommonTreeParserParameter param) { final String emptyString = ""; final String regex = "^\"|\"$"; String fileName = null; String funcName = null; String name = null; long lineNumber =-1; long ip = -1; List<CommonTree> children = tree.getChildren(); for (CommonTree child : children) { String left = child.getChild(0).getChild(0).getChild(0).getText(); if (left.equals(NAME)) { name = child.getChild(1).getChild(0).getChild(0).getText().replaceAll(regex, emptyString); } else if (left.equals(FUNC)) { funcName = child.getChild(1).getChild(0).getChild(0).getText().replaceAll(regex, emptyString); } else if (left.equals(IP)) { ip = Long.decode(child.getChild(1).getChild(0).getChild(0).getText()); } else if (left.equals(FILE)) { fileName = child.getChild(1).getChild(0).getChild(0).getText().replaceAll(regex, emptyString); } else if (left.equals(LINE)) { lineNumber = Long.parseLong(child.getChild(1).getChild(0).getChild(0).getText()); } } if (name == null || funcName == null || fileName == null) { throw new NullPointerException("CTFCallsite parameters shouldn't be null!"); } return new CTFCallsite(name, funcName, ip, fileName, lineNumber); }
Source:
<code>Collection<String> revsDiffBatch(SQLDatabase db, String docId, Collection<String> revs) throws DatastoreException { Set<String> missingRevs = new HashSet<String>(revs); final String sql = String.format( "SELECT revs.revid FROM docs, revs " + "WHERE docs.doc_id = revs.doc_id AND docs.docid = %s AND revs.revid IN " + "(%s) ", <START> DatabaseUtils.makePlaceholders(1), <END> DatabaseUtils.makePlaceholders(revs.size())); String[] args = new String[1 + revs.size()]; args[0] = docId; System.arraycopy(revs.toArray(new String[revs.size()]), 0, args, 1, revs.size()); Cursor cursor = null; try { cursor = db.rawQuery(sql, args); while (cursor.moveToNext()) { String revId = cursor.getString(cursor.getColumnIndex("revid")); missingRevs.remove(revId); } } catch (SQLException e) { throw new DatastoreException(e); } finally { DatabaseUtils.closeCursorQuietly(cursor); } return missingRevs; }</code><technical_language>DatabaseUtils.makePlaceholders(1) replaced literal ? in string</technical_language>

Target:
Collection<String> revsDiffBatch(SQLDatabase db, String docId, Collection<String> revs) throws DatastoreException { Set<String> missingRevs = new HashSet<String>(revs); final String sql = String.format( "SELECT revs.revid FROM docs, revs " + "WHERE docs.doc_id = revs.doc_id AND docs.docid = ? AND revs.revid IN " + "(%s) ", DatabaseUtils.makePlaceholders(revs.size())); String[] args = new String[1 + revs.size()]; args[0] = docId; System.arraycopy(revs.toArray(new String[revs.size()]), 0, args, 1, revs.size()); Cursor cursor = null; try { cursor = db.rawQuery(sql, args); while (cursor.moveToNext()) { String revId = cursor.getString(cursor.getColumnIndex("revid")); missingRevs.remove(revId); } } catch (SQLException e) { throw new DatastoreException(e); } finally { DatabaseUtils.closeCursorQuietly(cursor); } return missingRevs; }
Source:
<code>private void startDiscovery() { discoveryService.scheduleWithFixedDelay(() -> { try { <START> SECONDS.sleep(ThreadLocalRandom.current().nextLong(1, organizationDiscoveryIntervalMillis / 1000)); <END> log.info("Running shard organizer..."); submitJobs(discoverAndInitializeTablesToOrganize()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Throwable t) { log.error(t, "Error running shard organizer"); } }, 0, organizationDiscoveryIntervalMillis, TimeUnit.MILLISECONDS); }</code><technical_language>if organizationDiscoveryIntervalMillis is 1000? MILLISECONDS instead</technical_language>

Target:
private void startDiscovery() { discoveryService.scheduleWithFixedDelay(() -> { try { MILLISECONDS.sleep(ThreadLocalRandom.current().nextLong(1, organizationDiscoveryIntervalMillis)); log.info("Running shard organizer..."); submitJobs(discoverAndInitializeTablesToOrganize()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Throwable t) { log.error(t, "Error running shard organizer"); } }, 0, organizationDiscoveryIntervalMillis, TimeUnit.MILLISECONDS); }
Source:
<code>public void setup() <START> throws Exception { <END> sslFactory = TestUtils.createSSLFactory(); SSLContext sslContext = sslFactory.createSSLContext(); sslSocketFactory = sslContext.getSocketFactory(); sslEchoServer = new SSLBlockingEchoServer(sslFactory, sslPort); sslEchoServer.start(); }</code><technical_language>new echo server for test a single for tests suffice? If a single suffice, declare variables static turn functions @BeforeClass @AfterClass</technical_language>

Target:
public void setup() throws Exception { }
Source:
<code>public void testGenerateAmazonS3GetBucketRequestPrototype() throws IOException, TemplateModelException { final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); final Map<String,Object> testMap = new HashMap<>(); final Request requestEntry = RequestConverter.toRequest(Ds3ModelFixtures.getBucketRequest(), <START> new Ds3DocSpecImpl( <END> ImmutableMap.of(), ImmutableMap.of())); testMap.put("requestEntry", requestEntry); final CCodeGenerator codeGenerator = new CCodeGenerator(); codeGenerator.processTemplate(testMap, "header-templates/RequestPrototype.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); final String expectedOutput = "LIBRARY_API ds3_error* ds3_get_bucket(const ds3_client* client, const ds3_request* request, ds3_list_bucket_result_response** response);"; assertEquals(expectedOutput, output); }</code><technical_language>Ds3DocSpecEmptyImpl</technical_language>

Target:
public void testGenerateAmazonS3GetBucketRequestPrototype() throws IOException, TemplateModelException { final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); final Map<String,Object> testMap = new HashMap<>(); final Request requestEntry = RequestConverter.toRequest(Ds3ModelFixtures.getBucketRequest(), new Ds3DocSpecEmptyImpl()); testMap.put("requestEntry", requestEntry); final CCodeGenerator codeGenerator = new CCodeGenerator(); codeGenerator.processTemplate(testMap, "header-templates/RequestPrototype.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); final String expectedOutput = "LIBRARY_API ds3_error* ds3_get_bucket(const ds3_client* client, const ds3_request* request, ds3_list_bucket_result_response** response);"; assertEquals(expectedOutput, output); }
Source:
<code>public boolean equals(Object o){ <START> if (!(o instanceof SonarQubeServer)) return false; <END> SonarQubeServer other = (SonarQubeServer)o; return Comparing.equal(getHostUrl(), other.getHostUrl()) && Comparing.equal(getServerId(), other.getServerId()) && Comparing.equal(getPassword(), other.getPassword()) && Comparing.equal(getToken(), other.getToken()) && Comparing.equal(getLogin(), other.getLogin()) && Comparing.equal(getName(), other.getName()) && Comparing.equal(enableProxy(), other.enableProxy()); }</code><technical_language>![MAJOR](<LINK_2> statement is allowed line, 2 statements this line. [![rule](<LINK_4>](<LINK_0> ![MINOR](<LINK_3> Missing curly brace. [![rule](<LINK_4>](<LINK_1></technical_language>

Target:
public boolean equals(Object o){ if (!(o instanceof SonarQubeServer)) return false; SonarQubeServer other = (SonarQubeServer)o; return Comparing.equal(getHostUrl(), other.getHostUrl()) && Comparing.equal(getPassword(), other.getPassword()) && Comparing.equal(getToken(), other.getToken()) && Comparing.equal(getLogin(), other.getLogin()) && Comparing.equal(getName(), other.getName()) && Comparing.equal(enableProxy(), other.enableProxy()); }
Source:
<code>public static boolean sameAnnotationValue(AnnotationValue av1, AnnotationValue av2) { <START> return compareAnnotationValue(av1, av2) != 0; <END> }</code><technical_language>this == 0</technical_language>

Target:
public static boolean sameAnnotationValue(AnnotationValue av1, AnnotationValue av2) { return compareAnnotationValue(av1, av2) == 0; }
Source:
<code>private EEFTextDescription createEEFTextDescription(TextDescription textDescription) { EEFTextDescription eefTextDescription = EefFactory.eINSTANCE.createEEFTextDescription(); eefTextDescription.setIdentifier(textDescription.getIdentifier()); eefTextDescription.setValueExpression(textDescription.getValueExpression()); InitialOperation initialOperation = textDescription.getInitialOperation(); eefTextDescription.setEditExpression(getExpressionForOperation(initialOperation)); TextStyle textStyle = textDescription.getStyle(); if (textStyle != null) { EEFTextStyle eefTextStyle = EefFactory.eINSTANCE.createEEFTextStyle(); eefTextStyle.setBackgroundColorExpression(textStyle.getBackgroundColorExpression()); eefTextStyle.setForegroundColorExpression(textStyle.getForegroundColorExpression()); eefTextStyle.setFontNameExpression(textStyle.getFontNameExpression()); eefTextStyle.setFontSizeExpression(Integer.toString(textStyle.getFontSize())); <START> int fontStyle = SWT.NORMAL; if (textStyle.isFontBold()) { fontStyle = fontStyle | SWT.BOLD; } if (textStyle.isFontItalic()) { fontStyle = fontStyle | SWT.ITALIC; } <END> eefTextStyle.setFontStyleExpression(Integer.toString(fontStyle)); eefTextDescription.setStyle(eefTextStyle); } return eefTextDescription; }</code><technical_language>rework this code SWT. if this code is in UI bundle, day, used/moved of UI bundle. copy/paste of SWT constants</technical_language>

Target:
private EEFTextDescription createEEFTextDescription(TextDescription textDescription) { EEFTextDescription eefTextDescription = EefFactory.eINSTANCE.createEEFTextDescription(); eefTextDescription.setIdentifier(textDescription.getIdentifier()); eefTextDescription.setValueExpression(textDescription.getValueExpression()); InitialOperation initialOperation = textDescription.getInitialOperation(); eefTextDescription.setEditExpression(getExpressionForOperation(initialOperation)); TextStyle textStyle = textDescription.getStyle(); if (textStyle != null) { EEFTextStyle eefTextStyle = EefFactory.eINSTANCE.createEEFTextStyle(); eefTextStyle.setBackgroundColorExpression(textStyle.getBackgroundColorExpression()); eefTextStyle.setForegroundColorExpression(textStyle.getForegroundColorExpression()); eefTextStyle.setFontNameExpression(textStyle.getFontNameExpression()); eefTextStyle.setFontSizeExpression(Integer.toString(textStyle.getFontSize())); int fontStyle = 0; if (textStyle.isFontBold()) { fontStyle = fontStyle | 1; } if (textStyle.isFontItalic()) { fontStyle = fontStyle | 2; } eefTextStyle.setFontStyleExpression(Integer.toString(fontStyle)); eefTextDescription.setStyle(eefTextStyle); } return eefTextDescription; }
Source:
<code>public void start() { try { server.setHandler(new Dhis2RequestsHandler()); server.start(); } catch (Exception e) { <START> LOGGER.error("Failed to start the Jetty server"); <END> } }</code><technical_language>log excepion</technical_language>

Target:
public void start() { try { server.setHandler(new Dhis2RequestsHandler()); server.start(); } catch (Exception e) { LOGGER.error("Failed to start the Jetty server.", e); } }
Source:
<code>public DefaultMultiFactorAuthenticationSupportingWebApplicationService(final String id, final String originalUrl, final String artifactId, final ResponseType responseType, final HttpClient httpClient, @NotNull final String authnMethod) { super(cleanupUrl(id), originalUrl, artifactId, httpClient); <START> this.wrapperService = new SimpleWebApplicationServiceImpl(id, originalUrl, artifactId, responseType, httpClient); <END> this.authenticationMethod = authnMethod; }</code><technical_language>a factory creates DefaultMultiFactorAuthenticationSupportingWebApplicationService objects, right? needs passed factory, factory here</technical_language>

Target:
public DefaultMultiFactorAuthenticationSupportingWebApplicationService(final String id, final String originalUrl, final String artifactId, final ResponseType responseType, final HttpClient httpClient, @NotNull final String authnMethod) { super(cleanupUrl(id), originalUrl, artifactId, httpClient); this.wrapperService = new SimpleWebApplicationServiceImpl(id, httpClient); this.authenticationMethod = authnMethod; this.responseType = responseType; }
Source:
<code>private void caveAroundRay(GlowBlock block, Random random) { int radius = random.nextInt(2) + 2; <START> final int bx = block.getX(); <END> final int by = block.getY(); final int bz = block.getZ(); for (int x = bx - radius; x <= bx + radius; x++) { for (int y = by - radius; y <= by + radius; y++) { for (int z = bz - radius; z <= bz + radius; z++) { double distance = (bx - x) * (bx - x) + (by - y) * (by - y) + (bz - z) * (bz - z); if (distance < radius * radius) { GlowBlock pocket = block.getWorld().getBlockAt(x, y, z); pocket.setType(Material.AIR); } } } } }</code><technical_language>blockX, blockY, blockZ</technical_language>

Target:
private void caveAroundRay(GlowBlock block, Random random) { int radius = random.nextInt(2) + 2; final int blockX = block.getX(); final int blockY = block.getY(); final int blockZ = block.getZ(); for (int x = blockX - radius; x <= blockX + radius; x++) { for (int y = blockY - radius; y <= blockY + radius; y++) { for (int z = blockZ - radius; z <= blockZ + radius; z++) { double distanceSquared = (blockX - x) * (blockX - x) + (blockY - y) * (blockY - y) + (blockZ - z) * (blockZ - z); if (distanceSquared < radius * radius) { GlowBlock pocket = block.getWorld().getBlockAt(x, y, z); pocket.setType(Material.AIR); } } } } }
Source:
<code>public KafkaFuture<Void> all() { try { <START> return KafkaFuture.allOf(values().get().values().toArray(new KafkaFuture[0])); <END> } catch (InterruptedException | ExecutionException e) { KafkaFutureImpl<Void> future = new KafkaFutureImpl<>(); future.completeExceptionally(e.getCause()); return future; } }</code><technical_language>a bit confused this API. wait aggregate future wrap in another future. wrong, right? call all() block</technical_language>

Target:
public KafkaFuture<Void> all() { return this.future.thenApply(new BaseFunction<Map<TopicPartition, Errors>, Void>() { @Override public Void apply(final Map<TopicPartition, Errors> topicPartitionErrorsMap) { List<TopicPartition> partitionsFailed = topicPartitionErrorsMap.entrySet() .stream() .filter(e -> e.getValue() != Errors.NONE) .map(Map.Entry::getKey) .collect(Collectors.toList()); for (Errors error : topicPartitionErrorsMap.values()) { if (error != Errors.NONE) { throw error.exception( "Failed altering consumer group offsets for the following partitions: " + partitionsFailed); } } return null; } }); }
Source:
<code>public void shouldFetchSingleAvroMessage() throws IOException { Topic topic = topic() .withName("avro.fetch") .withValidation(true) .withMessageSchema(avroUser.getSchemaAsString()) .withContentType(AVRO).build(); operations.buildTopic(topic); wait.untilTopicDetailsAreCreated(topic.getName()); <START> publisher.publish(topic.getQualifiedName(), avroUser.asBytes(), Response.Status.CREATED); <END> List<String> previews = fetchPreviewsFromAllPartitions(topic.getQualifiedName(), 10, false); assertThat(previews).hasSize(1); assertThatJson(previews.get(0)) .when(Option.IGNORING_EXTRA_FIELDS) .isEqualTo(avroUser.asJson()); }</code><technical_language>argue java import static pl.allegro.tech.hermes.integration.test.HermesAssertions.assertThat; assertThat(publisher.publish(topic.getQualifiedName(), avroUser.asBytes()).hasStatus(CREATED); more verbose clear this stage tested publisher</technical_language>

Target:
public void shouldFetchSingleAvroMessage() throws IOException { Topic topic = topic() .withName("avro.fetch") .withValidation(true) .withMessageSchema(avroUser.getSchemaAsString()) .withContentType(AVRO).build(); operations.buildTopic(topic); wait.untilTopicDetailsAreCreated(topic.getName()); Response response = publisher.publish(topic.getQualifiedName(), avroUser.asBytes()); HermesAssertions.assertThat(response).hasStatus(CREATED); List<String> previews = fetchPreviewsFromAllPartitions(topic.getQualifiedName(), 10, false); assertThat(previews).hasSize(1); assertThatJson(previews.get(0)) .when(Option.IGNORING_EXTRA_FIELDS) .isEqualTo(avroUser.asJson()); }
Source:
<code>private CertificationResultTestFunctionalityEntity getCertificationResultTestFunctionalityById(Long id) { CertificationResultTestFunctionalityEntity entity = null; Query query = entityManager.createQuery( "SELECT crtf " + "FROM CertificationResultTestFunctionalityEntity crtf " + "LEFT OUTER JOIN FETCH crtf.testFunctionality tf " + "JOIN FETCH tf.certificationEdition edition " <START> + "where (NOT crtf.deleted = true) AND (crtf.id = :entityid) ", <END> CertificationResultTestFunctionalityEntity.class ); query.setParameter("entityid", id); List<CertificationResultTestFunctionalityEntity> result = query.getResultList(); if (result.size() > 0){ entity = result.get(0); } return entity; }</code><technical_language>I this is a tiny thing, mis-match of UPPERCASE SQL lowercase sql is odd me. I care use, I feel try consistent a single query ;)</technical_language>

Target:
private CertificationResultTestFunctionalityEntity getCertificationResultTestFunctionalityById(Long id) { CertificationResultTestFunctionalityEntity entity = null; Query query = entityManager.createQuery( "SELECT crtf " + "FROM CertificationResultTestFunctionalityEntity crtf " + "LEFT OUTER JOIN FETCH crtf.testFunctionality tf " + "JOIN FETCH tf.certificationEdition edition " + "WHERE (NOT crtf.deleted = true) " + "AND (crtf.id = :entityid) ", CertificationResultTestFunctionalityEntity.class ); query.setParameter("entityid", id); List<CertificationResultTestFunctionalityEntity> result = query.getResultList(); if (result.size() > 0){ entity = result.get(0); } return entity; }
Source:
<code>public void execute(T t) { <START> return; <END> }</code><technical_language>Empty return needed</technical_language>

Target:
public void execute(T t) { }
Source:
<code>public void addNewModelElements(EObject eObject, EReference eReference) { <START> if (delegate == null) { <END> return; } delegate.addNewModelElements(eObject, eReference, true); }</code><technical_language>I call new addNewModelElements</technical_language>

Target:
public void addNewModelElements(EObject eObject, EReference eReference) { addNewModelElements(eObject, eReference, true); }
Source:
<code>private URI createURI(List<Integer> proxyPorts) { List<String> stripes = new ArrayList<>(); <START> for (int proxyPort : proxyPorts) { <END> String stripe = "localhost:" + proxyPort; stripes.add(stripe); } String uri = "terracotta://" + String.join(STRIPE_SEPARATOR, stripes); return URI.create(uri); }</code><technical_language>proxyPorts.stream().map(proxyPort -> "localhost:" + proxyPort).join("terracotta://", STRIPE_SEPARATOR) similar</technical_language>

Target:
private URI createURI(List<Integer> proxyPorts) { Optional<String> reduce = proxyPorts.stream() .map(port -> "localhost:" + port) .reduce((x1, x2) -> x1 + STRIPE_SEPARATOR + x2); String uri = "terracotta://" + reduce.get(); return URI.create(uri); }
Source:
<code>public static File findIndex(final File samFile){ <START> final File indexFile = lookForIndex(samFile); END> if(indexFile == null){ try { return lookForIndex(samFile.getCanonicalFile()); } catch (IOException e){ return null; } } else { return indexFile; } }</code><technical_language>chanelling Nils... spaces ) { if (</technical_language>

Target:
public static File findIndex(final File samFile) { final File indexFile = lookForIndex(samFile); if (indexFile == null) { return unsymlinkAndLookForIndex(samFile); } else { return indexFile; } }
Source:
<code>public void testFixedPattern() { final Resource resource = KieServices.Factory.get().getResources().newClassPathResource("fixedPattern.xls", getClass()); final KieBuilder kbuilder = KieBaseUtil.getKieBuilderFromResources(true, resource); final KieContainer kcontainer = KieServices.Factory.get().newKieContainer(kbuilder.getKieModule().getReleaseId()); ksession = kcontainer.newKieSession(); final List<Long> list = new ArrayList<Long>(); ksession.setGlobal("list", list); ksession.insert(1L); ksession.insert(2); ksession.fireAllRules(); <START> Assertions.assertThat(list.size()).isEqualTo(1); <END> Assertions.assertThat((long) list.get(0)).isEqualTo(1L); }</code><technical_language>Assertions a method handle collection size. that, test fail messages nicer</technical_language>

Target:
public void testFixedPattern() { final Resource resource = KieServices.Factory.get().getResources().newClassPathResource("fixedPattern.xls", getClass()); final KieBuilder kbuilder = KieBaseUtil.getKieBuilderFromResources(true, resource); final KieContainer kcontainer = KieServices.Factory.get().newKieContainer(kbuilder.getKieModule().getReleaseId()); ksession = kcontainer.newKieSession(); final List<Long> list = new ArrayList<Long>(); ksession.setGlobal("list", list); ksession.insert(1L); ksession.insert(2); ksession.fireAllRules(); Assertions.assertThat(list).hasSize(1); Assertions.assertThat(list).first().isEqualTo(1L); }
Source:
<code>public void create() { try { serviceLoader.load(PmHealthCheckManager.class); serviceLoader.load(EngineBackupAwarenessManager.class); serviceLoader.load(DataCenterCompatibilityChecker.class); serviceLoader.load(ResourceManager.class); serviceLoader.load(IrsProxyManager.class); serviceLoader.load(OvfDataUpdater.class); StoragePoolStatusHandler.init(); serviceLoader.load(GlusterJobsManager.class); try { log.info("Init VM custom properties utilities"); VmPropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of vm custom properties failed.", e); } try { log.info("Init device custom properties utilities"); DevicePropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of device custom properties failed.", e); } serviceLoader.load(SchedulingManager.class); sessionDataContainer.cleanupEngineSessionsOnStartup(); serviceLoader.load(HostDeviceManager.class); serviceLoader.load(DwhHeartBeat.class); if(Config.<Boolean> getValue(ConfigValues.AffinityRulesEnforcementManagerEnabled)) { serviceLoader.load(AffinityRulesEnforcementManager.class); } serviceLoader.load(CertificationValidityChecker.class); serviceLoader.load(HostUpdatesCheckerService.class); serviceLoader.load(IPTablesDeprecationNotifier.class); <START> compensate(); <END> } catch (Exception ex) { log.error("Failed to initialize backend", ex); throw ex; } }</code><technical_language>executing late? execute soon Backend</technical_language>

Target:
public void create() { try { compensate(); serviceLoader.load(AsyncTaskManager.class); serviceLoader.load(CommandCoordinatorUtil.class); serviceLoader.load(CommandCallbacksPoller.class); serviceLoader.load(CommandEntityCleanupManager.class); serviceLoader.load(PmHealthCheckManager.class); serviceLoader.load(EngineBackupAwarenessManager.class); serviceLoader.load(DataCenterCompatibilityChecker.class); serviceLoader.load(ResourceManager.class); serviceLoader.load(IrsProxyManager.class); serviceLoader.load(OvfDataUpdater.class); StoragePoolStatusHandler.init(); serviceLoader.load(GlusterJobsManager.class); try { log.info("Init VM custom properties utilities"); VmPropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of vm custom properties failed.", e); } try { log.info("Init device custom properties utilities"); DevicePropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of device custom properties failed.", e); } serviceLoader.load(SchedulingManager.class); sessionDataContainer.cleanupEngineSessionsOnStartup(); serviceLoader.load(HostDeviceManager.class); serviceLoader.load(DwhHeartBeat.class); if(Config.<Boolean> getValue(ConfigValues.AffinityRulesEnforcementManagerEnabled)) { serviceLoader.load(AffinityRulesEnforcementManager.class); } serviceLoader.load(CertificationValidityChecker.class); serviceLoader.load(HostUpdatesCheckerService.class); serviceLoader.load(IPTablesDeprecationNotifier.class); } catch (Exception ex) { log.error("Failed to initialize backend", ex); throw ex; } }
Source:
<code>public void onEnableStroke(){ CategorizedPoint cp = (CategorizedPoint) getLegend(); <START> CategorizedPoint ra = cp; <END> ra.setStrokeEnabled(strokeBox.isSelected()); UniqueSymbolPoint usp = new UniqueSymbolPoint(ra.getFallbackParameters()); if(cp.isOnVertex()){ usp.setOnVertex(); } else { usp.setOnCentroid(); } getPreview().setSymbol(usp.getSymbolizer()); TableModelInterval model = (TableModelInterval) getJTable().getModel(); model.fireTableDataChanged(); }</code><technical_language>introduce ra = cp</technical_language>

Target:
public void onEnableStroke(){ CategorizedPoint cp = (CategorizedPoint) getLegend(); cp.setStrokeEnabled(strokeBox.isSelected()); UniqueSymbolPoint usp = new UniqueSymbolPoint(cp.getFallbackParameters()); if(cp.isOnVertex()){ usp.setOnVertex(); } else { usp.setOnCentroid(); } if(cp.isStrokeEnabled()){ cp.setStrokeUom(Uom.fromString(uoms[lineUom.getSelectedIndex()].getKey())); usp.setStrokeUom(cp.getStrokeUom()); } usp.setSymbolUom(cp.getSymbolUom()); getPreview().setSymbol(usp.getSymbolizer()); TableModelInterval model = (TableModelInterval) getJTable().getModel(); model.fireTableDataChanged(); }
Source:
<code>private Map<String, Object>[] createCheckpointsMap() { final List<Map<String, Object>> result = new ArrayList<>(); <START> getParameters().getCheckpoints().forEach(checkpoint -> { Map<String, Object> params = new HashMap<>(); params.put("id", checkpoint.getId().toString()); params.put("created", checkpoint.getCreationDate().toString()); params.put(VdsProperties.vm_disks, createDisksMap(checkpoint.getDisks())); <END> result.add(params); }); return result.toArray(new HashMap[0]); }</code><technical_language>map this collect a list</technical_language>

Target:
private HashMap[] createCheckpointsMap() { return getParameters().getCheckpoints().stream().map(checkpoint -> { Map<String, Object> params = new HashMap<>(); params.put("id", checkpoint.getId().toString()); params.put("created", checkpoint.getCreationDate().toString()); params.put(VdsProperties.vm_disks, createDisksMap(checkpoint.getDisks())); return params; }).toArray(HashMap[]::new); }
Source:
<code>private void compareTime(CompareAssertionResult result) { if (compareTime < 0) { return; } long prevTime = -1; SampleResult prevResult = null; boolean success = true; StringBuilder buf = new StringBuilder(); for (SampleResult sResult : responses) { long currentTime = sResult.getTime(); if (prevTime != -1) { success = Math.abs(prevTime - currentTime) <= compareTime; prevResult = sResult; } <START> if (!success) { <END> result.setFailure(true); buf.setLength(0); appendResultDetails(buf, prevResult); buf.append(JMeterUtils.getResString("comparison_response_time")).append(prevTime); result.addToBaseResult(buf.toString()); buf.setLength(0); appendResultDetails(buf, sResult); buf.append(JMeterUtils.getResString("comparison_response_time")).append(currentTime); result.addToSecondaryResult(buf.toString()); result.setFailureMessage( JMeterUtils.getResString("comparison_differ_time") + compareTime + JMeterUtils.getResString("comparison_unit")); break; } prevResult = sResult; prevTime = currentTime; } }</code><technical_language>please invert this if well</technical_language>

Target:
private void compareTime(CompareAssertionResult result) { if (compareTime < 0) { return; } long prevTime = -1; SampleResult prevResult = null; boolean success = true; for (SampleResult sResult : responses) { long currentTime = sResult.getTime(); if (prevTime != -1) { success = Math.abs(prevTime - currentTime) <= compareTime; prevResult = sResult; } if (success) { prevResult = sResult; prevTime = currentTime; } else { result.setFailure(true); StringBuilder sb = new StringBuilder(); appendResultDetails(sb, prevResult); sb.append(JMeterUtils.getResString("comparison_response_time")).append(prevTime); result.addToBaseResult(sb.toString()); sb.setLength(0); appendResultDetails(sb, sResult); sb.append(JMeterUtils.getResString("comparison_response_time")).append(currentTime); result.addToSecondaryResult(sb.toString()); result.setFailureMessage( JMeterUtils.getResString("comparison_differ_time") + compareTime + JMeterUtils.getResString("comparison_unit")); break; } } }
Source:
<code>public void testIncrementLong() { ITmfStateSystemBuilder ss = fStateSystem; int quark = ss.getQuarkAbsoluteAndAdd(DUMMY_STRING); ITmfStateValue value = ss.queryOngoingState(quark); <START> assertEquals(TmfStateValue.nullValue(), value); long increment = 3; StateSystemBuilderUtils.incrementAttributeLong(ss, START_TIME + TIME_INCREMENT, quark, increment); value = ss.queryOngoingState(quark); assertEquals(TmfStateValue.newValueLong(increment), value); Long increment2 = 1000L; StateSystemBuilderUtils.incrementAttributeLong(ss, START_TIME + TIME_INCREMENT, quark, increment2); value = ss.queryOngoingState(quark); assertEquals(TmfStateValue.newValueLong(increment + increment2), value); Long increment3 = -500L; StateSystemBuilderUtils.incrementAttributeLong(ss, START_TIME + TIME_INCREMENT, quark, increment3); value = ss.queryOngoingState(quark); assertEquals(TmfStateValue.newValueLong(increment + increment2 + increment3), <END> value); }</code><technical_language>objects instead of values if in provider</technical_language>

Target:
public void testIncrementLong() { ITmfStateSystemBuilder ss = fStateSystem; int quark = ss.getQuarkAbsoluteAndAdd(DUMMY_STRING); Object value = ss.queryOngoing(quark); assertNull(value); long increment = 3; StateSystemBuilderUtils.incrementAttributeLong(ss, START_TIME + TIME_INCREMENT, quark, increment); value = ss.queryOngoing(quark); assertNotNull(value); assertEquals(increment, (long) value); Long increment2 = 1000L; StateSystemBuilderUtils.incrementAttributeLong(ss, START_TIME + TIME_INCREMENT, quark, increment2); value = ss.queryOngoing(quark); assertNotNull(value); assertEquals(increment + increment2, (long) value); Long increment3 = -500L; StateSystemBuilderUtils.incrementAttributeLong(ss, START_TIME + TIME_INCREMENT, quark, increment3); value = ss.queryOngoing(quark); assertNotNull(value); assertEquals(increment + increment2 + increment3, (long) value); }
Source:
<code>private static URI convertKeyToEncodedUri(String key) { try { <START> URI unEncodedURI = new URI(key); return new URIBuilder().setPath(unEncodedURI.getRawPath()) .setScheme(unEncodedURI.getScheme()).build(); <END> } catch (URISyntaxException e) { int i = e.getIndex(); String details; if (i >= 0) { details = " -- \"" + e.getInput().charAt(i) + "\""; } else { details = ""; } throw new AssertionError("Failed to encode key: " + key + ": " + e + details); } }</code><technical_language>test is failing, convert key Path getPath instead of getRawPath in URIBuilder. this worked for - suggestion Path p = new Path(key); URI unEncodedURI = p.toUri(); return new URIBuilder().setPath(unEncodedURI.getPath()) .setScheme(unEncodedURI.getScheme()).build(); Give a try, if this works, if out safe post testing</technical_language>

Target:
private static URI convertKeyToEncodedUri(String key) { try { Path p = new Path(key); URI unEncodedURI = p.toUri(); return new URIBuilder().setPath(unEncodedURI.getPath()) .setScheme(unEncodedURI.getScheme()).build(); } catch (URISyntaxException e) { int i = e.getIndex(); String details; if (i >= 0) { details = " -- \"" + e.getInput().charAt(i) + "\""; } else { details = ""; } throw new AssertionError("Failed to encode key: " + key + ": " + e + details); } }
Source:
<code><START> public MultiTypeCodec codec() { <END> Map<String, KryoRegistrar> kryoRegistrarMap = applicationContext.getBeansOfType(KryoRegistrar .class); return new PojoCodec(new ArrayList<>(kryoRegistrarMap.values())); }</code><technical_language>raw type, needs <?></technical_language>

Target:
public MultiTypeCodec<?> codec() { Map<String, KryoRegistrar> kryoRegistrarMap = applicationContext.getBeansOfType(KryoRegistrar .class); return new PojoCodec(new ArrayList<>(kryoRegistrarMap.values())); }
Source:
<code>private void createAutoScaleGroup(Composite parent) { Composite composite = SWTUtil.createCompositeHorizontalFill(parent, 1, false); final Button autoScaleDiagramCheckBox = new Button(composite, SWT.CHECK | SWT.LEFT); autoScaleDiagramCheckBox.setText("Auto-Scale Diagram"); GridData data = new GridData(GridData.FILL, 0, true, false); autoScaleDiagramCheckBox.setLayoutData(data); autoScaleDiagramCheckBox.setSelection(this.autoScaleDiagram); <START> autoScaleDiagramCheckBox.addSelectionListener(SelectionListener.widgetSelectedAdapter((evt) -> { this.autoScaleDiagram = autoScaleDiagramCheckBox.getSelection(); })); <END> }</code><technical_language>compile Neon, prefer: autoScaleDiagramCheckBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { autoScaleDiagram = autoScaleDiagramCheckBox.getSelection(); } });</technical_language>

Target:
private void createAutoScaleGroup(Composite parent) { Composite composite = SWTUtil.createCompositeHorizontalFill(parent, 1, false); final Button autoScaleDiagramCheckBox = new Button(composite, SWT.CHECK | SWT.LEFT); autoScaleDiagramCheckBox.setText(Messages.AbstractExportRepresentationsAsImagesDialog_autoScaleDiagram); GridData data = new GridData(GridData.FILL, 0, true, false); autoScaleDiagramCheckBox.setLayoutData(data); autoScaleDiagramCheckBox.setSelection(this.autoScaleDiagram); autoScaleDiagramCheckBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { autoScaleDiagram = autoScaleDiagramCheckBox.getSelection(); } }); }
Source:
<code>protected static void setUpConfigurationFiles(final HBaseTestingUtility testUtil) throws Exception { String absoluteDataPath = testUtil.getDataTestDir().toString(); Files.createDirectories(Paths.get(absoluteDataPath)); List<String> confs = Arrays.asList("/hbase-site.xml", "/hbase-site2.xml", "/hbase-site3.xml"); for (String conf : confs) { <START> Path cnfPath = Paths.get("target/test-classes" + conf); <END> Path newConfPath = Paths.get(absoluteDataPath + conf); if (!conf.equals("/hbase-site3.xml")) { Files.copy(cnfPath, newConfPath); } newCnfPathes.add(newConfPath); } testUtil.getConfiguration().addResource(testUtil.getDataTestDir("hbase-site.xml")); }</code><technical_language>concatenating strings instead of API provided. java final Path confPath = Paths.get("target", "test-classes", "hbase-site.xml");</technical_language>

Target:
protected static void setUpConfigurationFiles(final HBaseTestingUtility testUtil) throws Exception { String absoluteDataPath = testUtil.getDataTestDir().toString(); Files.createDirectories(Paths.get(absoluteDataPath)); Path configFile = Paths.get("target", "test-classes", SERVER_CONFIG); configFileUnderTestDataDir = Paths.get(absoluteDataPath, SERVER_CONFIG); Files.copy(configFile, configFileUnderTestDataDir); Path overrideConfigFile = Paths.get("target", "test-classes", OVERRIDE_SERVER_CONFIG); overrideConfigFileUnderTestDataDir = Paths.get(absoluteDataPath, OVERRIDE_SERVER_CONFIG); Files.copy(overrideConfigFile, overrideConfigFileUnderTestDataDir); backupConfigFileUnderTestDataDir = Paths.get(absoluteDataPath, BACKUP_SERVER_CONFIG); testUtil.getConfiguration().addResource(testUtil.getDataTestDir(SERVER_CONFIG)); }
Source:
<code>private List<JobView> jobViews() { JobViews views = new JobViews(new StaticJenkinsAPIs(), currentConfig()); List<JobView> jobs = new ArrayList<JobView>(); @SuppressWarnings("unchecked") <START> List<ItemGroup<?>> groups = new ArrayList(filter(super.getItems(), AbstractFolder.class)); <END> Pattern includePattern = Strings.isNullOrEmpty(currentConfig().getInclude()) ? null : Pattern.compile(currentConfig().getInclude()); Pattern excludePattern = Strings.isNullOrEmpty(currentConfig().getExclude()) ? null : Pattern.compile(currentConfig().getExclude()); for (ItemGroup<?> group : groups) { @SuppressWarnings("unchecked") List<Job<?, ?>> groupJobs = new ArrayList(filter(group.getItems(), Job.class)); for (Job<?, ?> job : groupJobs) { boolean shouldInclude = includePattern == null || includePattern.matcher(job.getRelativeNameFrom(group)).find(); boolean shouldExclude = excludePattern != null && excludePattern.matcher(job.getRelativeNameFrom(group)).find(); if (shouldInclude && !shouldExclude) { jobs.add(views.viewOf(job)); } } } @SuppressWarnings("unchecked") List<Job<?, ?>> projects = new ArrayList(filter(super.getItems(), Job.class)); Collections.sort(projects, currentConfig().getOrder()); for (Job project : projects) { jobs.add(views.viewOf(project)); } return jobs; }</code><technical_language>if Folder plugin is installed class is available</technical_language>

Target:
private List<JobView> jobViews() { JobViews views = new JobViews(new StaticJenkinsAPIs(), currentConfig()); List<Job<?, ?>> projects = currentJobFilter().filterJobs(this.getItems()); Collections.sort(projects, currentConfig().getOrder()); List<JobView> jobs = new ArrayList<JobView>(projects.size()); for (Job project : projects) { jobs.add(views.viewOf(project)); } return jobs; }
Source:
<code>public void removeSegments(Iterable<DataSegment> segments) { try { for (DataSegment segment : segments) { serverManager.dropSegment(segment); File segmentInfoCacheFile = new File(config.getSegmentInfoCacheDirectory(), segment.getIdentifier()); if (!segmentInfoCacheFile.delete()) { log.warn("Unable to delete segmentInfoCacheFile[%s]", segmentInfoCacheFile); } } announcer.unannounceSegments(segments); } catch (Exception e) { <START> log.makeAlert("Failed to remove segments") <END> .addData("segments", segments) .emit(); } }</code><technical_language>merged master? I thought I fixed this include exception in message... I might've pushed yet, exception in alert. is, please edit if I pushed, deal conflict if creates one</technical_language>

Target:
public void removeSegments(Iterable<DataSegment> segments) { try { for (DataSegment segment : segments) { serverManager.dropSegment(segment); File segmentInfoCacheFile = new File(config.getSegmentInfoCacheDirectory(), segment.getIdentifier()); if (!segmentInfoCacheFile.delete()) { log.warn("Unable to delete segmentInfoCacheFile[%s]", segmentInfoCacheFile); } } announcer.unannounceSegments(segments); } catch (Exception e) { log.makeAlert(e, "Failed to remove segments") .addData("segments", segments) .emit(); } }
Source:
<code>public void testValues() throws DatabaseEngineException { <START> final Values values = values("id", "name") <END> .rows(row(k(1), k("ana")), row(k(2), k("fred")), row(k(3), k("manuel")), row(k(4), k("rita"))); final List<Map<String, ResultColumn>> result = engine.query(values); final List<Integer> ids = result.stream() .map(row -> row.get("id").toInt()) .sorted() .collect(Collectors.toList()); final List<String> names = result.stream() .map(row -> row.get("name").toString()) .sorted() .collect(Collectors.toList()); assertEquals("id must be 1", new Integer(1), ids.get(0)); assertEquals("id must be 2", new Integer(2), ids.get(1)); assertEquals("id must be 3", new Integer(3), ids.get(2)); assertEquals("id must be 4", new Integer(4), ids.get(3)); assertEquals("name must be 'ana'", "ana", names.get(0)); assertEquals("name must be 'fred'", "fred", names.get(1)); assertEquals("name must be 'manuel'", "manuel", names.get(2)); assertEquals("name must be 'rita'", "rita", names.get(3)); }</code><technical_language>I assuming a syntax for this: values("id", "name") .row(k(1), k("ana")) .row(k(2), k("fred")) .row(k(3), k("manuel")) .row(k(4), k("rita")); sense? is trickier use</technical_language>

Target:
public void testValues() throws DatabaseEngineException { final Values values = values("id", "name") .row(k(1), k("ana")) .row(k(2), k("fred")) .row(k(3), k("manuel")) .row(k(4), k("rita")); final List<Map<String, ResultColumn>> result = engine.query(values); final List<Integer> ids = result.stream() .map(row -> row.get("id").toInt()) .sorted() .collect(Collectors.toList()); final List<String> names = result.stream() .map(row -> row.get("name").toString()) .sorted() .collect(Collectors.toList()); assertEquals("id must be 1", new Integer(1), ids.get(0)); assertEquals("id must be 2", new Integer(2), ids.get(1)); assertEquals("id must be 3", new Integer(3), ids.get(2)); assertEquals("id must be 4", new Integer(4), ids.get(3)); assertEquals("name must be 'ana'", "ana", names.get(0)); assertEquals("name must be 'fred'", "fred", names.get(1)); assertEquals("name must be 'manuel'", "manuel", names.get(2)); assertEquals("name must be 'rita'", "rita", names.get(3)); }
Source:
<code>public void init(final ProcessorContext context) { super.init(context); metrics = (StreamsMetricsImpl) context.metrics(); droppedRecordsSensor = droppedRecordsSensorOrSkippedRecordsSensor(Thread.currentThread().getName(), context.taskId().toString(), metrics); if (queryableName != null) { <START> store = (TimestampedSerializedKeyValueStore<K, V>) context.getStateStore(queryableName); <END> tupleForwarder = new TimestampedTupleForwarder<>( store, context, new TimestampedCacheFlushListener<>(context), sendOldValues); skippedIdempotentUpdatesSensor = skippedIdempotentUpdatesSensor(Thread.currentThread().getName(), context.taskId().toString(), ((InternalProcessorContext) context).currentNode().name(), metrics); } }</code><technical_language>a more conservative avoid creating new type TimestampedSerializedKeyValueStore, avoid changing decorators all. avoid reasonable possibility of users encountering new methods. suggestion final StateStore stateStore = context.getStateStore(queryableName); try { store = ((WrappedStateStore<MeteredTimestampedKeyValueStore<K, V>, K, V>) stateStore).wrapped(); } catch (final ClassCastException e) { throw new IllegalStateException("Unexpected store type: " + stateStore.getClass() + " for store: " + queryableName, e); } Note, I this is awkward hack, state store hierarchy is a mess, some work clean up. then, personally comfortable internally depend a single layer of wrapper MeteredTimestamped store unwrapping get access new methods. advantage is minimize surface area change implement this feature (and minimize building a lot more top of mess have). risk is small: get compiler checking, any/all of tests fail if broke this assumption</technical_language>

Target:
public void init(final ProcessorContext context) { super.init(context); metrics = (StreamsMetricsImpl) context.metrics(); droppedRecordsSensor = droppedRecordsSensorOrSkippedRecordsSensor(Thread.currentThread().getName(), context.taskId().toString(), metrics); if (queryableName != null) { final StateStore stateStore = context.getStateStore(queryableName); try { store = ((WrappedStateStore<MeteredTimestampedKeyValueStore<K, V>, K, V>) stateStore).wrapped(); } catch (final ClassCastException e) { throw new IllegalStateException("Unexpected store type: " + stateStore.getClass() + " for store: " + queryableName, e); } tupleForwarder = new TimestampedTupleForwarder<>( store, context, new TimestampedCacheFlushListener<>(context), sendOldValues); skippedIdempotentUpdatesSensor = skippedIdempotentUpdatesSensor( Thread.currentThread().getName(), context.taskId().toString(), ((InternalProcessorContext) context).currentNode().name(), metrics ); } }
Source:
<code><START> public Statistics calc() { <END> List<Double> copy; long count; synchronized (this) { copy = new ArrayList<Double>(this.samples); count = this.count; } double sum = 0; double decay = 1 - 1. / this.window; double sumSquares = 0; double weight = 0; double min = this.min; double max = this.max; for (Double value : copy) { value /= this.factor; if (value > max) { max = value; } if (value < min) { min = value; } sum = decay * sum + value; sumSquares = decay * sumSquares + value * value; weight = decay * weight + 1; } synchronized (this) { if (max > this.max) { this.max = max; } if (min < this.min) { this.min = min; } } double mean = weight > 0 ? sum / weight : 0.; double var = weight > 0 ? sumSquares / weight - mean * mean : 0.; double standardDeviation = var > 0 ? Math.sqrt(var) : 0; return new Statistics(count, min == Double.MAX_VALUE ? 0 : min, max, mean, standardDeviation); }</code><technical_language>is this public, ExponentialMovingAverageRate's is private</technical_language>

Target:
private Statistics calc() { List<Double> copy; long count; synchronized (this) { copy = new ArrayList<Double>(this.samples); count = this.count; } double sum = 0; double decay = 1 - 1. / this.window; double sumSquares = 0; double weight = 0; double min = this.min; double max = this.max; for (Double value : copy) { value /= this.factor; if (value > max) { max = value; } if (value < min) { min = value; } sum = decay * sum + value; sumSquares = decay * sumSquares + value * value; weight = decay * weight + 1; } synchronized (this) { if (max > this.max) { this.max = max; } if (min < this.min) { this.min = min; } } double mean = weight > 0 ? sum / weight : 0.; double var = weight > 0 ? sumSquares / weight - mean * mean : 0.; double standardDeviation = var > 0 ? Math.sqrt(var) : 0; return new Statistics(count, min == Double.MAX_VALUE ? 0 : min, max, mean, standardDeviation); }
Source:
<code>public Map<SimpleInterval, Integer> getSimpleIntervalToIndexMap() { <START> Map<SimpleInterval, Integer> intervalToIndexMap = new HashMap<>(); <END> IntStream.range(0, counts.size()).forEach(i -> intervalToIndexMap.put(counts.get(i).getInterval(), i)); return intervalToIndexMap; }</code><technical_language>I intervalToIndexMap final give a size estimate in constructor elements is have</technical_language>

Target:
public Map<SimpleInterval, Integer> getSimpleIntervalToIndexMap() { return IntStream.range(0, counts.size()).boxed() .collect(Collectors.toMap(i -> counts.get(i).getInterval(), i -> i)); }