auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public final synchronized BoundedSource<ResultOutputType> splitAtFraction(double fraction) { ByteKey splitKey; final ByteKeyRange range = source.getConfiguration().toByteKeyRange(); try { splitKey = range.interpolateKey(fraction); } catch (IllegalArgumentException e) { READER_LOG.info("%s: Failed to interpolate key for fraction %s.", range, fraction); return null; } READER_LOG.debug("Proposing to split at fraction (key {})", rangeTracker, fraction, splitKey); if (!rangeTracker.trySplitAtPosition(splitKey)) { return null; } long estimatedSizeBytes = -1; try { estimatedSizeBytes = source.getEstimatedSizeBytes(null); } catch (IOException e) { READER_LOG.info("%s: Failed to get estimated size for key for fraction %s.", range, fraction); return null; } long newEstimatedSize = (long) (fraction * estimatedSizeBytes); byte[] splitKeyBytes = splitKey.getBytes(); SourceWithKeys<ResultOutputType> residual = source.createSourceWithKeys(splitKeyBytes, source.getConfiguration().getZeroCopyStopRow(), estimatedSizeBytes - newEstimatedSize); this.source = this.source.createSourceWithKeys( source.getConfiguration().getZeroCopyStartRow(), splitKeyBytes, newEstimatedSize); return residual; }

Target:
public final synchronized BoundedSource<ResultOutputType> splitAtFraction(double fraction) { ByteKey splitKey; final ByteKeyRange range = source.getConfiguration().toByteKeyRange(); try { splitKey = range.interpolateKey(fraction); } catch (IllegalArgumentException e) { READER_LOG.info("{}: Failed to interpolate key for fraction {}.", range, fraction); return null; } READER_LOG.debug("Proposing to split at fraction (key {})", rangeTracker, fraction, splitKey); long estimatedSizeBytes = -1; try { estimatedSizeBytes = source.getEstimatedSizeBytes(null); } catch (IOException e) { READER_LOG.info("{}: Failed to get estimated size for key for fraction {}.", range, fraction); return null; } long newEstimatedSize = (long) (fraction * estimatedSizeBytes); byte[] splitKeyBytes = splitKey.getBytes(); SourceWithKeys<ResultOutputType> residual = source.createSourceWithKeys(splitKeyBytes, source.getConfiguration().getZeroCopyStopRow(), estimatedSizeBytes - newEstimatedSize); SourceWithKeys<ResultOutputType> primary = this.source.createSourceWithKeys( source.getConfiguration().getZeroCopyStartRow(), splitKeyBytes, newEstimatedSize); if (!rangeTracker.trySplitAtPosition(splitKey)) { return null; } this.source = primary; return residual; }
Source:
private T getLiveValue() { for (Option option : options) { if (Boolean.TRUE.equals(option.observable.getValue())) return option.value; } return null; }

Target:
private T getLiveValue() { for (Option option : options) { if (option.observable.getValue()) return option.value; } return null; }
Source:
private PostActionParameterObject getPostActionParameter(String objectId, String objectKey) { for (PostActionParameterObject postActionParameterObject : postActionParameters) { if (postActionParameterObject.getObjectId().equals(objectId) && postActionParameterObject.getObjectKey().equals(objectKey)) { return postActionParameterObject; } } return null; }

Target:
private PostActionParameterObject getPostActionParameter(String objectId, String objectKey) { for (PostActionParameterObject postActionParameterObject : postActionParameters) { if (StringUtils.equals(postActionParameterObject.getObjectId(), objectId) && StringUtils.equals(postActionParameterObject.getObjectKey(), objectKey)) { return postActionParameterObject; } } return null; }
Source:
TableStructureAdapter of(ObjList<CharSequence> names, ObjList<TypeAdapter> types) { this.names = names; this.types = types; timestampIndex = names.indexOf(timestampIndexCol); return this; }

Target:
TableStructureAdapter of(ObjList<CharSequence> names, ObjList<TypeAdapter> types) throws TextException { this.names = names; this.types = types; if (timestampIndexCol == null) { timestampIndex = -1; } else { timestampIndex = names.indexOf(timestampIndexCol); if (timestampIndex == -1) { throw TextException.$("invalid timestamp column '").put(timestampIndexCol).put('\''); } if (types.getQuick(timestampIndex).getType() != ColumnType.TIMESTAMP) { throw TextException.$("not a timestamp '").put(timestampIndexCol).put('\''); } } return this; }
Source:
private void createDefaultPanels() { GlobalConfig globalConfig = new GlobalConfig(); PanelInfo test1 = new PanelInfo(); PanelInfo test2 = new PanelInfo(); PanelInfo test3 = new PanelInfo(); List<PanelInfo> panels = new ArrayList<>(); panels.add(test1); panels.add(test2); panels.add(test3); globalConfig.setPanelInfo(panels); ConfigFile globalConfigFile = new ConfigFile(Preferences.DIRECTORY, Preferences.TEST_SESSION_CONFIG_FILENAME); globalConfigFile.saveConfig(globalConfig); }

Target:
private void createDefaultPanels() { Preferences prefs = TestController.createTestPreferences(); PanelInfo test1 = new PanelInfo(); PanelInfo test2 = new PanelInfo(); PanelInfo test3 = new PanelInfo(); List<PanelInfo> panels = new ArrayList<>(); panels.add(test1); panels.add(test2); panels.add(test3); prefs.setPanelInfo(panels); }
Source:
public void handleRequirement(String rowValue, RoughArtifact roughArtifact) { StringBuffer imageFileList = new StringBuffer(""); getImageList(rowValue, imageFileList); rowValue = normalizeHtml(rowValue); String imageFile = imageFileList.toString(); if (!imageFile.isEmpty()) { String theImage; int comma = 0; int imageNumber = 0; do { String replaceName = ""; comma = imageFile.indexOf(','); if (comma == -1) { theImage = uriDirectoryName + imageFile; replaceName = imageFile; imageFile = " "; } else { theImage = uriDirectoryName + imageFile.substring(0, comma); replaceName = imageFile.substring(0, comma); imageFile = imageFile.substring(comma + 1); } try { URI imageURI = new URI(theImage); roughArtifact.addAttribute(CoreAttributeTypes.ImageContent.getName(), imageURI); rowValue = rowValue.replace(replaceName, IMAGE_BASE_NAME + Integer.toString(imageNumber)); imageNumber++; postProcessGuids.add(roughArtifact.getGuid()); } catch (URISyntaxException e) { e.printStackTrace(); } } while (comma != -1); } if (Strings.isValid(rowValue)) { roughArtifact.addAttribute(CoreAttributeTypes.HTMLContent, rowValue); } }

