auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void objectOrder(DistinctQueryType queryType) { String resource1 = String.format("{ " + "\"id\": \"12345\", " + "\"mypk\": \"abcde\"" + "} "); String resource2 = String.format("{ " + "\"mypk\": \"abcde\"," + "\"id\": \"12345\"" + "} "); DistinctMap distinctMap = DistinctMap.create(queryType, null); Utils.ValueHolder<String> outHash = new Utils.ValueHolder<>(); boolean add = distinctMap.add(resource1, outHash); assertThat(add).as("Value should be added first time").isTrue(); boolean add2 = distinctMap.add(resource2, outHash); assertThat(add2).as("Order of objects in map should be treated same").isTrue(); }

Target:
public void objectOrder(DistinctQueryType queryType) { String resource1 = String.format("{ " + "\"id\": \"12345\"," + "\"mypk\": \"abcde\"" + "} "); String resource2 = String.format("{ " + "\"mypk\": \"abcde\"," + "\"id\": \"12345\"" + "} "); Document resource = new Document(resource1); DistinctMap distinctMap = DistinctMap.create(queryType, null); Utils.ValueHolder<String> outHash = new Utils.ValueHolder<>(); boolean add = distinctMap.add(resource, outHash); assertThat(add).as("Value should be added first time").isTrue(); resource = new Document(resource2); boolean add2 = distinctMap.add(resource, outHash); assertThat(add2).as("Order of objects in map should be treated same").isFalse(); }
Source:
public boolean isInstalled(IProgressMonitor progress) throws Exception { boolean isInstalled = false; List<GAV> installedGavs = TaCoKitUtil.getInstalledComponents(progress); if (installedGavs != null && !installedGavs.isEmpty()) { TaCoKitUtil.checkMonitor(progress); List<GAV> newComponents = getCar().getComponents(); if (newComponents != null) { List<GAV> installedComponents = new ArrayList<>(); for (GAV newComponent : newComponents) { TaCoKitUtil.checkMonitor(progress); boolean alreadyInstalled = false; for (GAV installedGav : installedGavs) { TaCoKitUtil.checkMonitor(progress); if (alreadyInstalled) { break; } try { if (StringUtils.equals(installedGav.getGroupId() + ":" + installedGav.getArtifactId(), newComponent.getGroupId() + ":" + newComponent.getArtifactId())) { String installedVersionString = installedGav.getVersion().split("-")[0]; String newVersionString = newComponent.getVersion().split("-")[0]; String[] installedVersion = installedVersionString.split("\\."); String[] newVersion = newVersionString.split("\\."); alreadyInstalled = true; for (int i = 0; i < newVersion.length; ++i) { if (installedVersion.length - 1 < i) { alreadyInstalled = false; break; } int iVersion = Integer.valueOf(installedVersion[i]); int nVersion = Integer.valueOf(newVersion[i]); if (iVersion < nVersion) { alreadyInstalled = false; break; } } } } catch (Exception e) { alreadyInstalled = true; ExceptionHandler.process(e); } } if (alreadyInstalled) { installedComponents.add(newComponent); } } if (installedComponents.size() < newComponents.size()) { isInstalled = false; } else { isInstalled = true; } } } return isInstalled; }

Target:
public boolean isInstalled(IProgressMonitor progress) throws Exception { boolean isInstalled = false; List<GAV> installedComponents = TaCoKitUtil.getInstalledComponents(progress); if (installedComponents != null && !installedComponents.isEmpty()) { TaCoKitUtil.checkMonitor(progress); List<GAV> newComponents = getCar().getComponents(); if (newComponents != null) { Map<GAV, GAV> alreadyInstalledComponentMap = filterAlreadyInstalledComponent(installedComponents, newComponents, progress); if (alreadyInstalledComponentMap.size() < newComponents.size()) { isInstalled = false; } else { if (CommonsPlugin.isHeadless()) { } else { } isInstalled = true; } } } return isInstalled; }
Source:
public static void removePref(Context context, String prefKey){ SharedPreferences prefs = getPrefs(context); if (!prefs.contains(prefKey)){ return; } SharedPreferences.Editor editor = prefs.edit(); editor.remove(prefKey); editor.commit(); }

Target:
public static void removePref(Context context, String prefKey){ SharedPreferences prefs = getPrefs(context); if (!prefs.contains(prefKey)){ return; } SharedPreferences.Editor editor = prefs.edit(); editor.remove(prefKey); editor.apply(); }
Source:
static void assertDerivedFrom(RevCommit derived, RevCommit original) { assertThat(derived, not(equalTo(original))); assertEquals(derived.getFullMessage(), original.getFullMessage()); }

Target:
static void assertDerivedFrom(RevCommit derived, RevCommit original) { assertThat(derived, not(equalTo(original))); assertEquals(original.getFullMessage(), derived.getFullMessage()); }
Source:
public void testNoDuplicatesCanBeInserted() throws Exception { String dbCollectionGenesName = variantJobsArgs.getPipelineOptions().getString("db.collections.features.name"); JobExecution jobExecution = jobLauncherTestUtils.launchStep(InitDBConfiguration.CREATE_DATABASE_INDEXES); assertEquals(ExitStatus.COMPLETED, jobExecution.getExitStatus()); assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus()); MongoClient mongoClient = new MongoClient(); DBCollection genesCollection = mongoClient.getDB(dbName).getCollection(dbCollectionGenesName); genesCollection.insert(new BasicDBObject("_id", "example_id")); genesCollection.insert(new BasicDBObject("_id", "example_id")); }

Target:
public void testNoDuplicatesCanBeInserted() throws Exception { String dbCollectionGenesName = variantJobsArgs.getDbCollectionsFeaturesName(); JobExecution jobExecution = jobLauncherTestUtils.launchStep(InitDBConfiguration.CREATE_DATABASE_INDEXES); assertEquals(ExitStatus.COMPLETED, jobExecution.getExitStatus()); assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus()); MongoClient mongoClient = new MongoClient(); DBCollection genesCollection = mongoClient.getDB(dbName).getCollection(dbCollectionGenesName); genesCollection.insert(new BasicDBObject("_id", "example_id")); genesCollection.insert(new BasicDBObject("_id", "example_id")); }
Source:
public boolean getFileFromServer(String path, Bundle params, OutputStream fos) { byte[] bf = new byte[1024]; int current = 0; try { if (params != null) { StringBuilder sb = new StringBuilder(); boolean first = true; for (String key : params.keySet()) { if (first){ first = false; } else { sb.append("&"); } sb.append(URLEncoder.encode(key) + "=" + URLEncoder.encode(params.getString(key))); } path = path + "?" + sb.toString(); } URL url = new URL(path); HttpURLConnection connect = (HttpURLConnection)url.openConnection(); connect.setDoInput(true); connect.setConnectTimeout(5 * 1000); connect.setReadTimeout(30 * 1000); int code = connect.getResponseCode(); if (code == HttpURLConnection.HTTP_OK) { InputStream is = connect.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); while((current = bis.read(bf)) != -1){ fos.write(bf, 0, current); } bis.close(); fos.close(); connect.disconnect(); } return true; } catch (MalformedURLException e) { e.printStackTrace(); return false; } catch (IOException e) { e.printStackTrace(); return false; } }

