auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onTagDialog() { try { TagChoiceDialogFragment fragment = new TagChoiceDialogFragment(); fragment.setPreSelectedTags( Keyword.getVisibleKeywords(mMessage.getFlags())); fragment.show(getFragmentManager(), "tag_choice"); } catch (Exception e) { <START> e.printStackTrace(); <END> } }</code><technical_language>logging instead of this</technical_language>

Target:
public void onTagDialog() { try { TagChoiceDialogFragment fragment = new TagChoiceDialogFragment(); final FlagManager flagManager = FlagManager.getFlagManager(); fragment.setPreSelectedTags( flagManager.getVisibleKeywords(mMessage.getFlags())); fragment.show(getFragmentManager(), "tag_choice"); } catch (Exception e) { Timber.e(e, "Cannot show TagChoiceDialogFragment"); } }
Source:
<code>public ReserveVmInterfaceVspCommand(String nicUuid, String nicMacAddress, String networkUuid, boolean isL3Network, boolean isSharedNetwork, String vpcUuid, String networkDomainUuid, String networksAccountUuid, boolean isDomainRouter, String domainRouterIp, String vmInstanceName, String vmUuid, String vmUserName, String vmUserDomainName, boolean useStaticIp, String staticIp, String staticNatIpUuid, String staticNatIpAddress, boolean isStaticNatIpAllocated, boolean isOneToOneNat, String staticNatVlanUuid, <START> String staticNatVlanGateway, String staticNatVlanNetmask) { <END> super(); this._nicUuid = nicUuid; this._nicMacAddress = nicMacAddress; this._networkUuid = networkUuid; this._isL3Network = isL3Network; this._isSharedNetwork = isSharedNetwork; this._vpcUuid = vpcUuid; this._networkDomainUuid = networkDomainUuid; this._networksAccountUuid = networksAccountUuid; this._isDomainRouter = isDomainRouter; this._domainRouterIp = domainRouterIp; this._vmInstanceName = vmInstanceName; this._vmUuid = vmUuid; this._vmUserName = vmUserName; this._vmUserDomainName = vmUserDomainName; this._useStaticIp = useStaticIp; this._staticIp = staticIp; this._staticNatIpUuid = staticNatIpUuid; this._staticNatIpAddress = staticNatIpAddress; this._isStaticNatIpAllocated = isStaticNatIpAllocated; this._isOneToOneNat = isOneToOneNat; this._staticNatVlanUuid = staticNatVlanUuid; this._staticNatVlanGateway = staticNatVlanGateway; this._staticNatVlanNetmask = staticNatVlanNetmask; }</code><technical_language>number of parameters is extremely large -- creating a brittle interface difficult comprehend client client. Please refactor Builder pattern</technical_language>

Target:
private ReserveVmInterfaceVspCommand(String nicUuid, String nicMacAddress, String networkUuid, boolean isL3Network, boolean isSharedNetwork, String vpcUuid, String networkDomainUuid, String networksAccountUuid, boolean isDomainRouter, String domainRouterIp, String vmInstanceName, String vmUuid, String vmUserName, String vmUserDomainName, boolean useStaticIp, String staticIp, String staticNatIpUuid, String staticNatIpAddress, boolean isStaticNatIpAllocated, boolean isOneToOneNat, String staticNatVlanUuid, String staticNatVlanGateway, String staticNatVlanNetmask) { super(); this._nicUuid = nicUuid; this._nicMacAddress = nicMacAddress; this._networkUuid = networkUuid; this._isL3Network = isL3Network; this._isSharedNetwork = isSharedNetwork; this._vpcUuid = vpcUuid; this._networkDomainUuid = networkDomainUuid; this._networksAccountUuid = networksAccountUuid; this._isDomainRouter = isDomainRouter; this._domainRouterIp = domainRouterIp; this._vmInstanceName = vmInstanceName; this._vmUuid = vmUuid; this._vmUserName = vmUserName; this._vmUserDomainName = vmUserDomainName; this._useStaticIp = useStaticIp; this._staticIp = staticIp; this._staticNatIpUuid = staticNatIpUuid; this._staticNatIpAddress = staticNatIpAddress; this._isStaticNatIpAllocated = isStaticNatIpAllocated; this._isOneToOneNat = isOneToOneNat; this._staticNatVlanUuid = staticNatVlanUuid; this._staticNatVlanGateway = staticNatVlanGateway; this._staticNatVlanNetmask = staticNatVlanNetmask; }
Source:
<code><START> void mkfile(final OpenMode openMode, final String path, final MainFragment ma) { <END> mk(R.string.newfile, (dialog, which) -> { EditText textfield = dialog.getCustomView().findViewById(R.id.singleedittext_input); mkFile(new HybridFile(openMode, path + "/" + textfield.getText().toString()), ma); dialog.dismiss(); }, (text) -> { boolean isValidFilename = Utils.isValidFilename(text); if (isValidFilename && text.length() > 0 && !text.toLowerCase().endsWith(".txt")) { return new WarnableTextInputValidator.ReturnState( WarnableTextInputValidator.ReturnState.STATE_WARNING, R.string.create_file_suggest_txt_extension); } else { if (!isValidFilename) { return new WarnableTextInputValidator.ReturnState( WarnableTextInputValidator.ReturnState.STATE_ERROR, R.string.invalid_name); } else if (text.length() < 1) { return new WarnableTextInputValidator.ReturnState( WarnableTextInputValidator.ReturnState.STATE_ERROR, R.string.field_empty); } } return new WarnableTextInputValidator.ReturnState(); }); }</code><technical_language>".txt" is missing dialog shows</technical_language>

