auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testBatchLoookupOverconsumedBySubscriptionId() { Map<String, Entitlement> subIdMap = new HashMap<String, Entitlement>(); List<Pool> expectedPools = new ArrayList<Pool>(); for (Integer i = 0; i < 5; i++) { Pool pool = createPool(owner, product, 1L, TestUtil.createDate(2050, 3, 2), TestUtil.createDate(2055, 3, 2)); poolCurator.create(pool); expectedPools.add(pool); String subid = pool.getSubscriptionId(); Entitlement e = new Entitlement(pool, consumer, 2); entitlementCurator.create(e); subIdMap.put(subid, e); } Pool unconsumedPool = createPool(owner, product, 1L, TestUtil.createDate(2050, 3, 2), TestUtil.createDate(2055, 3, 2)); poolCurator.create(unconsumedPool); Pool notOverConsumedPool = createPool(owner, product, 1L, TestUtil.createDate(2050, 3, 2), TestUtil.createDate(2055, 3, 2)); poolCurator.create(notOverConsumedPool); entitlementCurator.create(new Entitlement(notOverConsumedPool, consumer, 1)); List<Pool> gotPools = poolCurator.lookupOversubscribedBySubscriptionIds(subIdMap); assertEquals(5, gotPools.size()); for (Pool expectedPool : gotPools) { assertTrue(gotPools.contains(expectedPool)); } assertFalse(gotPools.contains(unconsumedPool)); assertFalse(gotPools.contains(notOverConsumedPool)); }

Target:
public void testBatchLoookupOverconsumedBySubscriptionId() { Map<String, Entitlement> subIdMap = new HashMap<String, Entitlement>(); List<Pool> expectedPools = new ArrayList<Pool>(); for (Integer i = 0; i < 5; i++) { Pool pool = createPool(owner, product, 1L, TestUtil.createDate(2050, 3, 2), TestUtil.createDate(2055, 3, 2)); poolCurator.create(pool); expectedPools.add(pool); String subid = pool.getSubscriptionId(); Entitlement e = new Entitlement(pool, consumer, 2); entitlementCurator.create(e); subIdMap.put(subid, e); } Pool unconsumedPool = createPool(owner, product, 1L, TestUtil.createDate(2050, 3, 2), TestUtil.createDate(2055, 3, 2)); poolCurator.create(unconsumedPool); Pool notOverConsumedPool = createPool(owner, product, 1L, TestUtil.createDate(2050, 3, 2), TestUtil.createDate(2055, 3, 2)); poolCurator.create(notOverConsumedPool); entitlementCurator.create(new Entitlement(notOverConsumedPool, consumer, 1)); Pool overConsumedPool = createPool(owner, product, 1L, TestUtil.createDate(2050, 3, 2), TestUtil.createDate(2055, 3, 2)); poolCurator.create(overConsumedPool); entitlementCurator.create(new Entitlement(overConsumedPool, consumer, 2)); List<Pool> gotPools = poolCurator.lookupOversubscribedBySubscriptionIds(subIdMap); assertEquals(5, gotPools.size()); assertThat(expectedPools, hasItems(gotPools.toArray(new Pool[0]))); assertThat(gotPools, not(hasItem(unconsumedPool))); assertThat(gotPools, not(hasItem(notOverConsumedPool))); assertThat(gotPools, not(hasItem(overConsumedPool))); }
Source:
private boolean needsTildeValue(final int firstNonzeroIdx, final int lastNonzeroIdx, final LinkedHashMap<String, Long> truncatedFragments, final int handledFragmentCount, final boolean needsTilde, final Long value, final String key) { boolean tilde = needsTilde; long longValue = value.longValue(); int idx; switch (key) { case WEEK: idx = WEEKIDX; break; case DAY: idx = DAYIDX; break; case HOUR: idx = HOURIDX; break; case MIN: idx = MINIDX; break; default: idx = -1; break; } if (firstNonzeroIdx <= idx && idx <= lastNonzeroIdx && longValue > 0) { if (handledFragmentCount < 2) { truncatedFragments.put(key, value); } else { tilde = true; } } return tilde; }

Target:
private boolean needsTildeValue(final int firstNonzeroIdx, final int lastNonzeroIdx, final LinkedHashMap<String, Long> truncatedFragments, final int handledFragmentCount, final boolean needsTilde, final Long value, final String key) { boolean tilde = needsTilde; long longValue = value.longValue(); int idx = getIdx(key); if (firstNonzeroIdx <= idx && idx <= lastNonzeroIdx && longValue > 0) { if (handledFragmentCount < 2) { truncatedFragments.put(key, value); } else { tilde = true; } } return tilde; }
Source:
private void initializeCommand() { when(vmDao.get(any())).thenReturn(vm); Cluster cluster = new Cluster(); cluster.setCompatibilityVersion(Version.v4_4); when(clusterDao.get(any())).thenReturn(cluster); VmTemplate vmTemplate = new VmTemplate(); when(vmTemplateDao.get(any())).thenReturn(vmTemplate); disk.setStorageIds(Collections.singletonList(Guid.newGuid())); List<Disk> disks = Collections.singletonList(disk); QueryReturnValue queryReturnValue = new QueryReturnValue(); queryReturnValue.setSucceeded(true); queryReturnValue.setReturnValue(disks); when(backendInternal.runInternalQuery(eq(QueryType.GetAllDisksByVmId), any(), any())).thenReturn(queryReturnValue); when(diskDao.getAllForVm(any())).thenReturn(disks); cmd.init(); }

Target:
private void initializeCommand() { when(vmDao.get(any())).thenReturn(vm); Cluster cluster = new Cluster(); cluster.setCompatibilityVersion(Version.v4_4); when(clusterDao.get(any())).thenReturn(cluster); VmTemplate vmTemplate = new VmTemplate(); when(vmTemplateDao.get(any())).thenReturn(vmTemplate); disk.setStorageIds(Collections.singletonList(Guid.newGuid())); List<Disk> disks = Collections.singletonList(disk); QueryReturnValue disksByVmId = new QueryReturnValue(); disksByVmId.setSucceeded(true); disksByVmId.setReturnValue(disks); when(backendInternal.runInternalQuery(eq(QueryType.GetAllDisksByVmId), any(), any())) .thenReturn(disksByVmId); when(diskDao.getAllForVm(any())).thenReturn(disks); cmd.init(); }
Source:
private static FileDialog createNewFileDialog(Shell parent, int style) { String[] overrridePath = fOverridePath; List<String> sanitizedPath = overrridePath == null ? Collections.emptyList() : overrridePath.length == 0 ? Collections.emptyList() : Arrays.asList(overrridePath); fOverride = false; return new FileDialog(parent, style) { @Override public String open() { return !sanitizedPath.isEmpty() ? sanitizedPath.get(0) : null; } @Override protected void checkSubclass() { } @Override public String getFileName() { return !sanitizedPath.isEmpty() ? getFileName(sanitizedPath.get(0)) : ""; } @Override public String[] getFileNames() { List<String> outStrings = new ArrayList<>(); for (String entry : sanitizedPath) { outStrings.add(getFileName(entry)); } return outStrings.toArray(new String[outStrings.size()]); } @Override public String getFilterPath() { return !sanitizedPath.isEmpty() ? new Path(sanitizedPath.get(0)).removeLastSegments(1).toString() : ""; } private String getFileName(String path) { return new Path(path).lastSegment(); } }; }

