auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public DefaultCustomerInSession(final Configuration configuration, final ObjectStoringSessionStrategy session, final UserInfoViewModelFactory userInfoViewModelFactory) { this.customerIdSessionKey = configuration.getString("session.customer.customerId", DEFAULT_CUSTOMER_ID_SESSION_KEY); this.customerEmailSessionKey = configuration.getString("session.customer.customerEmail", DEFAULT_CUSTOMER_EMAIL_SESSION_KEY); this.customerGroupIdSessionKey = configuration.getString("session.customer.customerGroup", DEFAULT_CUSTOMER_GROUP_SESSION_KEY); this.userInfoSessionKey = configuration.getString("session.customer.userInfo", DEFAULT_USER_INFO_SESSION_KEY); this.session = session; this.userInfoViewModelFactory = userInfoViewModelFactory; }

Target:
public DefaultCustomerInSession(final Configuration configuration, final ObjectStoringSessionStrategy session, final UserInfoViewModelFactory userInfoViewModelFactory) { this.customerIdSessionKey = configuration.getString("session.customer.customerId", DEFAULT_CUSTOMER_ID_SESSION_KEY); this.customerEmailSessionKey = configuration.getString("session.customer.customerEmail", DEFAULT_CUSTOMER_EMAIL_SESSION_KEY); this.customerGroupIdSessionKey = configuration.getString("session.customer.customerGroupId", DEFAULT_CUSTOMER_GROUP_SESSION_KEY); this.userInfoSessionKey = configuration.getString("session.customer.userInfo", DEFAULT_USER_INFO_SESSION_KEY); this.session = session; this.userInfoViewModelFactory = userInfoViewModelFactory; }
Source:
List<Supplier<PageFilter>> makeReorderableFilters(Optional<RowExpression> filter, Optional<String> classNameSuffix) { if (!filter.isPresent()) { return ImmutableList.of(); } ImmutableList.Builder<RowExpression> conjunctBuilder = ImmutableList.builder(); collectConjuncts(filter.get(), conjunctBuilder); List<RowExpression> allConjuncts = conjunctBuilder.build(); if (allConjuncts.size() == 1) { return ImmutableList.of(pageFunctionCompiler.compileFilter(filter.get(), classNameSuffix)); } ImmutableList.Builder<Supplier<PageFilter>> result = ImmutableList.builder(); CallExpression topAnd = (CallExpression) filter.get(); Map<Set<InputReferenceExpression>, List<RowExpression>> inputsToConjuncts = new HashMap(); for (RowExpression conjunct : allConjuncts) { ImmutableSet.Builder<InputReferenceExpression> inputs = ImmutableSet.builder(); collectInputs(conjunct, inputs); inputsToConjuncts.compute(inputs.build(), (k, v) -> { if (v == null) { v = new ArrayList(); v.add(conjunct); return v; } else { v.add(conjunct); } return v; }); } for (List<RowExpression> conjuncts : inputsToConjuncts.values()) { RowExpression firstConjunct = conjuncts.get(0); for (int i = 1; i < conjuncts.size(); i++) { firstConjunct = new CallExpression(topAnd.getSignature(), topAnd.getType(), ImmutableList.of(firstConjunct, conjuncts.get(i))); } result.add(pageFunctionCompiler.compileFilter(firstConjunct, classNameSuffix)); } return result.build(); }

Target:
List<Supplier<PageFilter>> makeReorderableFilters(Optional<RowExpression> filter, Optional<String> classNameSuffix) { if (!filter.isPresent()) { return ImmutableList.of(); } ImmutableList.Builder<RowExpression> conjunctBuilder = ImmutableList.builder(); collectConjuncts(filter.get(), conjunctBuilder); List<RowExpression> allConjuncts = conjunctBuilder.build(); if (allConjuncts.size() == 1) { return ImmutableList.of(pageFunctionCompiler.compileFilter(filter.get(), classNameSuffix)); } ImmutableList.Builder<Supplier<PageFilter>> result = ImmutableList.builder(); CallExpression topAnd = (CallExpression) filter.get(); Map<Set<InputReferenceExpression>, List<RowExpression>> inputsToConjuncts = new HashMap(); for (RowExpression conjunct : allConjuncts) { ImmutableSet.Builder<InputReferenceExpression> inputs = ImmutableSet.builder(); collectInputs(conjunct, inputs); inputsToConjuncts.computeIfAbsent(inputs.build(), k -> new ArrayList<>()).add(conjunct); } for (List<RowExpression> conjuncts : inputsToConjuncts.values()) { RowExpression firstConjunct = conjuncts.get(0); for (int i = 1; i < conjuncts.size(); i++) { firstConjunct = new CallExpression(topAnd.getSignature(), topAnd.getType(), ImmutableList.of(firstConjunct, conjuncts.get(i))); } result.add(pageFunctionCompiler.compileFilter(firstConjunct, classNameSuffix)); } return result.build(); }
Source:
public <T> void registerInstance(final T instance) { requireNonNull(instance); streamCategories() .filter(category -> category.isAssignableFrom(instance.getClass())) .map(category -> (InstanceRegistry<? super T>) instanceRegistry(category)) .forEach(registry -> registry.register(instance)); }

Target:
public <T> void registerInstance(final T instance) { ensureArgumentNonNull("instance", instance); streamCategories().filter(category -> category.isAssignableFrom(instance.getClass())) .map(category -> (InstanceRegistry<? super T>) instanceRegistry(category)) .forEach(registry -> registry.register(instance)); }
Source:
public boolean deleteUsers(List<String> userNames) { return (Boolean) transactionTemplate.execute(new TransactionCallback() { @Override public Object doInTransaction(TransactionStatus status) { ArrayList<String> nullUsers = new ArrayList<>(); ArrayList<String> enabledUsers = new ArrayList<>(); checkAndCollectInvalidUsers(nullUsers, enabledUsers, userNames); if(nullUsers.isEmpty() && enabledUsers.isEmpty()){ String queryString = String.format("delete from User where name in (:userNames)"); Query query = sessionFactory.getCurrentSession().createQuery(queryString); query.setParameterList("userNames", userNames); query.executeUpdate(); return Boolean.TRUE; } throw new BulkDeleteException(nullUsers, enabledUsers); } }); }

