auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testPomlessBuildExtension() throws Exception { Verifier verifier = getVerifier("testsetversionpomless", false); verifier.addCliOption("-Dp2.repo=" + new File("repositories/kepler").getAbsoluteFile().toURI().toString()); verifier.addCliOption("-DnewVersion=2.0.0"); verifier.executeGoal("org.eclipse.tycho:tycho-versions-plugin:" + getTychoVersion() + ":set-version"); verifier.verifyErrorFreeLog(); File baseDir = new File(verifier.getBasedir()); String rootPom = readFileToString(new File(baseDir, "pom.xml")).toString(); Assert.assertTrue("Root pom version does not match 2.0.0!", rootPom.contains("<version>2.0.0</version>")); String bundleManifest = readFileToString(new File(baseDir, "bundle1/META-INF/MANIFEST.MF")).toString(); Assert.assertTrue("Bundles MANIFEST.MF version does not match 2.0.0!", bundleManifest.contains("Bundle-Version: 2.0.0")); String testBundleManifest = readFileToString(new File(baseDir, "bundle1.tests/META-INF/MANIFEST.MF")) .toString(); Assert.assertTrue("Test-bundles MANIFEST.MF version does not match 2.0.0!", testBundleManifest.contains("Bundle-Version: 2.0.0")); String featureXml = readFileToString(new File(baseDir, "feature/feature.xml")).toString(); Assert.assertTrue("feature.xml version does not match 2.0.0!", featureXml.contains("version=\"2.0.0\"")); }

Target:
public void testPomlessBuildExtension() throws Exception { Verifier verifier = getVerifier("testsetversionpomless", false); String newVersion = "2.0.0"; verifier.addCliOption("-DnewVersion=" + newVersion); verifier.executeGoal("org.eclipse.tycho:tycho-versions-plugin:" + getTychoVersion() + ":set-version"); verifier.verifyErrorFreeLog(); File baseDir = new File(verifier.getBasedir()); PomFile rootPom = PomFile.read(new File(baseDir, "pom.xml"), false); Assert.assertEquals(newVersion, rootPom.getVersion()); DefaultBundleReader reader = new DefaultBundleReader(); OsgiManifest bundleManifest = reader.loadManifest(new File(baseDir, "bundle1/META-INF/MANIFEST.MF")); Assert.assertEquals(newVersion, bundleManifest.getBundleVersion()); OsgiManifest testBundleManifest = reader.loadManifest(new File(baseDir, "bundle1.tests/META-INF/MANIFEST.MF")); Assert.assertEquals(newVersion, testBundleManifest.getBundleVersion()); Feature feature = Feature.read(new File(baseDir, "feature/feature.xml")); Assert.assertEquals(newVersion, feature.getVersion()); }
Source:
private static InputStream getInlineResourceStream(VaadinRequest request, String file) { VaadinService service = request.getService(); ResourceProvider resourceProvider = service.getContext() .getAttribute(Lookup.class).lookup(ResourceProvider.class); URL appResource = resourceProvider.getApplicationResource(service, file); InputStream stream = null; try { stream = appResource == null ? null : appResource.openStream(); } catch (IOException e) { throw new IllegalStateException(String.format( "Couldn't open application resource '%s' for inline resource", file, e)); } if (stream == null) { throw new IllegalStateException(String.format( "Application resource '%s' for inline resource is not available", file)); } return stream; }

Target:
private static InputStream getInlineResourceStream(VaadinRequest request, String file) { VaadinService service = request.getService(); ResourceProvider resourceProvider = service.getContext() .getAttribute(Lookup.class).lookup(ResourceProvider.class); URL appResource = resourceProvider.getApplicationResource(service, file); InputStream stream = null; try { stream = appResource == null ? null : appResource.openStream(); } catch (IOException e) { throw new IllegalStateException(String.format( "Couldn't open application resource '%s' for inline resource", file), e); } if (stream == null) { throw new IllegalStateException(String.format( "Application resource '%s' for inline resource is not available", file)); } return stream; }
Source:
public void testEqualValuesDifferentWeights() { FixedDoubleBreakdownHistogram histogram = new FixedDoubleBreakdownHistogram(200, 3.0, 4.0); histogram.add(3.5, 0.2, 1); histogram.add(3.5, 0.4, 1); histogram.add(3.5, 0.3, 2); Streams.stream(histogram.iterator()).forEach(c -> { assertTrue(c.getLeft() <= 3.5); assertTrue(c.getRight() >= 3.5); assertTrue(c.getLeft() < c.getRight()); }); assertEquals( Streams.stream(histogram.iterator()).mapToLong(c -> 1).sum(), 3); assertEquals( Streams.stream(histogram.iterator()).mapToDouble(c -> c.getWeight()).sum(), 0.9); assertEquals( Streams.stream(histogram.iterator()).mapToLong(c -> c.getCount()).sum(), 4); }

Target:
public void testEqualValuesDifferentWeights() { FixedDoubleBreakdownHistogram histogram = new FixedDoubleBreakdownHistogram(200, 3.0, 4.0); histogram.add(3.5, 0.2, 1); histogram.add(3.5, 0.4, 1); histogram.add(3.5, 0.3, 2); Streams.stream(histogram.iterator()).forEach(bucketWeight -> { assertTrue(bucketWeight.getLeft() <= 3.5); assertTrue(bucketWeight.getRight() >= 3.5); assertTrue(bucketWeight.getLeft() < bucketWeight.getRight()); }); assertEquals( Streams.stream(histogram.iterator()).count(), 3); assertEquals( Streams.stream(histogram.iterator()).mapToDouble(FixedDoubleBreakdownHistogram.BucketWeight::getWeight).sum(), 0.9); assertEquals( Streams.stream(histogram.iterator()).mapToLong(FixedDoubleBreakdownHistogram.BucketWeight::getCount).sum(), 4); }
Source:
public static void setUpOnce() throws IOException, RDFParseException { validator = new WikibaseDataModelValidator(); goodDataset = openTestDatasetStream(GOOD_DATASET_FILE_NAME); goodParsedDataset = Rio.parse(goodDataset, BASE_URI, RDF_FORMAT); badDataset = openTestDatasetStream(BAD_DATASET_FILE_NAME); badParsedDataset = Rio.parse(badDataset, BASE_URI, RDF_FORMAT); }

