auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void bulk(List<BasicDocumentRevision> revisions) { logger.entering(this.getClass().getCanonicalName(),"bulk",revisions); List<Map> allObjs = new ArrayList<Map>(); for (BasicDocumentRevision obj : revisions) { logger.finer(String.format("Document body: %s",obj.getBody())); allObjs.add(obj.asMap()); } List<Response> responses = couchClient.bulk(allObjs); for (Response r : responses) { logger.fine(String.format("Response: %s",r)); } }

Target:
public void bulk(List<BasicDocumentRevision> revisions) { logger.entering("com.cloudant.sync.replication.CouchClientWrapper","bulk",revisions); List<Map> allObjs = new ArrayList<Map>(); for (BasicDocumentRevision obj : revisions) { logger.finer(String.format("Document body: %s",obj.getBody())); allObjs.add(obj.asMap()); } List<Response> responses = couchClient.bulk(allObjs); for (Response r : responses) { logger.info(String.format("Response: %s",r)); } }
Source:
private String normalizePath(String filePath) { if (filePath == null) return ""; filePath = filePath.trim(); if (filePath.contains(":")) { filePath = filePath.substring(filePath.indexOf(":") + 1); } filePath = filePath.replaceAll("\\\\", "/"); filePath = filePath.toLowerCase(); filePath = filePath.replaceAll("/systemroot/", "/windows/"); filePath = filePath.replaceAll("%systemroot%", "/windows/"); filePath = filePath.replaceAll("device/",""); if (filePath.contains("harddiskvolume[0-9]/")){ filePath = filePath.substring(filePath.indexOf("harddiskvolume[0-9]/") -1); } filePath = filePath.replaceAll("harddiskvolume[0-9]/", ""); return filePath; }

Target:
private String normalizePath(String filePath) { if (filePath == null) return ""; filePath = filePath.trim(); if (filePath.contains(":")) { filePath = filePath.substring(filePath.indexOf(":") + 1); } filePath = filePath.replaceAll("\\\\", "/"); filePath = filePath.toLowerCase(); filePath = filePath.replaceAll("/systemroot/", "/windows/"); filePath = filePath.replaceAll("%systemroot%", "/windows/"); filePath = filePath.replaceAll("device/",""); filePath = filePath.substring(filePath.indexOf("harddiskvolume[0-9]/") -1); if (filePath.startsWith("/namedpipe/")) return ""; return filePath; }
Source:
public CompletableFuture<T> execute() { final SnmpRequestDTO snmpRequestDTO = new SnmpRequestDTO(); snmpRequestDTO.setLocation(location); snmpRequestDTO.setSystemId(systemId); snmpRequestDTO.setAgent(agent); snmpRequestDTO.setDescription(description); snmpRequestDTO.setGetRequests(gets); snmpRequestDTO.setWalkRequests(walks); snmpRequestDTO.setTimeToLive(timeToLiveInMilliseconds); snmpRequestDTO.addTracingInfo(RpcRequest.TAG_IP_ADDRESS, InetAddressUtils.toIpAddrString(agent.getAddress())); return client.execute(snmpRequestDTO) .thenApply(this::processResponse); }

Target:
public CompletableFuture<T> execute() { final SnmpRequestDTO snmpRequestDTO = new SnmpRequestDTO(); snmpRequestDTO.setLocation(location); snmpRequestDTO.setSystemId(systemId); snmpRequestDTO.setAgent(agent); snmpRequestDTO.setDescription(description); snmpRequestDTO.setGetRequests(gets); snmpRequestDTO.setWalkRequests(walks); snmpRequestDTO.setTimeToLive(timeToLiveInMilliseconds); snmpRequestDTO.addTracingInfo(RpcRequest.TAG_IP_ADDRESS, InetAddressUtils.toIpAddrString(agent.getAddress())); snmpRequestDTO.addTracingInfo(RpcRequest.TAG_DESCRIPTION, description); return client.execute(snmpRequestDTO) .thenApply(this::processResponse); }
Source:
public void someSampleWork(Calendar service) throws IOException { DateTime now = new DateTime(System.currentTimeMillis()); Events events = service.events().list("primary") .setMaxResults(10) .setTimeMin(now) .setOrderBy("startTime") .setSingleEvents(true) .execute(); List<Event> items = events.getItems(); if (items.size() == 0) { System.out.println("No upcoming events found."); } else { System.out.println("Upcoming events"); for (Event event : items) { DateTime start = event.getStart().getDateTime(); if (start == null) { start = event.getStart().getDate(); } System.out.printf("%s (%s)\n", event.getSummary(), start); } } }

Target:
public void someSampleWork(Calendar service) throws IOException { DateTime now = new DateTime(System.currentTimeMillis()); Events events = service.events().list("primary") .setMaxResults(10) .setTimeMin(now) .setOrderBy("startTime") .setSingleEvents(true) .execute(); List<Event> items = events.getItems(); if (items.isEmpty()) { System.out.println("No upcoming events found."); } else { System.out.println("Upcoming events"); for (Event event : items) { DateTime start = event.getStart().getDateTime(); if (start == null) { start = event.getStart().getDate(); } System.out.printf("%s (%s)\n", event.getSummary(), start); } } }
Source:
public void OnURLChosen(String url) { Log.d("DEBUG-d", "SetupEnterURLFragment returned: " + url); incomingRef = url; this.uiState = UiState.ready; uiStateScreenTransition(); }

Target:
public void OnURLChosen(String url) { if(BuildConfig.DEBUG) { Log.d("DEBUG-d", "SetupEnterURLFragment returned: " + url); } incomingRef = url; this.uiState = UiState.ready; uiStateScreenTransition(); }
Source:
private void parseUpdate(final ReceiveCommand cmd) { if (isHead(cmd) && canPerform(PUSH_HEAD, PUSH_HEAD_UPDATE) && projectControl.canUploadToRef(cmd.getRefName())) { } else { reject(cmd); } }

Target:
private void parseUpdate(final ReceiveCommand cmd) { RefControl refControl = projectControl.controlForRef(cmd.getRefName()); if (isHead(cmd) && refControl.canPerform(PUSH_HEAD, PUSH_HEAD_UPDATE)) { } else { reject(cmd); } }
Source:
private void existingTableTasks(ImportTableDesc tblDesc, Table table, ReplicationSpec replicationSpec) { if (!table.isPartitioned()) { LOG.debug("table non-partitioned"); if (!replicationSpec.allowReplacementInto(table.getParameters())) { return; } Task<? extends Serializable> alterTableTask = alterTableTask(tblDesc, replicationSpec); if (replicationSpec.isMetadataOnly()) { tracker.addTask(alterTableTask); } else { Task<?> loadTableTask = loadTableTask(table, replicationSpec, event.metadataPath(), table.getDataLocation()); alterTableTask.addDependentTask(loadTableTask); tracker.addTask(alterTableTask); } } }

