auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Response doImport(Action action) { validateParameters(action, "cluster.id|name"); Guid destStorageDomainId = getDestStorageDomainId(action); ImportVmParameters params = new ImportVmParameters(getEntity(), parent.getStorageDomainId(), destStorageDomainId, parent.getDataCenterId(destStorageDomainId), getClusterId(action)); params.setImageToDestinationDomainMap(getDiskToDestinationMap(action)); <START> params.setForceOverride(action.isSetForce() ? action.isForce() : false); <END> if (action.isSetVm() && action.getVm().isSetSnapshots() && action.getVm().getSnapshots().isSetCollapseSnapshots()) { params.setCopyCollapse(action.getVm().getSnapshots().isCollapseSnapshots()); } if (action.isSetClone()) { params.setImportAsNewEntity(action.isClone()); if(action.isSetVm() && action.getVm().isSetName()) { params.getVm().setvm_name(action.getVm().getName()); } } return doAction(VdcActionType.ImportVm, params, action); }</code><technical_language>in /export action action.isExclusive(), please do here</technical_language>

Target:
public Response doImport(Action action) { validateParameters(action, "cluster.id|name"); Guid destStorageDomainId = getDestStorageDomainId(action); ImportVmParameters params = new ImportVmParameters(getEntity(), parent.getStorageDomainId(), destStorageDomainId, parent.getDataCenterId(destStorageDomainId), getClusterId(action)); params.setImageToDestinationDomainMap(getDiskToDestinationMap(action)); params.setForceOverride(action.isSetExclusive() ? action.isExclusive() : false); if (action.isSetVm() && action.getVm().isSetSnapshots() && action.getVm().getSnapshots().isSetCollapseSnapshots()) { params.setCopyCollapse(action.getVm().getSnapshots().isCollapseSnapshots()); } if (action.isSetClone()) { params.setImportAsNewEntity(action.isClone()); if(action.isSetVm() && action.getVm().isSetName()) { params.getVm().setvm_name(action.getVm().getName()); } } return doAction(VdcActionType.ImportVm, params, action); }
Source:
<code>public NoSuchFileException(String file, String other, String reason) { <START> super(file + ", other " + other + ", reason " + reason); <END> }</code><technical_language>Translate this</technical_language>

Target:
public NoSuchFileException(String file, String other, String reason) { super(MessageFormat.format(JGitText.get().noSuchFile, file, other, reason)); }
Source:
<code>public String errorMessageWhile() { <START> return "Server stilll has state " + currentState.getText(); <END> }</code><technical_language>l letters in "still" :)</technical_language>

Target:
public String errorMessageWhile() { return "Server still has state '" + currentState.getText() + "'"; }
Source:
<code>public void write(int arg0) throws IOException { while(true) { if(lastWriteFuture.isDone() && !isClosed) { lastWriteFuture = c.write(ByteBuffer.wrap(new byte[]{(byte) arg0})); return; } else { try { lastWriteFuture.get(1000, TimeUnit.MILLISECONDS); } catch (Exception e) { <START> ExceptionUtils.handleException(e); <END> } } } }</code><technical_language>rethrow this IOException</technical_language>

Target:
public void write(int arg0) throws IOException { while(true) { if(lastWriteFuture.isDone() && !isClosed) { lastWriteFuture = c.write(ByteBuffer.wrap(new byte[]{(byte) arg0})); return; } else { blockWriteFuture(lastWriteFuture); } } }
Source:
<code>private static void compensate() { List<KeyValue> commandSnapshots = DbFacade.getInstance().getBusinessEntitySnapshotDao().getAllCommands(); for (KeyValue commandSnapshot : commandSnapshots) { CommandBase<?> cmd = CommandsFactory.createCommand(commandSnapshot.getValue().toString(), (Guid) commandSnapshot.getKey()); if (cmd != null) { try { cmd.compensate(); } catch (RuntimeException e) { log.error( <START> "Failed to run compensation on startup for Command '{}', Command Id '{}', due to: {}", <END> commandSnapshot.getValue(), commandSnapshot.getKey(), ExceptionUtils.getMessage(e)); log.debug("Exception", e); } log.info("Running compensation on startup for Command '{}', Command Id '{}'", commandSnapshot.getValue(), commandSnapshot.getKey()); } else { log.error("Failed to run compensation on startup for Command '{}', Command Id '{}'", commandSnapshot.getValue(), commandSnapshot.getKey()); } } }</code><technical_language>need ", due to"</technical_language>

Target:
private static void compensate() { List<KeyValue> commandSnapshots = DbFacade.getInstance().getBusinessEntitySnapshotDao().getAllCommands(); for (KeyValue commandSnapshot : commandSnapshots) { CommandBase<?> cmd = CommandsFactory.createCommand(commandSnapshot.getValue().toString(), (Guid) commandSnapshot.getKey()); if (cmd != null) { try { cmd.compensate(); } catch (RuntimeException e) { log.error( "Failed to run compensation on startup for Command '{}', Command Id '{}': {}", commandSnapshot.getValue(), commandSnapshot.getKey(), ExceptionUtils.getMessage(e)); log.debug("Exception", e); } log.info("Running compensation on startup for Command '{}', Command Id '{}'", commandSnapshot.getValue(), commandSnapshot.getKey()); } else { log.error("Failed to run compensation on startup for Command '{}', Command Id '{}'", commandSnapshot.getValue(), commandSnapshot.getKey()); } } }
Source:
<code>protected void populateDataTypes(String entity, Set<Field> metaFieldSet, ArrayList<String> headers, ArrayList<String> dataTypes) { try { final ClassLoader classLoader = getClass().getClassLoader(); <START> final Class entityClass = classLoader.loadClass("com.bullhornsdk.data.model.entity.core.standard." + entity); <END> for (Method method : Arrays.asList(entityClass.getMethods())){ if ("set".equalsIgnoreCase(method.getName().substring(0, 3))) { methodSet.add(method.getName().substring(3).toLowerCase()); } } } catch(ClassNotFoundException e) { throw new NullPointerException("Unknown entity passed as argument"); } for (Field field : metaFieldSet) { if ((methodSet.contains(field.getName().toLowerCase()) && !field.getName().contains("."))) { if (!isCompositeType(field)) { headers.add(field.getName()); if(field.getDataType() == null) { field.setDataType("Integer"); } dataTypes.add(field.getDataType()); } else if (isCompositeType(field)) { List<Method> compositeMethodList = getCompositeMethodList(entity, field); compositeMethodList.stream().forEach(n -> headers.add(getCompositeHeaderName(n, field))); compositeMethodList.stream().forEach(n -> dataTypes.add(n.getReturnType().getSimpleName())); } } } }</code><technical_language>This of a try...catch block is unnecessary. validating input in TemplateService, TemplateUtil assume is receiving valid data</technical_language>