Target:
public void handleRequirement(String rowValue, RoughArtifact roughArtifact) { StringBuffer imageFileList = new StringBuffer(""); appendToImageList(rowValue, imageFileList); rowValue = normalizeHtml(rowValue); String imageFile = imageFileList.toString(); if (!imageFile.isEmpty()) { String theImage; int comma = 0; int imageNumber = 0; do { String replaceName = ""; comma = imageFile.indexOf(','); if (comma == -1) { theImage = uriDirectoryName + imageFile; replaceName = imageFile; imageFile = " "; } else { theImage = uriDirectoryName + imageFile.substring(0, comma); replaceName = imageFile.substring(0, comma); imageFile = imageFile.substring(comma + 1); } try { URI imageURI = new URI(theImage); roughArtifact.addAttribute(CoreAttributeTypes.ImageContent.getName(), imageURI); rowValue = rowValue.replace(replaceName, IMAGE_BASE_NAME + Integer.toString(imageNumber)); imageNumber++; postProcessGuids.add(roughArtifact.getGuid()); } catch (URISyntaxException e) { if (logger != null) { logger.log(e); } } } while (comma != -1); } if (Strings.isValid(rowValue)) { roughArtifact.addAttribute(CoreAttributeTypes.HTMLContent, rowValue); } }
Source:
private Iterable<SAMRecord> getSortedRecordsFromReader(final SamReader reader) { if (reader.getFileHeader().getSortOrder() == SAMFileHeader.SortOrder.queryname) { return reader; } log.info("Input file isn't queryname sorted. Sorting into temp space."); final Path[] tmpPaths = TMP_DIR.stream() .map(File::toPath) .toArray(Path[]::new); final ProgressLogger sortProgress = new ProgressLogger(log, (int) 1e6, "Read into sorter"); final SortingCollection<SAMRecord> alignmentSorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(reader.getFileHeader()), new SAMRecordQueryNameComparator(), MAX_RECORDS_IN_RAM, tmpPaths); for (final SAMRecord rec : reader) { alignmentSorter.add(rec); sortProgress.record(rec); } return alignmentSorter; }

Target:
private Iterator<SAMRecord> getSortedRecordsFromReader(final SamReader reader) { if (reader.getFileHeader().getSortOrder() == SAMFileHeader.SortOrder.queryname) { return reader.iterator(); } log.info("Input file isn't queryname sorted. Sorting into temp space."); final ProgressLogger sortProgress = new ProgressLogger(log, (int) 1e6, "Read into sorter"); final SortingCollection<SAMRecord> alignmentSorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(reader.getFileHeader()), new SAMRecordQueryNameComparator(), MAX_RECORDS_IN_RAM); for (final SAMRecord rec : reader) { alignmentSorter.add(rec); sortProgress.record(rec); } final CloseableIterator<SAMRecord> iterator = alignmentSorter.iterator(); alignmentSorter.cleanup(); return iterator; }
Source:
public void withdrawPatchForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1").build(); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .build(); String token = getAuthToken(eperson.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/withdrawn", "true"); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isForbidden()); String tokenAdmin = getAuthToken(eperson.getEmail(), password); getClient(tokenAdmin).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.withdrawn", Matchers.is(false))) .andExpect(jsonPath("$.inArchive", Matchers.is(true))); }

Target:
public void withdrawPatchForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1").build(); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .build(); String token = getAuthToken(eperson.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/withdrawn", true); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isForbidden()); String tokenAdmin = getAuthToken(eperson.getEmail(), password); getClient(tokenAdmin).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.withdrawn", Matchers.is(false))) .andExpect(jsonPath("$.inArchive", Matchers.is(true))); }
Source:
public void testMixClass() throws Exception { final Injector injector = Guice.createInjector( new AbstractModule() { @Override protected void configure() }); final MixClass i1 = injector.getInstance(MixClass.class); final MixClass i2 = injector.getInstance(MixClass.class); assertSame(i1, i2); }

Target:
public void testMixClass() { final Injector injector = Guice.createInjector(); final MixClass i1 = injector.getInstance(MixClass.class); final MixClass i2 = injector.getInstance(MixClass.class); assertSame(i1, i2); }
Source:
protected void updateTab(CTabItem cti, MPart part, String attName, Object newValue) { if (UIEvents.UILabel.LABEL.equals(attName)) { String newName = (String) newValue; cti.setText(getLabel(part, newName)); } else if (UIEvents.UILabel.ICONURI.equals(attName)) { cti.setImage(getImage(part)); } else if (UIEvents.UILabel.TOOLTIP.equals(attName)) { String newTTip = (String) newValue; cti.setToolTipText(newTTip); } else if (UIEvents.Dirtyable.DIRTY.equals(attName)) { Boolean dirtyState = (Boolean) newValue; String text = cti.getText(); boolean hasAsterisk = text.length() > 0 && text.charAt(0) == '*'; if (dirtyState.booleanValue()) { if (!hasAsterisk) { cti.setText('*' + text); } } else if (hasAsterisk) { cti.setText(text.substring(1)); } } else if (UIEvents.UILifeCycle.BUSY.equals(attName)) { updateBusyIndicator(cti, part, (Boolean) newValue); } }

Target:
protected void updateTab(CTabItem cti, MPart part, String attName, Object newValue) { if (UIEvents.UILabel.LABEL.equals(attName)) { String newName = (String) newValue; cti.setText(getLabel(part, newName)); } else if (UIEvents.UILabel.ICONURI.equals(attName)) { cti.setImage(getImage(part)); } else if (UIEvents.UILabel.TOOLTIP.equals(attName)) { String newTTip = (String) newValue; cti.setToolTipText(newTTip); } else if (UIEvents.Dirtyable.DIRTY.equals(attName)) { Boolean dirtyState = (Boolean) newValue; String text = cti.getText(); boolean hasAsterisk = text.length() > 0 && text.charAt(0) == '*'; if (dirtyState.booleanValue()) { if (!hasAsterisk) { cti.setText('*' + text); } } else if (hasAsterisk) { cti.setText(text.substring(1)); } } else if (UIEvents.UILifeCycle.BUSY.equals(attName)) { setCSSInfo(part, cti); reapplyStyles(cti); } }
Source:
private boolean lockRoot(DecisionMaker<? super V> decisionMaker, RootReference rootReference, int attempt, int contention) { boolean success = lockRoot(rootReference); if (!success) { decisionMaker.reset(); if(attempt > 4) { if (attempt <= 24) { Thread.yield(); } else { try { Thread.sleep(0, 100 / contention + 50); } catch (InterruptedException ignore) { } } } } return success; }