Target:
private void existingTableTasks(ImportTableDesc tblDesc, Table table, ReplicationSpec replicationSpec) { if (!table.isPartitioned()) { LOG.debug("table non-partitioned"); if (!replicationSpec.allowReplacementInto(table.getParameters())) { return; } Task<? extends Serializable> alterTableTask = alterTableTask(tblDesc, replicationSpec); if (replicationSpec.isMetadataOnly()) { tracker.addTask(alterTableTask); } else { Task<?> loadTableTask = loadTableTask(table, replicationSpec, table.getDataLocation(), event.metadataPath()); alterTableTask.addDependentTask(loadTableTask); tracker.addTask(alterTableTask); } } }
Source:
private void attachRecyclerViewAdapter() { final RecyclerView.Adapter adapter = newAdapter(); adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { @Override public void onItemRangeInserted(int positionStart, int itemCount) { updateEmptyStateUi(); mRecyclerView.smoothScrollToPosition(adapter.getItemCount()); } @Override public void onItemRangeRemoved(int positionStart, int itemCount) { updateEmptyStateUi(); } private void updateEmptyStateUi() { mEmptyListMessage.setVisibility( adapter.getItemCount() == 0 ? View.VISIBLE : View.GONE); } }); mRecyclerView.setAdapter(adapter); }

Target:
private void attachRecyclerViewAdapter() { final RecyclerView.Adapter adapter = newAdapter(); adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { @Override public void onItemRangeInserted(int positionStart, int itemCount) { mRecyclerView.smoothScrollToPosition(adapter.getItemCount()); } }); mRecyclerView.setAdapter(adapter); }
Source:
public void theGetActualMeterReadsRequestIsReceived(final Map<String, String> settings) throws Throwable { final ActualMeterReadsGasRequest request = ActualMeterReadsGasRequestFactory.forDevice(settings); final ActualMeterReadsGasAsyncResponse asyncResponse = this.requestClient.doRequest(request); assertNotNull("asyncRespone should not be null", asyncResponse); ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid()); }

Target:
public void theGetActualMeterReadsRequestIsReceived(final Map<String, String> settings) throws Throwable { final ActualMeterReadsGasRequest request = ActualMeterReadsGasRequestFactory.fromParameterMap(settings); final ActualMeterReadsGasAsyncResponse asyncResponse = this.requestClient.doRequest(request); assertNotNull("asyncRespone should not be null", asyncResponse); ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid()); }
Source:
public void onNewUser(User user) { TextInputLayout emailLayout = findViewById(R.id.email_layout); if (getFlowParams().allowNewEmailAccounts) { RegisterEmailFragment fragment = RegisterEmailFragment.newInstance( getFlowParams(), user); FragmentTransaction ft = getSupportFragmentManager().beginTransaction() .replace(R.id.fragment_register_email, fragment, RegisterEmailFragment.TAG); if (emailLayout != null) { ViewCompat.setTransitionName(emailLayout, "email_field"); ft.addSharedElement(emailLayout, "email_field"); } ft.disallowAddToBackStack().commit(); } else { emailLayout.setError(getString(R.string.fui_error_email_does_not_exist)); } }

Target:
public void onNewUser(User user) { TextInputLayout emailLayout = findViewById(R.id.email_layout); if (getFlowParams().allowNewEmailAccounts) { RegisterEmailFragment fragment = RegisterEmailFragment.newInstance( getFlowParams(), user); FragmentTransaction ft = getSupportFragmentManager().beginTransaction() .replace(R.id.fragment_register_email, fragment, RegisterEmailFragment.TAG); if (emailLayout != null) ft.addSharedElement(emailLayout, "email_field"); ft.disallowAddToBackStack().commit(); } else { emailLayout.setError(getString(R.string.fui_error_email_does_not_exist)); } }
Source:
public Integer perform(InvocationContext ctx) throws Throwable { int size = 0; Map<Object, CacheEntry> contextEntries = ctx.getLookedUpEntries(); Set<Object> keys = new HashSet<>(); try (CloseableIterable<CacheEntry<Object, Void>> iterator = cache.getAdvancedCache().withFlags( flags != null ? flags.toArray(new Flag[flags.size()]) : null).filterEntries(AcceptAllKeyValueFilter.getInstance()).converter( NullValueConverter.getInstance())) { for (CacheEntry<Object, Void> entry : iterator) { CacheEntry value = contextEntries.get(entry.getKey()); if (value != null) { keys.add(entry.getKey()); if (!value.isRemoved()) { if (size++ == Integer.MAX_VALUE) {return Integer.MAX_VALUE;} } } else { if (size++ == Integer.MAX_VALUE) {return Integer.MAX_VALUE;} } } } for (Map.Entry<Object, CacheEntry> entry : contextEntries.entrySet()) { if (!keys.contains(entry.getKey()) && !entry.getValue().isRemoved() && !entry.getValue().isNull()) { if (size++ == Integer.MAX_VALUE) { return Integer.MAX_VALUE; } } } return size; }

Target:
public Integer perform(InvocationContext ctx) throws Throwable { int size = 0; Map<Object, CacheEntry> contextEntries = ctx.getLookedUpEntries(); Set<Object> keys = new HashSet<>(); try (CloseableIterable<CacheEntry<Object, Void>> iterator = cache.getAdvancedCache().withFlags( flags != null ? flags.toArray(new Flag[flags.size()]) : null).filterEntries(AcceptAllKeyValueFilter.getInstance()).converter( NullValueConverter.getInstance())) { for (CacheEntry<Object, Void> entry : iterator) { CacheEntry value = contextEntries.get(entry.getKey()); if (value != null) { keys.add(entry.getKey()); if (!value.isRemoved() && !value.isNull()) { if (size++ == Integer.MAX_VALUE) {return Integer.MAX_VALUE;} } } else { if (size++ == Integer.MAX_VALUE) {return Integer.MAX_VALUE;} } } } for (Map.Entry<Object, CacheEntry> entry : contextEntries.entrySet()) { if (!keys.contains(entry.getKey()) && !entry.getValue().isRemoved() && !entry.getValue().isNull()) { if (size++ == Integer.MAX_VALUE) { return Integer.MAX_VALUE; } } } return size; }
Source:
void hookEvents () { if ((style & SWT.BALLOON) != 0) { if (!OS.GTK3) { OS.g_signal_connect_closure_by_id (handle, display.signalIds [EXPOSE_EVENT], 0, display.getClosure (EXPOSE_EVENT), true); } else { OS.g_signal_connect_closure_by_id (handle, display.signalIds [EXPOSE_EVENT], 0, display.getClosure (EXPOSE_EVENT), true); if (OS.GTK_VERSION >= OS.VERSION (3, 9, 0)) { OS.g_signal_connect_closure_by_id (handle, display.signalIds [EXPOSE_EVENT_INVERSE], 0, display.getClosure (EXPOSE_EVENT_INVERSE), true); } } OS.gtk_widget_add_events (handle, OS.GDK_BUTTON_PRESS_MASK); OS.g_signal_connect_closure (handle, OS.button_press_event, display.getClosure (BUTTON_PRESS_EVENT), false); } }

