auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testUpdateVcfSequenceDictionary(final String outputFileName) throws FileNotFoundException { final File input = new File(TEST_DATA_PATH, "vcfFormatTest.vcf"); final File samSequenceDictionaryVcf = new File(TEST_DATA_PATH, "vcfFormatTest.bad_dict.vcf"); File outputFile = new File(outputFileName); outputFile.deleteOnExit(); if ( outputFileName.equals(UpdateVcfSequenceDictionary.STD_OUT) ) { System.setOut(new PrintStream(STD_OUT_FILE)); } final UpdateVcfSequenceDictionary updateVcfSequenceDictionary = new UpdateVcfSequenceDictionary(); updateVcfSequenceDictionary.INPUT = input; updateVcfSequenceDictionary.SEQUENCE_DICTIONARY = samSequenceDictionaryVcf; updateVcfSequenceDictionary.OUTPUT = outputFile; Assert.assertEquals(updateVcfSequenceDictionary.instanceMain(new String[0]), 0); if ( outputFileName.equals(UpdateVcfSequenceDictionary.STD_OUT) ) { outputFile = STD_OUT_FILE; } IOUtil.assertFilesEqual(samSequenceDictionaryVcf, outputFile); Assert.assertEquals(SAMSequenceDictionaryExtractor.extractDictionary(input).size(), 84); Assert.assertEquals(SAMSequenceDictionaryExtractor.extractDictionary(samSequenceDictionaryVcf).size(), 82); Assert.assertEquals(SAMSequenceDictionaryExtractor.extractDictionary(outputFile).size(), 82); }

Target:
public void testUpdateVcfSequenceDictionary(final String outputFileName) throws IOException, NoSuchFieldException, IllegalAccessException { File input = new File(TEST_DATA_PATH, "vcfFormatTest.vcf"); final File samSequenceDictionaryVcf = new File(TEST_DATA_PATH, "vcfFormatTest.bad_dict.vcf"); File outputFile = new File(outputFileName); outputFile.deleteOnExit(); final UpdateVcfSequenceDictionary updateVcfSequenceDictionary = new UpdateVcfSequenceDictionary(); if (outputFileName.equals(STD_OUT_NAME)) { final FileOutputStream stream = new FileOutputStream(STD_OUT_FILE); final Field fdField = FileDescriptor.class.getDeclaredField("fd"); fdField.setAccessible(true); updateVcfSequenceDictionary.OUTPUT = new File("/dev/fd/" + fdField.getInt(stream.getFD())); } else { final FileOutputStream stream = null; updateVcfSequenceDictionary.OUTPUT = outputFile; } updateVcfSequenceDictionary.INPUT = input; updateVcfSequenceDictionary.SEQUENCE_DICTIONARY = samSequenceDictionaryVcf; Assert.assertEquals(updateVcfSequenceDictionary.instanceMain(new String[0]), 0); if (outputFileName.equals(STD_OUT_NAME)) { outputFile = STD_OUT_FILE; } IOUtil.assertFilesEqual(samSequenceDictionaryVcf, outputFile); Assert.assertEquals(SAMSequenceDictionaryExtractor.extractDictionary(input).size(), 84); Assert.assertEquals(SAMSequenceDictionaryExtractor.extractDictionary(samSequenceDictionaryVcf).size(), 82); Assert.assertEquals(SAMSequenceDictionaryExtractor.extractDictionary(outputFile).size(), 82); }
Source:
public File getInfoDir() { if (infoDir == null) { StorageLocationConfig storageLocation = locations.get(0); if (storageLocation != null) { infoDir = new File(storageLocation.getPath(), "info_dir"); } } return infoDir; }

Target:
public File getInfoDir() { if (infoDir == null) { if (locations == null || locations.size() == 0) { throw new ISE("You have no segment cache locations defined. Please configure druid.segmentCache.locations to use one or more locations."); } infoDir = new File(locations.get(0).getPath(), "info_dir"); } return infoDir; }
Source:
public void testGetAcceptableTokens() { final MatchXpathCheck matchXpathCheck = new MatchXpathCheck(); assertThat("Expected empty array", matchXpathCheck.getAcceptableTokens(), is(CommonUtil.EMPTY_INT_ARRAY)); }

Target:
public void testGetAcceptableTokens() { final MatchXpathCheck matchXpathCheck = new MatchXpathCheck(); assertWithMessage("Expected empty array") .that(matchXpathCheck.getAcceptableTokens()) .isEmpty(); }
Source:
public void testAllDomainsWithinThresholdsOneLacking() { domain1.getStorageDynamicData().setAvailableDiskSize(15); domain2.getStorageDynamicData().setAvailableDiskSize(7); ValidationResult result = validator.allDomainsWithinThresholds(); assertFalse("Both domains should not be withing thresholds", result.isValid()); assertEquals("Wrong validation error", VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_TARGET_STORAGE_DOMAIN, result.getMessage()); }

Target:
public void testAllDomainsWithinThresholdsOneLacking() { domain1.getStorageDynamicData().setAvailableDiskSize(15); domain2.getStorageDynamicData().setAvailableDiskSize(7); ValidationResult result = validator.allDomainsWithinThresholds(); assertFalse("domain2 should not be within thresholds", result.isValid()); assertEquals("Wrong validation error", VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_TARGET_STORAGE_DOMAIN, result.getMessage()); }
Source:
public RuntimeWorkspaceDto getRuntimeWorkspaceById(@PathParam("id") String id) throws ServerException, BadRequestException, NotFoundException { return asRuntimeWorkspaceDto(workspaceManager.getRuntimeWorkspace(id)); }

Target:
public RuntimeWorkspaceDto getRuntimeWorkspaceById(@PathParam("id") String id) throws ServerException, BadRequestException, NotFoundException { return asDto(workspaceManager.getRuntimeWorkspace(id)); }
Source:
private String getPatentMetadata(ImportedPatent patent, String securityToken, int retryCount) throws Exception { if (retryCount > maxRetriesCount) { throw new PatentServiceException("number of maximum retries exceeded: " + maxRetriesCount); } HttpRequest httpRequest = buildPatentMetaRequest(patent, securityToken, opsUriRoot); HttpResponse httpResponse = httpClient.execute(opsHost, httpRequest); int statusCode = httpResponse.getStatusLine().getStatusCode(); switch (statusCode) { case 200: { HttpEntity entity = httpResponse.getEntity(); if (entity != null) { return EntityUtils.toString(entity); } else { throw new PatentServiceException("got empty response, full status: " + httpResponse.getStatusLine() + ", server response: " + EntityUtils.toString(httpResponse.getEntity())); } } case 400: { return getPatentMetadata(patent, reauthenticate(), ++retryCount); } case 403: { log.warn("got 403 HTTP code in response, potential reason: endpoint rate limit reached. Delaying for " + throttleSleepTime + " ms, server response: " + EntityUtils.toString(httpResponse.getEntity())); Thread.sleep(throttleSleepTime); return getPatentMetadata(patent, securityToken, ++retryCount); } case 404: { throw new NoSuchElementException("unable to find element at: " + httpRequest.getRequestLine()); } default: { String errMessage = "got unhandled HTTP status code when accessing endpoint: " + statusCode + ", full status: " + httpResponse.getStatusLine() + ", server response: " + EntityUtils.toString(httpResponse.getEntity()); throw new PatentServiceException(errMessage); } } }

