auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void run() { String originalText = editor.getCurrentTab().getSelectedText(); boolean selection = true; if(originalText == null || originalText.isEmpty()) { originalText = editor.getCurrentTab().getText(); selection = false; } String formattedText = aStyleInterface.AStyleMain(originalText, formatterConfiguration); if (formattedText.equals(originalText)) { editor.statusNotice(tr("No changes necessary for Auto Format.")); return; } if(selection) editor.getCurrentTab().setSelectedText(formattedText); else editor.getCurrentTab().setText(formattedText); editor.statusNotice(tr("Auto Format finished.")); }

Target:
public void run() { SketchTextArea textArea = editor.getCurrentTab().getTextArea(); String originalText = textArea.getSelectedText(); if (originalText == null || originalText.isEmpty()) { String formattedText = aStyleInterface.AStyleMain(textArea.getText(), formatterConfiguration); editor.getCurrentTab().setText(formattedText); } else { try { String FORMAT_ON = "\n String FORMAT_OFF = "\n RSyntaxDocument content = (RSyntaxDocument) textArea.getDocument(); textArea.beginAtomicEdit(); int selStart = editor.getCurrentTab().getSelectionStart(); int selEnd = editor.getCurrentTab().getSelectionStop(); int lineStart = textArea.getLineOfOffset(selStart); int lineEnd = textArea.getLineOfOffset(selEnd); int fristLineOffset = textArea.getLineStartOffset(lineStart); int lastLineOffset = textArea.getLineEndOffset(lineEnd); fristLineOffset = navigateOffComments(textArea, fristLineOffset); lastLineOffset = navigateOffComments(textArea, lastLineOffset); int offLength = FORMAT_OFF.length(); int onLength = FORMAT_ON.length(); content.insertString(0, FORMAT_OFF, null); content.insertString(fristLineOffset + offLength, FORMAT_ON, null); content.insertString(lastLineOffset + offLength + onLength, FORMAT_OFF,null); originalText = content.getText(0, content.getLength()); String formattedText = aStyleInterface.AStyleMain(originalText, formatterConfiguration); formattedText = formattedText.replaceAll(Pattern.quote(FORMAT_OFF), ""); formattedText = formattedText.replaceAll(Pattern.quote(FORMAT_ON), ""); textArea.setText(formattedText); textArea.select(selStart, selStart); } catch (BadLocationException e) { editor.statusNotice(tr("Auto Format Error") + ": " + e.getLocalizedMessage()); e.printStackTrace(); return; } finally { textArea.endAtomicEdit(); } } editor.statusNotice(tr("Auto Format finished.")); }
Source:
protected void initialize() { LogKitten.d("MotorControl initialized"); if (motor instanceof PositionSensorMotor) { ((PositionSensorMotor) motor).disableMC(); } }

Target:
protected void initialize() { LogKitten.d("MotorControl initialized"); if (motor instanceof PositionSensorMotor) { ((PositionSensorMotor) motor).disableMotionController(); } }
Source:
private List<String> loadColumnFamilyNames() throws IOException { final List<String> cfNames = new ArrayList<>(); final Path file = rocksdbDir.resolve(CF_NAMES_FILENAME); if(Files.exists(file)) { try (final LineNumberReader reader = new LineNumberReader(new InputStreamReader(Files.newInputStream(file), UTF_8))) { String line = null; while ((line = reader.readLine()) != null) { cfNames.add(line); } } } return cfNames; }

Target:
private List<String> loadColumnFamilyNames() throws IOException { final List<String> cfNames = new ArrayList<>(); final Path file = rocksDbDir.resolve(COLUMN_FAMILY_NAMES_FILENAME); if(Files.exists(file)) { try (final LineNumberReader reader = new LineNumberReader(Files.newBufferedReader(file, UTF_8))) { String line = null; while ((line = reader.readLine()) != null) { cfNames.add(line); } } } return cfNames; }
Source:
public static String getPreviewURL(DocumentModel doc, String xpath) { StringJoiner sj = new StringJoiner("/", "", "/") .add(REST_API_PREFIX) .add("repo").add(doc.getRepositoryName()) .add("id").add(doc.getId()); if (xpath != null) { sj.add("@blob").add(xpath); } String result = sj.add("@preview").toString(); String ct = doc.getChangeToken(); if (StringUtils.isNoneBlank(ct)) { result += "?" + CoreSession.CHANGE_TOKEN + "=" + doc.getChangeToken(); } return result; }

Target:
public static String getPreviewURL(DocumentModel doc, String xpath) { StringJoiner sj = new StringJoiner("/", "", "/") .add(REST_API_PREFIX) .add("repo").add(doc.getRepositoryName()) .add("id").add(doc.getId()); if (xpath != null) { sj.add("@blob").add(xpath); } String result = sj.add("@preview").toString(); String ct = doc.getChangeToken(); if (StringUtils.isNotBlank(ct)) { try { result += "?" + CoreSession.CHANGE_TOKEN + "=" + URLEncoder.encode(ct, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new PreviewException(e); } } return result; }
Source:
public Emitter getEmitter( Supplier<HttpEmitterConfig> config, @Nullable SSLContext sslContext, Lifecycle lifecycle, ObjectMapper jsonMapper ) { final DefaultAsyncHttpClientConfig.Builder builder = new DefaultAsyncHttpClientConfig.Builder(); if (sslContext != null) { builder.setSslContext(new JdkSslContext(sslContext, true, ClientAuth.NONE)); } builder.setThreadFactory(new DefaultThreadFactory("emitter-http-client", true)); final AsyncHttpClient client = new DefaultAsyncHttpClient(builder.build()); lifecycle.addCloseableInstance(client); return new HttpPostEmitter(config.get(), client, jsonMapper); }

Target:
public Emitter getEmitter( Supplier<HttpEmitterConfig> config, @Nullable SSLContext sslContext, Lifecycle lifecycle, ObjectMapper jsonMapper ) { return new HttpPostEmitter( config.get(), lifecycle.addCloseableInstance( createAsyncHttpClient("HttpPostEmitter-AsyncHttpClient-%d", sslContext) ), jsonMapper ); }
Source:
protected void eventHandle(@NonNull ITmfEvent event) { Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpu == null) { return; } ITmfStateSystemBuilder ssb = getStateSystemBuilder(); if (ssb == null) { return; } Integer cpuQuark = fCpuNumToQuark.get(cpu); if (cpuQuark == null) { try { String cpuAttributeName = NonNullUtils.nullToEmptyString(cpu); cpuQuark = ssb.getQuarkAbsoluteAndAdd(cpuAttributeName); fCpuNumToQuark.put(cpu, cpuQuark); ssb.modifyAttribute(0, TmfStateValue.nullValue(), cpuQuark); } catch (StateValueTypeException | AttributeNotFoundException e) { throw new IllegalStateException(e); } } if (!event.getName().equals(fSchedSwitch)) { return; } try { int nextTid = ((Long) event.getContent().getField(fNextTid).getValue()).intValue(); final TmfStateValue value = TmfStateValue.newValueInt(nextTid); ssb.modifyAttribute(event.getTimestamp().toNanos(), value, cpuQuark); } catch (StateValueTypeException | AttributeNotFoundException e) { Activator.getDefault().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e); } }

