auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void respond(IRequestCycle requestCycle) { WebApplication application = WebApplication.get(); Integer pageId = pageKey.getPageId(); <START> Session.get().getPageManager().touchPage(new Page() { <END> @Override public PageParameters getPageParameters() { return super.getPageParameters(); } @Override public int getPageId() { return 0; } }); Page page = (Page) Session.get().getPageManager().getPage(pageId); if (page != null) { page.dirty(); AjaxRequestTarget target = application.newAjaxRequestTarget(page); executeHandlers(target, page); } else { LOGGER.warn("Could not find a page with id '{}' for session with id '{}' in the page stores. It will be unregistered", pageId, pageKey.getSessionId()); EventBus.get(application).unregister(pageKey); } }</code><technical_language>this is needed</technical_language>

Target:
public void respond(IRequestCycle requestCycle) { WebApplication application = WebApplication.get(); Integer pageId = pageKey.getPageId(); Page page = (Page) Session.get().getPageManager().getPage(pageId); if (page != null) { page.dirty(); AjaxRequestTarget target = application.newAjaxRequestTarget(page); executeHandlers(target, page); } else { LOGGER.warn("Could not find a page with id '{}' for session with id '{}' in the page stores. It will be unregistered", pageId, pageKey.getSessionId()); EventBus.get(application).unregister(pageKey); } }
Source:
<code>public PendingTaskBasedWorkerProvisioningStrategy( PendingTaskBasedWorkerProvisioningConfig config, Supplier<WorkerBehaviorConfig> workerConfigRef, ProvisioningSchedulerConfig provisioningSchedulerConfig ) { this( config, workerConfigRef, provisioningSchedulerConfig, new Supplier<ScheduledExecutorService>() { @Override public ScheduledExecutorService get() { <START> return ScheduledExecutors.fixed(1, "PendingTaskBasedResourceManagement-manager--%d"); <END> } } ); }</code><technical_language>I suggest "PendingTaskBasedWorkerProvisioning-manager--%d" correspond changed class name</technical_language>

Target:
public PendingTaskBasedWorkerProvisioningStrategy( PendingTaskBasedWorkerProvisioningConfig config, Supplier<WorkerBehaviorConfig> workerConfigRef, ProvisioningSchedulerConfig provisioningSchedulerConfig ) { this( config, workerConfigRef, provisioningSchedulerConfig, new Supplier<ScheduledExecutorService>() { @Override public ScheduledExecutorService get() { return ScheduledExecutors.fixed(1, "PendingTaskBasedWorkerProvisioning-manager--%d"); } } ); }
Source:
<code>String getName() { if (uri != null) { return uri.getPath(); } else if (resourcePackage != null) { <START> return new StringBuilder(resourcePackage).append(':').append(resourceId).toString(); <END> } return Integer.toHexString(resourceId); }</code><technical_language>+ together</technical_language>

Target:
String getName() { if (uri != null) { return uri.getPath(); } else if (resourcePackage != null) { return resourcePackage + ':' + resourceId; } return Integer.toHexString(resourceId); }
Source:
<code>public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); butPlay.setOnClickListener(v -> { if (controller != null && controller.getMedia().getMediaType() == MediaType.VIDEO) { controller.playPause(); if(controller.getStatus() != PlayerStatus.PLAYING) { getContext().startActivity(PlaybackService.getPlayerActivityIntent(getContext(),controller.getMedia())); } <START> }else if (controller != null) { <END> controller.playPause(); } }); loadMediaInfo(); }</code><technical_language>ensures is race condition calling playPause player status interfere. if (controller != null) { if (video playing) { playPause() // Do call checking player status starting activity start activity } else { playPause(); } }</technical_language>

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); butPlay.setOnClickListener(v -> { if (controller != null) { if (controller.getMedia().getMediaType() == MediaType.VIDEO && controller.getStatus() != PlayerStatus.PLAYING) { controller.playPause(); getContext().startActivity(PlaybackService .getPlayerActivityIntent(getContext(), controller.getMedia())); } else { controller.playPause(); } } }); loadMediaInfo(); }
Source:
<code>private void showDownloadSizeExceedDialog(final ArrayList<DownloadEntry> de, final int noOfDownloads, final FragmentActivity activity, final DownloadManagerCallback callback) { Map<String, String> dialogMap = new HashMap<String, String>(); dialogMap.put("title", activity.getString(R.string.download_exceed_title)); dialogMap.put("message_1", activity.getString(R.string.download_exceed_message)); downloadFragment = DownloadSizeExceedDialog.newInstance(dialogMap, new IDialogCallback() { @Override public void onPositiveClicked() { if (!de.isEmpty()) { startDownload(de, activity, callback); final DownloadEntry downloadEntry = de.get(0); analyticsRegistry.trackSubSectionBulkVideoDownload(downloadEntry.getSectionName(), downloadEntry.getChapterName(), downloadEntry.getEnrollmentId(), noOfDownloads); EventBus.getDefault().post(new DownloadStartedEvent()); } } @Override public void onNegativeClicked() { downloadFragment.dismiss(); <START> EventBus.getDefault().post(new DownloadInterruptedEvent()); <END> } }); downloadFragment.setStyle(DialogFragment.STYLE_NO_TITLE, 0); downloadFragment.show(activity.getSupportFragmentManager(), "dialog"); downloadFragment.setCancelable(false); }</code><technical_language>rename "DownloadInterruptedEvent" event "DownloadCancelEvent", cancel more sense here</technical_language>

Target:
private void showDownloadSizeExceedDialog(final ArrayList<DownloadEntry> de, final int noOfDownloads, final FragmentActivity activity, final DownloadManagerCallback callback) { Map<String, String> dialogMap = new HashMap<String, String>(); dialogMap.put("title", activity.getString(R.string.download_exceed_title)); dialogMap.put("message_1", activity.getString(R.string.download_exceed_message)); downloadFragment = DownloadSizeExceedDialog.newInstance(dialogMap, new IDialogCallback() { @Override public void onPositiveClicked() { if (!de.isEmpty()) { startDownload(de, activity, callback); final DownloadEntry downloadEntry = de.get(0); analyticsRegistry.trackSubSectionBulkVideoDownload(downloadEntry.getSectionName(), downloadEntry.getChapterName(), downloadEntry.getEnrollmentId(), noOfDownloads); EventBus.getDefault().post(new BulkVideosDownloadStartedEvent()); } } @Override public void onNegativeClicked() { downloadFragment.dismiss(); EventBus.getDefault().post(new BulkVideosDownloadCancelledEvent()); } }); downloadFragment.setStyle(DialogFragment.STYLE_NO_TITLE, 0); downloadFragment.show(activity.getSupportFragmentManager(), "dialog"); downloadFragment.setCancelable(false); }
Source:
<code>public String getShortName() { <START> return "developmentinformation" ; <END> }</code><technical_language>"devInf" for consistency ext. service</technical_language>