Target:
public static void setUpOnce() throws RDFParseException, IOException { validator = new WikibaseDataModelValidator(); try (InputStream is = openTestDatasetStream(GOOD_DATASET_FILE_NAME)) { goodDataset = is; goodParsedDataset = Rio.parse(goodDataset, BASE_URI, RDF_FORMAT); } try (InputStream is = openTestDatasetStream(BAD_DATASET_FILE_NAME)) { badDataset = is; badParsedDataset = Rio.parse(badDataset, BASE_URI, RDF_FORMAT); } }
Source:
private void afterInvocation() throws Exception { ActionContext.setContext(null); }

Target:
protected void afterInvocation() throws Exception { ActionContext.setContext(null); }
Source:
public static Slice lineInterpolatePoint(@SqlType(GEOMETRY_TYPE_NAME) Slice lineSlice, @SqlType(DOUBLE) double fraction) { if (!(0.0 <= fraction && fraction <= 1.0)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Fraction must be between 0 and 1, but is %s", fraction)); } Geometry geometry = JtsGeometrySerde.deserialize(lineSlice); validateType("line_interpolate_point", geometry, ImmutableSet.of(LINE_STRING)); LineString line = (LineString) geometry; if (line.isEmpty()) { return JtsGeometrySerde.serialize(makeJtsEmptyPoint()); } org.locationtech.jts.geom.Coordinate coordinate = new LengthIndexedLine(line).extractPoint(fraction * line.getLength()); return JtsGeometrySerde.serialize(makeJtsPoint(coordinate)); }

Target:
public static Slice lineInterpolatePoint(@SqlType(GEOMETRY_TYPE_NAME) Slice lineSlice, @SqlType(DOUBLE) double fraction) { if (!(0.0 <= fraction && fraction <= 1.0)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("line_interpolate_point: Fraction must be between 0 and 1, but is %s", fraction)); } Geometry geometry = JtsGeometrySerde.deserialize(lineSlice); validateType("line_interpolate_point", geometry, ImmutableSet.of(LINE_STRING)); LineString line = (LineString) geometry; if (line.isEmpty()) { return JtsGeometrySerde.serialize(makeJtsEmptyPoint()); } org.locationtech.jts.geom.Coordinate coordinate = new LengthIndexedLine(line).extractPoint(fraction * line.getLength()); return JtsGeometrySerde.serialize(makeJtsPoint(coordinate)); }
Source:
public double priceFromYield(double yield, LocalDate settlementDate) { double accrualFactor = dayCount.relativeYearFraction(settlementDate, notional.getDate()); if (yieldConvention.equals(DISCOUNT)) { double price = 1.0d - accrualFactor * yield; return price; } if (yieldConvention.equals(INTEREST_AT_MATURITY) || yieldConvention.equals(FRANCE_CD) || yieldConvention.equals(JAPAN_BILLS)) { double price = 1.0d / (1.0d + accrualFactor * yield); return price; } throw new UnsupportedOperationException("The convention " + yieldConvention.name() + " is not supported."); }

Target:
public double priceFromYield(double yield, LocalDate settlementDate) { double accrualFactor = dayCount.relativeYearFraction(settlementDate, notional.getDate()); return yieldConvention.priceFromYield(yield, accrualFactor); }
Source:
public static String createJWT(HttpServletRequest request, SsoSession ssoSession, String clientId) throws NoSuchAlgorithmException, JOSEException { String serverName = request.getServerName(); String issuer = String.format("%s://%s:%s", request.getScheme(), InetAddressUtils.isIPv6Address(serverName) ? String.format("[%s]", serverName) : serverName, request.getServerPort()); JWTClaimsSet jwtClaims = (new JWTClaimsSet.Builder()) .jwtID(ssoSession.getPrincipalRecord().get(Authz.PrincipalRecord.ID)) .issueTime(new Date(System.currentTimeMillis())) .issuer(issuer) .subject(String.format("%s@%s", ssoSession.getUserId(), ssoSession.getProfile())) .audience(Collections.singletonList(clientId)) .claim("sub", String.format("%s@%s", ssoSession.getUserId(), ssoSession.getProfile())) .claim("preferred_username", String.format("%s@%s", ssoSession.getUserId(), ssoSession.getProfile())) .claim("email", ssoSession.getPrincipalRecord().<String>get(Authz.PrincipalRecord.EMAIL)) .claim("name", ssoSession.getPrincipalRecord().<String>get(Authz.PrincipalRecord.FIRST_NAME)) .build(); JWSSigner signer = new MACSigner(sharedSecret); SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), jwtClaims); signedJWT.sign(signer); return signedJWT.serialize(); }

Target:
public static String createJWT(HttpServletRequest request, SsoSession ssoSession, String clientId) throws NoSuchAlgorithmException, JOSEException { String serverName = request.getServerName(); String issuer = String.format("%s://%s:%s", request.getScheme(), InetAddressUtils.isIPv6Address(serverName) ? String.format("[%s]", serverName) : serverName, request.getServerPort()); JWTClaimsSet jwtClaims = (new JWTClaimsSet.Builder()) .jwtID(ssoSession.getPrincipalRecord().get(Authz.PrincipalRecord.ID)) .issueTime(new Date(System.currentTimeMillis())) .issuer(issuer) .subject(String.format("%s@%s", ssoSession.getUserId(), ssoSession.getProfile())) .audience(clientId) .claim("sub", String.format("%s@%s", ssoSession.getUserId(), ssoSession.getProfile())) .claim("preferred_username", String.format("%s@%s", ssoSession.getUserId(), ssoSession.getProfile())) .claim("email", ssoSession.getPrincipalRecord().<String>get(Authz.PrincipalRecord.EMAIL)) .claim("name", ssoSession.getPrincipalRecord().<String>get(Authz.PrincipalRecord.FIRST_NAME)) .build(); JWSSigner signer = new MACSigner(sharedSecret); SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), jwtClaims); signedJWT.sign(signer); return signedJWT.serialize(); }
Source:
public void testInspectSwarm() throws Exception { requireDockerApiVersionAtLeast("1.24", "swarm support"); final Swarm swarm = sut.inspectSwarm(); assertThat(swarm.createdAt(), is(not(isEmptyOrNullString()))); assertThat(swarm.updatedAt(), is(not(isEmptyOrNullString()))); assertThat(swarm.joinTokens().worker(), is(not(isEmptyOrNullString()))); assertThat(swarm.joinTokens().manager(), is(not(isEmptyOrNullString()))); }