Target:
protected void eventHandle(@NonNull ITmfEvent event) { Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpu == null) { return; } ITmfStateSystemBuilder ssb = getStateSystemBuilder(); if (ssb == null) { return; } Integer cpuQuark = fCpuNumToQuark.get(cpu); if (cpuQuark == null) { try { String cpuAttributeName = NonNullUtils.nullToEmptyString(cpu); cpuQuark = ssb.getQuarkAbsoluteAndAdd(cpuAttributeName); fCpuNumToQuark.put(cpu, cpuQuark); } catch (StateValueTypeException e) { throw new IllegalStateException(e); } } if (!event.getName().equals(fSchedSwitch)) { return; } try { int nextTid = ((Long) event.getContent().getField(fNextTid).getValue()).intValue(); final TmfStateValue value = TmfStateValue.newValueInt(nextTid); ssb.modifyAttribute(event.getTimestamp().toNanos(), value, cpuQuark); } catch (StateValueTypeException | AttributeNotFoundException e) { Activator.getDefault().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e); } }
Source:
public String toString() { return new ToStringBuilder(this, SHORT_CLASS_NAME_STYLE).append(DataList.this) .append("future", future == null ? null : future.getClass().getSimpleName() + '@' + Integer.toHexString(System.identityHashCode(future))) .append("isMoreDataAvailable", isMoreDataAvailable).toString(); }

Target:
public String toString() { return new ToStringBuilder(this, ToStringStyle.DEFAULT).append(DataList.this) .append("future", future == null ? null : future.getClass().getSimpleName() + '@' + Integer.toHexString(System.identityHashCode(future))) .append("isMoreDataAvailable", isMoreDataAvailable).toString(); }
Source:
public void testCapture() throws IllegalStateException { URI uri = api().capture(getName(), getName(), getName()); if (uri != null){ boolean jobDone = Predicates2.retry(new Predicate<URI>() { @Override public boolean apply(URI uri) { try { List<ResourceDefinition> definitions = api.getJobApi().captureStatus(uri); if (definitions != null) { for (ResourceDefinition definition : definitions) { LinkedTreeMap<String, String> properties = (LinkedTreeMap<String, String>) definition.properties(); Object storageObject = properties.get("storageProfile"); LinkedTreeMap<String, String> properties2 = (LinkedTreeMap<String, String>) storageObject; Object osDiskObject = properties2.get("osDisk"); LinkedTreeMap<String, String> osProperties = (LinkedTreeMap<String, String>) osDiskObject; Object dataDisksObject = properties2.get("dataDisks"); ArrayList<Object> dataProperties = (ArrayList<Object>) dataDisksObject; LinkedTreeMap<String, String> datadiskObject = (LinkedTreeMap<String, String>) dataProperties.get(0); Assert.assertNotNull(osProperties.get("name")); Assert.assertNotNull(datadiskObject.get("name")); } return true; } assert true; return false; } catch (Exception e) { assert true; return false; } } }, 15 * 1000 ).apply(uri); } }

Target:
public void testCapture() throws IllegalStateException { URI uri = api().capture(getName(), getName(), getName()); if (uri != null) { if (imageAvailablePredicate.apply(uri)) { List<ResourceDefinition> definitions = api.getJobApi().captureStatus(uri); if (definitions != null) { for (ResourceDefinition definition : definitions) { LinkedTreeMap<String, String> properties = (LinkedTreeMap<String, String>) definition.properties(); Object storageObject = properties.get("storageProfile"); LinkedTreeMap<String, String> properties2 = (LinkedTreeMap<String, String>) storageObject; Object osDiskObject = properties2.get("osDisk"); LinkedTreeMap<String, String> osProperties = (LinkedTreeMap<String, String>) osDiskObject; Object dataDisksObject = properties2.get("dataDisks"); ArrayList<Object> dataProperties = (ArrayList<Object>) dataDisksObject; LinkedTreeMap<String, String> datadiskObject = (LinkedTreeMap<String, String>) dataProperties.get(0); Assert.assertNotNull(osProperties.get("name")); Assert.assertNotNull(datadiskObject.get("name")); } } } } }
Source:
private List<DispoItem> createItems(Map<String, DispoItem> exisitingItems, OperationReport report) { List<DispoItem> toReturn; Collection<DispoItemData> values = datIdToItem.values(); for (DispoItemData item : values) { dataFactory.initDispoItem(item); item.setTotalPoints(String.valueOf(item.getAnnotationsList().length() + item.getDiscrepanciesList().length())); } if (!exisitingItems.isEmpty()) { DispoSetCopier copier = new DispoSetCopier(dispoConnector); List<DispoItemData> itemsFromImport = new ArrayList<DispoItemData>(); itemsFromImport.addAll(values); Map<String, DispoItemData> nameToItem = new HashMap<String, DispoItemData>(); for (DispoItemData item : itemsFromImport) { nameToItem.put(item.getName(), item); } toReturn = copier.copyAllDispositions(nameToItem, exisitingItems.values(), false, report); } else { toReturn = new ArrayList<DispoItem>(); toReturn.addAll(values); } for (DispoItem item : toReturn) { if (item.getStatus().equalsIgnoreCase("incomplete")) { createPlaceHolderAnnotations((DispoItemData) item); } } return toReturn; }