Target:
void hookEvents () { if ((style & SWT.BALLOON) != 0) { OS.g_signal_connect_closure_by_id (handle, display.signalIds [EXPOSE_EVENT], 0, display.getClosure (EXPOSE_EVENT), true); if (OS.GTK_VERSION >= OS.VERSION (3, 9, 0)) { OS.g_signal_connect_closure_by_id (handle, display.signalIds [EXPOSE_EVENT_INVERSE], 0, display.getClosure (EXPOSE_EVENT_INVERSE), true); } OS.gtk_widget_add_events (handle, OS.GDK_BUTTON_PRESS_MASK); OS.g_signal_connect_closure (handle, OS.button_press_event, display.getClosure (BUTTON_PRESS_EVENT), false); } }
Source:
public void completeRestoration() { if (state() == State.RUNNING) { return; } if (state() == State.RESTORING) { initializeMetadata(); initializeTopology(); processorContext.initialize(); idleStartTimeMs = RecordQueue.UNKNOWN; transitionTo(State.RUNNING); log.info("Restored and ready to run"); } else { throw new IllegalStateException("Illegal state " + state() + " while completing restoration for active task " + id); } }

Target:
public void completeRestoration() { switch (state()) { case RUNNING: return; case RESTORING: initializeMetadata(); initializeTopology(); processorContext.initialize(); idleStartTimeMs = RecordQueue.UNKNOWN; transitionTo(State.RUNNING); log.info("Restored and ready to run"); break; case CREATED: case SUSPENDED: case CLOSED: throw new IllegalStateException("Illegal state " + state() + " while completing restoration for active task " + id); default: throw new IllegalStateException("Unknown state " + state() + " while completing restoration for active task " + id); } }
Source:
@Test public void deleteRecursiveOnWindows() throws Exception { assumeTrue(Functions.isWindows()); Path targetDir = temp.newFolder("targetDir").toPath(); Path targetContents = Files.createFile(targetDir.resolve("contents.txt")); Path toDelete = temp.newFolder("toDelete").toPath(); Process p = new ProcessBuilder() .directory(toDelete.toFile()) .command("cmd.exe", "/C", "mklink /J junction ..\\targetDir") .start(); assertEquals("unable to create junction", 0, p.waitFor()); Files.createFile(toDelete.resolve("foo")); Files.createFile(toDelete.resolve("bar")); FilePath f = new FilePath(toDelete.toFile()); f.deleteRecursive(); assertTrue("junction target should not be deleted", Files.exists(targetDir)); assertTrue("junction target contents should not be deleted", Files.exists(targetContents)); assertFalse("could not delete target", Files.exists(toDelete)); }

Target:
@Test public void deleteRecursiveOnWindows() throws Exception { assumeTrue("Uses Windows-specific features", Functions.isWindows()); Path targetDir = temp.newFolder("targetDir").toPath(); Path targetContents = Files.createFile(targetDir.resolve("contents.txt")); Path toDelete = temp.newFolder("toDelete").toPath(); Process p = new ProcessBuilder() .directory(toDelete.toFile()) .command("cmd.exe", "/C", "mklink /J junction ..\\targetDir") .start(); assumeThat("unable to create junction", p.waitFor(), is(0)); Files.createFile(toDelete.resolve("foo")); Files.createFile(toDelete.resolve("bar")); FilePath f = new FilePath(toDelete.toFile()); f.deleteRecursive(); assertTrue("junction target should not be deleted", Files.exists(targetDir)); assertTrue("junction target contents should not be deleted", Files.exists(targetContents)); assertFalse("could not delete target", Files.exists(toDelete)); }
Source:
private void addMedia(Uri baseUri, boolean isVideo) { String[] projection = { ID_COL }; Cursor cursor = mContext.getContentResolver().query( baseUri, projection, null, null, null); if (cursor == null) { return; } int idIndex = cursor.getColumnIndexOrThrow(ID_COL); while (cursor.moveToNext()) { PhotoChooserItem item = new PhotoChooserItem(); item._id = cursor.getLong(idIndex); item.uri = Uri.withAppendedPath(baseUri, "" + item._id); item.isVideo = isVideo; tmpList.add(item); } }

Target:
private void addMedia(Uri baseUri, boolean isVideo) { String[] projection = { ID_COL }; Cursor cursor = mContext.getContentResolver().query( baseUri, projection, null, null, null); if (cursor == null) { return; } try { int idIndex = cursor.getColumnIndexOrThrow(ID_COL); while (cursor.moveToNext()) { PhotoChooserItem item = new PhotoChooserItem(); item._id = cursor.getLong(idIndex); item.uri = Uri.withAppendedPath(baseUri, "" + item._id); item.isVideo = isVideo; tmpList.add(item); } } finally { SqlUtils.closeCursor(cursor); } }
Source:
public int compare(SongMetadata songA, SongMetadata songB) { int artistComp = songA.getArtist().compareTo(songB.getArtist()); int albumComp = songA.getAlbum().compareTo(songB.getAlbum()); int titleComp = songA.getTitle().compareTo(songB.getTitle()); if(!songA.getArtist().substring(0, 1).matches("[a-zA-Z]") && songB.getArtist().substring(0, 1).matches("[a-zA-Z]")){ artistComp = 1; } else if(songA.getArtist().substring(0, 1).matches("[a-zA-Z]") && !songB.getArtist().substring(0, 1).matches("[a-zA-Z]")){ artistComp = -1; } if(artistComp!=0){ return artistComp; } if(!songA.getAlbum().substring(0, 1).matches("[a-zA-Z]") && songB.getAlbum().substring(0, 1).matches("[a-zA-Z]")){ albumComp = 1; } else if(songA.getAlbum().substring(0, 1).matches("[a-zA-Z]") && !songB.getAlbum().substring(0, 1).matches("[a-zA-Z]")){ albumComp = -1; } if(albumComp!=0){ return albumComp; } if(!songA.getTitle().substring(0, 1).matches("[a-zA-Z]") && songB.getTitle().substring(0, 1).matches("[a-zA-Z]")){ titleComp = 1; } else if(songA.getTitle().substring(0, 1).matches("[a-zA-Z]") && !songB.getTitle().substring(0, 1).matches("[a-zA-Z]")){ titleComp = -1; } return titleComp; }

