auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected List<OvfEntityData> getEntitiesFromStorageOvfDisk() { List<OvfEntityData> ovfEntitiesFromTar = Collections.emptyList(); List<DiskImage> ovfStoreDiskImages = new ArrayList(getAllOVFDisks()); if (!ovfStoreDiskImages.isEmpty()) { boolean entitiesRetrieved = false; while (!ovfStoreDiskImages.isEmpty()) { Pair<DiskImage, Long> ovfDiskAndSize = getLatestOVFDisk(ovfStoreDiskImages); DiskImage ovfDisk = ovfDiskAndSize.getFirst(); if (ovfDisk != null) { if (!entitiesRetrieved) { try { VDSReturnValue retrievedByteData = runVdsCommand(VDSCommandType.RetrieveImageData, new ImageHttpAccessVDSCommandParameters(getVdsId(), getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), ovfDisk.getId(), ovfDisk.getImage().getId(), ovfDiskAndSize.getSecond())); if (retrievedByteData.getSucceeded()) { ovfEntitiesFromTar = OvfUtils.getOvfEntities((byte[]) retrievedByteData.getReturnValue(), getParameters().getStorageDomainId()); <START> entitiesRetrieved = true; <END> } else { log.errorFormat("Image data could not be retrieved for disk id {0} in storage domain id {1}", ovfDisk.getId(), getParameters().getStorageDomainId()); } } catch (RuntimeException e) { log.errorFormat("Image data could not be retrieved for disk id {0} in storage domain id {1}. Error: {2}", ovfDisk.getId(), getParameters().getStorageDomainId(), e); } } ovfStoreDiskImages.remove(ovfDisk); } } if (!entitiesRetrieved) { AuditLogDirector.log(this, AuditLogType.RETRIEVE_OVF_STORE_FAILED); } } else { log.warnFormat("There are no OVF_STORE disks on storage domain id {0}", getParameters().getStorageDomainId()); } return ovfEntitiesFromTar; }</code><technical_language>return here, remove unneeded boolean</technical_language>

Target:
protected List<OvfEntityData> getEntitiesFromStorageOvfDisk() { List<DiskImage> ovfStoreDiskImages = new ArrayList(getAllOVFDisks()); if (!ovfStoreDiskImages.isEmpty()) { while (!ovfStoreDiskImages.isEmpty()) { Pair<DiskImage, Long> ovfDiskAndSize = getLatestOVFDisk(ovfStoreDiskImages); DiskImage ovfDisk = ovfDiskAndSize.getFirst(); if (ovfDisk != null) { try { VDSReturnValue retrievedByteData = runVdsCommand(VDSCommandType.RetrieveImageData, new ImageHttpAccessVDSCommandParameters(getVdsId(), getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), ovfDisk.getId(), ovfDisk.getImage().getId(), ovfDiskAndSize.getSecond())); if (retrievedByteData.getSucceeded()) { return OvfUtils.getOvfEntities((byte[]) retrievedByteData.getReturnValue(), getParameters().getStorageDomainId()); } else { log.errorFormat("Image data could not be retrieved for disk id {0} in storage domain id {1}", ovfDisk.getId(), getParameters().getStorageDomainId()); } } catch (RuntimeException e) { log.errorFormat("Image data could not be retrieved for disk id {0} in storage domain id {1}. Error: {2}", ovfDisk.getId(), getParameters().getStorageDomainId(), e); } ovfStoreDiskImages.remove(ovfDisk); } } AuditLogDirector.log(this, AuditLogType.RETRIEVE_OVF_STORE_FAILED); } else { log.warnFormat("There are no OVF_STORE disks on storage domain id {0}", getParameters().getStorageDomainId()); } return Collections.emptyList(); }
Source:
<code>protected String getClassProperty() { <START> return super.getClassProperty() + ' ' + this.currentContext.getCurrentMacroBlock().getId() + "message"; <END> }</code><technical_language>I understand context actually, sense. do extending macro name is call MacroDescriptor#getName()</technical_language>

Target:
protected String getClassProperty() { return super.getClassProperty() + ' ' + this.getDescriptor().getId().getId() + "message"; }
Source:
<code>private void handleException(Throwable err) { Handler<Throwable> handler; synchronized (this) { if ((handler = exceptionHandler) == null) { <START> log.error("Unhandled exception", err); <END> return; } } handler.handle(err); }</code><technical_language>I prefer this instead InboundBuffer code handle logging for NetSocket</technical_language>

Target:
private void handleException(Throwable err) { Handler<Throwable> handler; synchronized (this) { if ((handler = exceptionHandler) == null) { return; } } handler.handle(err); }
Source:
<code>protected void assertIndexUsed(IgniteCache<?, ?> cache, String sql, String idx) throws IgniteCheckedException { AtomicReference<String> currPlan = new AtomicReference<>(); <START> boolean res = GridTestUtils.waitForCondition(new PA() { <END> @Override public boolean apply() { String plan = explainPlan(cache, sql); currPlan.set(plan); return plan.contains(idx.toLowerCase()); } }, 1_000); assertTrue("Query \"" + sql + "\" executed without usage of " + idx + ", see plan:\n\"" + currPlan.get() + "\"", res); }</code><technical_language>java8 lambda here</technical_language>

Target:
protected void assertIndexUsed(IgniteCache<?, ?> cache, String sql, String idx) throws IgniteCheckedException { AtomicReference<String> currPlan = new AtomicReference<>(); boolean res = GridTestUtils.waitForCondition(() -> { String plan = explainPlan(cache, sql); currPlan.set(plan); return plan.contains(idx.toLowerCase()); }, 1_000); assertTrue("Query \"" + sql + "\" executed without usage of " + idx + ", see plan:\n\"" + currPlan.get() + "\"", res); }
Source:
<code>public int hashCode() { int hash = 7; hash = 31 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 31 * hash + (this.javaType != null ? this.javaType.hashCode() : 0); <START> hash = 31 * hash + (this.guid != null ? this.guid.hashCode() : 0); <END> return hash; }</code><technical_language>based guid</technical_language>

Target:
public int hashCode() { int hash = 7; hash = 31 * hash + (this.guid != null ? this.guid.hashCode() : 0); return hash; }
Source:
<code>private void assertCanDoActionMessage(VdcBllMessages msg) { assertTrue("canDoAction failed for the wrong reason", command.getReturnValue() .getCanDoActionMessages() <START> .contains(msg.toString())); <END> }</code><technical_language>name() instead. toString() overridden</technical_language>