Target:
public boolean deleteUsers(List<String> userNames) { return (Boolean) transactionTemplate.execute(new TransactionCallback() { @Override public Object doInTransaction(TransactionStatus status) { String queryString = "delete from User where name in (:userNames)"; Query query = sessionFactory.getCurrentSession().createQuery(queryString); query.setParameterList("userNames", userNames); query.executeUpdate(); return Boolean.TRUE; } }); }
Source:
private void assertSuccessCompletion(CompletableFuture<Void> future) { try { CompletionStages.join(future); } catch (Exception e) { Assert.fail("Future should've completed successfully"); } }

Target:
private void assertSuccessCompletion(CompletableFuture<Void> future) { try { FunctionalTestUtils.await(future); } catch (Exception e) { Assert.fail("Future should've completed successfully"); } }
Source:
public Duration getAdbExecTimeout() { return (Duration) getCapability(AndroidMobileCapabilityType.ADB_EXEC_TIMEOUT); }

Target:
public Duration getAdbExecTimeout() { Object duration = getCapability(AndroidMobileCapabilityType.ADB_EXEC_TIMEOUT); if (duration.getClass().isAssignableFrom(Long.class)) { return Duration.ofMillis((Long) duration); } Integer integer = (Integer) duration; Long value = Long.valueOf(integer); return Duration.ofMillis(value); }
Source:
void checkMaxEnvironmentRam(Workspace workspace) throws ServerException { if (workspace.getConfig() != null) { checkMaxEnvironmentRam(workspace.getId(), workspace.getConfig()); } else { LOG.warn( "Can not estimate memory needed for devfile based workspace {}. Set environment memory limits may work incorrectly", workspace.getId()); } }

Target:
void checkMaxEnvironmentRam(Workspace workspace) throws ServerException { if (workspace.getConfig() != null) { checkMaxEnvironmentRam(workspace.getId(), workspace.getConfig()); } else { LOG.warn( "Can not estimate memory needed for devfile based workspace `{}`." + " The environment memory limits may not be applied correctly.", workspace.getId()); } }
Source:
public void drawMapImage(final Graphics g) { final Graphics2D g2d = (Graphics2D) checkNotNull(g); final GameData gameData = this.gameData; gameData.acquireReadLock(); try { final Rectangle2D.Double bounds = new Rectangle2D.Double(0, 0, getImageWidth(), getImageHeight()); final Collection<Tile> tileList = tileManager.getTiles(bounds); for (final Tile tile : tileList) { tile.drawImage(gameData, uiContext.getMapData()); final Image img = tile.getImage(); g2d.drawImage( img, AffineTransform.getTranslateInstance(tile.getBounds().x, tile.getBounds().y), this); } } finally { gameData.releaseReadLock(); } }

Target:
public void drawMapImage(final Graphics g) { final Graphics2D g2d = (Graphics2D) checkNotNull(g); final GameData gameData = this.gameData; gameData.acquireReadLock(); try { final Rectangle2D.Double bounds = new Rectangle2D.Double(0, 0, getImageWidth(), getImageHeight()); final Collection<Tile> tileList = tileManager.getTiles(bounds); for (final Tile tile : tileList) { tile.drawImage(gameData, uiContext.getMapData()); g2d.drawImage( tile.getImage(), AffineTransform.getTranslateInstance(tile.getBounds().x, tile.getBounds().y), this); } } finally { gameData.releaseReadLock(); } }
Source:
private String putBlob(AmbryCoordinator ac) throws InterruptedException, StoreException, IOException, CoordinatorException { BlobProperties putBlobProperties = new BlobProperties(100, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time); ByteBuffer putUserMetadata = ByteBuffer.allocate(10); for (byte b = 0; b < 10; b++) { putUserMetadata.put(b); } ByteBuffer putContent = ByteBuffer.allocate(100); for (byte b = 0; b < 100; b++) { putContent.put(b); } putContent.flip(); return putBlob(ac, putBlobProperties, putUserMetadata, putContent); }

Target:
private String putBlob(AmbryCoordinator ac) throws InterruptedException, StoreException, IOException, CoordinatorException { BlobProperties putBlobProperties = new BlobProperties(100, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time); ByteBuffer putUserMetadata = getByteBuffer(10, false); ByteBuffer putContent = getByteBuffer(100, true); return putBlob(ac, putBlobProperties, putUserMetadata, putContent); }
Source:
public Extensions() { factories = new CopyOnWriteArrayList<>(); }

Target:
public Extensions()
Source:
Plumber initPlumber() { log.info("Someone get us a plumber!"); plumber = fireDepartment.findPlumber(); return plumber; }

Target:
private void initPlumber() { log.info("Someone get us a plumber!"); plumber = fireDepartment.findPlumber(); }
Source:
public boolean trySyncAcl(ACLDocumentOperation operation) { LOGGER.debug("Syncing the ACL to ElasticSearch"); try { lock.lock(); Collection<SearchGuardACLDocument> docs = loadAcls(); if(docs.size() < 2) { return false; } operation.syncDocuments(docs); return isSuccessfulWrite(writeAcl(operation, docs)); } catch (Exception e) { LOGGER.error("Exception while syncing ACL with cache", e); } finally { lock.unlock(); } return false; }

Target:
public boolean trySyncAcl(ACLDocumentOperation operation) { LOGGER.debug("Syncing the ACL to ElasticSearch"); try { lock.lock(); Collection<SearchGuardACLDocument> docs = loadAcls(); if(docs.size() < 2) { return false; } operation.syncDocuments(docs); return isSuccessfulWrite(writeAcl(operation, docs)); } catch (Exception e) { LOGGER.error("Exception while syncing ACL to Elasticsearch", e); } finally { lock.unlock(); } return false; }
Source:
public Chain getAndAppend(final long key, final ByteBuffer payLoad) throws TimeoutException { Chain chain = delegate.getAndAppend(key, payLoad); incrementInvalidationsCounter(key); return chain; }

Target:
public Chain getAndAppend(final long key, final ByteBuffer payLoad) throws TimeoutException { return delegate.getAndAppend(key, payLoad); }
Source:
protected void finished(Description description) { stopRecording(); }