Target:
public int compare(SongMetadata songA, SongMetadata songB) { int artistComp = compareStringsWithSpecialChars(songA.getArtist(), songB.getArtist()); if(artistComp!=0){ return artistComp; } int albumComp = compareStringsWithSpecialChars(songA.getAlbum(), songB.getAlbum()); if(albumComp!=0){ return albumComp; } int titleComp = compareStringsWithSpecialChars(songA.getTitle(), songB.getTitle()); return titleComp; }
Source:
public void setupRoutes() { path(controllerPath(), () -> { before("", mimeType, this::setContentType); before("/*", mimeType, this::setContentType); before("", this::verifyContentType); before("/*", this::verifyContentType); before("", mimeType, apiAuthenticationHelper::checkAdminUserAnd403); before("/*", mimeType, apiAuthenticationHelper::checkAdminUserAnd403); get("", mimeType, this::show); patch("", mimeType, this::replaceAndUpdateAdmins); put("", mimeType, this::replaceAndUpdateAdmins); exception(InvalidPluginTypeException.class, (ex, req, res) -> { res.body(this.messageJson(ex)); res.status(HttpStatus.BAD_REQUEST.value()); }); exception(RecordNotFoundException.class, this::notFound); }); }

Target:
public void setupRoutes() { path(controllerPath(), () -> { before("", mimeType, this::setContentType); before("/*", mimeType, this::setContentType); before("", mimeType, this::verifyContentType); before("/*", mimeType, this::verifyContentType); before("", mimeType, apiAuthenticationHelper::checkAdminUserAnd403); before("/*", mimeType, apiAuthenticationHelper::checkAdminUserAnd403); get("", mimeType, this::show); put("", mimeType, this::update); }); }
Source:
public static ScheduledExecutorService newScheduler(int numThreads, String threadNamePrefix, boolean isDaemon) { ScheduledThreadPoolExecutor scheduler = new ScheduledThreadPoolExecutor(numThreads, new SchedulerThreadFactory(threadNamePrefix, isDaemon)); scheduler.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); scheduler.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); scheduler.setRemoveOnCancelPolicy(true); return scheduler; }

Target:
public static ScheduledExecutorService newScheduler(int numThreads, String threadNamePrefix, boolean isDaemon) { ScheduledThreadPoolExecutor scheduler = new ScheduledThreadPoolExecutor(numThreads, new SchedulerThreadFactory(threadNamePrefix, isDaemon)); scheduler.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); scheduler.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); return scheduler; }
Source:
private void checkDeactivatedDirectEdit(SWTBotGefEditPart dEdgeNameEditPartBot, IFigure nameFigure) { Option<IFigure> wrapLabelFigureOption = new FigureQuery(nameFigure).getLabelFigure(); assertTrue("This figure should have a label figure.", wrapLabelFigureOption.some()); assertTrue("The figure of this label should be a SiriusWrapLabel.", wrapLabelFigureOption.get() instanceof SiriusWrapLabel); SiriusWrapLabel viewpointWrapLabel = (SiriusWrapLabel) wrapLabelFigureOption.get(); String wrapText = viewpointWrapLabel.getText(); final long oldTimeout = SWTBotPreferences.TIMEOUT; boolean oldErrorCatchActive = isErrorCatchActive(); setErrorCatchActive(false); SWTBotPreferences.TIMEOUT = 1000; assertLabelMultiLines(nameFigure, 1); boolean noException = editor.directEditType("O\n1\n2", dEdgeNameEditPartBot); if (noException) { fail("DirectEdit should not be enabled on begin and end edge labels."); } SWTBotPreferences.TIMEOUT = oldTimeout; SWTBotUtils.waitAllUiEvents(); assertEquals("DirectEdit should not be enabled on begin and end edge labels.", wrapText, viewpointWrapLabel.getText()); setErrorCatchActive(oldErrorCatchActive); editor.close(); SWTBotUtils.waitAllUiEvents(); }

Target:
private void checkDeactivatedDirectEdit(SWTBotGefEditPart dEdgeNameEditPartBot, IFigure nameFigure) { Option<IFigure> wrapLabelFigureOption = new FigureQuery(nameFigure).getLabelFigure(); assertTrue("This figure should have a label figure.", wrapLabelFigureOption.some()); assertTrue("The figure of this label should be a SiriusWrapLabel.", wrapLabelFigureOption.get() instanceof SiriusWrapLabel); SiriusWrapLabel viewpointWrapLabel = (SiriusWrapLabel) wrapLabelFigureOption.get(); String wrapText = viewpointWrapLabel.getText(); final long oldTimeout = SWTBotPreferences.TIMEOUT; boolean oldErrorCatchActive = isErrorCatchActive(); setErrorCatchActive(false); SWTBotPreferences.TIMEOUT = 1000; assertLabelMultiLines(nameFigure, 1); boolean noException = editor.directEditType("O\n1\n2", dEdgeNameEditPartBot); if (noException) { SWTBotPreferences.TIMEOUT = oldTimeout; fail("DirectEdit should not be enabled on begin and end edge labels."); } SWTBotUtils.waitAllUiEvents(); assertEquals("DirectEdit should not be enabled on begin and end edge labels.", wrapText, viewpointWrapLabel.getText()); setErrorCatchActive(oldErrorCatchActive); editor.close(); SWTBotUtils.waitAllUiEvents(); }
Source:
public void testExistingTargetFileWithError() throws Exception { exit.expectSystemExitWithStatus(2); exit.checkAssertionAfterwards(() -> { final LocalizedMessage auditStartMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, "DefaultLogger.auditStarted", null, null, getClass(), null); final LocalizedMessage auditFinishMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, "DefaultLogger.auditFinished", null, null, getClass(), null); final LocalizedMessage errorCounterMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, "Main.errorCounter", new String[] {String.valueOf(2)}, null, getClass(), null); final LocalizedMessage invalidPatternMessageMain = new LocalizedMessage(0, "com.puppycrawl.tools.checkstyle.checks.naming.messages", "name.invalidPattern", new String[] {"InputMain", "^[a-z0-9]*$"}, null, getClass(), null); final LocalizedMessage invalidPatternMessageMainInner = new LocalizedMessage(0, "com.puppycrawl.tools.checkstyle.checks.naming.messages", "name.invalidPattern", new String[] {"InputMainInner", "^[a-z0-9]*$"}, null, getClass(), null); final String expectedPath = getFilePath("InputMain.java"); assertEquals(String.format(Locale.ROOT, auditStartMessage.getMessage() + "%n" + "[ERROR] %1$s:3:14: " + invalidPatternMessageMain.getMessage() + " [TypeName]%n" + "[ERROR] %1$s:5:7: " + invalidPatternMessageMainInner.getMessage() + " [TypeName]%n" + auditFinishMessage.getMessage() + "%n" + errorCounterMessage.getMessage() + "%n", expectedPath), systemOut.getLog()); assertEquals("", systemErr.getLog()); }); Main.main("-c", getPath("config-classname2-error.xml"), getPath("InputMain.java")); }