Target:
void mkfile(final OpenMode openMode, final String path, final MainFragment ma) { mk(R.string.newfile, ".txt", (dialog, which) -> { EditText textfield = dialog.getCustomView().findViewById(R.id.singleedittext_input); mkFile(new HybridFile(openMode, path + "/" + textfield.getText().toString()), ma); dialog.dismiss(); }, (text) -> { boolean isValidFilename = FileUtil.isValidFilename(text); if (isValidFilename && text.length() > 0 && !text.toLowerCase().endsWith(".txt")) { return new WarnableTextInputValidator.ReturnState( WarnableTextInputValidator.ReturnState.STATE_WARNING, R.string.create_file_suggest_txt_extension); } else { if (!isValidFilename) { return new WarnableTextInputValidator.ReturnState( WarnableTextInputValidator.ReturnState.STATE_ERROR, R.string.invalid_name); } else if (text.length() < 1) { return new WarnableTextInputValidator.ReturnState( WarnableTextInputValidator.ReturnState.STATE_ERROR, R.string.field_empty); } } return new WarnableTextInputValidator.ReturnState(); }); }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SplittingBAMIndex that = (SplittingBAMIndex) o; <START> return !(virtualOffsets != null ? !virtualOffsets.equals(that.virtualOffsets) : that <END> .virtualOffsets != null); }</code><technical_language>simplifying this? This java return virtualOffsets != null ? virtualOffsets.equals(that.virtualOffsets) : that.virtualOffsets == null);</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SplittingBAMIndex that = (SplittingBAMIndex) o; return virtualOffsets != null ? virtualOffsets.equals(that.virtualOffsets) : that .virtualOffsets == null; }
Source:
<code>private static IPath decodePath(String str) { <START> if (null == str) { <END> return Path.fromPortableString(decode(str)); } else switch (str) { case "#": return null; case "&": return Path.EMPTY; default: return Path.fromPortableString(decode(str)); } }</code><technical_language>change boolean nomatch= false; if (str != null) switch (str) { ... default: nomatch= true; break; ... if (nomatch) { return Path.fromPortableString(decode(str)); }</technical_language>

Target:
private static IPath decodePath(String str) { if (str == null) return Path.fromPortableString(""); switch (str) { case "#": return null; case "&": return Path.EMPTY; default: return Path.fromPortableString(decode(str)); } }
Source:
<code>protected void joinRows(Map<String, Object> row) { <START> Map<String, Object> join = new HashMap<String, Object>(); <END> if (row != null) { for (Index index : table1Columns) { index.filter(row, join); } } outport.emit(join); }</code><technical_language>Generics right redundant Java 7</technical_language>

Target:
protected void joinRows(Map<String, Object> row) { Map<String, Object> join = new HashMap<>(); if (row != null) { for (Index index : table1Columns) { index.filter(row, join); } } outport.emit(join); }
Source:
<code>public boolean equals(Object o) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } CacheKey cacheKey = (CacheKey) o; <START> if ( annotationDescriptor != null ? !annotationDescriptor.equals( cacheKey.annotationDescriptor ) : cacheKey.annotationDescriptor != null ) { <END> return false; } if ( constraintFactory != null ? !constraintFactory.equals( cacheKey.constraintFactory ) : cacheKey.constraintFactory != null ) { return false; } if ( validatedType != null ? !validatedType.equals( cacheKey.validatedType ) : cacheKey.validatedType != null ) { return false; } return true; }</code><technical_language>get rid of null checks (except for constraintFactory)</technical_language>

Target:
public boolean equals(Object o) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } CacheKey cacheKey = (CacheKey) o; if ( !annotationDescriptor.equals( cacheKey.annotationDescriptor ) ) { return false; } if ( !validatedType.equals( cacheKey.validatedType ) ) { return false; } if ( !constraintValidatorFactory.equals( cacheKey.constraintValidatorFactory ) ) { return false; } return true; }
Source:
<code>public synchronized void tryToRefreshSessionCookie( ){ if ( task == null || task.isCancelled() ) { task =new GetSessesionExchangeCookieTask(MainApplication.instance()) { @Override public void onSuccess(List<HttpCookie> result) { if (result == null || result.isEmpty()) { logger.debug("result is empty"); EventBus.getDefault().post(new SessionIdRefreshEvent(false)); return; } long currentTime = new Date().getTime(); for (HttpCookie cookie : result) { if (cookie.getName().equals(PrefManager.Key.SESSION_ID)) { clearWebWiewCookie(context); PrefManager pref = new PrefManager(MainApplication.instance(), PrefManager.Pref.LOGIN); pref.put(PrefManager.Key.AUTH_ASSESSMENT_SESSION_ID, cookie.getValue()); EventBus.getDefault().post(new SessionIdRefreshEvent(true)); break; } } task = null; } <START> <END> @Override public void onException(Exception ex) { logger.error(ex); EventBus.getDefault().post(new SessionIdRefreshEvent(false)); task = null; } }; task.execute(); } }</code><technical_language>currentTime variable initialization removed longer used</technical_language>

Target:
public synchronized void tryToRefreshSessionCookie( ){ if ( task == null || task.isCancelled() ) { task =new GetSessesionExchangeCookieTask(MainApplication.instance()) { @Override public void onSuccess(List<HttpCookie> result) { if (result == null || result.isEmpty()) { logger.debug("result is empty"); EventBus.getDefault().post(new SessionIdRefreshEvent(false)); return; } for (HttpCookie cookie : result) { if (cookie.getName().equals(PrefManager.Key.SESSION_ID)) { clearWebWiewCookie(context); PrefManager pref = new PrefManager(MainApplication.instance(), PrefManager.Pref.LOGIN); pref.put(PrefManager.Key.AUTH_ASSESSMENT_SESSION_ID, cookie.getValue()); EventBus.getDefault().post(new SessionIdRefreshEvent(true)); break; } } task = null; } @Override public void onException(Exception ex) { logger.error(ex); EventBus.getDefault().post(new SessionIdRefreshEvent(false)); task = null; } }; task.execute(); } }
Source:
<code>public ExpiringAuthenticationStore(SpnegoAuthentication authentication) { <START> this.authentication = authentication; <END> results = CacheBuilder.newBuilder() .concurrencyLevel(CONCURRENCY_LEVEL) .maximumSize(CACHE_SIZE) .expireAfterWrite(CACHE_EXPIRE_TIME.roundTo(TimeUnit.MINUTES), TimeUnit.MINUTES).build(); }</code><technical_language>null check</technical_language>