Target:
protected void finished(Description description) { stopRecordingWithFinalWaiting(); }
Source:
public void testConfigureAsyncDeletes() throws Exception { Cache cache = cacheManager.getCache(); ExecutorService executor = spy(Executors.newFixedThreadPool(1)); try (Directory directory = DirectoryBuilder.newDirectoryInstance(cache, cache, cache, INDEX_NAME) .chunkSize(BUFFER_SIZE) .deleteOperationsExecutor(executor) .create()) { createFile(directory, "file"); assertEquals(directory.listAll().length, 1); directory.deleteFile("file"); eventuallyEquals(0, () -> { try { return directory.listAll().length; } catch (IOException e) { Assert.fail("Error inspecting directory", e); return null; } }); verify(executor).execute(any(Runnable.class)); } finally { executor.shutdownNow(); } }

Target:
public void testConfigureAsyncDeletes() throws Exception { Cache cache = cacheManager.getCache(); ExecutorService executor = spy(Executors.newFixedThreadPool(1)); try (Directory directory = DirectoryBuilder.newDirectoryInstance(cache, cache, cache, INDEX_NAME) .chunkSize(BUFFER_SIZE) .deleteOperationsExecutor(executor) .create()) { createFile(directory, "file"); assertEquals(directory.listAll().length, 1); directory.deleteFile("file"); eventuallyEquals(0, () -> { try { return directory.listAll().length; } catch (IOException e) { Assert.fail("Error inspecting directory", e); return null; } }); verify(executor).execute(any(DirectoryLucene.DeleteTask.class)); } finally { executor.shutdownNow(); } }
Source:
public static boolean assertPmCounter(int expectedCounter) { int actualCounter = pmPage.getMessagesCounter(); info("Expected counter: " + expectedCounter + ", actual counter: " + actualCounter); if (expectedCounter == actualCounter) { info("Assertion successful"); return true; } throw new AssertionFailedError("Actual PM counter differs from the expected value"); }

Target:
public static void assertPmCounter(int expectedCounter) { int actualCounter = pmPage.getMessagesCounter(); info("Checking PM counter. Expected: " + expectedCounter + ", actual: " + actualCounter); if (expectedCounter != actualCounter) { throw new AssertionFailedError("Actual PM counter differs from the expected value"); } info("Success. Expected counter equals actual number."); }
Source:
public void onTestFailure(ITestResult result) { driver = DriverProvider.getWebDriver(); if (Global.LOG_ENABLED) { try { CommonUtils .captureScreenshot(screenPath + imageCounter, driver); CommonUtils.appendTextToFile(screenPath + imageCounter + ".html", driver.getPageSource()); } catch (Exception e) { log("onException", "driver has no ability to catch screenshot or html source - driver may died", false); } StackTraceElement[] stackTrace = result.getThrowable().getStackTrace(); StringBuilder stackTraceBuilder = new StringBuilder(); for (int i=0; i<stackTrace.length; i++){ stackTraceBuilder.append(stackTrace[i]); stackTraceBuilder.append("\n"); } StringBuilder builder = new StringBuilder(); builder.append("<tr class=\"error\"><td>error</td><td>" + result.getThrowable().toString() + "\n" +stackTraceBuilder.toString() + "</td><td> <br/><a href='screenshots/screenshot" + imageCounter + ".png'>Screenshot</a><br/><a href='screenshots/screenshot" + imageCounter + ".html'>HTML Source</a></td></tr>"); CommonUtils.appendTextToFile(logPath, builder.toString()); imageCounter += 1; logJSError(driver); } }

Target:
public void onTestFailure(ITestResult result) { driver = DriverProvider.getWebDriver(); if (Global.LOG_ENABLED) { try { CommonUtils .captureScreenshot(screenPath + imageCounter, driver); CommonUtils.appendTextToFile(screenPath + imageCounter + ".html", driver.getPageSource()); } catch (Exception e) { log("onException", "driver has no ability to catch screenshot or html source - driver may died", false); } String exception = result.getThrowable().toString() + "\n" +ExceptionUtils.getStackTrace(result.getThrowable()); StringBuilder builder = new StringBuilder(); builder.append("<tr class=\"error\"><td>error</td><td>" + exception + "</td><td> <br/><a href='screenshots/screenshot" + imageCounter + ".png'>Screenshot</a><br/><a href='screenshots/screenshot" + imageCounter + ".html'>HTML Source</a></td></tr>"); CommonUtils.appendTextToFile(logPath, builder.toString()); imageCounter += 1; logJSError(driver); onTestSuccess(result); } }
Source:
public void tearDown() { fBot.closeAllEditors(); SWTBotUtils.deleteProject(PROJECT_NAME, fBot); }

Target:
public void tearDown() { fBot.closeAllEditors(); }
Source:
private SslContext getClientSslContext() throws SSLException { return SslContextBuilder .forClient() .sslProvider(BaseSslContextFactory.chooseSslProvider()) .startTls(true) .build(); }

Target:
private SslContext getClientSslContext() throws SSLException { return SslContextBuilder .forClient() .sslProvider(BaseSslContextFactory.chooseSslProvider()) .build(); }
Source:
private WrappedServletRequest wrapDeflatedRequest(HttpServletRequest request) throws IOException { final Inflater inflater = buildInflater(); try { final InflaterInputStream input = new InflaterInputStream(request.getInputStream(), inflater, inputBufferSize) { @Override public void close() throws IOException { super.close(); localInflater.set(inflater); } }; InputStream exceptionHandlingInput = new ZipExceptionHandlingInputStream(input, DEFLATE); return new WrappedServletRequest(request, exceptionHandlingInput); } catch (ZipException e) { throw ZipExceptionHandlingInputStream.buildBadDataException(DEFLATE, e); } catch (EOFException e) { throw ZipExceptionHandlingInputStream.buildPrematureEofException(DEFLATE, e); } }

Target:
private WrappedServletRequest wrapDeflatedRequest(HttpServletRequest request) throws IOException { final Inflater inflater = buildInflater(); try { final InflaterInputStream input = new InflaterInputStream(request.getInputStream(), inflater, inputBufferSize) { @Override public void close() throws IOException { super.close(); localInflater.set(inflater); } }; return new WrappedServletRequest(request, new ZipExceptionHandlingInputStream(input, DEFLATE)); } catch (IOException e) { throw ZipExceptionHandlingInputStream.handleException(DEFLATE, e); } }
Source:
public void shouldReduceAnEmptyListAndANonEmptyListAndReturnConcatenation() { final List<Integer> list = Collections.unmodifiableList( IntStream.range(0, 5) .boxed() .collect(Collectors.toList()) ); final List<Integer> actual = ListOps.reduce(list, new ArrayList<Integer>(), accumulator, combiner); final List<Integer> expected = IntStream.range(0, 5) .boxed() .collect(Collectors.toList()); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }

Target:
public void shouldReduceAnEmptyListAndANonEmptyListAndReturnConcatenation() { final List<Integer> list = Collections.unmodifiableList( Arrays.asList(0, 1, 2, 3, 4, 5) ); final List<Integer> actual = ListOps.reduce(list, new ArrayList<Integer>(), accumulator, combiner); final List<Integer> expected = Arrays.asList(0, 1, 2, 3, 4, 5); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }
Source:
private Map<String, Map<String, String>> parseVolumeConfigDetails(Map<String, Object> configs) { Map<String, Map<String, String>> volumeConfigs = new HashMap<String, Map<String, String>>(); for (Map.Entry<String, Object> entry : configs.entrySet()) { Map<String, Object> fetchedVolumeConfig = (Map<String, Object>) entry.getValue(); Map<String, String> volConfig = new HashMap<String, String>(); for (Map.Entry<String, Object> config : fetchedVolumeConfig.entrySet()) { String value = (String) config.getValue(); volConfig.put(config.getKey(), value == null ? "" : value); } volumeConfigs.put(entry.getKey(), volConfig); } return volumeConfigs; }

Target:
private Map<String, Map<String, String>> parseVolumeConfigDetails(Map<String, Object> configs) { Map<String, Map<String, String>> volumeConfigs = new HashMap<String, Map<String, String>>(); for (Map.Entry<String, Object> entry : configs.entrySet()) { Map<String, Object> fetchedVolumeConfig = (Map<String, Object>) entry.getValue(); Map<String, String> volConfig = new HashMap<String, String>(); for (Map.Entry<String, Object> config : fetchedVolumeConfig.entrySet()) { String value = (String) config.getValue(); volConfig.put(config.getKey(), value); } volumeConfigs.put(entry.getKey(), volConfig); } return volumeConfigs; }
Source:
public AuthRequest authenticate(final AuthRequest who) throws AccountException { final String authUsername = who.getLocalUser(); final String authPassword = who.getPassword(); if (this.username == null) { this.username = authUsername; this.password = authPassword; } try { final DirContext ctx = open(); try { final LdapQuery.Result m = findAccount(ctx, authUsername); if (authConfig.getAuthType() == AuthType.LDAP) { authenticate(m.getDN(), authPassword); } who.setDisplayName(apply(accountFullName, m)); who.setUserName(apply(accountSshUserName, m)); if (accountEmailAddress != null) { who.setEmailAddress(apply(accountEmailAddress, m)); } else if (emailExpander.canExpand(authUsername)) { who.setEmailAddress(emailExpander.expand(authUsername)); } membershipCache.put(authUsername, queryForGroups(ctx, authUsername, m)); return who; } finally { try { ctx.close(); } catch (NamingException e) { log.warn("Cannot close LDAP query handle", e); } } } catch (NamingException e) { log.error("Cannot query LDAP to autenticate user", e); throw new AccountException("Cannot query LDAP for account", e); } }

Target:
public AuthRequest authenticate(final AuthRequest who) throws AccountException { try { DirContext ctx = null; AuthType authType = authConfig.getAuthType(); String username = who.getLocalUser(); String password = who.getPassword(); if (this.username != null) { ctx = open(); if (authType == AuthType.LDAP) { ctx = authenticate(username, password); } } else if (authType == AuthType.LDAP) { ctx = authenticate(username, password); } else { ctx = open(); } try { final LdapQuery.Result m = findAccount(ctx, username); who.setDisplayName(apply(accountFullName, m)); who.setUserName(apply(accountSshUserName, m)); if (accountEmailAddress != null) { who.setEmailAddress(apply(accountEmailAddress, m)); } else if (emailExpander.canExpand(username)) { who.setEmailAddress(emailExpander.expand(username)); } membershipCache.put(username, queryForGroups(ctx, username, m)); return who; } finally { try { ctx.close(); } catch (NamingException e) { log.warn("Cannot close LDAP query handle", e); } } } catch (NamingException e) { log.error("Cannot query LDAP to autenticate user", e); throw new AccountException("Cannot query LDAP for account", e); } }
Source:
public void firstConnectionAutoUpgradeDisabled() throws Exception { startMiniClusterWithToggleNamespaceMapping(Boolean.FALSE.toString()); Map<String, String> props = new HashMap<>(); props.put(QueryServices.AUTO_UPGRADE_ENABLED, Boolean.FALSE.toString()); ReadOnlyProps readOnlyProps = new ReadOnlyProps(props); SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver driver = new SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver(readOnlyProps); try { driver.getConnectionQueryServices(getJdbcUrl(), new Properties()); fail("Client should not be able to create SYSTEM.CATALOG since we set the isAutoUpgradeEnabled property to false"); } catch (Exception e) { assertTrue(e instanceof UpgradeRequiredException); } hbaseTables = getHBaseTables(); assertFalse(hbaseTables.contains(PHOENIX_SYSTEM_CATALOG) || hbaseTables.contains(PHOENIX_NAMESPACE_MAPPED_SYSTEM_CATALOG)); assertTrue(hbaseTables.size() == 0); assertEquals(1, countUpgradeAttempts); Connection conn = driver.getConnectionQueryServices(getJdbcUrl(), new Properties()).connect(getJdbcUrl(), new Properties()); try { conn.createStatement().execute(EXECUTE_UPGRADE_COMMAND); } catch (Exception e) { fail("EXECUTE UPGRADE should not fail"); } finally { conn.close(); } hbaseTables = getHBaseTables(); assertTrue(PHOENIX_SYSTEM_TABLES.containsAll(hbaseTables)); assertTrue(hbaseTables.size() == 4); }

