auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Collection<String> call() throws JGitInternalException { checkCallable(); try { SubmoduleWalk generator = SubmoduleWalk.forIndex(repo); if (!paths.isEmpty()) generator.setFilter(PathFilterGroup.createFromStrings(paths)); StoredConfig config = repo.getConfig(); List<String> initialized = new ArrayList<String>(); while (generator.next()) { if (generator.getConfigUrl() != null) continue; String path = generator.getPath(); String url = generator.getModulesUrl(); if (new URIish(url).getScheme() == null) { <START> url = resolveRelativeModulePath(url); <END> } String update = generator.getModulesUpdate(); if (url != null) config.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_URL, url); if (update != null) config.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_UPDATE, update); if (url != null || update != null) initialized.add(path); } if (!initialized.isEmpty()) config.save(); return initialized; } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } catch (ConfigInvalidException e) { throw new JGitInternalException(e.getMessage(), e); } catch (URISyntaxException e) { throw new JGitInternalException(e.getMessage(), e); } }</code><technical_language>url null throw a URISyntaxException changes previous behavior ignoring null url values updating update value. I this moved check url != null line 117</technical_language>

Target:
public Collection<String> call() throws JGitInternalException { checkCallable(); try { SubmoduleWalk generator = SubmoduleWalk.forIndex(repo); if (!paths.isEmpty()) generator.setFilter(PathFilterGroup.createFromStrings(paths)); StoredConfig config = repo.getConfig(); List<String> initialized = new ArrayList<String>(); while (generator.next()) { if (generator.getConfigUrl() != null) continue; String path = generator.getPath(); String url = generator.getModulesUrl(); String update = generator.getModulesUpdate(); if (url != null) if (new URIish(url).getScheme() == null) url = resolveRelativeModulePath(url); config.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_URL, url); if (update != null) config.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_UPDATE, update); if (url != null || update != null) initialized.add(path); } if (!initialized.isEmpty()) config.save(); return initialized; } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } catch (ConfigInvalidException e) { throw new JGitInternalException(e.getMessage(), e); } catch (URISyntaxException e) { throw new JGitInternalException(e.getMessage(), e); } }
Source:
<code>private static void addPlatformMappings( IgniteLogger log, List<Map<Integer, MappedName>> mappings, Function<Byte, ConcurrentMap<Integer, MappedName>> mappedCache, BiPredicate<MappedName, String> cacheAddPred, MarshallerMappingFileStore writer ) { if (mappings == null) return; for (byte platformId = 0; platformId < mappings.size(); platformId++) { Map<Integer, MappedName> attach = mappings.get(platformId); if (attach == null) <START> return; <END> ConcurrentMap<Integer, MappedName> cached = mappedCache.apply(platformId); for (Map.Entry<Integer, MappedName> e : attach.entrySet()) { Integer typeId = e.getKey(); String clsName = e.getValue().className(); if (cacheAddPred.test(cached.get(typeId), clsName)) { try { cached.put(typeId, new MappedName(clsName, true)); writer.mergeAndWriteMapping(platformId, typeId, clsName); } catch (IgniteCheckedException ex) { U.error(log, "Failed to write marshaller mapping data", ex); } } } } }</code><technical_language>Originally null mappings skipped break processing. I continue there</technical_language>

Target:
private static void addPlatformMappings( IgniteLogger log, List<Map<Integer, MappedName>> mappings, Function<Byte, ConcurrentMap<Integer, MappedName>> mappedCache, BiPredicate<MappedName, String> cacheAddPred, MarshallerMappingFileStore writer ) { if (mappings == null) return; for (byte platformId = 0; platformId < mappings.size(); platformId++) { Map<Integer, MappedName> attach = mappings.get(platformId); if (attach == null) continue; ConcurrentMap<Integer, MappedName> cached = mappedCache.apply(platformId); for (Map.Entry<Integer, MappedName> e : attach.entrySet()) { Integer typeId = e.getKey(); String clsName = e.getValue().className(); if (cacheAddPred.test(cached.get(typeId), clsName)) { try { cached.put(typeId, new MappedName(clsName, true)); writer.mergeAndWriteMapping(platformId, typeId, clsName); } catch (IgniteCheckedException ex) { U.error(log, "Failed to write marshaller mapping data", ex); } } } } }
Source:
<code>public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { LOG.trace("CXFSAMLCallbackHandler.handle begin"); for (final Callback callback : callbacks) { if (callback instanceof SAMLCallback) { try { final Message message = getCurrentMessage(); final Object obj = message.get("assertion"); AssertionType custAssertion; <START> custAssertion = getCustAssertion(obj); <END> final SAMLCallback oSAMLCallback = (SAMLCallback) callback; oSAMLCallback.setIssuerKeyName("gateway"); oSAMLCallback.setIssuerKeyPassword("changeit"); oSAMLCallback.setSignAssertion(true); oSAMLCallback.setSendKeyValue(true); issuerCrypto = CryptoFactory.getInstance("signature.properties"); oSAMLCallback.setIssuerCrypto(issuerCrypto); oSAMLCallback.setSamlVersion(Version.SAML_20); oSAMLCallback.setSignatureAlgorithm(SPConstants.SHA1); oSAMLCallback.setSignatureDigestAlgorithm(SPConstants.SHA1); final SamlTokenCreator creator = new SamlTokenCreator(); final CallbackProperties properties = new CallbackMapProperties(addMessageProperties( creator.createRequestContext(custAssertion, getResource(message), null), message)); oSAMLCallback.setAssertionElement(builder.build(properties)); } catch (final Exception e) { LOG.error("Failed to create saml: {}", e.getLocalizedMessage(), e); } } } LOG.trace("CXFSAMLCallbackHandler.handle end"); }</code><technical_language>Unnecessary separation of declaration assignment</technical_language>