Target:
public ExpiringAuthenticationStore(SpnegoAuthentication authentication) { requireNonNull(authentication, "authentication is null"); this.authentication = authentication; results = CacheBuilder.newBuilder() .concurrencyLevel(CONCURRENCY_LEVEL) .maximumSize(CACHE_SIZE) .expireAfterWrite(CACHE_EXPIRE_TIME.roundTo(TimeUnit.MINUTES), TimeUnit.MINUTES).build(); }
Source:
<code>private void addSegment(final DruidServerMetadata server, final DataSegment segment) { synchronized (lock) { final Map<DataSegment, SegmentMetadataHolder> knownSegments = segmentMetadataInfo.get(segment.getDataSource()); if (knownSegments == null || !knownSegments.containsKey(segment)) { <START> final long isRealtime = server.segmentReplicatable() ? 0 : 1; <END> final long isPublished = server.getType().toString().equals(ServerType.HISTORICAL.toString()) ? 1 : 0; SegmentMetadataHolder holder = new SegmentMetadataHolder(null, isPublished, 1, isRealtime, 1, null); setSegmentSignature(segment, holder); segmentsNeedingRefresh.add(segment); if (!server.segmentReplicatable()) { log.debug("Added new mutable segment[%s].", segment.getIdentifier()); mutableSegments.add(segment); } else { log.debug("Added new immutable segment[%s].", segment.getIdentifier()); } } else { if (knownSegments != null && knownSegments.containsKey(segment)) { SegmentMetadataHolder holder = knownSegments.get(segment); holder.setNumReplicas(holder.getNumReplicas() + 1); } if (server.segmentReplicatable()) { mutableSegments.remove(segment); log.debug("Segment[%s] has become immutable.", segment.getIdentifier()); } } if (!tables.containsKey(segment.getDataSource())) { refreshImmediately = true; } lock.notifyAll(); } }</code><technical_language>segmentReplicatable() instead of server.getType() == ServerType.INDEXER_EXECUTOR</technical_language>

Target:
private void addSegment(final DruidServerMetadata server, final DataSegment segment) { synchronized (lock) { final Map<DataSegment, SegmentMetadataHolder> knownSegments = segmentMetadataInfo.get(segment.getDataSource()); if (knownSegments == null || !knownSegments.containsKey(segment)) { final long isRealtime = server.segmentReplicatable() ? 0 : 1; final long isPublished = server.getType() == ServerType.HISTORICAL ? 1 : 0; SegmentMetadataHolder holder = new SegmentMetadataHolder.Builder(isPublished, 1, isRealtime, 1).build(); setSegmentSignature(segment, holder); segmentsNeedingRefresh.add(segment); if (!server.segmentReplicatable()) { log.debug("Added new mutable segment[%s].", segment.getIdentifier()); mutableSegments.add(segment); } else { log.debug("Added new immutable segment[%s].", segment.getIdentifier()); } } else { if (knownSegments.containsKey(segment)) { SegmentMetadataHolder holder = knownSegments.get(segment); SegmentMetadataHolder holderWithNumReplicas = new SegmentMetadataHolder.Builder( holder.isPublished(), holder.isAvailable(), holder.isRealtime(), holder.getNumReplicas() ).withNumReplicas(holder.getNumReplicas() + 1).build(); knownSegments.put(segment, holderWithNumReplicas); } if (server.segmentReplicatable()) { mutableSegments.remove(segment); log.debug("Segment[%s] has become immutable.", segment.getIdentifier()); } } if (!tables.containsKey(segment.getDataSource())) { refreshImmediately = true; } lock.notifyAll(); } }
Source:
<code>private static void encodeTlvs(List<HAProxyTLV> haProxyTLVs, ByteBuf out) { <START> for (HAProxyTLV tlv: haProxyTLVs) { <END> encodeTlv(tlv, out); } }</code><technical_language>closing index based for loop eliminate GC pressure</technical_language>

Target:
private static void encodeTlvs(List<HAProxyTLV> haProxyTLVs, ByteBuf out) { for (int i = 0; i < haProxyTLVs.size(); i++) { encodeTlv(haProxyTLVs.get(i), out); } }
Source:
<code>public void serializeType() { String json = "{\"description\":\"Returns the type of o as a string ('string', 'date', 'number', 'array', 'boolean', 'error' or a class name)\",\"params\":\"object o\",\"returns\":\"string\"}"; TestUtils.isSerializedTo(new Type(), json); <START> } <END></code><technical_language>suggestion }</technical_language>

Target:
public void serializeType() { String json = "{\"description\":\"Returns the type of o as a string ('string', 'date', 'number', 'array', 'boolean' or a class name)\",\"params\":\"object o\",\"returns\":\"string\"}"; TestUtils.isSerializedTo(new Type(), json); }
Source:
<code>public EEFRadioLifecycleManager(EEFRadioDescription description, IVariableManager variableManager, IInterpreter interpreter, TransactionalEditingDomain editingDomain) { <START> super(description, variableManager, <END> interpreter, editingDomain); this.description = description; }</code><technical_language>done</technical_language>

Target:
public EEFRadioLifecycleManager(EEFRadioDescription description, IVariableManager variableManager, IInterpreter interpreter, TransactionalEditingDomain editingDomain) { super(variableManager, interpreter, editingDomain); this.description = description; }
Source:
<code>private static void findDirtyFiles(@NotNull String filePath, @NotNull GraphGenerator<String> dependenciesGraph, @NotNull Set<String> dirtyFiles) { if (dirtyFiles.contains(filePath)) return; dirtyFiles.add(filePath); <START> Iterator<String> childIterator = dependenciesGraph.getOut(filePath); <END> while (childIterator.hasNext()) { findDirtyFiles(childIterator.next(), dependenciesGraph, dirtyFiles); } }</code><technical_language>I pedantic, I hoped figure out yourself. agreed understand this method context. understand this variable named properly? dependency graph is built in out mean? naming 'dependentFiles' picture complete - able read this method understand marks files dependent dirty files dirty. if wrong</technical_language>