Target:
protected void populateDataTypes(String entity, Set<Field> metaFieldSet, ArrayList<String> headers, ArrayList<String> dataTypes) throws ClassNotFoundException { final HashSet<String> methodSet = getEntityFields(entity); for (Field field : metaFieldSet) { if ((methodSet.contains(field.getName().toLowerCase()) && !field.getName().contains("."))) { if (!isCompositeType(field)) { headers.add(field.getName()); if(field.getDataType() == null) { field.setDataType("Integer"); } dataTypes.add(field.getDataType()); } else if (isCompositeType(field)) { List<Method> compositeMethodList = getCompositeMethodList(entity, field); compositeMethodList.stream().forEach(n -> headers.add(getCompositeHeaderName(n, field))); compositeMethodList.stream().forEach(n -> dataTypes.add(n.getReturnType().getSimpleName())); } } } }
Source:
<code>public void teardownTest() throws InterruptedException { <START> Thread.sleep(10000); <END> if (currentServer != null) { assertNodeAvailable(currentServer); deleteServer(currentServer.id()); } if (cloneServer != null) { assertNodeAvailable(cloneServer); deleteServer(cloneServer.id()); } }</code><technical_language>Is get rid of this</technical_language>

Target:
public void teardownTest() throws InterruptedException { if (currentServer != null) { assertNodeAvailable(currentServer); deleteServer(currentServer.id()); } if (cloneServer != null) { assertNodeAvailable(cloneServer); deleteServer(cloneServer.id()); } }
Source:
<code>public void updateAttachmentsList(Attachment attachment){ Attachment originalAttachment = attachments.get(attachment.uri); originalAttachment.updateResizeInfo(attachment.resizeFactor, attachment.overrideDefault); <START> Log.d("ATTACH","Yes : " + attachments.size()); <END> }</code><technical_language>Stick K9.LOG_TAG change logging more useful. Also, need rebase this code Timber sooner later</technical_language>

Target:
public void updateAttachmentsList(Attachment attachment){ Attachment originalAttachment = attachments.get(attachment.uri); originalAttachment.updateResizeInfo(attachment.resizeFactor, attachment.overrideDefault); }
Source:
<code>private TraceFileSystemElement filterByTimerange(TraceFileSystemElement selectedFileSystemElements, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); subMonitor.subTask(Messages.ImportTraceWizard_FilteringOperationTaskName); String tracePath = selectedFileSystemElements.getFileSystemObject().getAbsolutePath(); ITmfTrace trace = null; try { TraceTypeHelper traceTypeHelper = TmfTraceTypeUIUtils.selectTraceType(tracePath, null, null); if (traceTypeHelper == null) { return null; } <START> trace = traceTypeHelper.getTrace(); <END> IConfigurationElement ce = TmfTraceType.getTraceAttributes(traceTypeHelper.getTraceTypeId()); if (ce == null) { return null; } ITmfEvent event = (ITmfEvent) ce.createExecutableExtension(TmfTraceType.EVENT_TYPE_ATTR); trace.initTrace(null, tracePath, event.getClass()); if (isInTimerange(trace)) { return selectedFileSystemElements; } } catch (TmfTraceImportException | CoreException | TmfTraceException e) { String errorMessage = Messages.ImportTraceWizard_ImportProblem + ": " + tracePath; Activator.getDefault().logError(errorMessage, e); } finally { subMonitor.worked(1); if (trace != null) { trace.dispose(); } } return null; }</code><technical_language>trace instance of helper is for validation. need instantiate a new one: trace = (ITmfTrace) ce.createExecutableExtension(TmfTraceType.TRACE_TYPE_ATTR);</technical_language>

Target:
private TraceFileSystemElement filterByTimerange(TraceFileSystemElement selectedFileSystemElements, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); subMonitor.subTask(Messages.ImportTraceWizard_FilteringOperationTaskName); String tracePath = selectedFileSystemElements.getFileSystemObject().getAbsolutePath(); ITmfTrace trace = null; try { TraceTypeHelper traceTypeHelper = TmfTraceTypeUIUtils.selectTraceType(tracePath, null, null); if (traceTypeHelper == null) { return null; } IConfigurationElement ce = TmfTraceType.getTraceAttributes(traceTypeHelper.getTraceTypeId()); if (ce == null) { return null; } trace = (ITmfTrace) ce.createExecutableExtension(TmfTraceType.TRACE_TYPE_ATTR); ITmfEvent event = (ITmfEvent) ce.createExecutableExtension(TmfTraceType.EVENT_TYPE_ATTR); trace.initTrace(null, tracePath, event.getClass()); if (isInTimerange(trace)) { return selectedFileSystemElements; } } catch (TmfTraceImportException | CoreException | TmfTraceException e) { String errorMessage = Messages.ImportTraceWizard_ImportProblem + ": " + tracePath; Activator.getDefault().logError(errorMessage, e); } finally { if (trace != null) { trace.dispose(); TmfTraceManager.deleteSupplementaryFolder(trace); } subMonitor.worked(1); } return null; }
Source:
<code>private Map<String, Object> renderReadme(RevWalk walk, GitilesView view, Config cfg, RevObject head) throws IOException { RevTree rootTree; try { rootTree = walk.parseTree(head); } catch <START> (MissingObjectException | <END> IncorrectObjectTypeException notTreeish) { return null; } ReadmeHelper readme = new ReadmeHelper(walk.getObjectReader(), view, cfg, rootTree); readme.scanTree(rootTree); if (readme.isPresent()) { return ImmutableMap.<String, Object> of("readmeHtml", readme.render()); } return null; }</code><technical_language>a MissingObjectException propagate a 500</technical_language>

