auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public CloudianGroup listGroup(final String groupId) { if (Strings.isNullOrEmpty(groupId)) { return null; } LOG.debug("Trying to find Cloudian group with id=" + groupId); try { final HttpResponse response = get(String.format("/group?groupId=%s", groupId)); checkResponseOK(response); <START> if (response.getStatusLine().getStatusCode() == HttpStatus.SC_NO_CONTENT || <END> response.getEntity() == null || response.getEntity().getContent() == null) { return null; } final ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(response.getEntity().getContent(), CloudianGroup.class); } catch (final IOException e) { LOG.error("Failed to list Cloudian group due to:", e); checkResponseTimeOut(e); } return null; }</code><technical_language>putting boolean condition response.getStatusLine().getStatusCode() == HttpStatus.SC_NO_CONTENT || response.getEntity() == null || response.getEntity().getContent() == null in a method? repeats often. Then, is write a unit test for it</technical_language>

Target:
public CloudianGroup listGroup(final String groupId) { if (Strings.isNullOrEmpty(groupId)) { return null; } LOG.debug("Trying to find Cloudian group with id=" + groupId); try { final HttpResponse response = get(String.format("/group?groupId=%s", groupId)); checkResponseOK(response); if (checkEmptyResponse(response)) { return null; } final ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(response.getEntity().getContent(), CloudianGroup.class); } catch (final IOException e) { LOG.error("Failed to list Cloudian group due to:", e); checkResponseTimeOut(e); } return null; }
Source:
<code>@Override protected AbstractContinuousQuery<Integer, String> getContinuousQuery() { ContinuousQueryWithTransformer<Integer, String, String> qry = new ContinuousQueryWithTransformer<>(); Factory factory = FactoryBuilder.factoryOf( (IgniteClosure<CacheEntryEvent, String>)event -> ((String)event.getValue()) ); qry.setRemoteTransformerFactory(factory); <START> qry.setLocalListener((evts) -> evts.forEach(e -> System.out.println("val=" + e))); <END> return qry; }</code><technical_language>eliminate System.out.println usage in test</technical_language>

Target:
@Override protected AbstractContinuousQuery<Integer, String> getContinuousQuery() { ContinuousQueryWithTransformer<Integer, String, String> qry = new ContinuousQueryWithTransformer<>(); Factory factory = FactoryBuilder.factoryOf( (IgniteClosure<CacheEntryEvent, String>)event -> ((String)event.getValue()) ); qry.setRemoteTransformerFactory(factory); ContinuousQueryWithTransformer.EventListener<String> lsnr = (evts) -> { for (String e : evts) updCntr.incrementAndGet(); }; qry.setLocalListener(lsnr); return qry; }
Source:
<code>private void performDiskUpdate(final boolean unlockImage) { if (shouldPerformMetadataUpdate()) { updateMetaDataDescription((DiskImage) getNewDisk()); } final Disk disk = getDiskDao().get(getParameters().getDiskId()); applyUserChanges(disk); TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { @Override public Object runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); updateDeviceProperties(); getBaseDiskDao().update(disk); if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) disk; diskImage.setQuotaId(getQuotaId()); if (unlockImage && diskImage.getImageStatus() == ImageStatus.LOCKED) { diskImage.setImageStatus(ImageStatus.OK); } getImageDao().update(diskImage.getImage()); updateQuota(diskImage); updateDiskProfile(); } if <START> (disk.getDiskStorageType() <END> == DiskStorageType.LUN) { updateLunProperties((LunDisk)getNewDisk()); } reloadDisks(); updateBootOrder(); setSucceeded(true); return null; } private void updateDeviceProperties() { if (updateReadOnlyRequested()) { vmDeviceForVm.setIsReadOnly(getNewDisk().getReadOnly()); getVmDeviceDao().update(vmDeviceForVm); } if (getOldDisk().getDiskInterface() != getNewDisk().getDiskInterface()) { getVmDeviceDao().clearDeviceAddress(getOldDisk().getId()); } } private void updateLunProperties(LunDisk lunDisk) { vmDeviceForVm.setScsiReservationUsed(lunDisk.isUsingScsiReservation()); getVmDeviceDao().update(vmDeviceForVm); } }); }</code><technical_language>if (!isDiskImage())</technical_language>

Target:
private void performDiskUpdate(final boolean unlockImage) { if (shouldPerformMetadataUpdate()) { updateMetaDataDescription((DiskImage) getNewDisk()); } final Disk disk = getDiskDao().get(getParameters().getDiskId()); applyUserChanges(disk); TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { @Override public Object runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); updateDeviceProperties(); getBaseDiskDao().update(disk); if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) disk; diskImage.setQuotaId(getQuotaId()); if (unlockImage && diskImage.getImageStatus() == ImageStatus.LOCKED) { diskImage.setImageStatus(ImageStatus.OK); } getImageDao().update(diskImage.getImage()); updateQuota(diskImage); updateDiskProfile(); } else if (disk.getDiskStorageType() == DiskStorageType.LUN) { updateLunProperties((LunDisk)getNewDisk()); } else { log.error("Unexpected disk storage type ..."); } clearDeviceAddressIfNeeded(); reloadDisks(); updateBootOrder(); setSucceeded(true); return null; } private void updateDeviceProperties() { if (updateReadOnlyRequested()) { vmDeviceForVm.setIsReadOnly(getNewDisk().getReadOnly()); getVmDeviceDao().update(vmDeviceForVm); } } private void updateLunProperties(LunDisk lunDisk) { vmDeviceForVm.setUsingScsiReservation(lunDisk.isUsingScsiReservation()); getVmDeviceDao().update(vmDeviceForVm); } private void clearDeviceAddressIfNeeded() { if (getOldDisk().getDiskInterface() != getNewDisk().getDiskInterface()) { getVmDeviceDao().clearDeviceAddress(getOldDisk().getId()); } } }); }
Source:
<code>private Integer populateBestHpMpMappings() throws SolrServerException, IOException, SQLException { Integer count = 0; String query = "SELECT 'hp_mp' AS type, hp_id, hp_term, mp_id, mp_term FROM best_impc_hp_mp_mapping "; try (Connection connection = phenodigmDataSource.getConnection(); PreparedStatement p = connection.prepareStatement(query, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)) { p.setFetchSize(Integer.MIN_VALUE); ResultSet r = p.executeQuery(); while (r.next()) { String hpId = r.getString("hp_id"); PhenodigmDTO doc = new PhenodigmDTO(); doc.setType(r.getString("type")); doc.setHpID(hpId); doc.setHpTerm(r.getString("hp_term")); doc.setMpID(r.getString("mp_id")); doc.setMpTerm(r.getString("mp_term")); if (humanSynonymMap.containsKey(hpId)) <START> doc.setHpSynonym(new ArrayList<>(humanSynonymMap.get(hpId))); <END> phenodigmIndexing.addBean(doc); count++; } } return count; }</code><technical_language>{}</technical_language>