Target:
private static FileDialog createNewFileDialog(Shell parent, int style) { String[] overridePath = fOverridePath; List<String> sanitizedPath = overridePath == null ? Collections.emptyList() : Arrays.asList(overridePath); fOverride = false; return new FileDialog(parent, style) { @Override public String open() { return !sanitizedPath.isEmpty() ? sanitizedPath.get(0) : null; } @Override protected void checkSubclass() { } @Override public String getFileName() { return !sanitizedPath.isEmpty() ? getFileName(sanitizedPath.get(0)) : ""; } @Override public String[] getFileNames() { List<String> outStrings = new ArrayList<>(); for (String entry : sanitizedPath) { outStrings.add(getFileName(entry)); } return outStrings.toArray(new String[outStrings.size()]); } @Override public String getFilterPath() { return !sanitizedPath.isEmpty() ? new Path(sanitizedPath.get(0)).removeLastSegments(1).toString() : ""; } private String getFileName(String path) { return new Path(path).lastSegment(); } }; }
Source:
private void doSearch() { List<ProjectRightsBased> filterProjectsList = new ArrayList<ProjectRightsBased>(); boolean searchAll = false; if ((!"".equals(filterParentProjectTxt.getText().trim())) || (!"".equals(filterProjectNameTxt.getText().trim()))) { for (final ProjectRightsBased k : projectsRightsBasedList) { if (!"".equals(filterProjectNameTxt.getText())) { if (!"".equals(filterParentProjectTxt.getText())) { if ((k.getProjectData().getName().regionMatches(true, 0, filterProjectNameTxt .getText(), 0, filterProjectNameTxt.getText().length())) && (k.getProjectData().getParentName().regionMatches(true, 0, filterParentProjectTxt.getText(), 0, filterParentProjectTxt .getText().length()))) { filterProjectsList.add(k); } } else { if (k.getProjectData().getName().regionMatches(true, 0, filterProjectNameTxt.getText(), 0, filterProjectNameTxt.getText().length())) { filterProjectsList.add(k); } } } else { if (!"".equals(filterParentProjectTxt.getText())) { if ((k.getProjectData().getParentName() != null) && (k.getProjectData().getParentName().regionMatches(true, 0, filterParentProjectTxt.getText(), 0, filterParentProjectTxt .getText().length()))) { filterProjectsList.add(k); } } } } } else { filterProjectsList = projectsRightsBasedList; searchAll = true; } if (searchListener != null) { searchListener.onSearch(filterProjectsList, searchAll); } }

Target:
private void doSearch() { List<ProjectData> filterProjectsList = new ArrayList<ProjectData>(); boolean searchAll = false; if ((!"".equals(filterParentProjectTxt.getText().trim())) || (!"".equals(filterProjectNameTxt.getText().trim()))) { for (final ProjectData k : projectDataList) { if (!"".equals(filterProjectNameTxt.getText())) { if (!"".equals(filterParentProjectTxt.getText())) { if ((k.getName().regionMatches(true, 0, filterProjectNameTxt .getText(), 0, filterProjectNameTxt.getText().length())) && k.getParentNameKey() != null && (k.getParentNameKey().get().regionMatches(true, 0, filterParentProjectTxt.getText(), 0, filterParentProjectTxt .getText().length()))) { filterProjectsList.add(k); } } else { if (k.getName().regionMatches(true, 0, filterProjectNameTxt.getText(), 0, filterProjectNameTxt.getText().length())) { filterProjectsList.add(k); } } } else { if (!"".equals(filterParentProjectTxt.getText())) { if (filterParentProjectTxt.getText().equals( Gerrit.getConfig().getWildProject().get())) { if (k.getParentNameKey() == null) { filterProjectsList.add(k); } } else if ((k.getParentNameKey() != null) && (k.getParentNameKey().get().regionMatches(true, 0, filterParentProjectTxt.getText(), 0, filterParentProjectTxt .getText().length()))) { filterProjectsList.add(k); } } } } } else { filterProjectsList = projectDataList; searchAll = true; } handlerManager.fireEvent(new SearchEvent(filterProjectsList, searchAll)); }
Source:
public RetryPolicy(int retryTimeOut, int retryNumber, int incomingHeartbeat, int outgoingHeartbeat, List<Class<? extends Exception>> retryableExceptions) { this.retryNumber = retryNumber; this.retryTimeOut = retryTimeOut; this.incomingHeartbeat = incomingHeartbeat; if (incomingHeartbeat != 0) { this.isIncomingHeartbeat.set(true); } this.outgoingHeartbeat = outgoingHeartbeat; if (outgoingHeartbeat != 0) { this.isOutgoingHeartbeat.set(true); } this.exceptions = Collections.unmodifiableList(retryableExceptions); }

Target:
public RetryPolicy(int retryTimeOut, int retryNumber, int incomingHeartbeat, int outgoingHeartbeat, List<Class<? extends Exception>> retryableExceptions) { this.retryNumber = retryNumber; this.retryTimeOut = retryTimeOut; setIncomingHeartbeat(incomingHeartbeat); setOutgoingHeartbeat(outgoingHeartbeat); this.exceptions = Collections.unmodifiableList(retryableExceptions); }
Source:
void notifyChatRoomMemberJoined(ChatRoomMember chatMember) { super.notifyChatRoomMemberJoined(chatMember); String identifier = getParticipantIdentifier(chatMember); this.transcriber.maybeAddParticipant(identifier); this.transcriber.updateParticipant(identifier, chatMember); this.transcriber.participantJoined(identifier); }