Target:
private Map<String, Object> renderReadme(RevWalk walk, GitilesView view, Config cfg, RevObject head) throws IOException { RevTree rootTree; try { rootTree = walk.parseTree(head); } catch (IncorrectObjectTypeException notTreeish) { return null; } ReadmeHelper readme = new ReadmeHelper(walk.getObjectReader(), view, cfg, rootTree); readme.scanTree(rootTree); if (readme.isPresent()) { return ImmutableMap.<String, Object> of("readmeHtml", readme.render()); } return null; }
Source:
<code><START> public static List<List<String>> extractTests(File file) throws Exception { <END> BufferedReader reader = new BufferedReader(new FileReader(file)); List<List<String>> tests = new ArrayList<>(); List<String> test = new ArrayList<>(); String line = reader.readLine(); while (line != null) { switch (line) { case "!": tests.add(test); test = new ArrayList<>(); break; default: test.add(line); break; } line = reader.readLine(); } tests.add(test); tests = tests.subList(1, tests.size()); return tests; }</code><technical_language>this return List of TckIndividualTest</technical_language>

Target:
public static List<TckIndividualTest> extractTests(File file) throws Exception { BufferedReader reader = new BufferedReader(new FileReader(file)); List<TckIndividualTest> tests = new ArrayList<>(); List<String> test = new ArrayList<>(); String line = reader.readLine(); String testFile = file.getName().replaceFirst(TckIndividualTest.clientPrefix, ""); while (line != null) { switch (line) { case "!": String name = ""; if (test.size() > 1) { name = test.get(0).split("%%")[1]; } TckIndividualTest tckTest = new TckIndividualTest(name, test, testFile); tests.add(tckTest); test = new ArrayList<>(); break; default: test.add(line); break; } line = reader.readLine(); } if (test.size() > 0) { String name = ""; name = test.get(0).split("%%")[1]; TckIndividualTest tckTest = new TckIndividualTest(name, test, testFile); tests.add(tckTest); tests = tests.subList(1, tests.size()); } return tests; }
Source:
<code>private ByteBuffer ensure(ByteBuffer buffer, int size) { if (buffer == null) { buffer = allocator.allocate(size); } else if (buffer.capacity() >= size) { buffer.clear(); } else { allocator.release(buffer); <START> release(buffer); <END> buffer = allocator.allocate(size); } return buffer; }</code><technical_language>releasing here. release calls allocator.release well</technical_language>

Target:
private ByteBuffer ensure(ByteBuffer buffer, int size) { if (buffer == null) { buffer = allocator.allocate(size); } else if (buffer.capacity() >= size) { buffer.clear(); } else { release(buffer); buffer = allocator.allocate(size); } return buffer; }
Source:
<code>public final void show() { Gdx.input.setInputProcessor(cStage); TextButtonStyle style = new TextButtonStyle(); style.font = cFont; cButtonSettings = new TextButton("Settings", style); cButtonStroll = new TextButton("Stroll", style); cWidth = Gdx.graphics.getWidth(); cHeight = Gdx.graphics.getHeight(); cButtonSettings.setPosition(cWidth / 2f - cButtonSettings.getWidth() / 2f, cHeight / 2f); cButtonStroll.setPosition(cWidth / 2f - cButtonStroll.getWidth() / 2f, cHeight / 2f + 20); cButtonSettings.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { ((Game) Gdx.app.getApplicationListener()).setScreen(new Settings()); Gdx.app.debug("Button", "Settings"); } }); cButtonStroll.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { Gdx.app.debug("Button", "Stroll"); } }); cStage.addActor(cButtonSettings); cStage.addActor(cButtonStroll); TimerTask timerTask = new TimerTask() { @Override public void onTick(int seconds) { cButtonStroll.setText("Stroll: " + seconds); } @Override public void onStart() { <START> cButtonStroll.setText("Stroll: "); <END> cButtonStroll.setDisabled(true); } @Override public void onStop() { cButtonStroll.setText("Stroll"); cButtonStroll.setDisabled(false); } }; TimeKeeper.getInstance().getTimer("INTERVAL").subscribe(timerTask); }</code><technical_language>ugly, get delay..</technical_language>

Target:
public void show() { cBatch = new SpriteBatch(); cBackground = new Texture(Gdx.files.internal("demobackground.jpg")); cStage = new Stage(); cFont = new BitmapFont(); Gdx.input.setInputProcessor(cStage); TextButtonStyle style = new TextButtonStyle(); style.font = cFont; cButtonSettings = new TextButton("Settings", style); cButtonStroll = new TextButton("Stroll", style); cWidth = Gdx.graphics.getWidth(); cHeight = Gdx.graphics.getHeight(); cButtonSettings.setPosition(cWidth / 2f - cButtonSettings.getWidth() / 2f, cHeight / 2f); cButtonStroll.setPosition(cWidth / 2f - cButtonStroll.getWidth() / 2f, cHeight / 2f + 20); cButtonSettings.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { ((Game) Gdx.app.getApplicationListener()).setScreen(new Settings()); Gdx.app.debug("Button", "Settings"); } }); cButtonStroll.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { Gdx.app.debug("Button", "Stroll"); } }); cStage.addActor(cButtonSettings); cStage.addActor(cButtonStroll); TimerTask timerTask = new TimerTask() { @Override public void onTick(int seconds) { cButtonStroll.setText("Stroll: " + seconds); } @Override public void onStart() { cButtonStroll.setText("Stroll: "); cButtonStroll.setDisabled(true); } @Override public void onStop() { cButtonStroll.setText("Stroll"); cButtonStroll.setDisabled(false); } }; TimeKeeper.getInstance().getTimer("INTERVAL").subscribe(timerTask); }
Source:
<code>public PutStatus put(K key, V value) throws CacheAccessException { checkKey(key); checkValue(value); XATransactionContext<K, V> currentContext = getCurrentContext(); if (currentContext.touched(key)) { V oldValue = currentContext.oldValueOf(key); currentContext.addCommand(key, new StorePutCommand<V>(oldValue, new XAValueHolder<V>(value, timeSource.getTimeMillis()))); <START> return PutStatus.PUT; <END> } ValueHolder<SoftLock<V>> softLockValueHolder = getSoftLockValueHolderFromUnderlyingStore(key); if (softLockValueHolder != null) { SoftLock<V> softLock = softLockValueHolder.value(); if (isInDoubt(softLock)) { currentContext.addCommand(key, new StoreEvictCommand<V>(softLock.getOldValue())); } else { currentContext.addCommand(key, new StorePutCommand<V>(softLock.getOldValue(), new XAValueHolder<V>(value, timeSource.getTimeMillis()))); } } else { currentContext.addCommand(key, new StorePutCommand<V>(null, new XAValueHolder<V>(value, timeSource.getTimeMillis()))); } return PutStatus.PUT; }</code><technical_language>a PUT if oldValue is null, UPDATE</technical_language>