Target:
private SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver firstConnectionAutoUpgradeDisabled() throws Exception { startMiniClusterWithToggleNamespaceMapping(Boolean.FALSE.toString()); Map<String, String> props = new HashMap<>(); props.put(QueryServices.AUTO_UPGRADE_ENABLED, Boolean.FALSE.toString()); ReadOnlyProps readOnlyProps = new ReadOnlyProps(props); SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver driver = new SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver(readOnlyProps); try { driver.getConnectionQueryServices(getJdbcUrl(), new Properties()); fail("Client should not be able to create SYSTEM.CATALOG since we set the isAutoUpgradeEnabled property to false"); } catch (Exception e) { assertTrue(e instanceof UpgradeRequiredException); } hbaseTables = getHBaseTables(); assertFalse(hbaseTables.contains(PHOENIX_SYSTEM_CATALOG) || hbaseTables.contains(PHOENIX_NAMESPACE_MAPPED_SYSTEM_CATALOG)); assertTrue(hbaseTables.size() == 0); assertEquals(1, countUpgradeAttempts); Connection conn = driver.getConnectionQueryServices(getJdbcUrl(), new Properties()).connect(getJdbcUrl(), new Properties()); try { conn.createStatement().execute(EXECUTE_UPGRADE_COMMAND); } finally { conn.close(); } hbaseTables = getHBaseTables(); assertEquals(PHOENIX_SYSTEM_TABLES, hbaseTables); return driver; }
Source:
private List<IProject> findProjectContainingTest(Path projectPath, IProgressMonitor monitor) { FixedRequestAttributes requestAttributes = this.runConfigurationAttributes.toFixedRequestAttributes(); GradleBuild gradleBuild = CorePlugin.gradleWorkspaceManager().getGradleBuild(requestAttributes); Collection<EclipseProject> models = gradleBuild.fetchCompositeModel(EclipseProject.class, getToken(), monitor); ImmutableSet.Builder<OmniEclipseProject> projects = ImmutableSet.builder(); for (EclipseProject model : models) { projects.addAll(DefaultOmniEclipseProject.from(model).getAll()); } Set<OmniEclipseProject> eclipseProjects = projects.build(); List<IProject> result = new ArrayList<IProject>(); for (OmniEclipseProject eclipseProject : eclipseProjects) { if (eclipseProject.getPath().equals(projectPath)) { Optional<IProject> workspaceProject = CorePlugin.workspaceOperations().findProjectByName(eclipseProject.getName()); if (workspaceProject.isPresent()) { result.add(workspaceProject.get()); } } } return result; }

Target:
private List<IProject> findProjectContainingTest(Path projectPath, IProgressMonitor monitor) { FixedRequestAttributes requestAttributes = this.runConfigurationAttributes.toFixedRequestAttributes(); ModelProvider modelProvider = CorePlugin.gradleWorkspaceManager().getGradleBuild(requestAttributes).getModelProvider(); Set<OmniEclipseProject> eclipseProjects = modelProvider.fetchEclipseGradleProjects(FetchStrategy.LOAD_IF_NOT_CACHED, getToken(), monitor); List<IProject> result = new ArrayList<IProject>(); for (OmniEclipseProject eclipseProject : eclipseProjects) { if (eclipseProject.getPath().equals(projectPath)) { Optional<IProject> workspaceProject = CorePlugin.workspaceOperations().findProjectByName(eclipseProject.getName()); if (workspaceProject.isPresent()) { result.add(workspaceProject.get()); } } } return result; }
Source:
public boolean containsValue(Object value) { LinkedList<Object> linkedList = new LinkedList<Object>(); linkedList.add(value); return validate().litems.containsValue(linkedList); }

Target:
public boolean containsValue(Object value) { LinkedList<Object> linkedList = new LinkedList<Object>(); linkedList.add(value); return validate().linkedListItems.containsValue(linkedList); }
Source:
private static Method find(String methodName) { try { Method method = ManagementFactory.getOperatingSystemMXBean().getClass().getMethod(methodName); if (!method.isAccessible()) { method.setAccessible(true); } return method; } catch (NoSuchMethodException e) { LOGGER.warn("Unable to find method '{}' on the {}", methodName, OperatingSystemMXBean.class.getSimpleName()); return null; } }

Target:
private static Method find(String methodName) { try { Method method = ManagementFactory.getOperatingSystemMXBean().getClass().getMethod(methodName); if (!method.isAccessible()) { method.setAccessible(true); } return method; } catch (NoSuchMethodException | SecurityException e) { LOGGER.trace("Unable to find or access method '{}' on the {}", methodName, OperatingSystemMXBean.class.getSimpleName()); return null; } }
Source:
public static void addPostWithHWAccelerationOff(int localSiteId, int localPostId) { if (localSiteId == 0 || localPostId == 0 || isPostWithHWAccelerationOff(localSiteId, localPostId)) { return; } String key = localSiteId + "-" + localPostId; List<String> currentIds = getPostWithHWAccelerationOff(); currentIds.add(key); String idsAsString = TextUtils.join(",", currentIds); setString(DeletablePrefKey.AZTEC_EDITOR_DISABLE_HW_ACC_KEYS, idsAsString); }

Target:
public static void addPostWithHWAccelerationOff(int localSiteId, int localPostId) { if (localSiteId == 0 || localPostId == 0 || isPostWithHWAccelerationOff(localSiteId, localPostId)) { return; } String key = localSiteId + "-" + localPostId; List<String> currentIds = new ArrayList<>(getPostWithHWAccelerationOff()); currentIds.add(key); String idsAsString = TextUtils.join(",", currentIds); setString(DeletablePrefKey.AZTEC_EDITOR_DISABLE_HW_ACC_KEYS, idsAsString); }
Source:
public static Flux<ByteBuffer> toFluxByteBuffer(InputStream inputStream) { Pair pair = new Pair(); return Flux.just(true) .repeat() .map(ignore -> { byte[] buffer = new byte[BYTE_BUFFER_CHUNK_SIZE]; try { int numBytes = inputStream.read(buffer); if (numBytes > 0) { return pair.buffer(ByteBuffer.wrap(buffer, 0, numBytes)).readBytes(numBytes); } else { return pair.buffer(null).readBytes(numBytes); } } catch (IOException ioe) { throw Exceptions.propagate(ioe); } }) .takeUntil(p -> p.readBytes() == -1) .filter(p -> p.readBytes() > 0) .map(Pair::buffer); }