Target:
public String getShortName() { return "devInf" ; }
Source:
<code>protected boolean isEnoughSpaceToMergeSnapshots() { for (final Guid storageDomainId : getStorageToDiskMap().keySet()) { <START> List<DiskImage> diskImages = getStorageToDiskMap().get(storageDomainId); <END> long sizeRequested = 0; for (DiskImage diskImage : diskImages) { sizeRequested += diskImage.getActualSize(); } storage_domains storageDomain = getStorageDomainDAO().getForStoragePool(storageDomainId, getStoragePoolId()); if (!validate(new StorageDomainValidator(storageDomain).isDomainHasSpaceForRequest(sizeRequested, false))) { return false; } } return true; }</code><technical_language>entrySey() instead of keySet() get(key)</technical_language>

Target:
protected boolean isEnoughSpaceToMergeSnapshots() { for (final Entry<Guid, List<DiskImage>> storageToDiskEntry : getStorageToDiskMap().entrySet()) { Guid storageDomainId = storageToDiskEntry.getKey(); List<DiskImage> diskImages = storageToDiskEntry.getValue(); long sizeRequested = 0l; for (DiskImage diskImage : diskImages) { sizeRequested += diskImage.getActualSize(); } storage_domains storageDomain = getStorageDomainDAO().getForStoragePool(storageDomainId, getStoragePoolId()); if (!validate(new StorageDomainValidator(storageDomain).isDomainHasSpaceForRequest(sizeRequested, false))) { return false; } } return true; }
Source:
<code>private void writeAggregatedBroadcasts( Item item, FieldWriter writer, OutputContext ctxt ) throws IOException { List<Id> downweighChannelIds = Arrays.stream( ctxt.getRequest() <START> .getParameter(Attributes.DOWNWEIGH.externalName()) <END> .split(",")) .map(Id::valueOf) .collect(MoreCollectors.toImmutableList()); writer.writeList( aggregatedBroadcastWriter, broadcastAggregator.aggregateBroadcasts( item.getBroadcasts(), ctxt.getPlatform(), downweighChannelIds ), ctxt ); }</code><technical_language>If parameter provided .getParameter() return "" null? NPE</technical_language>

Target:
private void writeAggregatedBroadcasts( Item item, FieldWriter writer, OutputContext ctxt ) throws IOException { String[] downweighIds = ctxt.getRequest() .getParameterValues(Attributes.DOWNWEIGH.externalName()); List<Id> downweighChannelIds; if (downweighIds == null || downweighIds.length == 0) { downweighChannelIds = ImmutableList.of(); } else { downweighChannelIds = Arrays.stream(downweighIds) .map(codec::decode) .map(Id::valueOf) .collect(MoreCollectors.toImmutableList()); } writer.writeList( broadcastWriter, broadcastAggregator.aggregateBroadcasts( item.getBroadcasts(), ctxt.getPlatform(), downweighChannelIds ), ctxt ); }
Source:
<code>public void testEvictCostOnReplace() { PlanNode y = node(); PlanNode x = node(y); Memo memo = new Memo(idAllocator, x); int xGroup = memo.getRootGroup(); int yGroup = getChildGroup(memo, memo.getRootGroup()); PlanNodeCostEstimate yCost = PlanNodeCostEstimate.cpuCost(42); PlanNodeCostEstimate xCost = yCost.add(PlanNodeCostEstimate.networkCost(37)); memo.storeCumulativeCost(yGroup, yCost); memo.storeCumulativeCost(xGroup, xCost); assertEquals(Optional.of(yCost), memo.getCumulativeCost(yGroup)); assertEquals(Optional.of(xCost), memo.getCumulativeCost(xGroup)); memo.replace(yGroup, node(), "rule"); assertEquals(Optional.empty(), memo.getCumulativeCost(yGroup)); <START> assertEquals(Optional.empty(), memo.getCumulativeCost(xGroup)); <END> }</code><technical_language>actual is right side...? I lived life in a mistake</technical_language>

Target:
public void testEvictCostOnReplace() { PlanNode y = node(); PlanNode x = node(y); Memo memo = new Memo(idAllocator, x); int xGroup = memo.getRootGroup(); int yGroup = getChildGroup(memo, memo.getRootGroup()); PlanNodeCostEstimate yCost = PlanNodeCostEstimate.cpuCost(42); PlanNodeCostEstimate xCost = yCost.add(PlanNodeCostEstimate.networkCost(37)); memo.storeCumulativeCost(yGroup, yCost); memo.storeCumulativeCost(xGroup, xCost); assertEquals(memo.getCumulativeCost(yGroup), Optional.of(yCost)); assertEquals(memo.getCumulativeCost(xGroup), Optional.of(xCost)); memo.replace(yGroup, node(), "rule"); assertEquals(memo.getCumulativeCost(yGroup), Optional.empty()); assertEquals(memo.getCumulativeCost(xGroup), Optional.empty()); }
Source:
<code>private void detectExecDisabled() { try { getUId(); } catch(JSchException | IOException e) { <START> execDisabled = true; <END> } }</code><technical_language>exception stored queries applications tests? a pain step debugger figure out real failure is here</technical_language>