Target:
private String getPatentMetadata(ImportedPatent patent, String securityToken, int retryCount) throws Exception { if (retryCount > maxRetriesCount) { throw new PatentServiceException("number of maximum retries exceeded: " + maxRetriesCount); } HttpRequest httpRequest = buildPatentMetaRequest(patent, securityToken, opsUriRoot); HttpResponse httpResponse = httpClient.execute(opsHost, httpRequest); int statusCode = httpResponse.getStatusLine().getStatusCode(); switch (statusCode) { case 200: { HttpEntity entity = httpResponse.getEntity(); if (entity == null) { throw new PatentServiceException( "got empty entity in response, full status: " + httpResponse.getStatusLine()); } return EntityUtils.toString(entity); } case 400: { log.info("got 400 HTTP code in response, potential reason: access token invalid or expired"); return getPatentMetadata(patent, reauthenticate(), ++retryCount); } case 403: { log.warn("got 403 HTTP code in response, potential reason: endpoint rate limit reached. Delaying for " + throttleSleepTime + " ms, server response: " + EntityUtils.toString(httpResponse.getEntity())); Thread.sleep(throttleSleepTime); return getPatentMetadata(patent, securityToken, ++retryCount); } case 404: { throw new NoSuchElementException("unable to find element at: " + httpRequest.getRequestLine()); } default: { throw new PatentServiceException(String.format( "got unhandled HTTP status code when accessing endpoint: %d, full status: %s, server response: %s", statusCode, httpResponse.getStatusLine(), EntityUtils.toString(httpResponse.getEntity()))); } } }
Source:
public void archive(RegionServerServices services) throws IOException{ if (getNumRolledLogFiles() < 1) { return; } Map.Entry<Path, WalProps> firstWALEntry = this.walFile2Props.firstEntry(); Map<byte[], List<byte[]>> regions = this.sequenceIdAccounting.findLower(firstWALEntry.getValue().encodedName2HighestSequenceId); if (regions != null) { for (Map.Entry<byte[], List<byte[]>> entry : regions.entrySet()) { String encodedRegionName = Bytes.toString(entry.getKey()); HRegion r = (HRegion) services.getRegion(encodedRegionName); if (r == null) { LOG.warn("Failed to flush of when archive manually, because it is not online on us", encodedRegionName); return; } r.flushcache(entry.getValue(), false, FlushLifeCycleTracker.DUMMY); } } this.totalLogSize.addAndGet(-firstWALEntry.getValue().logSize); moveLogFileToArchiveDir(firstWALEntry.getKey()); this.walFile2Props.remove(firstWALEntry.getKey()); }

Target:
public void archive(RegionServerServices services) throws IOException{ if (getNumRolledLogFiles() < 1) { return; } Map.Entry<Path, WalProps> firstWALEntry = this.walFile2Props.firstEntry(); Map<byte[], List<byte[]>> regions = this.sequenceIdAccounting.findLower(firstWALEntry.getValue().encodedName2HighestSequenceId); if (regions != null) { for (Map.Entry<byte[], List<byte[]>> entry : regions.entrySet()) { String encodedRegionName = Bytes.toString(entry.getKey()); HRegion r = (HRegion) services.getRegion(encodedRegionName); if (r == null) { throw new RegionException("Failed to flush of " + encodedRegionName + " when archive manually, because it is not online on rs"); } r.flushcache(entry.getValue(), false, FlushLifeCycleTracker.DUMMY); } } moveLogFileToArchiveDir(firstWALEntry.getKey()); this.totalLogSize.addAndGet(-firstWALEntry.getValue().logSize); this.walFile2Props.remove(firstWALEntry.getKey()); }
Source:
public void testRetryPostEnabled() throws Exception { enableSunHttpClientRetryPostProp(); sendInitialGetRequest(); ClientResponse response = webResource.post(ClientResponse.class); assertEquals(200, response.getStatus()); response.close(); }

Target:
public void testRetryPostEnabled() throws Exception { enableSunHttpClientRetryPostProp(); sendInitialGetRequest(); ClientResponse response = null; try { response = webResource.post(ClientResponse.class); assertEquals(200, response.getStatus()); } finally { if (response != null) { response.close(); } } }
Source:
public void scanHttpRequestSend(HttpMessage msg, int id) { TreeSet<HtmlParameter> urlParams = msg.getUrlParams(); String uri = msg.getRequestHeader().getURI().toString(); boolean found = false; OptionsParam options = Model.getSingleton().getOptionsParam(); HttpSessionsParam sessionOptions = options.getParamSet(HttpSessionsParam.class); List<String> sessionIds = Collections.emptyList(); if (sessionOptions != null) { sessionIds = sessionOptions.getDefaultTokensEnabled(); } if (!urlParams.isEmpty()) { for (HtmlParameter param : urlParams) { if (sessionIds.contains(param.getName().toLowerCase(Locale.ROOT))) { if (param.getValue().length() > SESSION_TOKEN_MIN_LENGTH) { Alert alert = new Alert( getPluginId(), getRisk(), Alert.CONFIDENCE_HIGH, getName()); alert.setDetail( getDescription(), uri, param.getName(), "", "", getSolution(), getReference(), param.getValue(), getCweId(), getWascId(), msg); parent.raiseAlert(id, alert); found = true; } } } } if (!found && msg.getRequestHeader().getURI().getEscapedPath() != null) { Matcher jsessMatcher = null; String path = ""; try { path = msg.getRequestHeader().getURI().getPath().toLowerCase(); jsessMatcher = PATHSESSIONIDPATTERN.matcher(path); } catch (URIException e) { e.printStackTrace(); } if (jsessMatcher != null && jsessMatcher.find()) { Alert alert = new Alert(getPluginId(), getRisk(), Alert.CONFIDENCE_HIGH, getName()); alert.setDetail( getDescription(), uri, "", "", "", getSolution(), getReference(), jsessMatcher.group(), getCweId(), getWascId(), msg); parent.raiseAlert(id, alert); found = true; } } if (found) { try { checkSessionIDExposureTo3rdParty(msg, id); } catch (URIException e) { } } }

