auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void writeCleanup() { JClassType editorType = model.getEditorType(); Set<String> fieldSet = new HashSet<>(); logger.log(Type.DEBUG, "Starting to write cleanup impl. for editor " + editorType.getQualifiedSourceName()); sw.println(); sw.println("@Override"); sw.println("public void cleanup() {"); sw.indent(); sw.println("getObject().cleanup();"); for (EditorData editorData : model.getEditorData()) { if (editorData.getPropertyOwnerType().isAssignableTo(hasCleanupType)) { fieldSet.add(String.format("getObject()%s", editorData.getBeanOwnerExpression())); } else { logger.log(Type.WARN, "Skipping non-model field for path " + editorData.getPath()); } } for (JField field : editorType.getFields()) { if (field.getType().isClassOrInterface() != null && field.getType().isClassOrInterface().isAssignableTo(hasCleanupType) && !field.getType().isClassOrInterface().isAssignableTo(baseModelType)) { fieldSet.add(String.format("getEditor().%s", field.getName())); <START> if (!field.isPublic()) { <END> logger.log(Type.ERROR, "Field " + field.getName() + " is not public, but needs to be cleaned up"); } } } for (String name: fieldSet) { sw.println("%s.cleanup();", name); } sw.outdent(); sw.println("}"); }</code><technical_language>I a lot of message compiling, I capture if true not</technical_language>

Target:
private void writeCleanup() { JClassType editorType = model.getEditorType(); Set<String> hasCleanupSet = new HashSet<>(); logger.log(Type.DEBUG, "Starting to write cleanup impl. for editor " + editorType.getQualifiedSourceName()); sw.println(); sw.println("@Override"); if (model.getProxyType().isAssignableTo(hasCleanupType)) { sw.println("public void cleanup() {"); } sw.indent(); sw.println("getObject().cleanup();"); for (EditorData editorData : model.getEditorData()) { if (editorData.getPropertyOwnerType().isAssignableTo(hasCleanupType)) { hasCleanupSet.add(String.format("getObject()%s", editorData.getBeanOwnerExpression())); } else { logger.log(Type.WARN, "Skipping non-model field for path " + editorData.getPath()); } } for (JField field : editorType.getFields()) { JClassType fieldType = field.getType().isClassOrInterface(); if (fieldType != null && fieldType.isAssignableTo(hasCleanupType) && !field.getType().isClassOrInterface().isAssignableTo(baseModelType)) { hasCleanupSet.add(String.format("getEditor().%s", field.getName())); if (!field.isPublic()) { logger.log(Type.ERROR, "Field " + field.getName() + " is not public, but needs to be cleaned up"); } } } for (String name: hasCleanupSet) { sw.println("%s.cleanup();", name); } sw.outdent(); sw.println("}"); }
Source:
<code>public String toString() { <START> if (this.jsonAsString == null && this.node != null) { <END> return getJsonAsString(); } return this.jsonAsString; }</code><technical_language>jsonAsString null, create a PhoenixJson object a string</technical_language>

Target:
public String toString() { return this.jsonAsString; }
Source:
<code>NatsTask(NatsPollingConsumer natsPollingConsumer, long interval) { <START> printDebugLog("Initializing."); <END> this.natsPollingConsumer = natsPollingConsumer; this.interval = interval; }</code><technical_language>Initialising what? mention name of inbound endpoint user NATS EP is initialising multiple</technical_language>

Target:
NatsTask(NatsPollingConsumer natsPollingConsumer, long interval) { printDebugLog("Initializing NATS Task."); this.natsPollingConsumer = natsPollingConsumer; this.interval = interval; }
Source:
<code>public void patchAnnotation(String annotationId, Annotation annotation) throws MendeleyException { try { String json = JsonParser.jsonFromAnnotation(annotation); Procedure proc = new PatchAnnotationProcedure(annotationId, json, authenticationManager); proc.checkedRun(); <START> } catch (JSONException e) { <END> throw new JsonParsingException(e.getMessage()); } }</code><technical_language>In this case I losing original of exception is more clear. Imagine client receives this exception. I distinguish if I show a "No connection" a "Something wrong" toast? is string matching, hoping error messages platforms. Please, pass original Exception cause, optional message if want. clients DO need of issue</technical_language>

Target:
public void patchAnnotation(String annotationId, Annotation annotation) throws MendeleyException { try { String json = JsonParser.jsonFromAnnotation(annotation); Procedure proc = new PatchAnnotationProcedure(annotationId, json, authenticationManager); proc.checkedRun(); } catch (JSONException e) { throw new JsonParsingException("Error parsing annotation", e); } }
Source:
<code>public PrivateKey decode(byte[] der, String password, Map<String, String> headers) throws IOException { ASN1Sequence seq = ASN1Sequence.getInstance(der); Enumeration asn1 = seq.getObjects(); BigInteger v = ((ASN1Integer) asn1.nextElement()).getValue(); if (v.intValue() != 0 && v.intValue() != 1) { throw new IllegalArgumentException("wrong version for RSA private key"); } <START> BigInteger version = v; <END> BigInteger modulus = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger publicExponent = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger privateExponent = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeP = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeQ = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeExponentP = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeExponentQ = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger coefficient = ((ASN1Integer) asn1.nextElement()).getValue(); if (asn1.hasMoreElements()) { ASN1Sequence otherPrimeInfos = (ASN1Sequence) asn1.nextElement(); } RSAPrivateCrtKeySpec spec = new RSAPrivateCrtKeySpec(modulus, publicExponent, privateExponent, primeP, primeQ, primeExponentP, primeExponentQ, coefficient); try { KeyFactory kf = KeyFactory.getInstance("RSA"); return kf.generatePrivate(spec); } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { throw new IOException("Could not read key", e); } }</code><technical_language>Nitpick: unused var version</technical_language>