Target:
public void testExistingTargetFileWithError() throws Exception { exit.expectSystemExitWithStatus(2); exit.checkAssertionAfterwards(() -> { final LocalizedMessage errorCounterTwoMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, "Main.errorCounter", new String[] {String.valueOf(2)}, null, getClass(), null); final LocalizedMessage invalidPatternMessageMain = new LocalizedMessage(0, "com.puppycrawl.tools.checkstyle.checks.naming.messages", "name.invalidPattern", new String[] {"InputMain", "^[a-z0-9]*$"}, null, getClass(), null); final LocalizedMessage invalidPatternMessageMainInner = new LocalizedMessage(0, "com.puppycrawl.tools.checkstyle.checks.naming.messages", "name.invalidPattern", new String[] {"InputMainInner", "^[a-z0-9]*$"}, null, getClass(), null); final String expectedPath = getFilePath("InputMain.java"); assertEquals(auditStartMessage.getMessage() + EOL + "[ERROR] " + expectedPath + ":3:14: " + invalidPatternMessageMain.getMessage() + " [TypeName]" + EOL + "[ERROR] " + expectedPath + ":5:7: " + invalidPatternMessageMainInner.getMessage() + " [TypeName]" + EOL + auditFinishMessage.getMessage() + EOL + errorCounterTwoMessage.getMessage() + EOL, systemOut.getLog()); assertEquals("", systemErr.getLog()); }); Main.main("-c", getPath("config-classname2-error.xml"), getPath("InputMain.java")); }
Source:
public void testComputeIfAbsent() throws IOException, InvalidChannelException, CompilationException { initChannel(); try { synchronization.computeIfAbsent(CHANNEL1, "c", FUNCTION_WITH_COMPILATION_ERROR); fail("CompilationException should be thrown"); } catch (CompilationException e) { } try { synchronization.computeIfAbsent(CHANNEL1, "c", FUNCTION_WITH_RUNTIME_ERROR); fail("ClosureEvaluationException should be thrown"); } catch (ClosureEvaluationException e) { } synchronization.computeIfAbsent(CHANNEL1, "a", "{k -> x + 1}"); Assert.assertEquals(1, (int) synchronization.get(CHANNEL1, "a")); synchronization.computeIfAbsent(CHANNEL1, "c", "{k -> 7}"); Assert.assertEquals(7, (int) synchronization.get(CHANNEL1, "c")); }

Target:
public void testComputeIfAbsent() throws IOException, InvalidChannelException, CompilationException { initChannel(); try { synchronization.computeIfAbsent(CHANNEL1, "c", FUNCTION_WITH_COMPILATION_ERROR); fail("CompilationException should be thrown"); } catch (CompilationException e) { } try { synchronization.computeIfAbsent(CHANNEL1, "c", FUNCTION_WITH_RUNTIME_ERROR); fail("ClosureEvaluationException should be thrown"); } catch (ClosureEvaluationException e) { } synchronization.computeIfAbsent(CHANNEL1, "a", FUNCTION_INCREMENT_ONE); Assert.assertEquals(1, (int) synchronization.get(CHANNEL1, "a")); synchronization.computeIfAbsent(CHANNEL1, "c", FUNCTION_RETURN_SEVEN); Assert.assertEquals(7, (int) synchronization.get(CHANNEL1, "c")); }
Source:
protected int doWork() { try { IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsWritable(OUTPUT); if (WRITE_READS_FILES) writeReadsFile(INPUT); final SamReader samReader = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE).open(INPUT); switch (FILTER) { case includeAligned: filterReads(new FilteringIterator(samReader.iterator(), new AlignedFilter(true), true)); break; case excludeAligned: filterReads(new FilteringIterator(samReader.iterator(), new AlignedFilter(false), true)); break; case includeReadList: filterReads(new FilteringIterator(samReader.iterator(), new ReadNameFilter(READ_LIST_FILE, true))); break; case excludeReadList: filterReads(new FilteringIterator(samReader.iterator(), new ReadNameFilter(READ_LIST_FILE, false))); break; case includeJavascript: filterReads(new FilteringIterator(samReader.iterator(), JavascriptFilter.makeSamFilter( samReader.getFileHeader(), JAVASCRIPT_FILE))); break; default: throw new UnsupportedOperationException(FILTER.name() + " has not been implemented!"); } IOUtil.assertFileIsReadable(OUTPUT); if (WRITE_READS_FILES) writeReadsFile(OUTPUT); return 0; } catch (Exception e) { if (OUTPUT.exists() && !OUTPUT.delete()) { log.warn("Failed to delete " + OUTPUT.getAbsolutePath()); } log.error(e, "Failed to filter " + INPUT.getName()); return 1; } }

Target:
protected int doWork() { try { IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsWritable(OUTPUT); if (WRITE_READS_FILES) writeReadsFile(INPUT); final SamReader samReader = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE).open(INPUT); final FilteringIterator filteringIterator; switch (FILTER) { case includeAligned: filteringIterator = new FilteringIterator(samReader.iterator(), new AlignedFilter(true), true); break; case excludeAligned: filteringIterator = new FilteringIterator(samReader.iterator(), new AlignedFilter(false), true); break; case includeReadList: filteringIterator = new FilteringIterator(samReader.iterator(), new ReadNameFilter(READ_LIST_FILE, true)); break; case excludeReadList: filteringIterator = new FilteringIterator(samReader.iterator(), new ReadNameFilter(READ_LIST_FILE, false)); break; case includeJavascript: filteringIterator = new FilteringIterator(samReader.iterator(), new JavascriptSamRecordFilter( JAVASCRIPT_FILE, samReader.getFileHeader() )); break; default: throw new UnsupportedOperationException(FILTER.name() + " has not been implemented!"); } filterReads(filteringIterator); IOUtil.assertFileIsReadable(OUTPUT); if (WRITE_READS_FILES) writeReadsFile(OUTPUT); return 0; } catch (Exception e) { if (OUTPUT.exists() && !OUTPUT.delete()) { log.warn("Failed to delete " + OUTPUT.getAbsolutePath()); } log.error(e, "Failed to filter " + INPUT.getName()); return 1; } }
Source:
public <T> PersistentParameter<T> getNewParameter(Class<T> clazz, String label, boolean perInstance, T defaultValue) { if (String.class.isAssignableFrom(clazz) || Integer.class.isAssignableFrom(clazz) || Boolean.class.isAssignableFrom(clazz)) { PersistentParameter<T> setting; setting = new PersistentParameter<T>(clazz, perInstance, getStorageKey(perInstance) + "+" + label); setting.setDefault(defaultValue); return setting; } else { throw new InvalidParameterException("Unsupported class type: " + clazz.toString()); } }