Target:
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { LOG.trace("CXFSAMLCallbackHandler.handle begin"); for (final Callback callback : callbacks) { if (callback instanceof SAMLCallback) { try { final Message message = getCurrentMessage(); final Object obj = message.get("assertion"); AssertionType custAssertion = getCustAssertion(obj); final SAMLCallback oSAMLCallback = (SAMLCallback) callback; oSAMLCallback.setIssuerKeyName("gateway"); oSAMLCallback.setIssuerKeyPassword("changeit"); oSAMLCallback.setSignAssertion(true); oSAMLCallback.setSendKeyValue(true); issuerCrypto = CryptoFactory.getInstance("signature.properties"); oSAMLCallback.setIssuerCrypto(issuerCrypto); oSAMLCallback.setSamlVersion(Version.SAML_20); oSAMLCallback.setSignatureAlgorithm(SPConstants.SHA1); oSAMLCallback.setSignatureDigestAlgorithm(SPConstants.SHA1); final SamlTokenCreator creator = new SamlTokenCreator(); final CallbackProperties properties = new CallbackMapProperties(addMessageProperties( creator.createRequestContext(custAssertion, getResource(message), null), message)); oSAMLCallback.setAssertionElement(builder.build(properties)); } catch (final Exception e) { LOG.error("Failed to create saml: {}", e.getLocalizedMessage(), e); } } } LOG.trace("CXFSAMLCallbackHandler.handle end"); }
Source:
<code>public void loseLife(Player player) { fireEvent(new PlayerEvent(player, PlayerEvent.LIFE_LOST, "Lost a life")); player.loseLife(); if (!player.hasLives()) { endGame("Game over..."); } else { collisionHandler.removeCollidable(Model.getCurrentRoom() <START> .getCollidables()); <END> collisionHandler.removeCollidable(Model.getPlayers().get(0) .getRopes()); restartRoom(); player.setAlive(true); ArrayList<Player> players = Model.getPlayers(); for(Player otherPlayer: players) { if(!otherPlayer.equals(player)) { otherPlayer.loseLife(); } otherPlayer.setAlive(true); } } }</code><technical_language>line-break</technical_language>

Target:
public void loseLife(Player player) { fireEvent(new PlayerEvent(player, PlayerEvent.LIFE_LOST, "Lost a life")); player.loseLife(); if (!player.hasLives()) { endGame("Game over..."); } else { collisionHandler.removeCollidable(Model.getCurrentRoom().getCollidables()); for(Player otherplayer: Model.getPlayers()) { collisionHandler.removeCollidable(otherplayer.getRopes()); } restartRoom(); player.setAlive(true); for(Player otherPlayer: Model.getPlayers()) { if(!otherPlayer.equals(player)) { otherPlayer.loseLife(); } otherPlayer.setAlive(true); } } }
Source:
<code>public void testAddObectSpecificData() throws UnsupportedEncodingException { bitstreamEventProcessor.configurationService = configurationService; <START> when(configurationService.getProperty(any(String.class))).thenReturn("demo.dspace.org"); <END> when(item.getHandle()).thenReturn("123456789/1"); String result = bitstreamEventProcessor.addObjectSpecificData("existing-string", item, bitstream); assertThat(result, is("existing-string&svc_dat=demo.dspace.org%2Fbitstream%2Fhandle%2F123456789%2F1%2F%3Fsequence%3D0" + "&rft_dat=Request")); }</code><technical_language>a note: need mock a config setting. set configurationService.setProperty(). Configs reload test</technical_language>

Target:
public void testAddObectSpecificData() throws UnsupportedEncodingException { bitstreamEventProcessor.configurationService = configurationService; when(bitstream.getID()).thenReturn(UUID.fromString("455bd3cf-31d3-40db-b283-4106c47fc025")); String result = bitstreamEventProcessor.addObjectSpecificData("existing-string", bitstream); assertThat(result, is("existing-string&svc_dat=" + encodedUrl + "%2Fapi%2Fcore%2Fbitstreams%2F455bd3cf-31d3-40db" + "-b283-4106c47fc025%2Fcontent&rft_dat=Request")); }
Source:
<code>private ReplicationSourceInterface addSource(ReplicationPeer peer) throws IOException { String id = peer.getId(); ReplicationSourceInterface src; synchronized (this.latestPaths) { src = this.sources.get(id); if (src == null) { src = createSource(id, peer); ReplicationSourceInterface newSrc = this.sources.putIfAbsent(id, src); if (newSrc != null) { src.terminate("Another beat us to the installation of an instance of " + id); src = newSrc; } } Map<String, NavigableSet<String>> walsByGroup = new HashMap<>(); this.walsById.put(id, walsByGroup); if (!this.latestPaths.isEmpty()) { for (Path logPath: this.latestPaths) { String name = logPath.getName(); <START> NavigableSet<String> logs = new TreeSet<>(); <END> logs.add(name); walsByGroup.put(AbstractFSWALProvider.getWALPrefixFromWALName(name), logs); if (src.isQueueStored()) { abortAndThrowIOExceptionWhenFail( () -> this.queueStorage.addWAL(server.getServerName(), id, name)); } src.enqueueLog(logPath); } } } src.startup(); return src; }</code><technical_language>I need this flag here, set queueStoreage null, Optional<ReplicationQueueStorage></technical_language>

Target:
private ReplicationSourceInterface addSource(ReplicationPeer peer) throws IOException { String rpid = peer.getId(); ReplicationSourceInterface src; synchronized (this.latestPaths) { src = this.sources.get(rpid); if (src == null) { src = this.sources.putIfAbsent(rpid, createSource(rpid, peer)); } Map<String, NavigableSet<String>> walsByGroup = new HashMap<>(); this.walsById.put(rpid, walsByGroup); if (!this.latestPaths.isEmpty()) { for (Path logPath: this.latestPaths) { String name = logPath.getName(); NavigableSet<String> logs = new TreeSet<>(); logs.add(name); walsByGroup.put(AbstractFSWALProvider.getWALPrefixFromWALName(name), logs); if (src.isQueuePersisted()) { abortAndThrowIOExceptionWhenFail( () -> this.queueStorage.addWAL(server.getServerName(), rpid, name)); } src.enqueueLog(logPath); } } } src.startup(); return src; }
Source:
<code>private Organization toOrganization(DbSession dbSession, String organizationUuid) { <START> analysisMetadata.setOrganizationsEnabled(organizationFlags.isEnabled(dbSession)); <END> Optional<OrganizationDto> organizationDto = dbClient.organizationDao().selectByUuid(dbSession, organizationUuid); checkState(organizationDto.isPresent(), "Organization with uuid '%s' can't be found", organizationUuid); return Organization.from(organizationDto.get()); }</code><technical_language>analysisMetadata.setOrganizationsEnabled is called line 117 belong a method called toOrganization static</technical_language>

