auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Set<SOURCE> getActiveSources() { Set<SOURCE> inactiveSources = Sets.newHashSet(); <START> inactiveSources.addAll(soundSources.keySet().stream().filter(source -> isActive(source)).collect(Collectors.toList())); <END> return inactiveSources; }</code><technical_language>I guess set collector here</technical_language>

Target:
public Set<SOURCE> getActiveSources() { return soundSources.keySet().stream().filter(this::isActive).collect(Collectors.toCollection(HashSet::new)); }
Source:
<code>protected void init() { super.init(); if (Guid.Empty.equals(getParameters().getVmId())) { boolean vmPrestarted = true; Guid vmToAttach = vmPoolHandler.selectPrestartedVm( getVmPoolId(), <START> getVmPool().isStateful(), <END> (vmId, errors) -> getReturnValue().getValidationMessages().addAll(errors)); if (Guid.Empty.equals(vmToAttach)) { vmPrestarted = false; vmToAttach = vmPoolHandler.selectNonPrestartedVm( getVmPoolId(), (vmId, errors) -> getReturnValue().getValidationMessages().addAll(errors)); } getParameters().setVmId(vmToAttach); getParameters().setVmPrestarted(vmPrestarted); } setVmId(getParameters().getVmId()); }</code><technical_language>getVmPool return null if invalid pool-id REST, right</technical_language>

Target:
protected void init() { super.init(); if (Guid.Empty.equals(getParameters().getVmId()) && getVmPool() != null) { boolean vmPrestarted = true; Guid vmToAttach = vmPoolHandler.selectPrestartedVm( getVmPoolId(), getVmPool().isStateful(), (vmId, errors) -> getReturnValue().getValidationMessages().addAll(errors)); if (Guid.Empty.equals(vmToAttach)) { vmPrestarted = false; vmToAttach = vmPoolHandler.selectNonPrestartedVm( getVmPoolId(), (vmId, errors) -> getReturnValue().getValidationMessages().addAll(errors)); } getParameters().setVmId(vmToAttach); getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VM, vmToAttach)); getParameters().setVmPrestarted(vmPrestarted); } setVmId(getParameters().getVmId()); }
Source:
<code>public void showPreview(final PageTitle title, final String wikiText) { hideSoftKeyboard(requireActivity()); parentActivity.showProgressBar(true); String url = model.getTitle().getWikiSite().uri() + PAGE_HTML_PREVIEW_ENDPOINT + title.getPrefixedText(); String postData; try { <START> postData = "wikitext=" + URLEncoder.encode(wikiText, "UTF-8"); <END> webview.postUrl(url, postData.getBytes()); } catch (UnsupportedEncodingException e) { parentActivity.showError(e.getCause()); L.e(e.getCause()); } setUpWebView(); }</code><technical_language>a utility method called UriUtil.encodeUrl() automatically takes care of catching unsupported encoding exceptions, happen</technical_language>

Target:
public void showPreview(final PageTitle title, final String wikiText) { hideSoftKeyboard(requireActivity()); parentActivity.showProgressBar(true); String url = model.getTitle().getWikiSite().uri() + PAGE_HTML_PREVIEW_ENDPOINT + title.getConvertedText(); String postData; postData = "wikitext=" + UriUtil.encodeURL(wikiText); webview.postUrl(url, postData.getBytes()); setUpWebView(); }
Source:
<code>public void init(final T model) { super.init(model); model.getPropertyChangedEvent().addListener((ev, sender, args) -> { NetworkModel senderModel = (NetworkModel) sender; String propertyName = args.propertyName; if ("Message".equals(propertyName)) { getView().setMessageLabel(senderModel.getMessage()); } }); getView().toggleSubnetVisibility(model.getExternal().getEntity()); model.getExternal().getEntityChangedEvent().addListener((ev, sender, args) -> getView().toggleSubnetVisibility( model.getExternal().getEntity() && !model.getExternalProviders().getSelectedItem().getIsUnmanaged())); model.getExternalProviders().getSelectedItemChangedEvent().addListener((ev, sender, args) -> <START> getView().toggleSubnetVisibility(model.getExternal().getEntity() && !model.getExternalProviders().getSelectedItem().getIsUnmanaged())); <END> getView().toggleProfilesVisibility(model.getProfiles().getIsAvailable()); model.getProfiles().getPropertyChangedEvent().addListener((ev, sender, args) -> { if ("IsAvailable".equals(args.propertyName)) { getView().toggleProfilesVisibility(model.getProfiles().getIsAvailable()); } }); getView().getQosButton().setCommand(model.getAddQosCommand()); getView().getQosButton().addClickHandler(event -> getView().getQosButton().getCommand().execute()); getView().addMtuEditor(); }</code><technical_language>Please extract a method reuse in #50 & #52</technical_language>

Target:
public void init(final T model) { super.init(model); model.getPropertyChangedEvent().addListener((ev, sender, args) -> { NetworkModel senderModel = (NetworkModel) sender; String propertyName = args.propertyName; if ("Message".equals(propertyName)) { getView().setMessageLabel(senderModel.getMessage()); } }); getView().toggleSubnetVisibility(model.getExternal().getEntity()); model.getExternal().getEntityChangedEvent().addListener((ev, sender, args) -> toggleSubnetVisibility(model)); model.getExternalProviders().getSelectedItemChangedEvent().addListener((ev, sender, args) -> toggleSubnetVisibility(model)); model.getProfiles().getPropertyChangedEvent().addListener((ev, sender, args) -> { if ("IsAvailable".equals(args.propertyName)) { getView().toggleProfilesVisibility(model.getProfiles().getIsAvailable()); } }); getView().getQosButton().setCommand(model.getAddQosCommand()); getView().getQosButton().addClickHandler(event -> getView().getQosButton().getCommand().execute()); getView().addMtuEditor(); }
Source:
<code>public void doTestHook(final SPOTS spot, final DefaultQuery _ignored, final ExecutionContext executionContext) { switch (spot) { case BEFORE_QUERY_EXECUTION: try { <START> if (!latch.await(8, SECONDS)) { <END> logger.warn("doTestHook latch took to long to release"); if (!latch.await(1, MINUTES)) { logger.error("doTestHook latch took way way long to release"); fail("testhook: query was not unlatched in time"); } } } catch (InterruptedException e) { e.printStackTrace(); Thread.currentThread().interrupt(); } break; case BEFORE_ADD_OR_UPDATE_MAPPING_OR_DESERIALIZING_NTH_STREAMINGOPERATION: if (hitCriticalThreshold && hitOnce.compareAndSet(false, true)) { InternalResourceManager resourceManager = (InternalResourceManager) getCache().getResourceManager(); resourceManager.getHeapMonitor().updateStateAndSendEvent(CRITICAL_HEAP_USED, "test"); await().until(() -> vmCheckCritcalHeap() == EVICTION_DISABLED_CRITICAL); callbackVM .invoke(() -> ResourceManagerWithQueryMonitorDUnitTest.criticalMemoryCountDownLatch .countDown()); } break; case LOW_MEMORY_WHEN_DESERIALIZING_STREAMINGOPERATION: rejectedObjects = true; break; default: break; } }</code><technical_language>I recommend changing await GeodeAwaitility.getTimeout()</technical_language>