Target:
private boolean lockRoot(DecisionMaker<? super V> decisionMaker, RootReference rootReference, int attempt, int contention) { boolean success = lockRoot(rootReference); if (!success) { decisionMaker.reset(); if(attempt > 4) { if (attempt <= 24) { Thread.yield(); } else { try { Thread.sleep(0, 100 / contention + 50); } catch (InterruptedException ex) { throw new RuntimeException(ex); } } } } return success; }
Source:
public Map<Integer, GermplasmPedigreeTreeNode> getDirectParentsForStudy(final int studyId) { final GermplasmDAO dao = this.getGermplasmDao(); final Map<Integer, Map<GermplasmNameType, Name>> namesMap = dao.getGermplasmParentNamesForStudy(studyId); final List<Germplasm> germs = dao.getGermplasmParentsForStudy(studyId); final Map<Integer, GermplasmPedigreeTreeNode> germNodes = new HashMap<>(); for (final Germplasm germ : germs) { final GermplasmPedigreeTreeNode root = new GermplasmPedigreeTreeNode(); root.setGermplasm(germ); final List<GermplasmPedigreeTreeNode> parents = new ArrayList<>(); Map<GermplasmNameType, Name> names = namesMap.get(germ.getGpid1()); final GermplasmPedigreeTreeNode femaleNode = createGermplasmPedigreeTreeNode(germ.getGpid1(), names); names = namesMap.get(germ.getGpid2()); final GermplasmPedigreeTreeNode maleNode = createGermplasmPedigreeTreeNode(germ.getGpid2(), names); parents.add(femaleNode); parents.add(maleNode); root.setLinkedNodes(parents); germNodes.put(germ.getGid(), root); } return germNodes; }

Target:
public Map<Integer, GermplasmPedigreeTreeNode> getDirectParentsForStudy(final int studyId) { final GermplasmDAO dao = this.getGermplasmDao(); final Map<Integer, Map<GermplasmNameType, Name>> namesMap = dao.getGermplasmParentNamesForStudy(studyId); final List<Germplasm> germs = dao.getGermplasmParentsForStudy(studyId); final Map<Integer, GermplasmPedigreeTreeNode> germNodes = new HashMap<>(); for (final Germplasm germ : germs) { final GermplasmPedigreeTreeNode root = new GermplasmPedigreeTreeNode(); root.setGermplasm(germ); Map<GermplasmNameType, Name> names = namesMap.get(germ.getGpid1()); final GermplasmPedigreeTreeNode femaleNode = createGermplasmPedigreeTreeNode(germ.getGpid1(), names); names = namesMap.get(germ.getGpid2()); final GermplasmPedigreeTreeNode maleNode = createGermplasmPedigreeTreeNode(germ.getGpid2(), names); root.setFemaleParent(femaleNode); root.setMaleParent(maleNode); if (femaleNode != null) { root.getLinkedNodes().add(femaleNode); } if (maleNode != null) { root.getLinkedNodes().add(maleNode); } germNodes.put(germ.getGid(), root); } return germNodes; }
Source:
private void lookupRenderers(String defaultUUID) { Collection<SyncBeanDef<RendererLibrary>> beanDefs = beanManager.lookupBeans(RendererLibrary.class); if (defaultUUID != null && ! defaultUUID.isEmpty()) { beanDefs.stream() .map(SyncBeanDef::getInstance) .filter(render -> render.getUUID().equals(defaultUUID)) .findFirst().ifPresent(rend -> rend.getSupportedTypes().forEach(c -> renderersDefault.put(c, rend)) ); } for (SyncBeanDef<RendererLibrary> beanDef : beanDefs) { RendererLibrary lib = beanDef.getInstance(); renderersList.add(lib); for (DisplayerType displayerType : DisplayerType.values()) { if (lib.isDefault(displayerType)) { renderersDefault.putIfAbsent(displayerType, lib); } } List<DisplayerType> types = lib.getSupportedTypes(); if (types != null && !types.isEmpty()) { for (DisplayerType type : types) { List<RendererLibrary> set = renderersByType.get(type); if (set == null) { set = new ArrayList<>(); renderersByType.put(type, set); } set.add(lib); List<DisplayerSubType> subTypes = lib.getSupportedSubtypes(type); if (subTypes != null && !subTypes.isEmpty()) { for (DisplayerSubType subType : subTypes) { List<RendererLibrary> subset = renderersBySubType.get(subType); if (subset == null) { subset = new ArrayList<>(); renderersBySubType.put(subType, subset); } subset.add(lib); } } } } } }

Target:
protected void lookupRenderers(String defaultUUID) { Collection<SyncBeanDef<RendererLibrary>> beanDefs = beanManager.lookupBeans(RendererLibrary.class); if (defaultUUID != null && ! defaultUUID.isEmpty()) { beanDefs.stream() .map(SyncBeanDef::getInstance) .filter(render -> render.getUUID().equals(defaultUUID)) .findFirst().ifPresent(rend -> rend.getSupportedTypes().forEach(c -> renderersDefault.put(c, rend)) ); } for (SyncBeanDef<RendererLibrary> beanDef : beanDefs) { RendererLibrary lib = beanDef.getInstance(); renderersList.add(lib); for (DisplayerType displayerType : DisplayerType.values()) { if (lib.isDefault(displayerType)) { renderersDefault.putIfAbsent(displayerType, lib); } } List<DisplayerType> types = lib.getSupportedTypes(); if (types != null && !types.isEmpty()) { for (DisplayerType type : types) { List<RendererLibrary> set = renderersByType.get(type); if (set == null) { set = new ArrayList<>(); renderersByType.put(type, set); } set.add(lib); List<DisplayerSubType> subTypes = lib.getSupportedSubtypes(type); if (subTypes != null && !subTypes.isEmpty()) { for (DisplayerSubType subType : subTypes) { List<RendererLibrary> subset = renderersBySubType.get(subType); if (subset == null) { subset = new ArrayList<>(); renderersBySubType.put(subType, subset); } subset.add(lib); } } } } } }
Source:
private void addOsTypes(VersionCaps version) { version.setOsTypes(new OsTypes()); version.getOsTypes().getOsTypes().addAll(OsTypeUtils.getAllValues()); }