Target:
private void assertCanDoActionMessage(VdcBllMessages msg) { assertTrue("canDoAction failed for the wrong reason", command.getReturnValue() .getCanDoActionMessages() .contains(msg.name())); }
Source:
<code>public void testUnescape() { assertEquals("a\"b", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\"b")).toString()); assertEquals("a\\b", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\\b")).toString()); assertEquals("a\\\"b", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\\\\\"b")).toString()); assertEquals("\\\"", VisibilityEvaluator.unescape(new ArrayByteSequence("\\\\\\\"")).toString()); assertEquals("a\\b\\c\\d", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\\b\\\\c\\\\d")).toString()); try { VisibilityEvaluator.unescape(new ArrayByteSequence("a\\b")); <START> fail(); <END> } catch (IllegalArgumentException e) try { VisibilityEvaluator.unescape(new ArrayByteSequence("a\\b\\c")); fail(); } catch (IllegalArgumentException e) try { VisibilityEvaluator.unescape(new ArrayByteSequence("a\"b\\")); fail(); } catch (IllegalArgumentException e) }</code><technical_language>assertion message for fail()'s nice</technical_language>

Target:
public void testUnescape() { assertEquals("a\"b", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\"b")).toString()); assertEquals("a\\b", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\\b")).toString()); assertEquals("a\\\"b", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\\\\\"b")).toString()); assertEquals("\\\"", VisibilityEvaluator.unescape(new ArrayByteSequence("\\\\\\\"")).toString()); assertEquals("a\\b\\c\\d", VisibilityEvaluator.unescape(new ArrayByteSequence("a\\\\b\\\\c\\\\d")).toString()); try { VisibilityEvaluator.unescape(new ArrayByteSequence("a\\b")); fail("Expected failure to unescape invalid escape sequence"); } catch (IllegalArgumentException e) try { VisibilityEvaluator.unescape(new ArrayByteSequence("a\\b\\c")); fail("Expected failure to unescape invalid escape sequence"); } catch (IllegalArgumentException e) try { VisibilityEvaluator.unescape(new ArrayByteSequence("a\"b\\")); fail("Expected failure to unescape invalid escape sequence"); } catch (IllegalArgumentException e) }
Source:
<code>public StatsManagerTest() throws IOException, StoreException { <START> tempDir = StoreTestUtils.createTempDirectory("nodeStatsDir-" + UtilsTest.getRandomString(10)); <END> outputFileString = (new File(tempDir.getAbsolutePath(), "stats_output.json")).getAbsolutePath(); long[][] testData1 = new long[][]{{100, 200, 300}, {100}, {200, 300}}; long[][] testData2 = new long[][]{{10}, {50}}; long[][] testData3 = new long[][]{{1000}, {200}, {300}, {10, 20, 30, 40, 50}}; List<StatsSnapshot> statsSnapshots = new ArrayList<>(); statsSnapshots.add(generateStatsSnapshot(testData1)); statsSnapshots.add(generateStatsSnapshot(testData2)); statsSnapshots.add(generateStatsSnapshot(testData3)); storeMap = new HashMap<>(); MetricRegistry registry = new MetricRegistry(); StorageManagerMetrics metrics = new StorageManagerMetrics(registry); for (int i = 0; i < 3; i++) { PartitionId id = new Partition(i, PartitionState.READ_WRITE, 1024 * 1024 * 1024); Store store = new MockBlobStore(UtilsTest.getRandomString(10), metrics, new MockBlobStoreStats(statsSnapshots.get(i))); storeMap.put(id, store); } storeMap.put(new Partition(1000, PartitionState.READ_WRITE, 1024 * 1024 * 1024), null); StorageManager storageManager = new MockStorageManager(storeMap); Properties properties = new Properties(); properties.put("stats.output.file.path", outputFileString); StatsManagerConfig config = new StatsManagerConfig(new VerifiableProperties(properties)); statsManager = new StatsManager(storageManager, new ArrayList<>(storeMap.keySet()), new MetricRegistry(), config, SystemTime.getInstance()); }</code><technical_language>move this a private method called setUpTest()</technical_language>

Target:
public StatsManagerTest() throws IOException, StoreException { tempDir = StoreTestUtils.createTempDirectory("nodeStatsDir-" + UtilsTest.getRandomString(10)); outputFileString = (new File(tempDir.getAbsolutePath(), "stats_output.json")).getAbsolutePath(); storeMap = new HashMap<>(); preAggregatedSnapshot = generateRandomSnapshot(); Pair<StatsSnapshot, StatsSnapshot> baseSliceAndNewSlice = new Pair<>(preAggregatedSnapshot, null); for (int i = 0; i < 2; i++) { baseSliceAndNewSlice = decomposeSnapshot(baseSliceAndNewSlice.getFirst()); storeMap.put(new Partition(i, PartitionState.READ_WRITE, CAPACITY), new MockBlobStore(new MockBlobStoreStats(baseSliceAndNewSlice.getSecond(), false))); } storeMap.put(new Partition(2, PartitionState.READ_WRITE, CAPACITY), new MockBlobStore(new MockBlobStoreStats(baseSliceAndNewSlice.getFirst(), false))); StorageManager storageManager = new MockStorageManager(storeMap); Properties properties = new Properties(); properties.put("stats.output.file.path", outputFileString); config = new StatsManagerConfig(new VerifiableProperties(properties)); statsManager = new StatsManager(storageManager, new ArrayList<>(storeMap.keySet()), new MetricRegistry(), config, new MockTime()); }
Source:
<code>public void addPatientCorrelationPLQ(PatientLocationQueryResponseType plqRecords, AssertionType assertion) { if (plqRecords == null) { LOG.warn("PLQRecords was null"); } try { PatientCorrelationPLQHelper.addPatientCorrelationPLQRecords(plqRecords); <START> } catch (final Exception ex) { <END> LOG.error("Error calling addPatientCorrelation: {}", ex.getMessage(), ex); } }</code><technical_language>Dont catch generic exceptions. Narrow specific</technical_language>

Target:
public void addPatientCorrelationPLQ(PatientLocationQueryResponseType plqRecords, AssertionType assertion) { if (plqRecords == null) { LOG.warn("PLQRecords was null"); return; } PatientCorrelationPLQHelper.addPatientCorrelationPLQRecords(plqRecords); }
Source:
<code>public void start() { stopAt = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(MAX_PROCESSING_TIME); <START> } <END></code><technical_language>rename stopAt stopAtNs</technical_language>

Target:
public void start() { stopAtNs = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(MAX_PROCESSING_TIME); }
Source:
<code>public void onAlarmDeleted(OnmsAlarm alarm) { <START> final Integer alarmId = alarm.getId(); <END> final String reductionKey = alarm.getReductionKey(); forEachListener(l -> l.handleDeletedAlarm(alarmId, reductionKey)); }</code><technical_language>Line 147 148 redundant</technical_language>

