auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public NewTableConfiguration enableSampling(SamplerConfiguration samplerConfiguration) { requireNonNull(samplerConfiguration); <START> Map<String,String> tmp = new SamplerConfigurationImpl(samplerConfiguration).toTablePropertiesMap(); <END> checkDisjoint(properties, tmp, summarizerProps); this.samplerProps = tmp; return this; }</code><technical_language>a static utility if do (unsafe) cast SamplerConfigurationImpl avoid unnecessary object creation</technical_language>

Target:
public NewTableConfiguration enableSampling(SamplerConfiguration samplerConfiguration) { requireNonNull(samplerConfiguration); Map<String,String> tmp = new SamplerConfigurationImpl(samplerConfiguration).toTablePropertiesMap(); checkDisjoint(properties, tmp, "sampler"); this.samplerProps = tmp; return this; }
Source:
<code>public String toString() { if (to == null || to.equals("")) { return ""; } else if (from == null || from.equals("")) { return to; } else if (readOnly == null || !readOnly) { <START> if (noCopy == null || !noCopy) { <END> return from + ":" + to; } else { return from + ":" + to + ":nocopy"; } } else { return from + ":" + to + ":ro"; } }</code><technical_language>noCopy readOnly mutually exclusive? in, from:to:ro from:to:nocopy from:to:ro:nocopy</technical_language>

Target:
public String toString() { if (to == null || to.equals("")) { return ""; } else if (from == null || from.equals("")) { return to; } final String bind = from + ":" + to; final List<String> options = new ArrayList<>(); if (readOnly != null && readOnly) { options.add("ro"); } if (noCopy != null && noCopy) { options.add("nocopy"); } final String optionsValue = Joiner.on(',').join(options); return (optionsValue.isEmpty()) ? bind : bind + ":" + optionsValue; }
Source:
<code><START> public WorkspaceTemplate() <END></code><technical_language>In constant class constructor is private</technical_language>

Target:
private WorkspaceTemplate()
Source:
<code>public boolean poll(Guid hostId) { waitBetweenPolls(); <START> <END> LOGGER.trace("Request to do poll for {}.", hostId); FutureVDSCall<VDSReturnValue> task = Backend.getInstance() .getResourceManager() .runFutureVdsCommand(FutureVDSCommandType.Poll, new VdsIdVDSCommandParametersBase(hostId)); LOGGER.trace("task executed."); boolean succeeded = getValue(task); LOGGER.trace("task result={}", succeeded); return succeeded; }</code><technical_language>is motivation of trace messages</technical_language>

Target:
public boolean poll(Guid hostId) { waitBetweenPolls(); LOGGER.trace("Request to do poll for host {}.", hostId); FutureVDSCall<VDSReturnValue> task = Backend.getInstance() .getResourceManager() .runFutureVdsCommand(FutureVDSCommandType.Poll, new VdsIdVDSCommandParametersBase(hostId)); LOGGER.trace("FutureVDSCommandType.Poll executed for host{}.", hostId); boolean succeeded = getValue(task); LOGGER.trace("Result of FutureVDSCommandType.Poll for host {}: {}", hostId, succeeded); timestampOfEndOfPreviousInvocation = System.currentTimeMillis(); return succeeded; }
Source:
<code>public void shouldFindConceptsBySourceUuid() throws Exception { <START> SimpleObject response = deserialize(handle(newGetRequest(getURI(), new Parameter("uuid", <END> "SSTRM-WGT234")))); List<Object> results = Util.getResultsList(response); Assert.assertEquals(results.size(), 1); Object next = results.iterator().next(); Assert.assertThat((String) PropertyUtils.getProperty(next, "uuid"), is("c607c80f-1ea9-4da3-bb88-6276ce8868dd")); }</code><technical_language>replace "uuid" "term"</technical_language>

Target:
public void shouldFindConceptsBySourceUuid() throws Exception { SimpleObject response = deserialize(handle(newGetRequest(getURI(), new Parameter("term", "SSTRM-WGT234")))); List<Object> results = Util.getResultsList(response); Assert.assertEquals(results.size(), 1); Object next = results.iterator().next(); Assert.assertThat((String) PropertyUtils.getProperty(next, "uuid"), is("c607c80f-1ea9-4da3-bb88-6276ce8868dd")); }
Source:
<code>public static String getCassandraVersion() { if (isDSE()) { String cassandraVersion = dseToCassandraVersions.get(CASSANDRA_VERSION); if (cassandraVersion != null) { return cassandraVersion; } else if (CASSANDRA_VERSION.startsWith("3.") || CASSANDRA_VERSION.compareTo("3") <= 0) { return "1.2"; } else if (CASSANDRA_VERSION.startsWith("4.")) { if (CASSANDRA_VERSION.compareTo("4.7") >= 0) { <START> return "2.0"; <END> } else { return "2.1"; } } else { return "3.0"; } } else { return CASSANDRA_VERSION; } }</code><technical_language>if else blocks inverted</technical_language>

Target:
public static String getCassandraVersion() { if (isDSE()) { String cassandraVersion = dseToCassandraVersions.get(CASSANDRA_VERSION); if (cassandraVersion != null) { return cassandraVersion; } else if (CASSANDRA_VERSION.startsWith("3.") || CASSANDRA_VERSION.compareTo("3") <= 0) { return "1.2"; } else if (CASSANDRA_VERSION.startsWith("4.")) { if (CASSANDRA_VERSION.compareTo("4.7") >= 0) { return "2.1"; } else { return "2.0"; } } else { return "3.0"; } } else { return CASSANDRA_VERSION; } }
Source:
<code>protected void parse() { if (isDone()) { MIOutput out = getMIOutput(); MIOOBRecord[] records = out.getMIOOBRecords(); StringBuilder builder = new StringBuilder(); for(MIOOBRecord rec : records) { if (rec instanceof MIConsoleStreamOutput) { MIStreamRecord o = (MIStreamRecord)rec; builder.append(o.getString()); } } fFullOutput = builder.toString(); <START> fVersion = LaunchUtils.getGDBVersionFromText(fFullOutput); <END> } }</code><technical_language>easier overwrite version parsing for custom GDBs adding a new method: parseVersion(String text), for instance? I common for vendors version formats. do think</technical_language>

