auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public static void trackCreateProgram(String projectName, Boolean landscapeMode, boolean exampleProgram) { <END> if (!BuildConfig.DATA_TRACKING) { return; } List<Pair<String, String>> trackingData = new ArrayList<>(); trackingData.add(new Pair<>(TrackingConstants.PROGRAM_NAME, projectName)); trackingData.add(new Pair<>(TrackingConstants.LANDSCAPE, String.valueOf(landscapeMode))); trackingData.add(new Pair<>(TrackingConstants.CREATE_EXAMPLE_PROGRAM, String.valueOf(exampleProgram))); createJsonAndLogCustomEvent(TrackingConstants.CREATE_PROGRAM, trackingData); }</code><technical_language>div below, i if clauses 50 times. implement a trackerClass is instantiated based build flag startup, activeTracker, "blackHole" swallowing tracking calls</technical_language>

Target:
public void trackCreateProgram(String projectName, Boolean landscapeMode, boolean exampleProgram) { List<Pair<String, String>> trackingData = new ArrayList<>(); trackingData.add(new Pair<>(TrackingConstants.PROGRAM_NAME, projectName)); trackingData.add(new Pair<>(TrackingConstants.LANDSCAPE, String.valueOf(landscapeMode))); trackingData.add(new Pair<>(TrackingConstants.CREATE_EXAMPLE_PROGRAM, String.valueOf(exampleProgram))); createJsonAndLogCustomEvent(TrackingConstants.CREATE_PROGRAM, trackingData); }
Source:
<code>private RMAuthentication joinResourceManager(String rmURL) { logger.info("Joining Resource Manager at " + rmURL); final String fullUrl = rmURL.endsWith("/") ? rmURL + RMConstants.NAME_ACTIVE_OBJECT_RMAUTHENTICATION : rmURL + "/" + RMConstants.NAME_ACTIVE_OBJECT_RMAUTHENTICATION; try { RMAuthentication auth = RMConnection.waitAndJoin(fullUrl, WAIT_ON_JOIN_TIMEOUT_IN_MS); if (auth == null) { logger.error(ExitStatus.RMAUTHENTICATION_NULL.description); System.exit(ExitStatus.RMAUTHENTICATION_NULL.exitCode); } logger.info("Resource Manager joined."); return auth; } catch (Throwable t) { logger.error("Unable to join the Resource Manager at " + rmURL <START> + "\n ProActive server can not send reply to Node (usually due to firewall). Please check server log for more information", t); <END> System.exit(ExitStatus.RMNODE_ADD_ERROR.exitCode); } return null; }</code><technical_language>..can request Node...</technical_language>

Target:
private RMAuthentication joinResourceManager(String rmURL) { logger.info("Joining Resource Manager at " + rmURL); final String fullUrl = rmURL.endsWith("/") ? rmURL + RMConstants.NAME_ACTIVE_OBJECT_RMAUTHENTICATION : rmURL + "/" + RMConstants.NAME_ACTIVE_OBJECT_RMAUTHENTICATION; try { RMAuthentication auth = RMConnection.waitAndJoin(fullUrl, WAIT_ON_JOIN_TIMEOUT_IN_MS); if (auth == null) { logger.error(ExitStatus.RMAUTHENTICATION_NULL.description); System.exit(ExitStatus.RMAUTHENTICATION_NULL.exitCode); } logger.info("Resource Manager joined."); return auth; } catch (Throwable t) { logger.error("Unable to join the Resource Manager at " + rmURL, t); System.exit(ExitStatus.RMNODE_ADD_ERROR.exitCode); } return null; }
Source:
<code>public EMFRefactorRequest(final EObject object) { this(object, <START> getModelSet(object)); <END> }</code><technical_language>If get a model-set, work? this throw exception in case</technical_language>

Target:
public EMFRefactorRequest(final EObject object) throws ServiceException { this(object, getModelSet(object)); }
Source:
<code>public Object execute() throws Exception { for (int i = 0; i < numberOfNotifications; i++) { sendNotification(); if (waitTime > 0) { try { Thread.sleep(waitTime * 1000L); } catch (InterruptedException e) { <START> Thread.currentThread().interrupt(); <END> } } } return null; }</code><technical_language>Need compute end time of a while loop for this instance of i compute remaining time inside. Interruption loop for this loop. for(), propagate interruption in a finally clause</technical_language>

Target:
public Object execute() throws Exception { for (int i = 0; i < numberOfNotifications; i++) { sendNotification(); if (waitTime > 0) { try { Thread.sleep(waitTime * 1000L); } catch (InterruptedException e) { } } } return null; }
Source:
<code>public String getExchangeFileLocation() { if (file == null) { String sValue = PropertyAccessor.getInstance().getPropertyFileLocation(); <START> if (sValue != null && sValue.length() > 0) { <END> if (sValue.endsWith(File.separator)) { setFileName(sValue + EXCHANGE_XML_FILE_NAME); } else { setFileName(sValue + File.separator + EXCHANGE_XML_FILE_NAME); } } } return isFile() ? file.getAbsolutePath() : null; }</code><technical_language>Optional: stringUtil class null string</technical_language>