Target:
public void onAlarmDeleted(OnmsAlarm alarm) { forEachListener(l -> l.handleDeletedAlarm(alarm.getId(), alarm.getReductionKey())); }
Source:
<code>protected Set<SubscriptionEventListener> getInterestedListeners(String event) { final Set<SubscriptionEventListener> listeners; synchronized (lock) { final Set<SubscriptionEventListener> sharedListeners = eventNameToListenerMap.get(event); if (sharedListeners != null) { listeners = new HashSet<SubscriptionEventListener>(sharedListeners); } else { listeners = null; } } <START> return listeners; <END> }</code><technical_language>else in this method other synchronized block, need local variable, replace assignments of listeners return statements</technical_language>

Target:
protected Set<SubscriptionEventListener> getInterestedListeners(String event) { synchronized (lock) { final Set<SubscriptionEventListener> sharedListeners = eventNameToListenerMap.get(event); if (sharedListeners == null) { return null; } return new HashSet<>(sharedListeners); } }
Source:
<code>public File getDirectory() { if (tmpdir == null) { tmpdir = getTemporaryDirectory(); if (tmpdir == null) { tmpdir = createDirInsideApplication(); <START> } <END> } return tmpdir.toFile(); }</code><technical_language>put this if other. :+1: anyway... need for locks, temp dir change (or shouldn't, anyway)</technical_language>

Target:
public File getDirectory() { if (tmpdir == null) { tmpdir = getTemporaryDirectory(); } if (tmpdir == null) { tmpdir = createDirInsideApplication(); } return tmpdir.toFile(); }
Source:
<code>private String getMappedAuth3dsResult(StripeNotificationType type) { switch (type) { case SOURCE_CHARGEABLE: return Auth3dsDetails.Auth3dsResult.AUTHORISED.toString(); case SOURCE_CANCELED: return Auth3dsDetails.Auth3dsResult.CANCELED.toString(); case SOURCE_FAILED: return Auth3dsDetails.Auth3dsResult.DECLINED.toString(); default: Auth3dsDetails.Auth3dsResult.ERROR.toString(); } <START> return Auth3dsDetails.Auth3dsResult.ERROR.toString(); <END> }</code><technical_language>If get line 145 return need this line</technical_language>

Target:
private String getMappedAuth3dsResult(StripeNotificationType type) { switch (type) { case SOURCE_CHARGEABLE: return Auth3dsDetails.Auth3dsResult.AUTHORISED.toString(); case SOURCE_CANCELED: return Auth3dsDetails.Auth3dsResult.CANCELED.toString(); case SOURCE_FAILED: return Auth3dsDetails.Auth3dsResult.DECLINED.toString(); default: return Auth3dsDetails.Auth3dsResult.ERROR.toString(); } }
Source:
<code>private void loadVncData(HasConsoleModel model, KeyMaker keyMaker) { if (!(model.getDefaultConsoleModel() instanceof VncConsoleModel)) { return; } model.setSelectedProtocol(ConsoleProtocol.VNC); asVncConsoleModel(model).setVncImplementation(VncConsoleModel.ClientConsoleMode <START> .valueOf(clientStorage.getLocalItem(keyMaker.make(VNC_CLIENT_MODE)))); <END> }</code><technical_language>is present in local storage (see storeVncData). Please wrap ...valueOf(...) try-catch</technical_language>

Target:
private void loadVncData(HasConsoleModel model, KeyMaker keyMaker) { if (!(model.getDefaultConsoleModel() instanceof VncConsoleModel)) { return; } model.setSelectedProtocol(ConsoleProtocol.VNC); try { asVncConsoleModel(model).setVncImplementation(VncConsoleModel.ClientConsoleMode .valueOf(clientStorage.getLocalItem(keyMaker.make(VNC_CLIENT_MODE)))); } catch (Exception e) { } }
Source:
<code><START> BitMappedTrie<T> boxed() { return map(identity()); } <END></code><technical_language>O(n) for changing type (which static in a statically typed language) IS EVIL</technical_language>

Target:
private BitMappedTrie<T> boxed() { return map(identity()); }
Source:
<code>private WFSTCompletionLookup build(final IndexReader indexReader, final String field) throws IOException { WFSTInputIterator iterator = new WFSTInputIterator( new LuceneDictionary(indexReader, field).getEntryIterator(), indexReader, field, getSearchCounts(field)); WFSTCompletionLookup lookup = createWFST(); lookup.build(iterator); <START> if (iterator.termLengthAccumulator > 0) { <END> double averageLength = (double) iterator.termLengthAccumulator / lookup.getCount(); averageLengths.put(field, averageLength); } return lookup; }</code><technical_language>prefer condition check lookup.getCount() a big deal</technical_language>

Target:
private WFSTCompletionLookup build(final IndexReader indexReader, final String field) throws IOException { WFSTInputIterator iterator = new WFSTInputIterator( new LuceneDictionary(indexReader, field).getEntryIterator(), indexReader, field, getSearchCounts(field)); WFSTCompletionLookup lookup = createWFST(); lookup.build(iterator); if (lookup.getCount() > 0) { double averageLength = (double) iterator.termLengthAccumulator / lookup.getCount(); averageLengths.put(field, averageLength); } return lookup; }
Source:
<code>public void invalidAccountTokenWithKubernetesApiMode() { Map<String, Comparable> properties = new HashMap<String, Comparable>(); <START> properties.put(SERVICE_DNS.key(), null); <END> properties.put(KUBERNETES_CA_CERTIFICATE.key(), TEST_CA_CERTIFICATE); new KubernetesConfig(properties); }</code><technical_language>here. I this line is needed</technical_language>

Target:
public void invalidAccountTokenWithKubernetesApiMode() { Map<String, Comparable> properties = new HashMap<String, Comparable>(); properties.put(KUBERNETES_CA_CERTIFICATE.key(), TEST_CA_CERTIFICATE); new KubernetesConfig(properties); }
Source:
<code>private boolean correctStorageDomainFormat() { storage_pool storagePool = getStoragePool(); StorageFormatType storageFormat = getStorageDomain().getStorageFormat(); StorageType storageType = getStorageDomain().getstorage_type(); <START> StorageDomainType storageDomainType = getStorageDomain().getstorage_domain_type(); <END> boolean isBlockStorage = storageType == StorageType.ISCSI || storageType == StorageType.FCP; boolean isDataStorageDomain = storageDomainType == StorageDomainType.Data; Set<StorageFormatType> supportedStorageFormats; if (storagePool != null) { supportedStorageFormats = getSupportedStorageFormatSet(storagePool.getcompatibility_version()); } else { storage_pool vdsStoragePool = getStoragePoolDAO().get(getVds().getstorage_pool_id()); if (vdsStoragePool == null) { return false; } supportedStorageFormats = getSupportedStorageFormatSet(vdsStoragePool.getcompatibility_version()); } if (!supportedStorageFormats.contains(storageFormat)) { return false; } if (storageFormat == StorageFormatType.V1 && isBlockStorage && storagePool == null) { return false; } if (storageFormat == StorageFormatType.V2 && (!isBlockStorage || !isDataStorageDomain)) { return false; } if (storageFormat == StorageFormatType.V3 && !isDataStorageDomain) { return false; } return true; }</code><technical_language>clearer if this storageDomainFunction (it serves a data domain, is of type fcp)</technical_language>

Target:
private boolean correctStorageDomainFormat() { storage_pool targetStoragePool = getStoragePool(); StorageFormatType storageFormat = getStorageDomain().getStorageFormat(); StorageType storageType = getStorageDomain().getstorage_type(); StorageDomainType storageDomainType = getStorageDomain().getstorage_domain_type(); Set<StorageFormatType> supportedStorageFormats; if (targetStoragePool == null) { targetStoragePool = getStoragePoolDAO().get(getVds().getstorage_pool_id()); if (targetStoragePool == null) { return false; } } supportedStorageFormats = getSupportedStorageFormatSet(targetStoragePool.getcompatibility_version()); if (!supportedStorageFormats.contains(storageFormat)) { return false; } boolean isBlockStorage = storageType == StorageType.ISCSI || storageType == StorageType.FCP; boolean isDataStorageDomain = storageDomainType == StorageDomainType.Data; if (storageFormat == StorageFormatType.V2 && (!isBlockStorage || !isDataStorageDomain)) { return false; } if (storageFormat == StorageFormatType.V3 && !isDataStorageDomain) { return false; } return true; }
Source:
<code>private void verifyMBean(StandardMBean mBean) { assertThat(mBean, is( either(instanceOf(MyService.class)) .or(instanceOf(MyService2.class)))); <START> if (mBean instanceof MyService) { <END> assertThat(((MyService) mBean).say("you"), is(equalTo("Hello you"))); verify(service, times(1)).say("you"); } else { assertThat(((MyService2) mBean).say("you"), is(equalTo("Hello you"))); } }</code><technical_language>verifications removed</technical_language>

Target:
private void verifyMBean(StandardMBean mBean) { assertThat(mBean, is( either(instanceOf(MyService.class)) .or(instanceOf(MyService2.class)))); assertThat(mBean.getMBeanInterface().getName(), is( either(equalTo(MyService.class.getName() + "MBean")) .or(equalTo(MyService.class.getName() + "2MBean")))); if (mBean instanceof MyService) { assertThat(((MyService) mBean).say("you"), is(equalTo("Hello you"))); verify(service, times(1)).say("you"); } else { assertThat(((MyService2) mBean).say("you"), is(equalTo("Hello you"))); } }
Source:
<code><START> public List<LocationListener> getListeners() { <END> List<LocationListener> listeners = new ArrayList<>(); for (LocationEngine engine : engineListeners.keySet()) { listeners.addAll(engineListeners.get(engine)); } return listeners; }</code><technical_language>decided remove LostApiClient#numberOfListeners() this removed? I currently in tests only. switch ShadowLocationManager in tests</technical_language>

Target:
List<LocationListener> getListeners() { List<LocationListener> listeners = new ArrayList<>(); for (LocationEngine engine : engineListeners.keySet()) { listeners.addAll(engineListeners.get(engine)); } return listeners; }
Source:
<code>public void testAbuseFilterTriggerWarn() { PageTitle title = new PageTitle(null, "User:Yuvipandaaaaaaaa", TEST_WIKI_SITE); for (int i = 0; i < 2; ++i) { String wikitext = "Testing Abusefilter by simply editing this page. Triggering rule 94" + "at " + System.nanoTime(); service.edit(TEST_WIKI_SITE, title, DEFAULT_SECTION_ID, wikitext, ANONYMOUS_TOKEN, DEFAULT_SUMMARY, false, null, null, new Edit.Callback() { @Override public void success(@NonNull EditingResult result) { if (!(result instanceof SuccessEditResult)) { assertThat(result, instanceOf(AbuseFilterEditResult.class)); assertThat(((AbuseFilterEditResult) result).getType(), <START> is(AbuseFilterEditResult.TYPE_WARNING)); <END> } } @Override public void failure(@NonNull Throwable caught) { throw new RuntimeException(caught); } }); } }</code><technical_language>latch</technical_language>

Target:
public void testAbuseFilterTriggerWarn() { PageTitle title = new PageTitle(null, "User:Yuvipandaaaaaaaa", TEST_WIKI_SITE); for (int i = 0; i < 2; ++i) { String wikitext = "Testing Abusefilter by simply editing this page. Triggering rule 94" + "at " + System.nanoTime(); final TestLatch latch = new TestLatch(); client.request(TEST_WIKI_SITE, title, DEFAULT_SECTION_ID, wikitext, ANONYMOUS_TOKEN, DEFAULT_SUMMARY, false, null, null, new EditClient.Callback() { @Override public void success(@NonNull Call<Edit> call, @NonNull EditingResult result) { if (!(result instanceof SuccessEditResult)) { assertThat(result, instanceOf(AbuseFilterEditResult.class)); assertThat(((AbuseFilterEditResult) result).getType(), is(AbuseFilterEditResult.TYPE_ERROR)); } latch.countDown(); } @Override public void failure(@NonNull Call<Edit> call, @NonNull Throwable caught) { throw new RuntimeException(caught); } }); latch.await(); } }
Source:
<code>public void removeCustomizedViews(String stateType, List<String> resourceNames) { for (String resourceName : resourceNames) { <START> _customizedViewCacheMap.get(stateType).getCustomizedViewCache() <END> .deletePropertyByName(resourceName); } }</code><technical_language>Safer check if stateType exists not</technical_language>

Target:
public void removeCustomizedViews(String stateType, List<String> resourceNames) { if (!_customizedViewCacheMap.containsKey(stateType)) { logger.warn(String.format("The customized state type : %s is not in the cache", stateType)); return; } for (String resourceName : resourceNames) { _customizedViewCacheMap.get(stateType).getCustomizedViewCache() .deletePropertyByName(resourceName); } }
Source:
<code>public Object[] next() { <START> if (m_count < m_objects.length) { <END> return m_objects[m_count++]; } else { throw new NoSuchElementException(); } }</code><technical_language>a personal taste, I prefer: java if (m_count >= m_objects.length) { throw new NoSuchElementException(); } return m_objects[m_count++];</technical_language>

Target:
public Object[] next() { if (m_count >= m_objects.length) { throw new NoSuchElementException(); } return m_objects[m_count++]; }
Source:
<code>private void initializeMetadata() { try { final Map<TopicPartition, OffsetAndMetadata> offsetsAndMetadata = consumer.committed(partitions).entrySet().stream() .filter(e -> e.getValue() != null) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); initializeTaskTime(offsetsAndMetadata); } catch (final TimeoutException e) { log.warn("Encountered while trying to fetch committed offsets, will retry initializing the metadata in the next loop." + <START> "\nConsider overwriting consumer config `default.api.timeout.ms` to a larger value to avoid timeout errors"); <END> throw e; } catch (final KafkaException e) { throw new StreamsException(format("task [%s] Failed to initialize offsets for %s", id, partitions), e); } }</code><technical_language>nit: ConsumerConfig.DEFAULT_API_TIMEOUT_MS_CONFIG instead of a hard-coded string -- in case deprecate config figure out want update this log statement</technical_language>