Target:
protected void parse() { if (isDone()) { MIOutput out = getMIOutput(); MIOOBRecord[] records = out.getMIOOBRecords(); StringBuilder builder = new StringBuilder(); for(MIOOBRecord rec : records) { if (rec instanceof MIConsoleStreamOutput) { MIStreamRecord o = (MIStreamRecord)rec; builder.append(o.getString()); } } fFullOutput = builder.toString(); fVersion = parseVersion(fFullOutput); } }
Source:
<code>private void testGetBlobWithVariousRanges(BlobInfo blobInfo) throws Exception { long blobSize = blobInfo.getBlobProperties().getBlobSize(); testGetBlob(blobInfo, null); <START> testGetBlob(blobInfo, ByteRange.fromStartOffset(ThreadLocalRandom.current().nextLong(blobSize))); <END> testGetBlob(blobInfo, ByteRange.fromLastNBytes(ThreadLocalRandom.current().nextLong(blobSize + 1))); long random1 = ThreadLocalRandom.current().nextLong(blobSize); long random2 = ThreadLocalRandom.current().nextLong(blobSize); testGetBlob(blobInfo, ByteRange.fromOffsetRange(Math.min(random1, random2), Math.max(random1, random2))); }</code><technical_language>in other cases - good match base case</technical_language>

Target:
private void testGetBlobWithVariousRanges(BlobInfo blobInfo) throws Exception { long blobSize = blobInfo.getBlobProperties().getBlobSize(); testGetBlob(blobInfo, null); testGetBlob(blobInfo, ByteRange.fromLastNBytes(0)); if (blobSize > 0) { testGetBlob(blobInfo, ByteRange.fromStartOffset(0)); testGetBlob(blobInfo, ByteRange.fromStartOffset(ThreadLocalRandom.current().nextLong(1, blobSize - 1))); testGetBlob(blobInfo, ByteRange.fromStartOffset(blobSize - 1)); long random1 = ThreadLocalRandom.current().nextLong(blobSize); long random2 = ThreadLocalRandom.current().nextLong(blobSize); testGetBlob(blobInfo, ByteRange.fromOffsetRange(Math.min(random1, random2), Math.max(random1, random2))); testGetBlob(blobInfo, ByteRange.fromLastNBytes(blobSize)); } if (blobSize > 1) { testGetBlob(blobInfo, ByteRange.fromLastNBytes(ThreadLocalRandom.current().nextLong(1, blobSize))); } }
Source:
<code>public Document getDocument(final String xml) throws ParserConfigurationException, SAXException, IOException { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); final DocumentBuilder builder = factory.newDocumentBuilder(); final InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xml)); <START> final Document doc = builder.parse(is); <END> return doc; }</code><technical_language>Simply: "return builder.parse(id);"</technical_language>

Target:
public Document getDocument(final String xml) throws ParserConfigurationException, SAXException, IOException { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); final DocumentBuilder builder = factory.newDocumentBuilder(); final InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xml)); return builder.parse(is); }
Source:
<code>private void checkError() { if (startAnchor.isPresent() && endAnchor.isPresent()) { try { endAnchor.get().getBlock().asExpr() <START> .analyze(new Env(), new GenSet()); <END> this.getStyleClass().remove("error"); } catch (HaskellTypeError e) { this.getStyleClass().add("error"); } catch (HaskellException e) { e.printStackTrace(); } } }</code><technical_language>line refactor</technical_language>

Target:
private void checkError() { if (startAnchor.isPresent() && endAnchor.isPresent()) { try { Block block = endAnchor.get().getBlock(); block.asExpr().analyze(new Env(), new GenSet()); this.getStyleClass().remove("error"); } catch (HaskellTypeError e) { this.getStyleClass().add("error"); } catch (HaskellException e) { e.printStackTrace(); } } }
Source:
<code>private String toTimeString(long millis) { <START> return String.format("%d min, %d sec", TimeUnit.MILLISECONDS.toMinutes(millis), TimeUnit.MILLISECONDS.toSeconds(millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis))); } <END></code><technical_language>(Nit) intermediary variables for readability (not if long is correct data type): suggestion long minutes = TimeUnit.MILLISECONDS.toMinutes(millis); long totalSeconds = TimeUnit.MILLISECONDS.toSeconds(millis); long seconds = totalSeconds - TimeUnit.MINUTES.toSeconds(minutes); return String.format("%d min, %d sec", minutes, seconds); }</technical_language>

Target:
private String toTimeString(long millis) { long minutes = TimeUnit.MILLISECONDS.toMinutes(millis); long totalSeconds = TimeUnit.MILLISECONDS.toSeconds(millis); long seconds = totalSeconds - TimeUnit.MINUTES.toSeconds(minutes); return String.format("%d min, %d sec", minutes, seconds); }
Source:
<code>public ClosableIterator<Tuple> callStoredProcedure( String storedProcedureName, ProcedureQueryParameters queryParameters, TupleContext tupleContext) { Map.Entry<String, Map> queryAndParams = buildProcedureQueryWithParams( storedProcedureName, queryParameters ); Transaction transaction = transaction( tupleContext ); if ( transaction == null ) { DatastoreProvider datastoreProvider = getServiceRegistry().getService( DatastoreProvider.class ); BoltNeo4jDatastoreProvider neo4jProvider = (BoltNeo4jDatastoreProvider) datastoreProvider; BoltNeo4jClient client = neo4jProvider.getClient(); <START> transaction = client.getDriver().session().beginTransaction(); <END> } StatementResult result = transaction.run( queryAndParams.getKey(), queryAndParams.getValue() ); return CollectionHelper.newClosableIterator( extractTuples( result ) ); }</code><technical_language>I neo4j transaction interface. transaction closed in cases</technical_language>