Target:
private void addOsTypes(VersionCaps version) { version.setOsTypes(new OsTypes()); if (VersionUtils.greaterOrEqual(version, VERSION_3_3)) { version.getOsTypes().getOsTypes().addAll(OsTypeUtils.getAllValues()); } else { for (OsType type : OsType.values()) { version.getOsTypes().getOsTypes().add(type.name()); } } }
Source:
private IMember[] getMembersToDelete(final IProgressMonitor monitor) throws JavaModelException { try { final IMember[] typesToDelete= getMembers(fMembersToMove, IJavaElement.TYPE); final IMember[] matchingElements= getMatchingElements(monitor, false); final IMember[] matchingFields= getMembers(matchingElements, IJavaElement.FIELD); List<IMember> toDelete= new ArrayList<>(); IMember[] all= JavaElementUtil.merge(matchingFields, typesToDelete); for(IMember member : all) { for(IMember moveMember : fMembersToMove) { if(member.equals(moveMember)) { toDelete.add(moveMember); } } } return JavaElementUtil.merge(toDelete.toArray(new IMember[0]), fDeletedMethods); } finally { monitor.done(); } }

Target:
private IMember[] getMembersToDelete(final IProgressMonitor monitor) throws JavaModelException { try { final IMember[] typesToDelete= getMembers(fMembersToMove, IJavaElement.TYPE); final IMember[] matchingElements= getMatchingElements(monitor, false); final IMember[] matchingFields= getMembers(matchingElements, IJavaElement.FIELD); List<IMember> toDelete= new ArrayList<>(); IMember[] all= JavaElementUtil.merge(matchingFields, typesToDelete); toDelete.addAll(Arrays.asList(fMembersToMove)); toDelete.retainAll(Arrays.asList(all)); return JavaElementUtil.merge(toDelete.toArray(new IMember[0]), fDeletedMethods); } finally { monitor.done(); } }
Source:
private void addNetworkSecurityGroup() { int ports[] = options.getInboundPorts(); if ((ports != null) && (ports.length > 0)) { variables.put("networkSecurityGroupName", name + "nsg"); variables.put("networkSecurityGroupNameReference", "[resourceId('Microsoft.Network/networkSecurityGroups',variables('networkSecurityGroupName'))]"); List<NetworkSecurityRule> rules = new ArrayList<NetworkSecurityRule>(); for (int i = 0; i < ports.length; i++) { NetworkSecurityRuleProperties ruleProperties = NetworkSecurityRuleProperties.builder() .description("default-allow-port-" + ports[i]) .protocol(NetworkSecurityRuleProperties.Protocol.All) .access(NetworkSecurityRuleProperties.Access.Allow) .sourcePortRange("*") .destinationPortRange("*") .sourceAddressPrefix("*") .destinationAddressPrefix("*") .priority(1234 + i) .direction(NetworkSecurityRuleProperties.Direction.Inbound) .build(); NetworkSecurityRule networkSecurityRule = NetworkSecurityRule.create( "default-allow-port-" + ports[i], null, null, ruleProperties); rules.add(networkSecurityRule); } NetworkSecurityGroupProperties networkSecurityGroupProperties = NetworkSecurityGroupProperties.builder() .securityRules(rules) .build(); ResourceDefinition networkSecurityGroup = ResourceDefinition.builder() .name("[variables('networkSecurityGroupName')]") .type("Microsoft.Network/networkSecurityGroups").location(location) .apiVersion(STORAGE_API_VERSION) .properties(networkSecurityGroupProperties) .build(); resources.add(networkSecurityGroup); } }

Target:
private void addNetworkSecurityGroup() { int ports[] = options.getInboundPorts(); if ((ports != null) && (ports.length > 0)) { variables.put("networkSecurityGroupName", name + "nsg"); variables.put("networkSecurityGroupNameReference", "[resourceId('Microsoft.Network/networkSecurityGroups',variables('networkSecurityGroupName'))]"); List<NetworkSecurityRule> rules = new ArrayList<NetworkSecurityRule>(); for (int i = 0; i < ports.length; i++) { NetworkSecurityRuleProperties ruleProperties = NetworkSecurityRuleProperties.builder() .description("default-allow-port-" + ports[i]) .protocol(NetworkSecurityRuleProperties.Protocol.All) .access(NetworkSecurityRuleProperties.Access.Allow) .sourcePortRange("*") .destinationPortRange(Integer.toString(ports[i])) .sourceAddressPrefix("*") .destinationAddressPrefix("*") .priority(1234 + i) .direction(NetworkSecurityRuleProperties.Direction.Inbound) .build(); NetworkSecurityRule networkSecurityRule = NetworkSecurityRule.create( "default-allow-port-" + ports[i], null, null, ruleProperties); rules.add(networkSecurityRule); } NetworkSecurityGroupProperties networkSecurityGroupProperties = NetworkSecurityGroupProperties.builder() .securityRules(rules) .build(); ResourceDefinition networkSecurityGroup = ResourceDefinition.builder() .name("[variables('networkSecurityGroupName')]") .type("Microsoft.Network/networkSecurityGroups").location(location) .apiVersion(STORAGE_API_VERSION) .properties(networkSecurityGroupProperties) .build(); resources.add(networkSecurityGroup); } }
Source:
private long heartbeatTimeoutPeriod() { return heartbeatInterval + heartbeatInterval / 5; }

Target:
private long heartbeatTimeoutPeriod() { return heartbeatInterval + HEARTBEAT_GRACE_PERIOD; }
Source:
public <T> LinkedHashSet<T> loadJavaServices(Class<T> serviceContract) { LinkedHashSet<T> services = new LinkedHashSet<T>( hibernateClassLoaderService.loadJavaServices( serviceContract ) ); if ( services.size() == 0 ) { services = internalClassLoaderService.loadJavaServices( serviceContract ); } return services; }