Target:
private void detectExecDisabled() { try { getUId(); } catch(JSchException | IOException e) { execDisabled = true; LOG.debug("Cannot get UID, assuming no exec channel is present", e); } }
Source:
<code>private void createDiskBasedOnLun() { LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); StorageDomainCommandBase.proceedLUNInDb(lun, lun.getLunType()); getBaseDiskDao().save(getParameters().getDiskInfo()); getDiskLunMapDao().save(new DiskLunMap(getParameters().getDiskInfo().getId(), lun.getLUN_id())); if (getVm() != null) { VmDeviceUtils.addManagedDevice(new VmDeviceId(getParameters().getDiskInfo().getId(), getVmId()), VmDeviceType.DISK, VmDeviceType.DISK, null, true, false, <START> ""); <END> } VmHandler.unlockVm(getVm().getDynamicData(), getCompensationContext()); setSucceeded(true); }</code><technical_language>encapsulated in addManagedDevice is empty string for calls</technical_language>

Target:
private void createDiskBasedOnLun() { LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); StorageDomainCommandBase.proceedLUNInDb(lun, lun.getLunType()); getBaseDiskDao().save(getParameters().getDiskInfo()); getDiskLunMapDao().save(new DiskLunMap(getParameters().getDiskInfo().getId(), lun.getLUN_id())); if (getVm() != null) { VmDeviceUtils.addManagedDevice(new VmDeviceId(getParameters().getDiskInfo().getId(), getVmId()), VmDeviceType.DISK, VmDeviceType.DISK, null, true, false); } VmHandler.unlockVm(getVm().getDynamicData(), getCompensationContext()); setSucceeded(true); }
Source:
<code>private List<Object> resetOutputFolders(IJavaProject project, IProgressMonitor monitor) throws JavaModelException { if (monitor == null) monitor= new NullProgressMonitor(); try { IPackageFragmentRoot[] roots= project.getPackageFragmentRoots(); monitor.beginTask(NewWizardMessages.ClasspathModifier_Monitor_ResetOutputFolder, roots.length + 10); List<CPListElementAttribute> entries= new ArrayList<>(); for (IPackageFragmentRoot r : roots) { monitor.worked(1); <START> IPackageFragmentRoot root= r; <END> if (root.isArchive() || root.isExternal()) continue; IClasspathEntry entry= root.getRawClasspathEntry(); CPListElement element= CPListElement.createFromExisting(entry, project); CPListElementAttribute outputFolder= new CPListElementAttribute(element, CPListElement.OUTPUT, element.getAttribute(CPListElement.OUTPUT), true); entries.add(outputFolder); } return reset(entries, project, new SubProgressMonitor(monitor, 10)); } finally { monitor.done(); } }</code><technical_language>obselete; rename loop var root</technical_language>

Target:
private List<Object> resetOutputFolders(IJavaProject project, IProgressMonitor monitor) throws JavaModelException { if (monitor == null) monitor= new NullProgressMonitor(); try { IPackageFragmentRoot[] roots= project.getPackageFragmentRoots(); monitor.beginTask(NewWizardMessages.ClasspathModifier_Monitor_ResetOutputFolder, roots.length + 10); List<CPListElementAttribute> entries= new ArrayList<>(); for (IPackageFragmentRoot root : roots) { monitor.worked(1); if (root.isArchive() || root.isExternal()) continue; IClasspathEntry entry= root.getRawClasspathEntry(); CPListElement element= CPListElement.createFromExisting(entry, project); CPListElementAttribute outputFolder= new CPListElementAttribute(element, CPListElement.OUTPUT, element.getAttribute(CPListElement.OUTPUT), true); entries.add(outputFolder); } return reset(entries, project, new SubProgressMonitor(monitor, 10)); } finally { monitor.done(); } }
Source:
<code>public <T> T executeSQL(String databaseName, String query, ExecuteResultHandler<T> handler) throws SQLiteException { Util.throwIfNull(query); Util.throwIfNull(handler); SQLiteDatabase database = openDatabase(databaseName); try { String trimmedSql = query.trim(); String prefixSql = ""; if (trimmedSql.length() >= 3) { prefixSql = trimmedSql.substring(0, 3).toUpperCase(); } <START> if (prefixSql.equals("UPD") || prefixSql.equals("DEL")) { <END> return executeUpdateDelete(database, query, handler); } else if (prefixSql.equals("INS")) { return executeInsert(database, query, handler); } else { return executeRawQuery(database, trimmedSql, handler); } } finally { database.close(); } }</code><technical_language>This case insensitive</technical_language>

Target:
public <T> T executeSQL(String databaseName, String query, ExecuteResultHandler<T> handler) throws SQLiteException { Util.throwIfNull(query); Util.throwIfNull(handler); SQLiteDatabase database = openDatabase(databaseName); try { String firstWord = getFirstWord(query); if (firstWord.equalsIgnoreCase("UPDATE") || firstWord.equalsIgnoreCase("DELETE")) { return executeUpdateDelete(database, query, handler); } else if (firstWord.equalsIgnoreCase("INSERT")) { return executeInsert(database, query, handler); } else if (firstWord.equalsIgnoreCase("SELECT")) { return executeSelect(database, query, handler); } else { return executeRawQuery(database, query, handler); } } finally { database.close(); } }
Source:
<code>public String readResource(URI endpoint) throws IOException { Map<String, String> headers = new HashMap<String, String>(); headers.put("User-Agent", USER_AGENT); headers.put("Accept", "*/*"); headers.put("Connection", "keep-alive"); <START> return readResource(endpoint, CredentialsEndpointRetryPolicy.NO_RETRY, new HashMap<String, String>()); <END> }</code><technical_language>parameter headers variable created above</technical_language>