Target:
public <T> PersistentParameter<T> getNewParameter(Class<T> clazz, String label, boolean perInstance, T defaultValue) { if (String.class.isAssignableFrom(clazz) || Integer.class.isAssignableFrom(clazz) || Boolean.class.isAssignableFrom(clazz)) { PersistentParameter<T> setting; setting = new PersistentParameter<T>(clazz, perInstance, getStorageKey(perInstance) + "." + label); setting.setDefault(defaultValue); return setting; } else { throw new InvalidParameterException("Unsupported class type: " + clazz.toString()); } }
Source:
protected void executeQueryCommand() { VDSGroup cluster = getDbFacade().getVdsGroupDao().get(getParameters().getId()); if (cluster.getArchitecture() == ArchitectureType.undefined) { getQueryReturnValue().setReturnValue(true); return; } List<VdsStatic> allVdsForVdsGroup = getDbFacade().getVdsStaticDao().getAllForVdsGroup(cluster.getId()); List<VM> allVmsForVdsGroup = getDbFacade().getVmDao().getAllForVdsGroup(cluster.getId()); Boolean isEmpty = allVmsForVdsGroup.isEmpty() && allVdsForVdsGroup.isEmpty(); getQueryReturnValue().setReturnValue(isEmpty); }

Target:
protected void executeQueryCommand() { VDSGroup cluster = getDbFacade().getVdsGroupDao().getIsEmpty(getParameters().getId()); getQueryReturnValue().setReturnValue(cluster != null); }
Source:
public String getAdminUri() { if (StringUtils.hasText(this.adminUri)) { return this.adminUri; } else if (!StringUtils.hasText(this.hostName)) { return "http://localhost:15672/api/"; } else { return "http://" + this.hostName + ":15672/api/"; } }

Target:
public String getAdminUri() { if (!StringUtils.hasText(this.adminUri)) { if (!StringUtils.hasText(this.hostName)) { this.adminUri = "http://localhost:15672/api/"; } else { this.adminUri = "http://" + this.hostName + ":15672/api/"; } } return this.adminUri; }
Source:
public Response compensate(@PathParam("participantId") String participantId, @HeaderParam(LRA_HTTP_CONTEXT_HEADER) String lraId, @HeaderParam(LRA_HTTP_PARENT_CONTEXT_HEADER) String parentId) { return lraParticipantRegistry.getParticipant(participantId).compensate(createURI(lraId), createURI(parentId)); }

Target:
public Response compensate(@PathParam("participantId") String participantId, @HeaderParam(LRA_HTTP_CONTEXT_HEADER) String lraId, @HeaderParam(LRA_HTTP_PARENT_CONTEXT_HEADER) String parentId) { return getParticipant(participantId).compensate(createURI(lraId), createURI(parentId)); }
Source:
private void checkFilePermissionsX00(String file) { File f = new File(Os.tidyPath(file)); if (f.exists() && f.isFile() && f.canRead()) { try { Maybe<String> permission = FileUtil.getFilePermissions(f); if (permission.isAbsent()) { LOG.debug("Could not determine permissions of global brooklyn properties file; assuming ok: "+f); } else { if (!permission.get().substring(4).equals("------")) { throw new FatalRuntimeException("Invalid permissions for file "+file+"; expected 600 but was "+permission.get()); } } } catch (FileNotFoundException e) { throw Exceptions.propagate(e); } } }

Target:
private void checkFilePermissionsX00(String file) { File f = new File(Os.tidyPath(file)); Maybe<String> permission = FileUtil.getFilePermissions(f); if (permission.isAbsent()) { LOG.debug("Could not determine permissions of file; assuming ok: "+f); } else { if (!permission.get().substring(4).equals("------")) { throw new FatalRuntimeException("Invalid permissions for file "+file+"; expected ?00 but was "+permission.get()); } } }
Source:
public void init() throws SQLException, IOException { init(featureType.getTypeName() + "." + dataStore.encodeFID(key, rs, offset)); for (int k = 0; k < values.length; k++) getAttribute(k); }

Target:
public void init() throws SQLException, IOException { init(featureType.getTypeName() + "." + dataStore.encodeFID(key, rs, offset)); }
Source:
private String toStackTrace(final Throwable throwable) { StringWriter stringWriter = new StringWriter(); PrintWriter stream = new PrintWriter(stringWriter); if (throwable != null) { throwable.printStackTrace(stream); } return stringWriter.toString().substring(0, stringWriter.toString().length() - 1); }

Target:
private String toStackTrace(final Throwable throwable) { final StringWriter stringWriter = new StringWriter(); final PrintWriter stream = new PrintWriter(stringWriter); if (throwable != null) { throwable.printStackTrace(stream); } return stringWriter.toString().substring(0, stringWriter.toString().length() - 1); }
Source:
static String getJdbcUrl(ConfigurationProperties props) { String url = props.getProperty(PROPERTY_DB_URL); if (DEFAULT_TYPE.equals(getDbType(props))) { if (!url.contains("?")) { url += "?useUnicode=yes&characterEncoding=utf8&nullNamePatternMatchesAll=true&cachePrepStmts=true&useServerPrepStmts=true&serverTimezone=UTC"; } else { String urlLwr = url.toLowerCase(); if (!urlLwr.contains("useunicode")) { url += "&useUnicode=yes"; } if (!urlLwr.contains("characterencoding")) { url += "&characterEncoding=utf8"; } if (!urlLwr.contains("nullnamepatternmatchesall")) { url += "&nullNamePatternMatchesAll=true"; } if (!urlLwr.contains("cacheprepstmts")) { url += "&cachePrepStmts=true"; } if (!urlLwr.contains("useserverprepstmts")) { url += "&useServerPrepStmts=true"; } if (!urlLwr.contains("servertimezone")) { url += "serverTimezone=UTC"; } } } return url; }