Target:
private static void findDirtyFiles(@NotNull String filePath, @NotNull GraphGenerator<String> dependenciesGraph, @NotNull Set<String> dirtyFiles) { if (dirtyFiles.contains(filePath)) return; dirtyFiles.add(filePath); Iterator<String> dependentFilesIterator = dependenciesGraph.getOut(filePath); while (dependentFilesIterator.hasNext()) { findDirtyFiles(dependentFilesIterator.next(), dependenciesGraph, dirtyFiles); } }
Source:
<code>public boolean isStaticResourceRequest(HttpServletRequest request) { URL resource; String requestFilename = getRequestFilename(request); if (requestFilename.endsWith("/")) { return false; } <START> if (themeFolder.matcher(requestFilename).find() || requestFilename.startsWith("/" + VAADIN_STATIC_FILES_PATH) <END> || requestFilename.startsWith("/" + VAADIN_BUILD_FILES_PATH)) { return true; } resource = servletService.getStaticResource(requestFilename); if (resource == null && shouldFixIncorrectWebjarPaths() && isIncorrectWebjarPath(requestFilename)) { return true; } return resource != null; }</code><technical_language>Add a line break ||, line length > 80</technical_language>

Target:
public boolean isStaticResourceRequest(HttpServletRequest request) { URL resource; String requestFilename = getRequestFilename(request); if (requestFilename.endsWith("/")) { return false; } if (APP_THEME_PATTERN.matcher(requestFilename).find() || requestFilename .startsWith("/" + VAADIN_STATIC_FILES_PATH) || requestFilename .startsWith("/" + VAADIN_BUILD_FILES_PATH)) { return true; } resource = servletService.getStaticResource(requestFilename); if (resource == null && shouldFixIncorrectWebjarPaths() && isIncorrectWebjarPath(requestFilename)) { return true; } return resource != null; }
Source:
<code>public Mono<TableEntity> getEntity(String partitionKey, String rowKey) { <START> return getEntityWithResponse(partitionKey, rowKey, null).flatMap(response -> Mono.justOrEmpty(response.getValue())); <END> }</code><technical_language>flatMap(FluxUtil::toMono)</technical_language>

Target:
public Mono<TableEntity> getEntity(String partitionKey, String rowKey) { return getEntityWithResponse(partitionKey, rowKey, null).flatMap(FluxUtil::toMono); }
Source:
<code>private void testAdditional() { if (networked) { throw new RuntimeException("testAdditional() is not allowed in networked mode"); } addTest(new TestMVTableEngine()); addTest(new TestAutoReconnect()); addTest(new TestBnf()); addTest(new TestCache()); addTest(new TestCollation()); addTest(new TestCompress()); addTest(new TestConnectionInfo()); addTest(new TestExit()); addTest(new TestFileLock()); addTest(new TestJmx()); addTest(new TestModifyOnWrite()); addTest(new TestOldVersion()); addTest(new TestMultiThreadedKernel()); addTest(new TestPageStore()); addTest(new TestPageStoreCoverage()); addTest(new TestPgServer()); addTest(new TestRecovery()); addTest(new RecoverLobTest()); addTest(createTest("org.h2.test.unit.TestServlet")); addTest(new TestTimeStampWithTimeZone()); addTest(new TestUpgrade()); addTest(new TestUsingIndex()); addTest(new TestValue()); addTest(new TestWeb()); runAddedTests(); addTest(new TestCluster()); addTest(new TestFileLockSerialized()); addTest(new TestFileLockProcess()); addTest(new TestDefrag()); addTest(new TestTools()); <START> addTest(new TestIgnoreCatalogs()); <END> addTest(new TestSampleApps()); addTest(new TestSubqueryPerformanceOnLazyExecutionMode()); runAddedTests(1); }</code><technical_language>invoked test() instead</technical_language>

Target:
private void testAdditional() { if (networked) { throw new RuntimeException("testAdditional() is not allowed in networked mode"); } addTest(new TestMVTableEngine()); addTest(new TestAutoReconnect()); addTest(new TestBnf()); addTest(new TestCache()); addTest(new TestCollation()); addTest(new TestCompress()); addTest(new TestConnectionInfo()); addTest(new TestExit()); addTest(new TestFileLock()); addTest(new TestJmx()); addTest(new TestModifyOnWrite()); addTest(new TestOldVersion()); addTest(new TestMultiThreadedKernel()); addTest(new TestPageStore()); addTest(new TestPageStoreCoverage()); addTest(new TestPgServer()); addTest(new TestRecovery()); addTest(new RecoverLobTest()); addTest(createTest("org.h2.test.unit.TestServlet")); addTest(new TestTimeStampWithTimeZone()); addTest(new TestUpgrade()); addTest(new TestUsingIndex()); addTest(new TestValue()); addTest(new TestWeb()); runAddedTests(); addTest(new TestCluster()); addTest(new TestFileLockSerialized()); addTest(new TestFileLockProcess()); addTest(new TestDefrag()); addTest(new TestTools()); addTest(new TestSampleApps()); addTest(new TestSubqueryPerformanceOnLazyExecutionMode()); runAddedTests(1); }
Source:
<code>public void constructors3() throws Exception { InputStream is = new ByteArrayInputStream("<xonfiguration><property name=\"key1\" value=\"val1\"/></xonfiguration>".getBytes()); Configuration conf = new Configuration(false); ConfigurationUtils.load(conf, is); <START> assertEquals(conf.get("key1"), "val1"); <END> }</code><technical_language>Reverse (expected first)</technical_language>

Target:
public void constructors3() throws Exception { InputStream is = new ByteArrayInputStream( "<xxx><property name=\"key1\" value=\"val1\"/></xxx>".getBytes()); Configuration conf = new Configuration(false); ConfigurationUtils.load(conf, is); assertEquals("val1", conf.get("key1")); }
Source:
<code>public void focusFrame(VControl control) { candybean.log.info("Focusing to frame by control: " + control.toString()); <START> this.getWd().switchTo().frame(control.getWe()); <END> }</code><technical_language>NIT: I strict of camel case capitalizing acronyms. I read switch (meaning getWd getWe getWD getWE)</technical_language>