Target:
public String readResource(URI endpoint) throws IOException { Map<String, String> headers = new HashMap<String, String>(); headers.put("User-Agent", USER_AGENT); headers.put("Accept", "*/*"); headers.put("Connection", "keep-alive"); return readResource(endpoint, CredentialsEndpointRetryPolicy.NO_RETRY, headers); }
Source:
<code>protected Menu getMenu(final MMenu mmenu, ToolItem toolItem) { Object obj = mmenu.getWidget(); if (obj instanceof Menu) { return (Menu) obj; } if (mmenu instanceof MRenderedMenu) { obj = ((MRenderedMenu) mmenu).getContributionManager(); if (obj instanceof IContextFunction) { final IEclipseContext lclContext = getContext(mmenu); obj = ((IContextFunction) obj).compute(lclContext, null); ((MRenderedMenu) mmenu).setContributionManager(obj); } if (obj instanceof IMenuCreator) { final IMenuCreator creator = (IMenuCreator) obj; final Menu menu = creator.getMenu(toolItem.getParent() .getShell()); if (menu != null) { toolItem.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (menu != null && !menu.isDisposed()) { creator.dispose(); ((MRenderedMenu) mmenu).setWidget(null); } } }); mmenu.setWidget(menu); menu.setData(AbstractPartRenderer.OWNING_ME, menu); return menu; } } } else { final IEclipseContext lclContext = getContext(mmenu); IPresentationEngine engine = lclContext .get(IPresentationEngine.class); <START> obj = engine.createGui(mmenu, toolItem.getParent(), lclContext); <END> if (obj instanceof Menu) { return (Menu) obj; } System.err.println("Rendering returned " + obj); } return null; }</code><technical_language>a candidate for assertion here</technical_language>

Target:
protected Menu getMenu(final MMenu mmenu, ToolItem toolItem) { Object obj = mmenu.getWidget(); if (obj instanceof Menu) { return (Menu) obj; } if (mmenu instanceof MRenderedMenu) { obj = ((MRenderedMenu) mmenu).getContributionManager(); if (obj instanceof IContextFunction) { final IEclipseContext lclContext = getContext(mmenu); obj = ((IContextFunction) obj).compute(lclContext, null); ((MRenderedMenu) mmenu).setContributionManager(obj); } if (obj instanceof IMenuCreator) { final IMenuCreator creator = (IMenuCreator) obj; final Menu menu = creator.getMenu(toolItem.getParent() .getShell()); if (menu != null) { toolItem.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (menu != null && !menu.isDisposed()) { creator.dispose(); ((MRenderedMenu) mmenu).setWidget(null); } } }); mmenu.setWidget(menu); menu.setData(AbstractPartRenderer.OWNING_ME, menu); return menu; } } } else { final IEclipseContext lclContext = getContext(mmenu); IPresentationEngine engine = lclContext .get(IPresentationEngine.class); obj = engine.createGui(mmenu, toolItem.getParent(), lclContext); if (obj instanceof Menu) { return (Menu) obj; } logger.debug("Rendering returned " + obj); } return null; }
Source:
<code><START> public static int rapidParseInt(final String input) { <END> final int len = input.length(); int val = 0; int i = 0; boolean isNegative = false; if (0 < len && '-' == input.charAt(0)) { i = 1; isNegative = true; } for (; i < len; ++i) { final char ch = input.charAt(i); if (Character.isDigit(ch)) { val = (val * 10) + (ch - 48); } else { break; } } if (isNegative) val = -val; return val; }</code><technical_language>I more suggestion here? I this method fail if parse digit string. this failed, in some instances parsing flowcell names other non-numeric Strings, happily returning 0</technical_language>

Target:
public static int rapidParseInt(final String input) throws NumberFormatException { final int len = input.length(); int val = 0; int i = 0; boolean isNegative = false; if (0 < len && '-' == input.charAt(0)) { i = 1; isNegative = true; } boolean hasDigits = false; for (; i < len; ++i) { final char ch = input.charAt(i); if (Character.isDigit(ch)) { val = (val * 10) + (ch - 48); hasDigits = true; } else { break; } } if (!hasDigits) throw new NumberFormatException("String '" + input + "' did not start with a parsable number."); if (isNegative) val = -val; return val; }
Source:
<code>public void testGetScreenshot() { HWND desktopWindow = User32.INSTANCE.GetDesktopWindow(); <START> assertNotNull(desktopWindow); <END> BufferedImage image = GDI32Util.getScreenshot(desktopWindow); List<Integer> distinctPixels = new ArrayList<Integer>(); for (int x = 0; x < image.getWidth(); x++) { for (int y = 0; y < image.getHeight(); y++) { int pixel = image.getRGB(x, y); if (!distinctPixels.contains(pixel)) { distinctPixels.add(pixel); } if (distinctPixels.size() > 20) { break; } } } assertTrue(distinctPixels.size() > 20); }</code><technical_language>java assertNotNull("Failed get desktop window: " + Native.getLastError(), desktopWindow);</technical_language>

Target:
public void testGetScreenshot() { HWND desktopWindow = User32.INSTANCE.GetDesktopWindow(); assertNotNull("Failed to obtain desktop window handle", desktopWindow); BufferedImage image = GDI32Util.getScreenshot(desktopWindow); List<Integer> distinctPixels = new ArrayList<Integer>(); for (int x = 0; x < image.getWidth(); x++) { for (int y = 0; y < image.getHeight(); y++) { int pixel = image.getRGB(x, y); if (!distinctPixels.contains(pixel)) { distinctPixels.add(pixel); } if (distinctPixels.size() > 20) { break; } } } assertTrue("Number of distinct pixels was not above 20.", distinctPixels.size() > 20); }
Source:
<code>public Set<Group> groupsFor(AuthenticatedUser au) { Set<Group> groups = new HashSet<>(); groups.addAll(groupsFor(au, null)); String identifier = au.getIdentifier(); String identifierWithoutAtSign = null; if (identifier != null) { try { identifierWithoutAtSign = identifier.substring(1); } catch (IndexOutOfBoundsException ex) { logger.info("Couldn't trim first character (@ sign) from identifier: " + identifier); } } if (identifierWithoutAtSign != null) { roleAssigneeSvc.getUserGroups(identifierWithoutAtSign).stream().forEach((groupAlias) -> { ExplicitGroup explicitGroup = explicitGroupProvider.get(groupAlias); <START> if (explicitGroup != null) { <END> groups.add(explicitGroup); } else { logger.info("Couldn't find group based on alias " + groupAlias); } }); } return groups; }</code><technical_language>For full lambda experience, map map group alias explicit group, filter out nulls, a collector get set of groups</technical_language>