Target:
public static boolean getFileFromServer(String path, Bundle params, OutputStream fos) { byte[] bf = new byte[FILE_BUFFER_SIZE]; int current = 0; InputStream is = null; HttpURLConnection connect = null; BufferedInputStream bis = null; try { if (params != null) { StringBuilder sb = new StringBuilder(); boolean first = true; for (String key : params.keySet()) { if (first){ first = false; } else { sb.append("&"); } sb.append(URLEncoder.encode(key) + "=" + URLEncoder.encode(params.getString(key))); } path = path + "?" + sb.toString(); } URL url = new URL(path); connect = (HttpURLConnection)url.openConnection(); connect.setDoInput(true); connect.setConnectTimeout(CONNECTION_TIME_OUT); connect.setReadTimeout(SOCKET_TIME_OUT); int code = connect.getResponseCode(); if (code == HttpURLConnection.HTTP_OK) { is = connect.getInputStream(); bis = new BufferedInputStream(is); while((current = bis.read(bf)) != FILE_END){ fos.write(bf, 0, current); } } return true; } catch (MalformedURLException e) { LogUtils.logD(e.getMessage()); return false; } catch (IOException e) { LogUtils.logD(e.getMessage()); return false; } catch (Exception e) { LogUtils.logD(e.getMessage()); return false; } finally { try{ if (is != null) { is.close(); } if (fos != null) { fos.close(); } if (connect != null) { connect.disconnect(); } if (bis != null) { bis.close(); } } catch (Exception e){ LogUtils.logD(e.getMessage()); } } }
Source:
public void testRebalanceResultOutputMemberCount() { server3 = cluster.startServerVM(3, "localhost", locator.getPort()); server3.invoke(() -> { Cache cache = ClusterStartupRule.getCache(); RegionFactory<Integer, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.PARTITION); Region region = dataRegionFactory.create("region-1"); for (int i = 0; i < 100; i++) { region.put("key" + (i + 400), "value" + (i + 400)); } }); locator.waitUntilRegionIsReadyOnExactlyThisManyServers("/region-1", 3); Map<String, List<String>> listMembersResult = gfsh.executeAndAssertThat("list members") .hasTableSection().getActual().getContent(); assertThat(listMembersResult.get("Name").size()).isEqualTo(4); server3.forceDisconnect(); Map<String, List<String>> rebalanceResult = gfsh.executeAndAssertThat("rebalance") .statusIsSuccess().hasTableSection().getActual().getContent(); server3.waitTilFullyReconnected(); listMembersResult = gfsh.executeAndAssertThat("list members") .hasTableSection().getActual().getContent(); assertThat(listMembersResult.get("Name").size()).isEqualTo(4); assertThat(rebalanceResult.get("Rebalanced Stats").get(9)) .isEqualTo("Total number of members in system on which rebalance is executed"); assertThat(rebalanceResult.get("Value").get(9)).isEqualTo("2"); }

Target:
public void testRebalanceResultOutputMemberCount() { server3 = cluster.startServerVM(3, "localhost", locator.getPort()); server3.invoke(() -> { Cache cache = ClusterStartupRule.getCache(); RegionFactory<Integer, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.PARTITION); Region region = dataRegionFactory.create("region-1"); for (int i = 0; i < 100; i++) { region.put("key" + (i + 400), "value" + (i + 400)); } }); locator.waitUntilRegionIsReadyOnExactlyThisManyServers("/region-1", 3); Map<String, List<String>> listMembersResult = gfsh.executeAndAssertThat("list members") .hasTableSection().getActual().getContent(); assertThat(listMembersResult.get("Name").size()).isEqualTo(4); server3.forceDisconnect(); Map<String, List<String>> rebalanceResult = gfsh.executeAndAssertThat("rebalance") .statusIsSuccess().hasTableSection().getActual().getContent(); server3.waitTilFullyReconnected(); listMembersResult = gfsh.executeAndAssertThat("list members") .hasTableSection().getActual().getContent(); assertThat(listMembersResult.get("Name").size()).isEqualTo(4); assertThat(rebalanceResult.get("Rebalanced Stats").get(9)) .isEqualTo(CliStrings.REBALANCE__MSG__MEMBER_COUNT); assertThat(rebalanceResult.get("Value").get(9)).isEqualTo("2"); }
Source:
private List<Member> removeIndirectMembers(PerunSession sess, Group group, List<Member> members, int sourceGroupId) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, NotGroupMemberException { List<Member> membersToRemove = new ArrayList<>(members); lockGroupMembership(group, membersToRemove); for (Member member: membersToRemove) { member.setSourceGroupId(sourceGroupId); groupsManagerImpl.removeMember(sess, group, member); addMemberToGroupsFromTriggerAttribute(sess, group, member); } List<Member> newMembers = this.getGroupMembers(sess, group); membersToRemove.removeAll(newMembers); for(Member removedIndirectMember: membersToRemove) { notifyMemberRemovalFromGroup(sess, group, removedIndirectMember); getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, removedIndirectMember, group); getPerunBl().getAuditer().log(sess, new IndirectMemberRemovedFromGroup(removedIndirectMember, group)); } return membersToRemove; }