Target:
public <T> LinkedHashSet<T> loadJavaServices(Class<T> serviceContract) { LinkedHashSet<T> servicesFromORMCLassLoader = new LinkedHashSet<T>( hibernateClassLoaderService.loadJavaServices( serviceContract ) ); LinkedHashSet<T> services = new LinkedHashSet<T>( internalClassLoaderService.loadJavaServices( serviceContract ) ); for ( T serviceInstance : servicesFromORMCLassLoader ) { if ( !contains( services, serviceInstance ) ) { services.add( serviceInstance ); } } return services; }
Source:
public InFormExpressionCacher expressionCacher() { return expressionCacher; }

Target:
public ExpressionCacher expressionCacher() { return expressionCacher; }
Source:
public void setInBatchMode(boolean inBatchMode) { this.inBatchMode = inBatchMode; }

Target:
protected void setInBatchMode(boolean inBatchMode) { this.inBatchMode = inBatchMode; }
Source:
public void testPushForMasterWithHashtags() throws GitAPIException, OrmException, IOException, RestApiException { if (!notesMigration.enabled()) { return; } String hashtag1 = "tag1"; List<String> expected = Arrays.asList(hashtag1); PushOneCommit.Result r = pushTo("refs/for/master%hashtag=" + hashtag1); r.assertOkStatus(); r.assertChange(Change.Status.NEW, null); String changeId = r.getChangeId(); RestResponse response = adminSession.get("/changes/" + changeId + "/hashtags/"); assertResultList(response, expected); String hashtag2 = "tag2"; expected = Arrays.asList(hashtag1, hashtag2); r = pushTo("refs/for/master%hashtag=" + hashtag1 + ",hashtag=" + hashtag2); r.assertOkStatus(); r.assertChange(Change.Status.NEW, null); changeId = r.getChangeId(); response = adminSession.get("/changes/" + changeId + "/hashtags/"); assertResultList(response, expected); }

Target:
public void testPushForMasterWithHashtags() throws GitAPIException, OrmException, IOException, RestApiException { assumeThat(notesMigration.enabled(), is(true)); String hashtag1 = "tag1"; List<String> expected = Arrays.asList(hashtag1); PushOneCommit.Result r = pushTo("refs/for/master%hashtag=" + hashtag1); r.assertOkStatus(); r.assertChange(Change.Status.NEW, null); String changeId = r.getChangeId(); RestResponse response = adminSession.get("/changes/" + changeId + "/hashtags/"); assertResultList(response, expected); String hashtag2 = "tag2"; expected = Arrays.asList(hashtag1, hashtag2); r = pushTo("refs/for/master%hashtag=" + hashtag1 + ",hashtag=" + hashtag2); r.assertOkStatus(); r.assertChange(Change.Status.NEW, null); changeId = r.getChangeId(); response = adminSession.get("/changes/" + changeId + "/hashtags/"); assertResultList(response, expected); }
Source:
public boolean chkAuthorizationByRole(String userName, String[] userRoles) throws QuadrigaStorageException, QuadrigaAccessException { ArrayList<String> roles; boolean haveAccess = false; haveAccess = wsSecurityManager.checkIsWorkspaceAssociated(userName); if (!haveAccess) { if (userRoles.length > 0) { roles = getAccessRoleList(userRoles); for (String role : roles) { haveAccess = wsSecurityManager.chkIsCollaboratorWorkspaceAssociated(userName, role); if (haveAccess) break; } } } return haveAccess; }

Target:
public boolean chkAuthorizationByRole(String userName, String[] userRoles) throws QuadrigaStorageException, QuadrigaAccessException { if (wsSecurityManager.checkIsWorkspaceAssociated(userName)) { return true; } else { if (userRoles.length > 0) { List<String> roles = Arrays.asList(userRoles); for (String role : roles) { if (wsSecurityManager.chkIsCollaboratorWorkspaceAssociated(userName, role)) { return true; } } } } return false; }
Source:
public void testSearchWithNullValueInDimension() throws Exception { IncrementalIndex<Aggregator> index = new OnheapIncrementalIndex.Builder() .setIncrementalIndexSchema( new IncrementalIndexSchema.Builder() .withQueryGranularity(Granularities.NONE) .withMinTimestamp(new DateTime("2011-01-12T00:00:00.000Z").getMillis()) .build() ) .setReportParseExceptions(true) .setMaxRowCount(10) .build(); index.add( new MapBasedInputRow( 1481871600000L, Arrays.asList("name", "host"), ImmutableMap.<String, Object>of("name", "name1", "host", "host") ) ); index.add( new MapBasedInputRow( 1481871670000L, Arrays.asList("name", "table"), ImmutableMap.<String, Object>of("name", "name2", "table", "table") ) ); SearchQuery searchQuery = Druids.newSearchQueryBuilder() .dimensions( new DefaultDimensionSpec("table", "table") ) .dataSource(QueryRunnerTestHelper.dataSource) .granularity(QueryRunnerTestHelper.allGran) .intervals(QueryRunnerTestHelper.fullOnInterval) .context(ImmutableMap.<String, Object>of("searchStrategy", "cursorOnly")) .build(); QueryRunnerFactory factory = new SearchQueryRunnerFactory( selector, toolChest, QueryRunnerTestHelper.NOOP_QUERYWATCHER ); QueryRunner runner = factory.createRunner(new QueryableIndexSegment("asdf", TestIndex.persistRealtimeAndLoadMMapped(index))); List<SearchHit> expectedHits = Lists.newLinkedList(); expectedHits.add(new SearchHit("table", "table", 1)); expectedHits.add(new SearchHit("table", "", 1)); checkSearchQuery(searchQuery, runner, expectedHits); }