Target:
public PrivateKey decode(byte[] der, String password, Map<String, String> headers) throws IOException { ASN1Sequence seq = ASN1Sequence.getInstance(der); Enumeration asn1 = seq.getObjects(); BigInteger version = ((ASN1Integer) asn1.nextElement()).getValue(); if (version.intValue() != 0 && version.intValue() != 1) { throw new IllegalArgumentException("wrong version for RSA private key"); } BigInteger modulus = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger publicExponent = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger privateExponent = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeP = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeQ = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeExponentP = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeExponentQ = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger coefficient = ((ASN1Integer) asn1.nextElement()).getValue(); if (asn1.hasMoreElements()) { throw new IOException("RSA multi-prime keys are not supported"); } RSAPrivateCrtKeySpec spec = new RSAPrivateCrtKeySpec(modulus, publicExponent, privateExponent, primeP, primeQ, primeExponentP, primeExponentQ, coefficient); try { KeyFactory kf = KeyFactory.getInstance("RSA"); return kf.generatePrivate(spec); } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { throw new IOException("Could not read key", e); } }
Source:
<code>public void testGetTransactionInfo() { Trace trace1 = new Trace(); trace1.setId("1"); trace1.setBusinessTransaction("trace1"); trace1.setStartTime(System.currentTimeMillis() - 4000); Component c1 = new Component(); c1.getProperties().add(new Property("prop1", "value1")); trace1.getNodes().add(c1); Trace trace2 = new Trace(); trace2.setId("2"); trace2.setBusinessTransaction("trace2"); trace2.setStartTime(System.currentTimeMillis() - 2000); Component c2 = new Component(); c2.getProperties().add(new Property("prop2", "value2")); trace2.getNodes().add(c2); try { publisher.publish(null, Arrays.asList(trace1, trace2)); <START> } catch (Exception e1) { <END> fail("Failed to store: " + e1); } Wait.until(() -> service.searchFragments(null, new Criteria()).size() == 2); Wait.until(() -> analytics.getTraceCompletionTimes(null, new Criteria()).size() == 2); List<TransactionInfo> tis = analytics.getTransactionInfo(null, new Criteria()); assertNotNull(tis); assertEquals(2, tis.size()); assertTrue(tis.get(0).getName().equals("trace1")); assertTrue(tis.get(1).getName().equals("trace2")); }</code><technical_language>This a test error</technical_language>

Target:
public void testGetTransactionInfo() throws Exception { Trace trace1 = new Trace(); trace1.setId("1"); trace1.setBusinessTransaction("trace1"); trace1.setStartTime(System.currentTimeMillis() - 4000); Component c1 = new Component(); c1.getProperties().add(new Property("prop1", "value1")); trace1.getNodes().add(c1); Trace trace2 = new Trace(); trace2.setId("2"); trace2.setBusinessTransaction("trace2"); trace2.setStartTime(System.currentTimeMillis() - 2000); Component c2 = new Component(); c2.getProperties().add(new Property("prop2", "value2")); trace2.getNodes().add(c2); publisher.publish(null, Arrays.asList(trace1, trace2)); Wait.until(() -> service.searchFragments(null, new Criteria()).size() == 2); Wait.until(() -> analytics.getTraceCompletionTimes(null, new Criteria()).size() == 2); List<TransactionInfo> tis = analytics.getTransactionInfo(null, new Criteria()); assertNotNull(tis); assertEquals(2, tis.size()); assertEquals("trace1", tis.get(0).getName()); assertEquals("trace2", tis.get(1).getName()); }
Source:
<code>public ConnectionPoolConfiguration getValue() throws IllegalStateException, IllegalArgumentException { return new ConfigurationBuilder().connectionPool() .exhaustedAction(this.exhaustedAction) <START> .lifo(ConnectionPoolStrategy.LIFO.equals(this.connectionPoolStrategy)) <END> .maxActive(this.maxActive) .maxIdle(this.maxIdle) .maxTotal(this.maxTotal) .maxWait(this.maxWait) .minEvictableIdleTime(this.minEvictableIdleTime) .minIdle(this.minIdle) .numTestsPerEvictionRun(this.numTestsPerEvictionRun) .testOnBorrow(this.testOnBorrow) .testOnReturn(this.testOnReturn) .testWhileIdle(this.testWhileIdle) .timeBetweenEvictionRuns(this.timeBetweenEvictionRuns) .create(); }</code><technical_language>== for enums</technical_language>

Target:
public ConnectionPoolConfiguration getValue() throws IllegalStateException, IllegalArgumentException { return new ConfigurationBuilder().connectionPool() .exhaustedAction(this.exhaustedAction) .maxActive(this.maxActive) .maxWait(this.maxWait) .minEvictableIdleTime(this.minEvictableIdleTime) .minIdle(this.minIdle) .create(); }
Source:
<code>public void testDecodeMultipleLiteralResponse() throws Exception { <START> final String literalResponse = "* 1 FETCH {15}\r\n" + "abc\r\n" + "defghijklm {5}\r\n" + "hij\r\n" + "\r\n"; <END> final byte[] responseBytes = literalResponse.getBytes(StandardCharsets.US_ASCII); final ByteBuf buffer = Unpooled.copiedBuffer(responseBytes, 0, responseBytes.length); final ImapClientRespReader respReader = new ImapClientRespReader(Integer.MAX_VALUE); final ByteBuf resultBuf = (ByteBuf) respReader.decode(null, buffer); final String result = resultBuf.toString(StandardCharsets.US_ASCII); Assert.assertEquals(result, literalResponse); }</code><technical_language>"* 1 FETCH BODY {15}\r\n" + "abc\r\n" + "defghijklm BODY[HEADER] {5}\r\n" + "h:j\r\n" + "\r\n"</technical_language>