Target:
public String getExchangeFileLocation() { if (file == null) { String sValue = PropertyAccessor.getInstance().getPropertyFileLocation(); if (StringUtils.isNotEmpty(sValue)) { if (sValue.endsWith(File.separator)) { setFileName(sValue + EXCHANGE_XML_FILE_NAME); } else { setFileName(sValue + File.separator + EXCHANGE_XML_FILE_NAME); } } } return isFile() ? file.getAbsolutePath() : null; }
Source:
<code>public EventData(byte[] body, Context context) { <START> Objects.requireNonNull(body); <END> this.body = ByteBuffer.wrap(body); this.properties = new HashMap<>(); this.systemProperties = new SystemProperties(Collections.emptyMap()); this.context = context; }</code><technical_language>full file, reduce this code duplication condensing ctor takes a byte[] bytebuffer. java public EventData(byte[] body) { this(body, Context.NONE); } public EventData(byte[] body, Context context) { this(ByteBuffer.wrap(body), context); } public EventData(ByteBuffer body) { this(body, Context.NONE); } public EventData(ByteBuffer body, Context context) { // logic here. is defined in place. }</technical_language>

Target:
public EventData(byte[] body, Context context) { this(ByteBuffer.wrap(body), context); }
Source:
<code>private boolean suggestGroupAsReviewer(final Project.NameKey project, final GroupReference group) throws OrmException { if (AccountGroup.ANONYMOUS_USERS.equals(group.getUUID()) <START> || AccountGroup.REGISTERED_USERS.equals(group.getUUID())) { <END> return false; } try { final Set<Account> members = groupMembersFactory.create(project, group.getUUID()).call(); if (members.isEmpty()) { return false; } final int maxAllowed = cfg.getInt("addreviewer", "maxAllowed", AddReviewer.DEFAULT_MAX_REVIEWERS); if (maxAllowed > 0 && members.size() > maxAllowed) { return false; } } catch (NoSuchGroupException e) { return false; } catch (NoSuchProjectException e) { return false; } return true; }</code><technical_language>Ah, yes, I understand simply groupMemberFactory now. I concerned special group handling is in common addReviewer code. change, if do, want handled equivalently. some utility a isLegalReviewerGroup() function</technical_language>

Target:
private boolean suggestGroupAsReviewer(final Project.NameKey project, final GroupReference group) throws OrmException { if (!AddReviewer.isLegalReviewerGroup(group.getUUID())) { return false; } try { final Set<Account> members = groupMembersFactory.create(project, group.getUUID()).call(); if (members.isEmpty()) { return false; } final int maxAllowed = cfg.getInt("addreviewer", "maxAllowed", AddReviewer.DEFAULT_MAX_REVIEWERS); if (maxAllowed > 0 && members.size() > maxAllowed) { return false; } } catch (NoSuchGroupException e) { return false; } catch (NoSuchProjectException e) { return false; } return true; }
Source:
<code>private void runUserControllerTask(final int iteration) throws Exception { <START> insertableMetricTracker.put(DolphinMetricKeys.CONTROLLER_TASK_USER_CONTROLLER_TASK_START, System.currentTimeMillis()); <END> userControllerTask.run(iteration); insertableMetricTracker.put(DolphinMetricKeys.CONTROLLER_TASK_USER_CONTROLLER_TASK_END, System.currentTimeMillis()); }</code><technical_language>happy packing key strings in class, classes key strings referring DolphinMetricKeys.CONTROLLER_TASK_SEND_DATA_START DolphinMetricKeys.COMPUTE_TASK_USER_COMPUTE_TASK_END (taken ControllerTask ComputeTask. see, prefix DolphinMetricKeys. long variable name longer. a static import statement in ControllerTask ComputeTask prefixes omitted</technical_language>

Target:
private void runUserControllerTask(final int iteration) throws MetricException { insertableMetricTracker.put(CONTROLLER_TASK_USER_CONTROLLER_TASK_START, System.currentTimeMillis()); userControllerTask.run(iteration); insertableMetricTracker.put(CONTROLLER_TASK_USER_CONTROLLER_TASK_END, System.currentTimeMillis()); }
Source:
<code>public void deleteCollectionAdminGroupUnAuthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); Group adminGroup = collectionService.createAdministrators(context, collection); context.restoreAuthSystemState(); getClient().perform(delete("/api/core/collections/" + collection.getID() + "/adminGroup")) <START> .andExpect(status().isUnauthorized()); <END> }</code><technical_language>double check group is</technical_language>

Target:
public void deleteCollectionAdminGroupUnAuthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); Group adminGroup = collectionService.createAdministrators(context, collection); context.restoreAuthSystemState(); getClient().perform(delete("/api/core/collections/" + collection.getID() + "/adminGroup")) .andExpect(status().isUnauthorized()); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/adminGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(adminGroup.getID(), adminGroup.getName()))); }
Source:
<code>TransferFormsTableView(TransferFormsTableViewModel model, String[] headers) { super(model); this.headers = headers; setName("forms"); addMouseListener(new MouseAdapterBuilder().onClick(this::relayClickToButton).build()); Dimension formNameDims = getHeaderDimension(this, getHeader(FORM_NAME_COL)); Dimension statusDims = getHeaderDimension(this, getHeader(STATUS_COL)); customizeHeader(getTableHeader()); customizeTable(this); TableColumnModel columns = getColumnModel(); columns.getColumn(SELECTED_CHECKBOX_COL).setMinWidth(40); columns.getColumn(SELECTED_CHECKBOX_COL).setMaxWidth(40); columns.getColumn(SELECTED_CHECKBOX_COL).setPreferredWidth(40); columns.getColumn(FORM_NAME_COL).setMinWidth(formNameDims.width + 25); columns.getColumn(FORM_NAME_COL).setPreferredWidth(formNameDims.width + 25); columns.getColumn(STATUS_COL).setMinWidth(statusDims.width + 25); columns.getColumn(STATUS_COL).setPreferredWidth(statusDims.width + 25); columns.getColumn(DETAIL_BUTTON_COL).setCellRenderer(UI::cellWithButton); columns.getColumn(DETAIL_BUTTON_COL).setMinWidth(40); columns.getColumn(DETAIL_BUTTON_COL).setMaxWidth(40); columns.getColumn(DETAIL_BUTTON_COL).setPreferredWidth(40); setFillsViewportHeight(true); TableRowSorter<TransferFormsTableViewModel> sorter = sortBy(getModel(), FORM_NAME_COL, ASCENDING); <START> sorter.setComparator(SELECTED_CHECKBOX_COL, (Comparator<Boolean>) UI::compareSelectionButton); <END> setRowSorter(sorter); sorter.sort(); }</code><technical_language>I need set another comparator for details column in: sorter.setComparator(DETAIL_BUTTON_COL, (Comparator<DetailsStatusButton>) DetailsStatusButton::compare);</technical_language>

Target:
TransferFormsTableView(TransferFormsTableViewModel model, String[] headers) { super(model); this.headers = headers; setName("forms"); addMouseListener(new MouseAdapterBuilder().onClick(this::relayClickToButton).build()); Dimension formNameDims = getHeaderDimension(this, getHeader(FORM_NAME_COL)); Dimension statusDims = getHeaderDimension(this, getHeader(STATUS_COL)); customizeHeader(getTableHeader()); customizeTable(this); TableColumnModel columns = getColumnModel(); columns.getColumn(SELECTED_CHECKBOX_COL).setMinWidth(40); columns.getColumn(SELECTED_CHECKBOX_COL).setMaxWidth(40); columns.getColumn(SELECTED_CHECKBOX_COL).setPreferredWidth(40); columns.getColumn(FORM_NAME_COL).setMinWidth(formNameDims.width + 25); columns.getColumn(FORM_NAME_COL).setPreferredWidth(formNameDims.width + 25); columns.getColumn(STATUS_COL).setMinWidth(statusDims.width + 25); columns.getColumn(STATUS_COL).setPreferredWidth(statusDims.width + 25); columns.getColumn(DETAIL_BUTTON_COL).setCellRenderer(ButtonProcessing::cellWithButton); columns.getColumn(DETAIL_BUTTON_COL).setMinWidth(40); columns.getColumn(DETAIL_BUTTON_COL).setMaxWidth(40); columns.getColumn(DETAIL_BUTTON_COL).setPreferredWidth(40); setFillsViewportHeight(true); TableRowSorter<TransferFormsTableViewModel> sorter = sortBy(getModel(), FORM_NAME_COL, ASCENDING); sorter.setComparator(SELECTED_CHECKBOX_COL, (Comparator<Boolean>) UI::compareSelectionButton); setRowSorter(sorter); sorter.sort(); }
Source:
<code>protected boolean setAndValidateDiskProfiles() { <START> if (diskInfoDestinationMap != null) { <END> Map<DiskImage, Guid> map = new HashMap<>(); for (DiskImage diskImage : diskInfoDestinationMap.values()) { map.put(diskImage, diskImage.getStorageIds().get(0)); } return validate(DiskProfileHelper.setAndValidateDiskProfiles(map)); } return true; }</code><technical_language>iirc initialized in ctor, check empty</technical_language>