Target:
public PutStatus put(K key, V value) throws CacheAccessException { checkKey(key); checkValue(value); XATransactionContext<K, V> currentContext = getCurrentContext(); if (currentContext.touched(key)) { V oldValue = currentContext.oldValueOf(key); currentContext.addCommand(key, new StorePutCommand<V>(oldValue, new XAValueHolder<V>(value, timeSource.getTimeMillis()))); if (oldValue == null) { return PutStatus.PUT; } else { return PutStatus.UPDATE; } } ValueHolder<SoftLock<V>> softLockValueHolder = getSoftLockValueHolderFromUnderlyingStore(key); PutStatus status = PutStatus.NOOP; if (softLockValueHolder != null) { SoftLock<V> softLock = softLockValueHolder.value(); if (isInDoubt(softLock)) { currentContext.addCommand(key, new StoreEvictCommand<V>(softLock.getOldValue())); status = PutStatus.NOOP; } else { if (currentContext.addCommand(key, new StorePutCommand<V>(softLock.getOldValue(), new XAValueHolder<V>(value, timeSource.getTimeMillis())))) { status = PutStatus.UPDATE; } } } else { if (currentContext.addCommand(key, new StorePutCommand<V>(null, new XAValueHolder<V>(value, timeSource.getTimeMillis())))) { status = PutStatus.PUT; } } return status; }
Source:
<code>private Predicate<Constructor<?>> createConstructorInaccessibleFromPackagePredicate(Package sourcePackage) { return constructor -> { <START> int constructorModifiers = constructor.getModifiers(); <END> return Modifier.isPrivate(constructorModifiers) || (!sourcePackage.equals(constructor.getDeclaringClass().getPackage()) && !Modifier.isPublic(constructorModifiers)); }; }</code><technical_language>inline this a single statement predicate</technical_language>

Target:
private Predicate<Constructor<?>> createConstructorInaccessibleFromPackagePredicate(Package sourcePackage) { return constructor -> Modifier.isPrivate(constructor.getModifiers()) || (!sourcePackage.equals(constructor.getDeclaringClass().getPackage()) && !Modifier.isPublic(constructor.getModifiers())); }
Source:
<code>private boolean checkRange(final long position) { if (Guard.isMultiMapNullOrEmpty(ranges)) return true; final BulkObject blob = getBlobFromPosition(ranges, position); if (blob == null) return false; final long blobSize = blobSizes.get(blob); <START> return blob.getOffset() <= position && position <= blob.getOffset() + blobSize - 1; <END> }</code><technical_language>simplify comparison from: position <= blob.getOffset() + blobSize - 1 to: position < blob.getOffset() + blobSize</technical_language>

Target:
private boolean checkRange(final long position) { if (Guard.isMultiMapNullOrEmpty(ranges)) return true; final BulkObject blob = getBlobFromPosition(ranges, position); if (blob == null) return false; final long blobSize = blobSizes.get(blob); return blob.getOffset() <= position && position < blob.getOffset() + blobSize; }
Source:
<code><START> public void testMultipleContentLengthHeadersWithFolding() { <END> EmbeddedChannel channel = new EmbeddedChannel(new HttpRequestDecoder()); String requestStr = "POST / HTTP/1.1\r\n" + "Host: example.com\r\n" + "Connection: close\r\n" + "Content-Length: 5\r\n" + "Content-Length:\r\n" + "\t6\r\n\r\n" + "123456"; assertTrue(channel.writeInbound(Unpooled.copiedBuffer(requestStr, CharsetUtil.US_ASCII))); HttpRequest request = channel.readInbound(); assertTrue(request.decoderResult().isFailure()); assertTrue(request.decoderResult().cause() instanceof IllegalArgumentException); assertFalse(channel.finish()); }</code><technical_language>check RFC test case? Content-Length: 42, 42</technical_language>

Target:
public void testMultipleContentLengthHeadersWithFolding() { String requestStr = "POST / HTTP/1.1\r\n" + "Host: example.com\r\n" + "Connection: close\r\n" + "Content-Length: 5\r\n" + "Content-Length:\r\n" + "\t6\r\n\r\n" + "123456"; testInvalidHeaders0(requestStr); }
Source:
<code>protected <START> VmStatic convertVm(int <END> defaultOsId, DisplayType defaultDisplayType, Map vmInfo) { Guid vmId = Guid.createGuidFromString((String) vmInfo.get(VdsProperties.vm_guid)); VmStatic vmStatic = new VmStatic(); vmStatic.setId(vmId); vmStatic.setCreationDate(new Date()); vmStatic.setVdsGroupId(vdsManager.getVdsGroupId()); String vmNameOnHost = (String) vmInfo.get(VdsProperties.vm_name); if (StringUtils.equals(Config.<String>getValue(ConfigValues.HostedEngineVmName), vmNameOnHost)) { return importHostedEngineVM(vmInfo); } else { vmStatic.setName(String.format(EXTERNAL_VM_NAME_FORMAT, vmNameOnHost)); vmStatic.setOrigin(OriginType.EXTERNAL); } vmStatic.setNumOfSockets(VdsBrokerObjectsBuilder.parseIntVdsProperty(vmInfo.get(VdsProperties.num_of_cpus))); vmStatic.setMemSizeMb(VdsBrokerObjectsBuilder.parseIntVdsProperty(vmInfo.get(VdsProperties.mem_size_mb))); vmStatic.setSingleQxlPci(false); setOsId(vmStatic, (String) vmInfo.get(VdsProperties.guest_os), defaultOsId); setDisplayType(vmStatic, (String) vmInfo.get(VdsProperties.displayType), defaultDisplayType); log.info("Importing VM '{}' as '{}', as it is running on the on Host, but does not exist in the engine.", vmNameOnHost, vmStatic.getName()); externalVmsToAdd.add(vmStatic); return vmStatic; }</code><technical_language>I this, return for testing purposes. For readability adapt methods express this: for (Map vmInfo : vmsInfo) { Vm vm = convertVm(defaultOsId defaultDisplayType, vmInfo); if (vm is hosted engine vm) { getVdsEventListener().importHostedEngineVm(vm); } }</technical_language>