Target:
public Set<Group> groupsFor(AuthenticatedUser au) { Set<Group> groups = new HashSet<>(); groups.addAll(groupsFor(au, null)); String identifier = au.getIdentifier(); String identifierWithoutAtSign = null; if (identifier != null) { try { identifierWithoutAtSign = identifier.substring(1); } catch (IndexOutOfBoundsException ex) { logger.info("Couldn't trim first character (@ sign) from identifier: " + identifier); } } if (identifierWithoutAtSign != null) { roleAssigneeSvc.getUserExplicitGroups(identifierWithoutAtSign).stream().forEach((groupAlias) -> { ExplicitGroup explicitGroup = explicitGroupProvider.get(groupAlias); if (explicitGroup != null) { groups.add(explicitGroup); } else { logger.info("Couldn't find group based on alias " + groupAlias); } }); } return groups; }
Source:
<code>public Object deserialize(JsonParser parser, DeserializationContext context) throws IOException { <START> if (claimTypeMap != null && parser.currentName() != null && claimTypeMap.containsKey(parser.currentName())) { <END> Class type = claimTypeMap.get(parser.currentName()); return parser.readValueAsTree().traverse(parser.getCodec()).readValueAs(type); } return super.deserialize(parser, context); }</code><technical_language>memoize result of parser.currentName() ? called in this code 3 times</technical_language>

Target:
public Object deserialize(JsonParser parser, DeserializationContext context) throws IOException { String name = parser.currentName(); if (claimTypeMap != null && name != null && claimTypeMap.containsKey(name)) { Class type = claimTypeMap.get(name); return parser.readValueAsTree().traverse(parser.getCodec()).readValueAs(type); } return super.deserialize(parser, context); }
Source:
<code>public void invoke(ClientEvent event) { try { method.invoke(listener, event); } catch (InvocationTargetException e) { log.errorInvokingListener(method, listener, e.getTargetException()); throw log.exceptionInvokingListener( e.getClass().getName(), method, listener, e.getTargetException()); } catch (Exception e) { throw log.exceptionInvokingListener( <START> e.getClass().getName(), method, listener, e); <END> } }</code><technical_language>enough throw logging exception instead of logging locally</technical_language>

Target:
public void invoke(ClientEvent event) { try { method.invoke(listener, event); } catch (InvocationTargetException e) { throw log.exceptionInvokingListener( e.getClass().getName(), method, listener, e.getTargetException()); } catch (Exception e) { throw log.exceptionInvokingListener( e.getClass().getName(), method, listener, e); } }
Source:
<code><START> public MultiStreamableMessageSource(Builder builder) { <END> this.eventStreams = builder.messageSources(); this.trackedEventComparator = builder.trackedEventComparator; }</code><technical_language>Nit: constructor protected</technical_language>

Target:
protected MultiStreamableMessageSource(Builder builder) { this.eventStreams = builder.messageSources(); this.trackedEventComparator = builder.trackedEventComparator; }
Source:
<code>public static Rectangle2D getVisualBounds(Stage stage) { return JavaFxUtil.getScreenForRectangle( new Rectangle2D(stage.getX(), stage.getY(), stage.getWidth(), <START> stage.getHeight())).getVisualBounds(); <END> }</code><technical_language>_Why_ this necessary? I Java's Screen.getScreensForRectangle() work correctly</technical_language>

Target:
public static Rectangle2D getVisualBounds(Stage stage) { double x1 = stage.getX() + (stage.getWidth() / 2); double y1 = stage.getY() + (stage.getHeight() / 2); Rectangle2D windowCenter = new Rectangle2D(x1, y1, 1, 1); ObservableList<Screen> screensForRectangle = Screen.getScreensForRectangle(windowCenter); return screensForRectangle.get(0).getVisualBounds(); }
Source:
<code>public void prepareSandboxTaskTest() throws IOException, NoLanguagePluginFoundException, ArchiveException { TaskExecutor executor = new TaskExecutorImpl(); Path exercisePath = TestUtils.getPath(getClass(), "arith_funcs"); Path submissionPath = TestUtils.getPath(getClass(), "arith_funcs_solution"); Path outputDirectory = Files.createTempDirectory("output-directory"); Path outputPath = new File("/tmp/output.tar").toPath(); Path tmcRunPath = new File("/home/local/onniaarn/Visulahti.R").toPath(); <START> Path tmcLangsPath = new File("/home/local/onniaarn/Projects/tmc-langs/tmc-langs-cli/target/tmc-langs-cli-0.7.7-SNAPSHOT.jar").toPath(); END> executor.prepareSandboxTask(exercisePath, submissionPath, outputPath, tmcRunPath, tmcLangsPath); Path testDirectory = Files.createTempDirectory("test-directory"); Process untarringProcess = new ProcessBuilder("tar", "-C", testDirectory.toString(), "-xf", outputPath.toString()).start(); assertTrue(Files.exists(outputPath)); assertTrue(Files.exists(testDirectory.resolve("tmc-langs.jar"))); assertTrue(Files.exists(testDirectory.resolve("tmc-run.sh"))); FileUtils.forceDelete(outputDirectory.toFile()); FileUtils.forceDelete(tmcRunPath.toFile()); FileUtils.forceDelete(tmcLangsPath.toFile()); FileUtils.forceDelete(testDirectory.toFile()); }</code><technical_language>paths weird</technical_language>

Target:
public void prepareSandboxTaskTest() throws IOException, NoLanguagePluginFoundException, ArchiveException { TaskExecutor executor = new TaskExecutorImpl(); Path exercisePath = TestUtils.getPath(getClass(), "arith_funcs"); Path submissionPath = TestUtils.getPath(getClass(), "arith_funcs_solution"); Path outputDirectory = Files.createTempDirectory("output-directory"); Path outputPath = outputDirectory.resolve("output.tar"); Path tmcRunPath = Files.createTempFile("fake-tmc-run", ".sh"); Path tmcLangsPath = Files.createTempFile("fake-tmc-langs", ".jar"); executor.prepareSandboxTask(exercisePath, submissionPath, outputPath, tmcRunPath, tmcLangsPath); Path testDirectory = Files.createTempDirectory("test-directory"); Process untarringProcess = new ProcessBuilder("tar", "-C", testDirectory.toString(), "-xf", outputPath.toString()).start(); assertTrue(Files.exists(outputPath)); assertTrue(Files.exists(testDirectory.resolve("tmc-langs.jar"))); assertTrue(Files.exists(testDirectory.resolve("tmc-run.sh"))); FileUtils.forceDelete(outputDirectory.toFile()); FileUtils.forceDelete(tmcRunPath.toFile()); FileUtils.forceDelete(tmcLangsPath.toFile()); FileUtils.forceDelete(testDirectory.toFile()); }
Source:
<code>public Optional<JobStatus> getJobStatus(@NotBlank(message = "Job id is missing and is required") final String id) { <START> return this.jobRepository.findByUniqueId(id, JobStatusProjection.class).map(JobStatusProjection::getStatus); <END> }</code><technical_language>other throwing GenieNotFoundException. reason for for this one</technical_language>