Target:
public void doTestHook(final SPOTS spot, final DefaultQuery _ignored, final ExecutionContext executionContext) { switch (spot) { case BEFORE_QUERY_EXECUTION: try { if (!latch.await(GeodeAwaitility.getTimeout().getValueInMS(), MILLISECONDS)) { fail("doTestHook: query was not unlatched in time"); } } catch (InterruptedException e) { e.printStackTrace(); Thread.currentThread().interrupt(); } break; case BEFORE_ADD_OR_UPDATE_MAPPING_OR_DESERIALIZING_NTH_STREAMINGOPERATION: if (hitCriticalThreshold && hitOnce.compareAndSet(false, true)) { InternalResourceManager resourceManager = (InternalResourceManager) getCache().getResourceManager(); resourceManager.getHeapMonitor().updateStateAndSendEvent(CRITICAL_HEAP_USED, "test"); await().until(() -> vmCheckCritcalHeap() == EVICTION_DISABLED_CRITICAL); callbackVM .invoke(() -> ResourceManagerWithQueryMonitorDUnitTest.criticalMemoryCountDownLatch .countDown()); } break; case LOW_MEMORY_WHEN_DESERIALIZING_STREAMINGOPERATION: rejectedObjects = true; break; default: break; } }
Source:
<code>public void testAltNames() throws Exception { <START> final File altFile = File.createTempFile("CreateSequenceDictionaryTest.", ".alt"); <END> final PrintWriter pw = new PrintWriter(altFile); pw.println("chr1\t1"); pw.println("chr1\t01"); pw.println("chr1\tk1"); pw.println("chrMT\tM"); pw.flush(); pw.close(); altFile.deleteOnExit(); final File outputDict = File.createTempFile("CreateSequenceDictionaryTest.", ".dict"); outputDict.delete(); outputDict.deleteOnExit(); final String[] argv = { "REFERENCE=" + BASIC_FASTA, "AN=" + altFile, "OUTPUT=" + outputDict, "TRUNCATE_NAMES_AT_WHITESPACE=true" }; Assert.assertEquals(runPicardCommandLine(argv), 0); final SAMSequenceDictionary dict = SAMSequenceDictionaryExtractor.extractDictionary(outputDict); Assert.assertNotNull(dict, "dictionary is null"); SAMSequenceRecord ssr = dict.getSequence("chr1"); Assert.assertNotNull(ssr, "chr1 missing in dictionary"); String an = ssr.getAttribute("AN"); Assert.assertNotNull(ssr, "AN Missing"); Set<String> anSet = new HashSet<>(Arrays.asList(an.split("[,]"))); Assert.assertTrue(anSet.contains("1")); Assert.assertTrue(anSet.contains("01")); Assert.assertTrue(anSet.contains("k1")); Assert.assertFalse(anSet.contains("M")); ssr = dict.getSequence("chr2"); Assert.assertNotNull(ssr, "chr2 missing in dictionary"); an = ssr.getAttribute("AN"); Assert.assertNull(an, "AN Present"); ssr = dict.getSequence("chrM"); Assert.assertNull(ssr, "chrM presnt in dictionary"); }</code><technical_language>arg createTempFile() end in a</technical_language>

Target:
public void testAltNames() throws Exception { final File altFile = File.createTempFile("CreateSequenceDictionaryTest", ".alt"); final PrintWriter pw = new PrintWriter(altFile); pw.println("chr1\t1"); pw.println("chr1\t01"); pw.println("chr1\tk1"); pw.println("chrMT\tM"); pw.flush(); pw.close(); altFile.deleteOnExit(); final File outputDict = File.createTempFile("CreateSequenceDictionaryTest.", ".dict"); outputDict.delete(); outputDict.deleteOnExit(); final String[] argv = { "REFERENCE=" + BASIC_FASTA, "AN=" + altFile, "OUTPUT=" + outputDict, "TRUNCATE_NAMES_AT_WHITESPACE=true" }; Assert.assertEquals(runPicardCommandLine(argv), 0); final SAMSequenceDictionary dict = SAMSequenceDictionaryExtractor.extractDictionary(outputDict); Assert.assertNotNull(dict, "dictionary is null"); SAMSequenceRecord ssr = dict.getSequence("chr1"); Assert.assertNotNull(ssr, "chr1 missing in dictionary"); String an = ssr.getAttribute("AN"); Assert.assertNotNull(ssr, "AN Missing"); Set<String> anSet = new HashSet<>(Arrays.asList(an.split("[,]"))); Assert.assertTrue(anSet.contains("1")); Assert.assertTrue(anSet.contains("01")); Assert.assertTrue(anSet.contains("k1")); Assert.assertFalse(anSet.contains("M")); ssr = dict.getSequence("chr2"); Assert.assertNotNull(ssr, "chr2 missing in dictionary"); an = ssr.getAttribute("AN"); Assert.assertNull(an, "AN Present"); ssr = dict.getSequence("chrM"); Assert.assertNull(ssr, "chrM present in dictionary"); }
Source:
<code>private List<ProcessInstance> startProcess(KieSession kieSession, String processId, int count) throws InterruptedException { List<ProcessInstance> piList = new ArrayList<ProcessInstance>(); for (int i = 0; i < count; i++) { <START> TimeUnit.MILLISECONDS.sleep(1000); <END> ProcessInstance pi = kieSession.startProcess(processId); if (pi != null) { piList.add(pi); } } return piList; }</code><technical_language>Reduce sleep time (probably a milliseconds is enough)</technical_language>

Target:
private List<ProcessInstance> startProcess(KieSession kieSession, String processId, int count) throws InterruptedException { return this.startProcess(kieSession, processId, count, 0); }
Source:
<code>public Boolean call() throws InterruptedException{ CallContext callContext = bulkExecCallerImpl.getCallContextQueue().poll(); continueCalling = (callContext == null)? false:bulkExecCallerImpl.processOutput((CallContextImpl) callContext); if(continueCalling) { bulkExecCallerImpl.getCallContextQueue().put(callContext); submitTask(this); } <START> else { <END> aliveCallContextCount.decrementAndGet(); if (aliveCallContextCount.get() == 0) { getCallerThreadPoolExecutor().shutdown(); } } return true; }</code><technical_language>suggest moving decrementAndGet() call if() test. way, a thread change this thread value, thread zero. change Output endpoint</technical_language>