Target:
private List<DispoItem> createItems(Map<String, DispoItem> exisitingItems, OperationReport report) { List<DispoItem> toReturn; Collection<DispoItemData> values = datIdToItem.values(); for (DispoItemData item : values) { dataFactory.initDispoItem(item); item.setTotalPoints(String.valueOf(item.getAnnotationsList().length() + item.getDiscrepanciesList().length())); } if (!exisitingItems.isEmpty()) { DispoSetCopier copier = new DispoSetCopier(dispoConnector); List<DispoItemData> itemsFromImport = new ArrayList<>(); itemsFromImport.addAll(values); Map<String, DispoItemData> nameToItem = new HashMap<>(); for (DispoItemData item : itemsFromImport) { nameToItem.put(item.getName(), item); } toReturn = copier.copyAllDispositions(nameToItem, exisitingItems.values(), false, report); } else { toReturn = new ArrayList<>(); toReturn.addAll(values); } for (DispoItem item : toReturn) { if (item.getStatus().equalsIgnoreCase("incomplete")) { createPlaceHolderAnnotations((DispoItemData) item); } } return toReturn; }
Source:
public void deleteBlob(String blobIdString) throws CoordinatorException { OperationContext oc = getOperationContext(); BlobId blobId = getBlobIdFromString(blobIdString); new DeleteOperation(datacenterName, connectionPool, requesterPool, oc, blobId, operationTimeoutMs).execute(); }

Target:
public void deleteBlob(String blobIdString) throws CoordinatorException { BlobId blobId = getBlobIdFromString(blobIdString); DeleteOperation deleteOperation = new DeleteOperation(datacenterName, connectionPool, requesterPool, getOperationContext(), blobId, operationTimeoutMs); deleteOperation.execute(); }
Source:
public void testServiceTopologyInitializationDelayed() throws Exception { IgniteEx loc = startGrids(NODES_CNT); IgniteEx rmt = grid(NODES_CNT - 1); deployServices(loc); fullMsgReceivedLatch.await(getTestTimeout(), MILLISECONDS); IgniteInternalFuture<Boolean> decentSvcFut = runAsync(() -> rmt.services().serviceProxy(DECENT_SRVC, Invoker.class, false).invoke()); IgniteInternalFuture<Boolean> brokenSvcFut = runAsync(() -> rmt.services().serviceProxy(BROKEN_SRVC, Invoker.class, false).invoke()); U.sleep(500); assertFalse(decentSvcFut.isDone()); assertFalse(brokenSvcFut.isDone()); fullMsgUnblockedLatch.countDown(); assertTrue(decentSvcFut.get(getTestTimeout())); assertThrowsWithCause(() -> brokenSvcFut.get(getTestTimeout()), IgniteException.class); }

Target:
public void testServiceTopologyInitializationDelayed() throws Exception { IgniteEx loc = startGrids(NODES_CNT); IgniteEx rmt = grid(NODES_CNT - 1); assertEquals(1, fullMsgReceivedLatch.getCount()); deployServices(loc); assertTrue(fullMsgReceivedLatch.await(getTestTimeout(), MILLISECONDS)); IgniteInternalFuture<Boolean> decentSvcFut = runAsync(() -> rmt.services().serviceProxy(DECENT_SRVC, Invoker.class, false).invoke()); IgniteInternalFuture<Boolean> brokenSvcFut = runAsync(() -> rmt.services().serviceProxy(BROKEN_SRVC, Invoker.class, false).invoke()); U.sleep(500); assertEquals(1, fullMsgUnblockedLatch.getCount()); assertFalse(decentSvcFut.isDone()); assertFalse(brokenSvcFut.isDone()); fullMsgUnblockedLatch.countDown(); assertTrue(decentSvcFut.get(getTestTimeout())); assertThrowsWithCause(() -> brokenSvcFut.get(getTestTimeout()), IgniteException.class); }
Source:
public synchronized void start() { if (live) { return; } if (!registry.isOpen()) { throw new IllegalStateException("Networking Service is already shutdown. Cannot start!"); } live = true; logger.finest("Starting Networking Service and IO selectors."); networking.restart(); startAcceptor(); if (unifiedEndpointManager == null) { refreshStatsFuture = metricsRegistry.scheduleAtFixedRate(refreshStatsTask, 1, SECONDS, ProbeLevel.INFO); refreshStatsTask.registerMetrics(); } }

Target:
public synchronized void start() { if (live) { return; } if (!registry.isOpen()) { throw new IllegalStateException("Networking Service is already shutdown. Cannot start!"); } live = true; logger.finest("Starting Networking Service and IO selectors."); networking.restart(); startAcceptor(); if (unifiedEndpointManager == null) { refreshStatsFuture = metricsRegistry.scheduleAtFixedRate(refreshStatsTask, refreshStatsIntervalSeconds, SECONDS, ProbeLevel.INFO); } }
Source:
public String toString() { return "atomatic"; }

Target:
public String toString() { return "stretch"; }
Source:
public static boolean isAcronymValid(String acronym) { return acronym != null && !acronym.isEmpty() && !ACRONYM_SKIP_LOWERCASED_VALUES.contains(acronym.trim().toLowerCase()); }

Target:
public static boolean isAcronymValid(String acronym) { return !StringUtils.isEmpty(acronym) && !ACRONYM_SKIP_LOWERCASED_VALUES.contains(acronym.trim().toLowerCase()); }
Source:
public Set<String> getChangedFieldsForStatus(VmStatic source, VmStatic destination, VmManagementParametersBase params, VMStatus status) { List<String> fields = updateVmsStatic.getChangedFieldsForStatus(source, destination, status); List<VmDeviceUpdate> devices = getVmDevicesFieldsToUpdateOnNextRun(source.getId(), status, params); fields.addAll(devices.stream().map(d -> d.getName()).collect(Collectors.toList())); return new HashSet<>(fields); }