Target:
void notifyChatRoomMemberJoined(ChatRoomMember chatMember) { super.notifyChatRoomMemberJoined(chatMember); String identifier = getParticipantIdentifier(chatMember); this.transcriber.updateParticipant(identifier, chatMember); this.transcriber.participantJoined(identifier); }
Source:
public void testInt3088MPutRecursiveFiltered() { if (!sessionFactory.toString().startsWith("Mock for")) { String dir = "sftpSource/"; this.inboundMGetRecursive.send(new GenericMessage<Object>(dir + "*")); while (output.receive(0) != null) { } this.inboundMPutRecursiveFiltered.send(new GenericMessage<File>(new File("/tmp/sftpOutboundTests/sftpSource"))); @SuppressWarnings("unchecked") Message<List<String>> out = (Message<List<String>>) this.output.receive(1000); assertNotNull(out); assertEquals(2, out.getPayload().size()); assertThat(out.getPayload().get(0), not(equalTo(out.getPayload().get(1)))); assertThat( out.getPayload().get(0), anyOf(equalTo("sftpTarget/slocalTarget1.txt"), equalTo("sftpTarget/slocalTarget2.txt"), equalTo("sftpTarget/subSftpSource/subSlocalTarget1.txt"))); assertThat( out.getPayload().get(1), anyOf(equalTo("sftpTarget/slocalTarget1.txt"), equalTo("sftpTarget/slocalTarget2.txt"), equalTo("sftpTarget/subSftpSource/subSlocalTarget1.txt"))); } }

Target:
public void testInt3088MPutRecursiveFiltered() { String dir = "sftpSource/"; this.inboundMGetRecursive.send(new GenericMessage<Object>(dir + "*")); while (output.receive(0) != null) { } this.inboundMPutRecursiveFiltered.send(new GenericMessage<File>(new File("/tmp/sftpOutboundTests/sftpSource"))); @SuppressWarnings("unchecked") Message<List<String>> out = (Message<List<String>>) this.output.receive(1000); assertNotNull(out); assertEquals(2, out.getPayload().size()); assertThat(out.getPayload().get(0), not(equalTo(out.getPayload().get(1)))); assertThat( out.getPayload().get(0), anyOf(equalTo("sftpTarget/slocalTarget1.txt"), equalTo("sftpTarget/slocalTarget2.txt"), equalTo("sftpTarget/subSftpSource/subSlocalTarget1.txt"))); assertThat( out.getPayload().get(1), anyOf(equalTo("sftpTarget/slocalTarget1.txt"), equalTo("sftpTarget/slocalTarget2.txt"), equalTo("sftpTarget/subSftpSource/subSlocalTarget1.txt"))); }
Source:
public void testDecodeWithNoSpaces() { AffineCipher affineCipher = new AffineCipher(); assertEquals("thequickbrownfoxjumpsoverthelazydog", affineCipher.decode("swxtjnpvyklruoliejdcblaxkswxmhqzglf", 17, 33)); }

Target:
public void testDecodeWithNoSpaces() { assertEquals("thequickbrownfoxjumpsoverthelazydog", affineCipher.decode("swxtjnpvyklruoliejdcblaxkswxmhqzglf", 17, 33)); }
Source:
private void configureShell() { shell.setText( title ); Rectangle parentSize = parent.getDisplay().getBounds(); Point prefSize = shell.computeSize( SWT.DEFAULT, SWT.DEFAULT ); shell.setSize( prefSize ); int locationX = ( parentSize.width - prefSize.x ) / 2 + parentSize.x; int locationY = ( parentSize.height - prefSize.y ) / 2 + parentSize.y; shell.setLocation( new Point( locationX, locationY ) ); shell.pack(); }

Target:
private void configureShell() { shell.setText( title ); Rectangle displaySize = parent.getDisplay().getBounds(); Point prefSize = shell.computeSize( SWT.DEFAULT, SWT.DEFAULT ); shell.setSize( prefSize ); int locationX = ( displaySize.width - prefSize.x ) / 2 + displaySize.x; int locationY = ( displaySize.height - prefSize.y ) / 2 + displaySize.y; shell.setLocation( new Point( locationX, locationY ) ); shell.pack(); }
Source:
public List<RootInternalResourceGroup> getRootGroups() { return (CopyOnWriteArrayList<RootInternalResourceGroup>) ((CopyOnWriteArrayList<RootInternalResourceGroup>) rootGroups).clone(); }

Target:
public List<RootInternalResourceGroup> getRootGroups() { return ImmutableList.copyOf(rootGroups); }
Source:
public void testTaskNotStartedReassign() throws Exception { Reader reader = new InputStreamReader(getClass().getResourceAsStream(MvelFilePath.DeadlineWithMultipleReassignment)); Map<String, Object> vars = new HashMap<String, Object>(); vars.put("now", new Date()); Task task = (InternalTask) TaskFactory.evalTask(reader, vars); Environment environment = EnvironmentFactory.newEnvironment(); Map<String, Object> inputVars = new HashMap<String, Object>(); inputVars.put("NotStartedReassign", "[users:Tony Stark,Bobba Fet,Jabba Hutt|groups:]@[500ms]"); ((InternalTask) task).setDeadlines(HumanTaskHandlerHelper.setDeadlines(inputVars, Collections.emptyList(), environment)); taskService.addTask(task, inputVars); long taskId = task.getId(); task = taskService.getTaskById(taskId); String []owners = new String[] { "Tony Stark", "Bobba Fet", "Jabba Hutt" }; Thread.sleep(1000); for(String owner : owners) { taskService.claim(taskId, owner); task = taskService.getTaskById(taskId); Assert.assertEquals(task.getTaskData().getActualOwner().getId(), owner); Thread.sleep(1000); task = taskService.getTaskById(taskId); Assert.assertNull("it was not reclaimed", task.getTaskData().getActualOwner()); } taskService.claim(taskId, "Bobba Fet"); taskService.start(taskId, "Bobba Fet"); taskService.complete(taskId, "Bobba Fet", Collections.<String, Object>emptyMap()); }