Target:
public Boolean call() throws InterruptedException{ CallContext callContext = bulkExecCallerImpl.getCallContextQueue().poll(); continueCalling = (callContext == null)? false:bulkExecCallerImpl.processOutput((CallContextImpl) callContext); if(continueCalling) { bulkExecCallerImpl.getCallContextQueue().put(callContext); submitTask(this); } else { if (aliveCallContextCount.decrementAndGet() == 0) { getCallerThreadPoolExecutor().shutdown(); } } return true; }
Source:
<code>public String getDropboxDisplayName(String siteId) { if (m_siteService.isUserSite(siteId) || m_siteService.isSpecialSite(siteId)) { return null; } String id = COLLECTION_DROPBOX + siteId + "/"; if (isDropboxMaintainer(siteId)) { return siteId + DROPBOX_ID; } <START> String displayId = userDirectoryService.getCurrentUser().getDisplayId(); <END> if(displayId != null && displayId.length()>0) { return userDirectoryService.getCurrentUser().getSortName()+" ("+ displayId+")"; } else { return userDirectoryService.getCurrentUser().getSortName(); } }</code><technical_language>chunk of code in 3 places, refactored out a method a user parameter. easier if needs change in future</technical_language>

Target:
public String getDropboxDisplayName(String siteId) { if (m_siteService.isUserSite(siteId) || m_siteService.isSpecialSite(siteId)) { return null; } String id = COLLECTION_DROPBOX + siteId + "/"; if (isDropboxMaintainer(siteId)) { return siteId + DROPBOX_ID; } return getDisplayName(null); }
Source:
<code>private void possiblyResetOffsetsOrWait( Map<TopicPartition, Long> outOfRangePartitions, KafkaConsumer<byte[], byte[]> consumer, Set<Integer> assignment ) throws InterruptedException { boolean shouldRetry = false; <START> for (Map.Entry<TopicPartition, Long> outOfRangePartition : outOfRangePartitions.entrySet()) { <END> final TopicPartition topicPartition = outOfRangePartition.getKey(); final long nextOffset = outOfRangePartition.getValue(); consumer.seekToBeginning(topicPartition); final long leastAvailableOffset = consumer.position(topicPartition); consumer.seek(topicPartition, nextOffset); if (tuningConfig.isResetOffsetAutomatically() && leastAvailableOffset > nextOffset) { resetOffset(consumer, assignment, topicPartition); } else { shouldRetry = true; } } if (shouldRetry) { log.warn("Retrying in %dms", POLL_RETRY_MS); pollRetryLock.lockInterruptibly(); try { long nanos = TimeUnit.MILLISECONDS.toNanos(POLL_RETRY_MS); while (nanos > 0L && !pauseRequested && !stopRequested) { nanos = isAwaitingRetry.awaitNanos(nanos); } } finally { pollRetryLock.unlock(); } } }</code><technical_language>do need run this code resetOffsetAutomatically is set false</technical_language>

Target:
private void possiblyResetOffsetsOrWait( Map<TopicPartition, Long> outOfRangePartitions, KafkaConsumer<byte[], byte[]> consumer, Set<Integer> assignment ) throws InterruptedException { boolean shouldRetry = false; if(tuningConfig.isResetOffsetAutomatically()) { for (Map.Entry<TopicPartition, Long> outOfRangePartition : outOfRangePartitions.entrySet()) { final TopicPartition topicPartition = outOfRangePartition.getKey(); final long nextOffset = outOfRangePartition.getValue(); consumer.seekToBeginning(topicPartition); final long leastAvailableOffset = consumer.position(topicPartition); consumer.seek(topicPartition, nextOffset); if (leastAvailableOffset > nextOffset) { resetOffset(consumer, assignment, topicPartition); } else { shouldRetry = true; } } } else { shouldRetry = true; } if (shouldRetry) { log.warn("Retrying in %dms", POLL_RETRY_MS); pollRetryLock.lockInterruptibly(); try { long nanos = TimeUnit.MILLISECONDS.toNanos(POLL_RETRY_MS); while (nanos > 0L && !pauseRequested && !stopRequested) { nanos = isAwaitingRetry.awaitNanos(nanos); } } finally { pollRetryLock.unlock(); } } }
Source:
<code><START> public boolean initializeStream(StreamSpec streamSpec) { <END> systemStreamToPartitions.put(streamSpec.toSystemStream(), streamSpec.getPartitionCount()); for (int partition = 0; partition < streamSpec.getPartitionCount(); partition++) { bufferedMessages.put( new SystemStreamPartition(streamSpec.toSystemStream(), new Partition(partition)), newSynchronizedLinkedList()); } return true; }</code><technical_language>need for this function. function a null check</technical_language>

Target:
boolean initializeStream(StreamSpec streamSpec) { LOG.info("Initializing the stream for {}", streamSpec.getId()); systemStreamToPartitions.put(streamSpec.toSystemStream(), streamSpec.getPartitionCount()); for (int partition = 0; partition < streamSpec.getPartitionCount(); partition++) { bufferedMessages.put( new SystemStreamPartition(streamSpec.toSystemStream(), new Partition(partition)), newSynchronizedLinkedList()); } return true; }
Source:
<code>private ResultSet getNextResultSet() { closeCurrentResultSet(); if (!tableIds.hasNext()) { return null; } Long tableId = tableIds.next(); Long columnId = metadataDao.getTemporalColumnId(tableId); List<String> columnNames; if (columnId == null) { columnNames = getMappedColumnNames(DEFAULT_COLUMN_NAME, DEFAULT_COLUMN_NAME, DEFAULT_COLUMN_NAME, DEFAULT_COLUMN_NAME); } else { Type temporalType = metadataDao.getTableColumn(tableId, columnId).getDataType(); checkState(temporalType.equals(DATE) || temporalType.equals(TIMESTAMP), "Temporal column should be of type date or timestamp: %s", temporalType); if (temporalType.equals(DATE)) { columnNames = getMappedColumnNames(DEFAULT_COLUMN_NAME, DEFAULT_COLUMN_NAME, minColumn(columnId), maxColumn(columnId)); } else { columnNames = getMappedColumnNames(minColumn(columnId), maxColumn(columnId), DEFAULT_COLUMN_NAME, DEFAULT_COLUMN_NAME); <START> } <END> } try { connection = dbi.open().getConnection(); statement = PreparedStatementBuilder.create( connection, constructSqlTemplate(columnNames, tableId), columnNames, TYPES, ImmutableSet.of(getColumnIndex(SHARD_METADATA, SHARD_UUID)), tupleDomain); return statement.executeQuery(); } catch (SQLException | DBIException e) { close(); throw metadataError(e); } }</code><technical_language>do this way: if(type.equals(DATE)){ .. } else if (type.equals(TIMESTAMP)) { .. } else { throw exception } remove checkState. This is prone errors adding more clauses builds in error check logic</technical_language>