Target:
public Set<String> getChangedFieldsForStatus(VmStatic source, VmStatic destination, VmManagementParametersBase params, VMStatus status) { List<String> fields = updateVmsStatic.getChangedFieldsForStatus(source, destination, status); List<VmDeviceUpdate> devices = getVmDevicesFieldsToUpdateOnNextRun(source.getId(), status, params); fields.addAll(devices.stream().map(VmDeviceUpdate::getName).collect(Collectors.toList())); return new HashSet<>(fields); }
Source:
public void changesDeliveredToIndexWriter() throws Exception { LuceneIndexWriter writer = mock( LuceneIndexWriter.class ); NonUniqueLuceneIndexPopulatingUpdater updater = newUpdater( writer ); String expectedString1 = documentRepresentingProperties( (long) 1, "after1" ).toString(); String expectedString2 = documentRepresentingProperties( (long) 2, "after2" ).toString(); String expectedString3 = documentRepresentingProperties( 3, "bit", "after2" ).toString(); updater.process( change( 1, SCHEMA_DESCRIPTOR, "before1", "after1" ) ); verifydocument( writer, newTermForChangeOrRemove( 1 ), expectedString1 ); updater.process( change( 2, SCHEMA_DESCRIPTOR, "before2", "after2" ) ); verifydocument( writer, newTermForChangeOrRemove( 2 ), expectedString2 ); updater.process( change( 3, COMPOSITE_SCHEMA_DESCRIPTOR, new Object[]{"bit", "before2"}, new Object[]{"bit", "after2"} ) ); verifydocument( writer, newTermForChangeOrRemove( 3 ), expectedString3 ); }

Target:
public void changesDeliveredToIndexWriter() throws Exception { LuceneIndexWriter writer = mock( LuceneIndexWriter.class ); NonUniqueLuceneIndexPopulatingUpdater updater = newUpdater( writer ); String expectedString1 = documentRepresentingProperties( 1, "after1" ).toString(); String expectedString2 = documentRepresentingProperties( 2, "after2" ).toString(); String expectedString3 = documentRepresentingProperties( 3, "bit", "after2" ).toString(); updater.process( change( 1, SCHEMA_DESCRIPTOR, "before1", "after1" ) ); verifydocument( writer, newTermForChangeOrRemove( 1 ), expectedString1 ); updater.process( change( 2, SCHEMA_DESCRIPTOR, "before2", "after2" ) ); verifydocument( writer, newTermForChangeOrRemove( 2 ), expectedString2 ); updater.process( change( 3, COMPOSITE_SCHEMA_DESCRIPTOR, new Object[]{"bit", "before2"}, new Object[]{"bit", "after2"} ) ); verifydocument( writer, newTermForChangeOrRemove( 3 ), expectedString3 ); }
Source:
public List<CourseAttributes> getCoursesForInstructor(List<InstructorAttributes> instructorList) { Assumption.assertNotNull("Supplied parameter was null", instructorList); List<String> courseIdList = new ArrayList<>(); for (InstructorAttributes instructor : instructorList) { if (!coursesDb.getCourse(instructor.courseId).isCourseDeleted()) { courseIdList.add(instructor.courseId); } } List<CourseAttributes> courseList = coursesDb.getCourses(courseIdList); if (courseIdList.size() > courseList.size()) { for (CourseAttributes ca : courseList) { courseIdList.remove(ca.getId()); } log.severe("Course(s) was deleted but the instructor still exists: " + System.lineSeparator() + courseIdList.toString()); } return courseList; }

Target:
public List<CourseAttributes> getCoursesForInstructor(List<InstructorAttributes> instructorList) { Assumption.assertNotNull("Supplied parameter was null", instructorList); List<String> courseIdList = instructorList.stream() .filter(instructor -> !coursesDb.getCourse(instructor.courseId).isCourseDeleted()) .map(InstructorAttributes::getCourseId) .collect(Collectors.toList()); List<CourseAttributes> courseList = coursesDb.getCourses(courseIdList); if (courseIdList.size() > courseList.size()) { for (CourseAttributes ca : courseList) { courseIdList.remove(ca.getId()); } log.severe("Course(s) was deleted but the instructor still exists: " + System.lineSeparator() + courseIdList.toString()); } return courseList; }
Source:
public DeleteQuery build() { Checks.checkNotEmpty(table, "Please specify table name"); return new DeleteQuery( table, where, whereArgs ); }

Target:
public DeleteQuery build() { checkNotEmpty(table, "Please specify table name"); return new DeleteQuery( table, where, whereArgs ); }
Source:
public ActionValueObjectResponseDto execute(final ClientConnection conn, final DlmsDevice device, final ActivityCalendarDataDto activityCalendar) { MethodResultCode methodResult = null; try { this.setActivityCalendarCommandExecutor.execute(conn, device, activityCalendar.getActivityCalendar()); methodResult = this.setActivityCalendarCommandActivationExecutor.execute(conn, device, null); } catch (final ProtocolAdapterException e) { return new ActionValueObjectResponseDto(e, "Error while setting new activity calendar"); } if (!MethodResultCode.SUCCESS.equals(methodResult)) { return new ActionValueObjectResponseDto("AccessResultCode for set Activity Calendar: " + methodResult); } return new ActionValueObjectResponseDto("Set Activity Calendar Result is OK for device id: " + device.getDeviceIdentification() + " calendar name: " + activityCalendar.getActivityCalendar().getCalendarName()); }

Target:
public ActionResponseDto execute(final ClientConnection conn, final DlmsDevice device, final ActivityCalendarDataDto activityCalendar) { try { this.setActivityCalendarCommandExecutor.execute(conn, device, activityCalendar.getActivityCalendar()); final MethodResultCode methodResult = this.setActivityCalendarCommandActivationExecutor.execute(conn, device, null); if (!MethodResultCode.SUCCESS.equals(methodResult)) { return new ActionResponseDto("AccessResultCode for set Activity Calendar: " + methodResult); } return new ActionResponseDto("Set Activity Calendar Result is OK for device id: " + device.getDeviceIdentification() + " calendar name: " + activityCalendar.getActivityCalendar().getCalendarName()); } catch (final ProtocolAdapterException e) { LOGGER.error("Error while setting new activity calendar", e); return new ActionResponseDto(e, "Error while setting new activity calendar"); } }
Source:
public void onSaveChangesClicked() { if (compareWithLatest) { view.getEditableContent(content -> { if (isEdited(content)) { saveContent(content); } }); } }

