auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testQueryCache_with_mapAttribute_inPredicate() { String MAP_ATTRIBUTE_NAME = "booleanMapAttribute"; Config config = new Config(); config.getMapConfig(mapName) .addQueryCacheConfig( new QueryCacheConfig(cacheName) .setIncludeValue(true) .setPredicateConfig( new PredicateConfig(Predicates.equal(MAP_ATTRIBUTE_NAME, true)) )) .addMapAttributeConfig( new MapAttributeConfig() .setExtractor(EvenNumberEmployeeValueExtractor.class.getName()) .setName(MAP_ATTRIBUTE_NAME)); IMap<Integer, Employee> map = getIMap(config); QueryCache<Integer, Employee> queryCache = map.getQueryCache(cacheName); populateMap(map, 100); assertEquals(queryCache.keySet().size(), 50); }

Target:
public void testQueryCache_with_mapAttribute_inPredicate() { String MAP_ATTRIBUTE_NAME = "booleanMapAttribute"; Config config = new Config(); config.getMapConfig(mapName) .addQueryCacheConfig( new QueryCacheConfig(cacheName) .setIncludeValue(true) .setPredicateConfig( new PredicateConfig(Predicates.equal(MAP_ATTRIBUTE_NAME, true)) )) .addMapAttributeConfig( new MapAttributeConfig() .setExtractor(EvenNumberEmployeeValueExtractor.class.getName()) .setName(MAP_ATTRIBUTE_NAME)); IMap<Integer, Employee> map = getIMap(config); QueryCache<Integer, Employee> queryCache = map.getQueryCache(cacheName); populateMap(map, 100); assertQueryCacheSizeEventually(50, queryCache); }
Source:
public PickerMilestone setMatching(boolean isMatching) { this.isMatching = isMatching; return this; }

Target:
public void setMatching(boolean isMatching) { this.isMatching = isMatching; }
Source:
public Object call() throws Exception { LOG.info("Begin plan changes: {}", requests); LogicalPlan lp = plan.cloneLogicalPlan(); PlanModifier pm = new PlanModifier(lp); for (LogicalPlanRequest request : requests) { LOG.debug("Dry run plan change: {}", request); request.execute(pm); } lp.validate(); pm = new PlanModifier(plan); for (LogicalPlanRequest request : requests) { request.execute(pm); recordEventAsync(new StramEvent.ChangeLogicalPlanEvent(request)); } pm.applyChanges(StreamingContainerManager.this); LOG.info("Plan changes applied: {}", requests); return null; }

Target:
public Object call() throws Exception { LOG.info("Begin plan changes: {}", requests); LogicalPlan lp = (LogicalPlan)SerializationUtils.clone(plan.getLogicalPlan()); PlanModifier pm = new PlanModifier(lp); for (LogicalPlanRequest request : requests) { LOG.debug("Dry run plan change: {}", request); request.execute(pm); } lp.validate(); pm = new PlanModifier(plan); for (LogicalPlanRequest request : requests) { request.execute(pm); recordEventAsync(new StramEvent.ChangeLogicalPlanEvent(request)); } pm.applyChanges(StreamingContainerManager.this); LOG.info("Plan changes applied: {}", requests); return null; }
Source:
private String formatQueries(final Set<StreamsQuery> queries) { final StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append("Queries in Rya Streams:\n"); sb.append("---------------------------------------------------------\n"); queries.forEach(query -> { sb.append("ID: ").append(query.getQueryId()) .append(" ") .append("Is Active: ").append(query.isActive()) .append( query.isActive() ? " " : " " ) .append("Query: ").append(query.getSparql()).append("\n"); }); return sb.toString(); }

Target:
private String formatQueries(final Set<StreamsQuery> queries) { final StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append("Queries in Rya Streams:\n"); sb.append("---------------------------------------------------------\n"); queries.forEach(query -> { sb.append("ID: ").append(query.getQueryId()) .append(" ") .append("Is Active: ").append(query.isActive()) .append(StringUtils.rightPad("" + query.isActive(), 9)) .append("Query: ").append(query.getSparql()).append("\n"); }); return sb.toString(); }
Source:
protected boolean validate() { if (!super.validate()) { return false; } macPool = getMacPool(); Map<Guid, StorageDomain> domainsMap = new HashMap<>(); if (!validateBeforeCloneVm(domainsMap)) { return false; } VmHandler.updateMaxMemorySize(getVm().getStaticData(), getEffectiveCompatibilityVersion()); if (getParameters().isImportAsNewEntity()) { initImportClonedVm(); if (getVm().getInterfaces().size() > macPool.getAvailableMacsCount()) { return failValidation(EngineMessage.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); } } if (!validateBallonDevice()) { return false; } if (!validateSoundDevice()) { return false; } if (!validate(VmHandler.validateMaxMemorySize(getVm().getStaticData(), getEffectiveCompatibilityVersion()))) { return false; } return validateAfterCloneVm(domainsMap); }

Target:
protected boolean validate() { if (!super.validate()) { return false; } macPool = getMacPool(); Map<Guid, StorageDomain> domainsMap = new HashMap<>(); if (!validateBeforeCloneVm(domainsMap)) { return false; } VmHandler.updateMaxMemorySize(getVm().getStaticData(), getEffectiveCompatibilityVersion()); if (getParameters().isImportAsNewEntity()) { initImportClonedVm(); if (getVm().getInterfaces().size() > macPool.getAvailableMacsCount()) { return failValidation(EngineMessage.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); } } if (!validateBallonDevice()) { return false; } if (!validateSoundDevice()) { return false; } return validateAfterCloneVm(domainsMap); }
Source:
public static ExpectedCondition<WebDriverElement> visible(final Hook hook) { return new ExpectedCondition<WebDriverElement>() { @Override public WebDriverElement apply(WebDriver driver) { try { WebElement element = findElement(hook, driver); return element.isDisplayed()? createWebDriverElement(hook, element, driver) : null; } catch (CandybeanException e) { return null; } catch (StaleElementReferenceException e) { return null; } } @Override public String toString() { return "visibility of " + hook; } }; }