Target:
public void testDecodeMultipleLiteralResponse() throws Exception { final String literalResponse = "* 1 FETCH BODY {15}\r\n" + "abc\r\n" + "defghijklm BODY[HEADER] {5}\r\n" + "h:j\r\n" + "\r\n"; final byte[] responseBytes = literalResponse.getBytes(StandardCharsets.US_ASCII); final ByteBuf buffer = Unpooled.copiedBuffer(responseBytes, 0, responseBytes.length); final ImapClientRespReader respReader = new ImapClientRespReader(Integer.MAX_VALUE); final ByteBuf resultBuf = (ByteBuf) respReader.decode(null, buffer); final String result = resultBuf.toString(StandardCharsets.US_ASCII); Assert.assertEquals(result, literalResponse); }
Source:
<code>private static void checkTuples(SubscriptionContext ctx, StringFormat format, Tuple tuple) { if (format.hasNamedFields()) { ctx.addIssue(tuple, "Replace this formatting argument with a mapping."); return; } <START> if (format.numExpectedArguments() != tuple.elements().size()) { <END> reportInvalidArgumentSize(ctx, tuple, format.numExpectedArguments(), tuple.elements().size()); return; } for (int i = 0; i < tuple.elements().size(); ++i) { format.replacementFields().get(i).validateArgument(tuple.elements().get(i)); } }</code><technical_language>I FPs if account for potential tuple unpacking. I expect common, works raise issue current implementation (PyCharm displays a warning way): args = ("are you", "a good day") print("hello %s, %s, this is %s" % ("friend", *args))</technical_language>

Target:
private static void checkTuples(SubscriptionContext ctx, StringFormat format, Tuple tuple) { if (tuple.elements().stream().anyMatch(expression -> expression.is(Tree.Kind.UNPACKING_EXPR))) { return; } if (format.numExpectedArguments() != tuple.elements().size()) { reportInvalidArgumentSize(ctx, tuple, format.numExpectedArguments(), tuple.elements().size()); return; } for (int i = 0; i < tuple.elements().size(); ++i) { format.replacementFields().get(i).validateArgument(tuple.elements().get(i)); } }
Source:
<code>public static Branch getBranch(Long branchId, ArtifactId view) throws OseeCoreException { if (branchId == null) { throw new BranchDoesNotExist("Branch Uuid is null"); } Branch branch = null; if (view.notEqual(ArtifactId.SENTINEL)) { List<Branch> views = getCache().getViews(); for (Branch branchView : views) { if (branchView.getId().equals(branchId) && branchView.getView().equals(view)) { <START> branch = branchView; <END> } } } else { branch = getCache().getById(branchId); if (branch == null) { branch = loadBranchToCache(branchId); } } return branch; }</code><technical_language>break out of for loop here</technical_language>

Target:
public static Branch getBranch(Long branchId, ArtifactId view) throws OseeCoreException { if (branchId == null) { throw new BranchDoesNotExist("Branch Uuid is null"); } Branch branch = null; if (view.notEqual(ArtifactId.SENTINEL)) { List<Branch> views = getCache().getViews(); for (Branch branchView : views) { if (branchView.getId().equals(branchId) && branchView.getView().equals(view)) { branch = branchView; break; } } } else { branch = getCache().getById(branchId); if (branch == null) { branch = loadBranchToCache(branchId); } } return branch; }
Source:
<code><START> private ReferenceContext getDerivedReferenceContextFromSlices(final List<Slice> containerSlices) { <END> final Set<ReferenceContext> sliceRefContexts = containerSlices.stream() .map(s -> s.getAlignmentContext().getReferenceContext()) .collect(Collectors.toSet()); if (sliceRefContexts.isEmpty()) { throw new CRAMException("Cannot construct a container without any slices"); } else if (sliceRefContexts.size() > 1) { return ReferenceContext.MULTIPLE_REFERENCE_CONTEXT; } return sliceRefContexts.iterator().next(); }</code><technical_language>suggestion private static ReferenceContext getDerivedReferenceContextFromSlices(final List<Slice> containerSlices) {</technical_language>

Target:
private static ReferenceContext getDerivedReferenceContextFromSlices(final List<Slice> containerSlices) { final Set<ReferenceContext> sliceRefContexts = containerSlices.stream() .map(s -> s.getAlignmentContext().getReferenceContext()) .collect(Collectors.toSet()); if (sliceRefContexts.isEmpty()) { throw new CRAMException("Cannot construct a container without any slices"); } else if (sliceRefContexts.size() > 1) { return ReferenceContext.MULTIPLE_REFERENCE_CONTEXT; } return sliceRefContexts.iterator().next(); }
Source:
<code><START> public String getAuthorEmail() { <END> try { return getPullRequest(false).getUser().getEmail(); } catch (IOException e) { logger.log(Level.SEVERE, "Unable to fetch author info for " + id); } return ""; }</code><technical_language>I this call blocking a bit then. worth caching result</technical_language>

Target:
public String getAuthorEmail() { if (StringUtils.isEmpty(authorEmail)) { try { GHUser user = getPullRequestAuthor(); authorEmail = user.getEmail(); } catch (IOException e) { logger.log(Level.SEVERE, "Unable to fetch author info for " + id); } } authorEmail = StringUtils.isEmpty(authorEmail) ? "" : authorEmail; return authorEmail; }
Source:
<code>protected boolean updateSelection(IStructuredSelection selection) { addAll(selectedDifferences, getSelectedDifferences(selection)); <START> Iterable<Diff> terminalStateDiffs = filter(selectedDifferences, <END> EMFComparePredicates.hasState(DifferenceState.MERGED, DifferenceState.DISCARDED)); if (!Iterables.isEmpty(terminalStateDiffs)) { return false; } if (this.adapterFactory != null) { contextualizeTooltip(); } return selection.toList().size() == selectedDifferences.size(); }</code><technical_language>Please static imports code more readable. Also, I realize Iterables.any() code more concise readable: import static com.google.common.collect.Iterables.any; import static org.eclipse.emf.compare.DifferenceState.DISCARDED; import static org.eclipse.emf.compare.DifferenceState.MERGED; import static org.eclipse.emf.compare.utils.EMFComparePredicates.hasState; (...) // Disable action if selection contains diffs in terminal state if (any(selectedDifferences, hasState(MERGED, DISCARDED))) { return false; }</technical_language>

Target:
protected boolean updateSelection(IStructuredSelection selection) { addAll(selectedDifferences, getSelectedDifferences(selection)); if (any(selectedDifferences, hasState(MERGED, DISCARDED))) { return false; } if (this.adapterFactory != null) { contextualizeTooltip(); } return selection.toList().size() == selectedDifferences.size(); }
Source:
<code>public DataFrame next() { while (intervalsLo < intervalsHi && partitionLo < partitionHi) { final int currentInterval = intervalsHi - 1; final int currentPartition = partitionHi - 1; long rowCount = reader.openPartition(currentPartition); if (rowCount > 0) { final ReadOnlyColumn column = reader.getColumn(TableReader.getPrimaryColumnIndex(reader.getColumnBase(currentPartition), timestampIndex)); final long intervalLo = intervals.getQuick(currentInterval * 2); final long intervalHi = intervals.getQuick(currentInterval * 2 + 1); if (column.getLong(0) > intervalHi) { partitionHi = currentPartition; partitionLimit = -1; continue; } if (column.getLong((rowCount - 1) * 8) < intervalLo) { partitionLimit = -1; intervalsHi = currentInterval; continue; } <START> long lo = search(column, intervalLo, 0, partitionLimit == -1 ? rowCount : partitionLimit, true); <END> if (lo < 0) { lo = -lo - 1; } long hi = search(column, intervalHi, lo, rowCount, false); if (hi < 0) { hi = -hi - 1; } else { hi++; } if (lo < hi) { dataFrame.partitionIndex = currentPartition; dataFrame.rowLo = lo; dataFrame.rowHi = hi; if (lo == 0) { partitionLimit = -1; partitionHi = currentPartition; } else { partitionLimit = lo; intervalsHi = currentInterval; } return dataFrame; } partitionLimit = lo; intervalsHi = currentInterval; } else { partitionHi = currentPartition; } } return null; }</code><technical_language>pass increment constant, e.g.: java static final int SCAN_UP = -1; static final int SCAN_DOWN = 1; ... long lo = search(column, intervalLo, 0, partitionLimit == -1 ? rowCount : partitionLimit, SCAN_UP); this is more readable faster :)</technical_language>