Target:
public void focusFrame(VControl control) { candybean.log.info("Focusing to frame by control: " + control.toString()); this.wd.switchTo().frame(control.getWe()); }
Source:
<code>public void testMemoryUsageInTheContextOfMemorySegmentAllocation() { final int bufferSize = 128; final int numBuffers = 10; NetworkBufferPool globalPool = new NetworkBufferPool(numBuffers, bufferSize); <START> assertThat(globalPool.getTotalNumberOfMemorySegments(), is(numBuffers)); assertThat(globalPool.getNumberOfAvailableMemorySegments(), is(numBuffers)); assertThat(globalPool.getNumberOfUsedMemorySegments(), is(0)); assertThat(globalPool.getTotalMemory(), is((long) numBuffers * bufferSize)); assertThat(globalPool.getAvailableMemory(), is((long) numBuffers * bufferSize)); assertThat(globalPool.getUsedMemory(), is(0L)); assertThat(globalPool.getNumberOfRegisteredBufferPools(), is(0)); <END> MemorySegment segment = globalPool.requestMemorySegment(); assertThat(segment, is(notNullValue())); assertThat(globalPool.getTotalNumberOfMemorySegments(), is(numBuffers)); assertThat(globalPool.getNumberOfAvailableMemorySegments(), is(numBuffers - 1)); assertThat(globalPool.getNumberOfUsedMemorySegments(), is(1)); assertThat(globalPool.getTotalMemory(), is((long) numBuffers * bufferSize)); assertThat(globalPool.getAvailableMemory(), is((long) (numBuffers - 1) * bufferSize)); assertThat(globalPool.getUsedMemory(), is((long) bufferSize)); assertThat(globalPool.getNumberOfRegisteredBufferPools(), is(0)); }</code><technical_language>is this tested in testCreatePoolAfterDestroy? is create a separate test case for this: testMemoryUsageInTheContextOfMemoryPoolCreation</technical_language>

Target:
public void testMemoryUsageInTheContextOfMemorySegmentAllocation() { final int bufferSize = 128; final int numBuffers = 10; NetworkBufferPool globalPool = new NetworkBufferPool(numBuffers, bufferSize); MemorySegment segment = globalPool.requestMemorySegment(); assertThat(segment, is(notNullValue())); assertThat(globalPool.getTotalNumberOfMemorySegments(), is(numBuffers)); assertThat(globalPool.getNumberOfAvailableMemorySegments(), is(numBuffers - 1)); assertThat(globalPool.getNumberOfUsedMemorySegments(), is(1)); assertThat(globalPool.getTotalMemory(), is((long) numBuffers * bufferSize)); assertThat(globalPool.getAvailableMemory(), is((long) (numBuffers - 1) * bufferSize)); assertThat(globalPool.getUsedMemory(), is((long) bufferSize)); }
Source:
<code>private static String getVUSOncogenicSummary(Alteration alteration) { List<Evidence> evidences = EvidenceUtils.getEvidence(Collections.singletonList(alteration), Collections.singleton(EvidenceType.VUS), null); String summary = "there was no available functional data about the " + getGeneMutationNameInVariantSummary(alteration.getGene(), alteration.getAlteration()) + "."; Date lastEdit = null; for (Evidence evidence : evidences) { if (evidence.getLastEdit() == null) { continue; } if (lastEdit == null) { lastEdit = evidence.getLastEdit(); } else if (lastEdit.compareTo(evidence.getLastEdit()) < 0) { lastEdit = evidence.getLastEdit(); } } if (lastEdit != null) { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); summary = "as of " + sdf.format(lastEdit) + ", " + summary; } <START> return summary.substring(0, 1).toUpperCase() + summary.substring(1); <END> }</code><technical_language>StringUtils.capitalize("your string")</technical_language>

