auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public CompletionStage<MetricsQueryResponse> queryMetrics(final MetricsQuery query) { final UUID queryUuid = UUID.randomUUID(); final JsonNode queryJson = _mapper.valueToTree(query); LOGGER.trace() .setMessage("starting queryMetrics") .addData("queryUuid", queryUuid) .addData("query", queryJson) .log(); final HttpRequest request = HttpRequest.POST(createUri(METRICS_QUERY_PATH).toString()) .withEntity(ContentTypes.APPLICATION_JSON, queryJson.toString()); final Instant startTime = Instant.now(); return fireRequest(request, MetricsQueryResponse.class) .whenComplete((response, error) -> { LOGGER.trace() .setMessage("finished queryMetrics") .addData("queryUuid", queryUuid) .addData("query", queryJson) .addData("duration", Duration.between(startTime, Instant.now())) <START> .addData("success", error == null) <END> .log(); }); }</code><technical_language>Sorry, call setThrowable error actual error is output well</technical_language>

Target:
public CompletionStage<MetricsQueryResponse> queryMetrics(final MetricsQuery query) { final Metrics metrics = _metricsFactory.create(); final UUID queryUuid = UUID.randomUUID(); final JsonNode queryJson = _mapper.valueToTree(query); LOGGER.trace() .setMessage("starting queryMetrics") .addData("queryUuid", queryUuid) .addData("query", queryJson) .log(); final HttpRequest request = HttpRequest.POST(createUri(METRICS_QUERY_PATH).toString()) .withEntity(ContentTypes.APPLICATION_JSON, queryJson.toString()); final Instant startTime = Instant.now(); return fireRequest(request, MetricsQueryResponse.class) .whenComplete((response, error) -> { LOGGER.trace() .setMessage("finished queryMetrics") .addData("queryUuid", queryUuid) .addData("query", queryJson) .addData("duration", Duration.between(startTime, Instant.now())) .setThrowable(error) .log(); metrics.incrementCounter("kairosClient/queryMetrics/success", error == null ? 1 : 0); metrics.close(); }); }
Source:
<code>public void createProject_shouldCreateRefappModuleProject() throws Exception{ <START> addTaskParam("moduleType", "refapp"); <END> for( String option : options){ addTaskParam(option, "test"); } executeTask("create-project"); assertSuccess(); assertProjectCreated(); }</code><technical_language>rename type? I envision create-project called for OWAs, creating distributions, etc. types start with: platform-module, referenceapplication-module</technical_language>