Target:
public void testInspectSwarm() throws Exception { requireDockerApiVersionAtLeast("1.24", "swarm support"); final Swarm swarm = sut.inspectSwarm(); assertThat(swarm.createdAt(), is(notNullValue())); assertThat(swarm.updatedAt(), is(notNullValue())); assertThat(swarm.id(), is(not(isEmptyOrNullString()))); assertThat(swarm.joinTokens().worker(), is(not(isEmptyOrNullString()))); assertThat(swarm.joinTokens().manager(), is(not(isEmptyOrNullString()))); }
Source:
public void merge(BuildPlan source) { Assert.isNotNull(source); @SuppressWarnings("serial") EcoreUtil.Copier copier = new EcoreUtil.Copier() { @Override protected EObject createCopy(EObject source) { return BuildPlan.this; }; @Override protected void copyAttribute(EAttribute eAttribute, EObject eObject, EObject copyEObject) { super.copyAttribute(eAttribute, eObject, copyEObject); } @Override protected void copyContainment(EReference eReference, EObject eObject, EObject copyEObject) { } }; copier.copy(source); getParameterDefinitions().clear(); getParameterDefinitions().addAll(EcoreUtil.copyAll(source.getParameterDefinitions())); getFlags().clear(); getFlags().addAll(source.getFlags()); getHealthReports().clear(); getHealthReports().addAll(EcoreUtil.copyAll(source.getHealthReports())); getAttributes().clear(); getAttributes().putAll(source.getAttributes()); getChildren().clear(); getChildren().addAll(source.getChildren()); getChildren().forEach(child -> { if (child.getServer() == null && child.getParent() != null) { child.setServer(child.getParent().getServer()); child.setRefreshDate(refreshDate); } IBuild build = child.getLastBuild(); if (build != null) { build.setServer(child.getServer()); build.setRefreshDate(refreshDate); build.setPlan(child); } }); if (getParent() != null) { if (server == null && getParent().getServer() != null) { setServer(getParent().getServer()); } } }

Target:
public void merge(BuildPlan source) { Assert.isNotNull(source); @SuppressWarnings("serial") EcoreUtil.Copier copier = new EcoreUtil.Copier() { @Override protected EObject createCopy(EObject source) { return BuildPlan.this; }; @Override protected void copyAttribute(EAttribute eAttribute, EObject eObject, EObject copyEObject) { super.copyAttribute(eAttribute, eObject, copyEObject); } @Override protected void copyContainment(EReference eReference, EObject eObject, EObject copyEObject) { } }; copier.copy(source); getParameterDefinitions().clear(); getParameterDefinitions().addAll(EcoreUtil.copyAll(source.getParameterDefinitions())); getFlags().clear(); getFlags().addAll(source.getFlags()); getHealthReports().clear(); getHealthReports().addAll(EcoreUtil.copyAll(source.getHealthReports())); getAttributes().clear(); getAttributes().putAll(source.getAttributes()); getChildren().clear(); getChildren().addAll(source.getChildren()); getChildren().forEach(child -> { child.setParent(this); child.setSelected(isSelected()); if (child.getServer() == null) { child.setServer(getServer()); child.setRefreshDate(refreshDate); } IBuild build = child.getLastBuild(); if (build != null) { build.setServer(child.getServer()); build.setRefreshDate(refreshDate); build.setPlan(child); } }); if (getParent() != null) { if (server == null && getParent().getServer() != null) { setServer(getParent().getServer()); } } }
Source:
public void killAll() throws IOException { try { S3Utils.retryS3Operation( () -> { String bucketName = segmentPusherConfig.getBucket(); String prefix = segmentPusherConfig.getBaseKey(); int maxListingLength = inputDataConfig.getMaxListingLength(); ListObjectsV2Result result; String continuationToken = null; do { log.info("Deleting batch of %d segment files from s3 location [bucket: %s prefix: %s].", maxListingLength, bucketName, prefix ); ListObjectsV2Request request = new ListObjectsV2Request() .withBucketName(bucketName) .withPrefix(prefix) .withContinuationToken(continuationToken) .withMaxKeys(maxListingLength); result = s3Client.listObjectsV2(request); List<S3ObjectSummary> objectSummaries = result.getObjectSummaries(); List<DeleteObjectsRequest.KeyVersion> keyVersionsToDelete = objectSummaries.stream() .map(x -> new DeleteObjectsRequest.KeyVersion(x.getKey())) .collect(Collectors.toList()); DeleteObjectsRequest deleteRequest = new DeleteObjectsRequest(bucketName) .withBucketName(bucketName) .withKeys(keyVersionsToDelete); s3Client.deleteObjects(deleteRequest); continuationToken = result.getNextContinuationToken(); } while (result.isTruncated()); return null; } ); } catch (Exception e) { log.error("Error occurred while deleting segment files from s3. Error: %s", e.getMessage()); throw new IOException(e); } }

Target:
public void killAll() throws IOException { log.info("Deleting all segment files from s3 location [bucket: '%s' prefix: '%s']", segmentPusherConfig.getBucket(), segmentPusherConfig.getBaseKey() ); try { S3Utils.deleteObjectsInPath( s3Client, inputDataConfig, segmentPusherConfig.getBucket(), segmentPusherConfig.getBaseKey(), Predicates.alwaysTrue() ); } catch (Exception e) { log.error("Error occurred while deleting segment files from s3. Error: %s", e.getMessage()); throw new IOException(e); } }
Source:
private Logger getLogger() { return LoggerFactory.getLogger(LitTemplateDataAnalyzer.class.getName()); }

Target:
private static Logger getLogger() { return LoggerFactory.getLogger(LitTemplateDataAnalyzer.class.getName()); }
Source:
public static long getNewMessageId() { long id = Interpreter.getInstance().getServiceIdentifier(); id = id << 32; id = id + idCounter.getAndIncrement(); return id; }

Target:
public static long getNewMessageId() { long id = Jolie.cellId; id = id << 32; id = id + ID_COUNTER.getAndIncrement(); return id; }
Source:
public Source resolve(String href, String base) throws TransformerException { InputStream stream = ClassPathURIResolver.class.getClassLoader() .getResourceAsStream(rulesDir.concat(File.separator).concat(href)); if (null != stream) { return new StreamSource(stream); } else { if (null != clientUriResolver) { return clientUriResolver.resolve(href, base); } else { return new StreamSource(stream); } } }

Target:
public Source resolve(String href, String base) throws TransformerException { InputStream stream = ClassPathURIResolver.class.getClassLoader() .getResourceAsStream(rulesDir.concat(File.separator).concat(href)); if (stream != null) { return new StreamSource(stream); } else { if (clientUriResolver != null) { return clientUriResolver.resolve(href, base); } else { return new StreamSource(stream); } } }
Source:
public Double getDoubleByHeaderName(String fieldName) { String value = getStringByHeaderName(fieldName); if (value != null) { value = value.replace("<=","").trim(); return Double.parseDouble(value); } else { return null; } }