Target:
private Organization toOrganization(DbSession dbSession, String organizationUuid) { Optional<OrganizationDto> organizationDto = dbClient.organizationDao().selectByUuid(dbSession, organizationUuid); checkState(organizationDto.isPresent(), "Organization with uuid '%s' can't be found", organizationUuid); return Organization.from(organizationDto.get()); }
Source:
<code>public IpAddressMatcher(String ipAddress) { <START> String ipAddr = ipAddress; <END> if (ipAddress.indexOf('/') > 0) { String[] addressAndMask = StringUtils.split(ipAddress, "/"); ipAddr = addressAndMask[0]; nMaskBits = Integer.parseInt(addressAndMask[1]); } else { nMaskBits = -1; } requiredAddress = parseAddress(ipAddr); Assert.isTrue(requiredAddress.getAddress().length * 8 >= nMaskBits, String.format("Mask bits too long for this address %s", ipAddress)); }</code><technical_language>While this improvement, @clementkng, please leave renaming variable for another PR, is a reason necessary</technical_language>

Target:
public IpAddressMatcher(String ipAddress) { if (ipAddress.indexOf('/') > 0) { String[] addressAndMask = StringUtils.split(ipAddress, "/"); ipAddress = addressAndMask[0]; nMaskBits = Integer.parseInt(addressAndMask[1]); } else { nMaskBits = -1; } requiredAddress = parseAddress(ipAddress); Assert.isTrue(requiredAddress.getAddress().length * 8 >= nMaskBits, String.format("IP address %s is too short for bitmask of length %d", ipAddress, nMaskBits)); }
Source:
<code>public IRateSource createRateSource(String sourceLogin) { if (sourceLogin != null && !sourceLogin.trim().isEmpty()){ StringTokenizer st = new StringTokenizer(sourceLogin, ":"); String exchangeType = st.nextToken(); String preferredFiatCurrency = FiatCurrency.USD.getCode(); <START> if ("coinmarketcap".equalsIgnoreCase(exchangeType)){ <END> String apiKey = null; if (st.hasMoreTokens()) { preferredFiatCurrency = st.nextToken().toUpperCase(); } if (st.hasMoreTokens()) { apiKey = st.nextToken(); } return new CoinmarketcapRateSource(apiKey, preferredFiatCurrency); } else if("xsgfix".equalsIgnoreCase(exchangeType)){ BigDecimal rate = BigDecimal.ZERO; if (st.hasMoreTokens()) { try { rate = new BigDecimal(st.nextToken()); } catch (Throwable e) { } } if (st.hasMoreTokens()) { preferredFiatCurrency = st.nextToken().toUpperCase(); } return new FixPriceRateSource(rate, preferredFiatCurrency); } } return null; }</code><technical_language>Remove Coinmarketcap ratesource</technical_language>

Target:
public IRateSource createRateSource(String sourceLogin) { if (sourceLogin != null && !sourceLogin.trim().isEmpty()){ StringTokenizer st = new StringTokenizer(sourceLogin, ":"); String exchangeType = st.nextToken(); String preferredFiatCurrency = FiatCurrency.USD.getCode(); if("xsgfix".equalsIgnoreCase(exchangeType)){ BigDecimal rate = BigDecimal.ZERO; if (st.hasMoreTokens()) { try { rate = new BigDecimal(st.nextToken()); } catch (Throwable e) { } } if (st.hasMoreTokens()) { preferredFiatCurrency = st.nextToken().toUpperCase(); } return new FixPriceRateSource(rate, preferredFiatCurrency); } } return null; }
Source:
<code>protected boolean canDoAction() { <START> if (!FeatureSupported.refreshLunSupported(getStoragePool().getCompatibilityVersion())) { <END> return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REFRESH_LUNS_UNSUPPORTED_ACTION); } if (!(checkStorageDomain() && checkStorageDomainStatus(StorageDomainStatus.Active))) { return false; } if (!getStorageDomain().getStorageType().isBlockDomain()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); return false; } if (!checkStorageDomainStatusNotEqual(StorageDomainStatus.Locked)) { return false; } if (!checkLunsInStorageDomain(getParameters().getLunIds(), getStorageDomain())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_LUNS_NOT_PART_OF_STORAGE_DOMAIN); return false; } return true; }</code><technical_language>if storage pool is null NPE - need check exists. storagepool validator</technical_language>

Target:
protected boolean canDoAction() { if (!validate(new StoragePoolValidator(getStoragePool()).isUp())) { return false; } if (!FeatureSupported.refreshLunSupported(getStoragePool().getCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REFRESH_LUNS_UNSUPPORTED_ACTION); } if (!(checkStorageDomain() && checkStorageDomainStatus(StorageDomainStatus.Active))) { return false; } if (!getStorageDomain().getStorageType().isBlockDomain()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); } if (!checkLunsInStorageDomain(getParameters().getLunIds(), getStorageDomain())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_LUNS_NOT_PART_OF_STORAGE_DOMAIN); } return true; }
Source:
<code><START> public void setUp() throws Exception { <END> super.init(); }</code><technical_language>super.init() method throw exception</technical_language>

Target:
public void setUp() { super.init(); }
Source:
<code>protected void executeCommand() { try { reconstructOpsSucceeded = reconstructMaster(); connectAndRefreshAllUpHosts(reconstructOpsSucceeded); <START> if (!_isLastMaster && reconstructOpsSucceeded) { <END> SearchParameters p = new SearchParameters( MessageFormat.format(DesktopsInStoragePoolQuery, getStoragePool().getname()), SearchType.VM); p.setMaxCount(Integer.MAX_VALUE); @SuppressWarnings("unchecked") List<VM> vmsInPool = (List<VM>) Backend.getInstance() .runInternalQuery(VdcQueryType.Search, p).getReturnValue(); VmCommand.updateVmInSpm(getStoragePool().getId(), vmsInPool); } setSucceeded(reconstructOpsSucceeded); } finally { Backend.getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.MarkPoolInReconstructMode, new MarkPoolInReconstructModeVDSCommandParameters(getStoragePoolId() .getValue(), ReconstructMarkAction.ClearCache)); } }</code><technical_language>connectAndRefreshAllUpHosts disconnected storage induce failure of updateVmInSpm</technical_language>