Target:
public JobStatus getJobStatus( @NotBlank(message = "Job id is missing and is required") final String id ) throws GenieNotFoundException { return this.jobRepository .findByUniqueId(id, JobStatusProjection.class) .orElseThrow(() -> new GenieNotFoundException("No job with id " + id + " exists. Unable to get status.")) .getStatus(); }
Source:
<code>public void cwlCorrect() throws IOException{ File cwlFile = new File(ResourceHelpers.resourceFilePath("1st-workflow.cwl")); File cwlJSON = new File(ResourceHelpers.resourceFilePath("1st-workflow-job.json")); ArrayList<String> args = new ArrayList<String>() {{ add("--local-entry"); add("--json"); add(cwlJSON.getAbsolutePath()); }}; WorkflowsApi api = mock(WorkflowsApi.class); UsersApi usersApi = mock(UsersApi.class); Client client = new Client(); client.setConfigFile(ResourceHelpers.resourceFilePath("config")); WorkflowClient workflowClient = new WorkflowClient(api, usersApi, client); workflowClient.checkEntryFile(cwlFile.getAbsolutePath(), args, null); <START> Assert.assertTrue("output should include a successful cromwell run",systemOutRule.getLog().contains("Provisioning your output files to their final destinations") ); <END> }</code><technical_language>This test appears ignored, changed. a WDL test, this a typo</technical_language>

Target:
public void cwlCorrect() throws IOException{ File cwlFile = new File(ResourceHelpers.resourceFilePath("1st-workflow.cwl")); File cwlJSON = new File(ResourceHelpers.resourceFilePath("1st-workflow-job.json")); ArrayList<String> args = new ArrayList<String>() {{ add("--local-entry"); add("--json"); add(cwlJSON.getAbsolutePath()); }}; WorkflowsApi api = mock(WorkflowsApi.class); UsersApi usersApi = mock(UsersApi.class); Client client = new Client(); client.setConfigFile(ResourceHelpers.resourceFilePath("config")); WorkflowClient workflowClient = new WorkflowClient(api, usersApi, client); workflowClient.checkEntryFile(cwlFile.getAbsolutePath(), args, null); Assert.assertTrue("output should include a successful cromwell run",systemOutRule.getLog().contains("Cromwell exit code: 0") ); }
Source:
<code>private void logContext(RelationshipOp operation, Environment environment) { List<?> children = (environment.field.getSelectionSet() != null) ? (List) environment.field.getSelectionSet().getChildren() : new ArrayList<>(); List<String> fieldName = new ArrayList<String>(); if (children.size() > 0) { children.stream().forEach(i -> { if (i.getClass().equals(Field.class)) { fieldName.add(((Field) i).getName()); } else if (i.getClass().equals(FragmentSpread.class)) { fieldName.add(((FragmentSpread) i).getName()); } else { log.debug("A new type of Selection, other than Field and FragmentSpread was encountered, {}", i.getClass()); } }); } String requestedFields = environment.field.getName() + fieldName.toString(); GraphQLType parent = environment.parentType; if (log.isDebugEnabled()) { log.debug("{} fields with parent {}<{}>", operation, requestedFields, <START> EntityDictionary.getSimpleName(new ClassType(parent.getClass())), parent.getName()); <END> } }</code><technical_language>This EntityDictionary.getType(parent)</technical_language>

Target:
private void logContext(RelationshipOp operation, Environment environment) { List<?> children = (environment.field.getSelectionSet() != null) ? (List) environment.field.getSelectionSet().getChildren() : new ArrayList<>(); List<String> fieldName = new ArrayList<String>(); if (children.size() > 0) { children.stream().forEach(i -> { if (i.getClass().equals(Field.class)) { fieldName.add(((Field) i).getName()); } else if (i.getClass().equals(FragmentSpread.class)) { fieldName.add(((FragmentSpread) i).getName()); } else { log.debug("A new type of Selection, other than Field and FragmentSpread was encountered, {}", i.getClass()); } }); } String requestedFields = environment.field.getName() + fieldName.toString(); GraphQLType parent = environment.parentType; if (log.isDebugEnabled()) { log.debug("{} fields with parent {}<{}>", operation, requestedFields, EntityDictionary.getSimpleName(EntityDictionary.getType(parent)), parent.getName()); } }
Source:
<code>public void changesUpdateAttribute() throws Exception { final Bout bout = new MkBase().randomBout(); final Attachments attachments = bout.attachments(); final Long last = bout.updated().getTime(); final String name = "att-name"; attachments.create(name); final Attachment attachment = attachments.get(name); attachment.write( <START> IOUtils.toInputStream("<root/>", CharEncoding.UTF_8), <END> "text/xml", Long.toString(System.currentTimeMillis()) ); final Long pause = 100L; Thread.sleep(pause); MatcherAssert.assertThat( bout.updated().getTime(), Matchers.greaterThan(last) ); }</code><technical_language>@dmzaytsev is StandardCharsets.UTF_8 JDK</technical_language>