Target:
public void testTaskNotStartedReassign() throws Exception { Reader reader = new InputStreamReader(getClass().getResourceAsStream(MvelFilePath.DeadlineWithMultipleReassignment)); Map<String, Object> vars = new HashMap<String, Object>(); vars.put("now", new Date()); Task task = (InternalTask) TaskFactory.evalTask(reader, vars); Environment environment = EnvironmentFactory.newEnvironment(); Map<String, Object> inputVars = new HashMap<String, Object>(); inputVars.put("NotStartedReassign", "[users:Tony Stark,Bobba Fet,Jabba Hutt|groups:]@[500ms]"); ((InternalTask) task).setDeadlines(HumanTaskHandlerHelper.setDeadlines(inputVars, Collections.emptyList(), environment)); taskService.addTask(task, inputVars); long taskId = task.getId(); String []owners = new String[] { "Tony Stark", "Bobba Fet", "Jabba Hutt" }; for(String owner : owners) { CountDownTaskEventListener countDownListener = new CountDownTaskEventListener(1, true, false); addCountDownListner(countDownListener); taskService.claim(taskId, owner); task = taskService.getTaskById(taskId); Assert.assertEquals(task.getTaskData().getActualOwner().getId(), owner); countDownListener.waitTillCompleted(); task = taskService.getTaskById(taskId); Assert.assertNull("it was not reclaimed", task.getTaskData().getActualOwner()); removeCountDownListner(countDownListener); } taskService.claim(taskId, "Bobba Fet"); taskService.start(taskId, "Bobba Fet"); taskService.complete(taskId, "Bobba Fet", Collections.<String, Object>emptyMap()); }
Source:
private Optional<ProcessResult> run(String[] command, Path dir) { ProcessRunner runner = new ProcessRunner(command, dir); try { return Optional.of(runner.call()); } catch (Exception e) { log.error("Running command failed {}", Arrays.deepToString(command), e); } return Optional.absent(); }

Target:
private ProcessResult run(String[] command, Path dir) throws IOException, InterruptedException { ProcessRunner runner = new ProcessRunner(command, dir); return runner.call(); }
Source:
public void rename(String oldNamespaceName, String newNamespaceName) throws AccumuloSecurityException, NamespaceNotFoundException, AccumuloException, NamespaceExistsException { checkArgument(oldNamespaceName.length() <= MAX_NAMESPACE_LEN, "Namespaces longer than 1024 characters" + "are no longer supported and may result in unexpected behavior"); checkArgument(newNamespaceName.length() <= MAX_TABLE_NAME_LEN, "Namespace is longer than 1024 characters"); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldNamespaceName.getBytes(UTF_8)), ByteBuffer.wrap(newNamespaceName.getBytes(UTF_8))); Map<String,String> opts = new HashMap<>(); doNamespaceFateOperation(FateOperation.NAMESPACE_RENAME, args, opts, oldNamespaceName); }

Target:
public void rename(String oldNamespaceName, String newNamespaceName) throws AccumuloSecurityException, NamespaceNotFoundException, AccumuloException, NamespaceExistsException { checkArgument(newNamespaceName.length() <= MAX_TABLE_NAME_LEN, "Namespace is longer than " + MAX_TABLE_NAME_LEN + " characters"); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldNamespaceName.getBytes(UTF_8)), ByteBuffer.wrap(newNamespaceName.getBytes(UTF_8))); Map<String,String> opts = new HashMap<>(); doNamespaceFateOperation(FateOperation.NAMESPACE_RENAME, args, opts, oldNamespaceName); }
Source:
public void testSmallIntervals(final File input, final String reference_name, final String useFastAlgorithm) throws IOException { final File outfile = File.createTempFile("testSmallIntervals", ".wgs_metrics",TEMP_OUTPUT_DIR); final File ref = new File(reference_name); final File intervals = new File(TEST_DIR, "smallIntervals.interval_list"); final int sampleSize = 1000; final String[] args = new String[] { "INPUT=" + input.getAbsolutePath(), "OUTPUT=" + outfile.getAbsolutePath(), "REFERENCE_SEQUENCE=" + ref.getAbsolutePath(), "INTERVALS=" + intervals.getAbsolutePath(), "SAMPLE_SIZE=" + sampleSize, "COVERAGE_CAP=" + 40000, "USE_FAST_ALGORITHM=" + useFastAlgorithm }; Assert.assertEquals(runPicardCommandLine(args), 0); final MetricsFile<WgsMetrics, Comparable<?>> output = new MetricsFile<>(); try (FileReader reader = new FileReader(outfile)) { output.read(reader); } for (final WgsMetrics metrics : output.getMetrics()) { Assert.assertEquals(metrics.GENOME_TERRITORY, 1000); Assert.assertEquals(metrics.PCT_EXC_ADAPTER, 0D); Assert.assertEquals(metrics.PCT_EXC_MAPQ, 0.0); Assert.assertEquals(metrics.PCT_EXC_DUPE, 0.0); Assert.assertEquals(metrics.PCT_EXC_UNPAIRED, 0.0); Assert.assertEquals(metrics.MEAN_COVERAGE, 1727.6, .1); Assert.assertEquals(metrics.SD_COVERAGE, 695.68, 0.1); Assert.assertEquals(metrics.FOLD_80_BASE_PENALTY, 1.59, 0.01); Assert.assertEquals(metrics.FOLD_90_BASE_PENALTY, 3.36, 0.01); Assert.assertTrue(Double.isNaN(metrics.FOLD_95_BASE_PENALTY)); } }

Target:
public void testSmallIntervals(final File input, final String reference_name, final String useFastAlgorithm) throws IOException { final File outfile = getTempOutputFile("testSmallIntervals", ".wgs_metrics"); final File ref = new File(reference_name); final File intervals = new File(TEST_DIR, "smallIntervals.interval_list"); final int sampleSize = 1000; final String[] args = { "INPUT=" + input.getAbsolutePath(), "OUTPUT=" + outfile.getAbsolutePath(), "REFERENCE_SEQUENCE=" + ref.getAbsolutePath(), "INTERVALS=" + intervals.getAbsolutePath(), "SAMPLE_SIZE=" + sampleSize, "COVERAGE_CAP=" + 40000, "USE_FAST_ALGORITHM=" + useFastAlgorithm }; Assert.assertEquals(runPicardCommandLine(args), 0); final MetricsFile<WgsMetrics, Comparable<?>> output = new MetricsFile<>(); try (FileReader reader = new FileReader(outfile)) { output.read(reader); } for (final WgsMetrics metrics : output.getMetrics()) { Assert.assertEquals(metrics.GENOME_TERRITORY, 1000); Assert.assertEquals(metrics.PCT_EXC_ADAPTER, 0D); Assert.assertEquals(metrics.PCT_EXC_MAPQ, 0.0); Assert.assertEquals(metrics.PCT_EXC_DUPE, 0.0); Assert.assertEquals(metrics.PCT_EXC_UNPAIRED, 0.0); Assert.assertEquals(metrics.MEAN_COVERAGE, 1727.6, .1); Assert.assertEquals(metrics.SD_COVERAGE, 695.68, 0.1); Assert.assertEquals(metrics.FOLD_80_BASE_PENALTY, 1.59, 0.01); Assert.assertEquals(metrics.FOLD_90_BASE_PENALTY, 3.36, 0.01); Assert.assertTrue(Double.isNaN(metrics.FOLD_95_BASE_PENALTY)); } }
Source:
public HostNetworkProviderModel() { getNetworkProviders().getSelectedItemChangedEvent().addListener((ev, sender, args) -> { Provider<OpenstackNetworkProviderProperties> provider = getNetworkProviders().getSelectedItem(); getNetworkProviderType().setIsAvailable(provider != null); getNetworkProviderType().setSelectedItem(provider == null ? null : provider.getType()); boolean isNeutron = getNetworkProviderType().getSelectedItem() == ProviderType.OPENSTACK_NETWORK || getNetworkProviderType().getSelectedItem() == ProviderType.EXTERNAL_NETWORK; getNeutronAgentModel().init(isNeutron && provider != null ? provider : new Provider<>(), getNetworkProviderType().getSelectedItem()); getNeutronAgentModel().setIsAvailable(isNeutron); }); getNetworkProviderType().setIsChangeable(false); getNetworkProviderType().setIsAvailable(false); getNeutronAgentModel().setIsAvailable(false); initNetworkProvidersList(); }