Target:
public static Flux<ByteBuffer> toFluxByteBuffer(InputStream inputStream) { Pair pair = new Pair(); return Flux.just(true) .repeat() .map(ignore -> { byte[] buffer = new byte[BYTE_BUFFER_CHUNK_SIZE]; try { int numBytes = inputStream.read(buffer); if (numBytes > 0) { return pair.buffer(ByteBuffer.wrap(buffer, 0, numBytes)).readBytes(numBytes); } else { return pair.buffer(null).readBytes(numBytes); } } catch (IOException ioe) { throw LOGGER.logExceptionAsError(new RuntimeException(ioe)); } }) .takeUntil(p -> p.readBytes() == -1) .filter(p -> p.readBytes() > 0) .map(Pair::buffer); }
Source:
protected void verifyAdsFromProvider(String providerName, List<WebElement> slots) { String providerSpecificSelector = AdsContent.getElementForProvider(providerName); for (WebElement slot: slots) { if (!checkIfElementInElement(providerSpecificSelector, slot)) { PageObjectLogging.log( "NoAdsFromProvider", "Ads from " + providerName + " not found in slot: " + slot.getAttribute("id"), false ); throw new NoSuchElementException( "Call to provider: " + providerName + " in slot: " + slot.getAttribute("id") + " not found!" ); } PageObjectLogging.log( "AdsFromProviderFound", "Ads from " + providerName + " found in slot: " + providerSpecificSelector, true ); } }

Target:
protected void verifyAdsFromProvider(String providerName, List<WebElement> slots) { String providerSpecificSelector = AdsContent.getElementForProvider(providerName); for (WebElement slot: slots) { if (!checkIfElementInElement(providerSpecificSelector, slot)) { PageObjectLogging.log( "NoAdsFromProvider", "Ads from " + providerName + " not found in slot: " + slot.getAttribute("id"), false ); throw new NoSuchElementException( "Call to provider: " + providerName + " in slot: " + slot.getAttribute("id") + " not found!" ); } PageObjectLogging.log( "AdsFromProviderFound", "Ads from " + providerName + " found in slot: " + slot.getAttribute("id"), true ); } }
Source:
private void browseSources() { File directory = null; if (rootFileLocation != null) { directory = new File(rootPathLocation); } else { return; } File[] files = directory.listFiles(); if (files == null) { Toast.makeText(getActivity(), getString(R.string.error_reading_local_storage), Toast.LENGTH_LONG); return; } Arrays.sort(files); rootFileLocation.clear(); browseRootAlready = true; for (File file : files) { boolean isDir = file.isDirectory(); rootFileLocation.add( new LocalFileLocation(file.getName(), file.getAbsolutePath(), isDir) ); } ((MediaPictureListAdapter) getAdapter()).setFilelistItems(rootFileLocation); }

Target:
private void browseSources() { File directory = null; if (rootFileLocation != null) { directory = new File(rootPathLocation); } else { return; } File[] files = directory.listFiles(); if (files == null) { Toast.makeText(getActivity(), getString(R.string.error_reading_local_storage), Toast.LENGTH_LONG).show(); return; } Arrays.sort(files); rootFileLocation.clear(); browseRootAlready = true; for (File file : files) { boolean isDir = file.isDirectory(); rootFileLocation.add( new LocalFileLocation(file.getName(), file.getAbsolutePath(), isDir) ); } ((MediaPictureListAdapter) getAdapter()).setFilelistItems(rootFileLocation); }
Source:
MetacardTransformer lookupTransformerReference(String metacardTransformerId) { Bundle bundle = FrameworkUtil.getBundle(this.getClass()); if (bundle != null) { BundleContext bundleContext = bundle.getBundleContext(); try { Collection<ServiceReference<MetacardTransformer>> transformerReference = bundleContext.getServiceReferences( MetacardTransformer.class, "(id=" + metacardTransformerId + ")"); return bundleContext.getService(transformerReference.iterator().next()); } catch (InvalidSyntaxException | NoSuchElementException e) { LOGGER.warn( "Unable to resolve MetacardTransformer {}. Backup will not be performed.", metacardTransformerId, e); } } return null; }

Target:
private MetacardTransformer lookupTransformerReference(String metacardTransformerId) { Bundle bundle = bundleLookup.apply(this.getClass()); if (bundle != null) { BundleContext bundleContext = bundle.getBundleContext(); try { Collection<ServiceReference<MetacardTransformer>> transformerReference = bundleContext.getServiceReferences( MetacardTransformer.class, "(id=" + metacardTransformerId + ")"); return bundleContext.getService(transformerReference.iterator().next()); } catch (InvalidSyntaxException | NoSuchElementException e) { LOGGER.warn( "Unable to resolve MetacardTransformer {}. Backup will not be performed.", metacardTransformerId, e); } } return null; }
Source:
public static void main(String[] args) throws Exception { if (args.length == 0) { throw new IllegalArgumentException("Topology name must be provided."); } final String name = args[0]; NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { @Override public void run(Nimbus.Iface client) throws Exception { GetInfoOptions opts = new GetInfoOptions(); opts.set_num_err_choice(NumErrorsChoice.ONE); TopologyInfo topologyInfo = client.getTopologyInfoByNameWithOpts(name, opts); Map<String, Object> outputMap = new HashMap<>(); if (topologyInfo == null) { outputMap.put("Failure", "No topologies running with name " + name); } else { String topologyName = topologyInfo.get_name(); Map<String, List<ErrorInfo>> topologyErrors = topologyInfo.get_errors(); outputMap.put("Topology Name", topologyName); outputMap.put("Comp-Errors", getComponentErrors(topologyErrors)); } System.out.println(JSONValue.toJSONString(outputMap)); } private Map<String, String> getComponentErrors(Map<String, List<ErrorInfo>> topologyErrors) { Map<String, String> componentErrorMap = new HashMap<>(); for (Map.Entry<String, List<ErrorInfo>> compNameToCompErrors : topologyErrors.entrySet()) { String compName = compNameToCompErrors.getKey(); List<ErrorInfo> compErrors = compNameToCompErrors.getValue(); if (compErrors != null && !compErrors.isEmpty()) { ErrorInfo latestError = compErrors.get(0); componentErrorMap.put(compName, latestError.get_error()); } } return componentErrorMap; } }); }