Target:
public DataFrame next() { while (intervalsLo < intervalsHi && partitionLo < partitionHi) { final int currentInterval = intervalsHi - 1; final int currentPartition = partitionHi - 1; long rowCount = reader.openPartition(currentPartition); if (rowCount > 0) { final ReadOnlyColumn column = reader.getColumn(TableReader.getPrimaryColumnIndex(reader.getColumnBase(currentPartition), timestampIndex)); final long intervalLo = intervals.getQuick(currentInterval * 2); final long intervalHi = intervals.getQuick(currentInterval * 2 + 1); if (column.getLong(0) > intervalHi) { partitionHi = currentPartition; partitionLimit = -1; continue; } if (column.getLong((rowCount - 1) * 8) < intervalLo) { partitionLimit = -1; intervalsHi = currentInterval; continue; } long lo = search(column, intervalLo, 0, partitionLimit == -1 ? rowCount : partitionLimit, AbstractIntervalDataFrameCursor.SCAN_UP); if (lo < 0) { lo = -lo - 1; } long hi = search(column, intervalHi, lo, rowCount, AbstractIntervalDataFrameCursor.SCAN_DOWN); if (hi < 0) { hi = -hi - 1; } else { hi++; } if (lo < hi) { dataFrame.partitionIndex = currentPartition; dataFrame.rowLo = lo; dataFrame.rowHi = hi; if (lo == 0) { partitionLimit = -1; partitionHi = currentPartition; } else { partitionLimit = lo; intervalsHi = currentInterval; } return dataFrame; } partitionLimit = lo; intervalsHi = currentInterval; } else { partitionHi = currentPartition; } } return null; }
Source:
<code>protected void runOneIteration() throws Exception { try { final HostStatus hostStatus = solo.client().hostStatus(solo.agentName()).get(); final Map<JobId, TaskStatus> statuses = hostStatus.getStatuses(); for (final TaskStatus status : statuses.values()) { final String containerId = status.getContainerId(); if (isNullOrEmpty(containerId) || logFutures.containsKey(containerId)) { continue; } final ScheduledFuture<?> future = this.executor().scheduleAtFixedRate(new Runnable() { @Override public void run() { try { final LogStream logStream = dockerClient.logs(containerId, stdout(), stderr(), follow()); log.info("attaching stdout/stderr for job={}, container={}", status.getJob().getId(), containerId); logStream.attach(System.out, System.err); } catch (Exception e) { log.debug("error streaming logs for job={}, container={} - {}", status.getJob().getId(), containerId, e); } } <START> }, 0, 100, TimeUnit.MILLISECONDS); <END> logFutures.put(containerId, future); } } catch (Exception e) { } }</code><technical_language>attaching container need scheduled a fix rate? this attaching happen times for container (and log INFO message too)</technical_language>

Target:
protected void runOneIteration() throws Exception { try { for (final String host : heliosClient.listHosts().get()) { final HostStatus hostStatus = heliosClient.hostStatus(host).get(); final Map<JobId, TaskStatus> statuses = hostStatus.getStatuses(); for (final TaskStatus status : statuses.values()) { final JobId jobId = status.getJob().getId(); final String containerId = status.getContainerId(); if (isNullOrEmpty(containerId)) { continue; } if (!logFutures.containsKey(containerId)) { final Future<?> future = this.executor().submit(new Runnable() { @Override public void run() { try { final LogStream logStream = dockerClient.logs(containerId, stdout(), stderr(), follow()); log.info("attaching stdout/stderr for job={}, container={}", jobId, containerId); logStream.attach(logStreamProvider.getStdoutStream(jobId, containerId), logStreamProvider.getStderrStream(jobId, containerId)); } catch (final InterruptedException e) { } catch (final Exception e) { log.warn("error streaming log for job={}, container={} - {}", jobId, containerId, e); } } }); logFutures.put(containerId, future); } } } } catch (Exception e) { } }
Source:
<code>public List<Constituent> getConstituentsWithSpan(IntPair span) { List<Constituent> list = new ArrayList<>(); for(Constituent c : this.constituents) if (c.getSpan().equals(span)) list.add(c); <START> list.sort(TextAnnotationUtilities.constituentStartComparator); <END> return list; }</code><technical_language>Minor confusion: If spans same, sort effect right? missing here</technical_language>