Target:
private static String getVUSOncogenicSummary(Alteration alteration) { List<Evidence> evidences = EvidenceUtils.getEvidence(Collections.singletonList(alteration), Collections.singleton(EvidenceType.VUS), null); String summary = "there was no available functional data about the " + getGeneMutationNameInVariantSummary(alteration.getGene(), alteration.getAlteration()) + "."; Date lastEdit = null; for (Evidence evidence : evidences) { if (evidence.getLastEdit() == null) { continue; } if (lastEdit == null) { lastEdit = evidence.getLastEdit(); } else if (lastEdit.compareTo(evidence.getLastEdit()) < 0) { lastEdit = evidence.getLastEdit(); } } if (lastEdit != null) { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); summary = "as of " + sdf.format(lastEdit) + ", " + summary; } return StringUtils.capitalize(summary); }
Source:
<code>public List<BattleStep> createSteps() { final List<BattleStep> steps = new ArrayList<>(); final List<FiringGroup> firingGroups = firingGroupSplitter.apply(battleState).stream() .sorted( Comparator.comparing(FiringGroup::getDisplayName) .thenComparing(FiringGroup::isSuicideOnHit)) <START> .collect(Collectors.toList()); <END> for (final FiringGroup firingGroup : firingGroups) { final FireRoundState fireRoundState = new FireRoundState(); steps.add(new RollDice(battleState, side, firingGroup, fireRoundState, diceRoller)); steps.add( new SelectCasualties(battleState, side, firingGroup, fireRoundState, casualtySelector)); steps.add( new MarkCasualties( battleState, battleActions, side, firingGroup, fireRoundState, returnFire)); } return steps; }</code><technical_language>nit, this seemingly simpler a map + flatmap operation. EG: return firingGroupSplitter.apply(battleState).stream() .sorted( Comparator.comparing(FiringGroup::getDisplayName) .thenComparing(FiringGroup::isSuicideOnHit)) .map(firingGroup -> List.of(new RollDice(battleState, side, firingGroup, fireRoundState, diceRoller), new SelectCasualties(battleState, side, firingGroup, fireRoundState, casualtySelector), new MarkCasualties( battleState, battleActions, side, firingGroup, fireRoundState, returnFire)) .flatMap(Collection::stream) .collect(Collectors.toList());</technical_language>

Target:
public List<BattleStep> createSteps() { return firingGroupSplitter.apply(battleState).stream() .sorted( Comparator.comparing(FiringGroup::getDisplayName) .thenComparing(FiringGroup::isSuicideOnHit)) .map( firingGroup -> { final FireRoundState fireRoundState = new FireRoundState(); return List.of( new RollDiceStep(battleState, side, firingGroup, fireRoundState, diceRoller), new SelectCasualties( battleState, side, firingGroup, fireRoundState, casualtySelector), new MarkCasualties( battleState, battleActions, side, firingGroup, fireRoundState, returnFire)); }) .flatMap(Collection::stream) .collect(Collectors.toList()); }
Source:
<code>public static CommandRequest newCommandRequest(UserId userId, Message command) { final CommandContext context = getCommandContext(userId); <START> final CommandRequest.Builder request = CommandRequest.newBuilder() <END> .setCommand(Messages.toAny(command)) .setContext(context); return request.build(); }</code><technical_language>requested in another pull request, please a utility method for building a CommandRequest command context. a method already</technical_language>

Target:
public static CommandRequest newCommandRequest(UserId userId, Message command) { final CommandContext context = getCommandContext(userId); final CommandRequest request = Commands.newCommandRequest(command, context); return request; }
Source:
<code>public static DistributedQueryRunner createMaterializingQueryRunner(Iterable<TpchTable<?>> tables) throws Exception { return createQueryRunner( tables, ImmutableMap.<String, String>builder() .put("query.partitioning-provider-catalog", "hive") .put("query.exchange-materialization-strategy", "ALL") .put("query.hash-partition-count", "11") .put("colocated-joins-enabled", "true") .put("grouped-execution-for-aggregation-enabled", "true") .put("experimental.table-writer-merge-operator-enabled", "true") <START> .put("task.writer-count", "2") <END> .build(), Optional.empty()); }</code><technical_language>Ummmm, memory check out this time :\</technical_language>

Target:
public static DistributedQueryRunner createMaterializingQueryRunner(Iterable<TpchTable<?>> tables) throws Exception { return createQueryRunner( tables, ImmutableMap.of( "query.partitioning-provider-catalog", "hive", "query.exchange-materialization-strategy", "ALL", "query.hash-partition-count", "11", "colocated-joins-enabled", "true", "grouped-execution-for-aggregation-enabled", "true"), Optional.empty()); }
Source:
<code>public void stop(BundleContext context) { <START> if (log.isDebugEnabled()) { <END> log.debug("BPMN-Explorer Bundle Started."); } }</code><technical_language>careful copy paste :). printing "bundle started" stopping also. Another is string manipulations in debug messages, need check isDebugEnabled(). is extra if</technical_language>

Target:
public void stop(BundleContext context) { log.debug("BPMN-Explorer Bundle Stopped."); }
Source:
<code>protected void readSecretFile(String secretFile) { log.debug("reading secret file: " + secretFile); BufferedReader in = null; try { in = new BufferedReader(new FileReader(secretFile)); StringBuilder tmpPassphrase = new StringBuilder(); String line = null; while ((line = in.readLine()) != null) { <START> log.debug("str passphrase: " + line); <END> tmpPassphrase.append(line); } log.debug("tmpPassphrase: " + tmpPassphrase.toString()); passphrase = tmpPassphrase.toString(); } catch (FileNotFoundException e) { log.debug("File not found: " + secretFile); passphrase = null; } catch (IOException e) { log.debug("IOException while reading: " + secretFile); passphrase = null; } finally { if (in != null) { try { in.close(); } catch (IOException ioe) { } } } log.debug("Using katello-passwd passphrase: " + passphrase); }</code><technical_language>I output plaintext passphrase. output total length of else more generic</technical_language>