Target:
public static ExpectedCondition<WebDriverElement> visible(final Hook hook) { return new ExpectedCondition<WebDriverElement>() { @Override public WebDriverElement apply(WebDriver driver) { try { WebElement element = findElement(hook, driver); return element.isDisplayed()? createWebDriverElement(hook, element, driver) : null; } catch (CandybeanException | StaleElementReferenceException e) { return null; } } @Override public String toString() { return "visibility of " + hook; } }; }
Source:
private static String typedNull(int targetSqlType) throws SQLException { switch (targetSqlType) { case Types.BOOLEAN: return typedNull("BOOLEAN"); case Types.TINYINT: return typedNull("TINYINT"); case Types.SMALLINT: return typedNull("SMALLINT"); case Types.INTEGER: return typedNull("INTEGER"); case Types.BIGINT: return typedNull("BIGINT"); case Types.FLOAT: case Types.REAL: return typedNull("REAL"); case Types.DOUBLE: return typedNull("DOUBLE"); case Types.DECIMAL: case Types.NUMERIC: return typedNull("DECIMAL"); case Types.CHAR: case Types.NCHAR: return typedNull("CHAR"); case Types.VARCHAR: case Types.NVARCHAR: case Types.LONGVARCHAR: case Types.LONGNVARCHAR: return typedNull("VARCHAR"); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: return typedNull("VARBINARY"); case Types.DATE: return typedNull("DATE"); case Types.TIME: return typedNull("TIME"); case Types.TIMESTAMP: return typedNull("TIMESTAMP"); case Types.TIME_WITH_TIMEZONE: return typedNull("TIME WITH TIME ZONE"); case Types.TIMESTAMP_WITH_TIMEZONE: return typedNull("TIMESTAMP WITH TIME ZONE"); case Types.OTHER: return "null"; } throw new SQLException("Unsupported target SQL type: " + targetSqlType); }

Target:
private static String typedNull(int targetSqlType) throws SQLException { switch (targetSqlType) { case Types.BOOLEAN: case Types.BIT: return typedNull("BOOLEAN"); case Types.TINYINT: return typedNull("TINYINT"); case Types.SMALLINT: return typedNull("SMALLINT"); case Types.INTEGER: return typedNull("INTEGER"); case Types.BIGINT: return typedNull("BIGINT"); case Types.FLOAT: case Types.REAL: return typedNull("REAL"); case Types.DOUBLE: return typedNull("DOUBLE"); case Types.DECIMAL: case Types.NUMERIC: return typedNull("DECIMAL"); case Types.CHAR: case Types.NCHAR: return typedNull("CHAR"); case Types.VARCHAR: case Types.NVARCHAR: case Types.LONGVARCHAR: case Types.LONGNVARCHAR: case Types.CLOB: case Types.NCLOB: return typedNull("VARCHAR"); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: case Types.BLOB: return typedNull("VARBINARY"); case Types.DATE: return typedNull("DATE"); case Types.TIME: return typedNull("TIME"); case Types.TIMESTAMP: return typedNull("TIMESTAMP"); case Types.NULL: return "NULL"; } throw new SQLException("Unsupported target SQL type: " + targetSqlType); }
Source:
@Test public void emptyModifierSet() throws IOException { javaWriter.emitPackage("com.blah"); javaWriter.beginType("com.blah.Foo", "class", new HashSet<Modifier>()) .endType(); }

Target:
@Test public void emptyModifierSet() throws IOException { javaWriter.emitPackage("com.blah"); javaWriter.beginType("com.blah.Foo", "class", Collections.<Modifier>emptySet()) .endType(); assertCode("" + "package com.blah;\n" + "\n" + "class Foo {\n" + "}\n"); }
Source:
public void testSessionCacheForTLS12() throws Exception { if (protocolCipherCombo != ProtocolCipherCombo.TLSV12) { return; } clientSslCtx = wrapContext(SslContextBuilder.forClient() .trustManager(InsecureTrustManagerFactory.INSTANCE) .sslProvider(sslClientProvider()) .sslContextProvider(clientSslContextProvider()) .protocols(protocols()) .ciphers(ciphers()) .build()); SelfSignedCertificate ssc = new SelfSignedCertificate(); serverSslCtx = wrapContext(SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()) .sslProvider(sslServerProvider()) .sslContextProvider(serverSslContextProvider()) .protocols(protocols()) .ciphers(ciphers()) .build()); try { doHandshake("a.netty.io", 9999); assertSessionCache(serverSslCtx.sessionContext(), 1); assertSessionCache(clientSslCtx.sessionContext(), 1); doHandshake("a.netty.io", 9999); assertSessionCache(serverSslCtx.sessionContext(), 1); assertSessionCache(clientSslCtx.sessionContext(), 1); doHandshake("b.netty.io", 9999); assertSessionCache(serverSslCtx.sessionContext(), 2); assertSessionCache(clientSslCtx.sessionContext(), 2); } finally { ssc.delete(); } }

Target:
public void testSessionCacheForTLS12() throws Exception { if (protocolCipherCombo != ProtocolCipherCombo.TLSV12) { return; } clientSslCtx = wrapContext(SslContextBuilder.forClient() .trustManager(InsecureTrustManagerFactory.INSTANCE) .sslProvider(sslClientProvider()) .sslContextProvider(clientSslContextProvider()) .protocols(protocols()) .ciphers(ciphers()) .build()); SelfSignedCertificate ssc = new SelfSignedCertificate(); serverSslCtx = wrapContext(SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()) .sslProvider(sslServerProvider()) .sslContextProvider(serverSslContextProvider()) .protocols(protocols()) .ciphers(ciphers()) .build()); try { doHandshakeVerifyReusedAndClose("a.netty.io", 9999, false); assertSessionCache(serverSslCtx.sessionContext(), 1); assertSessionCache(clientSslCtx.sessionContext(), 1); doHandshakeVerifyReusedAndClose("a.netty.io", 9999, true); assertSessionCache(serverSslCtx.sessionContext(), 1); assertSessionCache(clientSslCtx.sessionContext(), 1); doHandshakeVerifyReusedAndClose("b.netty.io", 9999, false); assertSessionCache(serverSslCtx.sessionContext(), 2); assertSessionCache(clientSslCtx.sessionContext(), 2); invalidateSessionsAndAssert(serverSslCtx.sessionContext()); invalidateSessionsAndAssert(clientSslCtx.sessionContext()); } finally { ssc.delete(); } }
Source:
private ArrayList<Integer> getMessageLocationFromParam(JSONObject params) throws ApiException { String fuzzLocation = getParam(params, PARAM_FUZZ_LOCATION, ""); int locationStart; int locationEnd; try { locationStart = Integer.parseInt(fuzzLocation.split(FUZZ_LOCATION_SEPARATOR)[0]); locationEnd = Integer.parseInt(fuzzLocation.split(FUZZ_LOCATION_SEPARATOR)[1]); } catch (IllegalArgumentException e) { LOGGER.error("Couldn't create integer start and end from: " + fuzzLocation, e); throw new ApiException(ApiException.Type.BAD_FORMAT, e); } if (locationStart > locationEnd) locationStart = locationEnd = 0; ArrayList<Integer> locations = new ArrayList<>(); locations.add(locationStart); locations.add(locationEnd); return locations; }