Target:
public void testSearchWithNullValueInDimension() throws Exception { IncrementalIndex<Aggregator> index = new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withMinTimestamp(new DateTime("2011-01-12T00:00:00.000Z").getMillis()) .build() ) .setMaxRowCount(10) .buildOnheap(); index.add( new MapBasedInputRow( 1481871600000L, Arrays.asList("name", "host"), ImmutableMap.<String, Object>of("name", "name1", "host", "host") ) ); index.add( new MapBasedInputRow( 1481871670000L, Arrays.asList("name", "table"), ImmutableMap.<String, Object>of("name", "name2", "table", "table") ) ); SearchQuery searchQuery = Druids.newSearchQueryBuilder() .dimensions( new DefaultDimensionSpec("table", "table") ) .dataSource(QueryRunnerTestHelper.dataSource) .granularity(QueryRunnerTestHelper.allGran) .intervals(QueryRunnerTestHelper.fullOnInterval) .context(ImmutableMap.<String, Object>of("searchStrategy", "cursorOnly")) .build(); QueryRunnerFactory factory = new SearchQueryRunnerFactory( selector, toolChest, QueryRunnerTestHelper.NOOP_QUERYWATCHER ); QueryRunner runner = factory.createRunner(new QueryableIndexSegment("asdf", TestIndex.persistRealtimeAndLoadMMapped(index))); List<SearchHit> expectedHits = Lists.newLinkedList(); expectedHits.add(new SearchHit("table", "table", 1)); expectedHits.add(new SearchHit("table", "", 1)); checkSearchQuery(searchQuery, runner, expectedHits); }
Source:
public TimingWindowSolver(List<TimingWindow> windows, boolean value) { super(DateTimeUtils.MillisecondsPerHour() / 4, DateTimeUtils.MillisecondsPerMinute()); this.windows = windows; this.value = value; }

Target:
public TimingWindowSolver(List<TimingWindow> windows, boolean value) { super(TimeUnit.HOURS.toMillis(1) / 4, TimeUnit.MINUTES.toMillis(1)); this.windows = windows; this.value = value; }
Source:
private void extractMailExample (String orig) throws Exception { File ex = new File(site.mail_dir, "/" + orig + ".example"); extract(ex, OutgoingEmail.class, orig); chmod(0444, ex); }

Target:
private void extractMailExample(String orig) throws Exception { File ex = new File(site.mail_dir, orig + ".example"); extract(ex, OutgoingEmail.class, orig); chmod(0444, ex); }
Source:
public void onSkipInWrite(S item, Throwable t) { if(skipWriteDelegate != null && t instanceof Exception) { try { skipWriteDelegate.onSkipWriteItem(Collections.<Object>singletonList(item), (Exception) t); } catch (Exception e) { throw new BatchRuntimeException(e); } } }

Target:
public void onSkipInWrite(S item, Throwable t) { if(skipWriteDelegate != null && t instanceof Exception) { try { skipWriteDelegate.onSkipWriteItem((List<Object>) item, (Exception) t); } catch (Exception e) { throw new BatchRuntimeException(e); } } }
Source:
protected void setData(String key, Number value) { if (data == null) { data = new HashMap<>(); } if (value == null) { data.remove(key); } else if (value instanceof Number) { data.put(key, value); } else { throw new RuntimeException("unexpected value"); } }

Target:
protected void setData(String key, Number value) { if (data == null) { data = new HashMap<>(); } data.put(key, value); }
Source:
public static TraceLogLevel valueOfString(String name){ if (name == null) { throw new NullPointerException(); } for (TraceLogLevel tllevel : TraceLogLevel.values()) { if (tllevel.getInName().equalsIgnoreCase(name)) { return tllevel; } } return LEVEL_UNKNOWN; }

Target:
public static TraceLogLevel valueOfString(String name) { if (name == null) { throw new InvalidParameterException(); } for (TraceLogLevel tllevel : TraceLogLevel.values()) { if (tllevel.getInName().equalsIgnoreCase(name)) { return tllevel; } } return LEVEL_UNKNOWN; }
Source:
public boolean onStartJob(JobParameters params) { if (params.getExtras() != null && params.getExtras() != null) { int startId = params.getExtras().getInt(ARG_START_ID); AppLog.i(T.STATS, "stats job service > task: " + startId + " started"); mStatsServiceLogic.performTask( StatsServiceStarter.passPersistableBundleExtrasToBundle(params.getExtras()), params); } return true; }

Target:
public boolean onStartJob(JobParameters params) { if (params.getExtras() != null) { int startId = params.getExtras().getInt(ARG_START_ID); AppLog.i(T.STATS, "stats job service > task: " + startId + " started"); mStatsServiceLogic.performTask( new Bundle(params.getExtras()), params); return true; } return false; }
Source:
protected String getCommandName() { return Messages.InsertBlankSpace_cmdName; }

Target:
protected String getCommandName() { if (startLocation > endLocation) { return Messages.RemoveBlankSpace_cmdName; } else { return Messages.InsertBlankSpace_cmdName; } }
Source:
public DomainBundleProjectResourcesContentProcessor(Path targetFolder) { this.targetFolder = targetFolder; }

Target:
public DomainBundleProjectResourcesContentProcessor(Path targetFolder) { domainFolderPath = targetFolder.resolve(DOMAIN.value()); applicationsFolderPath = targetFolder.resolve(APPLICATIONS.value()); }
Source:
public boolean hitEntity(ItemStack itemstack, EntityLivingBase target, EntityLivingBase attacker) { double energy = getEnergy(itemstack); int energyCost = MekanismConfig.current().general.DISASSEMBLER_WEAPON_USAGE.val(); int minDamage = MekanismConfig.current().general.DISASSEMBLER_DAMAGE_MIN.val(); int damageDifference = MekanismConfig.current().general.DISASSEMBLER_DAMAGE_MAX.val() - minDamage; double percent = energyCost == 0 ? 1 : energy / energyCost; float damage = (float) (minDamage + damageDifference * percent); if (attacker instanceof EntityPlayer) { target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), damage); } else { target.attackEntityFrom(DamageSource.causeMobDamage(attacker), damage); } if (energy > 0) { setEnergy(itemstack, energy - energyCost); } return false; }

Target:
public boolean hitEntity(ItemStack itemstack, EntityLivingBase target, EntityLivingBase attacker) { double energy = getEnergy(itemstack); int energyCost = MekanismConfig.current().general.disassemblerEnergyUsageWeapon.val(); int minDamage = MekanismConfig.current().general.disassemblerDamageMin.val(); int damageDifference = MekanismConfig.current().general.disassemblerDamageMax.val() - minDamage; double percent = 1; if (energy < energyCost && energyCost != 0) { percent = energy / energyCost; } float damage = (float) (minDamage + damageDifference * percent); if (attacker instanceof EntityPlayer) { target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), damage); } else { target.attackEntityFrom(DamageSource.causeMobDamage(attacker), damage); } if (energy > 0) { setEnergy(itemstack, energy - energyCost); } return false; }
Source:
protected void executeQueryCommand() { String configuration = getConfigurationFromDb(getParameters().getSnapshotSourceId()); VM result = null; if (configuration != null) { result = new VM(); getSnapshotManager().updateVmFromConfiguration(result,configuration); markImagesIllegalIfNotInDb(result); VmHandler.updateDisksForVm(result, result.getImages()); } getQueryReturnValue().setReturnValue(result); }