Target:
static String getJdbcUrl(ConfigurationProperties props) { String url = props.getProperty(PROPERTY_DB_URL); if (DEFAULT_TYPE.equals(getDbType(props))) { if (!url.contains("?")) { url += "?useUnicode=yes&characterEncoding=utf8&nullNamePatternMatchesAll=true&cachePrepStmts=true&useServerPrepStmts=true&serverTimezone=UTC"; } else { String urlLwr = url.toLowerCase(); if (!urlLwr.contains("useunicode")) { url += "&useUnicode=yes"; } if (!urlLwr.contains("characterencoding")) { url += "&characterEncoding=utf8"; } if (!urlLwr.contains("nullnamepatternmatchesall")) { url += "&nullNamePatternMatchesAll=true"; } if (!urlLwr.contains("cacheprepstmts")) { url += "&cachePrepStmts=true"; } if (!urlLwr.contains("useserverprepstmts")) { url += "&useServerPrepStmts=true"; } if (!urlLwr.contains("servertimezone")) { url += "&serverTimezone=UTC"; } } } return url; }
Source:
public void testMapping() throws Exception { OgmSession session = openSession(); Transaction transaction = session.beginTransaction(); rowAssertion( session.getSessionFactory(), "GrandMother" ) .id( "id", granny.getId() ) .assertNoOtherColumnPresent() .execute(); rowAssertion( session.getSessionFactory(), "GrandMother_grandChildren" ) .id( "GrandMother_id", granny.getId() ) .id( "birthorder", 0 ) .assertColumn( "grandChildren.name", "Luke" ) .assertNoOtherColumnPresent() .execute(); rowAssertion( session.getSessionFactory(), "GrandMother_grandChildren" ) .id( "GrandMother_id", granny.getId() ) .id( "birthorder", 1 ) .assertColumn( "grandChildren.name", "Leia" ) .assertNoOtherColumnPresent() .execute(); transaction.commit(); session.close(); }

Target:
public void testMapping() throws Exception { OgmSession session = openSession(); Transaction transaction = session.beginTransaction(); rowAssertion( session.getSessionFactory(), "GrandMother" ) .keyColumn( "id", granny.getId() ) .assertNoOtherColumnPresent() .execute(); rowAssertion( session.getSessionFactory(), "GrandMother_grandChildren" ) .keyColumn( "GrandMother_id", granny.getId() ) .keyColumn( "birthorder", 0 ) .assertColumn( "grandChildren.name", "Luke" ) .assertNoOtherColumnPresent() .execute(); rowAssertion( session.getSessionFactory(), "GrandMother_grandChildren" ) .keyColumn( "GrandMother_id", granny.getId() ) .keyColumn( "birthorder", 1 ) .assertColumn( "grandChildren.name", "Leia" ) .assertNoOtherColumnPresent() .execute(); transaction.commit(); session.close(); }
Source:
public VM(VmStatic vmStatic, VmDynamic vmDynamic, VmStatistics vmStatistics) { mDiskMap = new java.util.HashMap<String, DiskImage>(); mCdPath = ""; mFloppyPath = ""; mRunAndPause = false; _diskSize = 0; mVmStatic = vmStatic; mVmDynamic = vmDynamic; mVmStatistics = vmStatistics; if (mVmStatic != null) { mVmStatic.setImages(new java.util.ArrayList<DiskImage>()); mVmStatic.setInterfaces(new java.util.ArrayList<VmNetworkInterface>()); } }

Target:
public VM(VmStatic vmStatic, VmDynamic vmDynamic, VmStatistics vmStatistics) { mDiskMap = new java.util.HashMap<String, DiskImage>(); mCdPath = ""; mFloppyPath = ""; mRunAndPause = false; _diskSize = 0; mVmStatic = vmStatic; mVmDynamic = vmDynamic; mVmStatistics = vmStatistics; if (mVmStatic != null) { mVmStatic.setImages(new ArrayList<DiskImage>()); mVmStatic.setInterfaces(new ArrayList<VmNetworkInterface>()); } }
Source:
protected void assertStandardForeignIndividualValues(TaxRule rule) { assertEquals(PaymentWorksConstants.PaymentWorksTaxClassification.INDIVIDUAL_SOLE_PROPRIETOR.getTranslationToKfsOwnershipTypeCode(), rule.ownershipTypeCode); assertFalse(rule.populateW9Attributes); assertTrue(rule.populateFirstLastLegalName); assertFalse(rule.populateBusinessLegalName); assertTrue(rule.isForeign); assertTrue(rule.populateDateOfBirth); assertEquals("BN", rule.w8TypeCode); }

Target:
protected void assertStandardForeignIndividualValues(TaxRule rule) { assertEquals(PaymentWorksConstants.PaymentWorksTaxClassification.INDIVIDUAL_SOLE_PROPRIETOR.getTranslationToKfsOwnershipTypeCode(), rule.ownershipTypeCode); assertFalse(rule.populateW9Attributes); assertTrue(rule.populateFirstLastLegalName); assertFalse(rule.populateBusinessLegalName); assertTrue(rule.isForeign); assertTrue(rule.populateDateOfBirth); assertEquals(PaymentWorksConstants.W8TypeCodes.BN, rule.w8TypeCode); }
Source:
public void visit(RepositoryBuild build) throws Exception { Set<String> userEmailsToSendMessagesTo = getOptedInUserEmailsForBuild(build); boolean shouldSendMessage = shouldSendMessage(build, userEmailsToSendMessagesTo); if (shouldSendMessage) { for (String email : userEmailsToSendMessagesTo) { slackClientWrapper.sendMessageToUserByEmail(email, "", slackMessageBuildingUtils.buildSlackAttachment(build)); } } }

Target:
public void visit(RepositoryBuild build) throws Exception { Set<String> userEmailsToSendMessagesTo = getUserEmailsToDirectlyNotify(build); boolean shouldSendMessage = shouldSendMessage(build, userEmailsToSendMessagesTo); if (shouldSendMessage) { for (String email : userEmailsToSendMessagesTo) { String message = "A build started by your code push was not successful"; blazarSlackClient.sendMessageToUser(email, message, slackMessageBuildingUtils.buildSlackAttachment(build)); } } }
Source:
@Override public RelDataType inferReturnType(SqlOperatorBinding opBinding) { final RelDataTypeFactory typeFactory = opBinding.getTypeFactory(); final RelDataType operandType = opBinding.getOperandType(0); switch (operandType.getSqlTypeName()) { case ARRAY: return typeFactory.createTypeWithNullability( operandType.getComponentType(), true); case MAP: return typeFactory.createTypeWithNullability(operandType.getValueType(), true); case ROW: int lastOperandIdx = opBinding.getOperandCount() - 1; String fieldName = opBinding.getOperandLiteralValue(lastOperandIdx, String.class); return operandType.getFieldList().stream() .filter(field -> field.getName().equalsIgnoreCase(fieldName)) .findFirst().map(RelDataTypeField::getType) .orElseThrow(() -> new AssertionError("Cannot infer type of field '" + fieldName + "' within ROW type: " + operandType)); case ANY: case DYNAMIC_STAR: return typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.ANY), true); default: throw new AssertionError(); } }