Target:
protected boolean setAndValidateDiskProfiles() { if (diskInfoDestinationMap != null && !diskInfoDestinationMap.isEmpty()) { Map<DiskImage, Guid> map = new HashMap<>(); for (DiskImage diskImage : diskInfoDestinationMap.values()) { map.put(diskImage, diskImage.getStorageIds().get(0)); } return validate(DiskProfileHelper.setAndValidateDiskProfiles(map)); } return true; }
Source:
<code>public void testDotProductAttention(){ final INDArray keys = Nd4j.rand(new int[]{10, 4, 3}); final INDArray values = Nd4j.rand(new int[]{10, 4, 3}); final INDArray query = Nd4j.rand(new int[]{10, 4, 1}); final INDArray exec = Nd4j.matmul(keys, query, true, false, false) .divi(Math.sqrt(keys.size(1))); Nd4j.exec(new SoftMax(exec, exec, 1)); final INDArray finalOut = Nd4j.matmul(values, exec).norm1(); SameDiff sd = SameDiff.create(); SDVariable sdQ = sd.var("q", query); SDVariable sdK = sd.var("k", keys); SDVariable sdV = sd.var("v", values); SDVariable t = sd.nn.dotProductAttention(sdQ, sdK, sdV, null, true); t.norm1("out"); String err = OpValidation.validate(new TestCase(sd) .expectedOutput("out", finalOut) .gradientCheck(true)); <START> assertNull(err, err); <END> }</code><technical_language>minor point: assertNull(err) is fine. prints object if fails, string set message. (And yes, I a ton of tests do assertNull(err,err) cleaning I them)</technical_language>

Target:
public void testDotProductAttention(){ final INDArray keys = Nd4j.rand(new int[]{10, 4, 3}); final INDArray values = Nd4j.rand(new int[]{10, 4, 3}); final INDArray query = Nd4j.rand(new int[]{10, 4, 1}); final INDArray exec = Nd4j.matmul(keys, query, true, false, false) .divi(Math.sqrt(keys.size(1))); Nd4j.exec(new SoftMax(exec, exec, 1)); final INDArray finalOut = Nd4j.matmul(values, exec).norm1(); SameDiff sd = SameDiff.create(); SDVariable sdQ = sd.var("q", query); SDVariable sdK = sd.var("k", keys); SDVariable sdV = sd.var("v", values); SDVariable t = sd.nn.dotProductAttention(sdQ, sdK, sdV, null, true); t.norm1("out"); String err = OpValidation.validate(new TestCase(sd) .expectedOutput("out", finalOut) .gradientCheck(true)); assertNull(err); }
Source:
<code>public JobSubjectEntity(Guid jobId, Guid entityId, VdcObjectType entityType) { <START> super(); <END> this.entityId = entityId; this.entityType = entityType; this.jobId = jobId; }</code><technical_language>please remove empty c'tor</technical_language>

Target:
public JobSubjectEntity(Guid jobId, Guid entityId, VdcObjectType entityType) { this.entityId = entityId; this.entityType = entityType; this.jobId = jobId; }
Source:
<code>private RMNode recoverNode(RMNodeData rmNodeData, NodeSource nodeSource, Map<NodeState, Integer> recoveredNodeStatesCounter) throws InterruptedException { Node node = null; String nodeUrl = rmNodeData.getNodeUrl(); NodeState previousState = rmNodeData.getState(); boolean isPAMR = nodeUrl.startsWith("pamr://"); <START> int PAMR_MAXIMUM_TIMEOUT = 65000; <END> boolean connected = false; long initialTime = System.currentTimeMillis(); do { try { node = nodeSource.lookupNode(nodeUrl, PAResourceManagerProperties.RM_NODELOOKUP_TIMEOUT.getValueAsInt()); logger.info("Node " + nodeUrl + " was looked up successfully"); connected = true; } catch (Exception e) { if (isPAMR) { logger.debug("Node " + nodeUrl + " could not be looked up. Wait for PAMR agent reconnection delay."); Thread.sleep(1000); } else { logger.error("Node " + nodeUrl + " could not be looked up."); } } } while (!connected && isPAMR && (System.currentTimeMillis() - initialTime) < PAMR_MAXIMUM_TIMEOUT); if (!connected) { node = new FakeDownNodeForRecovery(rmNodeData.getName(), rmNodeData.getNodeUrl()); rmNodeData.setState(NodeState.DOWN); if (isPAMR) { logger.error("Node " + nodeUrl + " could not be looked up."); } } return this.addRMNodeToCoreAndSource(nodeSource, recoveredNodeStatesCounter, rmNodeData, nodeUrl, node, previousState); }</code><technical_language>timeout is 65s? why</technical_language>

Target:
private RMNode recoverNode(RMNodeData rmNodeData, NodeSource nodeSource, Map<NodeState, Integer> recoveredNodeStatesCounter) { Node node = null; String nodeUrl = rmNodeData.getNodeUrl(); NodeState previousState = rmNodeData.getState(); boolean isPAMR = nodeUrl.startsWith(PAMRRemoteObjectFactory.PROTOCOL_ID + "://"); boolean connected = false; long initialTime = System.currentTimeMillis(); do { try { node = nodeSource.lookupNode(nodeUrl, PAResourceManagerProperties.RM_NODELOOKUP_TIMEOUT.getValueAsInt()); logger.info("Node " + nodeUrl + " was looked up successfully"); connected = true; } catch (Exception e) { if (isPAMR) { logger.debug("Node " + nodeUrl + " could not be looked up. Wait for PAMR agent reconnection delay."); Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); } else { logger.error("Node " + nodeUrl + " could not be looked up."); } } } while (!connected && isPAMR && (System.currentTimeMillis() - initialTime) < Agent.MAXIMUM_RETRY_DELAY_MS); if (!connected) { node = new FakeDownNodeForRecovery(rmNodeData.getName(), rmNodeData.getNodeUrl()); rmNodeData.setState(NodeState.DOWN); if (isPAMR) { logger.error("Node " + nodeUrl + " could not be looked up."); } } return this.addRMNodeToCoreAndSource(nodeSource, recoveredNodeStatesCounter, rmNodeData, nodeUrl, node, previousState); }
Source:
<code><START> public static void resetUsageCountingDate() { <END> prefs.edit().putLong(PREF_USAGE_COUNTING_DATE, Calendar.getInstance().getTimeInMillis()).apply(); }</code><technical_language>This called a database is imported</technical_language>