Target:
public List<Constituent> getConstituentsWithSpan(IntPair span) { List<Constituent> list = new ArrayList<>(); for(Constituent c : this.constituents) if (c.getSpan().equals(span)) list.add(c); return list; }
Source:
<code>private List<Message> generateMessagesForParticipant(Criteria recipientCriteria, Message message, HelixDataAccessor targetDataAccessor) { List<Message> messages = new ArrayList<Message>(); List<Map<String, String>> matchedList = _evaluator.evaluateCriteria(recipientCriteria, targetDataAccessor); if (!matchedList.isEmpty()) { Map<String, String> sessionIdMap = new HashMap<String, String>(); if (recipientCriteria.isSessionSpecific()) { Builder keyBuilder = targetDataAccessor.keyBuilder(); List<LiveInstance> liveInstances = <START> targetDataAccessor.getChildValues(keyBuilder.liveInstances(), true); <END> for (LiveInstance liveInstance : liveInstances) { sessionIdMap.put(liveInstance.getInstanceName(), liveInstance.getEphemeralOwner()); } } for (Map<String, String> map : matchedList) { String id = UUID.randomUUID().toString(); Message newMessage = new Message(message.getRecord(), id); String srcInstanceName = _manager.getInstanceName(); String tgtInstanceName = map.get("instanceName"); if (recipientCriteria.isSelfExcluded() && srcInstanceName.equalsIgnoreCase(tgtInstanceName)) { continue; } newMessage.setSrcName(srcInstanceName); newMessage.setTgtName(tgtInstanceName); newMessage.setResourceName(map.get("resourceName")); newMessage.setPartitionName(map.get("partitionName")); if (recipientCriteria.isSessionSpecific()) { newMessage.setTgtSessionId(sessionIdMap.get(tgtInstanceName)); } messages.add(newMessage); } } return messages; }</code><technical_language>retrying for these? need some monitor failure ones</technical_language>

Target:
private List<Message> generateMessagesForParticipant(Criteria recipientCriteria, Message message, HelixDataAccessor targetDataAccessor) { List<Message> messages = new ArrayList<Message>(); List<Map<String, String>> matchedList = _evaluator.evaluateCriteria(recipientCriteria, targetDataAccessor); if (!matchedList.isEmpty()) { Map<String, String> sessionIdMap = new HashMap<String, String>(); if (recipientCriteria.isSessionSpecific()) { Builder keyBuilder = targetDataAccessor.keyBuilder(); List<LiveInstance> liveInstances = targetDataAccessor.getChildValues(keyBuilder.liveInstances(), false); for (LiveInstance liveInstance : liveInstances) { sessionIdMap.put(liveInstance.getInstanceName(), liveInstance.getEphemeralOwner()); } } for (Map<String, String> map : matchedList) { String id = UUID.randomUUID().toString(); Message newMessage = new Message(message.getRecord(), id); String srcInstanceName = _manager.getInstanceName(); String tgtInstanceName = map.get("instanceName"); if (recipientCriteria.isSelfExcluded() && srcInstanceName.equalsIgnoreCase(tgtInstanceName)) { continue; } newMessage.setSrcName(srcInstanceName); newMessage.setTgtName(tgtInstanceName); newMessage.setResourceName(map.get("resourceName")); newMessage.setPartitionName(map.get("partitionName")); if (recipientCriteria.isSessionSpecific()) { newMessage.setTgtSessionId(sessionIdMap.get(tgtInstanceName)); } messages.add(newMessage); } } return messages; }
Source:
<code>private <T extends IBootstrapComponent> void addBootstrapComponent( Class<? extends IBootstrapComponent> eventType, T component ) { <START> List<IBootstrapComponent> eventList = bootstrapComponents.get( eventType ); <END> if( eventList == null ) { eventList = new ArrayList<>(); bootstrapComponents.put( eventType, eventList ); } eventList.add( component ); }</code><technical_language>bootstrapComponents.computeIfAbsent( eventType, l -> new ArrayList>() ) here</technical_language>

Target:
private <T extends IBootstrapComponent> void addBootstrapComponent( Class<? extends IBootstrapComponent> eventType, T component ) { bootstrapComponents.computeIfAbsent( eventType, c -> new ArrayList<IBootstrapComponent>() ).add( component ); }
Source:
<code>public ProfilingLogger(final ConnectionInfo connectionInfo) throws DbException { accessMethod = AccessMethod.of(connectionInfo.getDbms(), connectionInfo, false); accessMethod.createTableIfNotExists(MyriaConstants.PROFILING_RELATION, MyriaConstants.PROFILING_SCHEMA); accessMethod.createTableIfNotExists(MyriaConstants.SENT_RELATION, MyriaConstants.SENT_SCHEMA); createProfilingIndexes(); createSentIndex(); if (accessMethod instanceof JdbcAccessMethod) { connection = ((JdbcAccessMethod) accessMethod).getConnection(); try { statementEvent = connection.prepareStatement(accessMethod.insertStatementFromSchema(MyriaConstants.PROFILING_SCHEMA, MyriaConstants.PROFILING_RELATION)); } catch (SQLException e) { throw new DbException(e); } try { statementSent = connection.prepareStatement(accessMethod.insertStatementFromSchema(MyriaConstants.SENT_SCHEMA, MyriaConstants.SENT_RELATION)); } catch (SQLException e) { throw new DbException(e); } } else { connection = null; <START> throw new NotImplementedError(); <END> } }</code><technical_language>a message explaining operation is unsupported</technical_language>