Target:
protected void convertVm(int defaultOsId, DisplayType defaultDisplayType, Map vmInfo) { Guid vmId = Guid.createGuidFromString((String) vmInfo.get(VdsProperties.vm_guid)); VmStatic vmStatic = new VmStatic(); vmStatic.setId(vmId); vmStatic.setCreationDate(new Date()); vmStatic.setVdsGroupId(vdsManager.getVdsGroupId()); String vmNameOnHost = (String) vmInfo.get(VdsProperties.vm_name); if (StringUtils.equals(Config.<String>getValue(ConfigValues.HostedEngineVmName), vmNameOnHost)) { importHostedEngineVM(vmInfo); return; } else { vmStatic.setName(String.format(EXTERNAL_VM_NAME_FORMAT, vmNameOnHost)); vmStatic.setOrigin(OriginType.EXTERNAL); } vmStatic.setNumOfSockets(VdsBrokerObjectsBuilder.parseIntVdsProperty(vmInfo.get(VdsProperties.num_of_cpus))); vmStatic.setMemSizeMb(VdsBrokerObjectsBuilder.parseIntVdsProperty(vmInfo.get(VdsProperties.mem_size_mb))); vmStatic.setSingleQxlPci(false); setOsId(vmStatic, (String) vmInfo.get(VdsProperties.guest_os), defaultOsId); setDisplayType(vmStatic, (String) vmInfo.get(VdsProperties.displayType), defaultDisplayType); log.info("Importing VM '{}' as '{}', as it is running on the on Host, but does not exist in the engine.", vmNameOnHost, vmStatic.getName()); externalVmsToAdd.add(vmStatic); }
Source:
<code>public void updateTaskFromTaskData(TaskRepository taskRepository, ITask task, TaskData taskData) { Date oldModificationDate = task.getModificationDate(); TaskMapper mapper = (TaskMapper) getTaskMapping(taskData); mapper.applyTo(task); String key = task.getTaskKey(); if (key != null) { task.setSummary(NLS.bind("{0} [{1}]", mapper.getSummary(), key)); task.setTaskKey(task.getTaskId()); } if (taskData.isPartial()) { task.setModificationDate(oldModificationDate); } <START> task.setAttribute("CODE_REVIEW", <END> taskData.getRoot().getAttribute(GerritTaskSchema.getDefault().REVIEW_STATE.getKey()).getValue()); task.setAttribute("VERIFIED", taskData.getRoot().getAttribute(GerritTaskSchema.getDefault().VERIFY_STATE.getKey()).getValue()); }</code><technical_language>Constants; potentially in ReviewCoreConstants something</technical_language>

Target:
public void updateTaskFromTaskData(TaskRepository taskRepository, ITask task, TaskData taskData) { Date oldModificationDate = task.getModificationDate(); TaskMapper mapper = (TaskMapper) getTaskMapping(taskData); mapper.applyTo(task); String key = task.getTaskKey(); if (key != null) { task.setSummary(NLS.bind("{0} [{1}]", mapper.getSummary(), key)); task.setTaskKey(task.getTaskId()); } if (taskData.isPartial()) { task.setModificationDate(oldModificationDate); } task.setAttribute(ReviewsCoreConstants.CODE_REVIEW, taskData.getRoot().getAttribute(GerritTaskSchema.getDefault().REVIEW_STATE.getKey()).getValue()); task.setAttribute(ReviewsCoreConstants.VERIFIED, taskData.getRoot().getAttribute(GerritTaskSchema.getDefault().VERIFY_STATE.getKey()).getValue()); }
Source:
<code>public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); <START> isDarkTheme = applicationKvStore.getBoolean("theme", false); <END> cameraMoveListener= () -> presenter.onCameraMove(mapBox.getCameraPosition().target); addCheckBoxCallback(); presenter.attachView(this); initRvNearbyList(); initThemePreferences(); mapView.onCreate(savedInstanceState); mapView.getMapAsync(mapBoxMap -> { this.mapBox=mapBoxMap; initViews(); presenter.setActionListeners(applicationKvStore); initNearbyFilter(); mapBoxMap.setStyle(isDarkTheme?Style.DARK:Style.OUTDOORS, style -> { UiSettings uiSettings = mapBoxMap.getUiSettings(); uiSettings.setCompassGravity(Gravity.BOTTOM | Gravity.LEFT); uiSettings.setCompassMargins(12, 0, 0, 24); uiSettings.setLogoEnabled(false); uiSettings.setAttributionEnabled(false); uiSettings.setRotateGesturesEnabled(false); NearbyParentFragment.this.isMapBoxReady=true; performMapReadyActions(); CameraPosition cameraPosition = new CameraPosition.Builder() .target(new LatLng(51.50550, -0.07520)) .zoom(ZOOM_LEVEL) .build(); mapBoxMap.setCameraPosition(cameraPosition); }); }); }</code><technical_language>revert this change</technical_language>

Target:
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); isDarkTheme = systemThemeUtils.isDeviceInNightMode(); cameraMoveListener= () -> presenter.onCameraMove(mapBox.getCameraPosition().target); addCheckBoxCallback(); presenter.attachView(this); initRvNearbyList(); initThemePreferences(); mapView.onCreate(savedInstanceState); mapView.getMapAsync(mapBoxMap -> { this.mapBox=mapBoxMap; initViews(); presenter.setActionListeners(applicationKvStore); initNearbyFilter(); mapBoxMap.setStyle(isDarkTheme?Style.DARK:Style.OUTDOORS, style -> { UiSettings uiSettings = mapBoxMap.getUiSettings(); uiSettings.setCompassGravity(Gravity.BOTTOM | Gravity.LEFT); uiSettings.setCompassMargins(12, 0, 0, 24); uiSettings.setLogoEnabled(true); uiSettings.setAttributionEnabled(true); uiSettings.setRotateGesturesEnabled(false); NearbyParentFragment.this.isMapBoxReady=true; performMapReadyActions(); CameraPosition cameraPosition = new CameraPosition.Builder() .target(new LatLng(51.50550, -0.07520)) .zoom(ZOOM_LEVEL) .build(); mapBoxMap.setCameraPosition(cameraPosition); }); }); }
Source:
<code>public URLStreamHandler createURLStreamHandler(String protocol) { <START> LOG.debug("createURLStreamHandler(" + protocol + ")"); <END> if (fExtensionPoints != null) { ExtensionPoint ep = fExtensionPoints .get("org.apache.nutch.protocol.Protocol"); if (ep != null) { Extension[] extensions = ep.getExtensions(); for (Extension extension : extensions) { String p = extension.getAttribute("protocolName"); LOG.trace("Found " + p); if (p.equals(protocol)) { LOG.debug("suitable " + p); Object extinst = null; try { extinst = extension.getExtensionInstance(); LOG.debug("instantiated " + extinst.getClass().getName()); } catch (Exception e) { LOG.warn("Could not instantiate " + extension.getId(), e); } String handlerClass = extension.getAttribute("urlStreamHandler"); LOG.debug("urlStreamHandler=" + handlerClass); if (handlerClass != null) { ClassLoader cl = this.getClass().getClassLoader(); LOG.trace("Using nutch classloader " + cl); if (extinst != null) { cl = extinst.getClass().getClassLoader(); LOG.trace("Using extension classloader " + cl); } try { Class clazz = cl.loadClass(handlerClass); return (URLStreamHandler) clazz.newInstance(); } catch (Exception e) { LOG.error("Could not instantiate protocol " + protocol + " handler class " + handlerClass + " defined by extension " + extension.getId(), e); return null; } } LOG.debug( "suitable protocol extension found that did not declare a handler"); return null; } } LOG.debug("No suitable protocol extensions registered"); } else { LOG.debug("No protocol extensions registered?"); } } return null; }</code><technical_language>Please parameterized logging</technical_language>