Target:
private ResultSet getNextResultSet() { closeCurrentResultSet(); if (!tableIds.hasNext()) { return null; } Long tableId = tableIds.next(); Long columnId = metadataDao.getTemporalColumnId(tableId); List<String> columnNames; if (columnId == null) { columnNames = getMappedColumnNames("null", "null", "null", "null"); } else { Type temporalType = metadataDao.getTableColumn(tableId, columnId).getDataType(); if (temporalType.equals(DATE)) { columnNames = getMappedColumnNames("null", "null", minColumn(columnId), maxColumn(columnId)); } else if (temporalType.equals(TIMESTAMP)) { columnNames = getMappedColumnNames(minColumn(columnId), maxColumn(columnId), "null", "null"); } else { throw new PrestoException(RAPTOR_CORRUPT_METADATA, "Temporal column should be of type date or timestamp, not " + temporalType.getDisplayName()); } } try { connection = dbi.open().getConnection(); statement = PreparedStatementBuilder.create( connection, constructSqlTemplate(columnNames, tableId), columnNames, TYPES, ImmutableSet.of(getColumnIndex(SHARD_METADATA, SHARD_UUID)), tupleDomain); return statement.executeQuery(); } catch (SQLException | DBIException e) { close(); throw metadataError(e); } }
Source:
<code>protected Iterator<TimelineRecord> readFile( File file ) { final ArrayList<TimelineRecord> result = new ArrayList<TimelineRecord>(); InputStream in = null; try { <START> in = new FileInputStream( file ); <END> TimelineRecord rec = fromProto( TimeLineRecordProtos.TimeLineRecord.parseDelimitedFrom( in ) ); while ( rec != null ) { result.add( rec ); rec = fromProto( TimeLineRecordProtos.TimeLineRecord.parseDelimitedFrom( in ) ); } } catch ( Exception e ) { } finally { IOUtil.close( in ); } return result.iterator(); }</code><technical_language>BufferedInputStream</technical_language>

Target:
protected Iterator<TimelineRecord> readFile( File file ) { final ArrayList<TimelineRecord> result = new ArrayList<TimelineRecord>(); InputStream in = null; try { in = new BufferedInputStream( new FileInputStream( file ) ); TimelineRecord rec = fromProto( TimeLineRecordProtos.TimeLineRecord.parseDelimitedFrom( in ) ); while ( rec != null ) { result.add( rec ); rec = fromProto( TimeLineRecordProtos.TimeLineRecord.parseDelimitedFrom( in ) ); } } catch ( Exception e ) { } finally { IOUtil.close( in ); } return result.iterator(); }
Source:
<code>public void testUpdateBeforeSave() throws Exception { ParseCurrentInstallationController controller = mock(ParseCurrentInstallationController.class); when(controller.isCurrent(any(ParseInstallation.class))).thenReturn(true); ParseCorePlugins.getInstance().registerCurrentInstallationController(controller); RobolectricPackageManager packageManager = spy(RuntimeEnvironment.getRobolectricPackageManager()); doReturn("parseTest").when(packageManager).getApplicationLabel(any(ApplicationInfo.class)); RuntimeEnvironment.setRobolectricPackageManager(packageManager); ParsePlugins.Android plugins = mock(ParsePlugins.Android.class); InstallationId installationId = mock(InstallationId.class); when(installationId.get()).thenReturn("installationId"); when(plugins.installationId()).thenReturn(installationId); when(plugins.applicationContext()).thenReturn(RuntimeEnvironment.application); ParsePlugins.set(plugins); ParseInstallation installation = new ParseInstallation(); installation.updateBeforeSave(); String zone = TimeZone.getDefault().getID(); assertEquals(zone, installation.getString(KEY_TIME_ZONE)); Context context = Parse.getApplicationContext(); String packageName = context.getPackageName(); PackageManager pm = context.getPackageManager(); PackageInfo pkgInfo = pm.getPackageInfo(packageName, 0); String appVersion = pkgInfo.versionName; String appName = pm.getApplicationLabel(pm.getApplicationInfo(packageName, 0)).toString(); assertEquals(packageName, installation.getString(KEY_APP_IDENTIFIER)); assertEquals(appName, installation.getString(KEY_APP_NAME)); assertEquals(appVersion, installation.getString(KEY_APP_VERSION)); assertEquals("android", installation.getString(KEY_DEVICE_TYPE)); assertEquals(installationId.get(), installation.getString(KEY_INSTALLATION_ID)); <START> assertEquals("en-US", installation.getString(KEY_LOCALE_IDENTIFIER)); <END> }</code><technical_language>a locale Locale.setDefaultLocale(Locale) running a en-US device</technical_language>

Target:
public void testUpdateBeforeSave() throws Exception { mocksForUpdateBeforeSave(); Locale.setDefault(new Locale("en", "US")); ParseInstallation installation = new ParseInstallation(); installation.updateBeforeSave(); String zone = TimeZone.getDefault().getID(); assertEquals(zone, installation.getString(KEY_TIME_ZONE)); Context context = Parse.getApplicationContext(); String packageName = context.getPackageName(); PackageManager pm = context.getPackageManager(); PackageInfo pkgInfo = pm.getPackageInfo(packageName, 0); String appVersion = pkgInfo.versionName; String appName = pm.getApplicationLabel(pm.getApplicationInfo(packageName, 0)).toString(); assertEquals(packageName, installation.getString(KEY_APP_IDENTIFIER)); assertEquals(appName, installation.getString(KEY_APP_NAME)); assertEquals(appVersion, installation.getString(KEY_APP_VERSION)); assertEquals("android", installation.getString(KEY_DEVICE_TYPE)); assertEquals("installationId", installation.getString(KEY_INSTALLATION_ID)); assertEquals("en-US", installation.getString(KEY_LOCALE_IDENTIFIER)); }
Source:
<code>protected Map getMapProperty(String key) { Object value = getProperty(key); if (value != null) { if (value instanceof Map) { return (Map) value; } <START> } <END> return null; }</code><technical_language>I remember usage paradigm here, I if is null, assertion is a Map. caller of this method is do wrong (i.e. expecting a map property is a map), a bug fixed</technical_language>