Target:
protected void executeCommand() { try { reconstructOpSucceeded = reconstructMaster(); connectAndRefreshAllUpHosts(reconstructOpSucceeded); if (!_isLastMaster && reconstructOpSucceeded) { SearchParameters p = new SearchParameters( MessageFormat.format(DesktopsInStoragePoolQuery, getStoragePool().getname()), SearchType.VM); p.setMaxCount(Integer.MAX_VALUE); @SuppressWarnings("unchecked") List<VM> vmsInPool = (List<VM>) Backend.getInstance() .runInternalQuery(VdcQueryType.Search, p).getReturnValue(); VmCommand.updateVmInSpm(getStoragePool().getId(), vmsInPool); } setSucceeded(reconstructOpSucceeded); } finally { Backend.getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.MarkPoolInReconstructMode, new MarkPoolInReconstructModeVDSCommandParameters(getStoragePoolId() .getValue(), ReconstructMarkAction.ClearCache)); } }
Source:
<code>private MenuItem[] createBoardsMenu() { MenuItem save = new MenuItem("Save"); save.setOnAction(e -> onBoardSave()); Menu open = new Menu("Open"); Menu delete = new Menu("Delete"); ui.registerEvent((BoardSavedEventHandler) e -> { open.getItems().clear(); delete.getItems().clear(); Map<String, List<String>> boards = prefs.getAllBoards(); for (Map.Entry<String, List<String>> entry : boards.entrySet()) { final String boardName = entry.getKey(); final List<String> filterSet = entry.getValue(); <START> MenuItem openItem = new MenuItem(); <END> openItem.setOnAction(e1 -> onBoardOpen(boardName, filterSet)); open.getItems().add(openItem); MenuItem deleteItem = new MenuItem(boardName); deleteItem.setOnAction(e1 -> onBoardDelete(boardName)); delete.getItems().add(deleteItem); } }); return new MenuItem[] {save, open, delete}; }</code><technical_language>this is intended right</technical_language>

Target:
private MenuItem[] createBoardsMenu() { MenuItem save = new MenuItem("Save"); save.setOnAction(e -> onBoardSave()); Menu open = new Menu("Open"); Menu delete = new Menu("Delete"); ui.registerEvent((BoardSavedEventHandler) e -> { open.getItems().clear(); delete.getItems().clear(); Map<String, List<String>> boards = prefs.getAllBoards(); for (Map.Entry<String, List<String>> entry : boards.entrySet()) { final String boardName = entry.getKey(); final List<String> filterSet = entry.getValue(); MenuItem openItem = new MenuItem(boardName); openItem.setOnAction(e1 -> onBoardOpen(boardName, filterSet)); open.getItems().add(openItem); MenuItem deleteItem = new MenuItem(boardName); deleteItem.setOnAction(e1 -> onBoardDelete(boardName)); delete.getItems().add(deleteItem); } }); return new MenuItem[] {save, open, delete}; }
Source:
<code>public ReferenceBinding getMemberType(char[] typeName) { if (!isPrototype()) { ReferenceBinding memberType = this.prototype.getMemberType(typeName); return memberType == null ? null : this.environment.createMemberType(memberType, this); } ReferenceBinding[] members = sortedMemberTypes(); <START> if ((this.tagBits & TagBits.HasUnresolvedMemberTypes) != 0) { <END> for (int i = members.length; --i >= 0;) { ReferenceBinding memberType = members[i]; if (memberType instanceof UnresolvedReferenceBinding) { char[] name = memberType.sourceName; int prefixLength = this.compoundName[this.compoundName.length - 1].length + 1; if (name.length == (prefixLength + typeName.length)) if (CharOperation.fragmentEquals(typeName, name, prefixLength, true)) return members[i] = (ReferenceBinding) resolveType(memberType, this.environment, false ); } else if (CharOperation.equals(typeName, memberType.sourceName)) { return memberType; } } return null; } int memberTypeIndex = unresolvedTypesAwareBinarySearch(typeName, members); if (memberTypeIndex >= 0) { ReferenceBinding memberType = members[memberTypeIndex]; if (memberType instanceof UnresolvedReferenceBinding) { return members[memberTypeIndex] = (ReferenceBinding) resolveType(memberType, this.environment, false ); } return memberType; } return null; }</code><technical_language>This resolving is done right</technical_language>

Target:
public ReferenceBinding getMemberType(char[] typeName) { if (!isPrototype()) { ReferenceBinding memberType = this.prototype.getMemberType(typeName); return memberType == null ? null : this.environment.createMemberType(memberType, this); } ReferenceBinding[] members = sortedMemberTypes(); if (!this.memberTypesSorted) { for (int i = members.length; --i >= 0;) { ReferenceBinding memberType = members[i]; if (memberType instanceof UnresolvedReferenceBinding) { char[] name = memberType.sourceName; int prefixLength = this.compoundName[this.compoundName.length - 1].length + 1; if (name.length == (prefixLength + typeName.length)) if (CharOperation.fragmentEquals(typeName, name, prefixLength, true)) return members[i] = (ReferenceBinding) resolveType(memberType, this.environment, false ); } else if (CharOperation.equals(typeName, memberType.sourceName)) { return memberType; } } return null; } int memberTypeIndex = unresolvedTypesAwareBinarySearch(typeName, members); if (memberTypeIndex >= 0) { ReferenceBinding memberType = members[memberTypeIndex]; if (memberType instanceof UnresolvedReferenceBinding) { return members[memberTypeIndex] = (ReferenceBinding) resolveType(memberType, this.environment, false ); } return memberType; } return null; }
Source:
<code>public void afterClass() throws Exception { String testClassName = this.getShortClassName(); <START> System.out.println("AfterClass: " + testClassName + " of TestListenerCallback called."); <END> if (_manager != null && _manager.isConnected()) { _manager.disconnect(); } TestHelper.dropCluster(_clusterName, _gZkClient); System.out.println("END " + _clusterName + " at " + new Date(System.currentTimeMillis())); }</code><technical_language>this bring lots of printout? Is this for debugging purpose</technical_language>

Target:
public void afterClass() throws Exception { if (_manager != null && _manager.isConnected()) { _manager.disconnect(); } TestHelper.dropCluster(_clusterName, _gZkClient); System.out.println("END " + _clusterName + " at " + new Date(System.currentTimeMillis())); }
Source:
<code>private Hashtable<String, String> convertMapToHashTable(Map<String, String> map) { Hashtable<String, String> table = new Hashtable<>(); <START> for (Map.Entry<String, String> stringStringEntry : map.entrySet()) { <END> Map.Entry pair = (Map.Entry) stringStringEntry; if (pair.getValue() != null) { table.put(pair.getKey().toString(), pair.getValue().toString()); } } return table; }</code><technical_language>map.forEach</technical_language>