Target:
public void scanHttpRequestSend(HttpMessage msg, int id) { }
Source:
public List<String> normalize(String... strings) { final Map<String, Pair<String, String>> stringParts = Arrays.stream(strings) .filter(Objects::nonNull) .collect(Collectors.toMap(Function.identity(), this::decompose, (value, ignore) -> value)); final int maxNumericSuffixLength = stringParts.values() .stream() .filter(Objects::nonNull) .collect(Collectors.summarizingInt(pair -> pair.getSecond().length())) .getMax(); return Arrays.stream(strings) .map(str -> compose(str, stringParts, maxNumericSuffixLength)) .collect(Collectors.toList()); }

Target:
public List<String> normalize(String... strings) { final Map<String, Pair<String, String>> stringParts = new HashMap<>(strings.length); Arrays.stream(strings) .filter(Objects::nonNull) .forEach(str -> stringParts.put(str, decompose(str))); final int maxNumericSuffixLength = stringParts.values() .stream() .filter(Objects::nonNull) .collect(Collectors.summarizingInt(pair -> pair.getSecond().length())) .getMax(); return Arrays.stream(strings) .map(str -> compose(str, stringParts, maxNumericSuffixLength)) .collect(Collectors.toList()); }
Source:
protected void calculateFilters() { Map<String, String> values = getValues(); Collection<MarkerFieldFilter> filters = new ArrayList<>(); for (MarkerField field : generator.getVisibleFields()) { MarkerFieldFilter fieldFilter = MarkerSupportInternalUtilities.generateFilter(field); if (fieldFilter != null) { filters.add(fieldFilter); if (fieldFilter instanceof MarkerTypeFieldFilter) { ((MarkerTypeFieldFilter) fieldFilter).setContentGenerator(generator); } if (values != null) { fieldFilter.initialize(values); } } } MarkerFieldFilter[] newFilters = new MarkerFieldFilter[filters.size()]; filters.toArray(newFilters); fieldFilters = newFilters; }

Target:
protected void calculateFilters() { Map<String, String> values = getValues(); Collection<MarkerFieldFilter> filters = new ArrayList<>(); for (MarkerField visibleField : generator.getVisibleFields()) { MarkerFieldFilter fieldFilter = MarkerSupportInternalUtilities.generateFilter(visibleField); if (fieldFilter != null) { filters.add(fieldFilter); if (fieldFilter instanceof MarkerTypeFieldFilter) { ((MarkerTypeFieldFilter) fieldFilter).setContentGenerator(generator); } if (values != null) { fieldFilter.initialize(values); } } } MarkerFieldFilter[] newFilters = new MarkerFieldFilter[filters.size()]; filters.toArray(newFilters); fieldFilters = newFilters; }
Source:
protected IntegerRangePredicate(FieldDef<T, Integer> type, String value) throws QueryParseException { super(type, value); if (value.startsWith("<=")) { relation = Relation.LESS_THAN_OR_EQUAL; value = value.substring(2); } else if (value.startsWith("<")) { relation = Relation.LESS_THAN; value = value.substring(1); } else if (value.startsWith(">=")) { relation = Relation.GREATER_THAN_OR_EQUAL; value = value.substring(2); } else if (value.startsWith(">")) { relation = Relation.GREATER_THAN; value = value.substring(1); } else { relation = Relation.EQUAL; } try { queryInt = Integer.parseInt(value); } catch (NumberFormatException e) { throw new QueryParseException(e.getMessage(), e); } }

Target:
protected IntegerRangePredicate(FieldDef<T, Integer> type, String value) throws QueryParseException { super(type, value); range = RangeUtil.getRange(value, Integer.MIN_VALUE, Integer.MAX_VALUE); if (range == null) { throw new QueryParseException("Invalid range predicate: " + value); } }
Source:
private void showNic(NetworkInterfaceModel nic) { contents.removeAllRows(); VdsNetworkInterface entity = nic.getOriginalIface(); addRow(templates.titleSetupNetworkTooltip(nic.getName(), SafeStylesUtils.forTrustedBackgroundColor(BACKGROUND_COLOR))); if (nic.getItems().isEmpty() && !nic.isBonded()) { insertHorizontalLine(); addMtuInfo(entity.getMtu()); addBootProtoAndIpInfo(new InterfacePropertiesAccessor.FromNic(entity, null)); } if (nic instanceof BondNetworkInterfaceModel) { CreateOrUpdateBond createOrUpdateBond = ((BondNetworkInterfaceModel) nic).getCreateOrUpdateBond(); String bondOptions = entity.getBondOptions(); if (createOrUpdateBond != null) { bondOptions = createOrUpdateBond.getBondOptions(); } addRow(constants.bondOptionsItemInfo(), bondOptions.replace(BOND_OPTIONS_IP_SEPARATOR, BOND_OPTIONS_IP_SEPARATOR + " ")); } else { addLldpInfo(nic); } if (nic.isVf()) { addRow(constants.physicalFunction(), nic.getPhysicalFunction()); } HostNicVfsConfig vfsConfig = nic.getSetupModel().getVfConfig(nic.getOriginalIface().getId()); addNonNullOrEmptyValueRow(constants.enabledVirtualFunctions(), vfsConfig != null ? String.valueOf(vfsConfig.getNumOfVfs()) : null); addNonNullOrEmptyValueRow(constants.freeVirtualFunctions(), vfsConfig != null ? String.valueOf(vfsConfig.getNumOfFreeVfs()) : null); }