Target:
public static void resetUsageCountingDate() { setUsageCountingDateMillis(Calendar.getInstance().getTimeInMillis()); }
Source:
<code>private static Set<String> getAllAsciiCharacters() { final int SPACE = ' '; final int TILDE = '~'; Set<String> singleChars = new HashSet<>(TILDE - SPACE + 1); <START> for (int i = SPACE; i <= TILDE; i++) { <END> singleChars.add(Character.toString((char) i)); } return singleChars; }</code><technical_language>suggestion for (char i = SPACE; i <= TILDE; i++) { do that? remove need for casting below, SPACE TILDE chars</technical_language>

Target:
private static Set<String> getAllAsciiCharacters() { final int SPACE = ' '; final int TILDE = '~'; Set<String> singleChars = new HashSet<>(TILDE - SPACE + 1); for (char i = SPACE; i <= TILDE; i++) { singleChars.add(Character.toString(i)); } return singleChars; }
Source:
<code>public void before() { final NoOpRecordCollector collector = new NoOpRecordCollector() { @Override public <K, V> void send(final String topic, final K key, final V value, final Headers headers, final Integer partition, final Long timestamp, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) { sent.put(key, value); } }; <START> final StreamsMetricsImpl streamsMetrics = niceMock(StreamsMetricsImpl.class); replay(streamsMetrics); <END> final InternalMockProcessorContext context = new InternalMockProcessorContext( TestUtils.tempDirectory(), Serdes.String(), Serdes.Long(), collector, new ThreadCache(new LogContext("testCache "), 0, streamsMetrics)); context.setTime(0); store.init(context, store); }</code><technical_language>question mocks</technical_language>

Target:
public void before() { final NoOpRecordCollector collector = new NoOpRecordCollector() { @Override public <K, V> void send(final String topic, final K key, final V value, final Headers headers, final Integer partition, final Long timestamp, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) { sent.put(key, value); } }; final InternalMockProcessorContext context = new InternalMockProcessorContext( TestUtils.tempDirectory(), Serdes.String(), Serdes.Long(), collector, new ThreadCache( new LogContext("testCache "), 0, new StreamsMetricsImpl(new Metrics(), "test", StreamsConfig.METRICS_LATEST))); context.setTime(0); store.init(context, store); }
Source:
<code>public void saveCurrentProperty() { List<Property> ppList = getProperties(); for (Property pp : ppList) { this.property = pp; Process p = this.currentStep.getProcess(); List<Property> props = p.getProperties(); for (Property processProperty : props) { if (processProperty.getTitle() == null) { p.getProperties().remove(processProperty); } } for (Process process : this.property.getProcesses()) { if (!process.getProperties().contains(this.property)) { process.getProperties().add(this.property); } } try { this.serviceManager.getProcessService().save(this.currentStep.getProcess()); Helper.setMeldung("Property saved"); } catch (DataException e) { <START> logger.error(e.getMessage(), e); <END> Helper.setFehlerMeldung("Properties could not be saved"); } } }</code><technical_language>setErrorMessage</technical_language>

Target:
public void saveCurrentProperty() { List<Property> ppList = getProperties(); for (Property pp : ppList) { this.property = pp; Process p = this.currentStep.getProcess(); List<Property> props = p.getProperties(); for (Property processProperty : props) { if (processProperty.getTitle() == null) { p.getProperties().remove(processProperty); } } for (Process process : this.property.getProcesses()) { if (!process.getProperties().contains(this.property)) { process.getProperties().add(this.property); } } try { this.serviceManager.getProcessService().save(this.currentStep.getProcess()); Helper.setMeldung("Property saved"); } catch (DataException e) { Helper.setErrorMessage("Properties could not be saved", logger, e); } } }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof GlusterBrickEntity)) { return false; } GlusterBrickEntity other = (GlusterBrickEntity) obj; return Objects.equals(id, other.id) && Objects.equals(volumeId, other.volumeId) && Objects.equals(serverId, other.serverId) && Objects.equals(brickDirectory, other.brickDirectory) && Objects.equals(brickOrder, other.brickOrder) && Objects.equals(asyncTask, other.asyncTask) && Objects.equals(unSyncedEntries, other.unSyncedEntries) && Objects.equals(unSyncedEntriesTrend, other.unSyncedEntriesTrend) && Objects.equals(selfHealEta, other.selfHealEta) && status == other.status && <START> (Objects.equals(isArbiter, <END> other.isArbiter)); }</code><technical_language>surrounding brackets needed</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof GlusterBrickEntity)) { return false; } GlusterBrickEntity other = (GlusterBrickEntity) obj; return Objects.equals(id, other.id) && Objects.equals(volumeId, other.volumeId) && Objects.equals(serverId, other.serverId) && Objects.equals(brickDirectory, other.brickDirectory) && Objects.equals(brickOrder, other.brickOrder) && Objects.equals(asyncTask, other.asyncTask) && Objects.equals(unSyncedEntries, other.unSyncedEntries) && Objects.equals(unSyncedEntriesTrend, other.unSyncedEntriesTrend) && Objects.equals(selfHealEta, other.selfHealEta) && status == other.status && Objects.equals(isArbiter, other.isArbiter); }
Source:
<code>public Repository(final File d, final File workTree, final File objectDir, final File[] alternateObjectDir, final File indexFile, FS fs) throws IOException { if (workTree != null) { workDir = workTree; if (d == null) gitDir = new File(workTree, Constants.DOT_GIT); else gitDir = d; } else { if (d != null) gitDir = d; else throw new IllegalArgumentException("Either GIT_DIR or GIT_WORK_TREE must be passed to Repository constructor"); } this.fs = fs; userConfig = SystemReader.getInstance().openUserConfig(fs); config = new RepositoryConfig(userConfig, fs.resolve(gitDir, "config")); loadUserConfig(); loadConfig(); if (workDir == null) { String workTreeConfig = getConfig().getString("core", null, "worktree"); if (workTreeConfig != null) { workDir = fs.resolve(d, workTreeConfig); } else { workDir = gitDir.getParentFile(); } } refs = new RefDirectory(this); if (objectDir != null) objectDatabase = new ObjectDirectory(fs.resolve(objectDir, ""), <START> alternateObjectDir); <END> else objectDatabase = new ObjectDirectory(fs.resolve(gitDir, "objects"), alternateObjectDir); if (indexFile != null) this.indexFile = indexFile; else this.indexFile = new File(gitDir, "index"); if (objectDatabase.exists()) { final String repositoryFormatVersion = getConfig().getString( "core", null, "repositoryFormatVersion"); if (!"0".equals(repositoryFormatVersion)) { throw new IOException("Unknown repository format \"" + repositoryFormatVersion + "\"; expected \"0\"."); } } }</code><technical_language>pass fs instance ObjectDirectory</technical_language>

