auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>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(); <START> if (items.size() == 0) { <END> 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); } } }</code><technical_language>items.isEmpty()</technical_language>

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:
<code><START> public void OnURLChosen(String url) { <END> Log.d("DEBUG-d", "SetupEnterURLFragment returned: " + url); incomingRef = url; this.uiState = UiState.ready; uiStateScreenTransition(); }</code><technical_language>Sandwiching a method in-between class fields is a bad place for a method. Please move this class constructor</technical_language>

Target:
public void OnURLChosen(String url) { if(BuildConfig.DEBUG) { Log.d("DEBUG-d", "SetupEnterURLFragment returned: " + url); } incomingRef = url; this.uiState = UiState.ready; uiStateScreenTransition(); }
Source:
<code>private void parseUpdate(final ReceiveCommand cmd) { if (isHead(cmd) && canPerform(PUSH_HEAD, PUSH_HEAD_UPDATE) <START> && projectControl.canUploadToRef(cmd.getRefName())) { <END> } else { reject(cmd); } }</code><technical_language>NAK. I a RefControl for refName asking refControl.canPerform(PUSH_HEAD, PUSH_HEAD_UPDATE)</technical_language>

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:
<code>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 = <START> loadTableTask(table, replicationSpec, event.metadataPath(), table.getDataLocation()); <END> alterTableTask.addDependentTask(loadTableTask); tracker.addTask(alterTableTask); } } }</code><technical_language>3rd parameter replaced table.getDataLocation() last</technical_language>

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:
<code>private void attachRecyclerViewAdapter() { final RecyclerView.Adapter adapter = newAdapter(); <START> adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { <END> @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); }</code><technical_language>replace non-scrolling pieces of this watching onDataChanged</technical_language>

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:
<code>public void theGetActualMeterReadsRequestIsReceived(final Map<String, String> settings) throws Throwable { <START> final ActualMeterReadsGasRequest request = ActualMeterReadsGasRequestFactory.forDevice(settings); <END> final ActualMeterReadsGasAsyncResponse asyncResponse = this.requestClient.doRequest(request); assertNotNull("asyncRespone should not be null", asyncResponse); ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid()); }</code><technical_language>factory method forDevice a bit odd map argument. I if method named fromParameterMap, if device identification extracted in step implementation parameter forDevice</technical_language>

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:
<code>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"); <START> } <END> ft.disallowAddToBackStack().commit(); } else { emailLayout.setError(getString(R.string.fui_error_email_does_not_exist)); } }</code><technical_language>@clydebarrow Checkstyle is correct: please remove new line if statement pull indentation end bracket is aligned i in if code is indented 4 spaces</technical_language>

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:
<code>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()) { <START> if (!keys.contains(entry.getKey()) && !entry.getValue().isRemoved() && !entry.getValue().isNull()) { <END> if (size++ == Integer.MAX_VALUE) { return Integer.MAX_VALUE; } } } return size; }</code><technical_language>in loop above, checking entry.getValue().isNull()</technical_language>

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:
<code>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 { <START> OS.g_signal_connect_closure_by_id (handle, <END> 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); } }</code><technical_language>drop if (!OS.GTK3) EXPOSE EVENT connect once. is point in having: if (true) { connect ExposeEvent } else{ connect ExposeEvent } thing</technical_language>

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:
<code>public void completeRestoration() { if (state() == State.RUNNING) { return; } <START> <END> 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); } }</code><technical_language>if/ else if for consistency</technical_language>

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:
<code>@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(); <START> assertEquals("unable to create junction", 0, p.waitFor()); <END> 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)); }</code><technical_language>bug: assume assert. windows users / version combinations create links / junctions this a failing test</technical_language>

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:
<code>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); } <START> } <END></code><technical_language>call cursor.close() here</technical_language>

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:
<code>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; } <START> else if(songA.getArtist().substring(0, 1).matches("[a-zA-Z]") && !songB.getArtist().substring(0, 1).matches("[a-zA-Z]")){ <END> 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; }</code><technical_language>I dont mind this method of string comparisons for now. problem is repeated code</technical_language>

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:
<code>public void setupRoutes() { path(controllerPath(), () -> { <START> before("", mimeType, this::setContentType); <END> 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); }); }</code><technical_language>adding mimeType</technical_language>

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:
<code>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); <START> scheduler.setRemoveOnCancelPolicy(true); <END> return scheduler; }</code><technical_language>I wary this. coz, existing schedulers this setting this removed immediately. ideally want in position, rolling this out, want unexpected behaviors</technical_language>

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:
<code>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); <START> 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; <END> SWTBotUtils.waitAllUiEvents(); assertEquals("DirectEdit should not be enabled on begin and end edge labels.", wrapText, viewpointWrapLabel.getText()); setErrorCatchActive(oldErrorCatchActive); editor.close(); SWTBotUtils.waitAllUiEvents(); }</code><technical_language>formatting wrong (at in Gerrit UI)</technical_language>

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:
<code>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) { } <START> synchronization.computeIfAbsent(CHANNEL1, "a", "{k -> x + 1}"); <END> Assert.assertEquals(1, (int) synchronization.get(CHANNEL1, "a")); synchronization.computeIfAbsent(CHANNEL1, "c", "{k -> 7}"); Assert.assertEquals(7, (int) synchronization.get(CHANNEL1, "c")); }</code><technical_language>for rest, a constant for "{k -> x + 1}"</technical_language>

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:
<code>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: <START> filterReads(new FilteringIterator(samReader.iterator(), <END> 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; } }</code><technical_language>assert file is readable</technical_language>

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:
<code><START> public <T> PersistentParameter<T> getNewParameter(Class<T> clazz, String label, boolean perInstance, T defaultValue) { <END> 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()); } }</code><technical_language>thinking it, I keeping Class parameter is better. If not, tricky in case defaultValue null</technical_language>

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:
<code>protected void executeQueryCommand() { VDSGroup cluster = getDbFacade().getVdsGroupDao().get(getParameters().getId()); if (cluster.getArchitecture() == ArchitectureType.undefined) { getQueryReturnValue().setReturnValue(true); return; } <START> <END> 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); }</code><technical_language>combine 2 in single stored procedure VdsGroupDao</technical_language>