Target:
private Integer[] getMessageLocationFromParam(JSONObject params) throws ApiException { String fuzzLocation = getParam(params, PARAM_FUZZ_LOCATION, ""); int locationStart; int locationEnd; try { locationStart = Integer.parseInt(fuzzLocation.split(FUZZ_LOCATION_SEPARATOR)[0]); locationEnd = Integer.parseInt(fuzzLocation.split(FUZZ_LOCATION_SEPARATOR)[1]); } catch (IllegalArgumentException e) { LOGGER.error("Couldn't create integer start and end from: " + fuzzLocation, e); throw new ApiException(ApiException.Type.BAD_FORMAT, e); } if (locationStart > locationEnd) locationStart = locationEnd = 0; return (new Integer[] {locationStart, locationEnd}); }
Source:
static <T> Iterator<T> tabulate(int n, Function<? super Integer, ? extends T> f) { Objects.requireNonNull(f, "f is null"); return Collections.tabulate(n, f, Iterator.empty(), Iterator::of); }

Target:
static <T> Iterator<T> tabulate(int n, Function<? super Integer, ? extends T> f) { Objects.requireNonNull(f, "f is null"); return Collections.tabulate(n, f); }
Source:
public void create_multiple_domain_objects_fail_bad_domain_syntacs() { databaseHelper.addObject("" + "inet6num: 2a01:500::/21\n" + "mnt-by: TEST-MNT\n" + "mnt-domains: TEST-MNT\n" + "mnt-domains: XS4ALL-MNT\n" + "source: TEST"); final RpslObject domain = RpslObject.parse("" + "domain: bug!-4.0.1.0.a.2.ip6.arpa\n" + "descr: Reverse delegation for 2a01:500::/22\n" + "admin-c: JAAP-TEST\n" + "tech-c: JAAP-TEST\n" + "zone-c: JAAP-TEST\n" + "nserver: ns1.example.com\n" + "nserver: ns2.example.com\n" + "mnt-by: TEST-MNT\n" + "source: TEST"); try { RestTest.target(getPort(), "whois/domain-objects/TEST") .request() .cookie("crowd.token_key", "valid-token") .post(Entity.entity(mapRpslObjects(new RpslObject[]{domain}), MediaType.APPLICATION_JSON_TYPE), WhoisResources.class); } catch (BadRequestException e) { final WhoisResources response = e.getResponse().readEntity(WhoisResources.class); RestTest.assertErrorCount(response, 1); RestTest.assertErrorMessage(response, 0, "Error", "Syntax error in %s", "bug!-4.0.1.0.a.2.ip6.arpa"); } }

Target:
public void create_multiple_domain_objects_fail_bad_domain_syntacs() { databaseHelper.addObject("" + "inet6num: 2a01:500::/21\n" + "mnt-by: TEST-MNT\n" + "mnt-domains: TEST-MNT\n" + "mnt-domains: TEST2-MNT\n" + "source: TEST"); final RpslObject domain = RpslObject.parse("" + "domain: bug!-4.0.1.0.a.2.ip6.arpa\n" + "descr: Reverse delegation for 2a01:500::/22\n" + "admin-c: JAAP-TEST\n" + "tech-c: JAAP-TEST\n" + "zone-c: JAAP-TEST\n" + "nserver: ns1.example.com\n" + "nserver: ns2.example.com\n" + "mnt-by: TEST-MNT\n" + "source: TEST"); try { RestTest.target(getPort(), "whois/domain-objects/TEST") .request() .cookie("crowd.token_key", "valid-token") .post(Entity.entity(mapRpslObjects(new RpslObject[]{domain}), MediaType.APPLICATION_JSON_TYPE), WhoisResources.class); fail(); } catch (BadRequestException e) { final WhoisResources response = e.getResponse().readEntity(WhoisResources.class); RestTest.assertErrorCount(response, 1); RestTest.assertErrorMessage(response, 0, "Error", "Syntax error in %s", "bug!-4.0.1.0.a.2.ip6.arpa"); } }
Source:
public void testUniqueValue() { assertNull(new Alphametics("A == B").solve()); }

Target:
public void testUniqueValue() throws UnsolvablePuzzleException { expectedException.expect(UnsolvablePuzzleException.class); new Alphametics("A == B").solve(); }
Source:
private void runAnsibleRemovePlaybook() { AuditLogable logable = new AuditLogableImpl(); logable.setVdsName(getVds().getName()); logable.setVdsId(getVds().getId()); try { AnsibleCommandBuilder command = new AnsibleCommandBuilder() .hostnames(getVds().getHostName()) .playbook(AnsibleConstants.HOST_REMOVE_PLAYBOOK); auditLogDirector.log(logable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_STARTED); AnsibleReturnValue ansibleReturnValue = ansibleExecutor.runCommand(command); logable.addCustomValue("LogFile", command.logFile().getAbsolutePath()); if (ansibleReturnValue.getAnsibleReturnCode() != AnsibleReturnCode.OK) { auditLogDirector.log(logable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_FAILED); } else { auditLogDirector.log(logable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_FINISHED); } } catch (Exception e) { logable.addCustomValue("Message", e.getMessage()); auditLogDirector.log(logable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_EXECUTION_FAILED); } }

Target:
private void runAnsibleRemovePlaybook() { AuditLogable logable = new AuditLogableImpl(); logable.setVdsName(getVds().getName()); logable.setVdsId(getVds().getId()); logable.setCorrelationId(getCorrelationId()); try { AnsibleCommandBuilder command = new AnsibleCommandBuilder() .hostnames(getVds().getHostName()) .playbook(AnsibleConstants.HOST_REMOVE_PLAYBOOK); auditLogDirector.log(logable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_STARTED); AnsibleReturnValue ansibleReturnValue = ansibleExecutor.runCommand(command); logable.addCustomValue("LogFile", command.logFile().getAbsolutePath()); if (ansibleReturnValue.getAnsibleReturnCode() != AnsibleReturnCode.OK) { auditLogDirector.log(logable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_FAILED); } else { auditLogDirector.log(logable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_FINISHED); } } catch (Exception e) { logable.addCustomValue("Message", e.getMessage()); auditLogDirector.log(logable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_EXECUTION_FAILED); } }
Source:
void should_allow_extracting_values_using_multiple_lambda_extractors() { AbstractListAssert<?, ?, Object, ?> result = assertThat(luke).extracting(firstName, employee -> employee.getName().getLast()); result.hasSize(2) .containsExactly("Luke", "Skywalker"); }