Target:
private void initializeMetadata() { try { final Map<TopicPartition, OffsetAndMetadata> offsetsAndMetadata = consumer.committed(partitions).entrySet().stream() .filter(e -> e.getValue() != null) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); initializeTaskTime(offsetsAndMetadata); } catch (final TimeoutException e) { log.warn("Encountered while trying to fetch committed offsets, will retry initializing the metadata in the next loop." + "\nConsider overwriting consumer config to a larger value to avoid timeout errors", ConsumerConfig.DEFAULT_API_TIMEOUT_MS_CONFIG); throw e; } catch (final KafkaException e) { throw new StreamsException(format("task [%s] Failed to initialize offsets for %s", id, partitions), e); } }
Source:
<code>public void init() throws ConfigurationResourceException { final ServiceConfiguration config = serviceConfiguration.get(); for (Service service : config.getServices()) { final String name = service.getName().split("=")[1]; <START> this.daemonList.add(new DaemonInfo(name, ignoreList.contains(name), service.isEnabled(), service.isReloadable() )); <END> } }</code><technical_language>member variables in this class scoped this unnecessarily. if is a style preference, pointing out. is true for a couple other classes in this PR well</technical_language>

Target:
public void init() throws ConfigurationResourceException { final ServiceConfiguration config = serviceConfiguration.get(); for (Service service : config.getServices()) { final String name = service.getName().split("=")[1]; daemonList.add(new DaemonInfo(name, ignoreList.contains(name), service.isEnabled(), service.isReloadable() )); } }
Source:
<code>protected Map<Key<?>, ?> getValues(ItemStack dataHolder) { if (!dataHolder.hasTagCompound()) { return Maps.newHashMap(); } Map<Key<?>, Boolean> map = Maps.newHashMap(); int flag = dataHolder.getTagCompound().getInteger(NbtDataUtil.ITEM_HIDE_FLAGS); <START> if (flag - 32 >= 0) { <END> map.put(Keys.HIDE_MISCELLANEOUS, true); flag -= 32; } else { map.put(Keys.HIDE_MISCELLANEOUS, false); } if (flag - 16 >= 0) { map.put(Keys.HIDE_CAN_PLACE, true); flag -= 16; } else { map.put(Keys.HIDE_CAN_PLACE, false); } if (flag - 8 >= 0) { map.put(Keys.HIDE_CAN_DESTROY, true); flag -= 8; } else { map.put(Keys.HIDE_CAN_DESTROY, false); } if (flag - 4 >= 0) { map.put(Keys.HIDE_UNBREAKABLE, true); flag -= 4; } else { map.put(Keys.HIDE_UNBREAKABLE, false); } if (flag - 2 >= 0) { map.put(Keys.HIDE_ATTRIBUTES, true); flag -= 2; } else { map.put(Keys.HIDE_ATTRIBUTES, false); } if (flag - 1 >= 0) { map.put(Keys.HIDE_ENCHANTMENTS, true); } else { map.put(Keys.HIDE_ENCHANTMENTS, false); } return map; }</code><technical_language>bitwise operators (bitwise AND) check for flags</technical_language>