Target:
protected void readSecretFile(String secretFile) { log.debug("reading secret file: " + secretFile); BufferedReader in = null; try { in = new BufferedReader(new FileReader(secretFile)); StringBuilder tmpPassphrase = new StringBuilder(); String line = null; while ((line = in.readLine()) != null) { tmpPassphrase.append(line); } passphrase = tmpPassphrase.toString(); } catch (FileNotFoundException e) { log.debug("File not found: " + secretFile); passphrase = null; } catch (IOException e) { log.debug("IOException while reading: " + secretFile); passphrase = null; } finally { if (in != null) { try { in.close(); } catch (IOException ioe) { } } } }
Source:
<code>public void checkStopStartWorkspaceTest() { projectExplorer.waitProjectExplorer(); terminal.waitTerminalTab(EXPECTED_MESS_IN_CONSOLE_SEC); <START> menu.waitMenuItemIsEnabled(PROFILE_MENU); <END> menu.runCommand(WORKSPACE, STOP_WORKSPACE); toastLoader.waitExpectedTextInToastLoader("Workspace is not running"); toastLoader.clickOnStartButton(); projectExplorer.waitProjectExplorer(); terminal.waitTerminalTab(EXPECTED_MESS_IN_CONSOLE_SEC); menu.waitMenuItemIsEnabled(PROFILE_MENU); }</code><technical_language>This verification slightly duplicates another in test [CreateWorkspaceOnDashboardTest](<LINK_1> avoid duplication place change verification in future, I suggest moving next commands test [CreateWorkspaceOnDashboardTest](<LINK_0> separate method Ide::waitOpenedWorkspaceIsReadyToUse() instead: java projectExplorer.waitProjectExplorer(PREPARING_WS_TIMEOUT_SEC); // need long timeout for OSIO terminal.waitTerminalTab(PREPARING_WS_TIMEOUT_SEC); // need long timeout for OSIO menu.waitMenuItemIsEnabled(WORKSPACE);</technical_language>

Target:
public void checkStopStartWorkspaceTest() { ide.waitOpenedWorkspaceIsReadyToUse(); menu.runCommand(WORKSPACE, STOP_WORKSPACE); toastLoader.waitExpectedTextInToastLoader("Workspace is not running"); toastLoader.clickOnStartButton(); ide.waitOpenedWorkspaceIsReadyToUse(); }
Source:
<code>public void deleteAttribute(String name, String attName) throws EntityNotFoundException { Product product = null; try { <START> product = productManager.load(name); <END> } catch (EntityNotFoundException e) { log.warning("The product: " + name + " is not in the database"); throw new APIException(new EntityNotFoundException(Product.class,name, e)); } try { product.deleteAttribute(attName); productManager.update(product); } catch (Exception e) { log.warning("Attribute not found : " + attName); throw new APIException(new EntityNotFoundException(Metadata.class, "Attribute not found : " + attName, attName)); } }</code><technical_language>coding style</technical_language>

Target:
public void deleteAttribute(String name, String attName) throws APIException { Product product = null; try { product = productManager.load(name); } catch (EntityNotFoundException e) { log.warning("The product: " + name + " is not in the database"); throw new APIException(new EntityNotFoundException(Product.class,name, e)); } try { product.deleteAttribute(attName); productManager.update(product); } catch (Exception e) { log.warning("Attribute not found : " + attName); throw new APIException(new EntityNotFoundException(Metadata.class, "Attribute not found : " + attName, attName)); } }
Source:
<code>public AdjacentListConcurrentMapDAG() { this.adjacent = new ConcurrentHashMap<>(); <START> this.inDegrees = new HashMap<>(); <END> this.rootVertices = new HashSet<>(); this.numVertices = 0; this.numEdges = 0; }</code><technical_language>inDegrees ConcurrentHashMap also</technical_language>

Target:
public AdjacentListConcurrentMapDAG() { this.adjacent = new ConcurrentHashMap<>(); this.inDegrees = new ConcurrentHashMap<>(); this.numVertices = 0; this.numEdges = 0; }
Source:
<code><START> public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime) { <END> ITimeGraphEntry entry = event.getEntry(); if (event instanceof TimeEvent && ((TimeEvent) event).hasValue() && entry instanceof TimeGraphEntry) { ITmfTreeDataModel model = ((TimeGraphEntry) entry).getEntryModel(); ITimeGraphDataProvider<? extends TimeGraphEntryModel> provider = getProvider((TimeGraphEntry) entry); if (provider != null) { return getTooltip(provider, model.getId(), hoverTime); } } return Collections.emptyMap(); }</code><technical_language>override getEventHoverToolTipInfo(ITimeEvent) call this, event's time. For markers..</technical_language>

Target:
public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime) { ITimeGraphEntry entry = event.getEntry(); if (event instanceof TimeEvent && !(event instanceof NullTimeEvent) && entry instanceof TimeGraphEntry) { ITmfTreeDataModel model = ((TimeGraphEntry) entry).getEntryModel(); ITimeGraphDataProvider<? extends TimeGraphEntryModel> provider = getProvider((TimeGraphEntry) entry); if (provider != null) { return getTooltip(provider, model.getId(), hoverTime); } } return Collections.emptyMap(); }
Source:
<code>protected boolean canDoAction() { VM vm = getVm(); if (vm == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); } if (vm.getStatus() == VMStatus.Paused) { return true; } List<String> messages = getReturnValue().getCanDoActionMessages(); List<Disk> vmDisks = getDiskDao().getAllForVm(vm.getId(), true); VDS destVds = getDestinationVds(); if (!getRunVmValidator().canRunVm(vm, messages, vmDisks, getParameters().getBootSequence(), getStoragePool(), isInternalExecution(), getParameters().getDiskPath(), getParameters().getFloppyPath(), getParameters().getRunAsStateless(), getRunVdssList(), destVds == null ? null : destVds.getId(), getVdsGroup()) && validateNetworkInterfaces()) { return false; } if (getParameters().getVmPayload() != null) { <START> boolean isPayloadValid = checkPayload(getParameters().getVmPayload(), <END> getParameters().getDiskPath()); if (isPayloadValid && !StringUtils.isEmpty(getParameters().getFloppyPath()) && getParameters().getVmPayload().getType() == VmDeviceType.FLOPPY) { return failCanDoAction(VdcBllMessages.VMPAYLOAD_FLOPPY_EXCEEDED); } getVm().setVmPayload(getParameters().getVmPayload()); } return true; }</code><technical_language>inline isPayloadValid field</technical_language>

Target:
protected boolean canDoAction() { VM vm = getVm(); if (vm == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); } if (vm.getStatus() == VMStatus.Paused) { return true; } List<String> messages = getReturnValue().getCanDoActionMessages(); List<Disk> vmDisks = getDiskDao().getAllForVm(vm.getId(), true); VDS destVds = getDestinationVds(); if (!getRunVmValidator().canRunVm(vm, messages, vmDisks, getParameters().getBootSequence(), getStoragePool(), isInternalExecution(), getParameters().getDiskPath(), getParameters().getFloppyPath(), getParameters().getRunAsStateless(), getRunVdssList(), destVds == null ? null : destVds.getId(), getVdsGroup()) && validateNetworkInterfaces()) { return false; } if (getParameters().getVmPayload() != null) { if (checkPayload(getParameters().getVmPayload(), getParameters().getDiskPath()) && !StringUtils.isEmpty(getParameters().getFloppyPath()) && getParameters().getVmPayload().getType() == VmDeviceType.FLOPPY) { return failCanDoAction(VdcBllMessages.VMPAYLOAD_FLOPPY_EXCEEDED); } getVm().setVmPayload(getParameters().getVmPayload()); } return true; }
Source:
<code>public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp) { try { final URI requestURI = req.getRequestURI(); final String path = requestURI.getPath(); final String backendURL = getMatchedBackendURL(path, requestURI); <START> LOG.logMessage("Generated backend URL for websocket connection: " + backendURL); <END> return new ProxyWebSocketAdapter(URI.create(backendURL), pool, getClientEndpointConfig(req)); } catch (final Exception e) { LOG.failedCreatingWebSocket(e); throw e; } }</code><technical_language>a new function log generic log messages, LOG.logMessage is log WS messages</technical_language>