Target:
public HostNetworkProviderModel() { getNetworkProviders().getSelectedItemChangedEvent().addListener((ev, sender, args) -> { Provider<OpenstackNetworkProviderProperties> provider = getNetworkProviders().getSelectedItem(); boolean providerIsAvailable = provider != null; ProviderType providerType = providerIsAvailable ? provider.getType() : null; getNetworkProviderType().setIsAvailable(providerIsAvailable); getNetworkProviderType().setSelectedItem(providerType); getNeutronAgentModel().init(providerIsAvailable ? provider : new Provider<>(), providerType); getNeutronAgentModel().setIsAvailable(true); }); getNetworkProviderType().setIsChangeable(false); getNetworkProviderType().setIsAvailable(false); getNeutronAgentModel().setIsAvailable(false); initNetworkProvidersList(); }
Source:
public Construct exec(Target t, Environment env, Construct... args) throws ConfigRuntimeException { MCPlayer m = Static.GetPlayer(args[0].val(), t); int effect = Static.getInt32(args[1], t); if (effect < 1 || effect > m.getMaxEffect()) { throw new ConfigRuntimeException("Invalid effect ID recieved, must be from 1-" + m.getMaxEffect(), ExceptionType.RangeException, t); } int strength = Static.getInt32(args[2], t); int seconds = 30; boolean ambient = false; boolean particles = true; if (args.length >= 4) { seconds = Static.getInt32(args[3], t); } if (args.length == 5) { ambient = Static.getBoolean(args[4]); } if (args.length == 6) { particles = Static.getBoolean(args[5]); } Static.AssertPlayerNonNull(m, t); if (seconds == 0) { return CBoolean.get(m.removeEffect(effect)); } else { m.addEffect(effect, strength, seconds, ambient, particles, t); return CBoolean.TRUE; } }

Target:
public Construct exec(Target t, Environment env, Construct... args) throws ConfigRuntimeException { MCPlayer m = Static.GetPlayer(args[0].val(), t); int effect = Static.getInt32(args[1], t); if (effect < 1 || effect > m.getMaxEffect()) { throw new ConfigRuntimeException("Invalid effect ID recieved, must be from 1-" + m.getMaxEffect(), ExceptionType.RangeException, t); } int strength = Static.getInt32(args[2], t); int seconds = 30; boolean ambient = false; boolean particles = true; if (args.length >= 4) { seconds = Static.getInt32(args[3], t); } if (args.length >= 5) { ambient = Static.getBoolean(args[4]); } if (args.length == 6) { particles = Static.getBoolean(args[5]); } Static.AssertPlayerNonNull(m, t); if (seconds == 0) { return CBoolean.get(m.removeEffect(effect)); } else { m.addEffect(effect, strength, seconds, ambient, particles, t); return CBoolean.TRUE; } }
Source:
protected VdcReturnValueBase convertToVdcReturnValueBase(final VDSReturnValue vdsReturnValue) { VdcReturnValueBase returnValue = new VdcReturnValueBase(); returnValue.setSucceeded(false); returnValue.setActionReturnValue(vdsReturnValue.getReturnValue()); returnValue.setExecuteFailedMessages(new ArrayList<String>() {{ String failedMesssage = null; VDS vds = getVdsDAO().get(vdsReturnValue.getVdsError().getVdsId()); if (vds != null) { failedMesssage = vds.getName() + ":"; } add(failedMesssage == null ? vdsReturnValue.getVdsError().getMessage() : failedMesssage.concat(vdsReturnValue.getVdsError().getMessage())); }} ); return returnValue; }

Target:
protected VdcReturnValueBase convertToVdcReturnValueBase(final VDSReturnValue vdsReturnValue) { VdcReturnValueBase returnValue = new VdcReturnValueBase(); returnValue.setSucceeded(false); returnValue.setActionReturnValue(vdsReturnValue.getReturnValue()); returnValue.setExecuteFailedMessages(new ArrayList<String>() { { add(vdsReturnValue.getVdsError().getMessage()); } }); return returnValue; }
Source:
public Response getDeploymentCfg(@Context final Server server) { String workingDir = server.getConfiguration(MyriaSystemConfigKeys.WORKING_DIRECTORY); String description = server.getConfiguration(MyriaSystemConfigKeys.DESCRIPTION); String fileName = server.getConfiguration(MyriaSystemConfigKeys.DEPLOYMENT_FILE); String deploymentFile = workingDir + "/" + description + "-files" + "/" + description + "/" + fileName; return Response.ok(deploymentFile).build(); }