Target:
public ClosableIterator<Tuple> callStoredProcedure( String storedProcedureName, ProcedureQueryParameters queryParameters, TupleContext tupleContext) { Map.Entry<String, Map<String, Object>> queryAndParams = buildProcedureQueryWithParams( storedProcedureName, queryParameters ); Transaction transaction = transaction( tupleContext ); StatementResult result = transaction.run( queryAndParams.getKey(), queryAndParams.getValue() ); try { return new BoltNeo4jMapsTupleIterator( result ); } catch (ClientException e) { switch ( e.code() ) { case BaseNeo4jDialect.PROCEDURE_CALL_FAILED_CODE: throw log.cannotExecuteStoredProcedure( storedProcedureName, e ); case BaseNeo4jDialect.PROCEDURE_NOT_FOUND_CODE: throw log.procedureWithResolvedNameDoesNotExist( storedProcedureName, e ); default: throw new HibernateException( e.getMessage() ); } } }
Source:
<code>public boolean shouldDisplay(Map<String, Object> context) { final String buildKey = StringUtils.defaultString((String) context.get("planKey"), (String) context.get("buildKey")); final String buildNumberString = (String) context.get("buildNumber"); if (buildKey != null && buildNumberString != null) { try { int buildNumber = Integer.parseInt(buildNumberString); final ResultsSummary resultsSummary = this.resultsSummaryManager.getResultsSummary(PlanKeys.getPlanResultKey(buildKey, buildNumber)); if (resultsSummary != null) { final AllureBuildResult buildResult = AllureBuildResult.fromCustomData(resultsSummary.getCustomBuildData()); return (buildResult.hasInfo() && (resultsSummary.isFinished() || resultsSummary.isNotBuilt())); } <START> } catch (Exception ignored) { <END> } } return false; }</code><technical_language>Log exception</technical_language>

Target:
public boolean shouldDisplay(Map<String, Object> context) { final String buildKey = StringUtils.defaultString((String) context.get("planKey"), (String) context.get("buildKey")); final String buildNumberString = (String) context.get("buildNumber"); if (buildKey != null && buildNumberString != null) { try { int buildNumber = Integer.parseInt(buildNumberString); final ResultsSummary resultsSummary = this.resultsSummaryManager.getResultsSummary(PlanKeys.getPlanResultKey(buildKey, buildNumber)); if (resultsSummary != null) { final AllureBuildResult buildResult = AllureBuildResult.fromCustomData(resultsSummary.getCustomBuildData()); return (buildResult.hasInfo() && (resultsSummary.isFinished() || resultsSummary.isNotBuilt())); } } catch (Exception e) { LOGGER.error("Failed to evaluate condition", e); } } return false; }
Source:
<code>public void execute(IAction action) { <START> IHistoryView view = TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), getSelectedResources()[0], null); <END> IHistoryPage page = view.getHistoryPage(); if (page instanceof GitHistoryPage){ GitHistoryPage gitHistoryPage = (GitHistoryPage) page; gitHistoryPage.setCompareMode(true); } }</code><technical_language>API null returned, check for this</technical_language>

Target:
public void execute(IAction action) { IHistoryView view = TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), getSelectedResources()[0], null); if (view == null) return; IHistoryPage page = view.getHistoryPage(); if (page instanceof GitHistoryPage){ GitHistoryPage gitHistoryPage = (GitHistoryPage) page; gitHistoryPage.setCompareMode(true); } }
Source:
<code>public MySQLCustomDialect() { <START> super(); <END> registerColumnType(Types.BLOB, "blob"); }</code><technical_language>This is called automatically</technical_language>

Target:
public MySQLCustomDialect() { registerColumnType(Types.BLOB, "blob"); registerColumnType(Types.BOOLEAN, "varchar(1)"); }
Source:
<code><START> private BrandingManager(final File etcDir) { <END> brandingRootPath = new File(etcDir, BRANDING_PATH); }</code><technical_language>I assume this constructor exists for unit testing purposes: - is this constructor private package-private, unit test directly? - do need synchronized getInstance(File) method, unit test is exercising this class in multi-threaded way</technical_language>

Target:
BrandingManager(final File etcDir) { brandingRootPath = new File(etcDir, BRANDING_PATH); objectMapper = new ObjectMapper(); }
Source:
<code>private void handleBinInfo(ITmfEvent event, final Long vpid, final ITmfStateSystemBuilder ss, boolean statedump) { Long baddr = event.getContent().getFieldValue(Long.class, fLayout.fieldBaddr()); Long memsz = event.getContent().getFieldValue(Long.class, fLayout.fieldMemsz()); String path = event.getContent().getFieldValue(String.class, fLayout.fieldPath()); Long hasBuildIdValue = event.getContent().getFieldValue(Long.class, fLayout.fieldHasBuildId()); Long hasDebugLinkValue = event.getContent().getFieldValue(Long.class, fLayout.fieldHasDebugLink()); Long isPicValue = event.getContent().getFieldValue(Long.class, fLayout.fieldIsPic()); if (baddr == null || memsz == null || path == null || hasBuildIdValue == null || hasDebugLinkValue == null || (statedump && isPicValue == null)) { TraceCompassLogUtils.traceInstant(LOGGER, <START> Level.WARNING, "[UstDebugInfoStateProvider:InvalidBinInfoEvent]", <END> "event", event); return; } boolean isPic = (statedump ? (checkNotNull(isPicValue).longValue() != 0) : true); long ts = getBinInfoTimeStamp(event, vpid, statedump); boolean hasBuildId = (hasBuildIdValue != 0); boolean hasDebugLink = (hasDebugLinkValue != 0); PendingBinInfo p = new PendingBinInfo(hasBuildId, hasDebugLink, vpid, baddr, memsz, path, isPic); processPendingBinInfo(p, ts, ss); }</code><technical_language>Fine</technical_language>

Target:
private void handleBinInfo(ITmfEvent event, final Long vpid, final ITmfStateSystemBuilder ss, boolean statedump) { Long baddr = event.getContent().getFieldValue(Long.class, fLayout.fieldBaddr()); Long memsz = event.getContent().getFieldValue(Long.class, fLayout.fieldMemsz()); String path = event.getContent().getFieldValue(String.class, fLayout.fieldPath()); Long hasBuildIdValue = event.getContent().getFieldValue(Long.class, fLayout.fieldHasBuildId()); Long hasDebugLinkValue = event.getContent().getFieldValue(Long.class, fLayout.fieldHasDebugLink()); Long isPicValue = event.getContent().getFieldValue(Long.class, fLayout.fieldIsPic()); if (baddr == null || memsz == null || path == null || hasBuildIdValue == null || hasDebugLinkValue == null || (statedump && isPicValue == null)) { TraceCompassLogUtils.traceInstant(LOGGER, Level.CONFIG, "UstDebugInfoStateProvider:InvalidBinInfoEvent", "event", event); return; } boolean isPic = (statedump ? (checkNotNull(isPicValue).longValue() != 0) : true); long ts = getBinInfoTimeStamp(event, vpid, statedump); boolean hasBuildId = (hasBuildIdValue != 0); boolean hasDebugLink = (hasDebugLinkValue != 0); PendingBinInfo p = new PendingBinInfo(hasBuildId, hasDebugLink, vpid, baddr, memsz, path, isPic); processPendingBinInfo(p, ts, ss); }
Source:
<code>public SequencerServer(ServerContext serverContext) { this.serverContext = serverContext; Config config = Config.parse(serverContext.getServerConfig()); this.executor = Executors.newSingleThreadExecutor( new ServerThreadFactory("sequencer-", new ServerThreadFactory.ExceptionHandler())); <START> globalLogTail = config.getInitialToken(); <END> this.cache = new SequencerServerCache((int)config.getCacheSize()); setUpTimerNameCache(); }</code><technical_language>cache size int instead of casting</technical_language>