Target:
public ProfilingLogger(final ConnectionInfo connectionInfo) throws DbException { accessMethod = AccessMethod.of(connectionInfo.getDbms(), connectionInfo, false); accessMethod.createTableIfNotExists(MyriaConstants.PROFILING_RELATION, MyriaConstants.PROFILING_SCHEMA); accessMethod.createTableIfNotExists(MyriaConstants.SENT_RELATION, MyriaConstants.SENT_SCHEMA); createProfilingIndexes(); createSentIndex(); if (accessMethod instanceof JdbcAccessMethod) { connection = ((JdbcAccessMethod) accessMethod).getConnection(); try { statementEvent = connection.prepareStatement(accessMethod.insertStatementFromSchema(MyriaConstants.PROFILING_SCHEMA, MyriaConstants.PROFILING_RELATION)); } catch (SQLException e) { throw new DbException(e); } try { statementSent = connection.prepareStatement(accessMethod.insertStatementFromSchema(MyriaConstants.SENT_SCHEMA, MyriaConstants.SENT_RELATION)); } catch (SQLException e) { throw new DbException(e); } } else { connection = null; throw new UnsupportedOperationException("Profiling only supported with JDBC connection"); } }
Source:
<code>public long estimateMemorySize() { return SIZE_OF_OGC_POINT + (point != null ? point.estimateMemorySize() : 0) + <START> (esriSR != null ? esriSR.estimateMemorySize() : 0); <END> }</code><technical_language>In a good implementation, spatial reference instance shared instances of geometry coming dataset, esriSR size contribute OGC types, enforce geometry side right now</technical_language>

Target:
public long estimateMemorySize() { return SIZE_OF_OGC_POINT + (point != null ? point.estimateMemorySize() : 0); }
Source:
<code>public void onDestroyView() { <START> LoaderManager.getInstance(requireActivity()).destroyLoader(HISTORY_FRAGMENT_LOADER_ID); <END> searchErrorView.setRetryClickListener(null); unbinder.unbind(); unbinder = null; disposables.clear(); super.onDestroyView(); }</code><technical_language>unused / dangerous</technical_language>

Target:
public void onDestroyView() { searchErrorView.setRetryClickListener(null); unbinder.unbind(); unbinder = null; disposables.clear(); super.onDestroyView(); }
Source:
<code>public String toString() { <START> return "NotificationDto [runName=" + runAlias + ", sequencerFolderPath=" + sequencerFolderPath + ", sequencerName=" + sequencerName <END> + ", containerId=" + containerSerialNumber + ", laneCount=" + laneCount + ", healthType=" + healthType + ", completionDate=" + completionDate + ", startDate=" + startDate + ", pairedEndRun=" + pairedEndRun + ", software=" + software + "]"; }</code><technical_language>update labels, add additional fields</technical_language>

Target:
public String toString() { return "NotificationDto [runAlias=" + runAlias + ", sequencerFolderPath=" + sequencerFolderPath + ", sequencerName=" + sequencerName + ", containerSerialNumber=" + containerSerialNumber + ", laneCount=" + laneCount + ", healthType=" + healthType + ", startDate=" + startDate + ", completionDate=" + completionDate + ", pairedEndRun=" + pairedEndRun + ", software=" + software + "]"; }
Source:
<code>void recurseSubmodules(String mode) { if (mode == null || mode.isEmpty()) { recurseSubmodules = FetchRecurseSubmodulesMode.YES; } else { try { recurseSubmodules = FetchRecurseSubmodulesMode.valueOf(mode); } catch (IllegalArgumentException e) { <START> throw die(MessageFormat.format( <END> CLIText.get().invalidRecurseSubmodulesMode, mode)); } } }</code><technical_language>calling jgit fetch --recurse-submodules origin a for --recurse-submodules (which is accepted native git) this fails error "fatal: Invalid recurse submodules mode: origin". a limitation of args4j. I reverse order jgit fetch origin --recurse-submodules I get "fatal: Option "--recurse-submodules" takes operand" jgit fetch --recurse-submodules origin yields "fatal: Invalid recurse submodules mode: yes" working format following: jgit fetch --recurse-submodules origin detection needs case insensitive. BranchRebaseMode case-sensitivity problem. true, false valid option values</technical_language>

Target:
void recurseSubmodules(String mode) { if (mode == null || mode.isEmpty()) { recurseSubmodules = FetchRecurseSubmodulesMode.YES; } else { for (FetchRecurseSubmodulesMode m : FetchRecurseSubmodulesMode .values()) { if (m.matchConfigValue(mode)) { recurseSubmodules = m; return; } } throw die(MessageFormat .format(CLIText.get().invalidRecurseSubmodulesMode, mode)); } }
Source:
<code>public Subscription schedule(final Action0 action, long delayTime, TimeUnit unit) { final ScheduledAction scheduledAction = new ScheduledAction(action); scheduledAction.addParent(mCompositeSubscription); scheduledAction.add(Subscriptions.create(new Action0() { @Override public void call() { handler.removeCallbacks(scheduledAction); } })); <START> <END> handler.postDelayed(scheduledAction, unit.toMillis(delayTime)); return scheduledAction; }</code><technical_language>need add scheduledAction composite: java mCompositeSubscription.add(scheduledAction);</technical_language>

Target:
public Subscription schedule(final Action0 action, long delayTime, TimeUnit unit) { final ScheduledAction scheduledAction = new ScheduledAction(action); scheduledAction.add(Subscriptions.create(new Action0() { @Override public void call() { handler.removeCallbacks(scheduledAction); } })); scheduledAction.addParent(compositeSubscription); compositeSubscription.add(scheduledAction); handler.postDelayed(scheduledAction, unit.toMillis(delayTime)); return scheduledAction; }
Source:
<code>public void readDirectory() throws Exception { SequenceFileTextValueReader reader = newReader(SEQUENCE_FILES); ArrayList<String> items = readAll(reader); <START> assertThat(items, contains("a", "bb", "ccc", "a", "bb", "ccc")); <END> }</code><technical_language>nice if sequence file contained else</technical_language>