Target:
void should_allow_extracting_values_using_multiple_lambda_extractors() { Function<Employee, Object> lastName = employee -> employee.getName().getLast(); AbstractListAssert<?, ?, Object, ?> result = assertThat(luke).extracting(firstName, lastName); result.hasSize(2) .containsExactly("Luke", "Skywalker"); }
Source:
SQLiteConnection createNewConnection() { try { SQLiteConnection conn; if (this.databaseFilePath != null) { conn = new SQLiteConnection(new File(this.databaseFilePath)); } else { conn = new SQLiteConnection(null); } conn.open(); conn.setBusyTimeout(30*1000); return conn; } catch (SQLiteException ex) { throw new IllegalStateException("Failed to open database.", ex); } }

Target:
SQLiteConnection createNewConnection() { try { SQLiteConnection conn; if (this.databaseFilePath != null) { conn = new SQLiteConnection(new File(this.databaseFilePath)); } else { conn = new SQLiteConnection(); } conn.open(); conn.setBusyTimeout(30*1000); return conn; } catch (SQLiteException ex) { throw new IllegalStateException("Failed to open database.", ex); } }
Source:
private static void addUsbSlots(VmBase vm, int numOfSlots) { for (int index = 1; index <= numOfSlots; index++) { VmDeviceUtils.addManagedDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.REDIR, VmDeviceType.SPICEVMC, getUsbSlotSpecParams(), true, false, ""); } }

Target:
private static void addUsbSlots(VmBase vm, int numOfSlots) { for (int index = 1; index <= numOfSlots; index++) { VmDeviceUtils.addManagedDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.REDIR, VmDeviceType.SPICEVMC, getUsbSlotSpecParams(), true, false); } }
Source:
public void batch_mutate(String kvsMethodName, Map<ByteBuffer, Map<String, List<Mutation>>> mutation_map, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { int numberOfMutations = mutation_map.size(); try (CloseableTrace trace = startLocalTrace("client.batch_mutate(number of mutations {}, consistency {})" + " on kvs.{}", numberOfMutations, consistency_level, kvsMethodName)) { KvsProfilingLogger.maybeLog( (KvsProfilingLogger.CallableCheckedException<Void, TException>) () -> { client.batch_mutate(mutation_map, consistency_level); return null; }, (logger, timer) -> logger.log("client.batch_mutate({}, {}) on kvs.{}", SafeArg.of("number of mutations", numberOfMutations), SafeArg.of("consistency", consistency_level.toString()), SafeArg.of("kvsMethodName", kvsMethodName))); } }

Target:
public void batch_mutate(String kvsMethodName, Map<ByteBuffer, Map<String, List<Mutation>>> mutation_map, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { int numberOfRowsMutated = mutation_map.size(); try (CloseableTrace trace = startLocalTrace("client.batch_mutate(number of rows mutated {}, consistency {})" + " on kvs.{}", numberOfRowsMutated, consistency_level, kvsMethodName)) { KvsProfilingLogger.maybeLog( (KvsProfilingLogger.CallableCheckedException<Void, TException>) () -> { client.batch_mutate(mutation_map, consistency_level); return null; }, (logger, timer) -> logger.log("client.batch_mutate({}, {}) on kvs.{}", SafeArg.of("number of mutations", numberOfRowsMutated), SafeArg.of("consistency", consistency_level.toString()), SafeArg.of("kvsMethodName", kvsMethodName))); } }
Source:
public String getPlural() { if (plural == null) { this.plural = getPlural(getClass()); } return plural; }

Target:
public String getPlural() { return plural; }
Source:
public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> descriptors= new ArrayList<IPropertyDescriptor>(); if (fSourceLookup.getCallsite() != null) { descriptors.add(new PropertyDescriptor(ID_FILE_NAME, NAME_FILE_NAME)); if (fSourceLookup.getCallsite().getFunctionName() != null) { descriptors.add(new PropertyDescriptor(ID_FUNCTION_NAME, NAME_FUNCTION_NAME)); } descriptors.add(new PropertyDescriptor(ID_LINE_NUMBER, NAME_LINE_NUMBER)); } return descriptors.toArray(new IPropertyDescriptor[0]); }

Target:
public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> descriptors= new ArrayList<IPropertyDescriptor>(); if (fSourceLookup.getCallsite() != null) { descriptors.add(new PropertyDescriptor(ID_FILE_NAME, NAME_FILE_NAME)); descriptors.add(new PropertyDescriptor(ID_LINE_NUMBER, NAME_LINE_NUMBER)); if (fSourceLookup.getCallsite().getFunctionName() != null) { descriptors.add(new PropertyDescriptor(ID_FUNCTION_NAME, NAME_FUNCTION_NAME)); } } return descriptors.toArray(new IPropertyDescriptor[0]); }
Source:
private void init() { Fabric.with(this, new Crashlytics()); LocationMemory.getInstance().init(getApplicationContext()); D2.init(this); SdkQueries.createDBIndexes(); if (PopulateDB.hasMandatoryTables()) { PostMigration.launchPostMigration(); } if (!BuildConfig.multiuser) { Log.i(TAG, "Pull on SplashScreen ..."); PullController pullController = new PullController( getApplication().getApplicationContext()); PullUseCase pullUseCase = new PullUseCase(pullController); PullFilters pullFilters = new PullFilters(); pullFilters.setDemo(true); pullUseCase.execute(pullFilters, new PullUseCase.Callback() { @Override public void onComplete() { Log.d(this.getClass().getSimpleName(), "pull complete"); } @Override public void onStep(PullStep step) { Log.d(this.getClass().getSimpleName(), step.toString()); } @Override public void onError(String message) { Log.e(this.getClass().getSimpleName(), message); } @Override public void onNetworkError() { Log.e(this.getClass().getSimpleName(), "Network Error"); } @Override public void onPullConversionError() { Log.e(this.getClass().getSimpleName(), "Pull Conversion Error"); } @Override public void onCancel() { Log.e(this.getClass().getSimpleName(), "Pull oncancel"); } }); } }