Target:
private Integer populateBestHpMpMappings() throws SolrServerException, IOException, SQLException { Integer count = 0; String query = "SELECT 'hp_mp' AS type, hp_id, hp_term, mp_id, mp_term FROM best_impc_hp_mp_mapping "; try (Connection connection = phenodigmDataSource.getConnection(); PreparedStatement p = connection.prepareStatement(query, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)) { p.setFetchSize(Integer.MIN_VALUE); ResultSet r = p.executeQuery(); while (r.next()) { String hpId = r.getString("hp_id"); PhenodigmDTO doc = new PhenodigmDTO(); doc.setType(r.getString("type")); doc.setHpID(hpId); doc.setHpTerm(r.getString("hp_term")); doc.setMpID(r.getString("mp_id")); doc.setMpTerm(r.getString("mp_term")); if (humanSynonymMap.containsKey(hpId)) { doc.setHpSynonym(new ArrayList<>(humanSynonymMap.get(hpId))); } phenodigmIndexing.addBean(doc); count++; } } return count; }
Source:
<code>public Result<Storage> getStorage(final String id) { final Optional<Storage> storage = storageDbRepository.getStorage(id); if (storage.isPresent()) { return Result.ok(storage.get()); } <START> else { <END> return Result.problem(Problem.valueOf(Response.Status.NOT_FOUND, "No storage with id " + id)); } }</code><technical_language>I thought decided write } else { newline</technical_language>

Target:
public Result<Storage> getStorage(final String id) { final Optional<Storage> storage; try { storage = storageDbRepository.getStorage(id); } catch (InternalNakadiException e) { return Result.problem(Problem.valueOf(INTERNAL_SERVER_ERROR, e.getMessage())); } if (storage.isPresent()) { return Result.ok(storage.get()); } else { return Result.problem(Problem.valueOf(NOT_FOUND, "No storage with id " + id)); } }
Source:
<code>public void star() throws IOException { <START> final Directives gistlocation = new Directives().xpath( <END> this.xpath() ); final Directives attributelocation = gistlocation.attr( "starred", MkGist.STARRED_VALUE ); this.storage.apply( attributelocation ); }</code><technical_language>dirs instead of gistlocation</technical_language>

Target:
public void star() throws IOException { this.storage.apply( new Directives() .xpath(this.xpath()) .attr("starred", Boolean.toString(true)) ); }
Source:
<code>public final void check(APIClient client, JmxMBeanServer server, EnumSet<RegistrationMode> mode) throws OperationsException, UnknownHostException { <START> if (!lock.tryLock() && mode.contains(Wait)) { <END> lock.lock(); lock.unlock(); return; } try { doCheck(client, server, mode); } finally { lock.unlock(); } }</code><technical_language>If tryLock fails, allowed wait, is supposed happen? Right now, perform doCheck lock (which I assume is safe?), call unlock()..</technical_language>

Target:
public final void check(APIClient client, JmxMBeanServer server, EnumSet<RegistrationMode> mode) throws OperationsException, UnknownHostException { if (!lock.tryLock()) { if (mode.contains(Wait)) { lock.lock(); lock.unlock(); } return; } try { doCheck(client, server, mode); } finally { lock.unlock(); } }
Source:
<code>public Map<ProjectRef, String> getRemoteDependencyVersionOverridesByProject( final ProjectVersionRef ref ) throws ManipulationException { <START> final Map<ProjectRef, String> versionOverrides = new LinkedHashMap<>(); <END> for (Map.Entry<ArtifactRef, String> entry : getRemoteDependencyVersionOverrides(ref).entrySet()) { ArtifactRef oldKey = entry.getKey(); ProjectRef newKey = new SimpleProjectRef(oldKey.getGroupId(), oldKey.getArtifactId()); versionOverrides.put(newKey, entry.getValue()); } return versionOverrides; }</code><technical_language>Assuming I understand correctly - need convert index ProjectRef compared in override g:a section (?) simpler ? : return getRemoteDependencyVersionOverrides(ref).entrySet().stream().collect( Collectors.toMap( e -> e.getKey().asProjectRef(), Map.Entry::getValue, (key1, key2) -> { // Avoid problem a ProjectRef leads duplicates ArtifactRef return key1; } ) );</technical_language>

Target:
public Map<ProjectRef, String> getRemoteDependencyVersionOverridesByProject( final ProjectVersionRef ref ) throws ManipulationException { Map<ArtifactRef, String> byArtifact = getRemoteDependencyVersionOverrides( ref ); return byArtifact.entrySet() .stream() .collect( Collectors.toMap( e -> e.getKey() .asProjectRef(), Map.Entry::getValue, ( key1, key2 ) -> { return key1; } ) ); }
Source:
<code>private void bodyConsumerChunk(ChannelBuffer buffer) throws HandlerException { try { bodyConsumer.chunk(buffer, responder); } catch (Throwable t) { try { bodyConsumerError(t); } catch (Throwable t2) { <START> exceptionHandler.handle(t2, request, responder); <END> return; } exceptionHandler.handle(t, request, responder); } }</code><technical_language>a good idea log exception, lose in this case</technical_language>

Target:
private void bodyConsumerChunk(ChannelBuffer buffer) throws HandlerException { try { bodyConsumer.chunk(buffer, responder); } catch (Throwable t) { try { bodyConsumerError(t); } catch (Throwable t2) { exceptionHandler.handle(t2, request, responder); LOG.debug("Handled exception thrown from handleError. original exception from chunk call was:", t); return; } exceptionHandler.handle(t, request, responder); } }
Source:
<code>public SolenoidRetract(String name, SolenoidSubsystem system) { <START> super(name, system, SolenoidState.REVERSE); <END> }</code><technical_language>change name of state RETRACT name of class file REVERSE (I prefer retract)</technical_language>

Target:
public SolenoidRetract(String name, SolenoidSubsystem system) { super(name, system, SolenoidState.RETRACT); }
Source:
<code>public ModuleMetadataResource toResource(ModuleMetadata entity) { <START> return createResourceWithId(entity.getName(), entity); <END> }</code><technical_language>I foresee clashes here. <type> + "/" + <name></technical_language>

Target:
public ModuleMetadataResource toResource(ModuleMetadata entity) { return createResourceWithId(entity.getId(), entity); }
Source:
<code><START> public Publisher<Integer> createPublisher(long elements) { <END> return new Publisher<Integer>() { @Override public void subscribe(final Subscriber<? super Integer> s) { s.onSubscribe(new Subscription() { @Override public void request(long n) { s.onComplete(); } @Override public void cancel() { } }); } }; }</code><technical_language>easier reuse AsyncIterablePublisher a Collections.emptyList</technical_language>

Target:
public Publisher<Integer> createPublisher(long elements) { return new AsyncIterablePublisher<Integer>(Collections.<Integer>emptyList(), ex); }
Source:
<code>public ResponseEntity createSampleList(@PathVariable final String crop, @RequestBody final SampleListDto dto) { dto.setCropName(crop); <START> Map<String, Object> map; <END> try { map = this.sampleListService.createSampleList(dto); } catch (final MiddlewareException e) { final ErrorResponse response = new ErrorResponse(); if(e.getMessage().equalsIgnoreCase("List name should be unique within the same directory")){ response.addError(e.getMessage(),"ListName"); }else{ response.addError("Something went wrong, please try again"); } return new ResponseEntity<>(response, HttpStatus.CONFLICT); } return new ResponseEntity<>(map, HttpStatus.OK); }</code><technical_language>@vmaletta add final</technical_language>

Target:
public ResponseEntity createSampleList(@PathVariable final String crop, @RequestBody final SampleListDto dto) { dto.setCropName(crop); final Map<String, Object> map; try { map = this.sampleListService.createSampleList(dto); } catch (final MiddlewareException e) { final ErrorResponse response = new ErrorResponse(); if (e.getMessage().equalsIgnoreCase("List name should be unique within the same directory")) { response.addError(e.getMessage(), "ListName"); } else { response.addError("Something went wrong, please try again"); } return new ResponseEntity<>(response, HttpStatus.CONFLICT); } return new ResponseEntity<>(map, HttpStatus.OK); }
Source:
<code>public void addExceptionalYield(SymbolicValue target, ProgramState exceptionalState, String exceptionFullyQualifiedName, SECheck check) { if (methodBehavior != null && methodBehavior.parameters().contains(target)) { Type exceptionType = semanticModel.getClassType(exceptionFullyQualifiedName); ProgramState newExceptionalState = exceptionalState.clearStack().stackValue(constraintManager.createExceptionalSymbolicValue(exceptionType)); ExplodedGraph.Node exitNode = explodedGraph.node(node.programPoint, newExceptionalState); MethodYield yield = methodBehavior.createExceptionalCheckBasedYield(exitNode, exceptionType, check); <START> exitNode.addParent(node, yield); <END> } }</code><technical_language>a test for this</technical_language>

Target:
public void addExceptionalYield(SymbolicValue target, ProgramState exceptionalState, String exceptionFullyQualifiedName, SECheck check) { if (methodBehavior != null && methodBehavior.parameters().contains(target)) { Type exceptionType = semanticModel.getClassType(exceptionFullyQualifiedName); ProgramState newExceptionalState = exceptionalState.clearStack().stackValue(constraintManager.createExceptionalSymbolicValue(exceptionType)); ExplodedGraph.Node exitNode = explodedGraph.node(node.programPoint, newExceptionalState); MethodYield yield = methodBehavior.createExceptionalCheckBasedYield(target, exitNode, exceptionType, check); exitNode.addParent(node, yield); } }
Source:
<code>public String queryMaxSupportedVersion() { String version = queryNewestVersion(); String majorVersion = version.split("\\.")[0]; <START> if (Integer.parseInt(majorVersion)>clientProperties.getMapGenerator().getMaxSupportedMajorVersion() || <END> Integer.parseInt(majorVersion)<clientProperties.getMapGenerator().getMinSupportedMajorVersion()) { RestTemplate restTemplate = new RestTemplate(); LinkedMultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); headers.add("Accept", "application/vnd.github.v3+json"); HttpEntity<String> entity = new HttpEntity<>(null, headers); ResponseEntity<String> response = restTemplate.exchange(clientProperties.getMapGenerator().getQueryVersionsUrl(), HttpMethod.GET, entity, String.class); JsonElement jsonElement = new JsonParser().parse(response.getBody()); for(JsonElement element: jsonElement.getAsJsonArray()) { JsonObject mainObject = element.getAsJsonObject(); version = mainObject.get("tag_name").getAsString(); majorVersion = version.split("\\.")[0]; if (Integer.parseInt(majorVersion)<clientProperties.getMapGenerator().getMaxSupportedMajorVersion() && Integer.parseInt(majorVersion)>clientProperties.getMapGenerator().getMinSupportedMajorVersion()) { return version; } } throw new RuntimeException("No Valid Generator Version Found"); } return version; }</code><technical_language>space ">",</technical_language>

Target:
public ComparableVersion queryMaxSupportedVersion() { ComparableVersion version = new ComparableVersion(""); ComparableVersion minVersion = new ComparableVersion(String.valueOf(clientProperties.getMapGenerator().getMinSupportedMajorVersion())); ComparableVersion maxVersion = new ComparableVersion(String.valueOf(clientProperties.getMapGenerator().getMaxSupportedMajorVersion() + 1)); RestTemplate restTemplate = new RestTemplate(); LinkedMultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); headers.add("Accept", "application/vnd.github.v3+json"); HttpEntity<String> entity = new HttpEntity<>(null, headers); ResponseEntity<List<GithubGeneratorRelease>> response = restTemplate.exchange(clientProperties.getMapGenerator().getQueryVersionsUrl(), HttpMethod.GET, entity, new ParameterizedTypeReference<>() { }); List<GithubGeneratorRelease> releases = response.getBody(); for (GithubGeneratorRelease release : releases) { version.parseVersion(release.getTagName()); if (version.compareTo(maxVersion) < 0 && minVersion.compareTo(version) < 0) { return version; } } throw new RuntimeException("No valid generator version found"); }
Source:
<code>public void flush() throws TTransportException { if (!isOpen()) { throw TNatsServiceTransport.getClosedConditionException(conn, "flush:"); } byte[] data = new byte[writeBuffer.position()]; writeBuffer.flip(); writeBuffer.get(data); if (data.length == 0) { return; } if (data.length + 4 > TNatsServiceTransport.NATS_MAX_MESSAGE_SIZE) { throw new FMessageSizeException(String.format( "Message exceeds %d bytes, was %d bytes", TNatsServiceTransport.NATS_MAX_MESSAGE_SIZE, data.length)); } byte[] frame = new byte[data.length + 4]; ProtocolUtils.writeInt(data.length, frame, 0); System.arraycopy(data, 0, frame, 4, data.length); try{ conn.publish(getFormattedSubject(), frame); }catch(IOException e){ <START> LOGGER.warning("flush: unable to publish data: " + e.getMessage()); <END> } writeBuffer.clear(); }</code><technical_language>throw a TTransportException wrapping this, right</technical_language>

Target:
public void flush() throws TTransportException { if (!isOpen()) { throw TNatsServiceTransport.getClosedConditionException(conn, "flush:"); } byte[] data = new byte[writeBuffer.position()]; writeBuffer.flip(); writeBuffer.get(data); if (data.length == 0) { return; } if (data.length + 4 > TNatsServiceTransport.NATS_MAX_MESSAGE_SIZE) { throw new FMessageSizeException(String.format( "Message exceeds %d bytes, was %d bytes", TNatsServiceTransport.NATS_MAX_MESSAGE_SIZE, data.length)); } byte[] frame = new byte[data.length + 4]; ProtocolUtils.writeInt(data.length, frame, 0); System.arraycopy(data, 0, frame, 4, data.length); try { conn.publish(getFormattedSubject(), frame); } catch (IOException e) { throw new TTransportException("flush: unable to publish data: " + e.getMessage()); } writeBuffer.clear(); }
Source:
<code>private void displayMessages(List<VerificationMessage> validationMessages) { if (!validationMessages.isEmpty()) { getLog().info("There were some issues found during the verification of your plugin. Please refer to " + HOSTING_JIRA_PROJECT <START> + " and/or the jenkinsci-dev ML to get hel if you don't understand the following message(s)."); <END> } for (VerificationMessage validationMessage : validationMessages) { getLog().info(validationMessage.getSeverity() + " => " + validationMessage.getMessage()); } }</code><technical_language>Typo: hel</technical_language>

Target:
private void displayMessages(List<VerificationMessage> validationMessages) { if (!validationMessages.isEmpty()) { getLog().info("There were some issues found during the verification of your plugin. Please refer to " + HOSTING_WIKI_PAGE + " and/or the jenkinsci-dev ML to get help if you don't understand the following message(s)."); } else { getLog().info("No issue found for hosting"); } for (VerificationMessage validationMessage : validationMessages) { getLog().info(validationMessage.getSeverity() + " => " + validationMessage.getMessage()); } }
Source:
<code>private boolean match(final MethodNode methodNode, final String superClassName) { firstIsALoad0(methodNode); <START> nextIsInvoke(Opcodes.INVOKESPECIAL, superClassName, "<init>", <END> CONSTRUCTOR_DESC); nextIs(Opcodes.RETURN); return cursor != null; }</code><technical_language>a contant CONSTRUCTOR_NAME in this filter. consistently remove all</technical_language>

Target:
private boolean match(final MethodNode methodNode, final String superClassName) { firstIsALoad0(methodNode); nextIsInvoke(Opcodes.INVOKESPECIAL, superClassName, CONSTRUCTOR_NAME, CONSTRUCTOR_DESC); nextIs(Opcodes.RETURN); return cursor != null; }
Source:
<code>public void injectRuntime(WorkspaceImpl workspace) throws ServerException { try (Unlocker ignored = lockService.writeLock(workspace.getId())) { WorkspaceStatus workspaceStatus = statuses.get(workspace.getId()); if (workspaceStatus == null) { workspace.setStatus(STOPPED); return; } try { <START> workspace.setRuntime(asRuntime(getRuntime(workspace.getId()))); <END> } catch (ServerException | InfrastructureException e) { workspaceStatus = STOPPED; } workspace.setStatus(workspaceStatus); } }</code><technical_language>asRuntime(getRuntime()) clear me. asRuntime(getInternalRuntime())</technical_language>

Target:
public void injectRuntime(WorkspaceImpl workspace) throws ServerException { try (Unlocker ignored = lockService.writeLock(workspace.getId())) { WorkspaceStatus workspaceStatus = statuses.get(workspace.getId()); if (workspaceStatus == null) { workspace.setStatus(STOPPED); return; } InternalRuntime<?> internalRuntime; try { internalRuntime = getInternalRuntime(workspace.getId()); } catch (ServerException | InfrastructureException e) { workspace.setStatus(STOPPED); return; } workspace.setRuntime(asRuntime(internalRuntime)); workspace.setStatus(workspaceStatus); } }
Source:
<code>public CompositeMetricsCollector(MetricsCollector... collectors) { <START> this.collectors = new ArrayList<>(asList(collectors)); <END> }</code><technical_language>additional list creation (new ArrayList<>()) provide benefits compared following? java this.collectors = asList(collectors);</technical_language>

Target:
public CompositeMetricsCollector(MetricsCollector... collectors) { this.collectors = asList(collectors); }
Source:
<code>public JSONArray getData(String sensorID, double fromDate, String sessionID) throws IOException, JSONException { if(fromDate == 0 || sensorID == null || sensorID.isEmpty() ||sessionID == null || sessionID.isEmpty()) <START> throw new IOException("invalid input of date or or sensorID or sessionID"); <END> double currTime = System.currentTimeMillis() /1000; if(fromDate > currTime){ throw new IOException ("start date cannot be after current date"); } String params = "?per_page=1000&start_date=" + fromDate + "&end_date=" + currTime +"&sort=DESC"; System.out.println("prev:" + fromDate); System.out.println("curr:" + currTime); String urlAction = URL_SENSORS + "/" + sensorID + "/" + URL_DATA; return getListForURLAction(urlAction, params, "data", sessionID, 1000, "getData"); }</code><technical_language>@excaliburnan a more exception</technical_language>

Target:
public JSONArray getData(String sensorID, double fromDate, String sessionID) throws IllegalArgumentException, IOException { if(fromDate == 0 || sensorID == null || sensorID.isEmpty() ||sessionID == null || sessionID.isEmpty()) throw new IllegalArgumentException("invalid input of date or or sensorID or sessionID"); SNTP sntp = new SNTP(); double currTime = sntp.getTime() /1000; if(fromDate > currTime){ throw new IllegalArgumentException ("start date cannot be after current date"); } String params = "?per_page=1000&start_date=" + fromDate + "&end_date=" + currTime +"&sort=DESC"; String urlAction = URL_SENSORS + "/" + sensorID + "/" + URL_DATA; JSONArray dataList; try { dataList = getListForURLAction(urlAction, params, "data", sessionID, 1000, "getData"); }catch(JSONException js){ throw new IOException("Failed to get the list of data from the server"); } return dataList; }
Source:
<code>public void testPrepareView() throws Exception { model.setConditionPatterns(Collections.singletonList( new Pattern52() {{ setChildColumns(Collections.singletonList(new ConditionCol52())); }}) ); actionSetFieldsPage.prepareView(); verify(actionSetFieldsPageView).setAvailablePatterns(patternsCaptor.capture()); assertEquals(1, patternsCaptor.getValue().size()); <START> } <END></code><technical_language>worth checking pattern set is set in model</technical_language>

Target:
public void testPrepareView() throws Exception { final Pattern52 pattern = new Pattern52() {{ setFactType("Person"); setBoundName("p"); setChildColumns(Collections.singletonList(new ConditionCol52())); }}; model.setConditionPatterns(Collections.singletonList(pattern)); actionSetFieldsPage.prepareView(); verify(actionSetFieldsPageView).setAvailablePatterns(patternsCaptor.capture()); assertEquals(1, patternsCaptor.getValue().size()); assertEquals(pattern, patternsCaptor.getValue().get(0)); }
Source:
<code>public MarshalledEntryFactory getMarshalledEntryFactory() { <START> throw new UnsupportedOperationException("User InitializationContext::getMarshallableEntryFactory instead"); <END> }</code><technical_language>suggestion throw new UnsupportedOperationException("Use InitializationContext::getMarshallableEntryFactory instead");</technical_language>

Target:
public MarshalledEntryFactory getMarshalledEntryFactory() { throw new UnsupportedOperationException("Use InitializationContext::getMarshallableEntryFactory instead"); }
Source:
<code><START> private Map<Pair<Guid, Guid>, Double> storageResourceMapForConsume() { <END> Map<Pair<Guid, Guid>, Double> quotaForStorageConsumeMap = new HashMap<Pair<Guid, Guid>, Double>(); for (DiskImage diskImage : mImages) { Pair<Guid, Guid> quotaDomainKey = new Pair<Guid, Guid>(diskImage.getQuotaId(), diskImage.getstorage_id().getValue()); Double quotaConsumeValue = quotaForStorageConsumeMap.get(quotaDomainKey); if (quotaConsumeValue != null) { quotaConsumeValue += getVm().getActualDiskWithSnapshotsSize(); } else { quotaForStorageConsumeMap.put(quotaDomainKey, 0d); } } return quotaForStorageConsumeMap; }</code><technical_language>please check if duplicate method in quota helper</technical_language>

Target:
private Map<Pair<Guid, Guid>, Double> storageResourceMapForConsume() { Map<Pair<Guid, Guid>, Double> quotaForStorageConsumeMap = new HashMap<Pair<Guid, Guid>, Double>(); for (DiskImage diskImage : mImages) { Pair<Guid, Guid> quotaDomainKey = new Pair<Guid, Guid>(diskImage.getQuotaId(), diskImage.getstorage_ids().get(0).getValue()); Double quotaConsumeValue = quotaForStorageConsumeMap.get(quotaDomainKey); if (quotaConsumeValue != null) { quotaConsumeValue += getVm().getActualDiskWithSnapshotsSize(); } else { quotaForStorageConsumeMap.put(quotaDomainKey, 0d); } } return quotaForStorageConsumeMap; }
Source:
<code>private void notifyClient() { synchronized (instanceLock) { if (stopped) { return; } } synchronized (instanceLock) { final List<Endpoint> newEndpoints = getNewEndpoints(); final Map<String, Endpoint> newEndpointsByName = new HashMap<String, Endpoint>(); <START> for (Endpoint endpoint : newEndpoints) { <END> newEndpointsByName.put(getEndpointKey(endpoint), endpoint); } Iterator<Map.Entry<String, Endpoint>> it = clientPicture.entrySet().iterator(); while (it.hasNext()) { final Map.Entry<String, Endpoint> endpointEntry = it.next(); final String key = endpointEntry.getKey(); if (! newEndpointsByName.containsKey(key)) { it.remove(); clientCallback.endpointEvent( Resolver.ResolverListener.Event.REMOVED_ENDPOINT, endpointEntry.getValue()); } } for (final Endpoint endpoint : newEndpoints) { String key = getEndpointKey(endpoint); if (! clientPicture.containsKey(key)) { clientCallback.endpointEvent( Resolver.ResolverListener.Event.NEW_ENDPOINT, endpoint); clientPicture.put(key, endpoint); } else { if (! clientPicture.get(key).equals(endpoint)) { clientCallback.endpointEvent( Resolver.ResolverListener.Event.REMOVED_ENDPOINT, clientPicture.get(key)); clientCallback.endpointEvent( Resolver.ResolverListener.Event.NEW_ENDPOINT, endpoint); clientPicture.put(key, endpoint); } } } } }</code><technical_language>put finals declarations for well</technical_language>

Target:
private void notifyClient() { synchronized (instanceLock) { if (stopped) { return; } final List<Endpoint> newEndpoints = getNewEndpoints(); final Map<String, Endpoint> newEndpointsByName = new HashMap<String, Endpoint>(); for (final Endpoint endpoint : newEndpoints) { newEndpointsByName.put(getEndpointKey(endpoint), endpoint); } Iterator<Map.Entry<String, Endpoint>> it = clientPicture.entrySet().iterator(); while (it.hasNext()) { final Map.Entry<String, Endpoint> endpointEntry = it.next(); final String key = endpointEntry.getKey(); if (! newEndpointsByName.containsKey(key)) { it.remove(); clientCallback.endpointEvent( Resolver.ResolverListener.Event.REMOVED_ENDPOINT, endpointEntry.getValue()); } } for (final Endpoint endpoint : newEndpoints) { String key = getEndpointKey(endpoint); if (! clientPicture.containsKey(key)) { clientCallback.endpointEvent( Resolver.ResolverListener.Event.NEW_ENDPOINT, endpoint); clientPicture.put(key, endpoint); } else { if (! clientPicture.get(key).equals(endpoint)) { clientCallback.endpointEvent( Resolver.ResolverListener.Event.REMOVED_ENDPOINT, clientPicture.get(key)); clientCallback.endpointEvent( Resolver.ResolverListener.Event.NEW_ENDPOINT, endpoint); clientPicture.put(key, endpoint); } } } } }
Source:
<code>private OnlineOptions(Data data) { if (data.protocol == null && System.getProperty(CREAPER_WILDFLY) != null) { if (data.sslOptions == null) { data.protocol = ManagementProtocol.HTTP_REMOTING; } else { data.protocol = ManagementProtocol.HTTPS_REMOTING; } } if (data.localDefault) { data.host = "localhost"; if (data.protocol == ManagementProtocol.HTTP_REMOTING || data.protocol == ManagementProtocol.HTTP) { data.port = 9990; } else if (data.protocol == ManagementProtocol.HTTPS_REMOTING <START> || data.protocol == ManagementProtocol.HTTPS) { <END> data.port = 9993; } else { data.port = 9999; } } this.isStandalone = data.isStandalone; this.isDomain = data.isDomain; this.defaultProfile = data.defaultProfile; this.defaultHost = data.defaultHost; this.host = data.host; this.port = data.port; this.protocol = data.protocol; this.connectionTimeout = data.connectionTimeout; this.bootTimeout = data.bootTimeout; this.username = data.username; this.password = data.password; this.localAuthDisabled = data.localAuthDisabled; this.sslOptions = data.sslOptions; this.wrappedModelControllerClient = data.wrappedModelControllerClient; this.isWrappedClient = data.wrappedModelControllerClient != null; }</code><technical_language>following? } else if (data.protocol == ManagementProtocol.HTTPS_REMOTING || (data.protocol == ManagementProtocol.HTTPS && System.getProperty(CREAPER_WILDFLY) != null)) { data.port = 9993; } else if (data.protocol == ManagementProtocol.HTTPS && System.getProperty(CREAPER_WILDFLY) == null)) { data.port = 9443; } else {</technical_language>

Target:
private OnlineOptions(Data data) { if (data.protocol == null && System.getProperty(CREAPER_WILDFLY) != null) { if (data.sslOptions == null) { data.protocol = ManagementProtocol.HTTP_REMOTING; } else { data.protocol = ManagementProtocol.HTTPS_REMOTING; } } if (data.localDefault) { data.host = "localhost"; if (data.protocol == ManagementProtocol.HTTP_REMOTING || data.protocol == ManagementProtocol.HTTP) { data.port = 9990; } else if (data.protocol == ManagementProtocol.HTTPS_REMOTING) { data.port = 9993; } else { data.port = 9999; } } this.isStandalone = data.isStandalone; this.isDomain = data.isDomain; this.defaultProfile = data.defaultProfile; this.defaultHost = data.defaultHost; this.host = data.host; this.port = data.port; this.protocol = data.protocol; this.connectionTimeout = data.connectionTimeout; this.bootTimeout = data.bootTimeout; this.username = data.username; this.password = data.password; this.localAuthDisabled = data.localAuthDisabled; this.sslOptions = data.sslOptions; this.wrappedModelControllerClient = data.wrappedModelControllerClient; this.isWrappedClient = data.wrappedModelControllerClient != null; }
Source:
<code>public void init(FilterConfig filterConfig) throws ServletException { showGitBlitBanner(); try { InputStream resin = getClass().getResourceAsStream(GITBLIT_GERRIT_PROPERTIES); Properties properties = null; try { properties = new Properties(); properties.load(resin); properties.put("git.repositoriesFolder", repoManager.getBasePath() .getAbsolutePath()); properties.put("realm.userService", GerritToGitBlitUserService.class.getName()); properties.put("web.otherUrls", <START> (config.getGitHttpUrl() + " " + config.getGitSshUrl()).trim() + " " + properties.get("web.otherUrls")); <END> } finally { resin.close(); } IStoredSettings settings = new GitBlitSettings(properties); GitBlit.self().configureContext(settings, repoManager.getBasePath(), false); GitBlit.self().contextInitialized( new ServletContextEvent(filterConfig.getServletContext())); super.init(new CustomFilterConfig(filterConfig)); } catch (Exception e) { throw new ServletException(e); } }</code><technical_language>NPE web.otherUrls is in gitblit.properties. (properties.get("web.otherUrls") null)</technical_language>

Target:
public void init(FilterConfig filterConfig) throws ServletException { showGitBlitBanner(); try { InputStream resin = getClass().getResourceAsStream(GITBLIT_GERRIT_PROPERTIES); Properties properties = null; try { properties = new Properties(); properties.load(resin); properties.put("git.repositoriesFolder", repoManager.getBasePath() .getAbsolutePath()); properties.put("realm.userService", GerritToGitBlitUserService.class.getName()); if (properties.get("web.otherUrls") != null) { properties.put("web.otherUrls", (config.getGitHttpUrl() + " " + config.getGitSshUrl()).trim() + " " + properties.get("web.otherUrls")); } else { properties.put("web.otherUrls", (config.getGitHttpUrl() + " " + config.getGitSshUrl()).trim()); } } finally { resin.close(); } IStoredSettings settings = new GitBlitSettings(properties); GitBlit.self().configureContext(settings, repoManager.getBasePath(), false); GitBlit.self().contextInitialized( new ServletContextEvent(filterConfig.getServletContext())); super.init(new CustomFilterConfig(filterConfig)); } catch (Exception e) { throw new ServletException(e); } }
Source:
<code>public static boolean isJSONValid(String jsonInString) { JsonParser parser = new JsonParser(); try { parser.parse(jsonInString); return true; <START> } catch (com.google.gson.JsonSyntaxException ex) { <END> return false; } }</code><technical_language>Import this</technical_language>

Target:
public static boolean isJSONValid(String jsonInString) { try { JSON_PARSER.parse(jsonInString); return true; } catch (JsonSyntaxException ex) { return false; } }
Source:
<code>public void beforeChannel(@NonNull JnlpConnectionState event) { DefaultJnlpSlaveReceiver.State state = event.getStash(DefaultJnlpSlaveReceiver.State.class); final SlaveComputer computer = state.getNode(); final OutputStream log = computer.openLogFile(); state.setLog(log); try (PrintWriter logw = new PrintWriter(log, true)) { logw.println("Inbound agent connected from " + event.getSocket().getInetAddress()); <START> } <END> for (ChannelConfigurator cc : ChannelConfigurator.all()) { cc.onChannelBuilding(event.getChannelBuilder(), computer); } event.getChannelBuilder().withHeaderStream(log); String cookie = event.getProperty(JnlpConnectionState.COOKIE_KEY); if (cookie != null) { event.getChannelBuilder().withProperty(COOKIE_NAME, cookie); } }</code><technical_language>AFAICT close log, is supposed happen</technical_language>

Target:
public void beforeChannel(@NonNull JnlpConnectionState event) { DefaultJnlpSlaveReceiver.State state = event.getStash(DefaultJnlpSlaveReceiver.State.class); final SlaveComputer computer = state.getNode(); final OutputStream log = computer.openLogFile(); state.setLog(log); PrintWriter logw = new PrintWriter(log, true); logw.println("Inbound agent connected from " + event.getSocket().getInetAddress()); for (ChannelConfigurator cc : ChannelConfigurator.all()) { cc.onChannelBuilding(event.getChannelBuilder(), computer); } event.getChannelBuilder().withHeaderStream(log); String cookie = event.getProperty(JnlpConnectionState.COOKIE_KEY); if (cookie != null) { event.getChannelBuilder().withProperty(COOKIE_NAME, cookie); } }
Source:
<code>protected void changeCacheGroupKeyLocal(int[] grpIds, byte[] keyIds, byte[][] keys) throws IgniteCheckedException { Map<Integer, Byte> encryptionStatus = U.newHashMap(grpIds.length); for (int i = 0; i < grpIds.length; i++) encryptionStatus.put(grpIds[i], keyIds[i]); WALPointer ptr = ctx.cache().context().wal().log(new ReencryptionStatusRecord(encryptionStatus)); if (ptr != null) ctx.cache().context().wal().flush(ptr, false); for (int i = 0; i < grpIds.length; i++) { int grpId = grpIds[i]; CacheGroupContext grp = ctx.cache().cacheGroup(grpId); if (grp == null) continue; GroupKeyEncrypted key = new GroupKeyEncrypted(keyIds[i] & 0xff, keys[i]); synchronized (metaStorageMux) { grpKeys.addKey(grpId, key); writeToMetaStore(grpId, true, false); GroupKey prevGrpKey = grpKeys.changeActiveKey(grpId, key); assert prevGrpKey != null && prevGrpKey.id() != key.id() : "prev=" + prevGrpKey + ", currId=" + key.id(); grpKeys.reserveWalKey(grpId, prevGrpKey.unsignedId(), ctx.cache().context().wal().currentSegment()); writeToMetaStore(grpId, true, true); } reencryptGroups.put(grpId, pageScanner.pagesCount(grp)); if (log.isInfoEnabled()) log.info("New encryption key for group was added [grpId=" + grpId + ", keyId=" + key.id() + "]"); } <START> <END> startReencryption(encryptionStatus.keySet()); }</code><technical_language>This future finished, do need unfinished future here</technical_language>

Target:
protected void changeCacheGroupKeyLocal(int[] grpIds, byte[] keyIds, byte[][] keys) throws IgniteCheckedException { Map<Integer, Byte> encryptionStatus = U.newHashMap(grpIds.length); for (int i = 0; i < grpIds.length; i++) encryptionStatus.put(grpIds[i], keyIds[i]); WALPointer ptr = ctx.cache().context().wal().log(new ReencryptionStartRecord(encryptionStatus)); if (ptr != null) ctx.cache().context().wal().flush(ptr, false); for (int i = 0; i < grpIds.length; i++) { int grpId = grpIds[i]; int newKeyId = keyIds[i] & 0xff; withMasterKeyChangeReadLock(() -> { synchronized (metaStorageMux) { GroupKey prevGrpKey = grpKeys.changeActiveKey(grpId, newKeyId); writeGroupKeysToMetaStore(grpId, grpKeys.getAll(grpId)); if (ptr == null) return null; grpKeys.reserveWalKey(grpId, prevGrpKey.unsignedId(), ctx.cache().context().wal().currentSegment()); writeTrackedWalIdxsToMetaStore(); } return null; }); CacheGroupContext grp = ctx.cache().cacheGroup(grpId); if (grp != null && grp.affinityNode()) reencryptGroups.put(grpId, pageScanner.pagesCount(grp)); if (log.isInfoEnabled()) log.info("New encryption key for group was added [grpId=" + grpId + ", keyId=" + newKeyId + "]"); } startReencryption(encryptionStatus.keySet()); }
Source:
<code>public List<Report> getReports() { <START> return new ArrayList<Report>(this.reports.values()); <END> }</code><technical_language>reason return type Collection<Report> here, return reports.values()</technical_language>

Target:
public Collection<Report> getReports() { return this.reports.values(); }
Source:
<code>public void getDescription_NoAnnotations() throws NoSuchMethodException { <START> String actualResult = getDescriptionWithMethodNameAndParamIndex(TEST_METHOD_10, FIRST_INDEX); <END> assertEquals(PARAMETER_INFO_DESCRIPTION, actualResult); }</code><technical_language>Abbreviation for variable name: Result -> res. abbreviation rules</technical_language>

Target:
public void getDescription_NoAnnotations() throws NoSuchMethodException { String actualRes = getDescriptionWithMethodNameAndParamIndex(TEST_METHOD_10, FIRST_INDEX); assertEquals(PARAMETER_INFO_DESCRIPTION, actualRes); }
Source:
<code>void verifyClosureExpressionBraceStyle(ClosureExpressionContext ctx) { ParseTree left = ParseTreeUtil.getLeftNode(ctx); if (left == null) { return; } Location leftLocation; if (left instanceof TerminalNodeImpl) { Token leftToken = ((TerminalNodeImpl) left).getSymbol(); leftLocation = ListenerUtil.getTokenLocation(leftToken); } else { ParserRuleContext leftContext = (ParserRuleContext) left; leftLocation = ListenerUtil.getContextStopLocation(leftContext); <START> } <END> verifyCodeBlockOpenBraceIsInline(ctx, leftLocation, Messages.CLOSURE); ParseTree leftSibling = ParseTreeUtil.getLeftSibling(ctx); if (leftSibling != null && (leftSibling instanceof ParenthesizedExpressionContext || leftSibling instanceof PostfixExpressionContext)) { Token leftToken = ((ParserRuleContext) leftSibling).getStop(); verifySingleSpaceBeforeOpenBrace(ctx, leftToken); } }</code><technical_language>a util method return location of a node great. util method worry node type (token, context)</technical_language>

Target:
void verifyClosureExpressionBraceStyle(ClosureExpressionContext ctx) { ParseTree left = ParseTreeUtil.getLeftNode(ctx); if (left == null) { return; } Location leftLocation = ListenerUtil.getTokenLocation(ParseTreeUtil.getStopTokenForNode(left)); verifyCodeBlockOpenBraceIsInline(ctx, leftLocation, Messages.CLOSURE); ParseTree leftSibling = ParseTreeUtil.getLeftSibling(ctx); if (leftSibling != null && (leftSibling instanceof ParenthesizedExpressionContext || leftSibling instanceof PostfixExpressionContext)) { Token leftToken = ((ParserRuleContext) leftSibling).getStop(); verifySingleSpaceBeforeOpenBrace(ctx, leftToken); } }
Source:
<code>public Task<Entity> newTask() { return TaskBuilder.<Entity>builder().name("component("+componentId+")").body(new Callable<Entity>() { @Override public Entity call() throws Exception { <START> if (scope == Scope.THIS) <END> return entity(); if (scope == Scope.PARENT) return entity().getParent(); Iterable<Entity> entitiesToSearch = null; if (scope == Scope.GLOBAL) entitiesToSearch = ((EntityManagerInternal)entity().getManagementContext().getEntityManager()) .getAllEntitiesInApplication( entity().getApplication() ); if (scope == Scope.DESCENDANT) { entitiesToSearch = Sets.newHashSet(); addDescendants(entity(), (Set<Entity>)entitiesToSearch); } if (scope == Scope.SIBLING) { entitiesToSearch = entity().getParent().getChildren(); } if (scope == Scope.CHILD) entitiesToSearch = entity().getChildren(); Optional<Entity> result = Iterables.tryFind(entitiesToSearch, new Predicate<Entity>() { @Override public boolean apply(Entity input) { return componentId.equals(input.getConfig(BrooklynCampConstants.PLAN_ID)); } }); if (result.isPresent()) return result.get(); throw new NoSuchElementException("No entity matching id " + componentId); } }).build(); }</code><technical_language>switch statement for enum is nicer</technical_language>

Target:
public Task<Entity> newTask() { return TaskBuilder.<Entity>builder().name("component("+componentId+")").body(new Callable<Entity>() { @Override public Entity call() throws Exception { Iterable<Entity> entitiesToSearch = null; switch (scope) { case THIS: return entity(); case PARENT: return entity().getParent(); case GLOBAL: entitiesToSearch = ((EntityManagerInternal)entity().getManagementContext().getEntityManager()) .getAllEntitiesInApplication( entity().getApplication() ); break; case DESCENDANT: entitiesToSearch = Sets.newLinkedHashSet(); addDescendants(entity(), (Set<Entity>)entitiesToSearch); break; case SIBLING: entitiesToSearch = entity().getParent().getChildren(); break; case CHILD: entitiesToSearch = entity().getChildren(); } Optional<Entity> result = Iterables.tryFind(entitiesToSearch, EntityPredicates.configEqualTo(BrooklynCampConstants.PLAN_ID, componentId)); if (result.isPresent()) return result.get(); throw new NoSuchElementException("No entity matching id " + componentId); } }).build(); }
Source:
<code>public void initialize() { viewModel = new CustomizeExternalFileTypesViewModel(); fileTypesTable.setItems(viewModel.getFileTypes()); fileTypesTableIconColumn.setCellValueFactory(data -> BindingsHelper.constantOf(data.getValue().getIcon())); fileTypesTableNameColumn.setCellValueFactory(data -> BindingsHelper.constantOf(data.getValue().getName())); fileTypesTableExtensionColumn.setCellValueFactory(data -> BindingsHelper.constantOf(data.getValue().getExtension())); fileTypesTableTypeColumn.setCellValueFactory(data -> BindingsHelper.constantOf(data.getValue().getMimeType())); fileTypesTableApplicationColumn.setCellValueFactory(data -> BindingsHelper.constantOf(data.getValue().getOpenWithApplication())); fileTypesTableEditColumn.setCellValueFactory(data -> BindingsHelper.constantOf(true)); fileTypesTableDeleteColumn.setCellValueFactory(data -> BindingsHelper.constantOf(true)); new ValueTableCellFactory<ExternalFileType, JabRefIcon>() .withGraphic(JabRefIcon::getGraphicNode) .install(fileTypesTableIconColumn); new ValueTableCellFactory<ExternalFileType, Boolean>() .withGraphic(none -> IconTheme.JabRefIcons.EDIT.getGraphicNode()) <START> .withOnMouseClickedEvent((type, none) -> event -> viewModel.edit(type, false)) <END> .install(fileTypesTableEditColumn); new ValueTableCellFactory<ExternalFileType, Boolean>() .withGraphic(none -> IconTheme.JabRefIcons.REMOVE.getGraphicNode()) .withOnMouseClickedEvent((type, none) -> event -> viewModel.remove(type)) .install(fileTypesTableDeleteColumn); }</code><technical_language>indent</technical_language>

Target:
public void initialize() { viewModel = new CustomizeExternalFileTypesViewModel(); fileTypesTable.setItems(viewModel.getFileTypes()); fileTypesTableIconColumn.setCellValueFactory(data -> BindingsHelper.constantOf(data.getValue().getIcon())); fileTypesTableNameColumn.setCellValueFactory(data -> BindingsHelper.constantOf(data.getValue().getName())); fileTypesTableExtensionColumn.setCellValueFactory(data -> BindingsHelper.constantOf(data.getValue().getExtension())); fileTypesTableTypeColumn.setCellValueFactory(data -> BindingsHelper.constantOf(data.getValue().getMimeType())); fileTypesTableApplicationColumn.setCellValueFactory(data -> BindingsHelper.constantOf(data.getValue().getOpenWithApplication())); fileTypesTableEditColumn.setCellValueFactory(data -> BindingsHelper.constantOf(true)); fileTypesTableDeleteColumn.setCellValueFactory(data -> BindingsHelper.constantOf(true)); new ValueTableCellFactory<ExternalFileType, JabRefIcon>() .withGraphic(JabRefIcon::getGraphicNode) .install(fileTypesTableIconColumn); new ValueTableCellFactory<ExternalFileType, Boolean>() .withGraphic(none -> IconTheme.JabRefIcons.EDIT.getGraphicNode()) .withOnMouseClickedEvent((type, none) -> event -> viewModel.edit(type)) .install(fileTypesTableEditColumn); new ValueTableCellFactory<ExternalFileType, Boolean>() .withGraphic(none -> IconTheme.JabRefIcons.REMOVE.getGraphicNode()) .withOnMouseClickedEvent((type, none) -> event -> viewModel.remove(type)) .install(fileTypesTableDeleteColumn); }