Target:
protected Map<Key<?>, ?> getValues(ItemStack dataHolder) { if (!dataHolder.hasTagCompound()) { return Maps.newHashMap(); } Map<Key<?>, Boolean> map = Maps.newHashMap(); int flag = dataHolder.getTagCompound().getInteger(NbtDataUtil.ITEM_HIDE_FLAGS); if ((flag & DataConstants.HIDE_MISCELLANEOUS_FLAG) != 0) { map.put(Keys.HIDE_MISCELLANEOUS, true); } else { map.put(Keys.HIDE_MISCELLANEOUS, false); } if ((flag & DataConstants.HIDE_CAN_PLACE_FLAG) != 0) { map.put(Keys.HIDE_CAN_PLACE, true); } else { map.put(Keys.HIDE_CAN_PLACE, false); } if ((flag & DataConstants.HIDE_CAN_DESTROY_FLAG) != 0) { map.put(Keys.HIDE_CAN_DESTROY, true); } else { map.put(Keys.HIDE_CAN_DESTROY, false); } if ((flag & DataConstants.HIDE_UNBREAKABLE_FLAG) != 0) { map.put(Keys.HIDE_UNBREAKABLE, true); } else { map.put(Keys.HIDE_UNBREAKABLE, false); } if ((flag & DataConstants.HIDE_ATTRIBUTES_FLAG) != 0) { map.put(Keys.HIDE_ATTRIBUTES, true); } else { map.put(Keys.HIDE_ATTRIBUTES, false); } if ((flag & DataConstants.HIDE_ENCHANTMENTS_FLAG) != 0) { map.put(Keys.HIDE_ENCHANTMENTS, true); } else { map.put(Keys.HIDE_ENCHANTMENTS, false); } return map; }
Source:
<code>public Plot(String title, String yaxis, String group, String numBuilds, String csvFileName, String style, boolean useDescr, boolean keepRecords, boolean exclZero, boolean logarithmic, String yaxisMinimum, String yaxisMaximum, String description) { this.title = title; this.yaxis = yaxis; this.group = group; this.numBuilds = numBuilds; <START> this.description = description; <END> this.csvFileName = csvFileName; this.style = style; this.useDescr = useDescr; this.keepRecords = keepRecords; this.exclZero = exclZero; this.logarithmic = logarithmic; this.yaxisMinimum = yaxisMinimum; this.yaxisMaximum = yaxisMaximum; }</code><technical_language>Please follow parameters order in CTOR assignments order CTOR -> move yaxisMaximum</technical_language>