Target:
public void readDirectory() throws Exception { SequenceFileTextValueReader reader = newReader(SEQUENCE_FILES); ArrayList<String> items = readAll(reader); assertThat(items, either(contains("a", "bb", "ccc", "d", "ee", "fff")) .or(contains("d", "ee", "fff", "a", "bb", "ccc"))); }
Source:
<code>private Map<String, String> parsePathParameters() { Map<String, String> query_pairs = new LinkedHashMap<>(); int idxQuery = this.relativeUrl.indexOf("?"); if (idxQuery != -1 && idxQuery < this.relativeUrl.length() - 1) { String query = this.relativeUrl.substring(idxQuery+1); Matcher queryParamMatcher = PARAM_URL_REGEX.matcher(query); if (queryParamMatcher.find()) { throw methodError(method, "URL query string \"%s\" must not have replace block. " + "For dynamic query parameters use @Query.", query); } String[] pairs = query.split("&"); for (String pair : pairs) { int idx = pair.indexOf("="); query_pairs.put(pair.substring(0, idx), pair.substring(idx + 1)); } this.relativeUrl = this.relativeUrl.substring(0, idxQuery); } <START> return query_pairs; <END> }</code><technical_language>camel case time, I queryPairs</technical_language>

Target:
private Map<String, String> parsePathParameters() { Map<String, String> queryPairs = new LinkedHashMap<>(); if(this.relativeUrl == null) { return queryPairs; } int idxQuery = this.relativeUrl.indexOf("?"); if (idxQuery != -1 && idxQuery < this.relativeUrl.length() - 1) { String query = this.relativeUrl.substring(idxQuery + 1); Matcher queryParamMatcher = PARAM_URL_REGEX.matcher(query); if (queryParamMatcher.find()) { throw methodError(method, "URL query string \"%s\" must not have replace block. " + "For dynamic query parameters use @Query.", query); } String[] pairs = query.split("&"); for (String pair : pairs) { int idx = pair.indexOf("="); queryPairs.put(pair.substring(0, idx), pair.substring(idx + 1)); } this.relativeUrl = this.relativeUrl.substring(0, idxQuery); } return queryPairs; }
Source:
<code>private void sendForm(HttpServletRequest req, HttpServletResponse res, boolean link, @Nullable String errorMessage) throws IOException { String self = req.getRequestURI(); String cancel = Objects.firstNonNull(urlProvider != null ? urlProvider.get() : "/", "/"); <START> String token = LoginUrlToken.getToken(req); cancel += token; <END> Document doc = header.parse(LoginForm.class, "LoginForm.html"); HtmlDomUtil.find(doc, "hostName").setTextContent(req.getServerName()); HtmlDomUtil.find(doc, "login_form").setAttribute("action", self); HtmlDomUtil.find(doc, "cancel_link").setAttribute("href", cancel); if (!link || ssoUrl != null) { Element input = HtmlDomUtil.find(doc, "f_link"); input.getParentNode().removeChild(input); } String last = getLastId(req); if (last != null) { HtmlDomUtil.find(doc, "f_openid").setAttribute("value", last); } Element emsg = HtmlDomUtil.find(doc, "error_message"); if (Strings.isNullOrEmpty(errorMessage)) { emsg.getParentNode().removeChild(emsg); } else { emsg.setTextContent(errorMessage); } for (String name : ALL_PROVIDERS.keySet()) { Element div = HtmlDomUtil.find(doc, "provider_" + name); if (div == null) { continue; } if (!suggestProviders.contains(name)) { div.getParentNode().removeChild(div); continue; } Element a = HtmlDomUtil.find(div, "id_" + name); if (a == null) { div.getParentNode().removeChild(div); continue; } StringBuilder u = new StringBuilder(); u.append(self).append(a.getAttribute("href")); if (link) { u.append("&link"); } a.setAttribute("href", u.toString()); } sendHtml(res, doc); }</code><technical_language>[optional] write this line</technical_language>

Target:
private void sendForm(HttpServletRequest req, HttpServletResponse res, boolean link, @Nullable String errorMessage) throws IOException { String self = req.getRequestURI(); String cancel = Objects.firstNonNull(urlProvider != null ? urlProvider.get() : "/", "/"); cancel += LoginUrlToken.getToken(req); Document doc = header.parse(LoginForm.class, "LoginForm.html"); HtmlDomUtil.find(doc, "hostName").setTextContent(req.getServerName()); HtmlDomUtil.find(doc, "login_form").setAttribute("action", self); HtmlDomUtil.find(doc, "cancel_link").setAttribute("href", cancel); if (!link || ssoUrl != null) { Element input = HtmlDomUtil.find(doc, "f_link"); input.getParentNode().removeChild(input); } String last = getLastId(req); if (last != null) { HtmlDomUtil.find(doc, "f_openid").setAttribute("value", last); } Element emsg = HtmlDomUtil.find(doc, "error_message"); if (Strings.isNullOrEmpty(errorMessage)) { emsg.getParentNode().removeChild(emsg); } else { emsg.setTextContent(errorMessage); } for (String name : ALL_PROVIDERS.keySet()) { Element div = HtmlDomUtil.find(doc, "provider_" + name); if (div == null) { continue; } if (!suggestProviders.contains(name)) { div.getParentNode().removeChild(div); continue; } Element a = HtmlDomUtil.find(div, "id_" + name); if (a == null) { div.getParentNode().removeChild(div); continue; } StringBuilder u = new StringBuilder(); u.append(self).append(a.getAttribute("href")); if (link) { u.append("&link"); } a.setAttribute("href", u.toString()); } sendHtml(res, doc); }
Source:
<code>public static OwnershipTaxClassification fromTaxClassification(String taxClassification) { <START> for (OwnershipTaxClassification oc : OwnershipTaxClassification.values()) { <END> if (StringUtils.equals(taxClassification, oc.taxClassification)) { return oc; } } return null; }</code><technical_language>indentation right</technical_language>

Target:
public static OwnershipTaxClassification fromTaxClassification(String taxClassification) { for (OwnershipTaxClassification oc : OwnershipTaxClassification.values()) { if (StringUtils.equals(taxClassification, oc.taxClassification)) { return oc; } } return OwnershipTaxClassification.UNKNOWN; }
Source:
<code>public boolean cancel(boolean mayInterruptIfRunning) { boolean cancelled = super.cancel(mayInterruptIfRunning); <START> return clearTaskAfterCompletion(cancelled, CANCELLED); <END> }</code><technical_language>merge lines</technical_language>