Target:
protected Map getMapProperty(String key) { Object value = getProperty(key); if (value != null) { if (value instanceof Map) { return (Map) value; } String msg = "'" + key + "' property value type does not match the specified type. Specified type: Map. " + "Existing type: " + value.getClass().getName(); msg += (isPrintableProperty(key) ? ". Value: " + value : "."); throw new IllegalArgumentException(msg); } return null; }
Source:
<code>static boolean validValue( long[] arr, int width ) { if ( arr.length != width ) { throw new AssertionError( "all elements in the set must have the same size" ); } for ( long l : arr ) { <START> if ( l == -1 || l == -2 ) <END> { throw new AssertionError( "magic values -1 and -2 not allowed in keys" ); } } return true; }</code><technical_language>( l == CONTINUE_PROBING || l == NOT_IN_USE)</technical_language>

Target:
static boolean validValue( long[] arr, int width ) { if ( arr.length != width ) { throw new AssertionError( "all elements in the set must have the same size" ); } for ( long l : arr ) { if ( l == NOT_IN_USE ) { throw new AssertionError( "magic value " + NOT_IN_USE + " not allowed in keys" ); } } return true; }
Source:
<code>private void calcMedicalSupportHoursNeeded() { ArrayList<Person> activePersonnel = new ArrayList<>(); <START> for (Person p : getCampaign().getPersonnel()) { if (p.isActive()) { activePersonnel.add(p); } } <END> int numSquads = new BigDecimal(activePersonnel.size()) .divide(new BigDecimal(7), 0, RoundingMode.DOWN).intValue(); int leftOver = activePersonnel.size() - (numSquads * 7); medSupportNeeded = (numSquads * 4) + (3 + (new BigDecimal(leftOver).divide( new BigDecimal(5), 0, RoundingMode.HALF_EVEN).intValue())); }</code><technical_language>I this "isActive" check enough Campaign warrants a "getActivePersonnel()" method carries work out internally</technical_language>

Target:
private void calcMedicalSupportHoursNeeded() { int activePersonnelCount = getCampaign().getActivePersonnel().size(); int numSquads = new BigDecimal(activePersonnelCount) .divide(new BigDecimal(7), 0, RoundingMode.DOWN).intValue(); int leftOver = activePersonnelCount - (numSquads * 7); medSupportNeeded = (numSquads * 4) + (3 + (new BigDecimal(leftOver).divide( new BigDecimal(5), 0, RoundingMode.HALF_EVEN).intValue())); }
Source:
<code>private void executeScript(List<Operation> operations) throws IOException { for (Operation operation : operations) { echo("Start operation: " + operation.getDescription()); for (SimulateParticipantProcess process : _processMap.values()) { process.getAndResetTransitions(); } if (operation.execute(_admin, _zkClient, _clusterName)) { ClusterStateVerifier.verifyByPolling(() -> { for (SimulateParticipantProcess process : _processMap.values()) { if (process.getTransitionCount() > 0) { return true; } } return false; }, DEFAULT_WAIT_TIME); if (!isClusterConverged()) { <START> echo("Cluster does not converge after operation " + operation.getDescription() <END> + ". Stop the next operation."); break; } printState("Done operation: " + operation.getDescription()); } else { echo("Operation " + operation.getDescription() + " failed. Stop the next operation."); break; } } }</code><technical_language>operation trigger multiple transitions, right? if multiple Participants transitions fully completed them? want break right away</technical_language>

Target:
private void executeScript(List<Operation> operations) throws IOException { for (Operation operation : operations) { echo("Start operation: " + operation.getDescription()); for (SimulateParticipantProcess process : _participantProcessMap.values()) { process.getAndResetTransitions(); } if (!operation.execute(_admin, _zkClient, _clusterName)) { echo("Operation " + operation.getDescription() + " failed. Stop the next operation."); break; } if (!checkAndPrint(operation.getDescription())) { break; } } }
Source:
<code>public Builder visitArray(List<? extends AnnotationValue> values, Entry entry) { <START> Visitor visitor = new Visitor(builder); <END> for (AnnotationValue value : values) { value.accept(visitor, new Entry(entry.name, value)); } return builder; }</code><technical_language>pass this</technical_language>

Target:
public Builder visitArray(List<? extends AnnotationValue> values, Entry entry) { for (AnnotationValue value : values) { value.accept(this, new Entry(entry.name, value)); } return builder; }
Source:
<code>void onTrackSelected(@NonNull PlayerWrapper player, @NonNull TrackInfo trackInfo) <START> { <END> if (trackInfo.getTrackType() == TrackInfo.MEDIA_TRACK_TYPE_SUBTITLE) { for (int i = 0; i < mSubtitleTracks.size(); i++) { if (mSubtitleTracks.get(i).equals(trackInfo)) { mSelectedSubtitleTrackIndex = i; continue; } } if (mSettingsMode == SETTINGS_MODE_SUBTITLE_TRACK) { mSubSettingsAdapter.setCheckPosition(mSelectedSubtitleTrackIndex + 1); } mSubtitleButton.setImageDrawable( mResources.getDrawable(R.drawable.ic_subtitle_on)); mSubtitleButton.setContentDescription( mResources.getString(R.string.mcv2_cc_is_on)); } else if (trackInfo.getTrackType() == TrackInfo.MEDIA_TRACK_TYPE_AUDIO) { for (int i = 0; i < mAudioTracks.size(); i++) { if (mAudioTracks.get(i).equals(trackInfo)) { mSelectedAudioTrackIndex = i; continue; } } mSettingsSubTextsList.set(SETTINGS_MODE_AUDIO_TRACK, mSubSettingsAdapter.getMainText(mSelectedAudioTrackIndex)); } }</code><technical_language>add if (player != mPlayer) return;</technical_language>