Target:
@Override public RelDataType inferReturnType(SqlOperatorBinding opBinding) { final RelDataTypeFactory typeFactory = opBinding.getTypeFactory(); final RelDataType operandType = opBinding.getOperandType(0); switch (operandType.getSqlTypeName()) { case ARRAY: return typeFactory.createTypeWithNullability( operandType.getComponentType(), true); case MAP: return typeFactory.createTypeWithNullability(operandType.getValueType(), true); case ROW: String fieldName = opBinding.getOperandLiteralValue(1, String.class); RelDataTypeField field = operandType.getField(fieldName, false, false); if (field == null) { throw new AssertionError("Cannot infer type of field '" + fieldName + "' within ROW type: " + operandType); } else { return field.getType(); } case ANY: case DYNAMIC_STAR: return typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.ANY), true); default: throw new AssertionError(); } }
Source:
public Optional<Argument> build(Type expectedType, Object value, ConfigRegistry config) { if (expectedType == Name.class || value instanceof Name) { Name nameValue = (Name) value; return config.get(Arguments.class).findFor(String.class, nameValue.getFullName(), config); } return Optional.empty(); }

Target:
public Optional<Argument> build(Type expectedType, Object value, ConfigRegistry config) { if (expectedType == Name.class || value instanceof Name) { Name nameValue = (Name) value; return config.get(Arguments.class).findFor(String.class, nameValue.getFullName()); } return Optional.empty(); }
Source:
public static Predicate<ServerCreated> awaitActive(ServerApi serverApi) { ServerActivePredicate statusPredicate = new ServerActivePredicate(serverApi, ACTIVE); return retry(statusPredicate, 600, 5, 5, SECONDS); }

Target:
public static Predicate<String> awaitActive(ServerApi serverApi) { return awaitStatus(serverApi, ACTIVE, TEN_MINUTES, FIVE_SECONDS); }
Source:
public CosmosChangeFeedBasedReplicationFeed(CosmosDataAccessor cosmosDataAccessor, AzureMetrics azureMetrics) { this.defaultCacheSize = AzureCloudDestination.getFindSinceQueryLimit(); changeFeedCache = new ConcurrentHashMap<>(); this.cosmosDataAccessor = cosmosDataAccessor; this.azureMetrics = azureMetrics; Utils.newScheduler(1, false) .scheduleAtFixedRate(() -> changeFeedCache.entrySet().removeIf(entry -> entry.getValue().isExpired()), CACHE_INVALIDATION_DURATION_IN_MILLIS, CACHE_INVALIDATION_DURATION_IN_MILLIS, TimeUnit.MILLISECONDS); }

Target:
public CosmosChangeFeedBasedReplicationFeed(CosmosDataAccessor cosmosDataAccessor, AzureMetrics azureMetrics) { this.defaultCacheSize = AzureCloudDestination.getFindSinceQueryLimit(); changeFeedCache = new ConcurrentHashMap<>(); this.cosmosDataAccessor = cosmosDataAccessor; this.azureMetrics = azureMetrics; scheduler = Utils.newScheduler(1, false); scheduler.scheduleAtFixedRate(() -> changeFeedCache.entrySet().removeIf(entry -> entry.getValue().isExpired()), CACHE_VALID_DURATION_IN_MS, CACHE_VALID_DURATION_IN_MS, TimeUnit.MILLISECONDS); }
Source:
private void buildTeamsStatisticsTableForSectionPanel( InstructorFeedbackResultsSectionPanel sectionPanel, Map<String, Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>> responsesGroupedByTeam, Set<String> teamsInSection) { Map<String, List<InstructorFeedbackResultsQuestionTable>> teamToStatisticsTables = new HashMap<String, List<InstructorFeedbackResultsQuestionTable>>(); for (String team : teamsInSection) { if (!responsesGroupedByTeam.containsKey(team) || !bundle.rosterTeamNameMembersTable.containsKey(team)) { continue; } List<InstructorFeedbackResultsQuestionTable> statisticsTablesForTeam = new ArrayList<InstructorFeedbackResultsQuestionTable>(); for (FeedbackQuestionAttributes question : bundle.questions.values()) { if (!responsesGroupedByTeam.get(team).containsKey(question)) { continue; } List<FeedbackResponseAttributes> responsesForTeamAndQuestion = responsesGroupedByTeam.get(team).get(question); InstructorFeedbackResultsQuestionTable statsTable = buildQuestionTableWithoutResponseRows( question, responsesForTeamAndQuestion, ""); statsTable.setCollapsible(false); if (!statsTable.getQuestionStatisticsTable().isEmpty()) { statisticsTablesForTeam.add(statsTable); } } InstructorFeedbackResultsQuestionTable.sortByQuestionNumber(statisticsTablesForTeam); teamToStatisticsTables.put(team, statisticsTablesForTeam); } sectionPanel.setTeamStatisticsTable(teamToStatisticsTables); }

Target:
private void buildTeamsStatisticsTableForSectionPanel( InstructorFeedbackResultsSectionPanel sectionPanel, Map<String, Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>> responsesGroupedByTeam, Set<String> teamsInSection) { Map<String, List<InstructorFeedbackResultsQuestionTable>> teamToStatisticsTables = new HashMap<String, List<InstructorFeedbackResultsQuestionTable>>(); for (String team : teamsInSection) { if (!responsesGroupedByTeam.containsKey(team) || !isTeamVisible(team)) { continue; } List<InstructorFeedbackResultsQuestionTable> statisticsTablesForTeam = new ArrayList<InstructorFeedbackResultsQuestionTable>(); for (FeedbackQuestionAttributes question : bundle.questions.values()) { if (!responsesGroupedByTeam.get(team).containsKey(question)) { continue; } List<FeedbackResponseAttributes> responsesForTeamAndQuestion = responsesGroupedByTeam.get(team).get(question); InstructorFeedbackResultsQuestionTable statsTable = buildQuestionTableWithoutResponseRows( question, responsesForTeamAndQuestion, ""); statsTable.setCollapsible(false); if (!statsTable.getQuestionStatisticsTable().isEmpty()) { statisticsTablesForTeam.add(statsTable); } } InstructorFeedbackResultsQuestionTable.sortByQuestionNumber(statisticsTablesForTeam); teamToStatisticsTables.put(team, statisticsTablesForTeam); } sectionPanel.setTeamStatisticsTable(teamToStatisticsTables); }