Target:
private List<Member> removeIndirectMembers(PerunSession sess, Group group, List<Member> members, int sourceGroupId) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, NotGroupMemberException { List<Member> membersToRemove = new ArrayList<>(members); lockGroupMembership(group, membersToRemove); for (Member member: membersToRemove) { member.setSourceGroupId(sourceGroupId); groupsManagerImpl.removeMember(sess, group, member); } List<Member> newMembers = this.getGroupMembers(sess, group); membersToRemove.removeAll(newMembers); for(Member removedIndirectMember: membersToRemove) { addMemberToGroupsFromTriggerAttribute(sess, group, removedIndirectMember); notifyMemberRemovalFromGroup(sess, group, removedIndirectMember); getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, removedIndirectMember, group); getPerunBl().getAuditer().log(sess, new IndirectMemberRemovedFromGroup(removedIndirectMember, group)); } return membersToRemove; }
Source:
protected void purgeAttachments(SQLDatabase db) { Set<String> currentKeys = new HashSet<String>(); Cursor c = null; try { db.delete("attachments", "sequence IN " + "(SELECT sequence from revs WHERE json IS null)", null); c = db.rawQuery(SQL_ATTACHMENTS_SELECT_ALL_KEYS, null); while (c.moveToNext()) { byte[] key = c.getBlob(0); currentKeys.add(keyToString(key)); } c.close(); } catch (SQLException e) { logger.log(Level.SEVERE, "SQL exception in purgeAttachments when updating attachments table", e); return; } finally { DatabaseUtils.closeCursorQuietly(c); } try { File attachments = new File(attachmentsDir); c = db.rawQuery(SQL_ATTACHMENTS_SELECT_KEYS_FILENAMES, null); while (c.moveToNext()) { String keyForFile = c.getString(0); if (!currentKeys.contains(keyForFile)) { File f = new File(attachments, c.getString(1)); try { boolean deleted = f.delete(); if (deleted) { db.delete(ATTACHMENTS_KEY_FILENAME, "key = ?", new String[]{keyForFile}); } else { logger.warning("Could not delete file from BLOB store: " + f.getAbsolutePath()); } } catch (SecurityException e) { String msg = String.format("SecurityException deleting %s from blob store", f.getAbsolutePath()); logger.log(Level.WARNING, msg, e); } } } c.close(); } catch (SQLException e) { logger.log(Level.SEVERE, "SQL exception in purgeAttachments when removing redundant attachments", e); } finally { DatabaseUtils.closeCursorQuietly(c); } }

Target:
protected void purgeAttachments(SQLDatabase db) { Set<String> currentKeys = new HashSet<String>(); Cursor c = null; try { db.delete("attachments", "sequence IN " + "(SELECT sequence from revs WHERE json IS null)", null); c = db.rawQuery(SQL_ATTACHMENTS_SELECT_ALL_KEYS, null); while (c.moveToNext()) { byte[] key = c.getBlob(0); currentKeys.add(keyToString(key)); } } catch (SQLException e) { logger.log(Level.SEVERE, "SQL exception in purgeAttachments when updating attachments table", e); return; } finally { DatabaseUtils.closeCursorQuietly(c); } try { File attachments = new File(attachmentsDir); c = db.rawQuery(SQL_ATTACHMENTS_SELECT_KEYS_FILENAMES, null); while (c.moveToNext()) { String keyForFile = c.getString(0); if (!currentKeys.contains(keyForFile)) { File f = new File(attachments, c.getString(1)); try { boolean deleted = f.delete(); if (deleted) { db.delete(ATTACHMENTS_KEY_FILENAME, "key = ?", new String[]{keyForFile}); } else { logger.warning("Could not delete file from BLOB store: " + f.getAbsolutePath()); } } catch (SecurityException e) { String msg = String.format("SecurityException deleting %s from blob store", f.getAbsolutePath()); logger.log(Level.WARNING, msg, e); } } } } catch (SQLException e) { logger.log(Level.SEVERE, "SQL exception in purgeAttachments when removing redundant attachments", e); } finally { DatabaseUtils.closeCursorQuietly(c); } }
Source:
public RequestOptions toRequestOptions() { final RequestOptions requestOptions = new RequestOptions(); requestOptions.setIfMatchETag(getIfMatchETag()); requestOptions.setIfNoneMatchETag(getIfNoneMatchETag()); return requestOptions; }

Target:
RequestOptions toRequestOptions() { final RequestOptions requestOptions = new RequestOptions(); requestOptions.setIfMatchETag(getIfMatchETag()); requestOptions.setIfNoneMatchETag(getIfNoneMatchETag()); return requestOptions; }
Source:
public static void setUp() { port = AvailablePortHelper.getRandomAvailableTCPPort(); server = new GeodeRedisServer("localhost", port); server.start(); jedis = new Jedis("localhost", port, 10000000); }

Target:
public static void setUp() { int port = AvailablePortHelper.getRandomAvailableTCPPort(); int TIMEOUT = 10000000; server = new GeodeRedisServer("localhost", port); server.start(); jedis = new Jedis("localhost", port, TIMEOUT); }
Source:
private void throwContractViolationExceptionIfContractIsInvalid(final boolean wrapInTransaction, final Map<String, Serializable> inputs, final TenantServiceAccessor tenantAccessor, final SFlowNodeInstance flowNodeInstance) throws SBonitaException, ContractViolationException { final GetContractOfUserTaskInstance contractOfUserTaskInstance = new GetContractOfUserTaskInstance(tenantAccessor.getProcessDefinitionService(), (SUserTaskInstance) flowNodeInstance); executeTransactionContent(tenantAccessor, contractOfUserTaskInstance, wrapInTransaction); final SContractDefinition contractDefinition = contractOfUserTaskInstance.getResult(); final ContractValidator validator = new ContractValidatorFactory().createContractValidator(tenantAccessor.getTechnicalLoggerService(), tenantAccessor.getExpressionService()); validator.validate(flowNodeInstance.getProcessDefinitionId(), contractDefinition, inputs); }