Target:
public Plot(String title, String yaxis, String group, String numBuilds, String csvFileName, String style, boolean useDescr, boolean keepRecords, boolean exclZero, boolean logarithmic, String yaxisMinimum, String yaxisMaximum, String description) { this.title = title; this.yaxis = yaxis; this.group = group; this.numBuilds = numBuilds; this.csvFileName = csvFileName; this.style = style; this.useDescr = useDescr; this.keepRecords = keepRecords; this.exclZero = exclZero; this.logarithmic = logarithmic; this.yaxisMinimum = yaxisMinimum; this.yaxisMaximum = yaxisMaximum; this.description = description; }
Source:
<code>public void start() { try { final ReviewDb db = schema.open(); try { final CurrentSchemaVersion sVer = getSchemaVersion(db); final int eVer = version.get().getVersionNbr(); if (sVer == null) { throw new ProvisionException("Schema not yet initialized." + " Run init to initialize the schema:\n" + "$ java -jar gerrit.war init -d " + site.site_path.getAbsolutePath()); } if (sVer.versionNbr != eVer) { throw new ProvisionException("Unsupported schema version " + sVer.versionNbr + "; expected schema version " + eVer + ". Run init to upgrade:\n" + "$ java -jar gerrit.war init -d " <START> + site.site_path.getAbsolutePath()); <END> } } finally { db.close(); } } catch (OrmException e) { throw new ProvisionException("Cannot read schema_version", e); } }</code><technical_language>This is nice, running init upgrade helps if expected schema version (eVer) is higher current schema version (sVer.versionNbr). If runs Gerrit version a newer test site, a downgrade is simply supported. I differentiate cases give dedicated error messages</technical_language>

Target:
public void start() { try { final ReviewDb db = schema.open(); try { final CurrentSchemaVersion currentVer = getSchemaVersion(db); final int expectedVer = version.get().getVersionNbr(); if (currentVer == null) { throw new ProvisionException("Schema not yet initialized." + " Run init to initialize the schema:\n" + "$ java -jar gerrit.war init -d " + site.site_path.getAbsolutePath()); } if (currentVer.versionNbr < expectedVer) { throw new ProvisionException("Unsupported schema version " + currentVer.versionNbr + "; expected schema version " + expectedVer + ". Run init to upgrade:\n" + "$ java -jar gerrit.war init -d " + site.site_path.getAbsolutePath()); } else if (currentVer.versionNbr > expectedVer) { throw new ProvisionException("Unsupported schema version " + currentVer.versionNbr + "; expected schema version " + expectedVer + ". Downgrade is not supported."); } } finally { db.close(); } } catch (OrmException e) { throw new ProvisionException("Cannot read schema_version", e); } }
Source:
<code>public Set<AccountGroup.Id> getOwners() { if (!localOwners.isEmpty()) { return localOwners; } else { <START> final ProjectState parent = projectCache.get(project.getParent()); <END> return parent.getOwners(); } }</code><technical_language>need terminate recursion isSpecialWildProject(), handle projects parent (as parent is Projects). I replace method with: if (!localOwners.isEmpty() || isSpecialWildProject() || project.getParent() == null) { return localOwners; } ProjectState parent = projectCache.get(project.getParent()); if (parent != null) { return parent.getOwners(); } return Collections.emptySet();</technical_language>

Target:
public Set<AccountGroup.Id> getOwners() { if (!localOwners.isEmpty() || isSpecialWildProject() || project.getParent() == null) { return localOwners; } final ProjectState parent = projectCache.get(project.getParent()); if (parent != null) { return parent.getOwners(); } return Collections.emptySet(); }
Source:
<code>public boolean shouldWait() { if (resultSet == null) { resultSet = new ReadResultSetImpl<>(minSize, maxSize, getNodeEngine().getSerializationService(), filter); sequence = startSequence; } RingbufferContainer ringbuffer = getRingBufferContainer(); sequence = ringbuffer.clampReadSequenceToBounds(sequence); if (minSize == 0) { <START> if (!ringbuffer.shouldWait(sequence)) { <END> readMany(ringbuffer); } return false; } if (resultSet.isMinSizeReached()) { return false; } if (sequence == ringbuffer.tailSequence() + 1) { return true; } readMany(ringbuffer); return !resultSet.isMinSizeReached(); }</code><technical_language>checked sequence number prior this line this check correct StateSequenceException. replaced this: if (sequence != ringbuffer.tailSequence() + 1)</technical_language>

Target:
public boolean shouldWait() { if (resultSet == null) { resultSet = new ReadResultSetImpl<>(minSize, maxSize, getNodeEngine().getSerializationService(), filter); sequence = startSequence; } RingbufferContainer ringbuffer = getRingBufferContainer(); sequence = ringbuffer.clampReadSequenceToBounds(sequence); if (minSize == 0) { if (sequence < ringbuffer.tailSequence() + 1) { readMany(ringbuffer); } return false; } if (resultSet.isMinSizeReached()) { return false; } if (sequence == ringbuffer.tailSequence() + 1) { return true; } readMany(ringbuffer); return !resultSet.isMinSizeReached(); }
Source:
<code>private void restore(Bundle savedInstanceState) { if (player == null) { if (savedInstanceState != null <START> && savedInstanceState.containsKey("player")) { <END> player = (IPlayer) savedInstanceState.get("player"); } else { player = new Player(); } } if (savedInstanceState != null && savedInstanceState.containsKey("isMessageDisplayed")) { if (savedInstanceState.getBoolean("isMessageDisplayed")) { showVideoNotAvailable(VideoNotPlayMessageType.IS_VIDEO_MESSAGE_DISPLAYED); } } if (savedInstanceState != null) { isPrepared = savedInstanceState.getBoolean("isPrepared"); isAutoPlayDone = savedInstanceState.getBoolean("isAutoPlayDone"); } reAttachPlayEventListener(); }</code><technical_language>saved state keys defined constants</technical_language>