Target:
private void showNic(NetworkInterfaceModel nic) { contents.removeAllRows(); VdsNetworkInterface entity = nic.getOriginalIface(); addRow(templates.titleSetupNetworkTooltip(nic.getName(), SafeStylesUtils.forTrustedBackgroundColor(BACKGROUND_COLOR))); if (nic.getItems().isEmpty() && !nic.isBonded()) { insertHorizontalLine(); addMtuInfo(entity.getMtu()); addBootProtoAndIpInfo(new InterfacePropertiesAccessor.FromNic(entity, null)); } if (nic instanceof BondNetworkInterfaceModel) { CreateOrUpdateBond createOrUpdateBond = ((BondNetworkInterfaceModel) nic).getCreateOrUpdateBond(); String bondOptions = entity.getBondOptions(); if (createOrUpdateBond != null) { bondOptions = createOrUpdateBond.getBondOptions(); } addRow(constants.bondOptionsItemInfo(), bondOptions.replace(BOND_OPTIONS_IP_SEPARATOR, BOND_OPTIONS_IP_SEPARATOR + " ")); } else { addLldpInfo(nic); } if (nic.isVf()) { addRow(constants.physicalFunction(), nic.getPhysicalFunction()); } HostNicVfsConfig vfsConfig = nic.getSetupModel().getVfConfig(nic.getOriginalIface().getId()); if (nic.isSriovEnabled()) { addNonNullOrEmptyValueRow(constants.enabledVirtualFunctions(), String.valueOf(vfsConfig.getNumOfVfs())); addNonNullOrEmptyValueRow(constants.freeVirtualFunctions(), String.valueOf(vfsConfig.getNumOfFreeVfs())); } }
Source:
private Address contact(final Gateway gateway, final int expires) throws ServletParseException { SipURI outboundInterface = null; if (address != null && !address.isEmpty()) { if(address.contains(":")) { outboundInterface = (SipURI) factory.createSipURI(null, address); } else { outboundInterface = outboundInterface(address, "udp"); } } else { outboundInterface = outboundInterface(); } if (outboundInterface == null) outboundInterface = (SipURI) factory.createSipURI(null, address); final String user = gateway.getUserName(); String contactUser = new String (user); if (contactUser.contains("@")) { int index = contactUser.indexOf("@"); contactUser = contactUser.substring(0, index); } final String host = outboundInterface.getHost(); int port = outboundInterface.getPort(); if (port == -1) { port = outboundInterface().getPort(); } final StringBuilder buffer = new StringBuilder(); buffer.append("sip:").append(contactUser).append("@").append(host).append(":").append(port); final Address contact = factory.createAddress(buffer.toString()); contact.setExpires(expires); return contact; }

Target:
private Address contact(final Gateway gateway, final int expires) throws ServletParseException { SipURI outboundInterface = null; if (address != null && !address.isEmpty()) { if(address.contains(":")) { outboundInterface = (SipURI) factory.createSipURI(null, address); } else { outboundInterface = outboundInterface(address, "udp"); } } else { outboundInterface = outboundInterface(); } if (outboundInterface == null) outboundInterface = (SipURI) factory.createSipURI(null, address); final String user = gateway.getUserName(); String contactUser = user; if (contactUser.contains("@")) { int index = contactUser.indexOf("@"); contactUser = contactUser.substring(0, index); } final String host = outboundInterface.getHost(); int port = outboundInterface.getPort(); if (port == -1) { port = outboundInterface().getPort(); } final StringBuilder buffer = new StringBuilder(); buffer.append("sip:").append(contactUser).append("@").append(host).append(":").append(port); final Address contact = factory.createAddress(buffer.toString()); contact.setExpires(expires); return contact; }
Source:
private void validateFilter() { String filter = getProperty(NotificationProperties.FILTER); if (!StringUtils.isEmpty(filter)) { String[] filterElements = filter.split("\\s+"); for (String filterElement : filterElements) { if (!StringUtils.isEmpty(filterElement)) { if (!FirstMatchSimpleFilter.PARSE_PATTERN.matcher(filterElement).matches()) { throw new IllegalArgumentException( String.format("%s Illegal value for %s , (%s)", GENERIC_MESSAGE, FILTER, filterElement)); } } } } }

Target:
private void validateFilter() { String filter = getProperty(NotificationProperties.FILTER, true); if (filter != null) FirstMatchSimpleFilter.parse(filter); }
Source:
private void announceTask(Worker theWorker, RemoteTaskRunnerWorkItem taskRunnerWorkItem) throws Exception { final Task task = taskRunnerWorkItem.getTask(); log.info("Coordinator asking Worker[%s] to add task[%s]", theWorker.getHost(), task.getId()); byte[] rawBytes = jsonMapper.writeValueAsBytes(task); if (rawBytes.length > config.getMaxNumBytes()) { throw new ISE("Length of raw bytes for task too large[%,d > %,d]", rawBytes.length, config.getMaxNumBytes()); } String taskPath = JOINER.join(config.getIndexerTaskPath(), theWorker.getHost(), task.getId()); if (cf.checkExists().forPath(taskPath) == null) { cf.create() .withMode(CreateMode.EPHEMERAL) .forPath( taskPath, rawBytes ); } runningTasks.put(task.getId(), pendingTasks.remove(task.getId()).withWorker(theWorker)); log.info("Task %s switched from pending to running", task.getId()); Stopwatch timeoutStopwatch = new Stopwatch(); timeoutStopwatch.start(); synchronized (statusLock) { while (!isWorkerRunningTask(theWorker, task)) { statusLock.wait(config.getTaskAssignmentTimeoutDuration().getMillis()); if (timeoutStopwatch.elapsed(TimeUnit.MILLISECONDS) >= config.getTaskAssignmentTimeoutDuration().getMillis()) { log.error( "Something went wrong! %s never ran task %s after %s!", theWorker.getHost(), task.getId(), config.getTaskAssignmentTimeoutDuration() ); taskRunnerWorkItem.setResult(TaskStatus.failure(taskRunnerWorkItem.getTask().getId())); break; } } } }