Target:
protected void executeQueryCommand() { VDSGroup cluster = getDbFacade().getVdsGroupDao().getIsEmpty(getParameters().getId()); getQueryReturnValue().setReturnValue(cluster != null); }
Source:
<code>public String getAdminUri() { if (StringUtils.hasText(this.adminUri)) { return this.adminUri; } else if (!StringUtils.hasText(this.hostName)) { return "http://localhost:15672/api/"; } else { <START> return "http://" + this.hostName + ":15672/api/"; <END> } }</code><technical_language>cache result of calculations of this method adminUri</technical_language>

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:
<code>public Response compensate(@PathParam("participantId") String participantId, @HeaderParam(LRA_HTTP_CONTEXT_HEADER) String lraId, @HeaderParam(LRA_HTTP_PARENT_CONTEXT_HEADER) String parentId) { <START> return lraParticipantRegistry.getParticipant(participantId).compensate(createURI(lraId), createURI(parentId)); <END> }</code><technical_language>If participant registry throw a null pointer caught reported HTTP 404 status code</technical_language>

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:
<code>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()) { <START> LOG.debug("Could not determine permissions of global brooklyn properties file; assuming ok: "+f); <END> } 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); } } }</code><technical_language>necessarily global properties file. Strictly speaking, necessarily a properties file (based name of method) picky</technical_language>

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:
<code>public void init() throws SQLException, IOException { init(featureType.getTypeName() + "." + dataStore.encodeFID(key, rs, offset)); <START> for (int k = 0; k < values.length; k++) END> getAttribute(k); }</code><technical_language>Finally managed sit PR computer. This initialization delayed reading in getAttribute(String) void harms performance. moded getAttributes instead (branches subject review open for reviewers modify). verified build works in H2, postgis, in mysql, online tests enabled. double check needed</technical_language>

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

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:
<code>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")) { <START> url += "serverTimezone=UTC"; <END> } } } return url; }</code><technical_language>Needs ampersand start separate additional parameter</technical_language>

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:
<code>public void testMapping() throws Exception { OgmSession session = openSession(); Transaction transaction = session.beginTransaction(); rowAssertion( session.getSessionFactory(), "GrandMother" ) .id( "id", granny.getId() ) .assertNoOtherColumnPresent() .execute(); <START> rowAssertion( session.getSessionFactory(), "GrandMother_grandChildren" ) <END> .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(); }</code><technical_language>I approach, allow implement identically for other dialects. rename id() keyColumn, is: id/key comprising of columns, ids</technical_language>

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:
<code>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) { <START> mVmStatic.setImages(new java.util.ArrayList<DiskImage>()); <END> mVmStatic.setInterfaces(new java.util.ArrayList<VmNetworkInterface>()); } }</code><technical_language>please omit java.util. prefix. ArrayList is imported (from lines)</technical_language>

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:
<code>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); <START> assertEquals("BN", rule.w8TypeCode); <END> }</code><technical_language>some constants defined for literal W8 type values</technical_language>

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:
<code>public void visit(RepositoryBuild build) throws Exception { Set<String> userEmailsToSendMessagesTo = getOptedInUserEmailsForBuild(build); boolean shouldSendMessage = shouldSendMessage(build, userEmailsToSendMessagesTo); if (shouldSendMessage) { for (String email : userEmailsToSendMessagesTo) { <START> slackClientWrapper.sendMessageToUserByEmail(email, "", slackMessageBuildingUtils.buildSlackAttachment(build)); <END> } } }</code><technical_language>slackClientWrapper.sendMessageToUserByEmail is a bit confusing (sounds sending email slack). method name sendMessage (overloaded) named private methods (name private methods sendMessageWithoutRetries that)</technical_language>

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:
<code>@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)) <START> .findFirst().map(RelDataTypeField::getType) <END> .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(); } }</code><technical_language>suggestion .findFirst() .map(RelDataTypeField::getType)</technical_language>

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:
<code>public Optional<Argument> build(Type expectedType, Object value, ConfigRegistry config) { if (expectedType == Name.class || value instanceof Name) { Name nameValue = (Name) value; <START> return config.get(Arguments.class).findFor(String.class, nameValue.getFullName(), config); <END> } return Optional.empty(); }</code><technical_language>feel weird pass config _from_ config. debated config registry optionally inject config types. Edit: consider this separately this PR, I wanted bring while a propos</technical_language>

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:
<code>public static Predicate<ServerCreated> awaitActive(ServerApi serverApi) { ServerActivePredicate statusPredicate = new ServerActivePredicate(serverApi, ACTIVE); <START> return retry(statusPredicate, 600, 5, 5, SECONDS); <END> }</code><technical_language>600 5 constants</technical_language>

Target:
public static Predicate<String> awaitActive(ServerApi serverApi) { return awaitStatus(serverApi, ACTIVE, TEN_MINUTES, FIVE_SECONDS); }
Source:
<code>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()), <START> CACHE_INVALIDATION_DURATION_IN_MILLIS, CACHE_INVALIDATION_DURATION_IN_MILLIS, TimeUnit.MILLISECONDS); <END> }</code><technical_language>I choose CACHE_INVALIDATION_DURATION_IN_MILLIS initial delay. a random initial delay</technical_language>

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:
<code>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) { <START> if (!responsesGroupedByTeam.containsKey(team) || !bundle.rosterTeamNameMembersTable.containsKey(team)) { <END> 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); }</code><technical_language>extract bundle.rosterTeamNameMembersTable.containsKey(team) some isTeamAnonymous() method? a named variable is fine too, if this is more once, a method better</technical_language>

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); }