Target:
public Double getDoubleByHeaderName(String fieldName) { String value = getStringByHeaderName(fieldName); if (value != null) { value = DOUBLE_IGNORE_PATTERN.matcher(value).replaceAll(""); return Double.parseDouble(value); } else { return null; } }
Source:
private static boolean checkIfCanAddToParentModules(Property property, boolean checkFilter) { if (property != null) { List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(property.getId(), property.getVersion(), RelationshipItemBuilder.JOB_RELATION); for (Relation relation : relations) { if (RelationshipItemBuilder.SERVICES_RELATION.equals(relation.getType())) { return false; } } if (property.getItem() != null && property.getItem().getState() != null && property.getItem().getState().isDeleted() && PomIdsHelper.getIfExcludeDeletedItems(property)) { return false; } if (Boolean.getBoolean(SYS_PROP_INCLUDE_REFERENCED_JOBLETS_ONLY)) { Map<Relation, Set<Relation>> allrelations = RelationshipItemBuilder.getInstance() .getCurrentProjectItemsRelations(); boolean found = false; Item item = property.getItem(); if (item != null && item instanceof JobletProcessItem) { for (Set<Relation> relationItems : allrelations.values()) { for (Relation relation : relationItems) { if (property.getId().equals(relation.getId()) && property.getVersion().equals(relation.getVersion())) { found = true; } } } if (!found) { return false; } } } } if (checkFilter) { if (GlobalServiceRegister.getDefault().isServiceRegistered(IFilterService.class)) { IFilterService filterService = (IFilterService) GlobalServiceRegister.getDefault() .getService(IFilterService.class); if (property != null && !filterService.isFilterAccepted(property.getItem(), PomIdsHelper.getPomFilter())) { return false; } } } return true; }

Target:
private static boolean checkIfCanAddToParentModules(Property property, boolean checkFilter) { if (property != null) { List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(property.getId(), property.getVersion(), RelationshipItemBuilder.JOB_RELATION); for (Relation relation : relations) { if (RelationshipItemBuilder.SERVICES_RELATION.equals(relation.getType())) { return false; } } if (property.getItem() != null && property.getItem().getState() != null && property.getItem().getState().isDeleted() && PomIdsHelper.getIfExcludeDeletedItems(property)) { return false; } } if (checkFilter) { if (GlobalServiceRegister.getDefault().isServiceRegistered(IFilterService.class)) { IFilterService filterService = (IFilterService) GlobalServiceRegister.getDefault() .getService(IFilterService.class); if (property != null && !filterService.isFilterAccepted(property.getItem(), PomIdsHelper.getPomFilter())) { return false; } } } return true; }
Source:
private void refreshIfRequired(Runnable refreshCallback) { synchronized (lock) { if (dirty.get()) { long currentTime = clock.getTime(); if (currentTime - lastRefreshTime > refreshDelta && dirty.compareAndSet(true, false)) { lastRefreshTime = currentTime; refreshCallback.run(); } } } }

Target:
private void refreshIfRequired(Runnable refreshCallback) { if (dirty.get()){ long currentTime = clock.getTime(); if (currentTime - lastRefreshTime > refreshDelta && dirty.compareAndSet(true, false)){ lastRefreshTime = currentTime; refreshCallback.run(); } } }
Source:
private PDataType getViewIndexType(Cell[] tableKeyValues) { Cell useLongViewIndexKv = tableKeyValues[USE_LONG_VIEW_INDEX]; boolean useLongViewIndex = useLongViewIndexKv != null; return useLongViewIndex ? MetaDataUtil.getViewIndexIdDataType() : MetaDataUtil.getLegacyViewIndexIdDataType(); }

Target:
private PDataType getViewIndexType(Cell[] tableKeyValues) { Cell dataTypeKv = tableKeyValues[VIEW_INDEX_ID_DATA_TYPE]; return PDataType.fromTypeId(PInteger.INSTANCE.getCodec() .decodeInt(dataTypeKv.getValueArray(), dataTypeKv.getValueOffset(), SortOrder.getDefault())); }
Source:
protected long calculatePartSize(long length) { long lengthInMB = (long) (length / (1L << 20)) + 1; double fpPartSizeInMB = sqrt(DEFAULT_RATIO * lengthInMB); long partSizeInMB = (long) pow(2, floor(log(fpPartSizeInMB) / log(2)) + 1); if (partSizeInMB < 1) return 1; else if (partSizeInMB > MAX_PART_SIZE) return MAX_PART_SIZE; return partSizeInMB; }

Target:
protected long calculatePartSize(long length) { long lengthInMB = (long) (length / (1L << 20)) + 1; double fpPartSizeInMB = sqrt(ratio * lengthInMB); long partSizeInMB = Long.highestOneBit((long) fpPartSizeInMB - 1) << 1; if (partSizeInMB < 1) return 1; else if (partSizeInMB > MAX_PART_SIZE) return MAX_PART_SIZE; return partSizeInMB; }
Source:
private String getVirtualRouterIP(Network network, Collection<String[]> ipAddressRanges) throws InsufficientVirtualNetworkCapacityException { String virtualRouterIp; String subnet = NetUtils.getCidrSubNet(network.getCidr()); String netmask = NetUtils.getCidrNetmask(network.getCidr()); long cidrSize = NetUtils.getCidrSize(netmask); Set<Long> allIPsInCidr = NetUtils.getAllIpsFromCidr(subnet, cidrSize, new HashSet<Long>()); if (allIPsInCidr.size() > 3) { Iterator<Long> ipIterator = allIPsInCidr.iterator(); long vip = ipIterator.next(); if (NetUtils.ip2Long(network.getGateway()) == vip) { s_logger.debug("Gateway of the Network(" + network.getName() + ") has the first IP " + NetUtils.long2Ip(vip)); vip = ipIterator.next(); virtualRouterIp = NetUtils.long2Ip(vip); s_logger.debug("So, reserving the 2nd IP " + virtualRouterIp + " for the Virtual Router IP in Network(" + network.getName() + ")"); } else { virtualRouterIp = NetUtils.long2Ip(vip); s_logger.debug("1nd IP is not used as the gateway IP. So, reserving" + virtualRouterIp + " for the Virtual Router IP for " + "Network(" + network.getName() + ")"); } String[] ipAddressRange = new String[2]; ipAddressRange[0] = NetUtils.long2Ip(ipIterator.next()); ipAddressRange[1] = NetUtils.getIpRangeEndIpFromCidr(subnet, cidrSize); ipAddressRanges.add(ipAddressRange); return virtualRouterIp; } throw new InsufficientVirtualNetworkCapacityException("VSP allocates an IP for VirtualRouter." + " So, subnet should have atleast minimum 4 hosts ", Network.class, network.getId()); }