Target:
public static void main(String[] args) throws Exception { if (args.length == 0) { throw new IllegalArgumentException("Topology name must be provided."); } final String name = args[0]; NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { @Override public void run(Nimbus.Iface client) throws Exception { GetInfoOptions opts = new GetInfoOptions(); opts.set_num_err_choice(NumErrorsChoice.ONE); Map<String, Object> outputMap = new HashMap<>(); try { TopologyInfo topologyInfo = client.getTopologyInfoByNameWithOpts(name, opts); String topologyName = topologyInfo.get_name(); Map<String, List<ErrorInfo>> topologyErrors = topologyInfo.get_errors(); outputMap.put("Topology Name", topologyName); outputMap.put("Comp-Errors", getComponentErrors(topologyErrors)); } catch (NotAliveException notAliveException) { outputMap.put("Failure", "No topologies running with name " + name); } System.out.println(JSONValue.toJSONString(outputMap)); } private Map<String, String> getComponentErrors(Map<String, List<ErrorInfo>> topologyErrors) { Map<String, String> componentErrorMap = new HashMap<>(); for (Map.Entry<String, List<ErrorInfo>> compNameToCompErrors : topologyErrors.entrySet()) { String compName = compNameToCompErrors.getKey(); List<ErrorInfo> compErrors = compNameToCompErrors.getValue(); if (compErrors != null && !compErrors.isEmpty()) { ErrorInfo latestError = compErrors.get(0); componentErrorMap.put(compName, latestError.get_error()); } } return componentErrorMap; } }); }
Source:
public void merge(ExecAggregator addend) throws StandardException { if(addend==null) return; DecimalBufferedSumAggregator other = (DecimalBufferedSumAggregator)addend; if (other.isNull && other.position == 0){ return; } if (!Objects.equals(other.sum, BigDecimal.ZERO)) { buffer[position] = other.sum; incrementPosition(); } for (int i = 0; i< other.position;i++) { buffer[position] = other.buffer[i]; incrementPosition(); } }

Target:
public void merge(ExecAggregator addend) throws StandardException { if(addend==null) return; DecimalBufferedSumAggregator other = (DecimalBufferedSumAggregator)addend; if (other.isNull){ return; } if (!Objects.equals(other.sum, BigDecimal.ZERO)) { buffer[position] = other.sum; incrementPosition(); } for (int i = 0; i< other.position;i++) { buffer[position] = other.buffer[i]; incrementPosition(); } }
Source:
private MetricFamilySamples buildStatusGauge() { String name = "jetty_responses"; return new MetricFamilySamples( name, Type.GAUGE, "number of requests with response status", Arrays.asList( buildStatusSample(name, "1xx", statisticsHandler.getResponses1xx()), buildStatusSample(name, "2xx", statisticsHandler.getResponses2xx()), buildStatusSample(name, "3xx", statisticsHandler.getResponses3xx()), buildStatusSample(name, "4xx", statisticsHandler.getResponses4xx()), buildStatusSample(name, "5xx", statisticsHandler.getResponses5xx()) ) ); }

Target:
private MetricFamilySamples buildStatusGauge() { String name = "jetty_responses"; return new MetricFamilySamples( name, Type.GAUGE, "Number of requests with response status", Arrays.asList( buildStatusSample(name, "1xx", statisticsHandler.getResponses1xx()), buildStatusSample(name, "2xx", statisticsHandler.getResponses2xx()), buildStatusSample(name, "3xx", statisticsHandler.getResponses3xx()), buildStatusSample(name, "4xx", statisticsHandler.getResponses4xx()), buildStatusSample(name, "5xx", statisticsHandler.getResponses5xx()) ) ); }
Source:
public void setConnectionNameStrategy(ConnectionNameStrategy connectionNameStrategy) { this.connectionNameStrategy = connectionNameStrategy; if (this.publisherConnectionFactory != null) { this.publisherConnectionFactory.setConnectionNameStrategy( cf -> connectionNameStrategy + PUBLISHER_SUFFIX); } }

Target:
public void setConnectionNameStrategy(ConnectionNameStrategy connectionNameStrategy) { this.connectionNameStrategy = connectionNameStrategy; if (this.publisherConnectionFactory != null) { this.publisherConnectionFactory.setConnectionNameStrategy( cf -> connectionNameStrategy.obtainNewConnectionName(cf) + PUBLISHER_SUFFIX); } }
Source:
public static void setupViews(List<View> views) { DEFAULT_VIEWS.clear(); for(View view: views) { try { JSONObject json = new JSONObject(); String srsName = view.getBundleByName("mapfull") .getConfigJSON() .getJSONObject("mapOptions") .getString("srsName"); json.put("uuid", view.getUuid()); json.put("name", view.getName()); json.put("srsName", srsName); DEFAULT_VIEWS.add(json); } catch (JSONException e) { LOGGER.warn("Couldn't format default views for appsetup.env:", e.getMessage()); } } }

Target:
public static void setupViews(List<View> views) { DEFAULT_VIEWS.clear(); for(View view: views) { try { JSONObject json = new JSONObject(); json.put("uuid", view.getUuid()); json.put("name", view.getName()); json.put("srsName", view.getSrsName()); DEFAULT_VIEWS.add(json); } catch (JSONException e) { LOGGER.warn("Couldn't format default views for appsetup.env:", e.getMessage()); } } }
Source:
private ModelBuildingRequest getModelBuildingRequest( InternalConfig config, File pomFile ) { ProjectBuildingRequest configuration = config.request; ModelBuildingRequest request = new DefaultModelBuildingRequest(); RequestTrace trace = RequestTrace.newChild( null, configuration ).newChild( request ); RepositorySystemSession repoSession; if ( Features.buildConsumer().isActive() ) { TransformerContext context = new TransformerContext() { @Override public String getUserProperty( String key ) { return config.session.getUserProperties().get( key ); } @Override public Model getRawModel( Path p ) { return config.modelPool.get( p ); } @Override public Model getRawModel( String groupId, String artifactId ) { return config.modelPool.get( groupId, artifactId, null ); } }; request.setTransformerContext( context ); repoSession = new DefaultRepositorySystemSession( config.session ) .setFileTransformerManager( a -> getTransformersForArtifact( a, context ) ); } else { repoSession = config.session; } ModelResolver resolver = new ProjectModelResolver( repoSession, trace, repoSystem, repositoryManager, config.repositories, configuration.getRepositoryMerging(), config.modelPool ); request.setValidationLevel( configuration.getValidationLevel() ); request.setProcessPlugins( configuration.isProcessPlugins() ); request.setProfiles( configuration.getProfiles() ); request.setActiveProfileIds( configuration.getActiveProfileIds() ); request.setInactiveProfileIds( configuration.getInactiveProfileIds() ); request.setSystemProperties( configuration.getSystemProperties() ); request.setUserProperties( configuration.getUserProperties() ); request.setBuildStartTime( configuration.getBuildStartTime() ); request.setModelResolver( resolver ); request.setModelCache( config.modelCache ); return request; }