Target:
private void announceTask(Worker theWorker, RemoteTaskRunnerWorkItem taskRunnerWorkItem) throws Exception { final Task task = taskRunnerWorkItem.getTask(); log.info("Coordinator asking Worker[%s] to add task[%s]", theWorker.getHost(), task.getId()); byte[] rawBytes = jsonMapper.writeValueAsBytes(task); if (rawBytes.length > config.getMaxNumBytes()) { throw new ISE("Length of raw bytes for task too large[%,d > %,d]", rawBytes.length, config.getMaxNumBytes()); } String taskPath = JOINER.join(config.getIndexerTaskPath(), theWorker.getHost(), task.getId()); if (cf.checkExists().forPath(taskPath) == null) { cf.create() .withMode(CreateMode.EPHEMERAL) .forPath( taskPath, rawBytes ); } RemoteTaskRunnerWorkItem workItem = pendingTasks.remove(task.getId()); if (workItem == null) { log.makeAlert("WTF?! Got a null work item from pending tasks?! How can this be?!") .addData("taskId", task.getId()) .emit(); return; } runningTasks.put(task.getId(), workItem.withWorker(theWorker)); log.info("Task %s switched from pending to running", task.getId()); Stopwatch timeoutStopwatch = new Stopwatch(); timeoutStopwatch.start(); synchronized (statusLock) { while (!isWorkerRunningTask(theWorker, task)) { statusLock.wait(config.getTaskAssignmentTimeoutDuration().getMillis()); if (timeoutStopwatch.elapsed(TimeUnit.MILLISECONDS) >= config.getTaskAssignmentTimeoutDuration().getMillis()) { log.error( "Something went wrong! %s never ran task %s after %s!", theWorker.getHost(), task.getId(), config.getTaskAssignmentTimeoutDuration() ); taskRunnerWorkItem.setResult(TaskStatus.failure(taskRunnerWorkItem.getTask().getId())); break; } } } }
Source:
public void startElement(final String uri, final String localName, final String qName, final Attributes atts) throws SAXException { Attributes resAtts = atts; if ((TOPIC_XREF.matches(atts) || TOPIC_LINK.matches(atts) || TOPIC_IMAGE.matches(atts) || SVG_D_SVGREF.matches(atts)) && !Objects.equals(ATTR_SCOPE_VALUE_EXTERNAL, atts.getValue(ATTRIBUTE_NAME_SCOPE)) && atts.getValue(ATTRIBUTE_NAME_HREF) != null) { resAtts = new XMLUtils.AttributesBuilder(atts) .add(ATTRIBUTE_NAME_HREF, updateHref(atts.getValue(ATTRIBUTE_NAME_HREF))) .build(); } getContentHandler().startElement(uri, localName, qName, resAtts); }

Target:
public void startElement(final String uri, final String localName, final String qName, final Attributes atts) throws SAXException { Attributes resAtts = atts; if ((TOPIC_XREF.matches(atts) || TOPIC_LINK.matches(atts) || TOPIC_IMAGE.matches(atts)) && !Objects.equals(ATTR_SCOPE_VALUE_EXTERNAL, atts.getValue(ATTRIBUTE_NAME_SCOPE)) && atts.getValue(ATTRIBUTE_NAME_HREF) != null) { resAtts = new XMLUtils.AttributesBuilder(atts) .add(ATTRIBUTE_NAME_HREF, updateHref(atts.getValue(ATTRIBUTE_NAME_HREF))) .build(); } getContentHandler().startElement(uri, localName, qName, resAtts); }
Source:
public QueryTraversal(GraphQLSchema schema, Document document, String operation, Map<String, Object> variables) { NodeUtil.GetOperationResult getOperationResult = NodeUtil.getOperation(document, operation); this.schema = schema; this.variables = variables; this.fragmentsByName = getOperationResult.fragmentsByName; this.roots = getOperationResult.operationDefinition.getSelectionSet().getChildren(); this.rootParentType = getRootTypeFromOperation(getOperationResult.operationDefinition); this.childrenOfSelectionProvider = new ChildrenOfSelectionProvider(fragmentsByName); }

Target:
private QueryTraversal(GraphQLSchema schema, Document document, String operation, Map<String, Object> variables) { assertNotNull(document, "document can't be null"); NodeUtil.GetOperationResult getOperationResult = NodeUtil.getOperation(document, operation); this.schema = assertNotNull(schema, "schema can't be null"); this.variables = assertNotNull(variables, "variables can't be null"); this.fragmentsByName = getOperationResult.fragmentsByName; this.roots = getOperationResult.operationDefinition.getSelectionSet().getChildren(); this.rootParentType = getRootTypeFromOperation(getOperationResult.operationDefinition); this.childrenOfSelectionProvider = new ChildrenOfSelectionProvider(fragmentsByName); }
Source:
private void invalidate() { List<String> expiredList = new ArrayList<>(); try { expiredList = activityDao.findExpired(System.currentTimeMillis()); } catch (ServerException e) { LOG.error(e.getLocalizedMessage(), e); } for (String workspaceId : expiredList) { try { Workspace workspace = workspaceManager.getWorkspace(workspaceId); workspace.getAttributes().put(WORKSPACE_STOPPED_BY, ACTIVITY_CHECKER); workspaceManager.updateWorkspace(workspaceId, workspace); workspaceManager.stopWorkspace(workspaceId, emptyMap()); } catch (NotFoundException ignored) { } catch (ConflictException e) { LOG.warn(e.getLocalizedMessage()); } catch (Exception ex) { LOG.error(ex.getLocalizedMessage()); LOG.debug(ex.getLocalizedMessage(), ex); } finally { try { activityDao.removeExpiration(workspaceId); } catch (ServerException e) { LOG.error(e.getLocalizedMessage(), e); } } } }

Target:
private void invalidate() { try { activityDao.findExpired(System.currentTimeMillis()).forEach(this::stopExpired); } catch (ServerException e) { LOG.error(e.getLocalizedMessage(), e); } }
Source:
public void testStrictVerificationFailure() { PrintableResult result = testResult(HasTempFolderWithAssuredDeletion.class); assertThat(result, failureCountIs(1)); assertThat(result.toString(), CoreMatchers.containsString("Unable to clean up temporary folder")); }

Target:
public void testStrictVerificationFailure() { PrintableResult result = testResult(HasTempFolderWithAssuredDeletion.class); assertThat(result, failureCountIs(1)); assertThat(result.toString(), containsString("Unable to clean up temporary folder")); }
Source:
public void testDefault() throws Exception { final String msg = getCheckMessage(InvalidJavadocPositionCheck.class, "invalid.position"); final String[] expected = { "1:9: " + msg, "3:1: " + msg, "6:1: " + msg, "9:5: " + msg, "13:5: " + msg, "23:9: " + msg, "24:17: " + msg, "25:17: " + msg, "35:10: " + msg, "36:19: " + msg, "37:19: " + msg, "38:21: " + msg, "39:23: " + msg, "43:1: " + msg, "45:7: " + msg, "46:36: " + msg, "47:1: " + msg, }; final Configuration checkConfig = getModuleConfig("InvalidJavadocPosition"); final String filePath = getPath("InputInvalidJavadocPosition.java"); final Integer[] warnList = getLinesWithWarn(filePath); verify(checkConfig, filePath, expected, warnList); }