Target:
private String getVirtualRouterIP(Network network, Collection<String[]> ipAddressRanges) throws InsufficientVirtualNetworkCapacityException { String virtualRouterIp; String subnet = NetUtils.getCidrSubNet(network.getCidr()); String netmask = NetUtils.getCidrNetmask(network.getCidr()); long cidrSize = NetUtils.getCidrSize(netmask); Set<Long> allIPsInCidr = NetUtils.getAllIpsFromCidr(subnet, cidrSize, new HashSet<Long>()); if (allIPsInCidr == null || !(allIPsInCidr instanceof TreeSet)) { throw new IllegalStateException("The IPs in CIDR for subnet " + subnet + " where null or returned in a non-ordered set."); } if (allIPsInCidr.size() > 3) { Iterator<Long> ipIterator = allIPsInCidr.iterator(); long vip = ipIterator.next(); if (NetUtils.ip2Long(network.getGateway()) == vip) { vip = ipIterator.next(); virtualRouterIp = NetUtils.long2Ip(vip); if (s_logger.isDebugEnabled()) { s_logger.debug("1st IP is used as gateway IP. Reserving " + virtualRouterIp + " for the Virtual Router IP for Network(" + network.getName() + ")"); } } else { virtualRouterIp = NetUtils.long2Ip(vip); if (s_logger.isDebugEnabled()) { s_logger.debug("1st IP is not used as the gateway IP. Reserving" + virtualRouterIp + " for the Virtual Router IP for Network(" + network.getName() + ")"); } } ipAddressRanges.add(new String[] { NetUtils.long2Ip(ipIterator.next()), NetUtils.getIpRangeEndIpFromCidr(subnet, cidrSize) }); return virtualRouterIp; } throw new InsufficientVirtualNetworkCapacityException("VSP allocates an IP for VirtualRouter." + " So, subnet should have atleast minimum 4 hosts ", Network.class, network.getId()); }
Source:
protected List getContributors(List elements) { List commonAdapters = new ArrayList(); List commonClasses = getCommonClasses(elements, commonAdapters); Class resourceClass = getCommonResourceClass(elements); Class resourceMappingClass = getResourceMappingClass(elements); List contributors = new ArrayList(); if (resourceClass != null) { addAll(contributors, getResourceContributors(resourceClass)); } if (commonClasses != null && !commonClasses.isEmpty()) { for (Object commonClasse : commonClasses) { List results = getObjectContributors((Class) commonClasse); addAll(contributors, results); } } if (resourceMappingClass == null) { resourceMappingClass = LegacyResourceSupport.getResourceMappingClass(); if (resourceMappingClass != null && commonAdapters.contains(resourceMappingClass.getName())) { addAll(contributors, getResourceContributors(resourceMappingClass)); } } else { contributors.addAll(getResourceContributors(resourceMappingClass)); } if (!commonAdapters.isEmpty()) { for (Iterator it = commonAdapters.iterator(); it.hasNext();) { String adapter = (String) it.next(); addAll(contributors, getAdaptableContributors(adapter)); } } contributors = removeDups(contributors); return contributors.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(contributors); }

Target:
protected List getContributors(List elements) { List commonAdapters = new ArrayList(); List commonClasses = getCommonClasses(elements, commonAdapters); Class resourceClass = getCommonResourceClass(elements); Class resourceMappingClass = getResourceMappingClass(elements); List contributors = new ArrayList(); if (resourceClass != null) { addAll(contributors, getResourceContributors(resourceClass)); } if (commonClasses != null && !commonClasses.isEmpty()) { for (Object commonClass : commonClasses) { List results = getObjectContributors((Class) commonClass); addAll(contributors, results); } } if (resourceMappingClass == null) { resourceMappingClass = LegacyResourceSupport.getResourceMappingClass(); if (resourceMappingClass != null && commonAdapters.contains(resourceMappingClass.getName())) { addAll(contributors, getResourceContributors(resourceMappingClass)); } } else { contributors.addAll(getResourceContributors(resourceMappingClass)); } if (!commonAdapters.isEmpty()) { for (Iterator it = commonAdapters.iterator(); it.hasNext();) { String adapter = (String) it.next(); addAll(contributors, getAdaptableContributors(adapter)); } } contributors = removeDups(contributors); return contributors.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(contributors); }
Source:
public byte[] evaluateChallenge(final byte[] challenge) throws SaslException { if (complete) { throw saslPlain.mechMessageAfterComplete().toSaslException(); } complete = true; if (challenge.length > 0) { throw saslPlain.mechInvalidMessageReceived().toSaslException(); } final NameCallback nameCallback = new NameCallback("Login name"); final PasswordCallback passwordCallback = new PasswordCallback("Password", false); try { cbh.handle(new Callback[] { nameCallback, passwordCallback }); } catch (SaslException e) { throw e; } catch (IOException | UnsupportedCallbackException e) { throw saslPlain.mechCallbackHandlerFailedForUnknownReason(e).toSaslException(); } final String name = nameCallback.getName(); if (name == null) { throw saslPlain.mechNoLoginNameGiven().toSaslException(); } final char[] password = passwordCallback.getPassword(); if (password == null) { throw saslPlain.mechNoPasswordGiven().toSaslException(); } try { final ByteStringBuilder b = new ByteStringBuilder(); if (authorizationId != null) { StringPrep.encode(authorizationId, b, StringPrep.PROFILE_SASL_STORED); } b.append((byte) 0); StringPrep.encode(name, b, StringPrep.PROFILE_SASL_STORED); b.append((byte) 0); StringPrep.encode(password, b, this.passwordProfile); return b.toArray(); } catch (IllegalArgumentException ex) { throw saslPlain.mechMalformedFields(ex).toSaslException(); } }