Target:
public void createProject_shouldCreateRefappModuleProject() throws Exception{ addTaskParam("type", "referenceapplication-module"); for( String option : options){ addTaskParam(option, "test"); } executeTask("create-project"); assertSuccess(); assertProjectCreated(); }
Source:
<code>public static SecureRandom getSecureRandom(Properties props) { String secureRandomClasses = props.getProperty( CHIMERA_SECURE_RANDOM_CLASSES_KEY); if (secureRandomClasses == null) { secureRandomClasses = System.getProperty( CHIMERA_SECURE_RANDOM_CLASSES_KEY); } SecureRandom random = null; for (String klassName : Splitter.on(',').trimResults().omitEmptyStrings() .split(secureRandomClasses)) { try { final Class klass = ReflectionUtils.getClassByName(klassName); random = (SecureRandom) ReflectionUtils.newInstance(klass, props); if (random != null) { break; } } catch (ClassCastException e) { LOG.error("Class is not a Cipher.", klassName); } catch (ClassNotFoundException e) { LOG.error("Cipher not found.", klassName); } } <START> return (random == null) ? new OsSecureRandom(props) : random; <END> }</code><technical_language>Here, I default JavaSecureRandom this is more work if others ((OpensslSecureRandom OSSecureRandom) failed</technical_language>

Target:
public static SecureRandom getSecureRandom(Properties props) { String secureRandomClasses = props.getProperty( CHIMERA_SECURE_RANDOM_CLASSES_KEY); if (secureRandomClasses == null) { secureRandomClasses = System.getProperty( CHIMERA_SECURE_RANDOM_CLASSES_KEY); } SecureRandom random = null; for (String klassName : Splitter.on(',').trimResults().omitEmptyStrings() .split(secureRandomClasses)) { try { final Class klass = ReflectionUtils.getClassByName(klassName); random = (SecureRandom) ReflectionUtils.newInstance(klass, props); if (random != null) { break; } } catch (ClassCastException e) { LOG.error("Class is not a Cipher.", klassName); } catch (ClassNotFoundException e) { LOG.error("Cipher not found.", klassName); } } return (random == null) ? new JavaSecureRandom(props) : random; }
Source:
<code>private void init() { menu = menuFor(item); getElement().addClassName(style.itemPanel()); setWidget(getContents()); addDomHandler(new ContextMenuHandler() { @Override public void onContextMenu(ContextMenuEvent event) { NetworkItemPanel sourcePanel = (NetworkItemPanel) event.getSource(); NativeEvent nativeEvent = event.getNativeEvent(); showContextMenu(sourcePanel, nativeEvent.getClientX(), nativeEvent.getClientY()); event.stopPropagation(); event.preventDefault(); } }, ContextMenuEvent.getType()); <START> addBitlessDomHandler(new DragStartHandler() { <END> @Override public void onDragStart(DragStartEvent event) { if (!draggable) { return; } NetworkItemPanel sourcePanel = (NetworkItemPanel) event.getSource(); lastDragData = sourcePanel.item.getType() + " " + sourcePanel.item.getName(); event.setData("Text", lastDragData); NativeEvent nativeEvent = event.getNativeEvent(); int x = nativeEvent.getClientX() - sourcePanel.getAbsoluteLeft(); int y = nativeEvent.getClientY() - sourcePanel.getAbsoluteTop(); event.getDataTransfer().setDragImage(sourcePanel.getElement(), x, y); } }, DragStartEvent.getType()); }</code><technical_language>Hm, call addBitlessDomHandler if draggable == true, i.e. this: if (draggable) { addBitlessDomHandler(...); } wondering, DragStartEvent get triggered calling getElement().setDraggable(DRAGGABLE_FALSE) - expect drag events raised in case</technical_language>

Target:
private void init() { menu = menuFor(item); getElement().addClassName(style.itemPanel()); setWidget(getContents()); addDomHandler(new ContextMenuHandler() { @Override public void onContextMenu(ContextMenuEvent event) { NetworkItemPanel sourcePanel = (NetworkItemPanel) event.getSource(); NativeEvent nativeEvent = event.getNativeEvent(); showContextMenu(sourcePanel, nativeEvent.getClientX(), nativeEvent.getClientY()); event.stopPropagation(); event.preventDefault(); } }, ContextMenuEvent.getType()); if (draggable) { addBitlessDomHandler(new DragStartHandler() { @Override public void onDragStart(DragStartEvent event) { NetworkItemPanel sourcePanel = (NetworkItemPanel) event.getSource(); lastDragData = sourcePanel.item.getType() + " " + sourcePanel.item.getName(); event.setData("Text", lastDragData); NativeEvent nativeEvent = event.getNativeEvent(); int x = nativeEvent.getClientX() - sourcePanel.getAbsoluteLeft(); int y = nativeEvent.getClientY() - sourcePanel.getAbsoluteTop(); event.getDataTransfer().setDragImage(sourcePanel.getElement(), x, y); } }, DragStartEvent.getType()); } }
Source:
<code>public void initActionSets() { if (descriptor != null) { <START> List<IActionSetDescriptor> temp = new ArrayList<IActionSetDescriptor>(); <END> List<String> ids = ModeledPageLayout.getIds(layout, ModeledPageLayout.ACTION_SET_TAG); createInitialActionSets(temp, ids); for (IActionSetDescriptor descriptor : temp) { if (!alwaysOnActionSets.contains(descriptor)) { alwaysOnActionSets.add(descriptor); } } } }</code><technical_language>find a name "temp"</technical_language>

Target:
public void initActionSets() { if (descriptor != null) { List<String> ids = ModeledPageLayout.getIds(layout, ModeledPageLayout.ACTION_SET_TAG); for (IActionSetDescriptor descriptor : createInitialActionSets(ids)) { if (!alwaysOnActionSets.contains(descriptor)) { alwaysOnActionSets.add(descriptor); } } } }
Source:
<code>public void dateFormattedCorrectly() throws Exception { ConsentSignature sig = makeSignatureWithoutImage(); ConsentPdf consentPdf = new ConsentPdf(study, EMAIL_PARTICIPANT, sig, SharingScope.NO_SHARING, NEW_DOCUMENT_FRAGMENT, consentBodyTemplate); String output = consentPdf.getFormattedConsentDocument(); <START> assertTrue("Contains formatted date", output.contains(ConsentPdf.FORMATTER.print(DateTime.now()) + " (GMT)")); <END> }</code><technical_language>DateUtils mock verify output a string. Otherwise, if ConsentPdf.FORMATTER formats date incorrectly, this test catch it</technical_language>

Target:
public void dateFormattedCorrectly() throws Exception { ConsentSignature sig = makeSignatureWithoutImage(); ConsentPdf consentPdf = new ConsentPdf(study, EMAIL_PARTICIPANT, sig, SharingScope.NO_SHARING, NEW_DOCUMENT_FRAGMENT, consentBodyTemplate); String output = consentPdf.getFormattedConsentDocument(); assertTrue("Contains formatted date", output.contains("October 4, 2017 (GMT)")); }
Source:
<code>public static String getFileName(String filePath) { if (filePath.contains("/")) { return last(filePath.split("/")); } <START> return ""; <END> }</code><technical_language>This right... this result in file's path file path of parent directory (and overwriting directory)</technical_language>

Target:
public static String getFileName(String filePath) { return last(filePath.split("/")); }
Source:
<code>GroupingTable(Map<String, AggregateOperator> groupByAliasToAggregateType, List<String> orderedAliases, boolean hasSelectValue) { <START> this.table = new HashMap<>(); <END> this.groupByAliasToAggregateType = groupByAliasToAggregateType; this.orderedAliases = orderedAliases; this.hasSelectValue = hasSelectValue; }</code><technical_language>null checks</technical_language>

Target:
GroupingTable(Map<String, AggregateOperator> groupByAliasToAggregateType, List<String> orderedAliases, boolean hasSelectValue) { if (groupByAliasToAggregateType == null) { throw new IllegalArgumentException("groupByAliasToAggregateType cannot be null"); } this.table = new HashMap<>(); this.groupByAliasToAggregateType = groupByAliasToAggregateType; this.orderedAliases = orderedAliases; this.hasSelectValue = hasSelectValue; }
Source:
<code>private void mergeNewValues(boolean force, double compression) { if (unmergedWeight == 0) { return; } if (force || unmergedWeight > 0) { <START> while (activeCentroids + tempUsed >= tempMean.length) { <END> tempWeight = Arrays.copyOf(tempWeight, min(tempWeight.length * 2, maxBufferSize)); tempMean = Arrays.copyOf(tempMean, min(tempMean.length * 2, maxBufferSize)); order = Arrays.copyOf(order, min(order.length * 2, maxBufferSize)); } merge(tempMean, tempWeight, tempUsed, order, unmergedWeight, mergeCount % 2 == 1, compression); mergeCount++; tempUsed = 0; unmergedWeight = 0; } }</code><technical_language>familiar algorithm. compute big array needs copy once</technical_language>

Target:
private void mergeNewValues(boolean force, double compression) { if (unmergedWeight == 0) { return; } if (force || unmergedWeight > 0) { merge(tempMean, tempWeight, tempUsed, order, unmergedWeight, mergeCount % 2 == 1, compression); mergeCount++; tempUsed = 0; unmergedWeight = 0; } }
Source:
<code>protected static Set<String> parseShortInvokedMethods(String line) { Set<String> methods = Sets.newHashSet(); Set<String> blacklist = Sets.newHashSet("time", "date"); String regex = "\\b(?!" + StringUtils.join(blacklist, "|") + ")(?<!\")[\\w\\.]+[\\(\\s]"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(line); while (matcher.find()) { if(!matcher.group().startsWith("concourse.")) { <START> methods.add(matcher.group().replaceFirst("[\\(\\s]", "")); <END> } } return methods; }</code><technical_language>relaceFirst instead of replace</technical_language>

Target:
protected static Set<String> parseShortInvokedMethods(String line) { Set<String> methods = Sets.newHashSet(); Set<String> blacklist = Sets.newHashSet("time", "date"); String regex = "\\b(?!" + StringUtils.join(blacklist, "|") + ")(?<!\")[\\w\\.]+[\\(\\s]"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(line); Pattern replacePattern = Pattern.compile("[\\(\\s]"); while (matcher.find()) { if(!matcher.group().startsWith("concourse.")) { methods.add(replacePattern.matcher(matcher.group()).replaceAll("")); } } return methods; }
Source:
<code>public static String identifyVM() { SystemInfo si = new SystemInfo(); HardwareAbstractionLayer hw = si.getHardware(); NetworkIF[] nifs = hw.getNetworkIFs(); boolean isvm = false; for (NetworkIF nif : nifs) { String mac = nif.getMacaddr().substring(0, 8).toUpperCase(); if (vmMacAddressOUI.containsKey(mac)) { isvm = true; <START> return "On a VM: " + vmMacAddressOUI.get(mac); <END> } } if (!isvm) { String model = hw.getComputerSystem().getModel(); for (String vm : vmModelArray) { if (model.contains(vm)) { isvm = true; return "On a VM: " + vm; } } } if (!isvm) { String manufacturer = hw.getComputerSystem().getManufacturer(); String model = hw.getComputerSystem().getModel(); if (manufacturer.equals("Microsoft Corporation") && model.equals("Virtual Machine")) { isvm = true; return "On a VM: Microsoft Hyper-V"; } } return "Couldn't detect VM"; }</code><technical_language>adding words "On a VM" return VM string here</technical_language>

Target:
public static String identifyVM() { SystemInfo si = new SystemInfo(); HardwareAbstractionLayer hw = si.getHardware(); NetworkIF[] nifs = hw.getNetworkIFs(); for (NetworkIF nif : nifs) { String mac = nif.getMacaddr().substring(0, 8).toUpperCase(); if (vmMacAddressOUI.containsKey(mac)) { return vmMacAddressOUI.get(mac); } } String model = hw.getComputerSystem().getModel(); for (String vm : vmModelArray) { if (model.contains(vm)) { return vm; } } String manufacturer = hw.getComputerSystem().getManufacturer(); if ("Microsoft Corporation".equals(manufacturer) && "Virtual Machine".equals(model)) { return "Microsoft Hyper-V"; } return ""; }
Source:
<code>public void scheduleTask(String taskName, boolean requestRecovery) throws TaskException { <START> throw new TaskException("Requesting recovery is not supported in standalone mode", null); <END> }</code><technical_language>a bad design a method required a single concrete class in generic interface? fix do this</technical_language>

Target:
public void scheduleTask(String taskName, boolean requestRecovery) throws TaskException { if (this.isMyTaskTypeRegistered()) { this.scheduleLocalTask(taskName, requestRecovery); } else { throw new TaskException("Task type: '" + this.getTaskType() + "' is not registered in the current task node", Code.TASK_NODE_NOT_AVAILABLE); } }
Source:
<code>public final @Nonnull Stream<OWLAxiom> axiomBase() { Stream<OWLAxiom> toReturn = axiomBase.stream(); toReturn = Stream.concat(tautologies.stream().flatMap(Set::stream), toReturn); <START> return axiomBase.stream(); <END> }</code><technical_language>this intention? globals is longer involved stream creation tautologies base axioms is unused</technical_language>

Target:
public final @Nonnull Stream<OWLAxiom> axiomBase() { return axiomBase.stream(); }
Source:
<code>public void onEvent(GitEvent event) { <START> if (event instanceof GitCheckoutEvent) { <END> GitCheckoutEvent checkoutEvent = (GitCheckoutEvent) event; String workspaceIdAndProjectName = checkoutEvent.getWorkspaceId() + checkoutEvent.getProjectName(); endpointIdsWithWorkspaceIdAndProjectName .entrySet() .stream() .filter(it -> it.getValue().contains(workspaceIdAndProjectName)) .map(Entry::getKey) .forEach( it -> transmitter .newRequest() .endpointId(it) .methodName("git/checkoutOutput") .paramsAsDto(event) .sendAndSkipResult()); } else if (event instanceof IndexChangedEvent) { endpointIds.forEach( id -> transmitter .newRequest() .endpointId(id) .methodName("event/git-index") .paramsAsDto(((IndexChangedEvent) event).getStatus()) .sendAndSkipResult()); } }</code><technical_language>onEvent method simpler. Encapsulate handling git events in methods. if () { handleEvent1() } else () { handlerEvent2() }</technical_language>

Target:
public void onEvent(GitEvent event) { if (event instanceof GitCheckoutEvent) { handleCheckoutEvent((GitCheckoutEvent) event); } else if (event instanceof GitCommitEvent || event instanceof GitResetEvent || event instanceof GitRepositoryInitializedEvent || event instanceof GitRepositoryDeletedEvent) { handleIndexChangedEvent(event); } }
Source:
<code>public void stateUpdated(Item item, State state) { State oldState = this.state; if (function != null && baseItem != null) { State calculatedState = function.calculate(members); <START> if (baseItem.getAcceptedDataTypes().contains(PercentType.class) <END> && !baseItem.getAcceptedDataTypes().contains(DecimalType.class)) { calculatedState = calculatedState.as(PercentType.class); } setState(calculatedState); } if (!oldState.equals(this.state)) { sendGroupStateChangedEvent(item.getName(), this.state, oldState); } }</code><technical_language>sense check type of calculatedState first? Java if (calculatedState instanceof DecimalType && !baseItem.getAcceptedDataTypes().contains(DecimalType.class) ...)</technical_language>

Target:
public void stateUpdated(Item item, State state) { State oldState = this.state; if (function != null && baseItem != null) { State calculatedState = function.calculate(members); calculatedState = ItemUtil.convertToAcceptedState(calculatedState, baseItem); setState(calculatedState); } if (!oldState.equals(this.state)) { sendGroupStateChangedEvent(item.getName(), this.state, oldState); } }
Source:
<code>public void serializeTimingData(Path outputPath) { merge(); try (FileWriter fw = new FileWriter(outputPath.toFile())) { <START> fw.write("Number Of Executions | Total Milliseconds | Milliseconds per execution | Type\n"); <END> for (Map.Entry<String, TimingData> timing : executionInfo.entrySet()) { TimingData data = timing.getValue(); long totalMillis = (data.totalNanos / 1000000); double millisPerExecution = (double) totalMillis / (double) data.numberOfExecutions; fw.write(String.format("%6d, %6d, %8.2f, %s", data.numberOfExecutions, totalMillis, millisPerExecution, StringEscapeUtils.escapeCsv(timing.getKey()) )); fw.write("\n"); } } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>this effectively delimiter "|" character</technical_language>

Target:
public void serializeTimingData(Path outputPath) { merge(); try (FileWriter fw = new FileWriter(outputPath.toFile())) { fw.write("Number Of Executions, Total Milliseconds, Milliseconds per execution, Type\n"); for (Map.Entry<String, TimingData> timing : executionInfo.entrySet()) { TimingData data = timing.getValue(); long totalMillis = (data.totalNanos / 1000000); double millisPerExecution = (double) totalMillis / (double) data.numberOfExecutions; fw.write(String.format("%6d, %6d, %8.2f, %s\n", data.numberOfExecutions, totalMillis, millisPerExecution, StringEscapeUtils.escapeCsv(timing.getKey()) )); } } catch (Exception e) { e.printStackTrace(); } }
Source:
<code>protected boolean canDoAction() { <START> setVdsId(getParameters().getPrefferedSPMId()); <END> if (getVds() == null) { return failCanDoAction(VdcBllMessages.VDS_NOT_EXIST); } if (getVds().getStatus() != VDSStatus.Up) { return failCanDo(VdcBllMessages.CANNOT_REINIT_SPM_VDS_NOT_UP); } if (getVds().getSpmStatus() != VdsSpmStatus.None) { return failCanDo(VdcBllMessages.CANNOT_REINIT_SPM_VDS_ALREADY_SPM); } if (getVds().getVdsSpmPriority() == BusinessEntitiesDefinitions.HOST_MIN_SPM_PRIORITY) { return failCanDo(VdcBllMessages.CANNOT_REINIT_SPM_VDS_MARKED_AS_NEVER_SPM); } return true; }</code><technical_language>done in constructor</technical_language>

Target:
protected boolean canDoAction() { if (getVds() == null) { return failCanDoAction(VdcBllMessages.VDS_NOT_EXIST); } if (getVds().getStatus() != VDSStatus.Up) { return failCanDo(VdcBllMessages.CANNOT_REINIT_SPM_VDS_NOT_UP); } if (getVds().getStoragePoolId() != getParameters().getStoragePoolId() || getParameters().getStoragePoolId() == null) { return failCanDo(VdcBllMessages.CANNOT_REINIT_SPM_VDS_NOT_IN_POOL); } if (getVds().getSpmStatus() != VdsSpmStatus.None) { return failCanDo(VdcBllMessages.CANNOT_REINIT_SPM_VDS_ALREADY_SPM); } if (getVds().getVdsSpmPriority() == BusinessEntitiesDefinitions.HOST_MIN_SPM_PRIORITY) { return failCanDo(VdcBllMessages.CANNOT_REINIT_SPM_VDS_MARKED_AS_NEVER_SPM); } return true; }
Source:
<code>public void registerAttributes(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadOnlyAttribute(MODULE, null); <START> resourceRegistration.registerOperationHandler(ADD_OP, addHandler); <END> }</code><technical_language>This in registerOperations</technical_language>

Target:
public void registerAttributes(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadOnlyAttribute(MODULE, null); }
Source:
<code>private List<String> mediaCellValues(String value, String imagePrefix) { List<String> cells = new ArrayList<>(); Media media = MediaResponse.parse(value); String filename = media.getFilename(); if (filename != null) { <START> filename = filename.substring(filename.lastIndexOf("/") + 1); END> if (filename.length() > 0) { cells.add(imagePrefix + filename); if (splitIntoColumns && media.getLocation() != null) { cells.add(Double.toString(media.getLocation().getLatitude())); cells.add(Double.toString(media.getLocation().getLongitude())); cells.add(Double.toString(media.getLocation().getAccuracy())); } } } return cells; }</code><technical_language>I suggest Paths.get(filename).getFileName() instead of _substring_ manipulation. java.nio.file.Paths introduced in Java 7, is safe use. java Paths.get("/this/is/a/long/path.txt").getFileName().equals(Paths.get("path.txt").getFileName()); // true Paths.get("/this/is/a////long/path.txt").getFileName().equals(Paths.get("path.txt").getFileName()) // true</technical_language>

Target:
private List<String> mediaCellValues(String value, String imagePrefix) { List<String> cells = new ArrayList<>(); Media media = MediaResponse.parse(value); String filename = media.getFilename(); if (filename != null) { filename = Paths.get(filename).getFileName().toString(); if (filename.length() > 0) { cells.add(imagePrefix + filename); if (splitIntoColumns && media.getLocation() != null) { cells.add(Double.toString(media.getLocation().getLatitude())); cells.add(Double.toString(media.getLocation().getLongitude())); cells.add(Double.toString(media.getLocation().getAccuracy())); } } } return cells; }
Source:
<code>public void updateFeedbackResponse( FeedbackResponseAttributes updatedResponse, FeedbackResponse oldResponseEntity) throws InvalidParametersException, EntityAlreadyExistsException { if (oldResponseEntity == null) { throw new NullPointerException("oldResponseEntity should not be null"); } FeedbackResponseAttributes newResponse = new FeedbackResponseAttributes(updatedResponse); FeedbackResponseAttributes oldResponse = new FeedbackResponseAttributes(oldResponseEntity); <START> copyOldResponseToNewResponse(newResponse, oldResponse); <END> if (!newResponse.recipientEmail.equals(oldResponse.recipientEmail) || !newResponse.giverEmail.equals(oldResponse.giverEmail)) { recreateResponse(newResponse, oldResponse); } else { try { frDb.updateFeedbackResponseOptimized(newResponse, oldResponseEntity); } catch (EntityDoesNotExistException e) { Assumption.fail(); } } }</code><technical_language>This copyOldResponseToNewResponse method error prone return a side effect. immediately clear object is copied which. move FeedbackResponseAttributes? a constructor of FeedbackResponseAttributes</technical_language>

Target:
public void updateFeedbackResponse( FeedbackResponseAttributes updatedResponse, FeedbackResponse oldResponseEntity) throws InvalidParametersException, EntityAlreadyExistsException { Assumption.assertNotNull(oldResponseEntity); FeedbackResponseAttributes newResponse = new FeedbackResponseAttributes(updatedResponse); FeedbackResponseAttributes oldResponse = new FeedbackResponseAttributes(oldResponseEntity); newResponse.courseId = oldResponse.courseId; newResponse.feedbackSessionName = oldResponse.feedbackSessionName; newResponse.feedbackQuestionId = oldResponse.feedbackQuestionId; newResponse.feedbackQuestionType = oldResponse.feedbackQuestionType; if (newResponse.responseMetaData == null) { newResponse.responseMetaData = oldResponse.responseMetaData; } if (newResponse.giverEmail == null) { newResponse.giverEmail = oldResponse.giverEmail; } if (newResponse.recipientEmail == null) { newResponse.recipientEmail = oldResponse.recipientEmail; } if (newResponse.giverSection == null) { newResponse.giverSection = oldResponse.giverSection; } if (newResponse.recipientSection == null) { newResponse.recipientSection = oldResponse.recipientSection; } if (!newResponse.recipientEmail.equals(oldResponse.recipientEmail) || !newResponse.giverEmail.equals(oldResponse.giverEmail)) { recreateResponse(newResponse, oldResponse); } else { try { frDb.updateFeedbackResponseOptimized(newResponse, oldResponseEntity); } catch (EntityDoesNotExistException e) { Assumption.fail(); } } }
Source:
<code>public static IntervalList invert(final IntervalList list) { final IntervalList inverse = new IntervalList(list.header.clone()); final ListMap<Integer, Interval> map = new ListMap<Integer, Interval>(); for (final Interval i : list.uniqued().getIntervals()) { map.add(list.getHeader().getSequenceIndex(i.getContig()), i); } int intervals = 0; for (final SAMSequenceRecord samSequenceRecord : list.getHeader().getSequenceDictionary().getSequences()) { final Integer sequenceIndex = samSequenceRecord.getSequenceIndex(); final String sequenceName = samSequenceRecord.getSequenceName(); final int sequenceLength = samSequenceRecord.getSequenceLength(); <START> Integer lastCoveredPosition = 0; END> if (map.containsKey(sequenceIndex)) { for (final Interval i : map.get(sequenceIndex)) { if (i.getStart() > lastCoveredPosition + 1) { inverse.add(new Interval(sequenceName, lastCoveredPosition + 1, i.getStart() - 1, false, "interval-" + (++intervals))); } lastCoveredPosition = i.getEnd(); } } if (sequenceLength > lastCoveredPosition) { inverse.add(new Interval(sequenceName, lastCoveredPosition + 1, sequenceLength, false, "interval-" + (++intervals))); } } return inverse; }</code><technical_language>int Integer this null suggestion int lastCoveredPosition = 0; //start beginning of sequence</technical_language>

Target:
public static IntervalList invert(final IntervalList list) { final IntervalList inverse = new IntervalList(list.header.clone()); final ListMap<Integer, Interval> map = new ListMap<>(); for (final Interval i : list.uniqued().getIntervals()) { map.add(list.getHeader().getSequenceIndex(i.getContig()), i); } int intervals = 0; for (final SAMSequenceRecord samSequenceRecord : list.getHeader().getSequenceDictionary().getSequences()) { final Integer sequenceIndex = samSequenceRecord.getSequenceIndex(); final String sequenceName = samSequenceRecord.getSequenceName(); final int sequenceLength = samSequenceRecord.getSequenceLength(); int lastCoveredPosition = 0; if (map.containsKey(sequenceIndex)) { for (final Interval i : map.get(sequenceIndex)) { if (i.getStart() > lastCoveredPosition + 1) { inverse.add(new Interval(sequenceName, lastCoveredPosition + 1, i.getStart() - 1, false, "interval-" + (++intervals))); } lastCoveredPosition = i.getEnd(); } } if (sequenceLength > lastCoveredPosition) { inverse.add(new Interval(sequenceName, lastCoveredPosition + 1, sequenceLength, false, "interval-" + (++intervals))); } } return inverse; }
Source:
<code><START> private Map<String, List<TaskId>> expectedAssignmentForTwoClients(final List<TaskId> assignedTasksForClient1, <END> final List<TaskId> assignedTasksForClient2) { return mkMap( mkEntry(CLIENT_1, assignedTasksForClient1), mkEntry(CLIENT_2, assignedTasksForClient2) ); }</code><technical_language>utility methods static</technical_language>

Target:
private static Map<String, List<TaskId>> expectedAssignmentForTwoClients(final List<TaskId> assignedTasksForClient1, final List<TaskId> assignedTasksForClient2) { return mkMap( mkEntry(CLIENT_1, assignedTasksForClient1), mkEntry(CLIENT_2, assignedTasksForClient2) ); }
Source:
<code>public String toString() { StringBuilder fsBuilder = new StringBuilder(); for (Map.Entry<String, String> address : addresses.entrySet()) { fsBuilder.append("<nuage-extension>\n"); <START> fsBuilder.append(" <interface mac='" + address.getKey() + "' vsp-vr-ip='" + address.getValue() + "'></interface>\n"); <END> fsBuilder.append("</nuage-extension>\n"); } return fsBuilder.toString(); }</code><technical_language>Performing string append operations a StringBuilder defeats purpose of class. Please change avoid unnecessary string re-allocation: fsBuilder.append(" <interface mac='") .append(address.getKey() ) .append("' vsp-vr-ip='") .append(address.getValue()) .append("'></interface>\n");</technical_language>

Target:
public String toString() { StringBuilder fsBuilder = new StringBuilder(); for (Map.Entry<String, String> address : addresses.entrySet()) { fsBuilder.append("<nuage-extension>\n") .append(" <interface mac='") .append(address.getKey()) .append("' vsp-vr-ip='") .append(address.getValue()) .append("'></interface>\n") .append("</nuage-extension>\n"); } return fsBuilder.toString(); }
Source:
<code>public void testReferenceCountingWhileQueryExecuting() throws Exception { loadQueryable("test", "3", new Interval("2011-04-04/2011-04-05")); Future future = assertQueryable( QueryGranularity.DAY, "test", new Interval("2011-04-04/2011-04-06"), ImmutableList.<Pair<String, Interval>>of( new Pair<String, Interval>("3", new Interval("2011-04-04/2011-04-05")) ) ); <START> queryNotifyLatch.await(); <END> Assert.assertEquals(1, factory.getSegmentReferences().size()); for (ReferenceCountingSegment referenceCountingSegment : factory.getSegmentReferences()) { Assert.assertEquals(1, referenceCountingSegment.getNumReferences()); } queryWaitYieldLatch.countDown(); Assert.assertEquals(1, factory.getAdapters().size()); for (SegmentForTesting segmentForTesting : factory.getAdapters()) { Assert.assertFalse(segmentForTesting.isClosed()); } dropQueryable("test", "3", new Interval("2011-04-04/2011-04-05")); for (SegmentForTesting segmentForTesting : factory.getAdapters()) { Assert.assertFalse(segmentForTesting.isClosed()); } queryWaitLatch.countDown(); future.get(); for (SegmentForTesting segmentForTesting : factory.getAdapters()) { Assert.assertTrue(segmentForTesting.isClosed()); } }</code><technical_language>guaranteed test get stuck if fails test</technical_language>

Target:
public void testReferenceCountingWhileQueryExecuting() throws Exception { loadQueryable("test", "3", new Interval("2011-04-04/2011-04-05")); Future future = assertQueryable( QueryGranularity.DAY, "test", new Interval("2011-04-04/2011-04-06"), ImmutableList.<Pair<String, Interval>>of( new Pair<String, Interval>("3", new Interval("2011-04-04/2011-04-05")) ) ); queryNotifyLatch.await(1000, TimeUnit.MILLISECONDS); Assert.assertEquals(1, factory.getSegmentReferences().size()); for (ReferenceCountingSegment referenceCountingSegment : factory.getSegmentReferences()) { Assert.assertEquals(1, referenceCountingSegment.getNumReferences()); } queryWaitYieldLatch.countDown(); Assert.assertEquals(1, factory.getAdapters().size()); for (SegmentForTesting segmentForTesting : factory.getAdapters()) { Assert.assertFalse(segmentForTesting.isClosed()); } dropQueryable("test", "3", new Interval("2011-04-04/2011-04-05")); for (SegmentForTesting segmentForTesting : factory.getAdapters()) { Assert.assertFalse(segmentForTesting.isClosed()); } queryWaitLatch.countDown(); future.get(); for (SegmentForTesting segmentForTesting : factory.getAdapters()) { Assert.assertTrue(segmentForTesting.isClosed()); } }
Source:
<code>public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateErrorEventCatching emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_OUTGOING_EDGE_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); <START> assertErrorEventExecutionSet(emptyEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, ""); <END> assertDataIOSet(emptyEvent.getDataIOSet(), EMPTY_VALUE); }</code><technical_language>suggestion assertErrorEventExecutionSet(emptyEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateErrorEventCatching emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_OUTGOING_EDGE_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertErrorEventExecutionSet(emptyEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE); assertDataIOSet(emptyEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
<code>protected @Nullable ITmfTreeViewerEntry updateElements(long start, long end, boolean isSelection) { TmfAbstractAnalysisModule analysisModule = getStatisticsAnalysisModule(); if (getTrace() == null || !(analysisModule instanceof AbstractSegmentStatisticsAnalysis)) { return null; } AbstractSegmentStatisticsAnalysis module = (AbstractSegmentStatisticsAnalysis) analysisModule; module.waitForCompletion(); TmfTreeViewerEntry root = new TmfTreeViewerEntry(""); List<ITmfTreeViewerEntry> entryList = root.getChildren(); if (isSelection) { setStats(start, end, entryList, module, getSelectionLabel(), new NullProgressMonitor()); } <START> setStats(start, end, entryList, module, getTotalLabel(), new NullProgressMonitor()); <END> return root; }</code><technical_language>no, I do all. I total statistics set if is a selection is need set again</technical_language>

Target:
protected @Nullable ITmfTreeViewerEntry updateElements(long start, long end, boolean isSelection) { TmfAbstractAnalysisModule analysisModule = getStatisticsAnalysisModule(); if (getTrace() == null || !(analysisModule instanceof AbstractSegmentStatisticsAnalysis)) { return null; } AbstractSegmentStatisticsAnalysis module = (AbstractSegmentStatisticsAnalysis) analysisModule; module.waitForCompletion(); TmfTreeViewerEntry root = new TmfTreeViewerEntry(""); List<ITmfTreeViewerEntry> entryList = root.getChildren(); if (isSelection) { setStats(start, end, entryList, module, true, new NullProgressMonitor()); } setStats(start, end, entryList, module, false, new NullProgressMonitor()); return root; }
Source:
<code>public void prefetchChildren(AlluxioURI path, MountTable mountTable) { if (mPrefetchExecutor == null) { return; } try { <START> Future<Collection<UfsStatus>> fute = <END> mPrefetchExecutor.submit(() -> getChildrenIfAbsent(path, mountTable)); Future<Collection<UfsStatus>> prev = mActivePrefetchJobs.put(path, fute); if (prev != null) { prev.cancel(true); } } catch (RejectedExecutionException e) { LOG.debug("Failed to submit prefetch job", e); } }</code><technical_language>hrmmm, is fute a real term? I familiar it..</technical_language>

Target:
public Future<Collection<UfsStatus>> prefetchChildren(AlluxioURI path, MountTable mountTable) { if (mPrefetchExecutor == null) { return null; } try { Future<Collection<UfsStatus>> job = mPrefetchExecutor.submit(() -> getChildrenIfAbsent(path, mountTable)); Future<Collection<UfsStatus>> prev = mActivePrefetchJobs.put(path, job); if (prev != null) { prev.cancel(true); } return job; } catch (RejectedExecutionException e) { LOG.debug("Failed to submit prefetch job for path {}", path, e); return null; } }
Source:
<code>public String getRegexToolPattern() { return <START> String.format("%1$s(?<%2$s>[0-9]{1,}.[0-9])[_|-]{1}(?<%3$s>[0-9]{1,})[.0-9a-z]*.[i|I][s|S][o|O]$", <END> getGuestToolsSetupIsoPrefix(), TOOL_CLUSTER_LEVEL, TOOL_VERSION); }</code><technical_language>this character class replaced [.\\w], is important matches lowercase characters</technical_language>

Target:
public String getRegexToolPattern() { return String.format("%1$s(?<%2$s>[0-9]{1,}.[0-9])[_|-]{1}(?<%3$s>[0-9]{1,})[.\\w]*.[i|I][s|S][o|O]$", getGuestToolsSetupIsoPrefix(), TOOL_CLUSTER_LEVEL, TOOL_VERSION); }
Source:
<code>public String getCategoryId() { <START> return "uncategorized"; <END> }</code><technical_language>this nested-projects</technical_language>

Target:
public String getCategoryId() { return "nested-projects"; }
Source:
<code>public static boolean isNotResolved(Bundle bundle) { <START> return bundle.getState() == Bundle.INSTALLED || bundle.getState() == Bundle.UNINSTALLED; <END> }</code><technical_language>java return (bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) != 0;</technical_language>

Target:
public static boolean isNotResolved(Bundle bundle) { return (bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) != 0; }
Source:
<code>private void start(boolean cleanQueues) { this.getLifeCycleLock().writeLock().lock(); try { if (isRunning()) { logger.warn("Gateway Sender is already running", this.getId()); return; } if (this.remoteDSId != DEFAULT_DISTRIBUTED_SYSTEM_ID) { String locators = this.cache.getInternalDistributedSystem().getConfig().getLocators(); if (locators.length() == 0) { throw new IllegalStateException( "Locators must be configured before starting gateway-sender."); } } eventProcessor = new ConcurrentParallelGatewaySenderEventProcessor(this, getThreadMonitorObj(), cleanQueues); if (startEventProcessorInPausedState) { pauseEvenIfProcessorStopped(); } eventProcessor.start(); waitForRunningStatus(); if (!isAsyncEventQueue()) { getCache().getPdxRegistry().gatewaySenderStarted(this); } new UpdateAttributesProcessor(this).distribute(false); InternalDistributedSystem system = (InternalDistributedSystem) this.cache.getDistributedSystem(); system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_START, this); logger.info("Started {}", this); enqueueTempEvents(); <START> startTime = System.currentTimeMillis(); <END> } finally { this.getLifeCycleLock().writeLock().unlock(); } }</code><technical_language>startTime set logger.info</technical_language>

Target:
private void start(boolean cleanQueues) { this.getLifeCycleLock().writeLock().lock(); try { if (isRunning()) { logger.warn("Gateway Sender is already running", this.getId()); return; } if (this.remoteDSId != DEFAULT_DISTRIBUTED_SYSTEM_ID) { String locators = this.cache.getInternalDistributedSystem().getConfig().getLocators(); if (locators.length() == 0) { throw new IllegalStateException( "Locators must be configured before starting gateway-sender."); } } eventProcessor = new ConcurrentParallelGatewaySenderEventProcessor(this, getThreadMonitorObj(), cleanQueues); if (startEventProcessorInPausedState) { pauseEvenIfProcessorStopped(); } eventProcessor.start(); waitForRunningStatus(); startTime = System.currentTimeMillis(); if (!isAsyncEventQueue()) { getCache().getPdxRegistry().gatewaySenderStarted(this); } new UpdateAttributesProcessor(this).distribute(false); InternalDistributedSystem system = (InternalDistributedSystem) this.cache.getDistributedSystem(); system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_START, this); logger.info("Started {}", this); enqueueTempEvents(); } finally { this.getLifeCycleLock().writeLock().unlock(); } }
Source:
<code>public DepthwiseConvolution2D clone() { DepthwiseConvolution2D clone = (DepthwiseConvolution2D) super.clone(); if (clone.kernelSize != null) clone.kernelSize = clone.kernelSize.clone(); if (clone.stride != null) clone.stride = clone.stride.clone(); if (clone.padding != null) <START> clone.padding = clone.padding.clone(); <END> return clone; }</code><technical_language>Clone method is wrong. Kernel/stride/padding handled in superclass clone. set depth multiplier</technical_language>