Target:
public void onSaveChangesClicked() { if (compareWithLatest) { final String content = view.getEditableContent(); if (isSaveNeeded(content)) { saveContent(content); } } }
Source:
public void testConnectAnnotationsStringComplete() { dispoItem.getDiscrepanciesList().values(); for (Discrepancy discrepancy : dispoItem.getDiscrepanciesList().values()) { discrepancy.setLocation(discrepancy.getLocation() + "zzz"); } DispoAnnotationData annotationOne = new DispoAnnotationData(); annotationOne.setLocationRefs("1zzz, 2zzz, 3zzz,4zzz,5zzz,12zzz,13zzz,14zzz,15zzz,16zzz,17zzz,18zzz,20zzz"); annotationOne.setIsResolutionValid(true); annotationOne.setResolutionType("Code"); annotationOne.setId(annotIdOne); List<String> idsOfCoveredDisc = new ArrayList<String>(); annotationOne.setIdsOfCoveredDiscrepancies(idsOfCoveredDisc); dispoConnector.connectAnnotation(annotationOne, dispoItem.getDiscrepanciesList()); List<DispoAnnotationData> annotationsList = new ArrayList<DispoAnnotationData>(); annotationsList.add(annotationOne); dispoItem.setAnnotationsList(annotationsList); List<String> idsOfCoveredDiscrepancies = annotationOne.getIdsOfCoveredDiscrepancies(); Assert.assertTrue(idsOfCoveredDiscrepancies.size() == 13); for (int i = 0; i < idsOfCoveredDiscrepancies.size(); i++) { if (i < 5) { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies1_5[i]); } else if (i < 12) { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies12_18[i - 5]); } else { assertEquals(idsOfCoveredDiscrepancies.get(i), id20); } } assertTrue(annotationOne.getIsConnected()); String actual = dispoConnector.getItemStatus(dispoItem); assertEquals(DispoStrings.Item_Complete, actual); }

Target:
public void testConnectAnnotationsStringComplete() { for (Discrepancy discrepancy : dispoItem.getDiscrepanciesList().values()) { discrepancy.setLocation(discrepancy.getLocation() + "zzz"); } DispoAnnotationData annotationOne = new DispoAnnotationData(); annotationOne.setLocationRefs("1zzz, 2zzz, 3zzz,4zzz,5zzz,12zzz,13zzz,14zzz,15zzz,16zzz,17zzz,18zzz,20zzz"); annotationOne.setIsResolutionValid(true); annotationOne.setResolutionType("Code"); annotationOne.setId(annotIdOne); List<String> idsOfCoveredDisc = new ArrayList<String>(); annotationOne.setIdsOfCoveredDiscrepancies(idsOfCoveredDisc); dispoConnector.connectAnnotation(annotationOne, dispoItem.getDiscrepanciesList()); List<DispoAnnotationData> annotationsList = new ArrayList<DispoAnnotationData>(); annotationsList.add(annotationOne); dispoItem.setAnnotationsList(annotationsList); List<String> idsOfCoveredDiscrepancies = annotationOne.getIdsOfCoveredDiscrepancies(); Assert.assertTrue(idsOfCoveredDiscrepancies.size() == 13); for (int i = 0; i < idsOfCoveredDiscrepancies.size(); i++) { if (i < 5) { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies1_5[i]); } else if (i < 12) { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies12_18[i - 5]); } else { assertEquals(idsOfCoveredDiscrepancies.get(i), id20); } } assertTrue(annotationOne.getIsConnected()); String actual = dispoConnector.getItemStatus(dispoItem); assertEquals(DispoStrings.Item_Complete, actual); }
Source:
private String invoke(Object obj, String methodName, Object...args) throws Throwable { Class<?>[] types = extractTypes(args); try { Method method = null; for (int length = types.length; length >= 0; length--) { method = new Mirror().on(obj.getClass()).reflect().method(methodName) .withArgs(Arrays.copyOf(types, length)); if (method != null) break; } if (methodName.startsWith("get")) { return method.invoke(obj).toString(); } return method.invoke(obj, args).toString(); } catch (MirrorException | InvocationTargetException e) { throw e.getCause() == null? e : e.getCause(); } }

Target:
private String invoke(Object obj, String methodName, Object...args) throws Throwable { Class<?>[] types = extractTypes(args); try { Method method = null; for (int length = types.length; length >= 0; length--) { method = new Mirror().on(obj.getClass()).reflect().method(methodName) .withArgs(Arrays.copyOf(types, length)); if (method != null) break; } if (methodName.startsWith("get")) { return method.invoke(obj).toString(); } return new Mirror().on(obj).invoke().method(method).withArgs(args).toString(); } catch (MirrorException | InvocationTargetException e) { throw e.getCause() == null? e : e.getCause(); } }
Source:
private void refreshPage() throws IOException { ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); ec.redirect(((HttpServletRequest) ec.getRequest()).getRequestURI()); }

Target:
private void refreshPage() throws IOException { FacesContext currentInstance = FacesContext.getCurrentInstance(); if (Objects.nonNull(currentInstance)) { ExternalContext externalContext = currentInstance.getExternalContext(); externalContext.redirect(((HttpServletRequest) externalContext.getRequest()).getRequestURI()); } }
Source:
private void populateSoldierBox(final View view, final ListRowElement item) { if (item instanceof SoldierSpinnerRow) { final SoldierSpinnerRow row = (SoldierSpinnerRow) item; final SoldierSpinnerAdapter adapter = new SoldierSpinnerAdapter(context, row.getSoldierStats()); final Spinner spinner = (Spinner) view.findViewById(R.id.spinner_soldier); final long id = preferences.getLong(Keys.Menu.LATEST_PERSONA, 0); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { final long oldId = preferences.getLong(Keys.Menu.LATEST_PERSONA, -1); if (oldId != id) { preferences.edit().putLong(Keys.Menu.LATEST_PERSONA, id).commit(); BusProvider.getInstance().post(new ActiveSoldierChangedEvent(id)); } } @Override public void onNothingSelected(AdapterView<?> parent) { } } ); spinner.setSelection(getIndexForSoldierInList(id, row.getSoldierStats())); } }