Target:
void onTrackSelected(@NonNull PlayerWrapper player, @NonNull TrackInfo trackInfo) { if (player != mPlayer) return; if (trackInfo.getTrackType() == TrackInfo.MEDIA_TRACK_TYPE_SUBTITLE) { for (int i = 0; i < mSubtitleTracks.size(); i++) { if (mSubtitleTracks.get(i).equals(trackInfo)) { mSelectedSubtitleTrackIndex = i; if (mSettingsMode == SETTINGS_MODE_SUBTITLE_TRACK) { mSubSettingsAdapter.setCheckPosition(mSelectedSubtitleTrackIndex + 1); } mSubtitleButton.setImageDrawable( mResources.getDrawable(R.drawable.ic_subtitle_on)); mSubtitleButton.setContentDescription( mResources.getString(R.string.mcv2_cc_is_on)); break; } } } else if (trackInfo.getTrackType() == TrackInfo.MEDIA_TRACK_TYPE_AUDIO) { for (int i = 0; i < mAudioTracks.size(); i++) { if (mAudioTracks.get(i).equals(trackInfo)) { mSelectedAudioTrackIndex = i; mSettingsSubTextsList.set(SETTINGS_MODE_AUDIO_TRACK, mSubSettingsAdapter.getMainText(mSelectedAudioTrackIndex)); break; } } } }
Source:
<code>public Response getConsent(final @PathParam("clientId") String clientId) { checkAccountApiEnabled(); <START> auth.requireOneOf(AccountRoles.MANAGE_ACCOUNT, AccountRoles.VIEW_PROFILE, AccountRoles.VIEW_CONSENT, AccountRoles.MANAGE_CONSENT); <END> ClientModel client = realm.getClientByClientId(clientId); if (client == null) { return Cors.add(request, Response.status(Response.Status.NOT_FOUND).entity("No client with clientId: " + clientId + " found.")).build(); } UserConsentModel consent = session.users().getConsentByClient(realm, user.getId(), client.getId()); if (consent == null) { return Cors.add(request, Response.noContent()).build(); } return Cors.add(request, Response.ok(modelToRepresentation(consent))).build(); }</code><technical_language>View profile allowed view profile, consent/apps</technical_language>

Target:
public Response getConsent(final @PathParam("clientId") String clientId) { checkAccountApiEnabled(); auth.requireOneOf(AccountRoles.MANAGE_ACCOUNT, AccountRoles.VIEW_CONSENT, AccountRoles.MANAGE_CONSENT); ClientModel client = realm.getClientByClientId(clientId); if (client == null) { return Cors.add(request, Response.status(Response.Status.NOT_FOUND).entity("No client with clientId: " + clientId + " found.")).build(); } UserConsentModel consent = session.users().getConsentByClient(realm, user.getId(), client.getId()); if (consent == null) { return Cors.add(request, Response.noContent()).build(); } return Cors.add(request, Response.ok(modelToRepresentation(consent))).build(); }
Source:
<code><START> public void testSetExpirationOnDoc() throws CouchbaseLiteException, Exception { <END> Date dto3 = new Date(System.currentTimeMillis() + 3000L); MutableDocument doc1a = new MutableDocument("doc1"); doc1a.setInt("answer", 12); doc1a.setValue("question", "What is six plus six?"); save(doc1a); MutableDocument doc1b = new MutableDocument("doc2"); doc1b.setInt("answer", 12); doc1b.setValue("question", "What is six plus six?"); save(doc1b); db.setDocumentExpiration("doc2", new Date(System.currentTimeMillis())); Thread.sleep(500); assertNull(db.getDocument("doc2")); db.setDocumentExpiration("doc1", dto3); Thread.sleep(3 * 1000); assertNull(db.getDocument("doc1")); }</code><technical_language>throw Exception here</technical_language>

Target:
public void testSetExpirationOnDoc() throws Exception { Date dto3 = new Date(System.currentTimeMillis() + 3000L); MutableDocument doc1 = new MutableDocument("doc1"); doc1.setInt("answer", 12); doc1.setValue("question", "What is six plus six?"); save(doc1); MutableDocument doc2 = new MutableDocument("doc2"); doc2.setInt("answer", 12); doc2.setValue("question", "What is six plus six?"); save(doc2); db.setDocumentExpiration("doc2", new Date(System.currentTimeMillis())); Thread.sleep(500); assertNull(db.getDocument("doc2")); db.setDocumentExpiration("doc1", dto3); Thread.sleep(3 * 1000); assertNull(db.getDocument("doc1")); }
Source:
<code>public void showTable(Table table) { this.table = table; nameLabel.setText(table.getName()); <START> DecimalFormat formatter = new DecimalFormat("#,###"); <END> if (table.getRowCount() > 0) { rowCountLabel.setText(formatter.format(table.getRowCount())); } else { rowCountLabel.setText(">= " + formatter.format(table.getRowsCheckedCount())); } fieldTable.clear(); for (Field field : table.getFields()){ fieldTable.add(field.outputName(), field.getType(),field.getDescription()); } commentsArea.setText(table.getComment()); }</code><technical_language>NumberFormat.getInstance() for a locale-dependent formatting</technical_language>

Target:
public void showTable(Table table) { this.table = table; nameLabel.setText(table.getName()); if (table.getRowCount() > 0) { rowCountLabel.setText(numberFormat.format(table.getRowCount())); } else { rowCountLabel.setText(">= " + numberFormat.format(table.getRowsCheckedCount())); } fieldTable.clear(); for (Field field : table.getFields()){ fieldTable.add(field.outputName(), field.getType(),field.getDescription()); } commentsArea.setText(table.getComment()); }
Source:
<code>protected void readSpecificHeader(ByteBuffer buffer) { int size = getConfig().getMaxChildren(); extension = buffer.getInt(); nbChildren = buffer.getInt(); children = new int[size]; for (int i = 0; i < nbChildren; i++) { children[i] = buffer.getInt(); } for (int i = nbChildren; i < size; i++) { buffer.getInt(); } this.childStart = new long[size]; for (int i = 0; i < nbChildren; i++) { childStart[i] = buffer.getLong(); } this.childEnd = new long[size]; for (int i = 0; i < nbChildren; i++) { childEnd[i] = buffer.getLong(); } <START> for (int i = nbChildren; i < size; i++) { <END> buffer.getLong(); } }</code><technical_language>this loop childStart loop</technical_language>

Target:
protected void readSpecificHeader(ByteBuffer buffer) { int size = getConfig().getMaxChildren(); extension = buffer.getInt(); nbChildren = buffer.getInt(); children = new int[size]; for (int i = 0; i < nbChildren; i++) { children[i] = buffer.getInt(); } for (int i = nbChildren; i < size; i++) { buffer.getInt(); } this.childStart = new long[size]; for (int i = 0; i < nbChildren; i++) { childStart[i] = buffer.getLong(); } for (int i = nbChildren; i < size; i++) { buffer.getLong(); } this.childEnd = new long[size]; for (int i = 0; i < nbChildren; i++) { childEnd[i] = buffer.getLong(); } for (int i = nbChildren; i < size; i++) { childEnd[i] = Long.MAX_VALUE; buffer.getLong(); } }
Source:
<code>private void shutdown() { logger.info("OperationController is shutting down"); try { if (shutDownLatch.await(SHUTDOWN_WAIT_MS, TimeUnit.MILLISECONDS)) { logger.error("RequestResponseHandler thread did not shut down gracefully, forcing shut down"); } } catch (InterruptedException e) { logger.error("Exception while shutting down, forcing shutdown", e); } <START> connectionManager.close(); <END> }</code><technical_language>is selector.close(). is in NonBlockingConnectionManager::close() (which is I be)</technical_language>