Target:
private void restore(Bundle savedInstanceState) { if (savedInstanceState != null) { player = (IPlayer) savedInstanceState.get(KEY_PLAYER); isPrepared = savedInstanceState.getBoolean(KEY_PREPARED); isAutoPlayDone = savedInstanceState.getBoolean(KEY_AUTOPLAY_DONE); transcript = (TranscriptModel) savedInstanceState.get(KEY_TRANSCRIPT); if (savedInstanceState.getBoolean(KEY_MESSAGE_DISPLAYED)) { showVideoNotAvailable(VideoNotPlayMessageType.IS_VIDEO_MESSAGE_DISPLAYED); } } else { player = new Player(); } }
Source:
<code>private boolean checkPresentOrNullable(Invocation invocation, String paramKey, int argIndex, Object arg) { <START> if (arg == null && !Reflection2.getInvokableParameters(invocation.getInvokable()).get(argIndex).isAnnotationPresent(Nullable.class)) <END> throw new NullPointerException(format("param{%s} for invocation %s.%s", paramKey, invocation.getInvokable() .getOwnerType().getRawType().getSimpleName(), invocation.getInvokable().getName())); return true; }</code><technical_language>Static import of Reflection2.getInvokableParameters</technical_language>

Target:
private boolean checkPresentOrNullable(Invocation invocation, String paramKey, int argIndex, Object arg) { if (arg == null && !getInvokableParameters(invocation.getInvokable()).get(argIndex).isAnnotationPresent(Nullable.class)) throw new NullPointerException(format("param{%s} for invocation %s.%s", paramKey, invocation.getInvokable() .getOwnerType().getRawType().getSimpleName(), invocation.getInvokable().getName())); return true; }
Source:
<code>private void assureVectorSize() { int requiredVectorLength = min(nextBatchSize, MAX_BATCH_SIZE); if (isNullVector.length < requiredVectorLength) { isNullVector = new boolean[requiredVectorLength]; inDictionaryVector = new boolean[requiredVectorLength]; <START> systemMemoryContext.setBytes(requiredVectorLength * 9); <END> } }</code><technical_language>Please constants in airlift SizeOf</technical_language>

Target:
private void assureVectorSize() { int requiredVectorLength = min(nextBatchSize, MAX_BATCH_SIZE); if (isNullVector.length < requiredVectorLength) { isNullVector = new boolean[requiredVectorLength]; inDictionaryVector = new boolean[requiredVectorLength]; systemMemoryContext.setBytes(getRetainedSizeInBytes()); } }
Source:
<code>public boolean presentationVisible() { <START> CheckBox lastCheckBox = checkBoxes_.get(checkBoxes_.size() - 1); <END> return StringUtil.equals(lastCheckBox.getText(), "Presentation") && lastCheckBox.isVisible(); }</code><technical_language>Is risk of this called checkBoxes_ is empty, checkBoxes_.size() - 1 negative (I think) end throwing exception? worth a check for this if chance of happening</technical_language>

Target:
public boolean presentationVisible() { if (checkBoxes_.size() <= 0) return false; CheckBox lastCheckBox = checkBoxes_.get(checkBoxes_.size() - 1); return StringUtil.equals(lastCheckBox.getText(), "Presentation") && lastCheckBox.isVisible(); }
Source:
<code>public void setMsqMinSelectableChoices(int qnNumber, int value) { assertTrue(isMsqMinSelectableChoicesEnabled(qnNumber)); WebElement inputBox = getMsqMinSelectableChoicesBox(qnNumber); JavascriptExecutor exec = (JavascriptExecutor) browser.driver; String id = inputBox.getAttribute("id"); <START> exec.executeScript(String.format("$('#%s').val(%d);$('#%s').change();", id, value, id)); <END> }</code><technical_language>need instantiate executor here. executeScript is for subclasses of AppPage</technical_language>

Target:
public void setMsqMinSelectableChoices(int qnNumber, int value) { assertTrue(isMsqMinSelectableChoicesEnabled(qnNumber)); WebElement inputBox = getMsqMinSelectableChoicesBox(qnNumber); String id = inputBox.getAttribute("id"); executeScript(String.format("$('#%s').val(%d);$('#%s').change();", id, value, id)); }
Source:
<code>private void retrieveDescriptor(String connectorType) { Filter filter; try { <START> filter = serviceUtils.makeFilter(ConnectorProvider.class, String.format("(connector=%s)", connectorType)); <END> } catch (InvalidSyntaxException e) { throw new IllegalArgumentException(e); } ConnectorProvider connectorProvider = serviceUtils.getOsgiServiceProxy(filter, ConnectorProvider.class); descriptor = connectorProvider.getDescriptor(); }</code><technical_language>Constants.CONNECTOR</technical_language>

Target:
private void retrieveDescriptor(String connectorType) { Filter filter = serviceUtils.makeFilter(ConnectorProvider.class, String.format("(%s=%s)", Constants.CONNECTOR_KEY, connectorType)); ConnectorProvider connectorProvider = serviceUtils.getOsgiServiceProxy(filter, ConnectorProvider.class); descriptor = connectorProvider.getDescriptor(); }
Source:
<code>public static void testGetClientMultiTenant() throws MambuApiException { System.out.println("\nIn testGetClientMultiTenant"); MambuAPIServiceFactory serviceFactory = DemoUtil.getAPIServiceFactory(); ClientsService clientService = serviceFactory.getClientService(); Client myClient = clientService.getClient(demoClient.getEncodedKey()); System.out.println("Client Service by ID Ok, ID=" + myClient.getId()); MambuAPIServiceFactory serviceFactory2 = MambuAPIServiceFactory.getFactory( "non-existing-subdomain.sandbox.mambu.com", "non-existing-user", "non-existing-password"); ClientsService clientService2 = serviceFactory2.getClientService(); try { clientService2.getClient(demoClient.getEncodedKey()); <START> System.out.println("Client Service by ID NOT Ok"); <END> } catch (MambuApiException e) { System.out.println("Client Service by ID Ok, invalid subdomain"); } myClient = clientService.getClient(demoClient.getEncodedKey()); System.out.println("Client Service by ID still Ok, ID=" + myClient.getId()); }</code><technical_language>not-ok ok sysout interchanged</technical_language>