Target:
public SequencerServer(ServerContext serverContext) { this.serverContext = serverContext; Config config = Config.parse(serverContext.getServerConfig()); this.executor = Executors.newSingleThreadExecutor( new ServerThreadFactory("sequencer-", new ServerThreadFactory.ExceptionHandler())); globalLogTail = Address.getMinAddress(); this.cache = new SequencerServerCache(config.getCacheSize(), globalLogTail - 1); setUpTimerNameCache(); }
Source:
<code>public void updated(final Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { Enumeration<String> configKeys = config.keys(); <START> while (configKeys.hasMoreElements()) { <END> String configKey = (String) configKeys.nextElement(); if ("service.pid".equals(configKey)) { continue; } String value = (String) config.get(configKey); logger.debug("Set config to {}",configKey,value); if(CONFIG_REFRESH.equals(configKey)) { if (isNotBlank(value)) { this.refreshInterval = Long.parseLong(value); } } else if (CONFIG_USER_ID.equals(configKey)) { this.user_id = value; } else if (CONFIG_KEY.equals(configKey)) { this.key = value; } else { throw new ConfigurationException(configKey, "the given configKey '" + configKey + "' is unknown"); } } setProperlyConfigured(true); } }</code><technical_language>this binding administer a single account simple fetch properties like: if (config != null) { String hostnameString = (String) config.get("hostname"); if (StringUtils.isNotBlank(hostnameString)) { hostname = hostnameString; } String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } setProperlyConfigured(true); }</technical_language>

Target:
public void updated(final Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String useridString = (String) config.get("user_id"); if (StringUtils.isNotBlank(useridString)) { this.user_id = useridString; } String keyString = (String) config.get("key"); if (StringUtils.isNotBlank(keyString)) { this.key = keyString; } String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { this.refreshInterval = Long.parseLong(refreshIntervalString); } setProperlyConfigured(true); } }
Source:
<code>public void requireViewClientAuthenticatorProviders() { <START> if (!(canViewRealm() || root.hasOneAdminRole(AdminRoles.QUERY_CLIENTS))) { <END> throw new ForbiddenException(); } }</code><technical_language>need include VIEW_CLIENTS MANAGE_CLIENTS roles</technical_language>

Target:
public void requireViewClientAuthenticatorProviders() { if (!(canViewRealm() || root.hasOneAdminRole(AdminRoles.QUERY_CLIENTS, AdminRoles.VIEW_CLIENTS, AdminRoles.MANAGE_CLIENTS))) { throw new ForbiddenException(); } }
Source:
<code>private void onOwnershipAckMsg(final MigrationMsg msg) { final String operationId = msg.getOperationId().toString(); final OwnershipAckMsg ownershipAckMsg = msg.getOwnershipAckMsg(); final int blockId = ownershipAckMsg.getBlockId(); final int oldOwnerId = ownershipAckMsg.getOldOwnerId(); final int newOwnerId = ownershipAckMsg.getNewOwnerId(); try (final TraceScope onOwnershipAckMsgScope = Trace.startSpan( String.format("on_ownership_ack_msg. blockId: %d", blockId), HTraceUtils.fromAvro(msg.getTraceInfo()))) { migrationManager.updateOwner(blockId, oldOwnerId, newOwnerId); <START> final boolean ownershipAckMsgArrivedFirst; <END> TraceInfo blockMovedMsgTraceInfo = null; synchronized (this) { ownershipAckMsgArrivedFirst = !blockMovedMsgArrivedBlockIds.containsKey(blockId); if (ownershipAckMsgArrivedFirst) { ownershipAckMsgArrivedBlockIds.add(blockId); } else { blockMovedMsgTraceInfo = blockMovedMsgArrivedBlockIds.remove(blockId).get(); } } if (!ownershipAckMsgArrivedFirst) { handleBlockMovedMsg(operationId, blockId, blockMovedMsgTraceInfo); } } }</code><technical_language>final boolean ownershipAckMsgArrivedFirst; // If true, messages arrived in order synchronized (this) { ownershipAckMsgArrivedFirst = !blockMovedMsgArrivedBlockIds.contains(blockId); if (ownershipMsgArrivedFirst) { ownershipAckMsgArrivedBlockIds.add(blockId); } else { blockMovedMsgTraceInfo = blockMovedMsgArrivedBlockIds.remove(blockId).get(); } } // If messages arrived out of order, blockMovedMsg proceesed here. if (!ownershipMsgArrivedFirst) { ... }</technical_language>

Target:
private void onOwnershipAckMsg(final MigrationMsg msg) { final String operationId = msg.getOperationId().toString(); final OwnershipAckMsg ownershipAckMsg = msg.getOwnershipAckMsg(); final int blockId = ownershipAckMsg.getBlockId(); final int oldOwnerId = ownershipAckMsg.getOldOwnerId(); final int newOwnerId = ownershipAckMsg.getNewOwnerId(); try (final TraceScope onOwnershipAckMsgScope = Trace.startSpan( String.format("on_ownership_ack_msg. blockId: %d", blockId), HTraceUtils.fromAvro(msg.getTraceInfo()))) { migrationManager.updateOwner(blockId, oldOwnerId, newOwnerId); final boolean ownershipAckMsgArrivedFirst; TraceInfo blockMovedMsgTraceInfo = null; synchronized (this) { ownershipAckMsgArrivedFirst = !blockMovedMsgArrivedBlockIds.containsKey(blockId); if (ownershipAckMsgArrivedFirst) { ownershipAckMsgArrivedBlockIds.add(blockId); } else { blockMovedMsgTraceInfo = blockMovedMsgArrivedBlockIds.remove(blockId).get(); } } if (!ownershipAckMsgArrivedFirst) { processBlockMovedMsg(operationId, blockId, blockMovedMsgTraceInfo); } } }
Source:
<code>static <T extends Throwable> T assertThrows(Class<T> expectedType, Executable executable, String message) { try { executable.execute(); } catch (Throwable actualException) { if (expectedType.isInstance(actualException)) { return (T) actualException; } else { <START> throw new AssertionFailedError(message, actualException); <END> } } throw new AssertionFailedError(message); }</code><technical_language>user-supplied message included in failure message in addition standard failure message, a replacement for standard failure message. Please consult other assertion implementations for inspiration</technical_language>