Target:
public byte[] evaluateChallenge(final byte[] challenge) throws SaslException { if (complete) { throw saslPlain.mechMessageAfterComplete().toSaslException(); } complete = true; if (challenge.length > 0) { throw saslPlain.mechInvalidMessageReceived().toSaslException(); } final NameCallback nameCallback = new NameCallback("Login name"); final PasswordCallback passwordCallback = new PasswordCallback("Password", false); try { cbh.handle(new Callback[] { nameCallback, passwordCallback }); } catch (SaslException e) { throw e; } catch (IOException | UnsupportedCallbackException e) { throw saslPlain.mechCallbackHandlerFailedForUnknownReason(e).toSaslException(); } final String name = nameCallback.getName(); if (name == null) { throw saslPlain.mechNoLoginNameGiven().toSaslException(); } final char[] password = passwordCallback.getPassword(); if (password == null) { throw saslPlain.mechNoPasswordGiven().toSaslException(); } try { final ByteStringBuilder b = new ByteStringBuilder(); if (authorizationId != null) { StringPrep.encode(authorizationId, b, this.profile); } b.append((byte) 0); StringPrep.encode(name, b, this.profile); b.append((byte) 0); StringPrep.encode(password, b, this.profile); return b.toArray(); } catch (IllegalArgumentException ex) { throw saslPlain.mechMalformedFields(ex).toSaslException(); } }
Source:
private void killTaskGroupForPartitions(Set<Integer> partitions) { for (Integer partition : partitions) { TaskGroup taskGroup = taskGroups.get(getTaskGroupIdForPartition(partition)); if (taskGroup != null) { for (Map.Entry<String, TaskData> entry : taskGroup.tasks.entrySet()) { String taskId = entry.getKey(); log.info("Reset dataSource[%s] - killing task [%s]", dataSource, taskId); killTask(taskId); } } partitionGroups.remove(getTaskGroupIdForPartition(partition)); taskGroups.remove(getTaskGroupIdForPartition(partition)); } }

Target:
private void killTaskGroupForPartitions(Set<Integer> partitions) { for (Integer partition : partitions) { TaskGroup taskGroup = taskGroups.get(getTaskGroupIdForPartition(partition)); if (taskGroup != null) { for (String taskId : JavaCompatUtils.keySet(taskGroup.tasks)) { log.info("Reset dataSource[%s] - killing task [%s]", dataSource, taskId); killTask(taskId); } } partitionGroups.remove(getTaskGroupIdForPartition(partition)); taskGroups.remove(getTaskGroupIdForPartition(partition)); } }
Source:
public io.confluent.connect.storage.format.RecordWriter getRecordWriter( final HdfsSinkConnectorConfig conf, final String filename ) { return new io.confluent.connect.storage.format.RecordWriter() { final DataFileWriter<Object> writer = new DataFileWriter<>(new GenericDatumWriter<>()); final Path path = new Path(filename); Schema schema = null; public io.confluent.connect.storage.format.RecordWriter init() { writer.setCodec(CodecFactory.fromString(conf.getAvroCodec())); return this; } @Override public void write(SinkRecord record) { if (schema == null) { schema = record.valueSchema(); try { log.info("Opening record writer for: {}", filename); final FSDataOutputStream out = path.getFileSystem(conf.getHadoopConfiguration()) .create(path); org.apache.avro.Schema avroSchema = avroData.fromConnectSchema(schema); writer.create(avroSchema, out); } catch (IOException e) { throw new ConnectException(e); } } log.trace("Sink record: {}", record); Object value = avroData.fromConnectData(schema, record.value()); try { if (value instanceof NonRecordContainer) { writer.append(((NonRecordContainer) value).getValue()); } else { writer.append(value); } } catch (IOException e) { throw new DataException(e); } } @Override public void close() { try { writer.close(); } catch (IOException e) { throw new DataException(e); } } @Override public void commit() }.init(); }

Target:
public io.confluent.connect.storage.format.RecordWriter getRecordWriter( final HdfsSinkConnectorConfig conf, final String filename ) { return new io.confluent.connect.storage.format.RecordWriter() { final DataFileWriter<Object> writer = new DataFileWriter<>(new GenericDatumWriter<>()); final Path path = new Path(filename); Schema schema = null; @Override public void write(SinkRecord record) { if (schema == null) { schema = record.valueSchema(); try { log.info("Opening record writer for: {}", filename); final FSDataOutputStream out = path.getFileSystem(conf.getHadoopConfiguration()) .create(path); org.apache.avro.Schema avroSchema = avroData.fromConnectSchema(schema); writer.setCodec(CodecFactory.fromString(conf.getAvroCodec())); writer.create(avroSchema, out); } catch (IOException e) { throw new ConnectException(e); } } log.trace("Sink record: {}", record); Object value = avroData.fromConnectData(schema, record.value()); try { if (value instanceof NonRecordContainer) { writer.append(((NonRecordContainer) value).getValue()); } else { writer.append(value); } } catch (IOException e) { throw new DataException(e); } } @Override public void close() { try { writer.close(); } catch (IOException e) { throw new DataException(e); } } @Override public void commit() }; }
Source:
@Override public void updateBasicAlerts(final IJob job, final boolean basicAlerts, final boolean basicPages) { @Nullable final Group group = this.groupManager.getGroup(job.getGroup()); if (group == null) { log.info("group was null"); return; } final Set<AbstractJobAlert> alerts = this.jobAlertRunner.getAlertsForJob(job.getId()); BasicAlerts existingBasicAlerts = BasicAlerts.create(alerts, BASIC_ALERT); BasicAlerts existingBasicPages = BasicAlerts.create(alerts, BASIC_PAGE); this.updateBasicAlert( existingBasicAlerts, job, basicAlerts, job.getBasicAlerts(), BASIC_ALERT, group.email, group.webhookURL, job::setBasicAlerts ); this.updateBasicAlert( existingBasicPages, job, basicPages, job.getBasicPages(), BASIC_PAGE, group.pagerEmail, null, job::setBasicPages ); }

Target:
@Override public void updateBasicAlerts(final IJob job, final boolean basicAlerts, final boolean basicPages) { @Nullable final Group group = this.groupManager.getGroup(job.getGroup()); if (group == null) { log.warn("No group '{}' found for job {}. Unable to create alerts without config.", job.getGroup(), job.getId()); return; } final Set<AbstractJobAlert> alerts = this.jobAlertRunner.getAlertsForJob(job.getId()); BasicAlerts existingBasicAlerts = BasicAlerts.create(alerts, BASIC_ALERT); BasicAlerts existingBasicPages = BasicAlerts.create(alerts, BASIC_PAGE); this.updateBasicAlert( existingBasicAlerts, job, basicAlerts, job.getBasicAlerts(), BASIC_ALERT, group.email, group.webhookURL, job::setBasicAlerts ); this.updateBasicAlert( existingBasicPages, job, basicPages, job.getBasicPages(), BASIC_PAGE, group.pagerEmail, null, job::setBasicPages ); }
Source:
public int countChildren(String path) { checkIfPathContainsShardingKey(path); return countChildren(path); }