Target:
private void populateSoldierBox(final View view, final ListRowElement item) { if (item instanceof SoldierSpinnerRow) { final SoldierSpinnerRow row = (SoldierSpinnerRow) item; final SoldierSpinnerAdapter adapter = new SoldierSpinnerAdapter(context, row.getSoldierStats()); final Spinner spinner = (Spinner) view.findViewById(R.id.spinner_soldier); final long id = preferences.getLong(Keys.Menu.LATEST_PERSONA, 0); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long selectedId) { final long currentId = preferences.getLong(Keys.Menu.LATEST_PERSONA, -1); if (currentId != selectedId) { preferences.edit().putLong(Keys.Menu.LATEST_PERSONA, selectedId).commit(); BusProvider.getInstance().post(new ActiveSoldierChangedEvent(selectedId)); } } @Override public void onNothingSelected(AdapterView<?> parent) { } } ); spinner.setSelection(getIndexForSoldierInList(id, row.getSoldierStats())); } }
Source:
public BeanMetaDataManager(ConstraintHelper constraintHelper, ExecutableHelper executableHelper, ParameterNameProvider parameterNameProvider, List<MetaDataProvider> optionalMetaDataProviders) { this.constraintHelper = constraintHelper; this.metaDataProviders = newArrayList(); this.metaDataProviders.addAll( optionalMetaDataProviders ); this.executableHelper = executableHelper; this.beanMetaDataCache = new ConcurrentReferenceHashMap<Class<?>, BeanMetaData<?>>( DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_CONCURRENCY_LEVEL, SOFT, SOFT, EnumSet.of( IDENTITY_COMPARISONS ) ); AnnotationProcessingOptions annotationProcessingOptions = getAnnotationProcessingOptionsFromNonDefaultProviders(); AnnotationMetaDataProvider defaultProvider = null; if ( Version.getJavaRelease() >= 8 ) { defaultProvider = new TypeUseAnnotationMetaDataProvider( constraintHelper, parameterNameProvider, annotationProcessingOptions ); } else { defaultProvider = new AnnotationMetaDataProvider( constraintHelper, parameterNameProvider, annotationProcessingOptions ); } this.metaDataProviders.add( defaultProvider ); }

Target:
public BeanMetaDataManager(ConstraintHelper constraintHelper, ExecutableHelper executableHelper, ParameterNameProvider parameterNameProvider, List<MetaDataProvider> optionalMetaDataProviders) { this.constraintHelper = constraintHelper; this.metaDataProviders = newArrayList(); this.metaDataProviders.addAll( optionalMetaDataProviders ); this.executableHelper = executableHelper; this.beanMetaDataCache = new ConcurrentReferenceHashMap<Class<?>, BeanMetaData<?>>( DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_CONCURRENCY_LEVEL, SOFT, SOFT, EnumSet.of( IDENTITY_COMPARISONS ) ); AnnotationProcessingOptions annotationProcessingOptions = getAnnotationProcessingOptionsFromNonDefaultProviders(); AnnotationMetaDataProvider defaultProvider = null; if ( Version.getJavaRelease() >= 8 ) { defaultProvider = new TypeAnnotationAwareMetaDataProvider( constraintHelper, parameterNameProvider, annotationProcessingOptions ); } else { defaultProvider = new AnnotationMetaDataProvider( constraintHelper, parameterNameProvider, annotationProcessingOptions ); } this.metaDataProviders.add( defaultProvider ); }
Source:
public CommonProgressDialog(Context context) { progressDialog = new ProgressDialog(context); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); setCancelable(false); }

Target:
public CommonProgressDialog(Context context) { progressDialog = new ProgressDialog(context); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); }
Source:
public Configuration getConfiguration() { final Configuration configuration = new Configuration(); final Map<String, File> configurationFiles = new HashMap<>(); Arrays.stream(getDirectories()).map(File::new).filter(File::isDirectory).forEach(c -> { final File[] array = c.listFiles(); assert (array != null); Arrays.stream(array).filter(File::isFile).filter(f -> !configurationFiles.containsKey(f.getName())) .forEach(f -> configurationFiles.put(f.getName(), f)); }); if (configurationFiles.size() == 0) { throw new IllegalStateException( "Specified directories does not contain any Hadoop configuration files"); } configurationFiles.values().stream().map(File::toURI).map(Path::new).forEach(configuration::addResource); return configuration; }

Target:
public Configuration getConfiguration() { final Configuration configuration = new Configuration(); final Map<String, File> configurationFiles = new HashMap<>(); Arrays.stream(getDirectories()).map(File::new).filter(File::isDirectory).forEach(c -> { final File[] array = c.listFiles(); assert (array != null); Arrays.stream(array).filter(File::isFile).filter(f -> !configurationFiles.containsKey(f.getName())) .filter(f -> FilenameUtils.getExtension(f.getName()).equalsIgnoreCase("xml")) .forEach(f -> configurationFiles.put(f.getName(), f)); }); if (configurationFiles.size() == 0) { throw new IllegalStateException( "Specified directories does not contain any Hadoop configuration files"); } configurationFiles.values().stream().map(File::toURI).map(Path::new).forEach(configuration::addResource); return configuration; }
Source:
private void checkEnvironment(RegistrationManager rm) throws BookieException, IOException { List<File> allLedgerDirs = new ArrayList<File>(ledgerDirsManager.getAllLedgerDirs().size() + indexDirsManager.getAllLedgerDirs().size()); allLedgerDirs.addAll(ledgerDirsManager.getAllLedgerDirs()); if (indexDirsManager != ledgerDirsManager) { allLedgerDirs.addAll(indexDirsManager.getAllLedgerDirs()); } if (rm == null) { for (File journalDirectory : journalDirectories) { checkDirectoryStructure(journalDirectory); } for (File dir : allLedgerDirs) { checkDirectoryStructure(dir); } return; } checkEnvironmentWithStorageExpansion(conf, rm, journalDirectories, allLedgerDirs); List<File> ledgerDirs = ledgerDirsManager.getAllLedgerDirs(); checkIfDirsOnSameDiskPartition(ledgerDirs); List<File> indexDirs = indexDirsManager.getAllLedgerDirs(); checkIfDirsOnSameDiskPartition(indexDirs); checkIfDirsOnSameDiskPartition(journalDirectories); }