Target:
static <T extends Throwable> T assertThrows(Class<T> expectedType, Executable executable, String message) { return assertThrows(expectedType, executable, () -> message); }
Source:
<code>public boolean contains(T t) { final int element = toInt.apply(t); if (element < 0) { <START> throw new IllegalArgumentException("bitset element must be >= 0"); <END> } final int index = element >> ADDRESS_BITS_PER_WORD; return (getWord(index) & (1L << element)) != 0; }</code><technical_language>if implement offset mentioned, map negative elements a negative offset :)</technical_language>

Target:
public boolean contains(T t) { final int element = toInt.apply(t); if (element < 0) { throw new IllegalArgumentException("bitset element must be >= 0"); } final int index = element >> ADDRESS_BITS_PER_WORD; return index < getWordsNum() && (getWord(index) & (1L << element)) != 0; }
Source:
<code>public void testRemoteListDirectory() throws IOException { final Ds3Client ds3Client = mock(Ds3Client.class); Mockito.when(ds3Client.getBucket(getBucketHas(MYBUCKET, null))).thenReturn(new StubGetBucketResponse(0)); Mockito.when(ds3Client.getBucket(getBucketHas(MYBUCKET, "baz"))).thenReturn(new StubGetBucketResponse(1)); Mockito.when(ds3Client.getBucket(getBucketHas(MYBUCKET, "/foo/baz"))).thenReturn(new StubGetBucketResponse(1)); <START> Iterable<FileSystemKey> fileSystemKeys = Ds3ClientHelpers.wrap(ds3Client).remoteListDirectory(MYBUCKET, null, "/", null, 0); <END> final List<FileSystemKey> contentsList = Lists.newArrayList(fileSystemKeys); assertThat(contentsList.size(), is(3)); }</code><technical_language>Missing final</technical_language>

Target:
public void testRemoteListDirectory() throws IOException { final Ds3Client ds3Client = mock(Ds3Client.class); Mockito.when(ds3Client.getBucket(getBucketHas(MYBUCKET, null))).thenReturn(new StubGetBucketResponse(0)); Mockito.when(ds3Client.getBucket(getBucketHas(MYBUCKET, "baz"))).thenReturn(new StubGetBucketResponse(1)); Mockito.when(ds3Client.getBucket(getBucketHas(MYBUCKET, "/foo/baz"))).thenReturn(new StubGetBucketResponse(1)); final Iterable<FileSystemKey> fileSystemKeys = Ds3ClientHelpers.wrap(ds3Client).remoteListDirectory(MYBUCKET, null, "/", null, 0); final List<FileSystemKey> contentsList = Lists.newArrayList(fileSystemKeys); assertThat(contentsList.size(), is(3)); }
Source:
<code>public ItemStack extractItem(int slot, int amount, boolean simulate) { if (amount == 0) return null; <START> ItemStack[] stacks = this.stacks; <END> validateSlotIndex(slot, stacks); ItemStack existing = stacks[slot]; if (existing == null) return null; int toExtract = Math.min(amount, existing.getMaxStackSize()); if (existing.stackSize <= toExtract) { if (!simulate) { stacks[slot] = null; onContentsChanged(slot); } return existing; } else { if (!simulate) { stacks[slot] = ItemHandlerHelper.copyStackWithSize(existing, existing.stackSize - toExtract); onContentsChanged(slot); } return ItemHandlerHelper.copyStackWithSize(existing, toExtract); } }</code><technical_language>minor, a bit redundant</technical_language>

Target:
public ItemStack extractItem(int slot, int amount, boolean simulate) { if (amount == 0) return null; validateSlotIndex(slot); ItemStack existing = this.stacks[slot]; if (existing == null) return null; int toExtract = Math.min(amount, existing.getMaxStackSize()); if (existing.stackSize <= toExtract) { if (!simulate) { this.stacks[slot] = null; onContentsChanged(slot); } return existing; } else { if (!simulate) { this.stacks[slot] = ItemHandlerHelper.copyStackWithSize(existing, existing.stackSize - toExtract); onContentsChanged(slot); } return ItemHandlerHelper.copyStackWithSize(existing, toExtract); } }
Source:
<code>protected boolean isSafariApp() { if (wirApplicationName != null && SAFARI.equals(wirApplicationName) && wirApplicationBundleIdentifier != null && SAFARIBUNDLEIDENTIFIER.equals(wirApplicationBundleIdentifier)) { <START> return true; <END> } return false; }</code><technical_language>null check is redundant if refactor this code if (SAFARI.equals(wirApplicationName) && SAFARIBUNDLEIDENTIFER.equals(wirApplicationBundleIdentifier)){ return true; } comparing a String constant a variable contents, null check is automatically care of "".equals(null) is false</technical_language>

Target:
protected boolean isSafariApp() { if (SAFARI.equals(wirApplicationName) && SAFARIBUNDLEIDENTIFIER.equals(wirApplicationBundleIdentifier)) { return true; } return false; }
Source:
<code><START> private UpdateFunction updateFunction() { <END> UpdateFunction logToFileFunction = new UpdateFunction() { @Override public void update(DAGStatus status, Map<String, Progress> vertexProgressMap, String report) { SessionState.get().updateProgressMonitor(progressMonitor(status, vertexProgressMap)); console.printInfo(report); } }; UpdateFunction inPlaceUpdateFunction = new UpdateFunction() { @Override public void update(DAGStatus status, Map<String, Progress> vertexProgressMap, String report) { inPlaceUpdate.render(progressMonitor(status, vertexProgressMap)); console.logInfo(report); } }; return InPlaceUpdate.canRenderInPlace(hiveConf) && !SessionState.getConsole().getIsSilent() ? inPlaceUpdateFunction : logToFileFunction; }</code><technical_language>if this naming a new convention, otherwise, getUpdateFunction more describing</technical_language>