Target:
private void init() { Fabric.with(this, new Crashlytics()); LocationMemory.getInstance().init(getApplicationContext()); D2.init(this); SdkQueries.createDBIndexes(); PopulateDB.initDBQuery(); PostMigration.launchPostMigration(); if (!BuildConfig.multiuser) { Log.i(TAG, "Pull on SplashScreen ..."); PullController pullController = new PullController( getApplication().getApplicationContext()); PullUseCase pullUseCase = new PullUseCase(pullController); PullFilters pullFilters = new PullFilters(); pullFilters.setDemo(true); pullUseCase.execute(pullFilters, new PullUseCase.Callback() { @Override public void onComplete() { Log.d(this.getClass().getSimpleName(), "pull complete"); } @Override public void onStep(PullStep step) { Log.d(this.getClass().getSimpleName(), step.toString()); } @Override public void onError(String message) { Log.e(this.getClass().getSimpleName(), message); } @Override public void onNetworkError() { Log.e(this.getClass().getSimpleName(), "Network Error"); } @Override public void onPullConversionError() { Log.e(this.getClass().getSimpleName(), "Pull Conversion Error"); } @Override public void onCancel() { Log.e(this.getClass().getSimpleName(), "Pull oncancel"); } }); } }
Source:
public void setValue(PColumn column, byte[] byteValue) { deleteRow = null; byte[] family = column.getFamilyName().getBytes(); byte[] qualifier = column.getName().getBytes(); PDataType type = column.getDataType(); if (byteValue == null || byteValue.length == 0) { if (!column.isNullable()) { throw new ConstraintViolationException(name.getString() + "." + column.getName().getString() + " may not be null"); } removeIfPresent(setValues, family, qualifier); unsetValues.deleteColumns(family, qualifier, ts); } else { Integer byteSize; if (type.isArrayType()) { byteSize = byteValue.length; } else { byteSize = column.getByteSize(); } if (type.isFixedWidth() && byteValue.length <= byteSize) { byteValue = SchemaUtil.padChar(byteValue, byteSize); } else if (byteSize != null && byteValue.length > byteSize) { throw new ConstraintViolationException(name.getString() + "." + column.getName().getString() + " may not exceed " + byteSize + " bytes (" + type.toObject(byteValue) + ")"); } removeIfPresent(unsetValues, family, qualifier); setValues.add(family, qualifier, ts, byteValue); } }

Target:
public void setValue(PColumn column, byte[] byteValue) { deleteRow = null; byte[] family = column.getFamilyName().getBytes(); byte[] qualifier = column.getName().getBytes(); PDataType type = column.getDataType(); if (byteValue == null || byteValue.length == 0) { if (!column.isNullable()) { throw new ConstraintViolationException(name.getString() + "." + column.getName().getString() + " may not be null"); } removeIfPresent(setValues, family, qualifier); unsetValues.deleteColumns(family, qualifier, ts); } else { Integer byteSize = column.getByteSize(); if (byteSize != null && type.isFixedWidth() && byteValue.length <= byteSize) { byteValue = SchemaUtil.padChar(byteValue, byteSize); } else if (byteSize != null && byteValue.length > byteSize) { throw new ConstraintViolationException(name.getString() + "." + column.getName().getString() + " may not exceed " + byteSize + " bytes (" + type.toObject(byteValue) + ")"); } removeIfPresent(unsetValues, family, qualifier); setValues.add(family, qualifier, ts, byteValue); } }
Source:
public Response getBuildArchive(@PathParam("programId") String programId, @PathParam("buildId") final String buildId, @DefaultValue("UNKNOWN") @QueryParam("program") final String programName, @DefaultValue("UNKNOWN") @QueryParam("build") final String buildName) { final String fileName = programName + "_" + buildName; ContentDisposition contentDisposition = ContentDisposition.type("attachment").fileName(fileName + ".zip").creationDate(new Date()).build(); return Response.ok(new StreamingOutput() { @Override public void write(OutputStream output) throws IOException, WebApplicationException { ByteArrayOutputStream tableStream = new ByteArrayOutputStream(); final ZipOutputStream zout = new ZipOutputStream(output); final String serverData = OseeServerProperties.getOseeApplicationServerData(null); PcrIdCollector collector = new PcrIdCollector() { @Override public void onPcrId(String pcrId) { String pcrFileName = pcrId + ".xml"; File file = new File(serverData + CHANGE_REPORTS_PATH + pcrFileName); if (file.exists()) { try { zout.putNextEntry(new ZipEntry("changeReports/" + pcrFileName)); zout.write(Lib.fileToBytes(file)); zout.closeEntry(); } catch (IOException ex) { OseeExceptions.wrapAndThrow(ex); } } } }; createTraceReport(buildId, programName, buildName, AtsElementData.ARCHIVE_URL_TEMPLATE, collector, tableStream); zout.putNextEntry(new ZipEntry(fileName + ".html")); tableStream.writeTo(zout); zout.closeEntry(); zout.close(); } }).header("Content-Disposition", contentDisposition).build(); }