Target:
public void testDefault() throws Exception { final String message = getCheckMessage(InvalidJavadocPositionCheck.class, "invalid.position"); final String[] expected = { "1:9: " + message, "3:1: " + message, "6:1: " + message, "9:5: " + message, "14:5: " + message, "17:5: " + message, "27:9: " + message, "28:17: " + message, "29:17: " + message, "39:10: " + message, "40:19: " + message, "41:19: " + message, "42:21: " + message, "43:23: " + message, "47:1: " + message, "52:7: " + message, "53:36: " + message, "54:1: " + message, }; final Configuration checkConfig = getModuleConfig("InvalidJavadocPosition"); final String filePath = getPath("InputInvalidJavadocPosition.java"); final Integer[] warnList = getLinesWithWarn(filePath); verify(checkConfig, filePath, expected, warnList); }
Source:
public UndefinedExpressionColumn(final HeaderMetaData headerMetaData, final UndefinedExpressionGrid gridWidget, final CellEditorControls cellEditorControls, final Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier) { this(new ArrayList<HeaderMetaData>() {{ add(headerMetaData); }}, gridWidget, cellEditorControls, expressionEditorDefinitionsSupplier); }

Target:
public UndefinedExpressionColumn(final HeaderMetaData headerMetaData, final UndefinedExpressionGrid gridWidget, final CellEditorControls cellEditorControls, final Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier) { this(Collections.singletonList(headerMetaData), gridWidget, cellEditorControls, expressionEditorDefinitionsSupplier); }
Source:
ContiguousOffsetCalculator(int numBlocks) { if (numBlocks <= 0 && (numBlocks & (numBlocks - 1)) == 0) { throw new IllegalArgumentException("maxOffset " + numBlocks + " must be greater than 0 and a power of 2"); } offsetBitPosition = 31 - Integer.numberOfTrailingZeros(numBlocks); }

Target:
ContiguousOffsetCalculator(int numBlocks) { if (numBlocks <= 0 || (numBlocks & (numBlocks - 1)) != 0) { throw new IllegalArgumentException("numBlocks " + numBlocks + " must be greater than 0 and a power of 2"); } offsetShift = 31 - Integer.numberOfTrailingZeros(numBlocks); }
Source:
default PlanNode resolve(PlanNode node) { if (node instanceof GroupReference) { return getOnlyElement(resolveGroup(node)); } return node; }

Target:
default PlanNode resolve(PlanNode node) { if (node instanceof GroupReference) { return resolveGroup(node).collect(toOptional()).get(); } return node; }
Source:
private List<Long> getCommittedTimestampsDescendingAndCleanupAborted( ShardAndStrategy shardStrategy, Multimap<Long, WriteInfo> startTsWrites) { Map<Long, Long> startToCommitTs = commitTsLoader.loadBatch(startTsWrites.keySet()); Map<TableReference, Multimap<Cell, Long>> cellsToDelete = new HashMap<>(); List<Long> committedTimestamps = new ArrayList<>(); for (Map.Entry<Long, Long> entry : startToCommitTs.entrySet()) { if (entry.getValue() == TransactionConstants.FAILED_COMMIT_TS) { startTsWrites.get(entry.getKey()) .forEach(write -> cellsToDelete .computeIfAbsent(write.tableRef(), ignore -> HashMultimap.create()) .put(write.cell(), write.timestamp())); } else { committedTimestamps.add(entry.getKey()); } } cellsToDelete.forEach((tableRef, multimap) -> { kvs.delete(tableRef, multimap); maybeMetrics.ifPresent(metrics -> metrics.updateAbortedWritesDeleted(shardStrategy, multimap.size())); log.info("Deleted aborted writes from the KVS.", multimap.size()); }); committedTimestamps.sort(Comparator.reverseOrder()); return committedTimestamps; }

Target:
private List<Long> getCommittedTimestampsDescendingAndCleanupAborted( ShardAndStrategy shardStrategy, Multimap<Long, WriteInfo> startTsWrites) { Map<Long, Long> startToCommitTs = commitTsLoader.loadBatch(startTsWrites.keySet()); Map<TableReference, Multimap<Cell, Long>> cellsToDelete = new HashMap<>(); List<Long> committedTimestamps = new ArrayList<>(); for (Map.Entry<Long, Long> entry : startToCommitTs.entrySet()) { if (entry.getValue() == TransactionConstants.FAILED_COMMIT_TS) { startTsWrites.get(entry.getKey()) .forEach(write -> cellsToDelete .computeIfAbsent(write.tableRef(), ignore -> HashMultimap.create()) .put(write.cell(), write.timestamp())); } else { committedTimestamps.add(entry.getKey()); } } cellsToDelete.forEach((tableRef, multimap) -> { kvs.delete(tableRef, multimap); maybeMetrics.ifPresent(metrics -> metrics.updateAbortedWritesDeleted(shardStrategy, multimap.size())); log.info("Deleted aborted writes from the KVS.", SafeArg.of("number", multimap.size())); }); committedTimestamps.sort(Comparator.reverseOrder()); return committedTimestamps; }
Source:
public JobManagerRunnerImpl( final JobGraph jobGraph, final JobMasterServiceFactory jobMasterFactory, final HighAvailabilityServices haServices, final LibraryCacheManager.ClassLoaderLease classLoaderLease, final Executor executor, final FatalErrorHandler fatalErrorHandler) throws Exception { this.resultFuture = new CompletableFuture<>(); this.terminationFuture = new CompletableFuture<>(); this.leadershipOperation = CompletableFuture.completedFuture(null); this.jobGraph = checkNotNull(jobGraph); this.classLoaderLease = checkNotNull(classLoaderLease); this.executor = checkNotNull(executor); this.fatalErrorHandler = checkNotNull(fatalErrorHandler); checkArgument(jobGraph.getNumberOfVertices() > 0, "The given job is empty"); final ClassLoader userCodeLoader; try { userCodeLoader = classLoaderLease.getOrResolveClassLoader( jobGraph.getUserJarBlobKeys(), jobGraph.getClasspaths()); } catch (IOException e) { throw new Exception("Cannot set up the user code libraries: " + e.getMessage(), e); } this.runningJobsRegistry = haServices.getRunningJobsRegistry(); this.leaderElectionService = haServices.getJobManagerLeaderElectionService(jobGraph.getJobID()); this.leaderGatewayFuture = new CompletableFuture<>(); try { this.jobMasterService = jobMasterFactory.createJobMasterService(jobGraph, this, userCodeLoader); } catch (Throwable t) { ClusterEntryPointExceptionUtils.tryEnrichClusterEntryPointError(t); throw t; } }