Target:
public URLStreamHandler createURLStreamHandler(String protocol) { LOG.debug("createURLStreamHandler({})", protocol); if (fExtensionPoints != null) { ExtensionPoint ep = fExtensionPoints .get("org.apache.nutch.protocol.Protocol"); if (ep != null) { Extension[] extensions = ep.getExtensions(); for (Extension extension : extensions) { String p = extension.getAttribute("protocolName"); LOG.trace("Found {}", p); if (p.equals(protocol)) { LOG.debug("suitable {}", p); Object extinst = null; try { extinst = extension.getExtensionInstance(); LOG.debug("found {}", extinst.getClass().getName()); } catch (Exception e) { LOG.warn("Could not find {}", extension.getId(), e); } String handlerClass = extension.getAttribute("urlStreamHandler"); LOG.debug("urlStreamHandler={}", handlerClass); if (handlerClass != null) { ClassLoader cl = this.getClass().getClassLoader(); LOG.trace("Using nutch classloader {}", cl); if (extinst != null) { cl = extinst.getClass().getClassLoader(); LOG.trace("Using extension classloader {}", cl); } try { Class clazz = cl.loadClass(handlerClass); return (URLStreamHandler) clazz.newInstance(); } catch (Exception e) { LOG.error("Could not instantiate protocol handler class defined by extension {}", protocol, handlerClass, extension.getId(), e); return null; } } LOG.debug( "suitable protocol extension found that did not declare a handler"); return null; } } LOG.debug("No suitable protocol extensions registered"); } else { LOG.debug("No protocol extensions registered?"); } } return null; }
Source:
<code>public void testParameterMD() throws SQLException { PreparedStatement pstmt = _conn.prepareStatement("SELECT a FROM parametertest WHERE b = ? AND c = ? AND d >^ ? "); ParameterMetaData pmd = pstmt.getParameterMetaData(); assertEquals(3, pmd.getParameterCount()); assertEquals(Types.DOUBLE, pmd.getParameterType(1)); assertEquals("float8", pmd.getParameterTypeName(1)); assertEquals("java.lang.Double", pmd.getParameterClassName(1)); assertEquals(Types.VARCHAR, pmd.getParameterType(2)); assertEquals("text", pmd.getParameterTypeName(2)); assertEquals("java.lang.String", pmd.getParameterClassName(2)); <START> assertEquals(Types.BINARY, pmd.getParameterType(3)); <END> assertEquals("point", pmd.getParameterTypeName(3)); pstmt.close(); }</code><technical_language>is reason for this change</technical_language>

Target:
public void testParameterMD() throws SQLException { PreparedStatement pstmt = _conn.prepareStatement("SELECT a FROM parametertest WHERE b = ? AND c = ? AND d >^ ? "); ParameterMetaData pmd = pstmt.getParameterMetaData(); assertEquals(3, pmd.getParameterCount()); assertEquals(Types.DOUBLE, pmd.getParameterType(1)); assertEquals("float8", pmd.getParameterTypeName(1)); assertEquals("java.lang.Double", pmd.getParameterClassName(1)); assertEquals(Types.VARCHAR, pmd.getParameterType(2)); assertEquals("text", pmd.getParameterTypeName(2)); assertEquals("java.lang.String", pmd.getParameterClassName(2)); assertEquals(Types.OTHER, pmd.getParameterType(3)); assertEquals("point", pmd.getParameterTypeName(3)); pstmt.close(); }
Source:
<code>public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain nextFilter) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; if (authorizers.isEmpty()) { log.debug("Skipping authorization for request %s %s %s", request.getMethod(), request.getRequestURI(), request.toString()); nextFilter.doFilter(request, response); return; } <START> log.debug("Applying authorization filter to request %s %s", request.getRequestURI(), request.toString()); <END> for (Authorizer authorizer : authorizers) { if (!authorizer.authorize(request)) { log.warn("Authorization FAILED for request: %s %s uri: %s", request.getMethod(), request.toString(), request.getRequestURI()); response.sendError(SC_FORBIDDEN, "Not Authorized to access this resource"); return; } } nextFilter.doFilter(request, response); }</code><technical_language>log.debug consumes CPU. avoid logging here</technical_language>

Target:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain nextFilter) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; if (authorizers.isEmpty()) { nextFilter.doFilter(request, response); return; } for (Authorizer authorizer : authorizers) { try { authorizer.authorize(request); } catch (AuthorizationException e) { log.warn("Authorization FAILED for request: %s %s uri: %s", request.getMethod(), request.toString(), request.getRequestURI()); response.sendError(SC_FORBIDDEN, e.getMessage() != null ? e.getMessage() : "Not Authorized to access this resource"); return; } } nextFilter.doFilter(request, response); }
Source:
<code>public Response<Set<String>> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || (Strings.isNullOrEmpty(input.add) && Strings .isNullOrEmpty(input.remove))) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); if (!control.canEditHashtags()) { throw new AuthException("Editing hashtags not permitted"); } ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> oldHashtags = notes.getHashtags(); Set<String> hashtags = new HashSet<String>(); if (oldHashtags != null) { hashtags.addAll(oldHashtags); }; if (!Strings.isNullOrEmpty(input.add)) { hashtags.addAll(Lists.newArrayList(Splitter.on(CharMatcher.anyOf(",;")) .trimResults().omitEmptyStrings().split(input.add))); } <START> if (!Strings.isNullOrEmpty(input.remove)) { <END> hashtags.removeAll(Lists.newArrayList(Splitter .on(CharMatcher.anyOf(",;")).trimResults().omitEmptyStrings() .split(input.remove))); } update.setHashtags(hashtags); update.commit(); indexer.index(dbProvider.get(), update.getChange()); return Response.ok(hashtags); }</code><technical_language>sense 400 if is overlap add remove</technical_language>