Target:
public static void testGetClientMultiTenant() throws MambuApiException { System.out.println("\nIn testGetClientMultiTenant"); MambuAPIServiceFactory serviceFactory = DemoUtil.getAPIServiceFactory(); ClientsService clientService = serviceFactory.getClientService(); Client myClient = clientService.getClient(demoClient.getEncodedKey()); System.out.println("Client Service by ID Ok, ID=" + myClient.getId()); MambuAPIServiceFactory serviceFactory2 = MambuAPIServiceFactory.getFactory( "non-existing-subdomain.sandbox.mambu.com", "non-existing-user", "non-existing-password"); ClientsService clientService2 = serviceFactory2.getClientService(); try { clientService2.getClient(demoClient.getEncodedKey()); System.out.println("Client Service by ID NOT Ok, should have thrown an exception"); } catch (MambuApiException e) { System.out .println("Client Service by ID Ok, an exception was caught as expected due to an invalid subdomain"); } myClient = clientService.getClient(demoClient.getEncodedKey()); System.out.println("Client Service by ID still Ok, ID=" + myClient.getId()); MambuAPIServiceFactory serviceFactory3 = DemoUtil.getAPIServiceFactory(true); ClientsService clientService3 = serviceFactory3.getClientService(); myClient = clientService3.getClient(demoClient2.getEncodedKey()); System.out.println("Client Service by ID Ok, ID=" + myClient.getId()); String otherClientId = myClient.getId(); myClient = clientService.getClient(demoClient.getEncodedKey()); if (otherClientId.equals(myClient.getId())) { System.out.println("Client Service by ID *NOT* Ok since both clients have same ID, ID=" + myClient.getId()); } else { System.out.println("Client Service by ID Ok since different ID, ID=" + myClient.getId()); } }
Source:
<code>public DruidRequestBody( @JsonProperty("query") String query, @JsonProperty("resultFormat") String resultFormat, @JsonProperty("queryHeader") boolean queryHeader) { requireNonNull(query); <START> this.query = query; <END> this.resultFormat = resultFormat; this.queryHeader = queryHeader; }</code><technical_language>this.query = requireNonNull(query);</technical_language>

Target:
public DruidRequestBody( @JsonProperty("query") String query, @JsonProperty("resultFormat") String resultFormat, @JsonProperty("queryHeader") boolean queryHeader) { this.query = requireNonNull(query); this.resultFormat = requireNonNull(resultFormat); this.queryHeader = queryHeader; }
Source:
<code>void handleFragmentTaskMessage(FragmentTaskMessage message) { <START> boolean shortcutRead = message.isReadOnly() && m_defaultConsistencyReadLevel.hasShortcutRead(); <END> FragmentTaskMessage msg = message; long newSpHandle; if (m_isLeader) { msg = new FragmentTaskMessage(message.getInitiatorHSId(), message.getCoordinatorHSId(), message); if (!shortcutRead) { TxnEgo ego = advanceTxnEgo(); newSpHandle = ego.getTxnId(); } else { newSpHandle = getMaxTaskedSpHandle(); } msg.setSpHandle(newSpHandle); if (msg.getInitiateTask() != null) { msg.getInitiateTask().setSpHandle(newSpHandle); msg.setStateForDurability(msg.getInitiateTask(), msg.getInvolvedPartitions()); } if (m_sendToHSIds.length > 0 && (!shortcutRead || msg.isSysProcTask())) { FragmentTaskMessage replmsg = new FragmentTaskMessage(m_mailbox.getHSId(), m_mailbox.getHSId(), msg); m_mailbox.send(m_sendToHSIds, replmsg); DuplicateCounter counter; if (message.getFragmentTaskType() != FragmentTaskMessage.SYS_PROC_PER_SITE) { counter = new DuplicateCounter( msg.getCoordinatorHSId(), msg.getTxnId(), m_replicaHSIds, message); } else { counter = new SysProcDuplicateCounter( msg.getCoordinatorHSId(), msg.getTxnId(), m_replicaHSIds, message); } safeAddToDuplicateCounterMap(new DuplicateCounterKey(message.getTxnId(), newSpHandle), counter); } } else { newSpHandle = msg.getSpHandle(); setMaxSeenTxnId(newSpHandle); } Iv2Trace.logFragmentTaskMessage(message, m_mailbox.getHSId(), newSpHandle, false); doLocalFragmentOffer(msg); }</code><technical_language>real-only fragments replicated</technical_language>

Target:
void handleFragmentTaskMessage(FragmentTaskMessage message) { FragmentTaskMessage msg = message; long newSpHandle; if (m_isLeader) { msg = new FragmentTaskMessage(message.getInitiatorHSId(), message.getCoordinatorHSId(), message); if (!message.isReadOnly()) { TxnEgo ego = advanceTxnEgo(); newSpHandle = ego.getTxnId(); } else { newSpHandle = getMaxTaskedSpHandle(); } msg.setSpHandle(newSpHandle); if (msg.getInitiateTask() != null) { msg.getInitiateTask().setSpHandle(newSpHandle); msg.setStateForDurability(msg.getInitiateTask(), msg.getInvolvedPartitions()); } if (m_sendToHSIds.length > 0 && (!message.isReadOnly() || msg.isSysProcTask())) { FragmentTaskMessage replmsg = new FragmentTaskMessage(m_mailbox.getHSId(), m_mailbox.getHSId(), msg); m_mailbox.send(m_sendToHSIds, replmsg); DuplicateCounter counter; if (message.getFragmentTaskType() != FragmentTaskMessage.SYS_PROC_PER_SITE) { counter = new DuplicateCounter( msg.getCoordinatorHSId(), msg.getTxnId(), m_replicaHSIds, message); } else { counter = new SysProcDuplicateCounter( msg.getCoordinatorHSId(), msg.getTxnId(), m_replicaHSIds, message); } safeAddToDuplicateCounterMap(new DuplicateCounterKey(message.getTxnId(), newSpHandle), counter); } } else { newSpHandle = msg.getSpHandle(); setMaxSeenTxnId(newSpHandle); } Iv2Trace.logFragmentTaskMessage(message, m_mailbox.getHSId(), newSpHandle, false); doLocalFragmentOffer(msg); }
Source:
<code>public void executeTaskWithNullDefinitionCreatesDefinitionIfConfigured() { initializeSuccessfulRegistry(appRegistry); when(this.taskLauncher.launch(any())).thenReturn("0"); <START> taskExecutionService.executeTask("demo", new HashMap<>(), new LinkedList<>()); <END> }</code><technical_language>test task definitions repo if task definition created</technical_language>

Target:
public void executeTaskWithNullDefinitionCreatesDefinitionIfConfigured() { initializeSuccessfulRegistry(appRegistry); when(this.taskLauncher.launch(any())).thenReturn("0"); taskExecutionService.executeTask("demo", new HashMap<>(), new LinkedList<>()); assertNotNull(taskDefinitionRepository.findByTaskName("demo")); }
Source:
<code>public void testValidWildmatch1() throws Exception { createFiles("a", "dir/x", "dir/sub1/x", "dir/sub2/x/y"); <START> writeTrashFile(".gitattributes", "**dir"); <END> assertSameAsCGit(); }</code><technical_language>I need attribute here. differences anyway</technical_language>

Target:
public void testValidWildmatch1() throws Exception { createFiles("a", "dir/x", "dir/sub1/x", "dir/sub2/x/y"); writeTrashFile(".gitattributes", "**dir bar\n"); assertSameAsCGit(); }