Target:
private UpdateFunction updateFunction() { UpdateFunction logToFileFunction = new UpdateFunction() { @Override public void update(DAGStatus status, Map<String, Progress> vertexProgressMap, String report) { SessionState.get().updateProgressMonitor(progressMonitor(status, vertexProgressMap)); console.printInfo(report); } }; UpdateFunction inPlaceUpdateFunction = new UpdateFunction() { @Override public void update(DAGStatus status, Map<String, Progress> vertexProgressMap, String report) { inPlaceUpdate.render(progressMonitor(status, vertexProgressMap)); console.logInfo(report); } }; return InPlaceUpdate.canRenderInPlace(hiveConf) && !SessionState.getConsole().getIsSilent() && !SessionState.get().isHiveServerQuery() ? inPlaceUpdateFunction : logToFileFunction; }
Source:
<code>public Map<AmplitudeData, EventScores> getPDF(final Collection<AmplitudeData> data) { <START> final List<Long> timestamps = new ArrayList<>(); <END> final List<Double> amplitudes = new ArrayList<>(); for(final AmplitudeData amplitudeData:data){ timestamps.add(Long.valueOf(amplitudeData.timestamp)); amplitudes.add(Double.valueOf(amplitudeData.amplitude)); } final WakeUpTimeScoringFunction wakeUpTimeScoreFunction = new WakeUpTimeScoringFunction(this.wakeUpStartPercentage); final Map<Long, Double> wakeUpTimePDF = wakeUpTimeScoreFunction.getPDF(timestamps); final SleepTimeScoringFunction sleepTimeScoreFunction = new SleepTimeScoringFunction(); final Map<Long, Double> sleepTimePDF = sleepTimeScoreFunction.getPDF(timestamps); final MotionScoringFunction amplitudeScoringFunction = new MotionScoringFunction(this.motionMaxPower); final Map<Double, Double> amplitudePDF = amplitudeScoringFunction.getPDF(amplitudes); final HashMap<AmplitudeData, EventScores> pdf = new HashMap<>(); for(final AmplitudeData datum:data){ final double sleepScore = sleepTimeScoreFunction.getScore(datum.timestamp, sleepTimePDF) * amplitudeScoringFunction.getScore(datum.amplitude, amplitudePDF); final double wakeUpScore = wakeUpTimeScoreFunction.getScore(datum.timestamp, wakeUpTimePDF) * amplitudeScoringFunction.getScore(datum.amplitude, amplitudePDF); pdf.put(datum, new EventScores(sleepScore, wakeUpScore)); } return pdf; }</code><technical_language>If size of list is (because iterating input), size in ArrayList constructor. Small optimization, reduces copies</technical_language>

Target:
public Map<AmplitudeData, EventScores> getPDF(final Collection<AmplitudeData> data) { final List<Long> timestamps = new ArrayList<>(data.size()); final List<Double> amplitudes = new ArrayList<>(data.size()); for(final AmplitudeData amplitudeData:data){ timestamps.add(Long.valueOf(amplitudeData.timestamp)); amplitudes.add(Double.valueOf(amplitudeData.amplitude)); } final WakeUpTimeScoringFunction wakeUpTimeScoreFunction = new WakeUpTimeScoringFunction(this.wakeUpStartPercentage); final Map<Long, Double> wakeUpTimePDF = wakeUpTimeScoreFunction.getPDF(timestamps); final SleepTimeScoringFunction sleepTimeScoreFunction = new SleepTimeScoringFunction(); final Map<Long, Double> sleepTimePDF = sleepTimeScoreFunction.getPDF(timestamps); final MotionScoringFunction amplitudeScoringFunction = new MotionScoringFunction(this.motionMaxPower); final Map<Double, Double> amplitudePDF = amplitudeScoringFunction.getPDF(amplitudes); final HashMap<AmplitudeData, EventScores> pdf = new HashMap<>(); for(final AmplitudeData datum:data){ final double sleepScore = sleepTimeScoreFunction.getScore(datum.timestamp, sleepTimePDF) * amplitudeScoringFunction.getScore(datum.amplitude, amplitudePDF); final double wakeUpScore = wakeUpTimeScoreFunction.getScore(datum.timestamp, wakeUpTimePDF) * amplitudeScoringFunction.getScore(datum.amplitude, amplitudePDF); pdf.put(datum, new EventScores(sleepScore, wakeUpScore)); } return pdf; }
Source:
<code>protected void sendStartAuthentication(ServletRequest request, ServletResponse response, FilterChain chain, AuthenticationException reason) throws ServletException, IOException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; if (isJson(httpRequest) || isJsonFormat(httpRequest)) { httpResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); return; } final Logger logger = LoggerFactory.getLogger(GoExceptionTranslationFilter.class); SavedRequest savedRequest = new SavedRequest(httpRequest, getPortResolver()); <START> logger.debug("Authentication entry point being called; SavedRequest added to Session: " + savedRequest); <END> if (isCreateSessionAllowed() && shouldRedirect(savedRequest.getRequestUrl())) { httpRequest.getSession().setAttribute(AbstractProcessingFilter.SPRING_SECURITY_SAVED_REQUEST_KEY, savedRequest); } SecurityContextHolder.getContext().setAuthentication(null); determineAuthenticationPoint(httpRequest).commence(httpRequest, response, reason); }</code><technical_language>change</technical_language>

Target:
protected void sendStartAuthentication(ServletRequest request, ServletResponse response, FilterChain chain, AuthenticationException reason) throws ServletException, IOException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; if (isJson(httpRequest) || isJsonFormat(httpRequest)) { httpResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); return; } final Logger logger = LoggerFactory.getLogger(GoExceptionTranslationFilter.class); SavedRequest savedRequest = new SavedRequest(httpRequest, getPortResolver()); logger.debug("Authentication entry point being called; SavedRequest added to Session: {}", savedRequest); if (isCreateSessionAllowed() && shouldRedirect(savedRequest.getRequestUrl())) { httpRequest.getSession().setAttribute(AbstractProcessingFilter.SPRING_SECURITY_SAVED_REQUEST_KEY, savedRequest); } SecurityContextHolder.getContext().setAuthentication(null); determineAuthenticationPoint(httpRequest).commence(httpRequest, response, reason); }
Source:
<code>public void request(long n) { <START> if (n > 0 && state.requestCount.getAndAdd(n) == 0) { <END> if (n == Long.MAX_VALUE) { for (; !state.subscriber.isUnsubscribed(); ) { if (!doNext()) { break; } } } else { if (!state.subscriber.isUnsubscribed()) { do { if (!doNext()) { break; } } while (state.requestCount.decrementAndGet() > 0 && !state.subscriber.isUnsubscribed()); } } } }</code><technical_language>BackpressureUtils.getAndAdd avoid request overflow</technical_language>