Target:
private Hashtable<String, String> convertMapToHashTable(Map<String, String> map) { Hashtable<String, String> table = new Hashtable<>(); map.forEach( (key, value) -> { if (value != null) { table.put(key.toString(), value.toString()); } }); return table; }
Source:
<code>public static Diamond3iIterable.Builder shell(Vector3ic origin, int radius) { <START> return new Diamond3iIterable.Builder(origin, radius).start(radius - 1); <END> }</code><technical_language>+/- 1 confusion: suggestion return new Diamond3iIterable.Builder(origin, radius).start(radius);</technical_language>

Target:
public static Diamond3iIterable.Builder shell(Vector3ic origin, int radius) { return new Diamond3iIterable.Builder(origin, radius).start(radius); }
Source:
<code>private Predicate createResourceLinkPathPredicate(FhirContext theContext, String theParamName, From<?, ? extends ResourceLink> theFrom, String theResourceType) { RuntimeResourceDefinition resourceDef = theContext.getResourceDefinition(theResourceType); RuntimeSearchParam param = mySearchParamRegistry.getSearchParamByName(resourceDef, theParamName); List<String> path = param.getPathsSplit(); path = new ArrayList<>(path); for (int i = 0; i < path.size(); i++) { String nextPath = trim(path.get(i)); if (!nextPath.contains(theResourceType + ".")) { path.remove(i); <START> i--; <END> } } return theFrom.get("mySourcePath").in(path); }</code><technical_language>This approach filtering lists is risky lead bugs code changes. Consider iterator: ListIterator< String > iter = path.listIterator(); while (iter.hasNext()){ String nextPath = trim(iter.next()); if (!nextPath.contains(theResourceType + ".")) { iter.remove(); } }</technical_language>

Target:
private Predicate createResourceLinkPathPredicate(FhirContext theContext, String theParamName, From<?, ? extends ResourceLink> theFrom, String theResourceType) { RuntimeResourceDefinition resourceDef = theContext.getResourceDefinition(theResourceType); RuntimeSearchParam param = mySearchParamRegistry.getSearchParamByName(resourceDef, theParamName); List<String> path = param.getPathsSplit(); path = new ArrayList<>(path); ListIterator<String> iter = path.listIterator(); while (iter.hasNext()) { String nextPath = trim(iter.next()); if (!nextPath.contains(theResourceType + ".")) { iter.remove(); } } return theFrom.get("mySourcePath").in(path); }
Source:
<code>@Override public HttpRequest filter(HttpRequest request) throws HttpException { long now = currentTimeSeconds(); ClientSecret client = ClientSecret.create( credentialsSupplier.get().identity, credentialsSupplier.get().credential, resource == null ? "" : resource, <START> ON_SPACE.join(scopes.forRequest(request)), <END> now + tokenDuration ); Token token = tokenCache.getUnchecked(client); String authorization = String.format("%s %s", token.tokenType(), token.accessToken()); return request.toBuilder().addHeader("Authorization", authorization).build(); }</code><technical_language>care of NPE here. scopes variable null in Azure</technical_language>

Target:
@Override public HttpRequest filter(HttpRequest request) throws HttpException { long now = currentTimeSeconds(); ClientSecret client = ClientSecret.create( credentialsSupplier.get().identity, credentialsSupplier.get().credential, resource == null ? "" : resource, scopes == null ? null : ON_SPACE.join(scopes.forRequest(request)), now + tokenDuration ); Token token = tokenCache.getUnchecked(client); String authorization = String.format("%s %s", token.tokenType(), token.accessToken()); return request.toBuilder().addHeader("Authorization", authorization).build(); }
Source:
<code>public void onActivityPaused(final Activity activity) { mPaused = true; if (check != null) { mHandler.removeCallbacks(check); } mHandler.postDelayed(check = new Runnable(){ @Override public void run() { if (mIsForeground && mPaused) { mIsForeground = false; try { double sessionLength = System.currentTimeMillis() - sStartSessionTime; if (sessionLength >= MPConfig.getInstance(activity.getApplicationContext()).getMinimumSessionDuration() && sessionLength < MPConfig.getInstance(activity.getApplicationContext()).getSessionTimeoutDuration()) { DecimalFormat df = new DecimalFormat("#.0"); String sessionLengthString = df.format((System.currentTimeMillis() - sStartSessionTime) / 1000); JSONObject sessionProperties = new JSONObject(); sessionProperties.put(AutomaticEvents.SESSION_LENGTH, sessionLengthString); <START> mMpInstance.getPeople().increment(AutomaticEvents.TOTAL_SESSIONS, 1); <END> mMpInstance.getPeople().increment(AutomaticEvents.TOTAL_SESSIONS_LENGTH, Double.valueOf(sessionLengthString)); mMpInstance.track(AutomaticEvents.SESSION, sessionProperties, true); } } catch (JSONException e) { e.printStackTrace(); } mMpInstance.flush(); } } }, CHECK_DELAY); }</code><technical_language>forget</technical_language>

Target:
public void onActivityPaused(final Activity activity) { mPaused = true; if (check != null) { mHandler.removeCallbacks(check); } mHandler.postDelayed(check = new Runnable(){ @Override public void run() { if (mIsForeground && mPaused) { mIsForeground = false; try { double sessionLength = System.currentTimeMillis() - sStartSessionTime; if (sessionLength >= MPConfig.getInstance(activity.getApplicationContext()).getMinimumSessionDuration() && sessionLength < MPConfig.getInstance(activity.getApplicationContext()).getSessionTimeoutDuration()) { DecimalFormat df = new DecimalFormat("#.0"); String sessionLengthString = df.format((System.currentTimeMillis() - sStartSessionTime) / 1000); JSONObject sessionProperties = new JSONObject(); sessionProperties.put(AutomaticEvents.SESSION_LENGTH, sessionLengthString); mMpInstance.track(AutomaticEvents.SESSION, sessionProperties, true); } } catch (JSONException e) { e.printStackTrace(); } mMpInstance.flush(); } } }, CHECK_DELAY); }
Source:
<code>public Response approve(@PathParam("thingUID") @ApiParam(value = "thingUID", required = true) String thingUID, @ApiParam(value = "thing label") String label, @QueryParam("enableChannels") @DefaultValue("true") @ApiParam(value = "enable channels", required = false) boolean enableChannels) { ThingUID thingUIDObject = new ThingUID(thingUID); List<DiscoveryResult> results = inbox.get(new InboxFilterCriteria(thingUIDObject, null)); if (results.isEmpty()) { return Response.status(Status.NOT_FOUND).build(); } Thing thing = inbox.approve(thingUIDObject, label != null && !label.isEmpty() ? label : null); <START> DiscoveryResult result = results.get(0); <END> thingSetupManager.addItems(label, new ArrayList<String>(), thing, result.getThingTypeUID()); if (enableChannels){ thingSetupManager.enableChannels(thing, result.getThingTypeUID()); } return Response.ok().build(); }</code><technical_language>Do I understand inbox.approve(..) code correctly, drop "result" thing.getThingTypeUID() in calls below. long inbox.approve InboxFilterCriteria, move "check if thingUID" is part of inbox in approve implementation throw exception, catch return Status.NOT_FOUND</technical_language>