Target:
protected void executeQueryCommand() { String configuration = getConfigurationFromDb(getParameters().getSnapshotSourceId(), getUserID(), getParameters().isFiltered()); VM result = null; if (configuration != null) { result = getVmFromConfiguration(configuration); markImagesIllegalIfNotInDb(result); VmHandler.updateDisksForVm(result, result.getImages()); } getQueryReturnValue().setReturnValue(result); }
Source:
public void nonMarkedMappingIsEvictable() { K key = factory.createKey(1); tier = factory.newStore(factory.newConfiguration(factory.getKeyType(), factory.getValueType(), 1L, null, null, Expirations.noExpiration())); try { tier.computeIfAbsent(key, new Function<K, V>() { @Override public V apply(final K k) { return factory.createValue(1L); } }); for (long seed = 2L; seed < 15000; seed++) { tier.put(factory.createKey(seed), factory.createValue(seed)); } assertThat(tier.get(key), is(nullValue())); } catch (CacheAccessException e) { System.err.println("Warning, an exception is thrown due to the SPI test"); e.printStackTrace(); } }

Target:
public void nonMarkedMappingIsEvictable() throws CacheAccessException { K key = factory.createKey(1); tier = factory.newStore(factory.newConfiguration(factory.getKeyType(), factory.getValueType(), 1L, null, null, Expirations.noExpiration())); tier.computeIfAbsent(key, new Function<K, V>() { @Override public V apply(final K k) { return factory.createValue(1L); } }); fillTierOverCapacity(tier, factory); assertThat(tier.get(key), is(nullValue())); }
Source:
public int getMode(File file) { return 0664; }

Target:
private int getMode(File file) { return 0664; }
Source:
public Map<SystemStreamPartition, List<IncomingMessageEnvelope>> poll( Set<SystemStreamPartition> systemStreamPartitions, long timeout) throws InterruptedException { if (!proxy.isRunning()) { stop(); if (proxy.getFailureCause() != null) { String message = "KafkaConsumerProxy has stopped"; throw new SamzaException(message, proxy.getFailureCause()); } else { LOG.warn("Failure cause is not populated for KafkaConsumerProxy"); throw new SamzaException("KafkaConsumerProxy has stopped"); } } Map<SystemStreamPartition, List<IncomingMessageEnvelope>> res = super.poll(systemStreamPartitions, timeout); return res; }

Target:
public Map<SystemStreamPartition, List<IncomingMessageEnvelope>> poll( Set<SystemStreamPartition> systemStreamPartitions, long timeout) throws InterruptedException { if (!proxy.isRunning()) { stop(); String message = String.format("%s: KafkaConsumerProxy has stopped.", this); throw new SamzaException(message, proxy.getFailureCause()); } return super.poll(systemStreamPartitions, timeout); }
Source:
private List<String> getJavaScriptExternalFilePaths(@Nullable XWikiDocument doc) { if (doc == null) { return Collections.emptyList(); } List<BaseObject> javaScriptFiles = doc.getXObjects( getOldCoreClasses().getJavaScriptExternalFilesClassRef( doc.getDocumentReference().getWikiReference().getName())); Vector<String> jsFiles = new Vector<>(); if (javaScriptFiles != null) { for (Object filepath : javaScriptFiles) { if ((filepath != null) && (filepath instanceof BaseObject)) { BaseObject filepathObj = (BaseObject) filepath; if (!"".equals(filepathObj.getStringValue("filepath"))) { jsFiles.add(filepathObj.getStringValue("filepath")); } } } } return jsFiles; }

Target:
private List<String> getJavaScriptExternalFilePaths(@Nullable XWikiDocument doc) { if (doc == null) { return Collections.emptyList(); } List<BaseObject> javaScriptFiles = doc.getXObjects( getOldCoreClasses().getJavaScriptExternalFilesClassRef( doc.getDocumentReference().getWikiReference().getName())); List<String> jsFiles = new ArrayList<>(); if (javaScriptFiles != null) { for (Object filepath : javaScriptFiles) { if ((filepath != null) && (filepath instanceof BaseObject)) { BaseObject filepathObj = (BaseObject) filepath; if (!"".equals(filepathObj.getStringValue("filepath"))) { jsFiles.add(filepathObj.getStringValue("filepath")); } } } } return jsFiles; }
Source:
private String capitalize(String str) { if (str == null || str.isEmpty() || str.trim().isEmpty()) { return str; } return str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase(); }

Target:
private String capitalize(String str) { if (str == null || str.isEmpty() || str.trim().isEmpty()) { return str; } str = str.trim(); return str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase(); }
Source:
public final Graph<SequenceSegment> parseFile(final String filename, final GraphFactory<SequenceSegment> gfact) { Calendar cal = Calendar.getInstance(); long startTime = cal.getTimeInMillis(); Graph<SequenceSegment> graph = gfact.getGraph(); parseVertices(filename, graph); parseEdges(filename, graph); Calendar cal2 = Calendar.getInstance(); System.out.println("Graph parsed. Took " + (cal2.getTimeInMillis() - startTime) + " ms."); return graph; }

Target:
public final Graph<SequenceSegment> parseFile(final String filename, final GraphFactory<SequenceSegment> gfact) { long startTime = Calendar.getInstance().getTimeInMillis(); Graph<SequenceSegment> graph = gfact.getGraph(); parseVertices(filename, graph); parseEdges(filename, graph); System.out.println("Graph parsed. Took " + (Calendar.getInstance().getTimeInMillis() - startTime) + " ms."); return graph; }
Source:
public String toString() { return "AliasedDiscoveryConfig{" + "enabled=" + enabled + ", usePublicIp=" + usePublicIp + ", properties=" + properties + '}'; }