Target:
private void checkEnvironment(RegistrationManager rm) throws BookieException, IOException { List<File> allLedgerDirs = new ArrayList<File>(ledgerDirsManager.getAllLedgerDirs().size() + indexDirsManager.getAllLedgerDirs().size()); allLedgerDirs.addAll(ledgerDirsManager.getAllLedgerDirs()); if (indexDirsManager != ledgerDirsManager) { allLedgerDirs.addAll(indexDirsManager.getAllLedgerDirs()); } if (rm == null) { for (File journalDirectory : journalDirectories) { checkDirectoryStructure(journalDirectory); } for (File dir : allLedgerDirs) { checkDirectoryStructure(dir); } return; } checkEnvironmentWithStorageExpansion(conf, rm, journalDirectories, allLedgerDirs); checkIfDirsOnSameDiskPartition(allLedgerDirs); checkIfDirsOnSameDiskPartition(journalDirectories); }
Source:
public void enableTrySamples(){ final MenuResourceHandlerWidget menuResourceHandlerWidget = menuResourceHandlerWidgets.get(); menuResourceHandlerWidget.init(this.translationService.getTranslation("TrySamples"), () -> libraryPlaces.closeAllPlacesOrNothing(() -> { libraryPlaces.goToLibrary(); libraryPlaces.goToTrySamples(); })); view.addNewMenuItem(menuResourceHandlerWidget); }

Target:
public void enableTrySamples(){ final MenuResourceHandlerWidget menuResourceHandlerWidget = menuResourceHandlerWidgets.get(); menuResourceHandlerWidget.init(this.translationService.getTranslation(LibraryConstants.TrySamples), () -> libraryPlaces.closeAllPlacesOrNothing(() -> { libraryPlaces.goToLibrary(); libraryPlaces.goToTrySamples(); })); view.addNewMenuItem(menuResourceHandlerWidget); }
Source:
private void validatePlayists(final Page<SimplePlaylist> playlistSearchResult) { assertEquals("<LINK_2>", playlistSearchResult.getHref()); assertEquals(20, playlistSearchResult.getLimit()); assertEquals(0, playlistSearchResult.getOffset()); assertNull(playlistSearchResult.getNext()); assertNull(playlistSearchResult.getPrevious()); assertEquals(7, playlistSearchResult.getTotal()); List<SimplePlaylist> playlists = playlistSearchResult.getItems(); assertEquals(7, playlists.size()); SimplePlaylist firstPlaylist = playlists.get(0); assertEquals("<LINK_0>", firstPlaylist.getExternalUrls().get("spotify")); assertEquals("<LINK_1>", firstPlaylist.getHref()); assertEquals("5W11lXKiV9B5RZluPrxmCS", firstPlaylist.getId()); assertEquals("Tdog✌🏿️", firstPlaylist.getName()); assertNotNull(firstPlaylist.getImages()); assertNotNull(firstPlaylist.getOwner()); assertEquals(SpotifyEntityType.PLAYLIST, firstPlaylist.getType()); assertEquals("spotify:user:theodorduf:playlist:5W11lXKiV9B5RZluPrxmCS", firstPlaylist.getUri()); }

Target:
private void validatePlayists(final Page<SimplePlaylist> playlistSearchResult) { assertEquals("<LINK_2>", playlistSearchResult.getHref()); assertEquals(20, playlistSearchResult.getLimit()); assertEquals(0, playlistSearchResult.getOffset()); assertNull(playlistSearchResult.getNext()); assertNull(playlistSearchResult.getPrevious()); assertEquals(7, playlistSearchResult.getTotal()); List<SimplePlaylist> playlists = playlistSearchResult.getItems(); assertEquals(7, playlists.size()); SimplePlaylist firstPlaylist = playlists.get(0); assertEquals("<LINK_0>", firstPlaylist.getExternalUrls().get("spotify")); assertEquals("<LINK_1>", firstPlaylist.getHref()); assertEquals("5W11lXKiV9B5RZluPrxmCS", firstPlaylist.getId()); assertEquals("Tdog", firstPlaylist.getName()); assertNotNull(firstPlaylist.getImages()); assertNotNull(firstPlaylist.getOwner()); assertEquals(SpotifyEntityType.PLAYLIST, firstPlaylist.getType()); assertEquals("spotify:user:theodorduf:playlist:5W11lXKiV9B5RZluPrxmCS", firstPlaylist.getUri()); }
Source:
public boolean exec() throws CliException { String path = args[1]; CountDownLatch latch = new CountDownLatch(1); final int[] resultCode = new int[1]; try { zk.sync(path, new AsyncCallback.VoidCallback() { public void processResult(int rc, String path, Object ctx) { resultCode[0] = rc; latch.countDown(); } }, null); latch.await(); out.println("Sync returned " + resultCode[0]); } catch (IllegalArgumentException | InterruptedException ex) { throw new MalformedPathException(ex.getMessage()); } return false; }

Target:
public boolean exec() throws CliException { String path = args[1]; CompletableFuture<Integer> cf = new CompletableFuture<>(); try { zk.sync(path, new AsyncCallback.VoidCallback() { public void processResult(int rc, String path, Object ctx) { cf.complete(rc); } }, null); int resultCode = cf.get(SYNC_TIMEOUT, TimeUnit.MILLISECONDS); if(resultCode == 0) { out.println("Sync is OK"); } else { out.println("Sync has failed. rc=" + resultCode); } } catch (IllegalArgumentException ex) { throw new MalformedPathException(ex.getMessage()); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new CliWrapperException(ie); } catch (TimeoutException | ExecutionException ex) { throw new CliWrapperException(ex); } return false; }
Source:
public Optional<HostLocation> get() { switch (snitch) { case "org.apache.cassandra.locator.EC2Snitch": return ec2Supplier.get(); default: return defaultSupplier.get(); } }