Target:
private ModelBuildingRequest getModelBuildingRequest( InternalConfig config, File pomFile ) { ProjectBuildingRequest configuration = config.request; ModelBuildingRequest request = new DefaultModelBuildingRequest(); RequestTrace trace = RequestTrace.newChild( null, configuration ).newChild( request ); ModelResolver resolver = new ProjectModelResolver( config.session, trace, repoSystem, repositoryManager, config.repositories, configuration.getRepositoryMerging(), config.modelPool ); request.setValidationLevel( configuration.getValidationLevel() ); request.setProcessPlugins( configuration.isProcessPlugins() ); request.setProfiles( configuration.getProfiles() ); request.setActiveProfileIds( configuration.getActiveProfileIds() ); request.setInactiveProfileIds( configuration.getInactiveProfileIds() ); request.setSystemProperties( configuration.getSystemProperties() ); request.setUserProperties( configuration.getUserProperties() ); request.setBuildStartTime( configuration.getBuildStartTime() ); request.setModelResolver( resolver ); request.setModelCache( config.modelCache ); request.setTransformerContext( (TransformerContext) config.session.getData().get( TransformerContext.KEY ) ); return request; }
Source:
public VectorizedParquetRecordReader( org.apache.hadoop.mapred.InputSplit oldInputSplit, JobConf conf) { try { serDeStats = new SerDeStats(); projectionPusher = new ProjectionPusher(); initialize(oldInputSplit, conf); colsToInclude = ColumnProjectionUtils.getReadColumnIDs(conf); rbCtx = Utilities.getVectorizedRowBatchCtx(conf); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
public VectorizedParquetRecordReader( org.apache.hadoop.mapred.InputSplit oldInputSplit, JobConf conf) { try { serDeStats = new SerDeStats(); projectionPusher = new ProjectionPusher(); initialize(getSplit(oldInputSplit, conf), conf); colsToInclude = ColumnProjectionUtils.getReadColumnIDs(conf); rbCtx = Utilities.getVectorizedRowBatchCtx(conf); } catch (Throwable e) { LOG.error("Failed to create the vectorized reader due to exception " + e); throw new RuntimeException(e); } }
Source:
public void cleanupBefore(long txid) { SortedMap<Long, Object> toDelete = _curr.headMap(txid); for(long tx: new HashSet<Long>(toDelete.keySet())) { _curr.remove(tx); try { _state.delete(txPath(tx)); } catch(RuntimeException e) { if(!(e.getCause() instanceof KeeperException.NoNodeException)) { throw e; } } } }

Target:
public void cleanupBefore(long txid) { SortedMap<Long, Object> toDelete = _curr.headMap(txid); for(long tx: new HashSet<Long>(toDelete.keySet())) { _curr.remove(tx); try { _state.delete(txPath(tx)); } catch(RuntimeException e) { if(!Utils.exceptionCauseIsInstanceOf(KeeperException.NoNodeException.class, e)) { throw e; } } } }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } GroupTopNFunction that = (GroupTopNFunction) o; if (limit != that.limit) { return false; } if (granularity != null ? !granularity.equals(that.granularity) : that.granularity != null) { return false; } if (!ordering.equals(that.ordering)) { return false; } return true; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } GroupTopNFunction that = (GroupTopNFunction) o; if (limit != that.limit || limitPerGroup != that.limitPerGroup) { return false; } if (granularity != that.granularity) { return false; } if (!ordering.equals(that.ordering)) { return false; } return true; }
Source:
private static String formatLinks(final String txt) { final String marker = "]("; final String html = "=\""; final StringBuilder result = new StringBuilder(); final Matcher matcher = MarkdownTxtmark.LINK.matcher(txt); int start = 0; while (matcher.find(start)) { result.append(txt.substring(start, matcher.start())); final String prefix = txt.substring( Math.max(0, matcher.start() - 2), matcher.start() ); final String suffix = txt.substring( matcher.end(), Math.min(txt.length(), matcher.end() + 2) ); final String uri = matcher.group(); if (marker.equals(suffix) || marker.equals(prefix) || html.equals(prefix)) { result.append(uri); } else { result.append(String.format("[%1$s](%1$s)", uri)); } start = matcher.end(); } result.append(txt.substring(start)); return result.toString(); }

Target:
private static String formatLinks(final String txt) { final StringBuffer result = new StringBuffer(); final Matcher matcher = MarkdownTxtmark.LINK.matcher(txt); while (matcher.find()) { matcher.appendReplacement( result, String.format("[%1$s](%1$s)", matcher.group()) ); } matcher.appendTail(result); return result.toString(); }
Source:
private Resource minShareStarvation() { Resource desiredShare = Resources.min(policy.getResourceCalculator(), scheduler.getClusterResource(), getMinShare(), getDemand()); Resource starvation = Resources.subtract(desiredShare, getResourceUsage()); boolean starved = Resources.greaterThan(policy.getResourceCalculator(), scheduler.getClusterResource(), starvation, none()); long now = scheduler.getClock().getTime(); if (!starved) { setLastTimeAtMinShare(now); } if (starved && (now - lastTimeAtMinShare > getMinSharePreemptionTimeout())) { return starvation; } else { return Resources.clone(Resources.none()); } }

Target:
private Resource minShareStarvation() { Resource desiredShare = Resources.min(policy.getResourceCalculator(), scheduler.getClusterResource(), getMinShare(), getDemand()); Resource starvation = Resources.subtract(desiredShare, getResourceUsage()); boolean starved = !Resources.isNone(starvation); long now = scheduler.getClock().getTime(); if (!starved) { setLastTimeAtMinShare(now); } if (now - lastTimeAtMinShare < getMinSharePreemptionTimeout()) { starvation = Resources.clone(Resources.none()); } return starvation; }
Source:
private byte[] randomBytes(final long seed) { final MersenneTwisterFast r = new MersenneTwisterFast(seed); final byte[] ldata = new byte[2938740]; for (int i = 0; i < ldata.length; i++) { ldata[i] = r.nextByte(); } return ldata; }

Target:
private byte[] randomBytes(final long seed) { final MersenneTwisterFast r = new MersenneTwisterFast(seed); final byte[] ldata = new byte[TEST_SIZE]; for (int i = 0; i < ldata.length; i++) { ldata[i] = r.nextByte(); } return ldata; }