Target:
public Response getDeploymentCfg(@Context final Server server) { String workingDir = server.getConfiguration(MyriaSystemConfigKeys.WORKING_DIRECTORY); String description = server.getConfiguration(MyriaSystemConfigKeys.DESCRIPTION); String fileName = server.getConfiguration(MyriaSystemConfigKeys.DEPLOYMENT_FILE); String deploymentFile = workingDir + File.separatorChar + description + "-files" + File.separatorChar + description + File.separatorChar + fileName; return Response.ok(deploymentFile).build(); }
Source:
public void testGetPermissionsObjectWithChildren() throws Exception { indexObjectsInTripleStore(rootObj, workObj, fileObj, unitObj, collObj); MvcResult result = mvc.perform(get("/acl/getPermissions/" + uuid)) .andExpect(status().is2xxSuccessful()) .andReturn(); Map<String,Object> respMap = getMapFromResponse(result); assertRespMapHasRequiredFields(respMap, uuid); Map<String,Object> aclMap = (Map<String, Object>) respMap.get("accessControls"); assertHasCorrectAccessControls(aclMap, uuid); assertTrue(aclMap.containsKey("memberPermissions")); }

Target:
public void testGetPermissionsObjectWithChildren() throws Exception { indexObjectsInTripleStore(rootObj, workObj, fileObj, unitObj, collObj); MvcResult result = mvc.perform(get("/acl/getPermissions/" + uuid)) .andExpect(status().is2xxSuccessful()) .andReturn(); Map<String,Object> respMap = getMapFromResponse(result); assertRespMapHasRequiredFields(respMap, uuid); Map<String,Object> aclMap = (Map<String, Object>) respMap.get("accessControls"); assertHasCorrectAccessControls(aclMap, uuid); assertTrue(aclMap.containsKey("memberPermissions")); List<Map<String, Object>> memberPermissions = (List<Map<String, Object>>) aclMap.get("memberPermissions"); Map<String, Object> memPermsMap = memberPermissions.get(0); assertHasCorrectAccessControls(memPermsMap, fileObj.getPid().getId()); }
Source:
public void createTest() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); String groupName = "testGroup1"; groupRest.setName(groupName); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform(post("/api/eperson/groups") .content(mapper.writeValueAsBytes(groupRest)).contentType(contentType)) .andExpect(status().isCreated()) .andExpect(jsonPath("name", Matchers.containsString(groupName))); }