Target:
public void changesUpdateAttribute() throws Exception { final Bout bout = new MkBase().randomBout(); final Attachments attachments = bout.attachments(); final Long last = bout.updated().getTime(); final String name = "att-name"; attachments.create(name); final Attachment attachment = attachments.get(name); attachment.write( IOUtils.toInputStream("<root/>", StandardCharsets.UTF_8), "text/xml", Long.toString(System.currentTimeMillis()) ); Thread.sleep(Tv.HUNDRED); MatcherAssert.assertThat( bout.updated().getTime(), Matchers.greaterThan(last) ); }
Source:
<code>public OperationResult execute() throws OperationException { logger.log(Level.INFO, "Determine file system actions ..."); FileSystemActionReconciliator actionReconciliator = new FileSystemActionReconciliator(config, result.getChangeSet()); List<FileSystemAction> actions; if (cleanupOccurred) { actions = actionReconciliator.determineFileSystemActions(winnersDatabase, true, preDeleteFileHistoriesWithLastVersion); } else { actions = actionReconciliator.determineFileSystemActions(winnersDatabase); } Set<MultiChunkId> unknownMultiChunks = determineRequiredMultiChunks(actions, winnersDatabase); try { <START> downloader.downloadAndDecryptMultiChunks(unknownMultiChunks); <END> } catch (StorageException | IOException e) { throw new OperationException(e); } result.getDownloadedMultiChunks().addAll(unknownMultiChunks); try { applyFileSystemActions(actions); } catch (IOException e) { throw new OperationException(e); } return null; }</code><technical_language>I feel more readable if in try/catch block. in individual methods</technical_language>

Target:
public OperationResult execute() throws OperationException { logger.log(Level.INFO, "Determine file system actions ..."); FileSystemActionReconciliator actionReconciliator = new FileSystemActionReconciliator(config, result.getChangeSet()); List<FileSystemAction> actions; if (cleanupOccurred) { actions = actionReconciliator.determineFileSystemActions(winnersDatabase, true, preDeleteFileHistoriesWithLastVersion); } else { actions = actionReconciliator.determineFileSystemActions(winnersDatabase); } Set<MultiChunkId> unknownMultiChunks = determineRequiredMultiChunks(actions, winnersDatabase); try { downloader.downloadAndDecryptMultiChunks(unknownMultiChunks); result.getDownloadedMultiChunks().addAll(unknownMultiChunks); applyFileSystemActions(actions); } catch (StorageException | IOException e) { throw new OperationException(e); } return null; }
Source:
<code>private void propogateInputChange() { if (!inputChangeListeners.isEmpty()) { Object[] allListeners = inputChangeListeners.getListeners(); final ICompareInput compareResult = (ICompareInput) getCompareResult(); for (Object <START> allListener : <END> allListeners) { final ICompareInputChangeListener listener = (ICompareInputChangeListener) allListener; SafeRunner.run(new ISafeRunnable() { @Override public void run() throws Exception { listener.compareInputChanged(compareResult); } @Override public void handleException(Throwable exception) { } }); } } }</code><technical_language>listener</technical_language>

Target:
private void propogateInputChange() { if (!inputChangeListeners.isEmpty()) { Object[] allListeners = inputChangeListeners.getListeners(); final ICompareInput compareResult = (ICompareInput) getCompareResult(); for (Object l : allListeners) { final ICompareInputChangeListener listener = (ICompareInputChangeListener) l; SafeRunner.run(new ISafeRunnable() { @Override public void run() throws Exception { listener.compareInputChanged(compareResult); } @Override public void handleException(Throwable exception) { } }); } } }
Source:
<code>void setOperationExceptionAndComplete(Exception exception) { if (exception instanceof RouterException) { RouterErrorCode routerErrorCode = ((RouterException) exception).getErrorCode(); if (operationException.get() == null) { operationException.set(exception); } else { if (getPrecedenceLevel(routerErrorCode) < getPrecedenceLevel( <START> ((RouterException) operationException.get()).getErrorCode())) { <END> operationException.set(exception); } } } else { operationException.set(exception); } operationCompleted = true; }</code><technical_language>Again, this is unsafe</technical_language>

Target:
void setOperationExceptionAndComplete(Exception exception) { if (exception instanceof RouterException) { RouterErrorCode routerErrorCode = ((RouterException) exception).getErrorCode(); if (operationException.get() == null) { operationException.set(exception); } else { Integer currentOperationExceptionLevel = null; if (operationException.get() instanceof RouterException) { currentOperationExceptionLevel = getPrecedenceLevel( ((RouterException) operationException.get()).getErrorCode()); } else { currentOperationExceptionLevel = getPrecedenceLevel(RouterErrorCode.UnexpectedInternalError); } if (getPrecedenceLevel(routerErrorCode) < currentOperationExceptionLevel) { operationException.set(exception); } } } else { operationException.set(exception); } operationCompleted = true; }
Source:
<code>public void onPlayerDisconnect() { <START> this.player = null; <END> }</code><technical_language>This works access world border's listeners remove listener instead of clearing reference player. happen replace world border player a one, longer need check below. (because listener present border is currently set for player)</technical_language>

Target:
public void onPlayerDisconnect() { ((Player) this.player).getWorldBorder().ifPresent(border -> ((WorldBorder) border).listeners.remove(this)); }
Source:
<code>public void removeDisk() { VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction(VdcActionType.RemoveDisk, new RemoveDiskParameters(getParameters().getImageGroupID())); <START> getReturnValue().getVdsmTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); <END> }</code><technical_language>this line is unneeded</technical_language>

Target:
public void removeDisk() { VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction(VdcActionType.RemoveDisk, new RemoveDiskParameters(getParameters().getImageGroupID())); }
Source:
<code>public ServerIdleDetector(WorkspaceManager workspaceManager, EventService eventService, @Named("che.openshift.server.inactive.stop.timeout.ms") long timeout) { this.timeout = timeout; this.eventService = eventService; this.workspaceManager = workspaceManager; if (timeout > 0) { this.executor = Executors.newSingleThreadScheduledExecutor(); this.future = executor.schedule(this::run, timeout, TimeUnit.MILLISECONDS); <START> LOG.info("Idling che server scheduled [timeout=" + timeout/1000 + " seconds]"); <END> } }</code><technical_language>requires INFO level avoid string concatenation</technical_language>