Target:
public boolean cancel(boolean mayInterruptIfRunning) { return clearTaskAfterCompletion(super.cancel(mayInterruptIfRunning), CANCELLED); }
Source:
<code>public List<Group> listGroups(Condition condition, int limit, int offset) throws UserStoreException { <START> validateCondition(condition); String domain = getDomainFromCondition(condition); handlePreListGroup(condition, domain); List<Group> filteredGroups = new ArrayList<>(); UserStoreManager secManager = getSecondaryUserStoreManager(domain); if (secManager != null) { if (secManager instanceof AbstractUserStoreManager) { if (isUniqueUserIdEnabled(secManager)) { UniqueIDPaginatedSearchResult <Group> groups = ((AbstractUserStoreManager) secManager) .doListGroups(condition, domain, offset, limit, null, null); filteredGroups = groups.getEntities(); } else { throw new UserStoreException(" listGroups is not supported."); } } <END> } handlePostListGroups(condition, domain, false); return filteredGroups; }</code><technical_language>this block is repeated in above, move a separate private method</technical_language>

Target:
public List<Group> listGroups(Condition condition, int limit, int offset) throws UserStoreException { return listGroups(condition, offset, limit, null, null); }
Source:
<code>private static MemcacheProtocolConfig initMemcacheProtocolConfig(Config config) { AdvancedNetworkConfig advancedNetworkConfig = config.getAdvancedNetworkConfig(); boolean isAdvancedNetwork = advancedNetworkConfig.isEnabled(); <START> if (isAdvancedNetwork) { <END> return new MemcacheProtocolConfig().setEnabled(true); } return config.getNetworkConfig().getMemcacheProtocolConfig(); }</code><technical_language>In addition isAdvancedNetwork, need check config.getAdvancedNetworkConfig().getEndpointConfigs().get(MEMCACHE) != null conclude return enabled memcache protocol config</technical_language>

Target:
private static MemcacheProtocolConfig initMemcacheProtocolConfig(Config config) { AdvancedNetworkConfig advancedNetworkConfig = config.getAdvancedNetworkConfig(); boolean isAdvancedNetwork = advancedNetworkConfig.isEnabled(); if (isAdvancedNetwork && config.getAdvancedNetworkConfig().getEndpointConfigs().get(MEMCACHE) != null) { return new MemcacheProtocolConfig().setEnabled(true); } return config.getNetworkConfig().getMemcacheProtocolConfig(); }
Source:
<code>private void runInternal() { try { operationSelector.start(); while (!stage.isTerminated()) { boolean started = stage.isStarted(); if (started) { txRemainingOperations = 0; if (ongoingTx != null) { endTransactionAndRegisterStats(null); } break; <START> } else { <END> if (!isStarted()) { Operation operation = operationSelector.next(random); try { logic.run(operation); stats.begin(); this.started = true; } catch (OperationLogic.RequestException e) { } } } } completion.start(); int i = 0; while (!stage.isTerminated()) { Operation operation = operationSelector.next(random); if (!completion.moreToRun()) break; try { logic.run(operation); } catch (OperationLogic.RequestException e) { } i++; completion.logProgress(i); } } finally { if (txRemainingOperations > 0) { endTransactionAndRegisterStats(null); } } }</code><technical_language>This do operation, call stats.begin() (before other threads started) busy loops polling stage.isStarted() running ops. I this is want</technical_language>

Target:
private void runInternal() { boolean counted = false; try { operationSelector.start(); while (!stage.isTerminated()) { boolean started = stage.isStarted(); if (started) { txRemainingOperations = 0; if (ongoingTx != null) { endTransactionAndRegisterStats(null); } break; } else { if (!counted) { threadCountDown.countDown(); counted = true; } Operation operation = operationSelector.next(random); try { logic.run(operation); } catch (OperationLogic.RequestException e) { } } } stats.begin(); this.started = true; completion.start(); int i = 0; while (!stage.isTerminated()) { Operation operation = operationSelector.next(random); if (!completion.moreToRun()) break; try { logic.run(operation); } catch (OperationLogic.RequestException e) { } i++; completion.logProgress(i); } } finally { if (txRemainingOperations > 0) { endTransactionAndRegisterStats(null); } } }
Source:
<code><START> protected List<MPartStack> findDirectStacks(MPartSashContainer root) { <END> List<MPartStack> result = new ArrayList<>(); for (MPartSashContainerElement e : root.getChildren()) { if (e instanceof MPartStack) { result.add((MPartStack) e); } else if (e instanceof MPartSashContainer) { result.addAll(findDirectStacks((MPartSashContainer) e)); } } return result; }</code><technical_language>private? is private method synchCTFState. I place new method synchCTFState. I get findElements() method need here. do a recursive search for MPartStack in areaModel. EModelServiceFindTest extended check case</technical_language>

Target:
private List<MPartStack> findDirectStacks(MPartSashContainer root) { List<MPartStack> result = new ArrayList<>(); for (MPartSashContainerElement e : root.getChildren()) { if (e instanceof MPartStack) { result.add((MPartStack) e); } else if (e instanceof MPartSashContainer) { result.addAll(findDirectStacks((MPartSashContainer) e)); } } return result; }
Source:
<code>void setInput(final RevFlag hFlag, final SWTCommitList list, final SWTCommit[] asArray, HistoryPageInput input) { this.input = input; if (menuListener != null) menuListener.setInput(input); final SWTCommitList oldList = allCommits; highlight = hFlag; allCommits = list; table.setInput(asArray); if (asArray != null && asArray.length > 0) { if (oldList != list) selectCommit(asArray[0]); <START> initCommitsMap(); <END> } else { table.getTable().deselectAll(); } }</code><technical_language>this line if (oldList != list), outside? If inside, please add brackets remove indentation</technical_language>

Target:
void setInput(final RevFlag hFlag, final SWTCommitList list, final SWTCommit[] asArray, HistoryPageInput input) { this.input = input; if (menuListener != null) menuListener.setInput(input); final SWTCommitList oldList = allCommits; highlight = hFlag; allCommits = list; table.setInput(asArray); if (asArray != null && asArray.length > 0) { if (oldList != list) { selectCommit(asArray[0]); initCommitsMap(); } } else { table.getTable().deselectAll(); } }