Target:
public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp) { try { final URI requestURI = req.getRequestURI(); final String path = requestURI.getPath(); final String backendURL = getMatchedBackendURL(path, requestURI); LOG.debugLog("Generated backend URL for websocket connection: " + backendURL); return new ProxyWebSocketAdapter(URI.create(backendURL), pool, getClientEndpointConfig(req)); } catch (final Exception e) { LOG.failedCreatingWebSocket(e); throw e; } }
Source:
<code>public T map(int row, ResultSet rs, StatementContext ctx) throws SQLException { T bean; try { bean = type.newInstance(); } catch (Exception e) { throw new IllegalArgumentException(String.format("A bean, %s, was mapped " + "which was not instantiable", type.getName()), e); } ResultSetMetaData metadata = rs.getMetaData(); for (int i = 1; i <= metadata.getColumnCount(); ++i) { String name = metadata.getColumnLabel(i).toLowerCase(); Field field = properties.get(name); if (field != null) { Class type = field.getType(); Object value; ResultColumnMapper mapper = ctx.columnMapperFor(type); if (mapper != null) { value = mapper.mapColumn(rs, i, ctx); } else if (type.isEnum()) { <START> String str = rs.getString(i); <END> value = str == null ? null : Enum.valueOf(type, str); } else { value = rs.getObject(i); } try { field.setAccessible(true); field.set(bean, value); } catch (IllegalAccessException e) { throw new IllegalArgumentException(String.format("Unable to access " + "property, %s", name), e); } } } return bean; }</code><technical_language>Again, feels weird a special case for Enum types here</technical_language>

Target:
public T map(int row, ResultSet rs, StatementContext ctx) throws SQLException { T bean; try { bean = type.newInstance(); } catch (Exception e) { throw new IllegalArgumentException(String.format("A bean, %s, was mapped " + "which was not instantiable", type.getName()), e); } ResultSetMetaData metadata = rs.getMetaData(); for (int i = 1; i <= metadata.getColumnCount(); ++i) { String name = metadata.getColumnLabel(i).toLowerCase(); Field field = properties.get(name); if (field != null) { Class type = field.getType(); Object value; ResultColumnMapper mapper = ctx.columnMapperFor(type); if (mapper != null) { value = mapper.mapColumn(rs, i, ctx); } else { value = rs.getObject(i); } try { field.setAccessible(true); field.set(bean, value); } catch (IllegalAccessException e) { throw new IllegalArgumentException(String.format("Unable to access " + "property, %s", name), e); } } } return bean; }
Source:
<code>public DispoConfig findDispoConfig(DispoProgram program) { <START> ArtifactReadable config = <END> getQuery().fromBranch(program.getUuid()).andNameEquals("Program Config").getResults().getOneOrNull(); if (config == null) { DispoUtil.getDefaultConfig(); } return DispoUtil.configArtToConfigData(new DispoConfigArtifact(config)); }</code><technical_language>andNameEquals is un-needed undesired incase name changes</technical_language>

Target:
public DispoConfig findDispoConfig(DispoProgram program) { ArtifactReadable config = getQuery().fromBranch(program.getUuid()).andNameEquals("Program Config").getResults().getOneOrNull(); if (config == null) { return DispoUtil.getDefaultConfig(); } return DispoUtil.configArtToConfigData(new DispoConfigArtifact(config)); }
Source:
<code>public void testMultipleStringValuesWithEmpty() { Assert.assertEquals("In<Utf8>#toString(STRING)", ",a,b", Predicates.in(new Utf8("a"), new Utf8("b"), new Utf8("")).toString(STRING)); Assert.assertEquals("In#toString(STRING)", <START> ",a,b", Predicates.in("a", "b", "").toString(STRING)); <END> Assert.assertEquals("In.fromString(String, STRING)", Predicates.in("a", "b", ""), In.<String>fromString("a,b,", STRING)); }</code><technical_language>I changed. In implementation generally preserve order normalized produce a String. Normalization a peer of toString(Schema), toNormalizedString(Schema)</technical_language>

Target:
public void testMultipleStringValuesWithEmpty() { Assert.assertEquals("In<Utf8>#toString(STRING)", "a,b,", Predicates.in(new Utf8("a"), new Utf8("b"), new Utf8("")).toString(STRING)); Assert.assertEquals("In#toString(STRING)", "a,b,", Predicates.in("a", "b", "").toString(STRING)); Assert.assertEquals("In.fromString(String, STRING)", Predicates.in("a", "b", ""), In.<String>fromString("a,b,", STRING)); }
Source:
<code>static Collection<FunctionDesc> mergeFunctionLists(List<FunctionDesc> ... functionLists) throws AmbiguousFunctionException { Map<Integer, FunctionDesc> funcMap = new HashMap<>(); List<FunctionDesc> baseFuncList = functionLists[0]; for (FunctionDesc desc: baseFuncList) { funcMap.put(desc.hashCodeWithoutType(), desc); } for (int i=1; i<functionLists.length; i++) { for (FunctionDesc desc: functionLists[i]) { if (funcMap.containsKey(desc.hashCodeWithoutType())) { <START> throw new AmbiguousFunctionException(String.format("UDF %s", desc.toString())); <END> } funcMap.put(desc.hashCodeWithoutType(), desc); baseFuncList.add(desc); } } return baseFuncList; }</code><technical_language>print function is ambiguous one</technical_language>

Target:
static Collection<FunctionDesc> mergeFunctionLists(List<FunctionDesc> ... functionLists) throws AmbiguousFunctionException { Map<Integer, FunctionDesc> funcMap = new HashMap<>(); List<FunctionDesc> baseFuncList = functionLists[0]; for (FunctionDesc desc: baseFuncList) { funcMap.put(desc.hashCodeWithoutType(), desc); } for (int i=1; i<functionLists.length; i++) { for (FunctionDesc desc: functionLists[i]) { if (funcMap.containsKey(desc.hashCodeWithoutType())) { FunctionDesc storedDesc = funcMap.get(desc.hashCodeWithoutType()); if (storedDesc.equalsSignature(desc)) { throw new AmbiguousFunctionException(String.format("%s", storedDesc.toString())); } } funcMap.put(desc.hashCodeWithoutType(), desc); baseFuncList.add(desc); } } return baseFuncList; }