Target:
public Response getBuildArchive(@PathParam("programId") String programId, @PathParam("buildId") final String buildId, @DefaultValue("UNKNOWN") @QueryParam("program") final String programName, @DefaultValue("UNKNOWN") @QueryParam("build") final String buildName) { final String fileName = programName + "_" + buildName; ContentDisposition contentDisposition = ContentDisposition.type("attachment").fileName(fileName + ".zip").creationDate(new Date()).build(); return Response.ok(new StreamingOutput() { @Override public void write(OutputStream output) throws WebApplicationException { ByteArrayOutputStream tableStream = new ByteArrayOutputStream(); final ZipOutputStream zout = new ZipOutputStream(output); final String serverData = OseeServerProperties.getOseeApplicationServerData(null); Set<String> pcrIds = new HashSet<String>(); createTraceReport(buildId, programName, buildName, AtsElementData.ARCHIVE_URL_TEMPLATE, pcrIds, tableStream); try { zout.putNextEntry(new ZipEntry(fileName + ".html")); tableStream.writeTo(zout); zout.closeEntry(); for (String pcrId : pcrIds) { String pcrFileName = pcrId + ".xml"; File file = new File(serverData + CHANGE_REPORTS_PATH + pcrFileName); if (file.exists()) { FileInputStream fis = null; try { fis = new FileInputStream(file); zout.putNextEntry(new ZipEntry("changeReports/" + pcrFileName)); Lib.inputStreamToOutputStream(fis, zout); zout.closeEntry(); } catch (IOException ex) { OseeExceptions.wrapAndThrow(ex); } finally { Lib.close(fis); } } } } catch (IOException ex) { OseeExceptions.wrapAndThrow(ex); } finally { Lib.close(zout); } } }).header("Content-Disposition", contentDisposition).build(); }
Source:
private void manageIntent(Intent intent) { if (isTestRunning()) { Toast.makeText(this, getString(R.string.OONIRun_TestRunningError), Toast.LENGTH_LONG).show(); finish(); } else if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri uri = intent.getData(); String mv = uri == null ? null : uri.getQueryParameter("mv"); String tn = uri == null ? null : uri.getQueryParameter("tn"); String ta = uri == null ? null : uri.getQueryParameter("ta"); loadScreen(mv, tn, ta); } else { Bundle bundle = intent.getExtras(); String mv = bundle == null ? null : intent.getExtras().getString("mv"); String tn = bundle == null ? null : intent.getExtras().getString("tn"); String ta = bundle == null ? null : intent.getExtras().getString("ta"); loadScreen(mv, tn, ta); } }

Target:
private void manageIntent(Intent intent) { if (isTestRunning()) { Toast.makeText(this, getString(R.string.OONIRun_TestRunningError), Toast.LENGTH_LONG).show(); finish(); } else if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri uri = intent.getData(); String mv = uri == null ? null : uri.getQueryParameter("mv"); String tn = uri == null ? null : uri.getQueryParameter("tn"); String ta = uri == null ? null : uri.getQueryParameter("ta"); loadScreen(mv, tn, ta); } }
Source:
public void testReplyToConsumersReduced() throws Exception { CachingConnectionFactory cf = new CachingConnectionFactory("localhost"); DirectReplyToMessageListenerContainer container = new DirectReplyToMessageListenerContainer(cf); container.setBeanName("reducing"); container.setIdleEventInterval(100); container.afterPropertiesSet(); container.start(); ChannelHolder channelHolder1 = container.getChannelHolder(); ChannelHolder channelHolder2 = container.getChannelHolder(); assertTrue(activeConsumerCount(container, 2)); container.releaseConsumerFor(channelHolder2, false, null); Thread.sleep(500); assertTrue(channelHolder1.getChannel().isOpen()); container.releaseConsumerFor(channelHolder1, false, null); assertTrue(activeConsumerCount(container, 0)); container.stop(); cf.destroy(); }

Target:
public void testReplyToConsumersReduced() throws Exception { CachingConnectionFactory cf = new CachingConnectionFactory("localhost"); DirectReplyToMessageListenerContainer container = new DirectReplyToMessageListenerContainer(cf); container.setBeanName("reducing"); container.setIdleEventInterval(100); CountDownLatch latch = new CountDownLatch(5); container.setApplicationEventPublisher(e -> { if (e instanceof ListenerContainerIdleEvent) { latch.countDown(); } }); container.afterPropertiesSet(); container.start(); ChannelHolder channelHolder1 = container.getChannelHolder(); ChannelHolder channelHolder2 = container.getChannelHolder(); assertTrue(activeConsumerCount(container, 2)); container.releaseConsumerFor(channelHolder2, false, null); assertTrue(latch.await(10, TimeUnit.SECONDS)); assertTrue(channelHolder1.getChannel().isOpen()); container.releaseConsumerFor(channelHolder1, false, null); assertTrue(activeConsumerCount(container, 0)); container.stop(); cf.destroy(); }
Source:
public void testSerializeRequest(){ Map<String, ?> metadata = new HashMap<String, Object>() {{ this.put("firstKey", "firstValue"); this.put("secondKey", "secondValue"); }}; CommandMessage message = new GenericCommandMessage<>("payload", metadata); Command command = testSubject.serialize(message, "routingKey", 1); CommandMessage<?> deserialize = testSubject.deserialize(command); assertEquals(message.getIdentifier(), deserialize.getIdentifier()); assertEquals(message.getIdentifier(), deserialize.getIdentifier()); assertEquals(message.getCommandName(), deserialize.getCommandName()); assertEquals(message.getMetaData(), deserialize.getMetaData()); assertEquals(message.getPayloadType(), deserialize.getPayloadType()); assertEquals(message.getPayload(), deserialize.getPayload()); }

Target:
public void testSerializeRequest() { Map<String, ?> metadata = new HashMap<String, Object>() {{ this.put("firstKey", "firstValue"); this.put("secondKey", "secondValue"); }}; CommandMessage message = new GenericCommandMessage<>("payload", metadata); Command command = testSubject.serialize(message, "routingKey", 1); CommandMessage<?> deserialize = testSubject.deserialize(command); assertEquals(message.getIdentifier(), deserialize.getIdentifier()); assertEquals(message.getCommandName(), deserialize.getCommandName()); assertEquals(message.getMetaData(), deserialize.getMetaData()); assertEquals(message.getPayloadType(), deserialize.getPayloadType()); assertEquals(message.getPayload(), deserialize.getPayload()); }
Source:
private void endInput() { stats.setNumBytesRead(in.getCount()); in = null; }

Target:
private void endInput() { stats.setNumBytesRead(this.streamPosition()); in = null; }
Source:
protected void createSelection(Composite container) { Label lblSelect = new Label(container, SWT.NONE); lblSelect.setText("Select synoptics:"); List<String> columnNames = Arrays.asList("Name"); items = createTable(container, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI, columnNames); List<String> names = (List<String>) SynopticInfo.names(available); setItems(names); }

Target:
protected void createSelection(Composite container) { Label lblSelect = new Label(container, SWT.NONE); lblSelect.setText("Select synoptics:"); List<String> columnNames = Arrays.asList("Name"); items = createTable(container, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI, columnNames); List<String> names = SynopticInfo.names(available); setItems(names); }
Source:
public DataIndexer getDataIndexer(ObjectStream<Event> events) throws IOException { String dataIndexerName = trainingParameters.getStringParameter(DATA_INDEXER_PARAM, DATA_INDEXER_TWO_PASS_VALUE); trainingParameters.put(AbstractDataIndexer.SORT_PARAM, Boolean.toString(isSortAndMerge())); DataIndexer indexer; if (DATA_INDEXER_ONE_PASS_VALUE.equals(dataIndexerName)) { indexer = new OnePassDataIndexer(); } else if (DATA_INDEXER_TWO_PASS_VALUE.equals(dataIndexerName)) { indexer = new TwoPassDataIndexer(); } else { throw new IllegalStateException("Unexpected data indexer name: " + dataIndexerName); } indexer.init(trainingParameters); indexer.index(events); return indexer; }