Target:
public int countChildren(String path) { checkIfPathContainsShardingKey(path); return _rawZkClient.countChildren(path); }
Source:
private void checkComment(GHIssueComment comment) throws IOException { GHUser sender = comment.getUser(); String body = comment.getBody(); logger.log(Level.FINEST, "[{0}] Added comment: {1}", new Object[] { sender.getName() != null ? sender.getName() : sender.getLogin(), body }); if (helper.isWhitelistPhrase(body) && helper.isAdmin(sender)) { GHIssue parent = comment.getParent(); GHUser author = parent.getUser(); if (!helper.isWhitelisted(author)) { logger.log(Level.FINEST, "Author {0} not whitelisted, adding to whitelist.", author); helper.addWhitelist(author.getLogin()); } setAccepted(true); } else if (helper.isOktotestPhrase(body) && helper.isAdmin(sender)) { logger.log(Level.FINEST, "Admin {0} gave OK to test", sender); setAccepted(true); } else if (helper.isRetestPhrase(body)) { logger.log(Level.FINEST, "Retest phrase"); if (helper.isAdmin(sender)) { logger.log(Level.FINEST, "Admin {0} gave retest phrase", sender); shouldRun = true; } else if (accepted && helper.isWhitelisted(sender)) { logger.log(Level.FINEST, "Retest accepted and user {0} is whitelisted", sender); shouldRun = true; } } else if (helper.isTriggerPhrase(body)) { logger.log(Level.FINEST, "Trigger phrase"); if (helper.isAdmin(sender)) { logger.log(Level.FINEST, "Admin {0} ran trigger phrase", sender); shouldRun = true; triggered = true; } else if (accepted && helper.isWhitelisted(sender)) { logger.log(Level.FINEST, "Trigger accepted and user {0} is whitelisted", sender); shouldRun = true; triggered = true; } } if (shouldRun) { triggerSender = sender; commentBody = body; } }

Target:
private void checkComment(GHIssueComment comment) throws IOException { GHUser sender = comment.getUser(); String body = comment.getBody(); String senderName = sender.getName(); logger.log(Level.FINEST, "[{0}] Added comment: {1}", new Object[] { senderName != null ? senderName : sender.getLogin(), body }); if (helper.isWhitelistPhrase(body) && helper.isAdmin(sender)) { GHIssue parent = comment.getParent(); GHUser author = parent.getUser(); if (!helper.isWhitelisted(author)) { logger.log(Level.FINEST, "Author {0} not whitelisted, adding to whitelist.", author); helper.addWhitelist(author.getLogin()); } setAccepted(true); } else if (helper.isOktotestPhrase(body) && helper.isAdmin(sender)) { logger.log(Level.FINEST, "Admin {0} gave OK to test", sender); setAccepted(true); } else if (helper.isRetestPhrase(body)) { logger.log(Level.FINEST, "Retest phrase"); if (helper.isAdmin(sender)) { logger.log(Level.FINEST, "Admin {0} gave retest phrase", sender); shouldRun = true; } else if (accepted && helper.isWhitelisted(sender)) { logger.log(Level.FINEST, "Retest accepted and user {0} is whitelisted", sender); shouldRun = true; } } else if (helper.isTriggerPhrase(body)) { logger.log(Level.FINEST, "Trigger phrase"); if (helper.isAdmin(sender)) { logger.log(Level.FINEST, "Admin {0} ran trigger phrase", sender); shouldRun = true; triggered = true; } else if (accepted && helper.isWhitelisted(sender)) { logger.log(Level.FINEST, "Trigger accepted and user {0} is whitelisted", sender); shouldRun = true; triggered = true; } } if (shouldRun) { triggerSender = sender; commentBody = body; } }
Source:
public static VDSReturnValue runVdsCommandWithFailover(VDSCommandType vdsCommandType, VdsIdVDSCommandParametersBase params, Guid storagePoolId, CommandBase<?> cmd) { return runVdsCommandWithFailover(vdsCommandType, params, storagePoolId, cmd, true); }

Target:
public static VDSReturnValue runVdsCommandWithFailover(VDSCommandType vdsCommandType, VdsIdVDSCommandParametersBase params, Guid storagePoolId, CommandBase<?> cmd) { return runVdsCommand(vdsCommandType, params, storagePoolId, cmd, true); }
Source:
private void sendPongResponse(WebSocketMessage webSocketMessage){ if( webSocketMessage instanceof WebSocketProxyV13.WebSocketMessageV13){ WebSocketProxyV13.WebSocketMessageV13 webSocketMessageV13 = (WebSocketProxyV13.WebSocketMessageV13) webSocketMessage; WebSocketMessageDTO webSocketMessageDTO = webSocketMessageV13.getDTO(); webSocketMessageDTO.readableOpcode = WebSocketMessage.opcode2string(WebSocketMessage.OPCODE_PONG); webSocketMessageDTO.opcode = WebSocketMessage.OPCODE_PONG; webSocketMessageDTO.isOutgoing = true; webSocketMessageDTO.id++; try { sendAndNotify(webSocketMessageDTO, Initiator.MANUAL_REQUEST); } catch (IOException e) { logger.warn(e.getStackTrace().toString()); } }else{ logger.warn("Haven't been supported that WebSocket Version yet"); } }