Target:
private void throwContractViolationExceptionIfContractIsInvalid(final boolean wrapInTransaction, final Map<String, Serializable> inputs, final TenantServiceAccessor tenantAccessor, final SFlowNodeInstance flowNodeInstance) throws SBonitaException, SContractViolationException { final GetContractOfUserTaskInstance contractOfUserTaskInstance = new GetContractOfUserTaskInstance(tenantAccessor.getProcessDefinitionService(), (SUserTaskInstance) flowNodeInstance); executeTransactionContent(tenantAccessor, contractOfUserTaskInstance, wrapInTransaction); final SContractDefinition contractDefinition = contractOfUserTaskInstance.getResult(); final ContractValidator validator = new ContractValidatorFactory().createContractValidator(tenantAccessor.getTechnicalLoggerService(), tenantAccessor.getExpressionService()); validator.validate(flowNodeInstance.getProcessDefinitionId(), contractDefinition, inputs); }
Source:
private Pair<Double, Double> calculateConcordance(final File outputVcf, final File truthVcf ) { final Set<String> outputKeys = StreamSupport.stream(new FeatureDataSource<VariantContext>(outputVcf).spliterator(), false) .map(vc -> keyForVariant(vc)).collect(Collectors.toSet()); final Set<String> truthKeys = StreamSupport.stream(new FeatureDataSource<VariantContext>(truthVcf).spliterator(), false) .map(vc -> keyForVariant(vc)).collect(Collectors.toSet()); final long truePositives = outputKeys.stream().filter(truthKeys::contains).count(); final long falsePositives = outputKeys.size() - truePositives; final double sensitivity = (double) truePositives / truthKeys.size(); final double fdr = (double) falsePositives / outputKeys.size(); return new ImmutablePair<>(sensitivity, fdr); }

Target:
private Pair<Double, Double> calculateConcordance(final File outputVcf, final File truthVcf ) { final Set<String> outputKeys = StreamSupport.stream(new FeatureDataSource<VariantContext>(outputVcf).spliterator(), false) .filter(vc -> vc.getFilters().isEmpty()) .map(vc -> keyForVariant(vc)).collect(Collectors.toSet()); final Set<String> truthKeys = StreamSupport.stream(new FeatureDataSource<VariantContext>(truthVcf).spliterator(), false) .filter(vc -> vc.getFilters().isEmpty()) .map(vc -> keyForVariant(vc)).collect(Collectors.toSet()); final long truePositives = outputKeys.stream().filter(truthKeys::contains).count(); final long falsePositives = outputKeys.size() - truePositives; final double sensitivity = (double) truePositives / truthKeys.size(); final double fdr = (double) falsePositives / outputKeys.size(); return new ImmutablePair<>(sensitivity, fdr); }
Source:
void addTaskGroupToActivelyReadingTaskGroup( int taskGroupId, ImmutableMap<Integer, Long> partitionOffsets, Optional<DateTime> minMsgTime, Optional<DateTime> maxMsgTime, Set<String> tasks ) { TaskGroup group = new TaskGroup( taskGroupId, partitionOffsets, minMsgTime, maxMsgTime ); group.tasks.putAll(tasks.stream().collect(Collectors.toMap(x -> x, x -> new TaskData()))); taskGroups.putIfAbsent(taskGroupId, group); }

Target:
void addTaskGroupToActivelyReadingTaskGroup( int taskGroupId, ImmutableMap<Integer, Long> partitionOffsets, Optional<DateTime> minMsgTime, Optional<DateTime> maxMsgTime, Set<String> tasks ) { TaskGroup group = new TaskGroup( taskGroupId, partitionOffsets, minMsgTime, maxMsgTime ); group.tasks.putAll(tasks.stream().collect(Collectors.toMap(x -> x, x -> new TaskData()))); if (taskGroups.putIfAbsent(taskGroupId, group) != null) { throw new ISE( "trying to add taskGroup with ID [%s] to actively reading task groups, but group already exists.", taskGroupId ); } }
Source:
public void render(Context context, GlusterGeoRepSessionConfiguration value, SafeHtmlBuilder sb) { List<String> allowedValues = value.getAllowedValues(); boolean isValuesConstrained = allowedValues == null || allowedValues.isEmpty() || allowedValues.size() == 1 && allowedValues.get(0).isEmpty(); SafeHtmlBuilder sbDelegate = new SafeHtmlBuilder(); if (isValuesConstrained) { textInputCell.render(context, value.getDefaultValue(), sbDelegate); } else { setOptions(allowedValues); delegate.render(context, value.getDefaultValue(), sbDelegate); } sb.append(sbDelegate.toSafeHtml()); }

Target:
public void render(Context context, GlusterGeoRepSessionConfiguration value, SafeHtmlBuilder sb) { List<String> allowedValues = value.getAllowedValues(); boolean isValuesConstrained = isValueConstrained(allowedValues); SafeHtmlBuilder sbDelegate = new SafeHtmlBuilder(); if (isValuesConstrained) { setOptions(allowedValues); delegate.render(context, value.getDefaultValue(), sbDelegate); } else { textInputCell.render(context, value.getDefaultValue(), sbDelegate); } sb.append(sbDelegate.toSafeHtml()); }
Source:
public void sendCommand(int deviceID, int messageGroupId, int messageId, int toggleTime, Command command) { String cmd = prepareCommand(deviceID, messageGroupId, messageId, toggleTime, command); if (cmd != "") { logger.debug("send to serial port:" + cmd); serialDevice.writeString(cmd + "\r"); } }

Target:
public void sendCommand(int deviceID, int messageGroupId, int messageId, int toggleTime, Command command) { String cmd = prepareCommand(deviceID, messageGroupId, messageId, toggleTime, command); if (cmd != "") { logger.debug("send to serial port: {}", cmd); serialDevice.writeString(cmd + "\r"); } }
Source:
public List<WebcamDevice> getDevices() { File[] vfiles = VFFILTER.getVideoFiles(); List<WebcamDevice> devices = new ArrayList<WebcamDevice>(); OutputStream os = null; InputStream is1 = null; InputStream is2 = null; Process process = null; String line = null; BufferedReader br1 = null; BufferedReader br2 = null; for (File vfile : vfiles) { String[] cmd = new String[] { "ffmpeg", "-f", "video4linux2", "-hide_banner", "", "-list_formats", "all", "-i", vfile.getAbsolutePath() }; if (LOG.isDebugEnabled()) { StringBuilder sb = new StringBuilder(); for (String c : cmd) { sb.append(c).append(' '); } LOG.debug("Executing command: {}", sb.toString()); } try { process = RT.exec(cmd); } catch (IOException e) { throw new RuntimeException(e); } os = process.getOutputStream(); is1 = process.getInputStream(); is2 = process.getErrorStream(); try { os.close(); } catch (IOException e) { throw new RuntimeException(e); } br1 = new BufferedReader(new InputStreamReader(is1)); br2 = new BufferedReader(new InputStreamReader(is2)); boolean read = false; try { while ((line = br2.readLine()) != null) { if (line.startsWith(STARTER)) { LOG.debug("Command stderr line: {}", line); devices.add(new FFmpegCliDevice(vfile, line)); read = true; break; } } if (!read) { while ((line = br1.readLine()) != null) { if (line.startsWith(STARTER)) { LOG.debug("Command stdout line: {}", line); devices.add(new FFmpegCliDevice(vfile, line)); break; } } } } catch (IOException e) { throw new RuntimeException(e); } finally { try { is1.close(); is2.close(); } catch (IOException e) { throw new RuntimeException(e); } } } return devices; }