Target:
public Optional<HostLocation> get() { try { if (overrideLocation.isPresent()) { return overrideLocation; } switch (snitchSupplier.get()) { case "org.apache.cassandra.locator.EC2Snitch": return Optional.of(ec2Supplier.get()); default: return Optional.empty(); } } catch (RuntimeException e) { log.warn("Host location supplier failed to retrieve the host location", e); return Optional.empty(); } }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o != null && !(o instanceof RangeData)) { return false; } RangeData data = (RangeData)o; if (startLine != data.startLine) return false; if (startColumn != data.startColumn) return false; if (endLine != data.endLine) return false; if (endColumn != data.endColumn) return false; if (hits != data.hits) return false; if (statements != data.statements) return false; return true; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o != null) { if (this.getClass() != o.getClass()) { return false; } } RangeData data = (RangeData)o; if (startLine != data.startLine) return false; if (startColumn != data.startColumn) return false; if (endLine != data.endLine) return false; if (endColumn != data.endColumn) return false; if (hits != data.hits) return false; if (statements != data.statements) return false; return true; }
Source:
public Properties getQueueProperties(final String queueName) { return this.rabbitTemplate.execute(new ChannelCallback<Properties>() { public Properties doInRabbit(Channel channel) throws Exception { try { DeclareOk declareOk = channel.queueDeclarePassive(queueName); Properties props = new Properties(); props.put(QUEUE_NAME, declareOk.getQueue()); props.put(QUEUE_MESSAGE_COUNT, declareOk.getMessageCount()); props.put(QUEUE_CONSUMER_COUNT, declareOk.getConsumerCount()); return props; } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Queue '" + queueName + "' does not exist"); } return null; } } }); }

Target:
public Properties getQueueProperties(final String queueName) { Assert.hasText(queueName, "'queueName' cannot be null or empty"); return this.rabbitTemplate.execute(new ChannelCallback<Properties>() { public Properties doInRabbit(Channel channel) throws Exception { try { DeclareOk declareOk = channel.queueDeclarePassive(queueName); Properties props = new Properties(); props.put(QUEUE_NAME, declareOk.getQueue()); props.put(QUEUE_MESSAGE_COUNT, declareOk.getMessageCount()); props.put(QUEUE_CONSUMER_COUNT, declareOk.getConsumerCount()); return props; } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Queue '" + queueName + "' does not exist"); } return null; } } }); }
Source:
public String type () { return TYPE; }

Target:
public String type () { return "/StateManager/BasicAction/AtomicAction/Sagas/BACoordinator"; }
Source:
public Mono<ConfigurationSetting> addSetting(ConfigurationSetting setting) { return client.addSetting(setting) .flatMap(response -> Mono.justOrEmpty(response.value())); }

Target:
public Mono<ConfigurationSetting> addSetting(ConfigurationSetting setting) { return client.addSetting(setting).map(ConfigurationAsyncClient::unwrapResponse); }
Source:
private ActionEventRequest buildUpdateProgramEnrollmentAction(String configName) { SortedSet<ActionParameterRequest> parameters = new TreeSet<>(); int order = 0; String serviceMethod = "updateProgramEnrollment"; parameters.add(prepareParameter(Keys.CONFIG_NAME, DisplayNames.CONFIG_NAME, configName, false, true, order++)); parameters.addAll(prepareProgramEnrollmentParameters(order)); order = parameters.size(); parameters.add(prepareParameter(Keys.PROGRAM_ATTRIBUTES, DisplayNames.PROGRAM_ATTRIBUTES, MAP, false, order)); return new ActionEventRequestBuilder() .setDisplayName(getDisplayName(UPDATE_PROGRAM_ENROLLMENT, configName)) .setServiceInterface(OPENMRS_ACTION_PROXY_SERVICE) .setServiceMethod(serviceMethod) .setSubject(getSubject(serviceMethod, configName)) .setActionParameters(parameters) .createActionEventRequest(); }

Target:
private ActionEventRequest buildUpdateProgramEnrollmentAction(String configName) { SortedSet<ActionParameterRequest> parameters = new TreeSet<>(); int order = 0; String serviceMethod = "updateProgramEnrollment"; parameters.add(prepareParameter(Keys.CONFIG_NAME, DisplayNames.CONFIG_NAME, configName, false, true, order++)); parameters.addAll(prepareProgramEnrollmentParameters(order, true)); return new ActionEventRequestBuilder() .setDisplayName(getDisplayName(UPDATE_PROGRAM_ENROLLMENT, configName)) .setServiceInterface(OPENMRS_ACTION_PROXY_SERVICE) .setServiceMethod(serviceMethod) .setSubject(getSubject(serviceMethod, configName)) .setActionParameters(parameters) .createActionEventRequest(); }
Source:
public Object instantiateItem(@NonNull ViewGroup container, int position) { LayoutInflater inflater = LayoutInflater.from(container.getContext()); View view = inflater.inflate(R.layout.view_reference_pager_item, container, false); view.setTag(position); TextView referenceText = view.findViewById(R.id.reference_text); referenceText.setText(StringUtil.fromHtml(items.get(position).getHref())); referenceText.setMovementMethod(new LinkMovementMethodExt(linkHandler)); TextView titleText = view.findViewById(R.id.reference_title_text); titleText.setText(getContext().getString(R.string.reference_title, items.get(position).getLinkText())); container.addView(view); return view; }

Target:
public Object instantiateItem(@NonNull ViewGroup container, int position) { LayoutInflater inflater = LayoutInflater.from(container.getContext()); View view = inflater.inflate(R.layout.view_reference_pager_item, container, false); TextView referenceText = view.findViewById(R.id.reference_text); referenceText.setText(StringUtil.fromHtml(items.get(position).getHref())); referenceText.setMovementMethod(new LinkMovementMethodExt(linkHandler)); TextView titleText = view.findViewById(R.id.reference_title_text); titleText.setText(getContext().getString(R.string.reference_title, items.get(position).getLinkText())); container.addView(view); return view; }
Source:
public void log(AuditLogable auditLogable, AuditLogType logType, String message) { if (!logType.shouldBeLogged()) { return; } EventFloodRegulator eventFloodRegulator = new EventFloodRegulator(auditLogable, logType); if (eventFloodRegulator.isLegal()) { AuditLog[] savedAuditLog = { null }; TransactionSupport.executeInNewTransaction(() -> { savedAuditLog[0] = saveToDb(auditLogable, logType, message); return null; }); if (savedAuditLog[0] == null) { log.warn("Unable to create AuditLog"); } else { logMessage(savedAuditLog[0]); } } }

Target:
public void log(AuditLogable auditLogable, AuditLogType logType, String message) { if (!logType.shouldBeLogged()) { return; } EventFloodRegulator eventFloodRegulator = new EventFloodRegulator(auditLogable, logType); if (eventFloodRegulator.isLegal()) { AuditLog savedAuditLog = saveToDb(auditLogable, logType, message); if (savedAuditLog == null) { log.warn("Unable to create AuditLog"); } else { logMessage(savedAuditLog); } } }
Source:
private void addListeners() { comboBox.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { widgetEntryChanged(); } }); comboBox.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { clearWarningMessage(); } }); }

Target:
private void addListeners() { comboBox.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { widgetEntryChanged(); } }); comboBox.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { comboBox.showDropDown(); } else { comboBox.autoCorrectCapitalization(); widgetEntryChanged(); } } }); comboBox.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { clearWarningMessage(); } }); }