Target:
public JobManagerRunnerImpl( final JobGraph jobGraph, final JobMasterServiceFactory jobMasterFactory, final HighAvailabilityServices haServices, final LibraryCacheManager.ClassLoaderLease classLoaderLease, final Executor executor, final FatalErrorHandler fatalErrorHandler) throws Exception { this.resultFuture = new CompletableFuture<>(); this.terminationFuture = new CompletableFuture<>(); this.leadershipOperation = CompletableFuture.completedFuture(null); this.jobGraph = checkNotNull(jobGraph); this.classLoaderLease = checkNotNull(classLoaderLease); this.executor = checkNotNull(executor); this.fatalErrorHandler = checkNotNull(fatalErrorHandler); checkArgument(jobGraph.getNumberOfVertices() > 0, "The given job is empty"); final ClassLoader userCodeLoader; try { userCodeLoader = classLoaderLease.getOrResolveClassLoader( jobGraph.getUserJarBlobKeys(), jobGraph.getClasspaths()); } catch (IOException e) { throw new Exception("Cannot set up the user code libraries: " + e.getMessage(), e); } this.runningJobsRegistry = haServices.getRunningJobsRegistry(); this.leaderElectionService = haServices.getJobManagerLeaderElectionService(jobGraph.getJobID()); this.leaderGatewayFuture = new CompletableFuture<>(); this.jobMasterService = jobMasterFactory.createJobMasterService(jobGraph, this, userCodeLoader); }
Source:
@Override public void onTxEnd(GridCacheSharedContext cctx, IgniteInternalTx tx, boolean commit) { for (int i = 0; i < activeCacheIds.size(); i++) { int cacheId = activeCacheIds.get(i); GridCacheContext cacheCtx = cctx.cacheContext(cacheId); assert cacheCtx != null : "cacheCtx == null"; onTxEnd(cacheCtx, tx, commit); } }

Target:
@Override public void onTxEnd(GridCacheSharedContext cctx, IgniteInternalTx tx, boolean commit) { for (int i = 0; i < activeCacheIds.size(); i++) { int cacheId = activeCacheIds.get(i); GridCacheContext cacheCtx = cctx.cacheContext(cacheId); assert cacheCtx != null : "cacheCtx == null, cacheId=" + cacheId; onTxEnd(cacheCtx, tx, commit); } }
Source:
public void verifyIvParameterSpecIdentity() throws Exception { boolean done = false; int iterations = 0; final int maxIterations = 10000; while (!done && iterations++ < maxIterations) { SupportedCipherDetails cipherDetails = AesCtrCipherDetails.INSTANCE_256_BIT; final byte[] iv = cipherDetails.generateIv(); AlgorithmParameterSpec spec = cipherDetails.getEncryptionParameterSpec(iv, 0L); Cipher cipher = cipherDetails.getCipher(); SecretKey secretKey = SecretKeyUtils.generate(cipherDetails); cipher.init(Cipher.DECRYPT_MODE, secretKey, spec); Assert.assertEquals(iv, cipher.getIV(), "Calculated initialization " + "vector does not match expected value [expected=" + Arrays.toString(iv) + " actual=" + Arrays.toString(cipher.getIV()) + "]"); final BigInteger ivBigInt = new BigInteger(iv); if (ivBigInt.compareTo(BigInteger.ZERO) == -1) { done = true; } } }

Target:
public void verifyIvParameterSpecIdentity() throws Exception { boolean done = false; int iterations = 0; final int maxIterations = 10000; while (!done && iterations++ < maxIterations) { SupportedCipherDetails cipherDetails = AesCtrCipherDetails.INSTANCE_256_BIT; final byte[] iv = cipherDetails.generateIv(); AlgorithmParameterSpec spec = cipherDetails.getEncryptionParameterSpec(iv, 0L); Cipher cipher = cipherDetails.getCipher(); SecretKey secretKey = SecretKeyUtils.generate(cipherDetails); cipher.init(Cipher.DECRYPT_MODE, secretKey, spec); Assert.assertEquals(iv, cipher.getIV(), "Calculated initialization " + "vector does not match expected value [expected=" + Arrays.toString(iv) + " actual=" + Arrays.toString(cipher.getIV()) + "]"); final BigInteger ivBigInt = new BigInteger(iv); if (ivBigInt.compareTo(BigInteger.ZERO) < 0) { done = true; } } }
Source:
void migratePerJobCredentials() { if (credentials == null && !mayHaveLegacyPerJobCredentials ) { return; } boolean allOk = true; Jenkins instance = Jenkins.getInstance(); if (instance != null) { for (AbstractProject<?, ?> job : instance.getAllItems(AbstractProject.class)) { File jobCredentials = new File(job.getRootDir(), "subversion.credentials"); if (jobCredentials.isFile()) { try { new PerJobCredentialStore(job).migrateCredentials(this); job.save(); if (!jobCredentials.delete()) { LOGGER.log(Level.WARNING, "Could not remove legacy per-job credentials store file: {0}", jobCredentials); allOk = false; } } catch (IOException e) { LOGGER.log(Level.WARNING, "Could not migrate per-job credentials for " + job.getFullName(), e); allOk = false; } } } } mayHaveLegacyPerJobCredentials = !allOk; save(); }

Target:
void migratePerJobCredentials() { if (credentials == null && !mayHaveLegacyPerJobCredentials ) { return; } boolean allOk = true; Jenkins instance = Jenkins.getInstance(); List<AbstractProject> allItems; if (instance == null) { allItems = Collections.emptyList(); } else { allItems = instance.getAllItems(AbstractProject.class); } for (AbstractProject<?, ?> job : allItems) { File jobCredentials = new File(job.getRootDir(), "subversion.credentials"); if (jobCredentials.isFile()) { try { new PerJobCredentialStore(job).migrateCredentials(this); job.save(); if (!jobCredentials.delete()) { LOGGER.log(Level.WARNING, "Could not remove legacy per-job credentials store file: {0}", jobCredentials); allOk = false; } } catch (IOException e) { LOGGER.log(Level.WARNING, "Could not migrate per-job credentials for " + job.getFullName(), e); allOk = false; } } } mayHaveLegacyPerJobCredentials = !allOk; save(); }
Source:
public void invokeCallbackMethods() { initCommandExecutor(); Iterator<Entry<Guid, CommandContainer>> iterator = cmdCallbackMap.entrySet().iterator(); while (iterator.hasNext()) { Entry<Guid, CommandContainer> entry = iterator.next(); if (--entry.getValue().executionCountdown > 0) { continue; } Guid cmdId = entry.getKey(); CommandCallback callback = entry.getValue().callback; CommandStatus status = coco.getCommandStatus(cmdId); boolean errorInCallback = false; try { switch (status) { case FAILED: callback.onFailed(cmdId, coco.getChildCommandIds(cmdId)); break; case SUCCEEDED: callback.onSucceeded(cmdId, coco.getChildCommandIds(cmdId)); break; case ACTIVE: if (coco.getCommandEntity(cmdId).isExecuted()) { callback.doPolling(cmdId, coco.getChildCommandIds(cmdId)); } break; default: break; } } catch (Exception ex) { errorInCallback = true; handleError(ex, status, cmdId); } finally { if (CommandStatus.FAILED.equals(status) || (CommandStatus.SUCCEEDED.equals(status) && !errorInCallback)) { coco.updateCallbackNotified(cmdId); iterator.remove(); } else { int maxDelay = Config.<Integer>getValue(ConfigValues.AsyncCommandPollingRateInSeconds); entry.getValue().executionDelay = Math.min(maxDelay, entry.getValue().executionDelay * 2); entry.getValue().executionCountdown = entry.getValue().executionDelay; } } } }