Target:
public ServerIdleDetector(WorkspaceManager workspaceManager, EventService eventService, @Named("che.openshift.server.inactive.stop.timeout.ms") long timeout) { this.timeout = timeout; this.eventService = eventService; this.workspaceManager = workspaceManager; if (timeout > 0) { this.executor = Executors.newSingleThreadScheduledExecutor(); this.future = executor.schedule(this::run, timeout, TimeUnit.MILLISECONDS); LOG.info(String.format(IDLING_CHE_SERVER_SCHEDULED, timeout/1000)); } }
Source:
<code>public void encodeToStream(final Document document, final DataOutputStream daos) { try { final List<Integer> words = document.getWords(); daos.writeInt(words.size()); for (final int word : words) { daos.writeInt(word); } for (int wordIdx = 0; wordIdx < words.size(); wordIdx++) { daos.writeInt(document.getAssignment(wordIdx)); } final Map<Integer, Integer> topicCounts = document.getTopicCounts(); daos.writeInt(topicCounts.size()); topicCounts.forEach((key, value) -> { try { <START> daos.writeInt(key); <END> } catch (IOException e) { throw new RuntimeException(e); } }); } catch (final IOException e) { throw new RuntimeException(e); } }</code><technical_language>care values</technical_language>

Target:
public void encodeToStream(final Document document, final DataOutputStream daos) { try { final List<Integer> words = document.getWords(); daos.writeInt(words.size()); for (final int word : words) { daos.writeInt(word); } for (int wordIdx = 0; wordIdx < words.size(); wordIdx++) { daos.writeInt(document.getAssignment(wordIdx)); } final Map<Integer, Integer> topicCounts = document.getTopicCounts(); daos.writeInt(topicCounts.size()); topicCounts.forEach((topicIdx, topicCount) -> { try { daos.writeInt(topicIdx); daos.writeInt(topicCount); } catch (IOException e) { throw new RuntimeException(e); } }); } catch (final IOException e) { throw new RuntimeException(e); } }
Source:
<code>public Response scan(@PathParam("bindingId") @ApiParam(value = "bindingId") final String bindingId) { discoveryServiceRegistry.startScan(bindingId, new ScanListener() { @Override public void onErrorOccurred(Exception exception) { logger.error("Error occured while scanning for binding '{}': {}", bindingId, exception.getMessage(), exception); } @Override public void onFinished() { logger.debug("Scan for binding '{}' successfully finished.", bindingId); } }); DiscoveryServiceDTO dto = new DiscoveryServiceDTO(); <START> dto.timeout = discoveryServiceRegistry.getMaxScanTimeout(bindingId); <END> return JSONResponse.createResponse(Status.OK, dto, ""); }</code><technical_language>I assume miss id attribute intention parameter request. Correct</technical_language>

Target:
public Response scan(@PathParam("bindingId") @ApiParam(value = "bindingId") final String bindingId) { discoveryServiceRegistry.startScan(bindingId, new ScanListener() { @Override public void onErrorOccurred(Exception exception) { logger.error("Error occured while scanning for binding '{}': {}", bindingId, exception.getMessage(), exception); } @Override public void onFinished() { logger.debug("Scan for binding '{}' successfully finished.", bindingId); } }); DiscoveryBindingDTO dto = new DiscoveryBindingDTO(); dto.timeout = discoveryServiceRegistry.getMaxScanTimeout(bindingId); return JSONResponse.createResponse(Status.OK, dto, ""); }
Source:
<code>public void setShooter(ProjectileSource source) { this.shooter = source; <START> ((GlowPlayer) source).playSound(location, Sound.ENTITY_ENDERPEARL_THROW, 3, 1); <END> }</code><technical_language>here? move ItemEnderPearl</technical_language>

Target:
public void setShooter(ProjectileSource source) { this.shooter = source; }
Source:
<code>public RequestMatcher param(String parameter, Matcher<Iterable<? extends String>> matchers) { return new AbstractFormDataRequestMatcher() { @Override protected void matchInternal(MultipartHttpServletRequest request) { Map<String, String[]> requestParams = request.getParameterMap(); assertValueCount(parameter, requestParams, 1); String[] values = requestParams.get(parameter); assertThat("Request parameter [" + parameter + "]", Arrays.asList(values), matchers); } <START> }; <END> }</code><technical_language>This if abstract class is replaced a lambda calls a static method parse multipart content</technical_language>

Target:
public RequestMatcher param(String parameter, Matcher<Iterable<? extends String>> matchers) { return request -> { Map<String, String[]> requestParams = MultipartRequestParser.parameterMap(request); assertValueCount(parameter, requestParams, 1); String[] values = requestParams.get(parameter); assertThat("Request parameter [" + parameter + "]", Arrays.asList(values), matchers); }; }
Source:
<code>public static AtBScenarioModifier Deserialize(String fileName) { AtBScenarioModifier resultingList = null; try { JAXBContext context = JAXBContext.newInstance(AtBScenarioModifier.class); Unmarshaller um = context.createUnmarshaller(); File xmlFile = new File(fileName); if(!xmlFile.exists()) { MekHQ.getLogger().warning(AtBScenarioModifier.class, "Deserialize", String.format("Specified file %s does not exist", fileName)); return null; } try (FileInputStream fileStream = new FileInputStream(xmlFile)) { Source inputSource = MekHqXmlUtil.createSafeXmlSource(fileStream); JAXBElement<AtBScenarioModifier> templateElement = um.unmarshal(inputSource, AtBScenarioModifier.class); resultingList = templateElement.getValue(); } } catch(Exception e) { <START> MekHQ.getLogger().error(ScenarioModifierManifest.class, "Deserialize", "Error Deserializing Scenario Modifier" + fileName, e); <END> } return resultingList; }</code><technical_language>Needs a colon a space filename</technical_language>

Target:
public static AtBScenarioModifier Deserialize(String fileName) { AtBScenarioModifier resultingList = null; try { JAXBContext context = JAXBContext.newInstance(AtBScenarioModifier.class); Unmarshaller um = context.createUnmarshaller(); File xmlFile = new File(fileName); if(!xmlFile.exists()) { MekHQ.getLogger().warning(AtBScenarioModifier.class, "Deserialize", String.format("Specified file %s does not exist", fileName)); return null; } try (FileInputStream fileStream = new FileInputStream(xmlFile)) { Source inputSource = MekHqXmlUtil.createSafeXmlSource(fileStream); JAXBElement<AtBScenarioModifier> templateElement = um.unmarshal(inputSource, AtBScenarioModifier.class); resultingList = templateElement.getValue(); } } catch(Exception e) { MekHQ.getLogger().error(ScenarioModifierManifest.class, "Deserialize", "Error Deserializing Scenario Modifier: " + fileName, e); } return resultingList; }