Target:
public List<WebcamDevice> getDevices() { List<WebcamDevice> devices; if (Platform.isWindows()) { devices = getWindowsDevices(); } else { devices = getUnixDevices(); } return devices; }
Source:
public <T extends Template> Collection<T> getTemplates(Locale locale) { Collection<RuleTemplate> values = providedObjectsHolder.values(); if (values.isEmpty()) { return Collections.<T>emptyList(); } Collection<RuleTemplate> toReturn = new LinkedList<RuleTemplate>(); toReturn.addAll(values); return (Collection<T>) toReturn; }

Target:
public <T extends Template> Collection<T> getTemplates(Locale locale) { Collection<RuleTemplate> values = providedObjectsHolder.values(); if (values.isEmpty()) { return Collections.<T>emptyList(); } return (Collection<T>) new LinkedList<RuleTemplate>(values); }
Source:
public static final Locale getPreferredLocale(HttpSession sess, ServletRequest request) { final String s = Library.getProperty(Attributes.PREFERRED_LOCALE); Locale l = (s != null) ? Locales.getLocale(s) : request.getLocale(); if (sess != null) { Object v = sess.getAttribute(Attributes.PREFERRED_LOCALE); if (v == null) v = sess.getAttribute(PX_PREFERRED_LOCALE); if (v != null) { if (v instanceof Locale) return (Locale) v; logLocaleError(v); } v = sess.getServletContext().getAttribute(Attributes.PREFERRED_LOCALE); if (v == null) v = sess.getServletContext().getAttribute(PX_PREFERRED_LOCALE); if (v != null) { if (v instanceof Locale) return (Locale) v; logLocaleError(v); } if (s != null) { return l; } } return l != null ? fixZhLocale(l) : Locale.getDefault(); }

Target:
public static final Locale getPreferredLocale(HttpSession sess, ServletRequest request) { final String s = Library.getProperty(Attributes.PREFERRED_LOCALE); final Locale l = (s != null) ? Locales.getLocale(s) : request.getLocale(); if (sess != null) { Object v = sess.getAttribute(Attributes.PREFERRED_LOCALE); if (v == null) v = sess.getAttribute(PX_PREFERRED_LOCALE); if (v != null) { if (v instanceof Locale) return (Locale) v; logLocaleError(v); } v = sess.getServletContext().getAttribute(Attributes.PREFERRED_LOCALE); if (v == null) v = sess.getServletContext().getAttribute(PX_PREFERRED_LOCALE); if (v != null) { if (v instanceof Locale) return (Locale) v; logLocaleError(v); } if (s != null) { return l; } } return l != null ? fixZhLocale(l) : Locale.getDefault(); }
Source:
public long getNumberOfValues() { return numberOfValues; }

Target:
public long getNumberOfValues() { return hasNumberOfValues ? numberOfValues : 0; }
Source:
public void testSafeRefresh() throws Exception { final int numberOfRefreshes = 100; final int requestsPerIteration = 100; final HeroicCoreInstance a = instances.get(0); final ClusterManager clusterManager = a.inject(ClusterComponent::clusterManager); final ClusterRefreshThread t = setupRefreshThread(clusterManager, numberOfRefreshes); final DataStreamCollector collector = new DataStreamCollector(); while (!t.shutdown.get()) { final List<Callable<AsyncFuture<Void>>> operations = new ArrayList<>(); for (int i = 0; i < requestsPerIteration; i++) { operations.add(() -> { final List<AsyncFuture<Void>> pongs = new ArrayList<>(); for (final ClusterShard shard : clusterManager.useDefaultGroup()) { for (int p = 0; p < 10; p++) { final List<UUID> excludeIds = Lists.newArrayList(); while (true) { Optional<ClusterManager.NodeResult<AsyncFuture<Void>>> ret = clusterManager.withNodeInShardButNotWithId(shard.getShard(), excludeIds, ClusterNode.Group::ping); if (!ret.isPresent()) { break; } ClusterManager.NodeResult<AsyncFuture<Void>> result = ret.get(); pongs.add(result.getReturnValue()); excludeIds.add(result.getNodeId()); } } } return async.collectAndDiscard(pongs); }); } async.eventuallyCollect(operations, collector, 20).get(); } t.join(); assertNull("no errors during refreshes", t.refreshError.get()); assertTrue("number of refreshes are non-zero", t.refreshes.get() > 0); assertTrue("number of resolved requests are non-zero", collector.resolved.get() > 0); assertEquals("expect no cancelled requests", 0, collector.cancelled.get()); assertEquals("expect no failed requests", 0, collector.failed.get()); assertTrue(collector.ended); }

Target:
public void testSafeRefresh() throws Exception { final int numberOfRefreshes = 100; final int requestsPerIteration = 100; final HeroicCoreInstance a = instances.get(0); final ClusterManager clusterManager = a.inject(ClusterComponent::clusterManager); final ClusterRefreshThread t = setupRefreshThread(clusterManager, numberOfRefreshes); final DataStreamCollector collector = new DataStreamCollector(); while (!t.shutdown.get()) { final List<Callable<AsyncFuture<Void>>> operations = new ArrayList<>(); for (int i = 0; i < requestsPerIteration; i++) { operations.add(() -> { final List<AsyncFuture<Void>> pongs = new ArrayList<>(); for (final ClusterShard shard : clusterManager.useDefaultGroup()) { for (int p = 0; p < 10; p++) { pongs.addAll(pingAllNodesInShard(clusterManager, shard)); } } return async.collectAndDiscard(pongs); }); } async.eventuallyCollect(operations, collector, 20).get(); } t.join(); assertNull("no errors during refreshes", t.refreshError.get()); assertTrue("number of refreshes are non-zero", t.refreshes.get() > 0); assertTrue("number of resolved requests are non-zero", collector.resolved.get() > 0); assertEquals("expect no cancelled requests", 0, collector.cancelled.get()); assertEquals("expect no failed requests", 0, collector.failed.get()); assertTrue(collector.ended); }
Source:
public TConstruct() { instance = this; FMLJavaModLoadingContext.get().getModEventBus().addListener(this::preInit); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::init); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::postInit); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::gatherData); pulseManager = new PulseManager(Config.pulseConfig); pulseManager.registerPulse(new TinkerCommons()); pulseManager.registerPulse(new TinkerFluids()); pulseManager.registerPulse(new TinkerWorld()); pulseManager.registerPulse(new TinkerGadgets()); pulseManager.enablePulses(); DistExecutor.runWhenOn(Dist.CLIENT, () -> TinkerBook::initBook); if(ModLoadingContext.get().getActiveContainer() instanceof FMLModContainer) { IEventBus eventBus = ((FMLModContainer) ModLoadingContext.get().getActiveContainer()).getEventBus(); eventBus.register(CommonBlocks.class); eventBus.register(WorldBlocks.class); eventBus.register(GadgetBlocks.class); eventBus.register(DecorativeBlocks.class); eventBus.register(CommonItems.class); eventBus.register(WorldItems.class); eventBus.register(GadgetItems.class); eventBus.register(ToolItems.class); eventBus.register(FoodItems.class); } }