Target:
public DataIndexer getDataIndexer(ObjectStream<Event> events) throws IOException { trainingParameters.put(AbstractDataIndexer.SORT_PARAM, Boolean.toString(isSortAndMerge())); if (trainingParameters.getIntParameter(CUTOFF_PARAM, -1) == -1) { trainingParameters.put(CUTOFF_PARAM, "5"); } DataIndexer indexer = DataIndexerFactory.getDataIndexer(trainingParameters, reportMap); indexer.index(events); return indexer; }
Source:
public final void installService(DeploymentPhaseContext ctx, String implementationClassName, T instance) { AbstractExtensionManagerService<T> service = createService(implementationClassName, instance); ServiceName extensionServiceName = ServiceName.JBOSS.append(service.getServiceTypeName(), implementationClassName.replaceAll("\\.", "_")); logger.info("Registering Deployed Cache Store service for store " + implementationClassName); ServiceBuilder<T> serviceBuilder = ctx.getServiceTarget().addService(extensionServiceName, service); serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE); serviceBuilder.addDependency(DeployedCacheStoreFactoryService.SERVICE_NAME, DeployedCacheStoreFactory.class, service.getDeployedCacheStoreFactory()); serviceBuilder.install(); }

Target:
public final void installService(DeploymentPhaseContext ctx, String implementationClassName, T instance) { AbstractExtensionManagerService<T> service = createService(implementationClassName, instance); ServiceName extensionServiceName = ServiceName.JBOSS.append(service.getServiceTypeName(), implementationClassName.replaceAll("\\.", "_")); InfinispanLogger.ROOT_LOGGER.installDeployedCacheStore(implementationClassName); ServiceBuilder<T> serviceBuilder = ctx.getServiceTarget().addService(extensionServiceName, service); serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE); serviceBuilder.addDependency(DeployedCacheStoreFactoryService.SERVICE_NAME, DeployedCacheStoreFactory.class, service.getDeployedCacheStoreFactory()); serviceBuilder.install(); }
Source:
public List<ComparablePair<Long,KeyExtent>> computeBusiest(Collection<Tablet> tablets) { HashMap<KeyExtent,Long> counts = new HashMap<>(); ArrayList<ComparablePair<Long,KeyExtent>> tabletsWithDelta = new ArrayList<>(); for (Tablet tablet : tablets) { KeyExtent extent = tablet.getExtent(); long count = extractCount(tablet); if (count == 0) continue; counts.put(extent, count); Long lastCount = lastCounts.get(extent); if (lastCount == null) lastCount = 0L; long delta = count - lastCount; if (delta <= 0) continue; tabletsWithDelta.add(new ComparablePair<>(delta, extent)); } lastCounts = counts; return Ordering.natural().greatestOf(tabletsWithDelta, numBusiestTabletsToLog); }

Target:
public List<ComparablePair<Long,KeyExtent>> computeBusiest(Collection<Tablet> tablets) { HashMap<KeyExtent,Long> counts = new HashMap<>(); ArrayList<ComparablePair<Long,KeyExtent>> tabletsWithDelta = new ArrayList<>(); for (Tablet tablet : tablets) { KeyExtent extent = tablet.getExtent(); long count = extractCount(tablet); if (count == 0) continue; counts.put(extent, count); Long lastCount = lastCounts.get(extent); if (lastCount == null) lastCount = 0L; long delta = count - lastCount; if (delta > 0) tabletsWithDelta.add(new ComparablePair<>(delta, extent)); } lastCounts = counts; return Ordering.natural().greatestOf(tabletsWithDelta, numBusiestTabletsToLog); }
Source:
public int prolepticYear(final Era era, final int yearOfEra) { if (!(era instanceof InternationalFixedEra)) { throw new ClassCastException("Invalid era: " + era); } if (0 > yearOfEra) { throw new DateTimeException("Invalid year of era: " + yearOfEra); } return yearOfEra; }

Target:
public int prolepticYear(final Era era, final int yearOfEra) { if (!(era instanceof InternationalFixedEra)) { throw new ClassCastException("Invalid era: " + era); } YEAR_RANGE.checkValidIntValue(yearOfEra, ChronoField.YEAR_OF_ERA); return yearOfEra; }
Source:
public void readFromNbt(NBTTagCompound compound) { if (this instanceof IMixinCustomDataHolder) { if (compound.hasKey(NbtDataUtil.CUSTOM_MANIPULATOR_TAG_LIST, NbtDataUtil.TAG_LIST)) { final NBTTagList list = compound.getTagList(NbtDataUtil.CUSTOM_MANIPULATOR_TAG_LIST, NbtDataUtil.TAG_COMPOUND); final ImmutableList.Builder<DataView> builder = ImmutableList.builder(); if (list != null && list.tagCount() != 0) { for (int i = 0; i < list.tagCount(); i++) { final NBTTagCompound internal = list.getCompoundTagAt(i); builder.add(NbtTranslator.getInstance().translateFrom(internal)); } } try { final List<DataManipulator<?, ?>> manipulators = DataUtil.deserializeManipulatorList(builder.build()); for (DataManipulator<?, ?> manipulator : manipulators) { offer(manipulator); } } catch (InvalidDataException e) { SpongeImpl.getLogger().error("Could not deserialize custom plugin data! ", e); } } } if (this instanceof IMixinGriefer && ((IMixinGriefer) this).isGriefer() && compound.hasKey("CanGrief")) { ((IMixinGriefer) this).setCanGrief(compound.getBoolean("CanGrief")); } }