Target:
public Repository(final File d, final File workTree, final File objectDir, final File[] alternateObjectDir, final File indexFile, FS fs) throws IOException { if (workTree != null) { workDir = workTree; if (d == null) gitDir = new File(workTree, Constants.DOT_GIT); else gitDir = d; } else { if (d != null) gitDir = d; else throw new IllegalArgumentException("Either GIT_DIR or GIT_WORK_TREE must be passed to Repository constructor"); } this.fs = fs; userConfig = SystemReader.getInstance().openUserConfig(fs); config = new RepositoryConfig(userConfig, fs.resolve(gitDir, "config")); loadUserConfig(); loadConfig(); if (workDir == null) { String workTreeConfig = getConfig().getString("core", null, "worktree"); if (workTreeConfig != null) { workDir = fs.resolve(d, workTreeConfig); } else { workDir = gitDir.getParentFile(); } } refs = new RefDirectory(this); if (objectDir != null) objectDatabase = new ObjectDirectory(fs.resolve(objectDir, ""), alternateObjectDir, fs); else objectDatabase = new ObjectDirectory(fs.resolve(gitDir, "objects"), alternateObjectDir, fs); if (indexFile != null) this.indexFile = indexFile; else this.indexFile = new File(gitDir, "index"); if (objectDatabase.exists()) { final String repositoryFormatVersion = getConfig().getString( "core", null, "repositoryFormatVersion"); if (!"0".equals(repositoryFormatVersion)) { throw new IOException("Unknown repository format \"" + repositoryFormatVersion + "\"; expected \"0\"."); } } }
Source:
<code>private void dumpDirectly(final String path, final String jobName, final List<String> result) { for (String each : regCenter.getChildrenKeys(path)) { String zkPath = path + "/" + each; String zkValue = Optional.ofNullable(regCenter.get(zkPath)).orElse(""); String cachePath = zkPath; String cacheValue = zkValue; CuratorCache cache = (CuratorCache) regCenter.getRawCache("/" + jobName); <START> if (null != cache) { <END> Optional<ChildData> cacheData = cache.get(zkPath); cachePath = cacheData.map(ChildData::getPath).orElse(zkPath); cacheValue = cacheData.map(ChildData::getData).map(String::new).orElse(zkValue); } if (zkValue.equals(cacheValue) && zkPath.equals(cachePath)) { result.add(String.join(" | ", zkPath, zkValue)); } else { result.add(String.join(" | ", zkPath, zkValue, cachePath, cacheValue)); } dumpDirectly(zkPath, jobName, result); } }</code><technical_language>If cache == null, means cachePath equals zkPath. logic line 121 true. logic before</technical_language>

Target:
private void dumpDirectly(final String path, final String jobName, final List<String> result) { for (String each : regCenter.getChildrenKeys(path)) { String zkPath = path + "/" + each; String zkValue = Optional.ofNullable(regCenter.get(zkPath)).orElse(""); String cachePath = zkPath; String cacheValue = zkValue; CuratorCache cache = (CuratorCache) regCenter.getRawCache("/" + jobName); if (null != cache) { Optional<ChildData> cacheData = cache.get(zkPath); cachePath = cacheData.map(ChildData::getPath).orElse(""); cacheValue = cacheData.map(ChildData::getData).map(String::new).orElse(""); } if (zkValue.equals(cacheValue) && zkPath.equals(cachePath)) { result.add(String.join(" | ", zkPath, zkValue)); } else { result.add(String.join(" | ", zkPath, zkValue, cachePath, cacheValue)); } dumpDirectly(zkPath, jobName, result); } }
Source:
<code>private static DetailAST getNodeFromFile(int type) throws Exception { <START> return getNode(parseFile(getPath("checkutils/InputCheckUtilsTest.java")), type); <END> }</code><technical_language>checkutils/ part of getPath. test folder</technical_language>