Target:
public void request(long n) { if (n > 0 && BackpressureUtils.getAndAddRequest(state.requestCount, n) == 0) { if (n == Long.MAX_VALUE) { for (; !state.subscriber.isUnsubscribed(); ) { if (!doNext()) { break; } } } else if (!state.subscriber.isUnsubscribed()) { do { if (!doNext()) { break; } } while (state.requestCount.decrementAndGet() > 0 && !state.subscriber.isUnsubscribed()); } } }
Source:
<code>public static void clearCache(Instance instance) { cacheResetCount.incrementAndGet(); getZooCache(instance).clear(ZooUtil.getRoot(instance) + Constants.ZTABLES); getZooCache(instance).clear(ZooUtil.getRoot(instance) + Constants.ZNAMESPACES); <START> tableMapCache = null; <END> }</code><technical_language>is a clearCacheByPath method this set null</technical_language>

Target:
public static void clearCache(Instance instance) { getZooCache(instance).clear(ZooUtil.getRoot(instance) + Constants.ZTABLES); getZooCache(instance).clear(ZooUtil.getRoot(instance) + Constants.ZNAMESPACES); instanceToMapCache.invalidate(instance.getInstanceID()); }
Source:
<code><START> private void testGetNextTrainingData(final int numTotalInstances) { <END> final int remainderForLatchMiniBatch = numTotalInstances % MINI_BATCH_SIZE; final int numMiniBatches = numTotalInstances / MINI_BATCH_SIZE + (remainderForLatchMiniBatch == 0 ? 0 : 1); final int sizeOfLastMiniBatch = remainderForLatchMiniBatch == 0 ? MINI_BATCH_SIZE : remainderForLatchMiniBatch; int miniBatchIdx = 0; Map<Long, Integer> trainingData = trainingDataProvider.getNextTrainingData(); while (!trainingData.isEmpty()) { miniBatchIdx++; for (final Long key : trainingData.keySet()) { assertEquals(kvMapBackingMemoryStore.get(key), trainingData.get(key)); } if (miniBatchIdx < numMiniBatches) { assertEquals("Should process MINI_BATCH_SIZE instances", MINI_BATCH_SIZE, trainingData.size()); } else if (miniBatchIdx == numMiniBatches) { assertEquals("The last mini-batch should process remaining instances", sizeOfLastMiniBatch, trainingData.size()); } else { fail("The total number of mini-batches is larger than expectation"); } trainingData = trainingDataProvider.getNextTrainingData(); } assertEquals("The total number of mini-batches is different from expectation", numMiniBatches, miniBatchIdx); }</code><technical_language>add a description for this method</technical_language>

Target:
private void testGetNextTrainingData(final int numTotalInstances) { final int remainderForLastMiniBatch = numTotalInstances % MINI_BATCH_SIZE; final int numMiniBatches = numTotalInstances / MINI_BATCH_SIZE + (remainderForLastMiniBatch == 0 ? 0 : 1); final int lastMiniBatchIdx = numMiniBatches - 1; final int sizeOfLastMiniBatch = remainderForLastMiniBatch == 0 ? MINI_BATCH_SIZE : remainderForLastMiniBatch; int miniBatchIdx = 0; Map<Long, Integer> trainingData = trainingDataProvider.getNextTrainingData(); while (!trainingData.isEmpty()) { for (final Long key : trainingData.keySet()) { assertEquals(memoryStore.get(key).getSecond(), trainingData.get(key)); } if (miniBatchIdx < lastMiniBatchIdx) { assertEquals("Should process MINI_BATCH_SIZE instances", MINI_BATCH_SIZE, trainingData.size()); } else if (miniBatchIdx == lastMiniBatchIdx) { assertEquals("The last mini-batch should process remaining instances", sizeOfLastMiniBatch, trainingData.size()); } else { fail("The total number of mini-batches is larger than expectation"); } trainingData = trainingDataProvider.getNextTrainingData(); miniBatchIdx++; } assertEquals("The total number of mini-batches is different from expectation", numMiniBatches, miniBatchIdx); }
Source:
<code>private void getTopicList() { if (getTopicListCall != null) { getTopicListCall.cancel(); } getTopicListCall = discussionService.getCourseTopics(courseData.getCourse().getId()); getTopicListCall.enqueue(new ErrorHandlingCallback<CourseTopics>( <START> getActivity(), this, errorNotification, snackbarErrorNotification, this) { <END> @Override protected void onResponse(@NonNull final CourseTopics courseTopics) { logger.debug("GetTopicListTask success=" + courseTopics); ArrayList<DiscussionTopic> allTopics = new ArrayList<>(); allTopics.addAll(courseTopics.getNonCoursewareTopics()); allTopics.addAll(courseTopics.getCoursewareTopics()); List<DiscussionTopicDepth> allTopicsWithDepth = DiscussionTopicDepth.createFromDiscussionTopics(allTopics); discussionTopicsAdapter.setItems(allTopicsWithDepth); discussionTopicsAdapter.notifyDataSetChanged(); } @Override protected void onFinish() { if (!EventBus.getDefault().isRegistered(CourseDiscussionTopicsFragment.this)) { EventBus.getDefault().registerSticky(CourseDiscussionTopicsFragment.this); } } }); }</code><technical_language>Instead of implementing TaskProgressCallback fragment level TaskProgressCallback#ProgressViewController utility class, instantiate anonymous object pass instead of this. e.g. java new TaskProgressCallback.ProgressViewController(view.findViewById(R.id.loading_indicator)</technical_language>