Target:
private void shutdown() { logger.info("OperationController is shutting down"); try { if (shutDownLatch.await(SHUTDOWN_WAIT_MS, TimeUnit.MILLISECONDS)) { logger.error("RequestResponseHandler thread did not shut down gracefully, forcing shut down"); } } catch (InterruptedException e) { logger.error("Exception while shutting down, forcing shutdown", e); } connectionManager.close(); selector.close(); }
Source:
<code>public void init() { <START> filterSettingsManager.getDefaultActiveFilterKey(defaultFilter -> loadSavedFilters(defaultFilter)); <END> }</code><technical_language>in I default filter is attribute of filter itself. continue _loadSavedFilters_ set default filter automatically</technical_language>

Target:
public void init() { loadSavedFilters(); }
Source:
<code>public void testTimerStreamCancellation() throws Exception { <START> TimeoutStream timer = vertx.timerStream(10); <END> AtomicBoolean called = new AtomicBoolean(); timer.handler(l -> { called.set(true); }); timer.cancel(); vertx.setTimer(500, id -> { assertFalse(called.get()); testComplete(); }); await(); }</code><technical_language>I suspect this deterministic failures CI 10 ms is short</technical_language>

Target:
public void testTimerStreamCancellation() throws Exception { vertx.runOnContext(v -> { TimeoutStream timer = vertx.timerStream(200); AtomicBoolean called = new AtomicBoolean(); timer.handler(l -> { called.set(true); }); timer.cancel(); vertx.setTimer(500, id -> { assertFalse(called.get()); testComplete(); }); }); await(); }
Source:
<code>public List<KeySlice> getRows(String kvsMethodName, KeyRange keyRange, SlicePredicate slicePredicate) { InetSocketAddress host = clientPool.getRandomHostForKey(keyRange.getStart_key()); return clientPool.runWithRetryOnHost( host, <START> new FunctionCheckedException<CassandraClient, List<KeySlice>, RuntimeException>() { <END> @Override public List<KeySlice> apply(CassandraClient client) throws RuntimeException { try { return queryRunner.run(client, tableRef, () -> client.get_range_slices(kvsMethodName, tableRef, slicePredicate, keyRange, consistency)); } catch (UnavailableException e) { throw new InsufficientConsistencyException("get_range_slices requires " + consistency + " Cassandra nodes to be up and available.", e); } catch (Exception e) { throw QosAwareThrowables.unwrapAndThrowRateLimitExceededOrAtlasDbDependencyException(e); } } @Override public String toString() { return "get_range_slices(" + tableRef + ")"; } }); }</code><technical_language>change this a Function throwing a checked exception</technical_language>

Target:
public List<KeySlice> getRows(String kvsMethodName, KeyRange keyRange, SlicePredicate slicePredicate) { InetSocketAddress host = clientPool.getRandomHostForKey(keyRange.getStart_key()); return clientPool.runWithRetryOnHost( host, new FunctionCheckedException<CassandraClient, List<KeySlice>, RuntimeException>() { @Override public List<KeySlice> apply(CassandraClient client) { try { return queryRunner.run(client, tableRef, () -> client.get_range_slices(kvsMethodName, tableRef, slicePredicate, keyRange, consistency)); } catch (UnavailableException e) { throw new InsufficientConsistencyException("get_range_slices requires " + consistency + " Cassandra nodes to be up and available.", e); } catch (Exception e) { throw QosAwareThrowables.unwrapAndThrowRateLimitExceededOrAtlasDbDependencyException(e); } } @Override public String toString() { return "get_range_slices(" + tableRef + ")"; } }); }
Source:
<code><START> private MemoizedMessage(Diagnostic.Kind kind, CharSequence message) { <END> this.kind = kind; this.message = message; }</code><technical_language>transform message string once, in getter</technical_language>

Target:
private MemoizedMessage(Diagnostic.Kind kind, CharSequence message) { this.kind = kind; this.message = message.toString(); }
Source:
<code>public void configure(Binder binder) { JsonConfigProvider.bind(binder, STATIC_CONFIG_PREFIX, NamespaceLookupStaticConfig.class); PolyBind.createChoiceWithDefault( binder, TYPE_PREFIX, Key.get(NamespaceExtractionCacheManager.class), Key.get(OnHeapNamespaceExtractionCacheManager.class), "onheap" ).in(LazySingleton.class); PolyBind .optionBinder(binder, Key.get(NamespaceExtractionCacheManager.class)) .addBinding("offheap") .to(OffHeapNamespaceExtractionCacheManager.class) .in(LazySingleton.class); getNamespaceFactoryMapBinder(binder) .addBinding(JDBCExtractionNamespace.class) .to(JDBCExtractionNamespaceFunctionFactory.class) .in(LazySingleton.class); getNamespaceFactoryMapBinder(binder) .addBinding(URIExtractionNamespace.class) .to(URIExtractionNamespaceFunctionFactory.class) .in(LazySingleton.class); <START> AnnouncementListenerResource <END> .getPOSTHandlerMap(binder) .addBinding("namespace") .toProvider(NamespaceAnnouncementPostHandlerProvider.class) .in(LazySingleton.class); AnnouncementListenerResource .getDELETEHandlerMap(binder) .addBinding("namespace") .toProvider(NamespaceAnnouncementDeleteHandlerProvider.class) .in(LazySingleton.class); AnnouncementListenerResource .getGETHandlerMap(binder) .addBinding("namespace") .toProvider(NamespaceAnnouncementGetHandlerProvider.class) .in(LazySingleton.class); JsonConfigProvider.bind(binder, "druid.zk.paths", NamespaceLookupConfig.class); LifecycleModule.register(binder, NamespaceProcessorAnnouncer.class); Jerseys.addResource(binder, AnnouncementListenerResource.class); LifecycleModule.register(binder, NamespaceStaticConfiguration.class); Jerseys.addResource(binder, NamespacesCacheResource.class); }</code><technical_language>this i removed well</technical_language>