Target:
private static DetailAST getNodeFromFile(int type) throws Exception { return getNode(parseFile(getPath("InputCheckUtilsTest.java")), type); }
Source:
<code>public void setCommandExecuted() { Transaction transaction = TransactionSupport.suspend(); try { CommandEntity cmdEntity = CommandCoordinatorUtil.getCommandEntity(getCommandId()); if (cmdEntity != null) { CommandEntity executedCmdEntity = buildCommandEntity(cmdEntity.getRootCommandId(), cmdEntity.isCallbackEnabled()); <START> executedCmdEntity.setWaitingForEvent(callbackTriggeredByEvent()); <END> CommandCoordinatorUtil.persistCommand(executedCmdEntity, getContext()); CommandCoordinatorUtil.updateCommandExecuted(getCommandId()); } } finally { if (transaction != null) { TransactionSupport.resume(transaction); } } }</code><technical_language>more correct executedCmdEntity.setWaitingForEvent(cmdEntity.isCallbackEnabed() ? getCallback().callback.isTriggeredByEvent() : false</technical_language>

Target:
public void setCommandExecuted() { Transaction transaction = TransactionSupport.suspend(); try { CommandEntity cmdEntity = CommandCoordinatorUtil.getCommandEntity(getCommandId()); if (cmdEntity != null) { CommandEntity executedCmdEntity = buildCommandEntity(cmdEntity.getRootCommandId(), cmdEntity.isCallbackEnabled()); executedCmdEntity .setWaitingForEvent(cmdEntity.isCallbackEnabled() ? callbackTriggeredByEvent() : false); CommandCoordinatorUtil.persistCommand(executedCmdEntity, getContext()); CommandCoordinatorUtil.updateCommandExecuted(getCommandId()); } } finally { if (transaction != null) { TransactionSupport.resume(transaction); } } }
Source:
<code>public void controller(FragmentConfiguration config, @FragmentParam("patient") PatientDomainWrapper pdw, @SpringBean("adtService") AdtService adtService, UiSessionContext sessionContext, UiUtils uiUtils, FragmentModel model) { model.addAttribute("activeVisitStartDatetime", null); Patient patient = pdw.getPatient(); VisitDomainWrapper activeVisit = (VisitDomainWrapper) config.getAttribute("activeVisit"); if (activeVisit == null) { try { Location visitLocation = adtService.getLocationThatSupportsVisits(sessionContext.getSessionLocation()); activeVisit = adtService.getActiveVisit(patient, visitLocation); } catch (IllegalArgumentException ex) { } } if (activeVisit != null) { model.addAttribute("activeVisit", activeVisit); <START> model.addAttribute("activeVisitStartDatetime", <END> DateFormatUtils.format(activeVisit.getStartDatetime(), "dd MMM yyyy hh:mm a", Context.getLocale())); } }</code><technical_language>intentionally switch uiUtils.format DateFormatUtils.format</technical_language>

Target:
public void controller(FragmentConfiguration config, @FragmentParam("patient") PatientDomainWrapper pdw, @SpringBean("adtService") AdtService adtService, UiSessionContext sessionContext, UiUtils uiUtils, FragmentModel model) { model.addAttribute("activeVisitStartDatetime", null); Patient patient = pdw.getPatient(); VisitDomainWrapper activeVisit = (VisitDomainWrapper) config.getAttribute("activeVisit"); if (activeVisit == null) { try { Location visitLocation = adtService.getLocationThatSupportsVisits(sessionContext.getSessionLocation()); activeVisit = adtService.getActiveVisit(patient, visitLocation); } catch (IllegalArgumentException ex) { } } if (activeVisit != null) { model.addAttribute("activeVisit", activeVisit); model.addAttribute("activeVisitStartDatetime", uiUtils.format(activeVisit.getStartDatetime())); } }
Source:
<code><START> public static LongObjectOpenHashMap<BigFraction> readLongBigFractionOpenHashMap(ObjectInputStream stream) throws ClassNotFoundException, IOException { <END> boolean[] allocated = (boolean[]) stream.readObject(); long[] keys = (long[]) stream.readObject(); BigFraction[] values = (BigFraction[]) stream.readObject(); LongObjectOpenHashMap<BigFraction> result = new LongObjectOpenHashMap<BigFraction>(); for (int i=0; i<allocated.length; i++) { if (allocated[i]) { result.put(keys[i], values[i]); } } return result; }</code><technical_language>Fix bug</technical_language>

Target:
public static LongObjectOpenHashMap<BigFraction> readLongBigFractionOpenHashMap(ObjectInputStream stream) throws ClassNotFoundException, IOException { boolean[] allocated = (boolean[]) stream.readObject(); long[] keys = (long[]) stream.readObject(); Object[] values = (Object[]) stream.readObject(); LongObjectOpenHashMap<BigFraction> result = new LongObjectOpenHashMap<BigFraction>(); for (int i=0; i<allocated.length; i++) { if (allocated[i]) { result.put(keys[i], (BigFraction)values[i]); } } return result; }
Source:
<code>public void testWriteRecord() throws IOException, CopycatException { Properties props = createProps(); HdfsSinkConnectorConfig connectorConfig = new HdfsSinkConnectorConfig(props); HdfsWriter hdfsWriter = new HdfsWriter(connectorConfig); String topicsDir = connectorConfig.getString(HdfsSinkConnectorConfig.TOPIC_DIR_CONFIG); String topic = "topic"; int partition = 0; String key = "key"; GenericRecord record = createRecord(); TopicPartition topicPart = new TopicPartition(topic, partition); for (long offset = 0; offset < 7; offset++) { <START> SinkRecord sinkRecord = new SinkRecord(topic, partition, key, record, offset); <END> hdfsWriter.writeRecord(topicPart, sinkRecord); } hdfsWriter.close(); long[] validOffsets = {-1, 2, 5, 6}; for (int i = 1; i < validOffsets.length; i++) { Path path = new Path(FileUtils.fileName(url, topicsDir, topicPart, validOffsets[i])); Collection<Object> records = readAvroFile(path); long size = validOffsets[i] - validOffsets[i - 1]; assertEquals(records.size(), size); for (Object avroRecord: records) { assertEquals(avroRecord, AvroData.convertToAvro(record)); } } long[] inValidOffsets = {0, 1, 3, 4}; for (long offset: inValidOffsets) { Path path = new Path(FileUtils.fileName(url, topicsDir, topicPart, offset)); assertFalse(fs.exists(path)); } }</code><technical_language>I thinking a good idea vary key slightly in a verifiable way, e.g. key numeric of numeric fields in record match offset. This allow verification expected contents written properly. I realized writing value, key info lost. thoughts handle this? include key part of record well, losing some info including both. create some combined schema include in records. camus do handle keys</technical_language>

Target:
public void testWriteRecord() throws IOException, CopycatException { Properties props = createProps(); HdfsSinkConnectorConfig connectorConfig = new HdfsSinkConnectorConfig(props); HdfsWriter hdfsWriter = new HdfsWriter(connectorConfig); String topicsDir = connectorConfig.getString(HdfsSinkConnectorConfig.TOPIC_DIR_CONFIG); String topic = "topic"; int partition = 0; String key = "key"; GenericRecord record = createRecord(); TopicPartition topicPart = new TopicPartition(topic, partition); for (long offset = 0; offset < 7; offset++) { SinkRecord sinkRecord = new SinkRecord(topic, partition, key, record, offset); hdfsWriter.writeRecord(topicPart, sinkRecord); } hdfsWriter.close(); long[] validOffsets = {-1, 2, 5, 6}; for (int i = 1; i < validOffsets.length; i++) { Path path = new Path(FileUtils.committedFileName(url, topicsDir, topicPart, validOffsets[i])); Collection<Object> records = readAvroFile(path); long size = validOffsets[i] - validOffsets[i - 1]; assertEquals(records.size(), size); for (Object avroRecord: records) { assertEquals(avroRecord, AvroData.convertToAvro(record)); } } long[] inValidOffsets = {0, 1, 3, 4}; for (long offset: inValidOffsets) { Path path = new Path(FileUtils.committedFileName(url, topicsDir, topicPart, offset)); assertFalse(fs.exists(path)); } }
Source:
<code>protected CompactJavaSerializer(ClassLoader loader, Map<Integer, ObjectStreamClass> mappings) { this(loader); <START> System.out.println(mappings); <END> for (Entry<Integer, ObjectStreamClass> e : mappings.entrySet()) { Integer encoding = e.getKey(); ObjectStreamClass disconnectedOsc = disconnect(e.getValue()); readLookup.put(encoding, disconnectedOsc); if (writeLookup.putIfAbsent(new SerializableDataKey(disconnectedOsc, true), encoding) != null) { throw new AssertionError("Corrupted data " + mappings.toString()); } } }</code><technical_language>sysout??</technical_language>

Target:
protected CompactJavaSerializer(ClassLoader loader, Map<Integer, ObjectStreamClass> mappings) { this(loader); for (Entry<Integer, ObjectStreamClass> e : mappings.entrySet()) { Integer encoding = e.getKey(); ObjectStreamClass disconnectedOsc = disconnect(e.getValue()); readLookup.put(encoding, disconnectedOsc); if (writeLookup.putIfAbsent(new SerializableDataKey(disconnectedOsc, true), encoding) != null) { throw new AssertionError("Corrupted data " + mappings.toString()); } } }
Source:
<code>public IDefinition getDefinition(String fieldName) { <START> if( fieldName.equals(AbstractEventHeaderDecl.ID)){ <END> return new IntegerDefinition(IntegerDeclaration.INT_32B_DECL, null, AbstractEventHeaderDecl.ID, getId()); } else if(fieldName.equals(AbstractEventHeaderDecl.TIMESTAMP)){ return new IntegerDefinition(IntegerDeclaration.INT_64B_DECL, null, AbstractEventHeaderDecl.TIMESTAMP, getTimestamp()); } return null; }</code><technical_language>ctrl+shift+f</technical_language>

Target:
public Definition getDefinition(String fieldName) { if (fieldName.equals(AbstractEventHeaderDecl.ID)) { return new IntegerDefinition(IntegerDeclaration.INT_32B_DECL, null, AbstractEventHeaderDecl.ID, getId()); } else if (fieldName.equals(AbstractEventHeaderDecl.TIMESTAMP)) { return new IntegerDefinition(IntegerDeclaration.INT_64B_DECL, null, AbstractEventHeaderDecl.TIMESTAMP, getTimestamp()); } return null; }
Source:
<code>public MenuItem newExportsItem(final Command exportPNGCommand, final Command exportJPGCommand, final Command exportPDFCommand, final Command exportBPMNCommand) { final DropDownMenu menu = new DropDownMenu() {{ setPull(Pull.RIGHT); }}; menu.add(new AnchorListItem("Export to PNG") {{ setIcon(IconType.FILE_IMAGE_O); setIconPosition(IconPosition.LEFT); setTitle("Export to PNG"); addClickHandler(event -> exportPNGCommand.execute()); }}); menu.add(new AnchorListItem("Export to JPG") {{ setIcon(IconType.FILE_IMAGE_O); setIconPosition(IconPosition.LEFT); setTitle("Export to JPG"); addClickHandler(event -> exportJPGCommand.execute()); }}); menu.add(new AnchorListItem("Export to PDF") {{ setIcon(IconType.FILE_PDF_O); setIconPosition(IconPosition.LEFT); setTitle("Export to PDF"); addClickHandler(event -> exportPDFCommand.execute()); }}); <START> menu.add(new AnchorListItem("Export to BPMN") {{ <END> setIcon(IconType.FILE_TEXT_O); setIconPosition(IconPosition.LEFT); setTitle("Export to BPMN"); addClickHandler(event -> exportBPMNCommand.execute()); }}); final IsWidget group = new ButtonGroup() {{ add(new Button() {{ setToggleCaret(true); setDataToggle(Toggle.DROPDOWN); setIcon(IconType.IMAGE); setSize(ButtonSize.SMALL); setTitle("Export diagram"); }}); add(menu); }}; return buildItem(group); }</code><technical_language>constant needed here? java org.kie.workbench.common.stunner.core.client.toolbox.ExportBPMN</technical_language>

Target:
public MenuItem newExportsItem(final Command exportPNGCommand, final Command exportJPGCommand, final Command exportPDFCommand, final Command exportBPMNCommand) { final DropDownMenu menu = new DropDownMenu() {{ setPull(Pull.RIGHT); }}; menu.add(new AnchorListItem("Download as PNG") {{ setIcon(IconType.FILE_IMAGE_O); setIconPosition(IconPosition.LEFT); setTitle("Download as PNG"); addClickHandler(event -> exportPNGCommand.execute()); }}); menu.add(new AnchorListItem("Download as JPG") {{ setIcon(IconType.FILE_IMAGE_O); setIconPosition(IconPosition.LEFT); setTitle("Download as JPG"); addClickHandler(event -> exportJPGCommand.execute()); }}); menu.add(new AnchorListItem("Download as PDF") {{ setIcon(IconType.FILE_PDF_O); setIconPosition(IconPosition.LEFT); setTitle("Download as PDF"); addClickHandler(event -> exportPDFCommand.execute()); }}); menu.add(new AnchorListItem("Download as BPMN") {{ setIcon(IconType.FILE_TEXT_O); setIconPosition(IconPosition.LEFT); setTitle("Download as BPMN"); addClickHandler(event -> exportBPMNCommand.execute()); }}); final IsWidget group = new ButtonGroup() {{ add(new Button() {{ setToggleCaret(true); setDataToggle(Toggle.DROPDOWN); setIcon(IconType.IMAGE); setSize(ButtonSize.SMALL); setTitle("Download diagram"); }}); add(menu); }}; return buildItem(group); }
Source:
<code>public static Set<DistributionModuleGroup> getModuleGroups(String distribution, String version) { HDFSLinkedNodeCondition hdfsLinkedNodeCondition = new HDFSLinkedNodeCondition(distribution, version); DistributionModuleGroup dmgWebHDFS = new DistributionModuleGroup(CDH5100Constant.WEBHDFS_MODULE_GROUP.getModuleName(), true, hdfsLinkedNodeCondition.getWebHDFSCondition()); <START> DistributionModuleGroup dmgADLS = <END> new DistributionModuleGroup(CDH5100Constant.SPARK_AZURE_MRREQUIRED_MODULE_GROUP.getModuleName(), true, hdfsLinkedNodeCondition.getAdlsCondition()); Set<DistributionModuleGroup> hs = new HashSet<>(); hs.add(dmgWebHDFS); hs.add(dmgADLS); return hs; }</code><technical_language>ADLS is supported cdh5.12</technical_language>

Target:
public static Set<DistributionModuleGroup> getModuleGroups(String distribution, String version) { HDFSLinkedNodeCondition hdfsLinkedNodeCondition = new HDFSLinkedNodeCondition(distribution, version); DistributionModuleGroup dmgWebHDFS = new DistributionModuleGroup(CDH5100Constant.WEBHDFS_MODULE_GROUP.getModuleName(), true, hdfsLinkedNodeCondition.getWebHDFSCondition()); Set<DistributionModuleGroup> hs = new HashSet<>(); hs.add(dmgWebHDFS); return hs; }
Source:
<code>private ContentTypeConvertingInterceptor(String contentType, boolean input) { this.contentType = contentType; this.mimeType = MessageConverterUtils.getMimeType(contentType); this.input = input; if (MessageConverterUtils.X_JAVA_OBJECT.includes(this.mimeType)) { this.klazz = MessageConverterUtils .getJavaTypeForJavaObjectContentType(this.mimeType); } else if (this.mimeType.equals(MessageConverterUtils.X_SPRING_TUPLE)) { this.klazz = Tuple.class; } else if (this.mimeType.getType().equals("text") || this.mimeType.getSubtype().equals( "json") || this.mimeType.getSubtype().equals("xml")) { this.klazz = String.class; } else { this.klazz = byte[].class; } <START> if (input) { <END> this.messageConverter = new MessageWrappingMessageConverter( MessageConverterConfigurer.this.compositeMessageConverterFactory .getMessageConverterForType(this.mimeType), this.mimeType); } else { this.messageConverter = new MessageWrappingMessageConverter( MessageConverterConfigurer.this.compositeMessageConverterFactory .getMessageConverterForType(this.mimeType), this.mimeType); } }</code><technical_language>if else branches identical</technical_language>

Target:
private ContentTypeConvertingInterceptor(String contentType, boolean input) { this.contentType = contentType; this.mimeType = MessageConverterUtils.getMimeType(contentType); this.input = input; if (MessageConverterUtils.X_JAVA_OBJECT.includes(this.mimeType)) { this.klazz = MessageConverterUtils .getJavaTypeForJavaObjectContentType(this.mimeType); } else if (this.mimeType.equals(MessageConverterUtils.X_SPRING_TUPLE)) { this.klazz = Tuple.class; } else if (this.mimeType.getType().equals("text") || this.mimeType.getSubtype().equals( "json") || this.mimeType.getSubtype().equals("xml")) { this.klazz = String.class; } else { this.klazz = byte[].class; } this.messageConverter = new MessageWrappingMessageConverter( MessageConverterConfigurer.this.compositeMessageConverterFactory .getMessageConverterForType(this.mimeType), this.mimeType); }
Source:
<code>public void testSendPingAgent() throws IOException, InterruptedException { TestApplication app = new TestApplication(); ManagedApplication ma = new ManagedApplication( app, this.folder.newFolder() ); this.manager.getAppNameToManagedApplication().put( app.getName(), ma ); for (Instance i : app.getRootInstances()) { this.manager.pingAgent( app.getName(), i.getName(), "TEST " + i.getName(), 0L ); } List<Message> sentMessages = this.msgClient.sentMessages; Assert.assertTrue( sentMessages.size() == app.getRootInstances().size() ); int index = 0; for (Instance i : app.getRootInstances()) { Message message = sentMessages.get( index++ ); Assert.assertTrue( message instanceof MsgEcho ); MsgEcho echo = (MsgEcho) message; <START> Assert.assertTrue( echo.getContent().equals( "PING:TEST " + i.getName()) ); <END> } }</code><technical_language>Assert.assertEquals instead</technical_language>

Target:
public void testSendPingAgent() throws IOException, InterruptedException { TestApplication app = new TestApplication(); ManagedApplication ma = new ManagedApplication( app, this.folder.newFolder() ); this.manager.getAppNameToManagedApplication().put( app.getName(), ma ); for (Instance i : app.getRootInstances()) { this.manager.pingAgent( app.getName(), i.getName(), "TEST " + i.getName(), 0L ); } List<Message> sentMessages = this.msgClient.sentMessages; Assert.assertTrue( sentMessages.size() == app.getRootInstances().size() ); int index = 0; for (Instance i : app.getRootInstances()) { Message message = sentMessages.get( index++ ); Assert.assertTrue( message instanceof MsgEcho ); MsgEcho echo = (MsgEcho) message; Assert.assertEquals( "PING:TEST " + i.getName(), echo.getContent() ); } }
Source:
<code>private ServiceMessage toResponse(Object response, Map<String, String> headers) { if (response instanceof ServiceMessage) { return (ServiceMessage) response; } return ServiceMessage.builder() .qualifier(methodInfo.qualifier()) <START> .headers(headers) <END> .data(response) .build(); }</code><technical_language>Cool, set headers before</technical_language>

Target:
private ServiceMessage toResponse(Object response, Map<String, String> headers) { if (response instanceof ServiceMessage) { ServiceMessage response1 = (ServiceMessage) response; return ServiceMessage.from(response1).qualifier(methodInfo.qualifier()).build(); } return ServiceMessage.builder() .qualifier(methodInfo.qualifier()) .headers(headers) .data(response) .build(); }
Source:
<code>protected void doStop() throws Exception { if (aggregateController != null) { aggregateController.onStop(this); } if (recoverService != null) { camelContext.getExecutorServiceManager().shutdown(recoverService); } <START> if (timeoutCheckerExecutorService != null) { <END> camelContext.getExecutorServiceManager().shutdown(timeoutCheckerExecutorService); timeoutCheckerExecutorService = null; } ServiceHelper.stopServices(timeoutMap, processor, deadLetterProducerTemplate); if (closedCorrelationKeys != null) { ServiceHelper.stopService(closedCorrelationKeys); closedCorrelationKeys.clear(); } batchConsumerCorrelationKeys.clear(); redeliveryState.clear(); }</code><technical_language>@gsudharsan , sure, related CAMEL-4037. I reason tests fails, shutdown of executor timeoutCheckerExecutorService is controlled shutdownTimeoutCheckerExecutorService boolean flag null of instance itself. @davsclaus , @oscerd do this</technical_language>

Target:
protected void doStop() throws Exception { if (aggregateController != null) { aggregateController.onStop(this); } if (recoverService != null) { camelContext.getExecutorServiceManager().shutdown(recoverService); } if (shutdownTimeoutCheckerExecutorService && timeoutCheckerExecutorService != null) { camelContext.getExecutorServiceManager().shutdown(timeoutCheckerExecutorService); timeoutCheckerExecutorService = null; shutdownTimeoutCheckerExecutorService = false; } ServiceHelper.stopServices(timeoutMap, processor, deadLetterProducerTemplate); if (closedCorrelationKeys != null) { ServiceHelper.stopService(closedCorrelationKeys); closedCorrelationKeys.clear(); } batchConsumerCorrelationKeys.clear(); redeliveryState.clear(); }