Target:
public DepthwiseConvolution2D clone() { DepthwiseConvolution2D clone = (DepthwiseConvolution2D) super.clone(); clone.depthMultiplier = depthMultiplier; return clone; }
Source:
<code>public List<ClientModel> getClients(RealmModel realm) { TypedQuery<ClientEntity> query = em.createNamedQuery("getClientsByRealm", ClientEntity.class); Set<ClientEntity> result = null; Map<String, Set<RoleModel>> rolesMap = new TreeMap<>(); query.setParameter("realm", realm.getId()); <START> for (Tuple t : em.createNamedQuery("realmScopeMappingIds", Tuple.class).setParameter("realm", realm.getId()).getResultList()) { <END> rolesMap.computeIfAbsent(t.get(0, String.class), k -> new HashSet<>()) .add(realm.getRoleById(t.get(1, String.class))); } result = new HashSet<>(query.getResultList()); if (!result.isEmpty()) { for (String name : GET_CLIENTS_REALM_GRAPH_JOIN) { query.setHint(JPAConstants.LOADGRAPH, em.getEntityGraph(name)); result.addAll(query.getResultList()); } } result.forEach(clientEntity -> { if (!rolesMap.containsKey(clientEntity.getId())) { rolesMap.put(clientEntity.getId(), Collections.emptySet()); } }); return result.stream().map(app -> new PrefetchClientAdapter(realm, em, session, app, rolesMap.get(app.getId()))) .collect(Collectors.collectingAndThen( Collectors.toList(), Collections::unmodifiableList)); }</code><technical_language>is more readable? java rolesMap = em.createNamedQuery("realmScopeMappingIds", Tuple.class) .setParameter("realm", realm.getId()) .getResultList()) .stream() .collect(t -> Collectors::groupingBy(t.get(0, String.class), Collectors::mapping(t -> t.get(1, String.class), Collectors::toSet())</technical_language>

Target:
public List<ClientModel> getClients(RealmModel realm) { TypedQuery<String> query = em.createNamedQuery("getClientIdsByRealm", String.class); query.setParameter("realm", realm.getId()); List<String> clients = query.getResultList(); if (clients.isEmpty()) return Collections.EMPTY_LIST; List<ClientModel> list = new LinkedList<>(); for (String id : clients) { ClientModel client = session.realms().getClientById(id, realm); if (client != null) list.add(client); } return Collections.unmodifiableList(list); }
Source:
<code>public StoreClientFactory( Configs configs, int requestTimeoutInSeconds, int maxConcurrentConnectionOpenRequests, UserAgentContainer userAgent, boolean enableTransportClientSharing) { this.configs = configs; this.protocol = configs.getProtocol(); this.requestTimeoutInSeconds = requestTimeoutInSeconds; this.maxConcurrentConnectionOpenRequests = maxConcurrentConnectionOpenRequests; this. enableTransportClientSharing = enableTransportClientSharing; if (protocol == Protocol.HTTPS) { this.transportClient = new HttpTransportClient(configs, requestTimeoutInSeconds, userAgent); } else if (protocol == Protocol.TCP){ <START> if (enableTransportClientSharing) { <END> this.transportClient = SharedRntbdTransportClient.getOrCreateInstance(configs, requestTimeoutInSeconds, userAgent); } else { this.transportClient = new RntbdTransportClient(configs, requestTimeoutInSeconds, userAgent); } } else { throw new IllegalArgumentException(String.format("protocol: %s", this.protocol)); } }</code><technical_language>sharing transport agnostic</technical_language>

Target:
public StoreClientFactory( Configs configs, int requestTimeoutInSeconds, int maxConcurrentConnectionOpenRequests, UserAgentContainer userAgent, boolean enableTransportClientSharing) { this.configs = configs; this.protocol = configs.getProtocol(); this.requestTimeoutInSeconds = requestTimeoutInSeconds; this.maxConcurrentConnectionOpenRequests = maxConcurrentConnectionOpenRequests; this.enableTransportClientSharing = enableTransportClientSharing; if (enableTransportClientSharing) { this.transportClient = SharedTransportClient.getOrCreateInstance(protocol, configs, requestTimeoutInSeconds, userAgent); } else { if (protocol == Protocol.HTTPS) { this.transportClient = new HttpTransportClient(configs, requestTimeoutInSeconds, userAgent); } else if (protocol == Protocol.TCP) { this.transportClient = new RntbdTransportClient(configs, requestTimeoutInSeconds, userAgent); } else { throw new IllegalArgumentException(String.format("protocol: %s", this.protocol)); } } }
Source:
<code>public void setup() { ClassOrInterfaceDeclaration fakeObject = new ClassOrInterfaceDeclaration(); <START> fakeObject.setName(new SimpleName("java.lang.Object")); <END> final MethodDeclaration equals = fakeObject.addMethod("equals", Modifier.PUBLIC); equals.addParameter("java.lang.Object", "obj"); final BlockStmt body = new BlockStmt(); body.addStatement("return this == obj;"); equals.setBody(body); TypeSolver typeSolver = new TypeSolver() { @Override public TypeSolver getParent() { return null; } @Override public void setParent(TypeSolver parent) { } @Override public SymbolReference<ResolvedReferenceTypeDeclaration> tryToSolveType(String name) { if ("java.lang.Object".equals(name)) { return SymbolReference.solved(new JavaParserClassDeclaration(fakeObject, this)); } return SymbolReference.unsolved(ResolvedReferenceTypeDeclaration.class); } }; ParserConfiguration config = new ParserConfiguration(); config.setSymbolResolver(new JavaSymbolSolver(typeSolver)); javaParser = new JavaParser(config); }</code><technical_language>I SimpleName dots. want set a package declaration instead</technical_language>

Target:
public void setup() { final CompilationUnit compilationUnit = new CompilationUnit(); compilationUnit.setPackageDeclaration("java.lang"); final ClassOrInterfaceDeclaration clazz = compilationUnit.addClass("Object", Modifier.PUBLIC); final MethodDeclaration equals = clazz.addMethod("equals", Modifier.PUBLIC); equals.addParameter("Object", "obj"); final BlockStmt body = new BlockStmt(); body.addStatement("return this == obj;"); equals.setBody(body); TypeSolver typeSolver = new TypeSolver() { @Override public TypeSolver getParent() { return null; } @Override public void setParent(TypeSolver parent) { } @Override public SymbolReference<ResolvedReferenceTypeDeclaration> tryToSolveType(String name) { if ("java.lang.Object".equals(name)) { return SymbolReference.solved(new JavaParserClassDeclaration(clazz, this)); } return SymbolReference.unsolved(ResolvedReferenceTypeDeclaration.class); } }; ParserConfiguration config = new ParserConfiguration(); config.setSymbolResolver(new JavaSymbolSolver(typeSolver)); javaParser = new JavaParser(config); }
Source:
<code>public void testNotFoundKey() { final List<String> testStrings = new ArrayList<>(3); Method getLineNumber = null; try { getLineNumber = UniquePropertiesCheck.class.getDeclaredMethod( "getLineNumber", FileText.class, String.class); } catch (NoSuchMethodException ex) { <START> LOG.debug("NoSuchMethodException occurred.", ex); <END> } getLineNumber.setAccessible(true); testStrings.add(""); testStrings.add("0 = 0"); testStrings.add("445"); final FileText fileText = new FileText(new File("some.properties"), testStrings); Object lineNumber = null; try { lineNumber = getLineNumber.invoke(UniquePropertiesCheck.class, fileText, "some key"); } catch (IllegalAccessException ex) { LOG.debug("IllegalAccessException occurred.", ex); } catch (InvocationTargetException ex) { LOG.debug("InvocationTargetException occurred.", ex); } assertEquals("Invalid line number", 0, lineNumber); }</code><technical_language>This is similar a try-catch-fail **worse**. If method found, logging exception JUnit pass. logs for a failure, success care. If method throw exception out of method runner fail display failure stack trace user. try-catch</technical_language>

Target:
public void testNotFoundKey() throws Exception { final List<String> testStrings = new ArrayList<>(3); final Method getLineNumber = UniquePropertiesCheck.class.getDeclaredMethod( "getLineNumber", FileText.class, String.class); Assert.assertNotNull(getLineNumber); getLineNumber.setAccessible(true); testStrings.add(""); testStrings.add("0 = 0"); testStrings.add("445"); final FileText fileText = new FileText(new File("some.properties"), testStrings); final Object lineNumber = getLineNumber.invoke(UniquePropertiesCheck.class, fileText, "some key"); Assert.assertNotNull(lineNumber); assertEquals("Invalid line number", 0, lineNumber); }
Source:
<code>public void nest(Node node){ <START> Pane nestSPace = (Pane) this.lookup("#nest_space"); <END> ((Label) this.lookup("#label_function_name")).setText("Higher order function"); nestSPace.getChildren().add(node); }</code><technical_language>Is a nestSPace, nestSpace, nestPane</technical_language>

Target:
public void nest(Node node) { Pane nestSpace = (Pane) this.lookup("#nest_space"); ((Label) this.lookup("#label_function_name")).setText("Higher order function"); nestSpace.getChildren().add(node); }