Target:
public TConstruct() { instance = this; FMLJavaModLoadingContext.get().getModEventBus().addListener(this::preInit); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::init); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::postInit); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::gatherData); pulseManager = new PulseManager(Config.pulseConfig); pulseManager.registerPulse(new TinkerCommons()); pulseManager.registerPulse(new TinkerFluids()); pulseManager.registerPulse(new TinkerWorld()); pulseManager.registerPulse(new TinkerGadgets()); pulseManager.enablePulses(); DistExecutor.runWhenOn(Dist.CLIENT, () -> TinkerBook::initBook); }
Source:
public AddRemoveRowWidget() { this(20); }

Target:
public AddRemoveRowWidget() { this(Integer.MAX_VALUE); }
Source:
private Map<String, Set<String>> getDataObjectsMap(List<DataObjectFormModel> dataObjects) { return dataObjects.stream().collect(Collectors.toMap( DataObjectFormModel::getClassName, d -> d.getProperties().stream().map(ModelProperty::getName).collect(Collectors.toSet())) ); }

Target:
private Map<String, Set<String>> getDataObjectsMap(List<DataObjectFormModel> dataObjects) { return dataObjects.stream().collect(Collectors.toMap( DataObjectFormModel::getClassName, getModelPropertyNameSet() )); }
Source:
public void testSetEncapsulationAction() throws CapabilityException { int actionCount = 0; Response resp = (Response) chassisCapability.sendMessage(ActionConstants.GETCONFIG, null); Assert.assertTrue(resp.getStatus() == Status.OK); Assert.assertTrue(resp.getErrors().size() == 0); actionCount++; resp = (Response) chassisCapability.sendMessage(ActionConstants.SETENCAPSULATION, newParamsInterfaceEthernetPort("fe-0/1/0", 13)); Assert.assertTrue(resp.getStatus() == Status.OK); Assert.assertTrue(resp.getErrors().size() == 0); actionCount++; List<IAction> queue = (List<IAction>) queueCapability.sendMessage(QueueConstants.GETQUEUE, null); Assert.assertTrue(queue.size() == 4); QueueResponse queueResponse = (QueueResponse) queueCapability.sendMessage(QueueConstants.EXECUTE, null); Assert.assertTrue(queueResponse.getResponses().size() == actionCount); for (int i = 0; i < queueResponse.getResponses().size(); i++) { Assert.assertTrue(queueResponse.getResponses().get(i).getStatus() == ActionResponse.STATUS.OK); for (Response response : queueResponse.getResponses().get(i).getResponses()) { Assert.assertTrue(response.getStatus() == Response.Status.OK); } } Assert.assertTrue(queueResponse.getPrepareResponse().getStatus() == ActionResponse.STATUS.OK); Assert.assertTrue(queueResponse.getConfirmResponse().getStatus() == ActionResponse.STATUS.OK); Assert.assertTrue(queueResponse.getRefreshResponse().getStatus() == ActionResponse.STATUS.OK); Assert.assertTrue(queueResponse.getRestoreResponse().getStatus() == ActionResponse.STATUS.PENDING); Assert.assertTrue(queueResponse.isOk()); }

Target:
public void testSetEncapsulationAction() throws CapabilityException { int actionCount = 0; Response resp = (Response) chassisCapability.sendMessage(ActionConstants.GETCONFIG, null); assertEquals(Status.OK, resp.getStatus()); assertTrue("There should be no errors", resp.getErrors().isEmpty()); actionCount++; resp = (Response) chassisCapability.sendMessage(ActionConstants.SETENCAPSULATION, newParamsInterfaceEthernetPort("fe-0/1/0", 13)); assertEquals(Status.OK, resp.getStatus()); assertTrue("There should be no errors", resp.getErrors().isEmpty()); actionCount++; List<IAction> queue = (List<IAction>) queueCapability.sendMessage(QueueConstants.GETQUEUE, null); assertEquals(actionCount, queue.size()); QueueResponse queueResponse = (QueueResponse) queueCapability.sendMessage(QueueConstants.EXECUTE, null); assertEquals(actionCount, queueResponse.getResponses().size()); for (int i = 0; i < queueResponse.getResponses().size(); i++) { assertEquals(ActionResponse.STATUS.OK, queueResponse.getResponses().get(i).getStatus()); for (Response response : queueResponse.getResponses().get(i).getResponses()) { assertEquals(Response.Status.OK, response.getStatus()); } } assertEquals(ActionResponse.STATUS.OK, queueResponse.getPrepareResponse().getStatus()); assertEquals(ActionResponse.STATUS.OK, queueResponse.getConfirmResponse().getStatus()); assertEquals(ActionResponse.STATUS.OK, queueResponse.getRefreshResponse().getStatus()); assertEquals(ActionResponse.STATUS.PENDING, queueResponse.getRestoreResponse().getStatus()); assertTrue("Response should be ok", queueResponse.isOk()); }
Source:
public IBlockState getNewState() { if (this.isCanceled()) return this.getWorld().getBlockState(this.getPos()); return newState; }

Target:
public IBlockState getNewState() { return newState; }
Source:
public void deserialize(String value) { if (allKeyValueMap == null) { saveEntity = value; return; } if (value != null) { keyValueMap_used = new HashMap<String, String>(); if (!value.isEmpty()) { String[] lines = value.split(PROPERTIES_DELIMETER); String[] splitLine; for (String line : lines) { if (line.isEmpty()) { continue; } splitLine = line.split(KEY_VALUE_DELIMETER, 2); String key = splitLine[0]; if (allKeyValueMap.containsKey(key)) { keyValueMap_used.put(key, splitLine[1]); } } } } init(allKeyValueMap.keySet(), keyValueMap_used.keySet()); }