Target:
private void sendPongResponse(WebSocketMessage webSocketMessage){ WebSocketMessageDTO webSocketMessageDTO = webSocketMessage.getDTO(); webSocketMessageDTO.readableOpcode = WebSocketMessage.opcode2string(WebSocketMessage.OPCODE_PONG); webSocketMessageDTO.opcode = WebSocketMessage.OPCODE_PONG; webSocketMessageDTO.isOutgoing = !webSocketMessageDTO.isOutgoing; webSocketMessageDTO.hasChanged = true; try { sendAndNotify(webSocketMessageDTO, Initiator.MANUAL_REQUEST); } catch (IOException e) { logger.warn("Failed to send Pong response:", e); } }
Source:
public Uri getTakePhotoUri() { File file; if (Config.ONLY_INTERNAL_STORAGE) { file = new File(mXmppConnectionService.getCacheDir().getAbsolutePath(), "Camera/IMG_" + this.IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); } else { file = new File(getTakePhotoPath() + "IMG_" + this.IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); } file.getParentFile().mkdirs(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { return FileProvider.getUriForFile(mXmppConnectionService, CONVERSATIONS_FILE_PROVIDER, file); } else { return Uri.fromFile(file); } }

Target:
public Uri getTakePhotoUri() { File file; if (Config.ONLY_INTERNAL_STORAGE) { file = new File(mXmppConnectionService.getCacheDir().getAbsolutePath(), "Camera/IMG_" + this.IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); } else { file = new File(getTakePhotoPath() + "IMG_" + this.IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); } file.getParentFile().mkdirs(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N || Config.ONLY_INTERNAL_STORAGE) { return FileProvider.getUriForFile(mXmppConnectionService, CONVERSATIONS_FILE_PROVIDER, file); } else { return Uri.fromFile(file); } }
Source:
void handleRepeatedInvocation() { cancelFutures(); List<ICompletionProposal> computedProposals= Collections.synchronizedList(new ArrayList<>()); fFutures= buildCompletionFuturesOrJobs(fInvocationOffset); List<CompletableFuture<Void>> populateFutures= new ArrayList<>(fFutures.size()); for (CompletableFuture<List<ICompletionProposal>> future : fFutures) { populateFutures.add(future.thenAccept(proposals -> computedProposals.addAll(proposals))); } ComputingProposal computingProposal= new ComputingProposal(fInvocationOffset, fFutures.size()); computedProposals.add(0, computingProposal); fComputedProposals= computedProposals; setProposals(fComputedProposals, false); Set<CompletableFuture<Void>> remaining= Collections.synchronizedSet(new HashSet<>(populateFutures)); for (CompletableFuture<Void> populateFuture : populateFutures) { populateFuture.thenRun(() -> { remaining.removeIf(CompletableFuture::isDone); computingProposal.setRemaining(remaining.size()); if (remaining.isEmpty()) { computedProposals.remove(computingProposal); } List<ICompletionProposal> newProposals= new ArrayList<>(computedProposals); fComputedProposals= newProposals; Display.getDefault().asyncExec(() -> { setProposals(newProposals, false); displayProposals(); }); }); } displayProposals(); }

Target:
void handleRepeatedInvocation() { cancelFutures(); fFutures= buildCompletionFuturesOrJobs(fInvocationOffset); runFutures(fInvocationOffset, null, false, false, false); }
Source:
private final void update(String userInput) { List<String> confirmedKeywords = getConfirmedKeywords(userInput); for (String confirmedKeyword : confirmedKeywords) { updateAssignedLabels(Optional.ofNullable(TurboLabel.getMatchedLabels(allLabels, confirmedKeyword).get(0))); } Optional<String> keywordInProgess = getKeywordInProgress(userInput); if (keywordInProgess.isPresent()) { updateMatchedLabels(keywordInProgess.get()); updateSuggestionIndex(keywordInProgess.get(), matchedLabels); } }

Target:
private final void update(String userInput) { List<String> confirmedKeywords = getConfirmedKeywords(userInput); for (String confirmedKeyword : confirmedKeywords) { TurboLabel.getMatchedLabels(allLabels, confirmedKeyword) .stream().findFirst().ifPresent(this::updateAssignedLabels); } Optional<String> keywordInProgess = getKeywordInProgress(userInput); if (keywordInProgess.isPresent()) { updateMatchedLabels(keywordInProgess.get()); updateSuggestionIndex(keywordInProgess.get(), matchedLabels); } }
Source:
public void testInsertUnpartitioned() { String tableName = "test_basic_statistics_unpartitioned_insert_presto"; onPresto().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); onPresto().executeQuery(format("" + "CREATE TABLE %s (" + " n_nationkey bigint, " + " n_regionkey bigint, " + " n_name varchar(25), " + " n_comment varchar(152)" + ")", tableName)); try { BasicStatistics statisticsEmpty = getBasicStatisticsForTable(onHive(), tableName); assertThatStatisticsArePresent(statisticsEmpty); assertThatStatisticsAreZero(statisticsEmpty); insertNationData(onPresto(), tableName); BasicStatistics statisticsFirstInsert = getBasicStatisticsForTable(onHive(), tableName); assertThatStatisticsArePresent(statisticsFirstInsert); assertThatStatisticsAreNonZero(statisticsFirstInsert); assertThat(statisticsFirstInsert.getNumRows().getAsLong()).isEqualTo(25); insertNationData(onPresto(), tableName); BasicStatistics statisticsSecondInsert = getBasicStatisticsForTable(onHive(), tableName); assertThatStatisticsArePresent(statisticsSecondInsert); assertThatStatisticsAreNonZero(statisticsSecondInsert); assertThatStatisticsValuesHaveIncreased(statisticsFirstInsert, statisticsSecondInsert); assertThat(statisticsSecondInsert.getNumRows().getAsLong()).isEqualTo(50); assertThat(statisticsSecondInsert.getNumPartitions().getAsLong()).isEqualTo(0); } finally { onPresto().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); } }

Target:
public void testInsertUnpartitioned() { String tableName = "test_basic_statistics_unpartitioned_insert_presto"; onPresto().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); onPresto().executeQuery(format("" + "CREATE TABLE %s (" + " n_nationkey bigint, " + " n_regionkey bigint, " + " n_name varchar(25), " + " n_comment varchar(152)" + ")", tableName)); try { BasicStatistics statisticsEmpty = getBasicStatisticsForTable(onHive(), tableName); assertThatStatisticsAreZero(statisticsEmpty); insertNationData(onPresto(), tableName); BasicStatistics statisticsFirstInsert = getBasicStatisticsForTable(onHive(), tableName); assertThatStatisticsAreNonZero(statisticsFirstInsert); assertThat(statisticsFirstInsert.getNumRows().getAsLong()).isEqualTo(25); insertNationData(onPresto(), tableName); BasicStatistics statisticsSecondInsert = getBasicStatisticsForTable(onHive(), tableName); assertThatStatisticsAreNonZero(statisticsSecondInsert); assertThatStatisticsValuesHaveIncreased(statisticsFirstInsert, statisticsSecondInsert); assertThat(statisticsSecondInsert.getNumRows().getAsLong()).isEqualTo(50); } finally { onPresto().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); } }
Source:
public OpenApiResource(@JaxrsResource Set<Object> jaxrsResources) { this.jaxrsResources = jaxrsResources; }

Target:
public OpenApiResource(@JaxrsResource Set<Object> jaxrsResources) { this.jaxrsResources = requireNonNull(jaxrsResources, "jaxrsResources is null"); }