Target:
public Response approve(@PathParam("thingUID") @ApiParam(value = "thingUID", required = true) String thingUID, @ApiParam(value = "thing label") String label, @QueryParam("enableChannels") @DefaultValue("true") @ApiParam(value = "enable channels", required = false) boolean enableChannels) { ThingUID thingUIDObject = new ThingUID(thingUID); String notEmptyLabel = label != null && !label.isEmpty() ? label : null; Thing thing = null; try { thing = inbox.approve(thingUIDObject, notEmptyLabel); } catch (IllegalArgumentException e){ return Response.status(Status.NOT_FOUND).build(); } thingSetupManager.createGroupItems(notEmptyLabel, new ArrayList<String>(), thing, thing.getThingTypeUID()); if (enableChannels) { thingSetupManager.enableChannels(thing, thing.getThingTypeUID()); } return Response.ok().build(); }
Source:
<code>private static void validateValidationConfig(TableConfig tableConfig) { SegmentsValidationAndRetentionConfig validationConfig = tableConfig.getValidationConfig(); if (validationConfig != null) { <START> String timeColumnName = validationConfig.getTimeColumnName(); if(timeColumnName == null) { throw new IllegalStateException("Must provide valid timeColumnName in tableConfig"); } <END> String peerSegmentDownloadScheme = validationConfig.getPeerSegmentDownloadScheme(); if (peerSegmentDownloadScheme != null) { if (!"http".equalsIgnoreCase(peerSegmentDownloadScheme) && !"https".equalsIgnoreCase(peerSegmentDownloadScheme)) { throw new IllegalStateException("Invalid value '" + peerSegmentDownloadScheme + "' for peerSegmentDownloadScheme. Must be one of http nor https" ); } } } }</code><technical_language>force time column for real-time table, please fix format suggestion if (tableConfig.getTableType() == TableType.REALTIME && validationConfig.getTimeColumnName() == null) { throw new IllegalStateException("Must provide time column in real-time table config"); }</technical_language>

Target:
private static void validateValidationConfig(TableConfig tableConfig) { SegmentsValidationAndRetentionConfig validationConfig = tableConfig.getValidationConfig(); if (validationConfig != null) { if (tableConfig.getTableType() == TableType.REALTIME && validationConfig.getTimeColumnName() == null) { throw new IllegalStateException("Must provide time column in real-time table config"); } String peerSegmentDownloadScheme = validationConfig.getPeerSegmentDownloadScheme(); if (peerSegmentDownloadScheme != null) { if (!"http".equalsIgnoreCase(peerSegmentDownloadScheme) && !"https".equalsIgnoreCase(peerSegmentDownloadScheme)) { throw new IllegalStateException("Invalid value '" + peerSegmentDownloadScheme + "' for peerSegmentDownloadScheme. Must be one of http nor https" ); } } } }
Source:
<code>public void testAllNodesDieOnRequest() throws Exception { CountDownLatch nodeStopLatch = new CountDownLatch(3); Ignite srv1 = startGrid(0); replaceWithStoppingMappingRequestListener( ((GridKernalContext)U.field(srv1, "ctx")).io(), 0, nodeStopLatch); Ignite srv2 = startGrid(1); replaceWithStoppingMappingRequestListener( ((GridKernalContext)U.field(srv2, "ctx")).io(), 1, nodeStopLatch); Ignite srv3 = startGrid(2); replaceWithStoppingMappingRequestListener( ((GridKernalContext)U.field(srv3, "ctx")).io(), 2, nodeStopLatch); srv3.cache(DEFAULT_CACHE_NAME).put( 1, new Organization(1, "Microsoft", "One Microsoft Way Redmond, WA 98052-6399, USA")); <START> clientMode = true; <END> Ignite cl1 = startClientGrid(4); try { cl1.cache(DEFAULT_CACHE_NAME).get(1); } catch (Exception e) { e.printStackTrace(); } nodeStopLatch.await(5_000, TimeUnit.MILLISECONDS); int result = mappingReqsCounter.get(); assertEquals("Expected requests count is 3, actual is " + result, 3, result); }</code><technical_language>This is redundant</technical_language>

Target:
public void testAllNodesDieOnRequest() throws Exception { CountDownLatch nodeStopLatch = new CountDownLatch(3); Ignite srv1 = startGrid(0); replaceWithStoppingMappingRequestListener( ((GridKernalContext)U.field(srv1, "ctx")).io(), 0, nodeStopLatch); Ignite srv2 = startGrid(1); replaceWithStoppingMappingRequestListener( ((GridKernalContext)U.field(srv2, "ctx")).io(), 1, nodeStopLatch); Ignite srv3 = startGrid(2); replaceWithStoppingMappingRequestListener( ((GridKernalContext)U.field(srv3, "ctx")).io(), 2, nodeStopLatch); srv3.cache(DEFAULT_CACHE_NAME).put( 1, new Organization(1, "Microsoft", "One Microsoft Way Redmond, WA 98052-6399, USA")); Ignite cl1 = startClientGrid(4); try { cl1.cache(DEFAULT_CACHE_NAME).get(1); } catch (Exception e) { e.printStackTrace(); } nodeStopLatch.await(5_000, TimeUnit.MILLISECONDS); int result = mappingReqsCounter.get(); assertEquals("Expected requests count is 3, actual is " + result, 3, result); }
Source:
<code>public void testBlockOperations() throws Exception { String blockContainer = CONTAINER_PREFIX + new SecureRandom().nextInt(); String blockBlob = "myblockblob-" + new SecureRandom().nextInt(); String A = "A"; String B = "B"; String C = "C"; String blockIdA = BaseEncoding.base64().encode((blockBlob + "-" + A).getBytes()); String blockIdB = BaseEncoding.base64().encode((blockBlob + "-" + B).getBytes()); String blockIdC = BaseEncoding.base64().encode((blockBlob + "-" + C).getBytes()); getApi().createContainer(blockContainer); getApi().putBlock(blockContainer, blockBlob, blockIdA, new ByteArrayPayload(A.getBytes())); getApi().putBlock(blockContainer, blockBlob, blockIdB, new ByteArrayPayload(B.getBytes())); <START> getApi().putBlock(blockContainer, blockBlob, blockIdC, new ByteArrayPayload(C.getBytes())); <END> getApi().putBlockList(blockContainer, blockBlob, Arrays.asList(blockIdA, blockIdB, blockIdC)); ListBlobBlocksResponse blocks = getApi().getBlockList(blockContainer, blockBlob); assertEquals(3, blocks.getBlocks().size()); assertEquals(blockIdA, blocks.getBlocks().get(0).getBlockName()); assertEquals(blockIdB, blocks.getBlocks().get(1).getBlockName()); assertEquals(blockIdC, blocks.getBlocks().get(2).getBlockName()); assertEquals(1, blocks.getBlocks().get(0).getContentLength()); assertEquals(1, blocks.getBlocks().get(1).getContentLength()); assertEquals(1, blocks.getBlocks().get(2).getContentLength()); getApi().deleteContainer(blockContainer); }</code><technical_language>minor Payloads.newByteArrayPayload</technical_language>