Target:
public void deserialize(String value) { if (allKeyValueMap == null) { saveEntity = value; return; } keyValueMap_used = new HashMap<String, String>(); if (value != null && !value.isEmpty()) { String[] lines = value.split(PROPERTIES_DELIMETER); String[] splitLine; for (String line : lines) { if (line.isEmpty()) { continue; } splitLine = line.split(KEY_VALUE_DELIMETER, 2); String key = splitLine[0]; if (allKeyValueMap.containsKey(key)) { keyValueMap_used.put(key, splitLine[1]); } } } init(allKeyValueMap.keySet(), keyValueMap_used.keySet()); }
Source:
public boolean equals(Object obj) { if (id == null) { return super.equals(obj); } if (obj == null || !(obj instanceof AssignedIdString)) { return false; } AssignedIdString other = (AssignedIdString) obj; if (other.id == null) { return (id == other.id); } return id.equals(other.id); }

Target:
public boolean equals(Object obj) { if (id == null) { return super.equals(obj); } if (obj == null || !(obj instanceof AssignedIdString)) { return false; } AssignedIdString other = (AssignedIdString) obj; if (other.id == null) { return false; } return id.equals(other.id); }
Source:
public void close() throws SQLException { connect.deleteConnector(CONNECTOR_NAME); connection.close(); stopConnect(); }

Target:
public void close() throws SQLException { deleteTable(); connect.deleteConnector(CONNECTOR_NAME); connection.close(); stopConnect(); }
Source:
private Boolean containsGzip(Request request) { return request.headers(HttpHeaders.ACCEPT_ENCODING).toLowerCase().contains(GZIP); }

Target:
private Boolean containsGzip(Request request) { String acceptEncoding = request.headers(HttpHeaders.ACCEPT_ENCODING); if (acceptEncoding != null) { return acceptEncoding.toLowerCase().contains(GZIP); } LOGGER.debug("Request header Accept-Encoding is null"); return false; }
Source:
private ImmutableSet<DeclaredType> getValueFieldOfClasses(AnnotationMirror annotationMirror) { return ((List<AnnotationValue>) getAnnotationValue(annotationMirror, "value").getValue()) .stream() .map(value -> MoreTypes.asDeclared((DeclaredType) value.getValue())) .collect(ImmutableSet.toImmutableSet()); }

Target:
private ImmutableSet<DeclaredType> getValueFieldOfClasses(AnnotationMirror annotationMirror) { return ((List<AnnotationValue>) getAnnotationValue(annotationMirror, "value").getValue()) .stream() .map(value -> (DeclaredType) value.getValue()) .collect(toImmutableSet()); }
Source:
public void reorder(List<?> list) { for (int i = 0; i < list.size(); i++) { if (list.get(i) instanceof Lifeline[]) { Lifeline temp[] = (Lifeline[]) list.get(i); temp = checkNotNull(temp); if (temp.length == 2) { if (temp[1] == null) { insertLifelineAfter(temp[0], getLifeline(lifeLinesCount() - 1)); } else { insertLifelineBefore(temp[0], temp[1]); } } } } }

Target:
public void reorder(List<?> list) { for (int i = 0; i < list.size(); i++) { Object o = list.get(i); if (o instanceof Lifeline[]) { Lifeline temp[] = (Lifeline[]) o; if (temp.length == 2) { if (temp[1] == null) { insertLifelineAfter(temp[0], getLifeline(lifeLinesCount() - 1)); } else { insertLifelineBefore(temp[0], temp[1]); } } } } }
Source:
public static void setMoney(User user, BigDecimal balance) throws NoLoanPermittedException { if (user == null) { throw new RuntimeException("Economy user cannot be null"); } if (balance.compareTo(ess.getSettings().getMinMoney()) < 0) { throw new NoLoanPermittedException(); } if (balance.signum() < 0 && !user.isAuthorized("essentials.eco.loan")) { throw new NoLoanPermittedException(); } try { user.setMoney(balance, UserBalanceUpdateEvent.Cause.API); } catch (MaxMoneyException ex) { } Trade.log("API", "Set", "API", user.getName(), new Trade(balance, ess), null, null, null, ess); }

Target:
public static void setMoney(User user, BigDecimal balance) throws NoLoanPermittedException { if (user == null) { throw new IllegalArgumentException("Economy user cannot be null"); } if (balance.compareTo(ess.getSettings().getMinMoney()) < 0) { throw new NoLoanPermittedException(); } if (balance.signum() < 0 && !user.isAuthorized("essentials.eco.loan")) { throw new NoLoanPermittedException(); } try { user.setMoney(balance, UserBalanceUpdateEvent.Cause.API); } catch (MaxMoneyException ex) { } Trade.log("API", "Set", "API", user.getName(), new Trade(balance, ess), null, null, null, ess); }
Source:
public String getValue(ContextKey key) { if (delegate == null) { LOG.debug("Configuration not yet initialized. Returning 'null' for " + key); return null; } return delegate.getValue(key); }

Target:
public String getValue(ContextKey key) { if (delegate == null) { System.out.println("Configuration not yet initialized. Returning 'null' for " + key); return null; } return delegate.getValue(key); }
Source:
public boolean replaces(@Nullable LookupExtractorFactory other) { if (this == other) { return false; } if (other == null) { return true; } if (!(other instanceof MapLookupExtractorFactory)) { return true; } final MapLookupExtractorFactory that = (MapLookupExtractorFactory) other; return isOneToOne != that.isOneToOne || !map.equals(that.map); }

Target:
public boolean replaces(@Nullable LookupExtractorFactory other) { return !equals(other); }
Source:
protected String getDestinationDescription() { if (this.replyDestination instanceof TemporaryQueue) { return "Temporary queue:" + this.replyDestination.toString(); } else if (super.getDestination() != null){ try { return super.getDestinationDescription(); } catch (Exception e) { if (logger.isWarnEnabled()) { logger.warn("Unexpected error obtaining destination description: " + e.getMessage()); } return "unknown.1"; } } else { return "unknown.2"; } }