Target:
public Response<TreeSet<String>> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || (Strings.isNullOrEmpty(input.add) && Strings .isNullOrEmpty(input.remove))) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); if (!control.canEditHashtags()) { throw new AuthException("Editing hashtags not permitted"); } ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> existingHashtags = notes.getHashtags(); Set<String> updatedHashtags = new HashSet<>(); Set<String> toAdd = new HashSet<>(extractTags(input.add)); Set<String> toRemove = new HashSet<>(extractTags(input.remove)); if (existingHashtags != null && !existingHashtags.isEmpty()) { updatedHashtags.addAll(existingHashtags); toAdd.removeAll(existingHashtags); toRemove.retainAll(existingHashtags); } if (toAdd.size() > 0 || toRemove.size() > 0) { updatedHashtags.addAll(toAdd); updatedHashtags.removeAll(toRemove); update.setHashtags(updatedHashtags); update.commit(); indexer.index(dbProvider.get(), update.getChange()); } return Response.ok(new TreeSet<String>(updatedHashtags)); }
Source:
<code>public void processAllUpdates() { horizontalGraphGroup.processAllUpdates(); verticalGraphGroup.processAllUpdates(); if (!this.positionsAffected.isEmpty()) { LongIterator itrPositions = this.positionsAffected.iterator(); while (itrPositions.hasNext()) { long pos = itrPositions.nextLong(); int oldHorizDistance = this.horizDistances.get(pos); int oldVertDistance = this.vertDistances.get(pos); int horizCurrentDistance = horizontalGraphGroup.getLevel(pos); int vertCurrentDistance = verticalGraphGroup.getLevel(pos); if (oldHorizDistance != horizCurrentDistance || oldVertDistance != vertCurrentDistance) { <START> iTicketManager.getCubeTaskPriorityQueueSorter().onUpdateCubeLevel(CubePos.from(pos), () -> this.horizDistances.get(pos), horizCurrentDistance, (horizDistance) -> { <END> if (horizCurrentDistance >= this.horizDistances.defaultReturnValue() || vertCurrentDistance >= this.vertDistances.defaultReturnValue()) { this.horizDistances.remove(pos); this.vertDistances.remove(pos); } else { this.horizDistances.put(pos, horizCurrentDistance); this.vertDistances.put(pos, vertCurrentDistance); } }); this.updateTicket(pos, horizCurrentDistance, this.isWithinViewDistance(oldHorizDistance, oldVertDistance), this.isWithinViewDistance(horizCurrentDistance, vertCurrentDistance)); } } this.positionsAffected.clear(); } }</code><technical_language>vertical view distance account sorting cube load tasks suggestion iTicketManager.getCubeTaskPriorityQueueSorter().onUpdateCubeLevel(CubePos.from(pos), () -> this.horizDistances.get(pos), horizCurrentDistance+verticalViewDistance, (horizDistance) -> {</technical_language>

Target:
public void processAllUpdates() { horizontalGraphGroup.processAllUpdates(); verticalGraphGroup.processAllUpdates(); if (!this.positionsAffected.isEmpty()) { LongIterator itrPositions = this.positionsAffected.iterator(); while (itrPositions.hasNext()) { long pos = itrPositions.nextLong(); int oldHorizDistance = this.horizDistances.get(pos); int oldVertDistance = this.vertDistances.get(pos); int horizCurrentDistance = horizontalGraphGroup.getLevel(pos); int vertCurrentDistance = verticalGraphGroup.getLevel(pos); if (oldHorizDistance != horizCurrentDistance || oldVertDistance != vertCurrentDistance) { iTicketManager.getCubeTaskPriorityQueueSorter().onUpdateCubeLevel(CubePos.from(pos), () -> this.horizDistances.get(pos), horizCurrentDistance+verticalViewDistance, (horizDistance) -> { if (horizCurrentDistance >= this.horizDistances.defaultReturnValue() || vertCurrentDistance >= this.vertDistances.defaultReturnValue()) { this.horizDistances.remove(pos); this.vertDistances.remove(pos); } else { this.horizDistances.put(pos, horizCurrentDistance); this.vertDistances.put(pos, vertCurrentDistance); } }); this.updateTicket(pos, horizCurrentDistance, this.isWithinViewDistance(oldHorizDistance, oldVertDistance), this.isWithinViewDistance(horizCurrentDistance, vertCurrentDistance)); } } this.positionsAffected.clear(); } }
Source:
<code>private void clientCertCheck(){ int enableClientCert = getInteger(USE_CLIENT_CERT, 0); String certPath = getString(CLIENT_CERT_LOCATION, ""); String certPass = getString(CLIENT_CERT_PASSWORD, ""); if(enableClientCert!=0 && !certPath.isEmpty() && !certPass.isEmpty()) { try { SSLContextManager contextManager = getSSLContextManager(); int ksIndex = contextManager.loadPKCS12Certificate(certPath, certPass); contextManager.unlockKey(ksIndex, ksIndex, certPass); contextManager.setDefaultKey(ksIndex, ksIndex); setActiveCertificate(); setEnableCertificate(true); logger.info("Client Certificate enabled from CLI"); logger.info("Use -config certificate.persist=1 to save settings"); } catch (IOException ex) { logger.error("IO exception", ex); <START> } catch (CertificateException ex) { <END> logger.error("Certificate exception", ex); } catch (NoSuchAlgorithmException ex) { logger.error("NoSuchAlgorithm exception", ex); } catch (KeyStoreException ex) { logger.error("KeyStore exception", ex); } catch (KeyManagementException ex) { logger.error("KeyManagement exception", ex); } } }</code><technical_language>user need this? debug more appropriate</technical_language>

Target:
private void clientCertCheck(){ boolean enableClientCert = getBoolean(USE_CLIENT_CERT, false); String certPath = getString(CLIENT_CERT_LOCATION, ""); String certPass = getString(CLIENT_CERT_PASSWORD, ""); int certIndex = getInt(CLIENT_CERT_INDEX, 0); if(enableClientCert && !certPath.isEmpty() && !certPass.isEmpty()) { try { SSLContextManager contextManager = getSSLContextManager(); int ksIndex = contextManager.loadPKCS12Certificate(certPath, certPass); contextManager.unlockKey(ksIndex, certIndex, certPass); contextManager.setDefaultKey(ksIndex, certIndex); setActiveCertificate(); setEnableCertificate(true); logger.info("Client Certificate enabled from CLI"); logger.info("Use -config certificate.persist=true to save settings"); } catch (IOException|CertificateException|NoSuchAlgorithmException|KeyStoreException|KeyManagementException ex) { logger.error("The certificate could not be enabled due to an error", ex); } } }
Source:
<code>public int ifHit(Vector<Bullet> shipBullets) { Iterator iteralien = ConcreteAggregate.createIterator(shipBullets); while (iteralien.hasNext()) { <START> Bullet bullet = (Bullet) iteralien.next(); <END> if (bullet.getY() > ypos - 12 && bullet.getY() < ypos + 20) { if (bullet.getX() > xpos - 6 && bullet.getX() < xpos + 50) { Game.logfile.writeHit("Alien", xpos, ypos); health--; return iteralien.position(); } } } return -1; }</code><technical_language>iteralien -> iterShipBullets</technical_language>

Target:
public int ifHit(Vector<Bullet> shipBullets) { Iterator iterShipBullets = ConcreteAggregate.createIterator(shipBullets); while (iterShipBullets.hasNext()) { Bullet bullet = (Bullet) iterShipBullets.next(); if (bullet.getY() > ypos - 12 && bullet.getY() < ypos + 20) { if (bullet.getX() > xpos - 6 && bullet.getX() < xpos + 50) { Game.logfile.writeHit("Alien", xpos, ypos); health--; return iterShipBullets.position(); } } } return -1; }
Source:
<code>public void minAgeLimitButBirthdateTooRecent() { String birthdate = DateTime.now().minusYears(18).plusDays(1).toLocalDate().toString(); <START> validator = new ConsentSignatureValidator(18); <END> ConsentSignature sig = new ConsentSignature.Builder().withName("test name").withBirthdate(birthdate).build(); assertValidatorMessage(validator, sig, "birthdate", "too recent (the study requires participants to be 18 years of age or older)."); }</code><technical_language>Actually, I want this other around. Feb 28 2022, this *definitely* fail, Joda thinks 18 years Feb 29 2004 Feb 28 2022. I fixed timestamps test more reliable</technical_language>

Target:
public void minAgeLimitButBirthdateTooRecent() { String birthdate = NOW.minusYears(18).plusDays(1).toLocalDate().toString(); validator = new ConsentSignatureValidator(18); ConsentSignature sig = new ConsentSignature.Builder().withName("test name").withBirthdate(birthdate).build(); assertValidatorMessage(validator, sig, "birthdate", "too recent (the study requires participants to be 18 years of age or older)."); }
Source:
<code>public ImportEntriesDialog(BibDatabaseContext database, BackgroundTask<ParserResult> task) { this.database = database; this.task = task; ViewLoader.view(this) .load() .setAsDialogPane(this); BooleanBinding booleanBind = Bindings.isEmpty(entriesListView.getCheckModel().getCheckedItems()); Button btn = (Button) this.getDialogPane().lookupButton(importButton); btn.disableProperty().bind(booleanBind); setResultConverter(button -> { if (button == importButton) { <START> viewModel.importEntries(entriesListView.getCheckModel().getCheckedItems(), downloadLinkedOnlineFiles.isSelected()); <END> } else { dialogService.notify(Localization.lang("Import canceled")); } return false; }); }</code><technical_language>JabRef MVVM approach, ideal solution add a property for checkbox in viewmodel bind checkbox's selected item property. ideally case for checkedItems.. done. <LINK_0></technical_language>

Target:
public ImportEntriesDialog(BibDatabaseContext database, BackgroundTask<ParserResult> task) { this.database = database; this.task = task; ViewLoader.view(this) .load() .setAsDialogPane(this); BooleanBinding booleanBind = Bindings.isEmpty(entriesListView.getCheckModel().getCheckedItems()); Button btn = (Button) this.getDialogPane().lookupButton(importButton); btn.disableProperty().bind(booleanBind); downloadLinkedOnlineFiles.setSelected(preferences.getFilePreferences().getDownloadLinkedFiles()); setResultConverter(button -> { if (button == importButton) { viewModel.importEntries(entriesListView.getCheckModel().getCheckedItems(), downloadLinkedOnlineFiles.isSelected()); } else { dialogService.notify(Localization.lang("Import canceled")); } return false; }); }
Source:
<code>public Subscriber<? super T> call(final Subscriber<? super T> child) { return new Subscriber<T>(child) { U previousKey; boolean hasPrevious; @Override public void onNext(T t) { U currentKey = previousKey; final U key; try { key = keySelector.call(t); } catch (Throwable e) { Exceptions.throwOrReport(e, child, t); return; } previousKey = key; if (hasPrevious) { Boolean comparison; try { comparison = comparator.call(currentKey, key); } catch (Throwable e) { Exceptions.throwOrReport(e, child, key); return; } <START> if (!comparison) { <END> child.onNext(t); } else { request(1); } } else { hasPrevious = true; child.onNext(t); } } @Override public void onError(Throwable e) { child.onError(e); } @Override public void onCompleted() { child.onCompleted(); } }; }</code><technical_language>a subtle NPE potential here. if want explicitly guard a misbehaving comparator implementation</technical_language>

Target:
public Subscriber<? super T> call(final Subscriber<? super T> child) { return new Subscriber<T>(child) { U previousKey; boolean hasPrevious; @Override public void onNext(T t) { U currentKey = previousKey; final U key; try { key = keySelector.call(t); } catch (Throwable e) { Exceptions.throwOrReport(e, child, t); return; } previousKey = key; if (hasPrevious) { boolean comparison; try { comparison = comparator.call(currentKey, key); } catch (Throwable e) { Exceptions.throwOrReport(e, child, key); return; } if (!comparison) { child.onNext(t); } else { request(1); } } else { hasPrevious = true; child.onNext(t); } } @Override public void onError(Throwable e) { child.onError(e); } @Override public void onCompleted() { child.onCompleted(); } }; }