Target:
public void testBlockOperations() throws Exception { String blockContainer = CONTAINER_PREFIX + new SecureRandom().nextInt(); String blockBlob = "myblockblob-" + new SecureRandom().nextInt(); String A = "A"; String B = "B"; String C = "C"; String blockIdA = BaseEncoding.base64().encode((blockBlob + "-" + A).getBytes()); String blockIdB = BaseEncoding.base64().encode((blockBlob + "-" + B).getBytes()); String blockIdC = BaseEncoding.base64().encode((blockBlob + "-" + C).getBytes()); getApi().createContainer(blockContainer); getApi().putBlock(blockContainer, blockBlob, blockIdA, Payloads.newByteArrayPayload(A.getBytes())); getApi().putBlock(blockContainer, blockBlob, blockIdB, Payloads.newByteArrayPayload(B.getBytes())); getApi().putBlock(blockContainer, blockBlob, blockIdC, Payloads.newByteArrayPayload(C.getBytes())); getApi().putBlockList(blockContainer, blockBlob, Arrays.asList(blockIdA, blockIdB, blockIdC)); ListBlobBlocksResponse blocks = getApi().getBlockList(blockContainer, blockBlob); assertEquals(3, blocks.getBlocks().size()); assertEquals(blockIdA, blocks.getBlocks().get(0).getBlockName()); assertEquals(blockIdB, blocks.getBlocks().get(1).getBlockName()); assertEquals(blockIdC, blocks.getBlocks().get(2).getBlockName()); assertEquals(1, blocks.getBlocks().get(0).getContentLength()); assertEquals(1, blocks.getBlocks().get(1).getContentLength()); assertEquals(1, blocks.getBlocks().get(2).getContentLength()); getApi().deleteContainer(blockContainer); }
Source:
<code>ConsumerRateHistory decode(byte[] data) { MessageHeaderDecoder header = new MessageHeaderDecoder(); RateHistoryDecoder body = new RateHistoryDecoder(); UnsafeBuffer buffer = new UnsafeBuffer(data); header.wrap(buffer, 0); if (header.templateId() != RateHistoryDecoder.TEMPLATE_ID) { throw new IllegalStateException(String.format("RateHistoryDecoder TEMPLATE_ID=%d does not match encoded TEMPLATE_ID=%d", RateHistoryDecoder.TEMPLATE_ID, header.templateId())); } body.wrap(buffer, header.encodedLength(), header.blockLength(), header.version()); ConsumerRateHistory result = new ConsumerRateHistory(); for (RateHistoryDecoder.SubscriptionsDecoder subscriptionDecoder : body.subscriptions()) { long id = subscriptionDecoder.id(); List<Double> rates = new ArrayList<>(); <START> for (RateHistoryDecoder.SubscriptionsDecoder.RatesDecoder ratesDecoder : subscriptionDecoder.rates()) { <END> rates.add(ratesDecoder.rate()); } subscriptionIds.getSubscriptionId(id) .ifPresent(subscriptionId -> { result.setRateHistory(subscriptionId.getSubscriptionName(), new RateHistory(rates)); }); } return result; }</code><technical_language>Stream api? get rid of long RateHistoryDecoder.SubscriptionsDecoder.RatesDecoder ratesDecoder. WDYT</technical_language>

Target:
ConsumerRateHistory decode(byte[] data) { MessageHeaderDecoder header = new MessageHeaderDecoder(); RateHistoryDecoder body = new RateHistoryDecoder(); UnsafeBuffer buffer = new UnsafeBuffer(data); header.wrap(buffer, 0); if (header.templateId() != RateHistoryDecoder.TEMPLATE_ID) { throw new IllegalStateException(String.format("RateHistoryDecoder TEMPLATE_ID=%d does not match encoded TEMPLATE_ID=%d", RateHistoryDecoder.TEMPLATE_ID, header.templateId())); } body.wrap(buffer, header.encodedLength(), header.blockLength(), header.version()); ConsumerRateHistory result = new ConsumerRateHistory(); for (RateHistoryDecoder.SubscriptionsDecoder subscriptionDecoder : body.subscriptions()) { long id = subscriptionDecoder.id(); List<Double> rates = StreamSupport.stream(subscriptionDecoder.rates().spliterator(), false) .map(RatesDecoder::rate) .collect(Collectors.toList()); subscriptionIds.getSubscriptionId(id) .ifPresent(subscriptionId -> { result.setRateHistory(subscriptionId.getSubscriptionName(), new RateHistory(rates)); }); } return result; }
Source:
<code>public static List<CredentialsProvider> enabled(Object context) { List<CredentialsProvider> providers = new ArrayList<>(ExtensionList.lookup(CredentialsProvider.class)); <START> providers.removeIf(p -> !p.isEnabled(context)); <END> return providers; }</code><technical_language>similarly</technical_language>