Target:
public String toString() { return "AliasedDiscoveryConfig{" + "tag='" + tag + '\'' + ", enabled=" + enabled + ", usePublicIp=" + usePublicIp + ", properties=" + properties + '}'; }
Source:
public HttpResponse doFinishLogin(StaplerRequest request) throws IOException { String code = request.getParameter("code"); if (code == null || code.trim().length() == 0) { Log.info("doFinishLogin: missing code."); return HttpResponses.redirectToContextRoot(); } Log.info("test"); HttpPost httpost = new HttpPost(githubWebUri + "/login/oauth/access_token?" + "client_id=" + clientID + "&" + "client_secret=" + clientSecret + "&" + "code=" + code); DefaultHttpClient httpclient = new DefaultHttpClient(); org.apache.http.HttpResponse response = httpclient.execute(httpost); HttpEntity entity = response.getEntity(); String content = EntityUtils.toString(entity); httpclient.getConnectionManager().shutdown(); String accessToken = extractToken(content); if (accessToken != null && accessToken.trim().length() > 0) { GithubAuthenticationToken auth = new GithubAuthenticationToken(accessToken, getGithubApiUri()); SecurityContextHolder.getContext().setAuthentication(auth); GHUser self = auth.getGitHub().getMyself(); User u = User.current(); u.setFullName(self.getName()); } else { Log.info("Github did not return an access token."); } String referer = (String)request.getSession().getAttribute(REFERER_ATTRIBUTE); if (referer!=null) return HttpResponses.redirectTo(referer); return HttpResponses.redirectToContextRoot(); }

Target:
public HttpResponse doFinishLogin(StaplerRequest request) throws IOException { String code = request.getParameter("code"); if (code == null || code.trim().length() == 0) { Log.info("doFinishLogin: missing code."); return HttpResponses.redirectToContextRoot(); } Log.info("test"); HttpPost httpost = new HttpPost(githubWebUri + "/login/oauth/access_token?" + "client_id=" + clientID + "&" + "client_secret=" + clientSecret + "&" + "code=" + code); DefaultHttpClient httpclient = new DefaultHttpClient(); org.apache.http.HttpResponse response = httpclient.execute(httpost); HttpEntity entity = response.getEntity(); String content = EntityUtils.toString(entity); httpclient.getConnectionManager().shutdown(); String accessToken = extractToken(content); if (accessToken != null && accessToken.trim().length() > 0) { GithubAuthenticationToken auth = new GithubAuthenticationToken(accessToken, getGithubApiUri()); SecurityContextHolder.getContext().setAuthentication(auth); GHUser self = auth.getGitHub().getMyself(); User u = User.current(); u.setFullName(self.getName()); if (!u.getProperty(Mailer.UserProperty.class).hasExplicitlyConfiguredAddress()) { u.addProperty(new Mailer.UserProperty(self.getEmail())); } } else { Log.info("Github did not return an access token."); } String referer = (String)request.getSession().getAttribute(REFERER_ATTRIBUTE); if (referer!=null) return HttpResponses.redirectTo(referer); return HttpResponses.redirectToContextRoot(); }
Source:
public void sendEventBundle(EventBundle events) { if (events.size() == 0) { return; } for (EventBundlePipe pipe : pipes) { pipe.sendEventBundle(events); } }

Target:
public void sendEventBundle(EventBundle events) { if (events.isEmpty()) { return; } for (EventBundlePipe pipe : pipes) { pipe.sendEventBundle(events); } }
Source:
public void init(FilterConfig filterConfig) throws ServletException { additionalSchemes = filterConfig.getInitParameter("schemes"); }

Target:
public void init(FilterConfig filterConfig) throws ServletException { String schemes = filterConfig.getInitParameter("schemes"); if (schemes == null) { schemes = ""; } additionalSchemes = Arrays.asList(schemes.split(",")); realmInfo = filterConfig.getInitParameter("realmInfo"); }
Source:
private Collection<AbstractPolicy> getPolicies(QName policyType, AbstractNodeTemplate nodeTemplate) { Collection<AbstractPolicy> policies = new ArrayList<AbstractPolicy>(); for (AbstractPolicy policy : nodeTemplate.getPolicies()) { if (policy.getType().getId().equals(policyType)) { policies.add(policy); } } return policies; }

Target:
private Collection<AbstractPolicy> getPolicies(QName policyType, AbstractNodeTemplate nodeTemplate) { return nodeTemplate.getPolicies().stream().filter(x -> x.getType().getId().equals(policyType)).collect(Collectors.toList()); }
Source:
public CaptureProcessScheduler(ConnectorConfiguration configuration, Environment environment, CardCaptureProcess cardCaptureProcess, XrayUtils xrayUtils) { this.cardCaptureProcess = cardCaptureProcess; this.xrayUtils = xrayUtils; if ((configuration != null) && (configuration.getCaptureProcessConfig() != null)) { CaptureProcessConfig captureProcessConfig = configuration.getCaptureProcessConfig(); initialDelayInSeconds = captureProcessConfig.getSchedulerInitialDelayInSeconds(); randomIntervalMinimumInSeconds = captureProcessConfig.getSchedulerRandomIntervalMinimumInSeconds(); randomIntervalMaximumInSeconds = captureProcessConfig.getSchedulerRandomIntervalMaximumInSeconds(); schedulerThreads = captureProcessConfig.getSchedulerThreads(); } scheduledExecutorService = environment .lifecycle() .scheduledExecutorService(CAPTURE_PROCESS_SCHEDULER_NAME) .threads(schedulerThreads + 1) .build(); }

Target:
public CaptureProcessScheduler(ConnectorConfiguration configuration, Environment environment, CardCaptureProcess cardCaptureProcess, XrayUtils xrayUtils) { this.cardCaptureProcess = cardCaptureProcess; this.xrayUtils = xrayUtils; if ((configuration != null) && (configuration.getCaptureProcessConfig() != null)) { CaptureProcessConfig captureProcessConfig = configuration.getCaptureProcessConfig(); initialDelayInSeconds = captureProcessConfig.getSchedulerInitialDelayInSeconds(); randomIntervalMinimumInSeconds = captureProcessConfig.getSchedulerRandomIntervalMinimumInSeconds(); randomIntervalMaximumInSeconds = captureProcessConfig.getSchedulerRandomIntervalMaximumInSeconds(); schedulerThreads = captureProcessConfig.getSchedulerThreads(); } int totalThreads = schedulerThreads + 1; scheduledExecutorService = environment .lifecycle() .scheduledExecutorService(CAPTURE_PROCESS_SCHEDULER_NAME) .threads(totalThreads) .build(); }