Target:
public void readFromNbt(NBTTagCompound compound) { if (this instanceof IMixinCustomDataHolder) { if (compound.hasKey(NbtDataUtil.CUSTOM_MANIPULATOR_TAG_LIST, NbtDataUtil.TAG_LIST)) { final NBTTagList list = compound.getTagList(NbtDataUtil.CUSTOM_MANIPULATOR_TAG_LIST, NbtDataUtil.TAG_COMPOUND); final ImmutableList.Builder<DataView> builder = ImmutableList.builder(); if (list != null && list.tagCount() != 0) { for (int i = 0; i < list.tagCount(); i++) { final NBTTagCompound internal = list.getCompoundTagAt(i); builder.add(NbtTranslator.getInstance().translateFrom(internal)); } } try { final List<DataManipulator<?, ?>> manipulators = DataUtil.deserializeManipulatorList(builder.build()); for (DataManipulator<?, ?> manipulator : manipulators) { offer(manipulator); } } catch (InvalidDataException e) { SpongeImpl.getLogger().error("Could not deserialize custom plugin data! ", e); } } } }
Source:
private ImmutableHolidayCalendar(String name, SortedSet<LocalDate> holidays, Set<DayOfWeek> weekendDays) { ArgChecker.notNull(name, "name"); ArgChecker.notNull(holidays, "holidays"); ArgChecker.notNull(weekendDays, "weekendDays"); this.name = name; this.holidays = ImmutableSortedSet.copyOfSorted(holidays); this.weekendDays = Sets.immutableEnumSet(weekendDays); if (holidays.isEmpty()) { this.range = LocalDateRange.ALL; this.startYear = 0; this.lookup = new int[0]; } else { this.range = LocalDateRange.ofClosed( holidays.first().with(TemporalAdjusters.firstDayOfYear()), holidays.last().with(TemporalAdjusters.lastDayOfYear())); this.startYear = range.getStart().getYear(); int[] array = new int[(range.getEndExclusive().getYear() - startYear) * 12]; for (LocalDate date : holidays) { int index = (date.getYear() - startYear) * 12 + date.getMonthValue() - 1; array[index] |= (1 << (date.getDayOfMonth() - 1)); } LocalDate date = LocalDate.of(startYear, 1, 1); for (int i = 0; i < array.length; i++) { int monthLen = date.lengthOfMonth(); for (int j = 0; j < monthLen; j++) { if (weekendDays.contains(date.getDayOfWeek())) { array[i] |= (1 << j); } date = date.plusDays(1); } for (int j = monthLen; j < 32; j++) { array[i] |= (1 << j); } } this.lookup = array; } }

Target:
private ImmutableHolidayCalendar(String name, SortedSet<LocalDate> holidays, Set<DayOfWeek> weekendDays) { ArgChecker.notNull(name, "name"); ArgChecker.notNull(holidays, "holidays"); ArgChecker.notNull(weekendDays, "weekendDays"); this.name = name; this.holidays = ImmutableSortedSet.copyOfSorted(holidays); this.weekendDays = Sets.immutableEnumSet(weekendDays); if (holidays.isEmpty()) { this.range = LocalDateRange.ALL; this.startYear = 0; this.lookup = new int[0]; } else { this.range = LocalDateRange.ofClosed( holidays.first().with(TemporalAdjusters.firstDayOfYear()), holidays.last().with(TemporalAdjusters.lastDayOfYear())); this.startYear = range.getStart().getYear(); int endYearExclusive = range.getEndExclusive().getYear(); this.lookup = buildLookupArray(holidays, weekendDays, startYear, endYearExclusive); } }
Source:
private void startProcessesCleaner() { Scheduler.get() .scheduleFixedDelay( () -> { for (Iterator<Map.Entry<String, Pair<ProgressReportDto, Long>>> it = progresses.entrySet().iterator(); it.hasNext(); ) { Map.Entry<String, Pair<ProgressReportDto, Long>> entry = it.next(); long lastUpdate = entry.getValue().getSecond(); ProgressReportDto progress = entry.getValue().getFirst(); if ((currentTimeMillis() - lastUpdate) > DELAY_MS) { it.remove(); progressResolver.removeProgress(progress); String currentTaskId = currentProgress.getId(); String taskId = progress.getId(); if (currentTaskId.equals(taskId)) { updateCurrentTask(); } } } return !progresses.isEmpty(); }, DELAY_MS); }

Target:
private void startProcessesCleaner() { Scheduler.get() .scheduleFixedDelay( () -> { for (Iterator<Map.Entry<String, Pair<ProgressReportDto, Long>>> it = progresses.entrySet().iterator(); it.hasNext(); ) { Map.Entry<String, Pair<ProgressReportDto, Long>> entry = it.next(); long lastUpdate = entry.getValue().getSecond(); ProgressReportDto progress = entry.getValue().getFirst(); if ((currentTimeMillis() - lastUpdate) > DELAY_MS) { it.remove(); backgroundLoader.removeProgress(progress); String currentTaskId = currentProgress.getId(); String taskId = progress.getId(); if (currentTaskId.equals(taskId)) { updateCurrentProgress(); } } } return !progresses.isEmpty(); }, DELAY_MS); }
Source:
public void doMovesRightTest() { Point q = new Point(-3.0, -3.0); Enemy enemy = new Enemy(q, null); units.add(enemy); simpleLevel = new Level(players, units, emptyGrid); simpleArtificialIntelligence = new ArtificialIntelligence(simpleLevel); simpleArtificialIntelligence.aiMover(); simpleLevel.tick(); assertTrue(enemy.getLocation().getX() > q.getX()); }

Target:
public void doMovesRightTest() { point = new Point(-3.0, -3.0); Enemy enemy = new Enemy(point, null); units.add(enemy); simpleLevel = new Level(players, units, emptyGrid); simpleArtificialIntelligence = new ArtificialIntelligence(simpleLevel); simpleArtificialIntelligence.aiMover(); simpleLevel.tick(); assertTrue(enemy.getLocation().getX() > point.getX()); }
Source:
static List<TooSlowLog.SlowLogPayload> getFilteredLogs( AdminProtos.SlowLogResponseRequest request, List<TooSlowLog.SlowLogPayload> logPayloadList) { if (isFilterProvided(request)) { logPayloadList = filterLogs(request, logPayloadList); } int limit = Math.min(request.getLimit(), logPayloadList.size()); return logPayloadList.subList(0, limit); }

Target:
static List<TooSlowLog.SlowLogPayload> getFilteredLogs( AdminProtos.SlowLogResponseRequest request, List<TooSlowLog.SlowLogPayload> logPayloadList) { int totalFilters = getTotalFiltersCount(request); if (totalFilters > 0) { logPayloadList = filterLogs(request, logPayloadList, totalFilters); } int limit = Math.min(request.getLimit(), logPayloadList.size()); return logPayloadList.subList(0, limit); }