Target:
public void invokeCallbackMethods() { initCommandExecutor(); Iterator<Entry<Guid, CommandContainer>> iterator = cmdCallbackMap.entrySet().iterator(); while (iterator.hasNext()) { Entry<Guid, CommandContainer> entry = iterator.next(); if ((entry.getValue().remainingDelay -= POLLING_RATE) > 0) { continue; } Guid cmdId = entry.getKey(); CommandCallback callback = entry.getValue().callback; CommandStatus status = coco.getCommandStatus(cmdId); boolean errorInCallback = false; try { switch (status) { case FAILED: callback.onFailed(cmdId, coco.getChildCommandIds(cmdId)); break; case SUCCEEDED: callback.onSucceeded(cmdId, coco.getChildCommandIds(cmdId)); break; case ACTIVE: if (coco.getCommandEntity(cmdId).isExecuted()) { callback.doPolling(cmdId, coco.getChildCommandIds(cmdId)); } break; default: break; } } catch (Exception ex) { errorInCallback = true; handleError(ex, status, cmdId); } finally { if (CommandStatus.FAILED.equals(status) || (CommandStatus.SUCCEEDED.equals(status) && !errorInCallback)) { coco.updateCallbackNotified(cmdId); iterator.remove(); } else { int maxDelay = Config.<Integer>getValue(ConfigValues.AsyncCommandPollingRateInSeconds); entry.getValue().initialDelay = Math.min(maxDelay, entry.getValue().initialDelay * 2); entry.getValue().remainingDelay = entry.getValue().initialDelay; } } } }
Source:
public Boolean getUseForBackup() { return useForBackup; }

Target:
public boolean getUseForBackup() { return useForBackup; }
Source:
private void createDefaultFileStats(Object[] fileNames) { for (int i = 0; i < fileNames.length; i++) { fileStats.put((String) fileNames[i], null); } }

Target:
private void createDefaultFileStats(Object[] fileNames) { for (int i = 0; i < fileNames.length; i++) { fileStats.put((String) fileNames[i], Collections.<String, Object>emptyMap()); } }
Source:
public void batchReadComplex() throws Exception { String[] bins = new String[] {binName}; List<BatchRead> records = new ArrayList<BatchRead>(); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 1), bins)); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 2), true)); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 3), true)); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 4), false)); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 5), true)); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 6), true)); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 7), bins)); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 8), new String[] {"binnotfound"})); records.add(new BatchRead(new Key(args.namespace, args.set, "keynotfound"), bins)); Mono<List<BatchRead>> mono = reactorClient.get(records); StepVerifier.create(mono) .expectNextMatches(batchReads -> { int found = 0; int count = 0; for (BatchRead record : batchReads) { Record rec = record.record; count++; if (rec != null) { found++; Object value = rec.getValue(binName); if (count != 4 && count <= 7) { assertEquals(valuePrefix + count, value); } else { assertNull(value); } } } assertEquals(8, found); return true; }) .verifyComplete(); }

Target:
public void batchReadComplex() { String[] bins = new String[] {binName}; List<BatchRead> records = new ArrayList<BatchRead>(); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 1), bins)); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 2), true)); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 3), true)); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 4), false)); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 5), true)); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 6), true)); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 7), bins)); records.add(new BatchRead(new Key(args.namespace, args.set, keyPrefix + 8), new String[] {"binnotfound"})); records.add(new BatchRead(new Key(args.namespace, args.set, "keynotfound"), bins)); Mono<List<BatchRead>> mono = reactorClient.get(records); StepVerifier.create(mono) .expectNextMatches(batchReads -> { List<BatchRead> recordsFound = batchReads.stream() .filter(record -> record.record != null) .collect(Collectors.toList()); assertThat(recordsFound).hasSize(8); assertThat(recordsFound).extracting(record -> record.record.getValue(binName)) .containsExactly( "batchvalue1", "batchvalue2", "batchvalue3", null, "batchvalue5", "batchvalue6", "batchvalue7", null); return true; }) .verifyComplete(); }
Source:
public static void registerFormat(String name, Format<?> fmt) { if (fmt == null) throw new NullPointerException(); FormatEntry old, entry; do { old = formats.get(name); if (old == null) { entry = new FormatEntry(fmt, 1); continue; } if (!old.format.equals(fmt)) throw new JGitInternalException(MessageFormat.format( JGitText.get().archiveFormatAlreadyRegistered, name)); entry = new FormatEntry(old.format, old.refcnt + 1); } while (!replace(formats, name, old, entry)); }

Target:
public static Format<?> registerFormat(String name, Format<?> fmt) { if (fmt == null) throw new NullPointerException(); FormatEntry old, entry; do { old = formats.get(name); if (old == null) { entry = new FormatEntry(fmt, 1); continue; } if (!old.format.equals(fmt)) throw new JGitInternalException(MessageFormat.format( JGitText.get().archiveFormatAlreadyRegistered, name)); entry = new FormatEntry(old.format, old.refcnt + 1); } while (!replace(formats, name, old, entry)); return entry.format; }
Source:
public List<AuthScope> matchingScopes(@NonNull Set<String> scopeStrings) { val result = scopeStrings.stream().map(s -> AuthScope.from(s)) .filter(p -> matches(p)) .collect(Collectors.toList()); return result; }

Target:
public List<AuthScope> matchingScopes(@NonNull Set<String> scopeStrings) { return scopeStrings.stream() .map(AuthScope::from) .filter(this::matches) .collect(toUnmodifiableList()); }