Target:
private void getTopicList() { if (getTopicListCall != null) { getTopicListCall.cancel(); } final TaskProgressCallback.ProgressViewController progressViewController = new TaskProgressCallback.ProgressViewController(progressSpinner); getTopicListCall = discussionService.getCourseTopics(courseData.getCourse().getId()); getTopicListCall.enqueue(new ErrorHandlingCallback<CourseTopics>( getActivity(), progressViewController, errorNotification, snackbarErrorNotification, this) { @Override protected void onResponse(@NonNull final CourseTopics courseTopics) { logger.debug("GetTopicListTask success=" + courseTopics); ArrayList<DiscussionTopic> allTopics = new ArrayList<>(); allTopics.addAll(courseTopics.getNonCoursewareTopics()); allTopics.addAll(courseTopics.getCoursewareTopics()); List<DiscussionTopicDepth> allTopicsWithDepth = DiscussionTopicDepth.createFromDiscussionTopics(allTopics); discussionTopicsAdapter.setItems(allTopicsWithDepth); discussionTopicsAdapter.notifyDataSetChanged(); } @Override protected void onFinish() { if (!EventBus.getDefault().isRegistered(CourseDiscussionTopicsFragment.this)) { EventBus.getDefault().registerSticky(CourseDiscussionTopicsFragment.this); } } }); }
Source:
<code>public void destroy() throws Exception { super.cleanup(); <START> deleteApplication(); <END> }</code><technical_language>move this line line, super.cleanup method do of server requests</technical_language>

Target:
public void destroy() throws Exception { deleteApplication(); super.cleanup(); }
Source:
<code>public static WebArchive getDeployment() { final String javaHome = getSystemProperty("java.home"); final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, DEPLOYMENT_NAME + ".war") .addClass(TransactionalClient.class) .addClass(TransactionalService.class) .addClass(TransactionalServiceImpl.class) .addClass(TestSuiteEnvironment.class) .addAsManifestResource(new StringAsset("Dependencies: org.jboss.xts,org.jboss.jts\n"), "MANIFEST.MF") .addAsManifestResource(createPermissionsXmlAsset( new RuntimePermission("getClassLoader"), new RuntimePermission("accessDeclaredMembers"), new FilePermission(javaHome + File.separator + "lib" + File.separator + "jaxws.properties", "read"), new FilePermission(javaHome + File.separator + "lib" + File.separator + "wsdl.properties", "read"), new PropertyPermission("user.dir", "read"), new RuntimePermission("org.apache.cxf.permission"), new SocketPermission(SERVER_HOST_PORT, "connect,resolve"), <START> new RuntimePermission("createClassLoader"), <END> new PropertyPermission("management.address", "read"), new PropertyPermission("node0", "read"), new PropertyPermission("jboss.http.port", "read")), "permissions.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); return webArchive; }</code><technical_language>for expert check ^^^. fine</technical_language>

Target:
public static WebArchive getDeployment() { final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, DEPLOYMENT_NAME + ".war") .addClass(TransactionalClient.class) .addClass(TransactionalService.class) .addClass(TransactionalServiceImpl.class) .addAsManifestResource(new StringAsset("Dependencies: org.jboss.xts,org.jboss.jts\n"), "MANIFEST.MF") .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); return webArchive; }
Source:
<code><START> public void setUp() throws Exception { cuMarshalService = new CUMarshalServiceImpl(); xmlFile = new File(EXAMPLE_FILE_NAME); } <END></code><technical_language>Is throws Exception needed here</technical_language>

Target:
public void setUp() { cuMarshalService = new CUMarshalServiceImpl(); xmlFile = new File(EXAMPLE_FILE_NAME); }
Source:
<code>public AuditLogType getAuditLogTypeValue() { <START> return getSucceeded() ? AuditLogType.USER_ADD_PROFILE : AuditLogType.USER_ADD_PROFILE_FAILED; <END> }</code><technical_language>audit message for case key updated is needed</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { UserProfile existingProfile = getUserProfile(); if (existingProfile != null && isSSHPublicKeyUpdate(existingProfile)) { return getSucceeded() ? AuditLogType.USER_UPDATE_PROFILE : AuditLogType.USER_UPDATE_PROFILE_FAILED; } else { return getSucceeded() ? AuditLogType.USER_ADD_PROFILE : AuditLogType.USER_ADD_PROFILE_FAILED; } }
Source:
<code>public static org.ovirt.engine.api.model.ClusterFeature map(AdditionalFeature entity, org.ovirt.engine.api.model.ClusterFeature template) { <START> org.ovirt.engine.api.model.ClusterFeature model = new org.ovirt.engine.api.model.ClusterFeature(); <END> model.setName(entity.getName()); model.setId(entity.getId().toString()); return model; }</code><technical_language>Same, create a new instance if "template" is null</technical_language>

Target:
public static org.ovirt.engine.api.model.ClusterFeature map(AdditionalFeature entity, org.ovirt.engine.api.model.ClusterFeature template) { org.ovirt.engine.api.model.ClusterFeature model = template != null ? template : new org.ovirt.engine.api.model.ClusterFeature(); model.setName(entity.getName()); model.setId(entity.getId().toString()); return model; }
Source:
<code><START> public CacheConfigurationBuilder<K, V> withResourcePools(ResourcePools resourcePools) { <END> return new CacheConfigurationBuilder<K, V>(expiry, classLoader, evictionPrioritizer, evictionVeto, resourcePools, serviceConfigurations); }</code><technical_language>Do want this method</technical_language>

Target:
public CacheConfigurationBuilder<K, V> withResourcePools(ResourcePools resourcePools) { if (resourcePools == null) { throw new NullPointerException("Null resource pools"); } CacheConfigurationBuilder<K, V> otherBuilder = new CacheConfigurationBuilder<K, V>(this); otherBuilder.resourcePools = resourcePools; return otherBuilder; }
Source:
<code>public GenericRecord parse(ByteBuffer bytes) { bytes.get(); int id = bytes.getInt(); int length = bytes.limit() - 1 - 4; int offset = bytes.position() + bytes.arrayOffset(); <START> try { <END> Schema schema = registry.getByID(id); DatumReader<GenericRecord> reader = new GenericDatumReader<>(schema); return reader.read(null, DecoderFactory.get().binaryDecoder(bytes.array(), offset, length, null)); } catch (RestClientException | IOException e) { throw new ParseException(e, "Fail to decode avro message!"); } }</code><technical_language>schema registry repo contains avro serializer/deserializer , is instead of knowing format of message</technical_language>

Target:
public GenericRecord parse(ByteBuffer bytes) { try { bytes.get(); int id = bytes.getInt(); int length = bytes.limit() - 1 - 4; int offset = bytes.position() + bytes.arrayOffset(); Schema schema = registry.getByID(id); DatumReader<GenericRecord> reader = new GenericDatumReader<>(schema); return reader.read(null, DecoderFactory.get().binaryDecoder(bytes.array(), offset, length, null)); } catch (Exception e) { throw new ParseException(e, "Fail to decode avro message!"); } }