Target:
public void configure(Binder binder) { JsonConfigProvider.bind(binder, STATIC_CONFIG_PREFIX, NamespaceLookupStaticConfig.class); PolyBind.createChoiceWithDefault( binder, TYPE_PREFIX, Key.get(NamespaceExtractionCacheManager.class), Key.get(OnHeapNamespaceExtractionCacheManager.class), "onheap" ).in(LazySingleton.class); PolyBind .optionBinder(binder, Key.get(NamespaceExtractionCacheManager.class)) .addBinding("offheap") .to(OffHeapNamespaceExtractionCacheManager.class) .in(LazySingleton.class); getNamespaceFactoryMapBinder(binder) .addBinding(JDBCExtractionNamespace.class) .to(JDBCExtractionNamespaceFunctionFactory.class) .in(LazySingleton.class); getNamespaceFactoryMapBinder(binder) .addBinding(URIExtractionNamespace.class) .to(URIExtractionNamespaceFunctionFactory.class) .in(LazySingleton.class); LifecycleModule.register(binder, NamespaceStaticConfiguration.class); Jerseys.addResource(binder, NamespacesCacheResource.class); }
Source:
<code>public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); <START> ExtensionSpider spider = Control.getSingleton().getExtensionLoader().getExtension(ExtensionSpider.class); graphQlSpider = new GraphQlSpider(); graphQlParseFilter = new GraphQlParseFilter(); <END> if (spider != null && !"2.9.0".equals(Constant.PROGRAM_VERSION)) { spider.addCustomParseFilter(graphQlParseFilter); spider.addCustomParser(graphQlSpider); LOG.debug("Added GraphQl spider."); } else { LOG.warn("Could not add GraphQl spider."); } if (getView() != null) { extensionHook.getHookMenu().addImportMenuItem(getMenuImportLocalGraphQl()); extensionHook.getHookMenu().addImportMenuItem(getMenuImportUrlGraphQl()); } extensionHook.addApiImplementor(new GraphQlApi()); extensionHook.addCommandLine(getCommandLineArguments()); }</code><technical_language>moved if of version check</technical_language>

Target:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); if (!"2.9.0".equals(Constant.PROGRAM_VERSION)) { ExtensionSpider spider = Control.getSingleton().getExtensionLoader().getExtension(ExtensionSpider.class); graphQlSpider = new GraphQlSpider(); graphQlParseFilter = new GraphQlParseFilter(); if (spider != null) { spider.addCustomParseFilter(graphQlParseFilter); spider.addCustomParser(graphQlSpider); LOG.debug("Added GraphQl spider."); } else { LOG.debug("Could not add GraphQl spider."); } } if (getView() != null) { extensionHook.getHookMenu().addImportMenuItem(getMenuImportLocalGraphQl()); extensionHook.getHookMenu().addImportMenuItem(getMenuImportUrlGraphQl()); } extensionHook.addApiImplementor(new GraphQlApi()); extensionHook.addCommandLine(getCommandLineArguments()); }
Source:
<code>private int lookupSymbol(char chr) throws IOException { int result = -1; Character chrObj = chr; int index = Collections.binarySearch(symbols, chrObj); if (index >= 0) { while (index > 0 && symbols.get(index - 1).compareTo(chrObj) == 0) { index--; } while (index < symbols.size()) { <START> TokenizerSymbol symbol = (symbols.get(index)); <END> if (symbol.compareTo(chrObj) == 0) { if (compare(symbol.startText.toCharArray(), 1)) { result = index; break; } index++; } else { break; } } } return result; }</code><technical_language>Extra parentheses removed</technical_language>

Target:
private int lookupSymbol(char chr) throws IOException { int result = -1; Character chrObj = chr; int index = Collections.binarySearch(symbols, chrObj); if (index >= 0) { while (index > 0 && ((TokenizerSymbol) symbols.get(index - 1)).compareTo(chrObj) == 0) { index--; } while (index < symbols.size()) { TokenizerSymbol symbol = ((TokenizerSymbol) symbols.get(index)); if (symbol.compareTo(chrObj) == 0) { if (compare(symbol.startText.toCharArray(), 1)) { result = index; break; } index++; } else { break; } } } return result; }
Source:
<code><START> public Command getCloneRepoCommand() { <END> return cloneRepoCommand; }</code><technical_language>this public? (package-protected fine.. a detail)</technical_language>

Target:
Command getCloneRepoCommand() { return cloneRepoCommand; }
Source:
<code>public Object get(DataFetchingEnvironment env) { Object source = env.getSource(); if (source == null || !(source instanceof Map)) return null; <START> return ((Map<?, ?>) source).get(keyName); <END> }</code><technical_language>if ... return map.get else return null</technical_language>

Target:
public Object get(DataFetchingEnvironment env) { Object source = env.getSource(); if (source == null || !(source instanceof Map)) return null; return getValue(source); }
Source:
<code>public void init() throws DBException { <START> System.out.println("Init this.toString() = " + this.toString()); <END> super.init(); Properties props = getProperties(); String tableName = props.getProperty(CoreWorkload.TABLENAME_PROPERTY, CoreWorkload.TABLENAME_PROPERTY_DEFAULT); String igniteIPs = props.getProperty(IGNITE_IPS, "127.0.0.1,127.0.0.1:47500..47509"); asyncInsert = Boolean.valueOf(props.getProperty(INSERT_ASYNC, "false")); batchSize = Integer.parseInt(props.getProperty(BATCH_SIZE, "1")); createIgniteClient(tableName, igniteIPs); System.out.println( "" + this + ":" + "\n\tBATCH_SIZE = " + batchSize + "\n\tINSERT_ASYNC = " +asyncInsert); }</code><technical_language>Sysout a Logger</technical_language>

Target:
public void init() throws DBException { super.init(); Properties props = getProperties(); tableName = props.getProperty(CoreWorkload.TABLENAME_PROPERTY, CoreWorkload.TABLENAME_PROPERTY_DEFAULT); String igniteIPs = props.getProperty(IGNITE_IPS, "127.0.0.1,127.0.0.1:47500..47509"); asyncInsert = Boolean.valueOf(props.getProperty(INSERT_ASYNC, "false")); batchSize = Integer.parseInt(props.getProperty(BATCH_SIZE, "1")); createIgniteClient(tableName, igniteIPs); LOG.info( "" + this + ":" + "\n\tBATCH_SIZE = " + batchSize + "\n\tINSERT_ASYNC = " +asyncInsert); }
Source:
<code>private static long getSliceArrayRetainedSizeInBytes(Slice[] values) { <START> long sizeInBytes = SizeOf.sizeOf(values); <END> Map<Object, Boolean> uniqueRetained = new IdentityHashMap<>(values.length); for (Slice value : values) { if (value != null && value.getBase() != null && uniqueRetained.put(value.getBase(), true) == null) { sizeInBytes += value.getRetainedSize(); } } return sizeInBytes; }</code><technical_language>Replace SizeOf.sizeOf. statically imported it</technical_language>

Target:
private static long getSliceArrayRetainedSizeInBytes(Slice[] values) { long sizeInBytes = sizeOf(values); Map<Object, Boolean> uniqueRetained = new IdentityHashMap<>(values.length); for (Slice value : values) { if (value == null) { continue; } if (value.getBase() != null && uniqueRetained.put(value.getBase(), true) == null) { sizeInBytes += value.getRetainedSize(); } } return sizeInBytes; }