Target:
protected String getDestinationDescription() { if (this.replyDestination instanceof TemporaryQueue) { return "Temporary queue:" + this.replyDestination.toString(); } else if (super.getDestination() != null){ try { return super.getDestinationDescription(); } catch (Exception e) { if (logger.isWarnEnabled()) { logger.warn("Unexpected error obtaining destination description: " + e.getMessage()); } return null; } } else { return null; } }
Source:
public void disableWireframe() { boolean refreshTaskList = false; EnableFaceCulling faceCullingStateChange = new EnableFaceCulling(); if (!getDesiredStateChanges().contains(faceCullingStateChange)) { addDesiredStateChange(faceCullingStateChange); refreshTaskList = true; } if (getDesiredStateChanges().contains(wireframeStateChange)) { removeDesiredStateChange(wireframeStateChange); refreshTaskList = true; } if (refreshTaskList) { worldRenderer.requestTaskListRefresh(); } }

Target:
public void disableWireframe() { if (getDesiredStateChanges().contains(wireframeStateChange)) { addDesiredStateChange(faceCullingStateChange); removeDesiredStateChange(wireframeStateChange); worldRenderer.requestTaskListRefresh(); } }
Source:
public CopyArtifact(String projectName) { StaplerRequest req = Stapler.getCurrentRequest(); if (req!=null) { AbstractProject<?,?> p = req.findAncestorObject(AbstractProject.class); if (p != null) { ItemGroup<?> context = p.getParent(); if (projectName.indexOf('$') < 0 && Jenkins.getInstance().getItem(projectName, context, Job.class) == null) projectName = ""; } } this.project = projectName; setParameters(null); setFilter(null); setTarget(null); setExcludes(null); setSelector(null); setFlatten(false); setOptional(false); setFingerprintArtifacts(false); }

Target:
public CopyArtifact(String projectName) { StaplerRequest req = Stapler.getCurrentRequest(); if (req!=null) { AbstractProject<?,?> p = req.findAncestorObject(AbstractProject.class); if (p != null) { ItemGroup<?> context = p.getParent(); if (projectName.indexOf('$') < 0 && Jenkins.getInstance().getItem(projectName, context, Job.class) == null) projectName = ""; } } this.project = projectName; setParameters(null); setFilter(null); setTarget(null); setExcludes(null); setSelector(DEFAULT_BUILD_SELECTOR); setFlatten(false); setOptional(false); setFingerprintArtifacts(false); }
Source:
public Adapter createStoragePathAdapter(String path, boolean isLocal) { IFileRevision findFileRevision = findFileRevision((ITypedElement)accessor); IFile file = findFile((ITypedElement)accessor); boolean local; if (file == null) { local = false; } else { local = true; } if (!isLocal && findFileRevision != null) { return new StoragePathAdapter(path, local, findFileRevision.getContentIdentifier(), findFileRevision.getAuthor()); } else { return new StoragePathAdapter(path, local); } }

Target:
public Adapter createStoragePathAdapter(String path, boolean isLocal) { IFileRevision findFileRevision = findFileRevision((ITypedElement)accessor); IFile file = findFile((ITypedElement)accessor); boolean local = file != null; if (!isLocal && findFileRevision != null) { return new StoragePathAdapter(path, local, findFileRevision.getContentIdentifier(), findFileRevision.getAuthor()); } else { return new StoragePathAdapter(path, local); } }
Source:
public ProjectProperty(DmsProject project, Integer typeId, String value, Integer rank, Integer variableId, String alias) { this.project = project; this.typeId = typeId; this.value = value; this.rank = rank; this.variableId = variableId; this.alias = alias; this.description = description; }

Target:
public ProjectProperty(DmsProject project, Integer typeId, String value, Integer rank, Integer variableId, String alias) { this.project = project; this.typeId = typeId; this.value = value; this.rank = rank; this.variableId = variableId; this.alias = alias; }
Source:
void setSession(BigtableSession session) { this.session = session; }

Target:
protected void setSession(BigtableSession session) { this.session = session; }
Source:
private String name(final String... parts) { final List<String> normalized = Stream.concat( Stream.of(prefix), Arrays .stream(parts) .map(GcMemoryMetrics::normalize) ).collect(Collectors.toList()); return String.join(".", normalized); }

Target:
private String name(final String... parts) { return Stream.concat( Stream.of(prefix), Arrays .stream(parts) .map(GcMemoryMetrics::normalize) ).collect(Collectors.joining(".")); }
Source:
protected void executeQueryCommand() { final VDSGroup oldCluster = backend.runQuery(VdcQueryType.GetVdsGroupById, getParameters()).getReturnValue(); VDSGroup newCluster = getParameters().getNewCluster(); List<ClusterEditWarnings.Warning> hostWarnings = getProblematicEntities(oldCluster, newCluster, hostCheckers, new ClusterEntityResolver<VDS>() { @Override public List<VDS> getClusterEntities(VDSGroup cluster) { return vdsDao.getAllForVdsGroup(cluster.getId()); } }); final List<ClusterEditWarnings.Warning> vmWarnings = oldCluster.supportsVirtService() && newCluster.supportsVirtService() ? getProblematicEntities(oldCluster, newCluster, vmCheckers, new ClusterEntityResolver<VM>() { @Override public List<VM> getClusterEntities(VDSGroup cluster) { return vmDao.getAllForVdsGroup(cluster.getId()); } }) : Collections.<ClusterEditWarnings.Warning>emptyList(); setReturnValue(new ClusterEditWarnings(hostWarnings, vmWarnings)); }

Target:
protected void executeQueryCommand() { final VDSGroup oldCluster = backend.runQuery(VdcQueryType.GetVdsGroupById, getParameters()).getReturnValue(); VDSGroup newCluster = getParameters().getNewCluster(); List<ClusterEditWarnings.Warning> hostWarnings = getProblematicEntities(oldCluster, newCluster, hostCheckers, new ClusterEntityResolver<VDS>() { @Override public List<VDS> getClusterEntities(VDSGroup cluster) { return vdsDao.getAllForVdsGroup(cluster.getId()); } }); List<ClusterEditWarnings.Warning> vmWarnings = new ArrayList<>(); if (oldCluster.supportsVirtService() && newCluster.supportsVirtService()) { getProblematicEntities(oldCluster, newCluster, vmCheckers, new ClusterEntityResolver<VM>() { @Override public List<VM> getClusterEntities(VDSGroup cluster) { return vmDao.getAllForVdsGroup(cluster.getId()); } }); } setReturnValue(new ClusterEditWarnings(hostWarnings, vmWarnings)); }