Target:
public void createTest() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); String groupName = "testGroup1"; groupRest.setName(groupName); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform(post("/api/eperson/groups") .content(mapper.writeValueAsBytes(groupRest)).contentType(contentType)) .andExpect(status().isCreated()); getClient(authToken).perform(get("/api/eperson/groups")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.groups", Matchers.containsInAnyOrder( GroupMatcher.matchGroupWithName(groupName), GroupMatcher.matchGroupWithName("Administrator"), GroupMatcher.matchGroupWithName("Anonymous")))); }
Source:
public List<Script> getScriptList(HttpServletRequest request) { final String type = (String) request.getAttribute("type"); this.path = getPath(request); this.path = stripExtension(this.path); org.geoserver.platform.resource.Resource dir = scriptMgr.script(path); List<Script> scripts = Lists.newArrayList(); if (dir != null) { Filter<Resource> filter = type != null ? new Filter<org.geoserver.platform.resource.Resource>() { @Override public boolean accept(org.geoserver.platform.resource.Resource pathname) { return type.equalsIgnoreCase(FilenameUtils.getExtension(pathname.name())); } } : new Filter<org.geoserver.platform.resource.Resource>() { @Override public boolean accept(org.geoserver.platform.resource.Resource pathname) { return true; } }; for (org.geoserver.platform.resource.Resource f : Resources.list(dir, filter)) { if (path.equals("apps")) { org.geoserver.platform.resource.Resource mainScript = scriptMgr.findAppMainScript(f); if (mainScript != null) { String name = mainScript.path().substring( f.parent().path().length() + 1).replace("\\", "/"); scripts.add(new Script(name)); } } else if (path.equals("wps")) { if (f.getType() == Type.DIRECTORY) { String namespace = f.name(); List<org.geoserver.platform.resource.Resource> files = f.list(); for(org.geoserver.platform.resource.Resource file: files) { String name = namespace + ":" + file.name(); scripts.add(new Script(name)); } } else { String name = f.name(); scripts.add(new Script(name)); } } else { String name = f.name(); scripts.add(new Script(name)); } } } else { } return scripts; }

Target:
public List<Script> getScriptList(HttpServletRequest request) { final String type = (String) request.getAttribute("type"); this.path = getPath(request); this.path = stripExtension(this.path); Resource dir = scriptMgr.script(path); List<Script> scripts = Lists.newArrayList(); if (dir != null) { Filter<Resource> filter = type != null ? new Filter<Resource>() { @Override public boolean accept(Resource pathname) { return type.equalsIgnoreCase(FilenameUtils.getExtension(pathname.name())); } } : new Filter<Resource>() { @Override public boolean accept(Resource pathname) { return true; } }; for (Resource f : Resources.list(dir, filter)) { if (path.equals("apps")) { Resource mainScript = scriptMgr.findAppMainScript(f); if (mainScript != null) { String name = mainScript.path().substring( f.parent().path().length() + 1).replace("\\", "/"); scripts.add(new Script(name)); } } else if (path.equals("wps")) { if (f.getType() == Type.DIRECTORY) { String namespace = f.name(); List<Resource> files = f.list(); for(Resource file: files) { String name = namespace + ":" + file.name(); scripts.add(new Script(name)); } } else { String name = f.name(); scripts.add(new Script(name)); } } else { String name = f.name(); scripts.add(new Script(name)); } } } return scripts; }
Source:
public boolean isConfigured() { return configured; }

Target:
protected boolean isConfigured() { return configured; }
Source:
public void readNewFeeds (int currentPage, int recentPage, String feedUrl) { int j = 0; FeedConfig[] newFeeds = new FeedConfig[recentPage - currentPage + 1]; String url = feedUrl.substring(0, feedUrl.lastIndexOf('/') + 1); for (int i = currentPage; i <= recentPage; i++) { newFeeds[j] = new FeedConfig(url + Integer.toString(i), "/([0-9a-f-]*)\\?"); j++; } this.setFeedConfigs(new FeedConfigs(new HashSet<>(Arrays.asList(newFeeds)))); }

Target:
public void readNewFeeds (int currentPage, int recentPage, String feedUrl) { List<FeedConfig> newFeeds = new ArrayList<>(); String url = feedUrl.substring(0, feedUrl.lastIndexOf('/') + 1); for (int i = currentPage; i <= recentPage; i++) { newFeeds.add(new FeedConfig(url + Integer.toString(i), "/([0-9a-f-]*)\\?")); } this.setFeedConfigs(new FeedConfigs(new HashSet<>(newFeeds))); }
Source:
public void close() { appenders.forEach(OutputStreamAppender::stop); }

Target:
void close() { appenders.forEach(OutputStreamAppender::stop); }
Source:
public void onFailed(Guid cmdId, List<Guid> childCmdIds) { getCommand(cmdId).onStopVmsFailed(); CommandCoordinatorUtil.removeAllCommandsInHierarchy(cmdId); }

Target:
public void onFailed(Guid cmdId, List<Guid> childCmdIds) { RemoveVmPoolCommand<? extends VmPoolParametersBase> cmd = getCommand(cmdId); CommandCoordinatorUtil.removeAllCommandsInHierarchy(cmdId); cmd.getParameters().setTaskGroupSuccess(false); cmd.endAction(); }
Source:
private void printPartitionRebalancingFully(Map<String, List<SupplyPartitionInfo>> supplyInfoMap) { if (hasPartitonToLog(supplyInfoMap, false)) { log.info("Partitions weren't present in any history reservation: [" + supplyInfoMap.entrySet().stream().map(entry -> "[grp=" + entry.getKey() + " part=[" + S.compact(entry.getValue().stream() .filter(info -> !info.isHistoryReserved()) .map(info -> info.part()).collect(Collectors.toSet())) + "]]" ).collect(Collectors.joining(", ")) + ']'); } if (hasPartitonToLog(supplyInfoMap, true)) { log.info("Partitions were reserved, but maximum available counter is greater than demanded: [" + supplyInfoMap.entrySet().stream().map(entry -> "[grp=" + entry.getKey() + ' ' + entry.getValue().stream().filter(SupplyPartitionInfo::isHistoryReserved).map(info -> "[part=" + info.part() + ", minCntr=" + info.minCntr() + ", maxReserved=" + info.maxReserved() + ", maxReservedNodeId=" + info.maxReservedNodeId() + ']' ).collect(Collectors.joining(", ")) + ']' ).collect(Collectors.joining(", ")) + ']'); } }

Target:
private void printPartitionRebalancingFully(Map<String, List<SupplyPartitionInfo>> supplyInfoMap) { try { if (hasPartitionToLog(supplyInfoMap, false)) { log.info("Partitions weren't present in any history reservation: [" + supplyInfoMap.entrySet().stream().map(entry -> "[grp=" + entry.getKey() + " part=[" + S.compact(entry.getValue().stream() .filter(info -> !info.isHistoryReserved()) .map(info -> info.part()).collect(Collectors.toSet())) + "]]" ).collect(Collectors.joining(", ")) + ']'); } if (hasPartitionToLog(supplyInfoMap, true)) { log.info("Partitions were reserved, but maximum available counter is greater than demanded: [" + supplyInfoMap.entrySet().stream().map(entry -> "[grp=" + entry.getKey() + ' ' + entry.getValue().stream().filter(SupplyPartitionInfo::isHistoryReserved).map(info -> "[part=" + info.part() + ", minCntr=" + info.minCntr() + ", maxReserved=" + info.maxReserved() + ", maxReservedNodeId=" + info.maxReservedNodeId() + ']' ).collect(Collectors.joining(", ")) + ']' ).collect(Collectors.joining(", ")) + ']'); } } catch (Exception e) { log.error("An error happened during printing partitions that have no history.", e); } }
Source:
public static boolean isInteger(Class<?> instanceClass) { if (instanceClass.isPrimitive()) { try { return Integer.class.getField(TYPE).get(null).equals(instanceClass) || Long.class.getField(TYPE).get(null).equals(instanceClass) || Short.class.getField(TYPE).get(null).equals(instanceClass); } catch (final IllegalArgumentException ex) { Activator.logException(ex); } catch (final SecurityException ex) { Activator.logException(ex); } catch (final IllegalAccessException ex) { Activator.logException(ex); } catch (final NoSuchFieldException ex) { Activator.logException(ex); } } else if (BigInteger.class.isAssignableFrom(instanceClass)) { return true; } else if (Integer.class.isAssignableFrom(instanceClass)) { return true; } else if (Long.class.isAssignableFrom(instanceClass)) { return true; } else if (Short.class.isAssignableFrom(instanceClass)) { return true; } return false; }

Target:
public static boolean isInteger(Class<?> instanceClass) { if (instanceClass.isPrimitive()) { try { return Integer.class.getField(TYPE).get(null).equals(instanceClass) || Long.class.getField(TYPE).get(null).equals(instanceClass) || Short.class.getField(TYPE).get(null).equals(instanceClass) || Byte.class.getField(TYPE).get(null).equals(instanceClass); } catch (final IllegalArgumentException ex) { Activator.logException(ex); } catch (final SecurityException ex) { Activator.logException(ex); } catch (final IllegalAccessException ex) { Activator.logException(ex); } catch (final NoSuchFieldException ex) { Activator.logException(ex); } } else if (BigInteger.class.isAssignableFrom(instanceClass)) { return true; } else if (Integer.class.isAssignableFrom(instanceClass)) { return true; } else if (Long.class.isAssignableFrom(instanceClass)) { return true; } else if (Short.class.isAssignableFrom(instanceClass)) { return true; } else if (Byte.class.isAssignableFrom(instanceClass)) { return true; } return false; }
Source:
public List<TrackInfo> getTrackInfo() { return isConnected() ? getImpl().getTracks() : null; }

Target:
public List<TrackInfo> getTrackInfo() { return getTracks(); }
Source:
public boolean getCheckValue(Iterable<T> items, SelectionModel selectionModel) { if (!items.iterator().hasNext()) { return false; } boolean allSelected = true; for (T entity : items) { if (!selectionModel.isSelected(entity)) { allSelected = false; } } return allSelected; }

Target:
public boolean getCheckValue(Iterable<T> items, SelectionModel selectionModel) { if (!items.iterator().hasNext()) { return false; } boolean allSelected = true; for (T entity : items) { if (!selectionModel.isSelected(entity)) { return false; } } return true; }
Source:
public void handleResponse(RestRequest restRequest, RestResponseChannel restResponseChannel, ReadableStreamChannel response, Exception exception) throws RestServiceException { if (isRunning()) { asyncHandlerWorker.handleResponse(restRequest, restResponseChannel, response, exception); } else { restServerMetrics.asyncRequestHandlerUnavailableError.inc(); throw new RestServiceException( "Requests cannot be handled because the AsyncRequestResponseHandler is not available", RestServiceErrorCode.ServiceUnavailable); } }

Target:
public void handleResponse(RestRequest restRequest, RestResponseChannel restResponseChannel, ReadableStreamChannel response, Exception exception) throws RestServiceException { if (isRunning()) { asyncHandlerWorker.submitResponse(restRequest, restResponseChannel, response, exception); } else { restServerMetrics.asyncRequestHandlerUnavailableError.inc(); throw new RestServiceException( "Requests cannot be handled because the AsyncRequestResponseHandler is not available", RestServiceErrorCode.ServiceUnavailable); } }
Source:
private static MailmapResult parseNameAndEmail(String line, boolean allowEmptyEmail) { int left, right; left = line.indexOf("<"); if (left == -1) { return null; } right = line.indexOf(">", left + 1); if (right == -1) { return null; } if (!allowEmptyEmail && (left + 1 == right)) { return null; } String name = left == 0 ? null : line.substring(0, left - 1).trim(); String email = line.substring(left + 1, right); return new MailmapResult(name, email, line.substring(right + 1).trim()); }

Target:
private static MailmapResult parseNameAndEmail(String line, boolean allowEmptyEmail) { int left, right; left = line.indexOf('<'); if (left == -1) { return null; } right = line.indexOf('>', left + 1); if (right == -1) { return null; } if (!allowEmptyEmail && (left + 1 == right)) { return null; } String name = left == 0 ? null : line.substring(0, left - 1).trim(); String email = line.substring(left + 1, right); return new MailmapResult(name, email, line.substring(right + 1).trim()); }
Source:
public boolean isExecutable() { return getModelObject() != null && getModelObject().getId() != null; }

Target:
public boolean isExecutable() { IReview review = ((ReviewDetailSection) getContext()).getReview(); ReviewStatus currentStatus = review.getState(); return getModelObject() != null && getModelObject().getId() != null && currentStatus != ReviewStatus.ABANDONED && currentStatus != ReviewStatus.MERGED; }
Source:
public ArrayLiteralTreeImpl newArrayLiteralWithElements(Optional<List<InternalSyntaxToken>> commaTokens, ExpressionTree element, Optional<List<Tuple<List<InternalSyntaxToken>, ExpressionTree>>> restElements, Optional<List<InternalSyntaxToken>> restCommas ) { List<Tree> elementsAndCommas = Lists.newArrayList(); if (commaTokens.isPresent()) { for (InternalSyntaxToken comma : commaTokens.get()) { elementsAndCommas.add(comma); } } elementsAndCommas.add(element); if (restElements.isPresent()) { for (Tuple<List<InternalSyntaxToken>, ExpressionTree> t : restElements.get()) { elementsAndCommas.add(t.first().get(0)); t.first().remove(0); for (InternalSyntaxToken comma : t.first()) { elementsAndCommas.add(comma); } elementsAndCommas.add(t.second()); } } if (restCommas.isPresent()) { int nbEndingComma = restCommas.get().size(); elementsAndCommas.add(restCommas.get().get(0)); if (nbEndingComma > 1) { for (InternalSyntaxToken comma : restCommas.get().subList(1, nbEndingComma)) { elementsAndCommas.add(comma); } } } return new ArrayLiteralTreeImpl(elementsAndCommas); }

Target:
public ArrayLiteralTreeImpl newArrayLiteralWithElements(Optional<List<InternalSyntaxToken>> commaTokens, ExpressionTree element, Optional<List<Tuple<List<InternalSyntaxToken>, ExpressionTree>>> restElements, Optional<List<InternalSyntaxToken>> restCommas ) { List<Tree> elementsAndCommas = Lists.newArrayList(); if (commaTokens.isPresent()) { elementsAndCommas.addAll(commaTokens.get()); } elementsAndCommas.add(element); if (restElements.isPresent()) { for (Tuple<List<InternalSyntaxToken>, ExpressionTree> t : restElements.get()) { elementsAndCommas.addAll(t.first()); elementsAndCommas.add(t.second()); } } if (restCommas.isPresent()) { elementsAndCommas.addAll(restCommas.get()); } return new ArrayLiteralTreeImpl(elementsAndCommas); }
Source:
protected int writePOJO(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { String formatString = null; if ( options!=null ) formatString = options[Option.FORMAT.ordinal()]; AttributeRenderer<? super Object> r = scope.st.impl.nativeGroup.getAttributeRenderer(o.getClass()); String v; if ( r!=null ) v = r.toString(o, formatString, locale); else v = o.toString(); int n; if ( options!=null && options[Option.WRAP.ordinal()]!=null ) { n = out.write(v, options[Option.WRAP.ordinal()]); } else { n = out.write(v); } return n; }

Target:
protected int writePOJO(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException { String formatString = null; if ( options!=null ) formatString = options[Option.FORMAT.ordinal()]; String v = renderObject(scope, formatString, o, o.getClass()); int n; if ( options!=null && options[Option.WRAP.ordinal()]!=null ) { n = out.write(v, options[Option.WRAP.ordinal()]); } else { n = out.write(v); } return n; }
Source:
public void processMatcher(ViatraQueryMatcher<?> matcher, QueryEvaluationHint hint) throws ViatraQueryException, QueryProcessingException { if (hint.getQueryBackendFactory() instanceof ReteBackendFactory) { ReteNetworkTrace trace = new ReteNetworkTrace(matcher, traceCollector); CoverageInfo<Node> reteCoverage = new ReteCoverage(matcher).reteCoverage(); CoverageInfo<PTraceable> newCoverage = trace.traceCoverage(matcher, reteCoverage); coverage = coverage.mergeWith(newCoverage); } }

Target:
public void processMatcher(ViatraQueryMatcher<?> matcher, QueryEvaluationHint hint) throws ViatraQueryException, QueryProcessingException { if (matcher instanceof BaseMatcher) { BaseMatcher<?> baseMatcher = (BaseMatcher<?>) matcher; if (baseMatcher.getCapabilities() instanceof IncrementalMatcherCapability) { ReteNetworkTrace trace = new ReteNetworkTrace(matcher, traceCollector); CoverageInfo<Node> reteCoverage = new ReteCoverage(matcher).reteCoverage(); CoverageInfo<PTraceable> newCoverage = trace.traceCoverage(matcher, reteCoverage); coverage = coverage.mergeWith(newCoverage); } } }
Source:
public Collection<GrantedAuthority> getAuthorities() { List<GrantedAuthority> roles = new ArrayList<>(1); roles.add(new SimpleGrantedAuthority(getUser().getRole().getShortName())); return roles; }

Target:
public Collection<GrantedAuthority> getAuthorities() { return ImmutableList.of(new SimpleGrantedAuthority(getUser().getRole().getShortName())); }