Target:
public static List<CredentialsProvider> enabled(Object context) { return ExtensionList.lookup(CredentialsProvider.class) .stream() .filter(p -> p.isEnabled(context)) .collect(Collectors.toList()); }
Source:
<code>private boolean isDefaultGiven(String swaggerContent) throws APIManagementException { Swagger swagger = getSwagger(swaggerContent); boolean isDefaultGiven = true; try { Map<String, SecuritySchemeDefinition> securityDefinitions = swagger.getSecurityDefinitions(); if (securityDefinitions == null) { securityDefinitions = new HashMap<>(); } OAuth2Definition checkDefault = (OAuth2Definition) securityDefinitions.get(SWAGGER_SECURITY_SCHEMA_KEY); if (checkDefault == null) { isDefaultGiven = false; } return isDefaultGiven; <START> } catch (NullPointerException e){ <END> isDefaultGiven = false; return isDefaultGiven; } }</code><technical_language>catch NPEs. do a pre-check for null catching NPE</technical_language>

Target:
private boolean isDefaultGiven(String swaggerContent) throws APIManagementException { Swagger swagger = getSwagger(swaggerContent); Map<String, SecuritySchemeDefinition> securityDefinitions = swagger.getSecurityDefinitions(); if (securityDefinitions == null) { return false; } OAuth2Definition checkDefault = (OAuth2Definition) securityDefinitions.get(SWAGGER_SECURITY_SCHEMA_KEY); if (checkDefault == null) { return false; } return true; }
Source:
<code>private HttpHeaders changeResponseHeader(String headerName, Object headerValue) throws RestServiceException { try { responseMetadataChangeLock.lockInterruptibly(); verifyResponseAlive(); logger.trace("Changing response metadata for channel {}", ctx.channel()); return responseMetadata.headers().set(headerName, headerValue); } catch (InterruptedException e) { <START> logger.error("Internal metadata change lock acquiring interrupted. Throwing exception.. (channel {})", <END> ctx.channel(), e); nettyMetrics.responseMetadataWriteLockInterrupted.inc(); throw new RestServiceException("Response metadata change synchronization was interrupted", e, RestServiceErrorCode.OperationInterrupted); } finally { if (channelWriteLock.isHeldByCurrentThread()) { channelWriteLock.unlock(); } } }</code><technical_language>I ".." places in logging. dont follow this coding format. want consider changing</technical_language>

Target:
private HttpHeaders changeResponseHeader(String headerName, Object headerValue) throws RestServiceException { try { responseMetadataChangeLock.lockInterruptibly(); verifyResponseAlive(); logger.trace("Changing header to for channel {}", headerName, headerValue, ctx.channel()); return responseMetadata.headers().set(headerName, headerValue); } catch (InterruptedException e) { nettyMetrics.responseMetadataWriteLockInterruptedError.inc(); throw new RestServiceException("Internal metadata change lock acquiring interrupted. Response header not changed", e, RestServiceErrorCode.OperationInterrupted); } catch (RestServiceException e) { nettyMetrics.deadResponseAccessError.inc(); throw e; } finally { if (channelWriteLock.isHeldByCurrentThread()) { channelWriteLock.unlock(); } } }
Source:
<code>public void testExtraction() { ResourceGroupIdTemplate template = new ResourceGroupIdTemplate("test.pipeline.${pipeline}.${USER}"); ResourceGroupId expected = new ResourceGroupId(new ResourceGroupId(new ResourceGroupId(new ResourceGroupId("test"), "pipeline"), "testpipeline"), "user"); <START> Pattern sourcePattern = Pattern.compile("scheduler.important.(?<pipeline>([^\\[]*)).*"); <END> StaticSelector selector = new StaticSelector(Optional.empty(), Optional.of(sourcePattern), Optional.empty(), Optional.empty(), template); SelectionCriteria context = new SelectionCriteria(true, "user", Optional.of("scheduler.important.testpipeline[5]"), ImmutableSet.of(), 1, Optional.empty()); assertEquals(selector.match(context).map(SelectionContext::getResourceGroupId), Optional.of(expected)); }</code><technical_language>syntax for named group is unusual this pull request. Fix this occurrences in code json files. (?<name>.*) instead of (?<name>(.*))</technical_language>

Target:
public void testExtraction() { ResourceGroupIdTemplate template = new ResourceGroupIdTemplate("test.pipeline.job_${pipeline}_user:${USER}.${USER}"); ResourceGroupId expected = new ResourceGroupId(new ResourceGroupId(new ResourceGroupId(new ResourceGroupId("test"), "pipeline"), "job_testpipeline_user:user"), "user"); Pattern sourcePattern = Pattern.compile("scheduler.important.(?<pipeline>[^\\[]*).*"); StaticSelector selector = new StaticSelector(Optional.empty(), Optional.of(sourcePattern), Optional.empty(), Optional.empty(), template); SelectionCriteria context = new SelectionCriteria(true, "user", Optional.of("scheduler.important.testpipeline[5]"), ImmutableSet.of(), 1, Optional.empty()); assertEquals(selector.match(context).map(SelectionContext::getResourceGroupId), Optional.of(expected)); }
Source:
<code>public Collection<TurnCostTableEntry> analyzeTurnRelation(OSMTurnRelation turnRelation) { Map<Long, TurnCostTableEntry> entries = new LinkedHashMap<>(); for (FlagEncoder encoder : encodingManager.fetchEdgeEncoders()) { <START> if ((turnRelation == null) || ((turnRelation != null) && encoder.acceptsRelation(turnRelation))) { <END> for (TurnCostTableEntry entry : analyzeTurnRelation(encoder, turnRelation)) { TurnCostTableEntry oldEntry = entries.get(entry.getItemId()); if (oldEntry != null) { oldEntry.flags |= entry.flags; } else { entries.put(entry.getItemId(), entry); } } } } return entries.values(); }</code><technical_language>remove this null check (we check for null createTurnRelation 'default' is 'nothing is null')</technical_language>

Target:
public Collection<TurnCostTableEntry> analyzeTurnRelation(OSMTurnRelation turnRelation) { Map<Long, TurnCostTableEntry> entries = new LinkedHashMap<>(); for (FlagEncoder encoder : encodingManager.fetchEdgeEncoders()) { if (encoder.acceptsTurnRelation(turnRelation)) { for (TurnCostTableEntry entry : analyzeTurnRelation(encoder, turnRelation)) { TurnCostTableEntry oldEntry = entries.get(entry.getItemId()); if (oldEntry != null) { oldEntry.flags |= entry.flags; } else { entries.put(entry.getItemId(), entry); } } } } return entries.values(); }