auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static Map<Integer, Collection<JsonArrayEntry>> groupJsonEntryByInstanceId( Collection<JsonArrayEntry> jsonEntries, LwM2mPath baseName) throws InvalidValueException { Map<Integer, Collection<JsonArrayEntry>> result = new HashMap<>(); for (JsonArrayEntry e : jsonEntries) { LwM2mPath nodePath = baseName.append(e.getName()); if (!nodePath.isResourceInstance() && !nodePath.isResource()) { throw new InvalidValueException( "Invalid path for resource, it should be a resource or a resource instance path", nodePath); } Collection<JsonArrayEntry> jsonArray = result.get(nodePath.getObjectInstanceId()); if (jsonArray == null) { jsonArray = new ArrayList<JsonArrayEntry>(); result.put(nodePath.getObjectInstanceId(), jsonArray); } jsonArray.add(e); } return result; }

Target:
private static Map<Integer, Collection<JsonArrayEntry>> groupJsonEntryByInstanceId( Collection<JsonArrayEntry> jsonEntries, LwM2mPath baseName) throws InvalidValueException { Map<Integer, Collection<JsonArrayEntry>> result = new HashMap<>(); for (JsonArrayEntry e : jsonEntries) { LwM2mPath nodePath = baseName.append(e.getName()); if (!nodePath.isResourceInstance() && !nodePath.isResource()) { throw new InvalidValueException( "Invalid path for resource, it should be a resource or a resource instance path", nodePath); } Collection<JsonArrayEntry> jsonArray = result.get(nodePath.getObjectInstanceId()); if (jsonArray == null) { jsonArray = new ArrayList<>(); result.put(nodePath.getObjectInstanceId(), jsonArray); } jsonArray.add(e); } return result; }
Source:
public void testFirstDataMapper() { final StudentDataMapper mapper = new StudentDataMapperImpl(); Student student = new Student(1, "Adam", 'A'); mapper.insert(student); assertEquals(student.getStudentId(), mapper.find(student.getStudentId()).get().getStudentId()); student = new Student(student.getStudentId(), "AdamUpdated", 'A'); mapper.update(student); assertEquals("AdamUpdated", mapper.find(student.getStudentId()).get().getName()); mapper.delete(student); assertFalse(mapper.find(student.getStudentId()).isPresent()); }

Target:
public void testFirstDataMapper() { final StudentDataMapper mapper = new StudentDataMapperImpl(); int studentId = 1; Student student = new Student(studentId, "Adam", 'A'); mapper.insert(student); assertEquals(studentId, mapper.find(student.getStudentId()).get().getStudentId()); String updatedName = "AdamUpdated"; student = new Student(student.getStudentId(), updatedName, 'A'); mapper.update(student); assertEquals(updatedName, mapper.find(student.getStudentId()).get().getName()); mapper.delete(student); assertFalse(mapper.find(student.getStudentId()).isPresent()); }
Source:
protected static TrustManagerFactory buildTrustManagerFactory( File certChainFile, TrustManagerFactory trustManagerFactory, String keyType) throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException { X509Certificate[] x509Certs = toX509Certificates(certChainFile); return buildTrustManagerFactory(x509Certs, trustManagerFactory, keyType); }

Target:
static TrustManagerFactory buildTrustManagerFactory( File certChainFile, TrustManagerFactory trustManagerFactory, String keyType) throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException { X509Certificate[] x509Certs = toX509Certificates(certChainFile); return buildTrustManagerFactory(x509Certs, trustManagerFactory, keyType); }
Source:
public synchronized void addLocation(URI location, TaskId remoteSourceTaskId) { requireNonNull(location, "location is null"); if (closed.get()) { return; } if (allClients.containsKey(location)) { return; } checkState(!noMoreLocations, "No more locations already set"); HttpPageBufferClient client = new HttpPageBufferClient( httpClient, maxResponseSize, maxErrorDuration, acknowledgePages, location, new ExchangeClientCallback(), scheduler, pageBufferClientCallbackExecutor); allClients.put(location, client); checkState(taskIdToURI.put(remoteSourceTaskId, location) == null, "Duplicate remoteSourceTaskId: " + remoteSourceTaskId); queuedClients.add(client); scheduleRequestIfNecessary(); }

Target:
public synchronized void addLocation(URI location, TaskId remoteSourceTaskId) { requireNonNull(location, "location is null"); if (closed.get()) { return; } if (allClients.containsKey(location)) { return; } if (removedRemoteSourceTaskIds.contains(remoteSourceTaskId)) { return; } checkState(!noMoreLocations, "No more locations already set"); HttpPageBufferClient client = new HttpPageBufferClient( httpClient, maxResponseSize, maxErrorDuration, acknowledgePages, location, new ExchangeClientCallback(), scheduler, pageBufferClientCallbackExecutor); allClients.put(location, client); checkState(taskIdToLocationMap.put(remoteSourceTaskId, location) == null, "Duplicate remoteSourceTaskId: " + remoteSourceTaskId); queuedClients.add(client); scheduleRequestIfNecessary(); }
Source:
void initialize(PlatformManager platformManager, Platform platform) { BlockRegistry blockRegistry = platform.getRegistries().getBlockRegistry(); for (BlockType type : BlockType.REGISTRY) { for (BlockState state : type.getAllStates()) { BlockStateIdAccess.register(state, blockRegistry.getInternalBlockStateId(state) .orElse(BlockStateIdAccess.invalidId())); } } }

Target:
void initialize(PlatformManager platformManager, Platform platform) { platform.registerGameHooks(); }
Source:
public InstructorAttributes updateInstructorByEmail(InstructorAttributes.UpdateOptionsWithEmail updateOptions) throws InvalidParametersException, EntityDoesNotExistException { Assumption.assertNotNull("Supplied parameter was null", updateOptions); InstructorAttributes originalInstructor = instructorsDb.getInstructorForEmail(updateOptions.getCourseId(), updateOptions.getEmail()); InstructorAttributes updatedInstructor = instructorsDb.updateInstructorByEmail(updateOptions); boolean isOriginalInstructorDisplayed = originalInstructor.isDisplayedToStudents(); verifyAtLeastOneInstructorIsDisplayed(originalInstructor.courseId, isOriginalInstructorDisplayed, updatedInstructor.isDisplayedToStudents()); return instructorsDb.updateInstructorByEmail(updateOptions); }

Target:
public InstructorAttributes updateInstructorByEmail(InstructorAttributes.UpdateOptionsWithEmail updateOptions) throws InvalidParametersException, EntityDoesNotExistException { Assumption.assertNotNull("Supplied parameter was null", updateOptions); InstructorAttributes originalInstructor = instructorsDb.getInstructorForEmail(updateOptions.getCourseId(), updateOptions.getEmail()); if (originalInstructor == null) { throw new EntityDoesNotExistException("Trying to update non-existent Entity: " + updateOptions); } InstructorAttributes newInstructor = originalInstructor.getCopy(); newInstructor.update(updateOptions); boolean isOriginalInstructorDisplayed = originalInstructor.isDisplayedToStudents(); verifyAtLeastOneInstructorIsDisplayed(originalInstructor.courseId, isOriginalInstructorDisplayed, newInstructor.isDisplayedToStudents()); return instructorsDb.updateInstructorByEmail(updateOptions); }
Source:
public static SQLException getJdbcSQLException(int errorCode) { return getJdbcSQLException(errorCode, null); }

Target:
public static SQLException getJdbcSQLException(int errorCode) { return getJdbcSQLException(errorCode, (Throwable)null); }
Source:
static BasicLocationDefinition localhost(String id) { return new BasicLocationDefinition(id, "localhost", "localhost", null); }

Target:
protected static BasicLocationDefinition localhost(String id) { return new BasicLocationDefinition(id, "localhost", "localhost", null); }
Source:
public void testToBuilder() { CloudBigtableConfiguration underTest = new CloudBigtableConfiguration(PROJECT, ZONE, CLUSTER, Collections.singletonMap("somekey", "somevalue")); CloudBigtableConfiguration copy = underTest.toBuilder().build(); Assert.assertTrue(underTest != copy); Assert.assertEquals(underTest, copy); }

Target:
public void testToBuilder() { CloudBigtableConfiguration underTest = new CloudBigtableConfiguration(PROJECT, ZONE, CLUSTER, Collections.singletonMap("somekey", "somevalue")); CloudBigtableConfiguration copy = underTest.toBuilder().build(); Assert.assertNotSame(underTest, copy); Assert.assertEquals(underTest, copy); }
Source:
public void should_call_all_listeners_on_verify() { RememberingListener listener1 = new RememberingListener(); RememberingListener listener2 = new RememberingListener(); MockingProgress mockingProgress = ThreadSafeMockingProgress.mockingProgress(); mockingProgress.addListener(listener1); mockingProgress.addListener(listener2); Foo foo = mock(Foo.class); VerificationMode never = never(); verify(foo, never).doSomething(""); assertThatHasBeenNotified(listener1, foo, never, invocationWanted); assertThatHasBeenNotified(listener2, foo, never, invocationWanted); }

Target:
public void should_call_all_listeners_on_verify() { RememberingListener listener2 = new RememberingListener(); mockitoFramework.addListener(listener2); Foo foo = mock(Foo.class); VerificationMode never = never(); verify(foo, never).doSomething(""); assertThat(listener).is(notifiedFor(foo, never, invocationWanted)); assertThat(listener2).is(notifiedFor(foo, never, invocationWanted)); }
Source:
public Box get(long boxId) throws IOException { Box o = boxStore.get(boxId); if (authorizationManager.readCheck(o)) return o; else throw new IOException("User " + authorizationManager.getCurrentUser().getFullName() + " cannot read Box " + boxId); }

Target:
public Box get(long boxId) throws IOException { Box o = boxStore.get(boxId); authorizationManager.throwIfNotReadable(o); return o; }
Source:
private static double pvbpPayment(PricingEnvironment env, RatePaymentPeriod paymentPeriod) { double df = env.discountFactor(paymentPeriod.getCurrency(), paymentPeriod.getPaymentDate()); ArgChecker.isTrue(!paymentPeriod.getFxReset().isPresent()); double notional = paymentPeriod.getNotional(); ArgChecker.isTrue(paymentPeriod.getAccrualPeriods().size() == 1); RateAccrualPeriod accrualPeriod = paymentPeriod.getAccrualPeriods().get(0); ArgChecker.isTrue(accrualPeriod.getRateObservation() instanceof FixedRateObservation); return df * accrualPeriod.getYearFraction() * notional; }

Target:
private static double pvbpPayment(PricingEnvironment env, RatePaymentPeriod paymentPeriod) { ArgChecker.isTrue(!paymentPeriod.getFxReset().isPresent()); ArgChecker.isTrue(paymentPeriod.getAccrualPeriods().size() == 1); RateAccrualPeriod accrualPeriod = paymentPeriod.getAccrualPeriods().get(0); ArgChecker.isTrue(accrualPeriod.getRateObservation() instanceof FixedRateObservation); double df = env.discountFactor(paymentPeriod.getCurrency(), paymentPeriod.getPaymentDate()); double notional = paymentPeriod.getNotional(); return df * accrualPeriod.getYearFraction() * notional; }
Source:
public DataBundle generateJsonData() { DataBundle dataBundle = new DataBundle(); dataBundle.accounts = generateAccounts(); dataBundle.courses = generateCourses(); dataBundle.instructors = generateInstructors(); dataBundle.students = generateStudents(); dataBundle.feedbackQuestions = generateFeedbackQuestions(); dataBundle.feedbackSessions = generateFeedbackSessions(); dataBundle.feedbackResponses = generateFeedbackResponses(); dataBundle.feedbackResponseComments = generateFeedbackResponseComments(); dataBundle.profiles = generateProfiles(); return dataBundle; }

Target:
public DataBundle generateJsonData() { DataBundle dataBundle = new DataBundle(); dataBundle.accounts = generateAccounts(); dataBundle.courses = generateCourses(); dataBundle.instructors = generateInstructors(); dataBundle.students = generateStudents(); dataBundle.feedbackSessions = generateFeedbackSessions(); dataBundle.feedbackQuestions = generateFeedbackQuestions(); dataBundle.feedbackResponses = generateFeedbackResponses(); dataBundle.feedbackResponseComments = generateFeedbackResponseComments(); dataBundle.profiles = generateProfiles(); return dataBundle; }
Source:
public void processTimer(ComputationContext context, String key, long timestamp) { refreshMetricsIfNeeded(); log.debug("start update metrics: " + metrics.size()); List<LatencyMetric> toRemove = metrics.stream() .filter(metric -> metric.update(getManager(), codec)) .collect(Collectors.toList()); toRemove.forEach(LatencyMetric::destroy); toRemove.forEach(metric -> invalidStreams.add(metric.getStream())); metrics.removeAll(toRemove); context.setTimer("tracker", System.currentTimeMillis() + intervalMs); }

Target:
public void processTimer(ComputationContext context, String key, long timestamp) { refreshMetricsIfNeeded(); log.debug("start update metrics: {}", metrics::size); List<LatencyMetric> toRemove = metrics.stream() .filter(metric -> metric.update(getManager(), codec)) .collect(Collectors.toList()); toRemove.forEach(LatencyMetric::destroy); toRemove.forEach(metric -> invalidStreams.add(metric.getStream())); metrics.removeAll(toRemove); context.setTimer("tracker", System.currentTimeMillis() + intervalMs); }
Source:
default void bindEntityClass(Class<?> entityClass, EntityDictionary dictionary) { try { dictionary.lookupEntityClass(entityClass); } catch (IllegalArgumentException e) { return; } dictionary.bindEntity(entityClass); dictionary.getAttributes(entityClass) .stream() .forEach((attribute) -> { JPQLFilterFragment annotation = dictionary.getAttributeOrRelationAnnotation(entityClass, JPQLFilterFragment.class, attribute); if (annotation != null) { try { FilterTranslator.registerJPQLGenerator(annotation.operator(), entityClass, attribute, annotation.generator().newInstance()); } catch (InstantiationException | IllegalAccessException e) { throw new IllegalStateException(e); } } }); }

Target:
default void bindEntityClass(Class<?> entityClass, EntityDictionary dictionary) { try { dictionary.lookupEntityClass(entityClass); } catch (IllegalArgumentException e) { return; } dictionary.bindEntity(entityClass); dictionary.getAttributes(entityClass) .stream() .forEach((attribute) -> { JPQLFilterFragment annotation = dictionary.getAttributeOrRelationAnnotation(entityClass, JPQLFilterFragment.class, attribute); if (annotation != null) { try { FilterTranslator.registerJPQLGenerator(annotation.operator(), entityClass, attribute, annotation.generator().newInstance()); } catch (InstantiationException | IllegalAccessException e) { LOGGER.error("Unable to instantiate the JPQL fragment generator: {}", e.getMessage()); throw new IllegalStateException(e); } } }); }
Source:
public final int compareTo(final Object other) { final Cookie o = (Cookie) other; int retVal = 0; if (getName() == null && o.getName() != null) return -1; if (getName() != null && o.getName() == null) return 1; retVal = (getName() == null && o.getName() == null) ? 0 : getName().compareTo(o.getName()); if (retVal != 0) return retVal; if (getPath() == null && o.getPath() != null) return -1; if (getPath() != null && o.getPath() == null) return 1; retVal = (getPath() == null && o.getPath() == null) ? 0 : getPath().compareTo(o.getPath()); if (retVal != 0) return retVal; if (getDomain() == null && o.getDomain() != null) return -1; if (getDomain() != null && o.getDomain() == null) return 1; retVal = (getDomain() == null && o.getDomain() == null) ? 0 : getDomain().compareTo(o.getDomain()); if (retVal != 0) return retVal; return 0; }

Target:
public final int compareTo(final Object other) { return Cookie.super.compareTo(other); }
Source:
public void recordEventAsync(StramEvent ev) { if (apexPluginManager != null) { apexPluginManager.dispatch(STRAM_EVENT, ev); } if (eventBus != null) { eventBus.publishAsync(ev); } }

Target:
public void recordEventAsync(StramEvent ev) { apexPluginDispatcher.dispatch(STRAM_EVENT, ev); if (eventBus != null) { eventBus.publishAsync(ev); } }
Source:
public void testBindingCteAssociationToEntity() { transactional(new TxVoidWork() { @Override public void work(EntityManager em) { CriteriaBuilder<MyEntity> select = cbf.create(em, MyEntity.class) .withRecursive(Cte.class) .from(MyEntity.class, "a") .bind("myEntity").select("a") .bind("id").select("1") .unionAll() .from(MyEntity.class, "a") .where("a.attribute").eq("bogus") .bind("myEntity").select("a") .bind("id").select("1") .end() .from(Cte.class) .select("myEntity"); List<MyEntity> resultList = select .getResultList(); String sql = ((CustomSQLTypedQuery) select.getQuery()).getQuerySpecification().getSql(); String cteBase = sql.substring(sql.indexOf("\nselect") + 1, sql.lastIndexOf("UNION ALL") - 1); String cteRecursivePart = sql.substring(sql.indexOf("UNION ALL")+10, sql.lastIndexOf("select")-3); String queryPart = sql.substring(sql.lastIndexOf("select")); assertEquals("Recursive base part should project 2 columns separated by a single comma", cteBase.indexOf(","), cteBase.lastIndexOf(",")); assertEquals("Recursive part should project 2 columns separated by a single comma", cteRecursivePart.indexOf(","), cteRecursivePart.lastIndexOf(",")); assertEquals("Final query should project 2 columns separated by a single comma", queryPart.indexOf(","), queryPart.lastIndexOf(",")); } }); }

Target:
public void testBindingCteAssociationToEntity() { transactional(new TxVoidWork() { @Override public void work(EntityManager em) { CriteriaBuilder<MyEntity> select = cbf.create(em, MyEntity.class) .withRecursive(Cte.class) .from(MyEntity.class, "a") .bind("myEntity").select("a") .bind("id").select("1") .unionAll() .from(MyEntity.class, "a") .where("a.attribute").eq("bogus") .bind("myEntity").select("a") .bind("id").select("1") .end() .from(Cte.class) .select("myEntity"); select.getResultList(); String sql = ((CustomSQLTypedQuery) select.getQuery()).getQuerySpecification().getSql(); String cteBase = sql.substring(sql.indexOf("\nselect") + 1, sql.lastIndexOf("UNION ALL") - 1); String cteRecursivePart = sql.substring(sql.indexOf("UNION ALL")+10, sql.lastIndexOf("select")-3); String queryPart = sql.substring(sql.lastIndexOf("select")); assertEquals("Recursive base part should project 2 columns separated by a single comma", cteBase.indexOf(","), cteBase.lastIndexOf(",")); assertEquals("Recursive part should project 2 columns separated by a single comma", cteRecursivePart.indexOf(","), cteRecursivePart.lastIndexOf(",")); assertEquals("Final query should project 2 columns separated by a single comma", queryPart.indexOf(","), queryPart.lastIndexOf(",")); } }); }
Source:
public ResponseEntity<CustomPageImpl<UserLicensesDTO>> getLicenses( @ModelAttribute PageDTO pageDTO, @RequestParam(name = "queryUser", defaultValue = "") String query, @RequestParam(name = "pendingOnly", defaultValue = "false") Boolean pendingOnly) { PageRequest pageRequest = new PageRequest(pageDTO.getPage() - 1, pageDTO.getPageSize()); final Page<AthenaUser> users = userService.getUsersWithLicenses(pageRequest, query, pendingOnly); List<UserLicensesDTO> dtos = converterUtils.convertList(users.getContent(), UserLicensesDTO.class); CustomPageImpl<UserLicensesDTO> resultPage = new CustomPageImpl<>(dtos, pageRequest, users.getTotalElements()); return ResponseEntity.ok(resultPage); }

Target:
public Page<UserLicensesDTO> getLicenses( @ModelAttribute PageDTO pageDTO, @RequestParam(name = "queryUser", defaultValue = "") String query, @RequestParam(name = "pendingOnly", defaultValue = "false") Boolean pendingOnly) { PageRequest pageRequest = new PageRequest(pageDTO.getPage() - 1, pageDTO.getPageSize()); final Page<AthenaUser> users = userService.getUsersWithLicenses(pageRequest, query, pendingOnly); List<UserLicensesDTO> dtos = converterUtils.convertList(users.getContent(), UserLicensesDTO.class); return new CustomPageImpl(dtos, pageRequest, users.getTotalElements()); }
Source:
protected boolean isVersion21OrHigher() { String version = null; if (getTargetObject() != null) { URI uri = getTargetObject().eResource().getURI(); IFile tempFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true))); IProject project = tempFile.getProject(); version = SwitchYardModelUtils.getSwitchYardProjectRuntimeVersion(project); } if (version != null && (version.startsWith("2.0") || version.startsWith("1"))) { return false; } return true; }

Target:
protected boolean isVersion21OrHigher() { String version = null; if (getTargetObject() != null) { URI uri = getTargetObject().eResource().getURI(); IFile tempFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true))); if (tempFile != null) { IProject project = tempFile.getProject(); version = SwitchYardModelUtils.getSwitchYardProjectRuntimeVersion(project); } } if (version != null && (version.startsWith("2.0") || version.startsWith("1"))) { return false; } return true; }
Source:
public String getSqlOrder() { return "SELECT ST_Transform(the_geom, targetCRSCode [or 'EPSG:4326']) from myTable"; }

Target:
public String getSqlOrder() { return "SELECT ST_Transform(the_geom, targetCRSCode | 'EPSG:4326') from myTable"; }
Source:
public void shouldSetJettyBaseToValueOfJettyHome() { when(systemEnvironment.getPropertyImpl("jetty.home")).thenReturn("foo"); JettyWorkDirValidator jettyWorkDirValidator = new JettyWorkDirValidator(systemEnvironment); Validation val = new Validation(); jettyWorkDirValidator.validate(val); assertThat(val.isSuccessful(), is(true)); verify(systemEnvironment).setProperty("jetty.base", "foo"); }

Target:
public void shouldSetJettyBaseToValueOfJettyHome() { when(systemEnvironment.getPropertyImpl("jetty.home")).thenReturn("foo"); Validation val = new Validation(); jettyWorkDirValidator.validate(val); assertThat(val.isSuccessful(), is(true)); verify(systemEnvironment).setProperty("jetty.base", "foo"); }
Source:
public void doSetup() throws Exception { final byte[] password = "password".getBytes("UTF-8"); crc32 = DigestManager.instantiate(ThreadLocalRandom.current().nextLong(0, Long.MAX_VALUE), password, DigestType.CRC32); crc32c = DigestManager.instantiate(ThreadLocalRandom.current().nextLong(0, Long.MAX_VALUE), password, DigestType.CRC32C); mac = DigestManager.instantiate(ThreadLocalRandom.current().nextLong(0, Long.MAX_VALUE), password, DigestType.MAC); digestBuf = Unpooled.buffer(getDigestManager(digest).getMacCodeLength()); final int entrySizeKb = 64; arrayBackedBuffer = Unpooled.wrappedBuffer(randomBytes(entrySizeKb * 1024)); final int headerSize = 32 + getDigestManager(digest).getMacCodeLength(); notArrayBackedBuffer = DoubleByteBuf.get(Unpooled.wrappedBuffer(randomBytes(headerSize)), Unpooled.wrappedBuffer((randomBytes(entrySizeKb * 1024 - headerSize)))); byteBufDefaultAlloc = ByteBufAllocator.DEFAULT.buffer(entrySizeKb * 1024, entrySizeKb * 1024); byteBufDefaultAlloc.writeBytes(randomBytes(entrySizeKb * 1024)); if (!arrayBackedBuffer.hasArray() || notArrayBackedBuffer.hasArray()) { throw new IllegalStateException("buffers in invalid state"); } }

Target:
public void doSetup() throws Exception { final byte[] password = "password".getBytes("UTF-8"); crc32 = DigestManager.instantiate(ThreadLocalRandom.current().nextLong(0, Long.MAX_VALUE), password, DigestType.CRC32); crc32c = DigestManager.instantiate(ThreadLocalRandom.current().nextLong(0, Long.MAX_VALUE), password, DigestType.CRC32C); mac = DigestManager.instantiate(ThreadLocalRandom.current().nextLong(0, Long.MAX_VALUE), password, DigestType.MAC); digestBuf = Unpooled.buffer(getDigestManager(digest).getMacCodeLength()); arrayBackedBuffer = Unpooled.wrappedBuffer(randomBytes(entrySize)); final int headerSize = 32 + getDigestManager(digest).getMacCodeLength(); notArrayBackedBuffer = DoubleByteBuf.get(Unpooled.wrappedBuffer(randomBytes(headerSize)), Unpooled.wrappedBuffer((randomBytes(entrySize - headerSize)))); byteBufDefaultAlloc = ByteBufAllocator.DEFAULT.buffer(entrySize, entrySize); byteBufDefaultAlloc.writeBytes(randomBytes(entrySize)); if (!arrayBackedBuffer.hasArray() || notArrayBackedBuffer.hasArray()) { throw new IllegalStateException("buffers in invalid state"); } }
Source:
public static void check( LogTailScanner tailScanner, Config config ) throws UpgradeNotAllowedByConfigurationException { if ( !config.get( GraphDatabaseSettings.allow_upgrade ) ) { LogEntryVersion latestLogEntryVersion = tailScanner.getTailInformation().latestLogEntryVersion; if ( latestLogEntryVersion != null && LogEntryVersion.moreRecentVersionExists( latestLogEntryVersion ) ) { String message = "The version your upgrading to is using a new transaction log format. This is a " + "non-reversible upgrade and you wont be able to downgrade after starting"; throw new UpgradeNotAllowedByConfigurationException( message ); } } }

Target:
public static void check( LogTailScanner tailScanner, Config config ) throws UpgradeNotAllowedByConfigurationException { if ( !config.get( GraphDatabaseSettings.allow_upgrade ) ) { LogEntryVersion latestLogEntryVersion = tailScanner.getTailInformation().latestLogEntryVersion; if ( latestLogEntryVersion != null && LogEntryVersion.moreRecentVersionExists( latestLogEntryVersion ) ) { String message = "The version you're upgrading to is using a new transaction log format. This is a " + "non-reversible upgrade and you wont be able to downgrade after starting"; throw new UpgradeNotAllowedByConfigurationException( message ); } } }
Source:
public void execute() throws ServerApiException { try { LinkDomainToLdapResponse response = _ldapManager.linkDomainToLdap(domainId, type, name, accountType); if(admin!=null) { try { LdapUser ldapUser = _ldapManager.getUser(admin, type, name); if(!ldapUser.isDisabled()) { Account account = _accountService.getActiveAccountByName(admin, domainId); if (account == null) { UserAccount userAccount = _accountService.createUserAccount(admin, "", ldapUser.getFirstname(), ldapUser.getLastname(), ldapUser.getEmail(), null, admin, Account.ACCOUNT_TYPE_DOMAIN_ADMIN, domainId, admin, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP); response.setAdminId(String.valueOf(userAccount.getAccountId())); s_logger.info("created an account with name " + admin + " in the given domain " + domainId); } else { s_logger.debug("an account with name " + admin + " already exists in the domain " + domainId); } } else { s_logger.debug("ldap user with username "+admin+" is disabled in the given group/ou"); } } catch (NoLdapUserMatchingQueryException e) { s_logger.debug("no ldap user matching username " + admin + " in the given group/ou"); } } response.setObjectName("LinkDomainToLdap"); response.setResponseName(getCommandName()); setResponseObject(response); } catch (final InvalidParameterValueException e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString()); } }

Target:
public void execute() throws ServerApiException { try { LinkDomainToLdapResponse response = _ldapManager.linkDomainToLdap(domainId, type, name, accountType); if(admin!=null) { LdapUser ldapUser = null; try { ldapUser = _ldapManager.getUser(admin, type, name); } catch (NoLdapUserMatchingQueryException e) { s_logger.debug("no ldap user matching username " + admin + " in the given group/ou", e); } if (ldapUser != null && !ldapUser.isDisabled()) { Account account = _accountService.getActiveAccountByName(admin, domainId); if (account == null) { try { UserAccount userAccount = _accountService.createUserAccount(admin, "", ldapUser.getFirstname(), ldapUser.getLastname(), ldapUser.getEmail(), null, admin, Account.ACCOUNT_TYPE_DOMAIN_ADMIN, domainId, admin, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP); response.setAdminId(String.valueOf(userAccount.getAccountId())); s_logger.info("created an account with name " + admin + " in the given domain " + domainId); } catch (Exception e) { s_logger.info("an exception occurred while creating account with name " + admin +" in domain " + domainId, e); } } else { s_logger.debug("an account with name " + admin + " already exists in the domain " + domainId); } } else { s_logger.debug("ldap user with username "+admin+" is disabled in the given group/ou"); } } response.setObjectName("LinkDomainToLdap"); response.setResponseName(getCommandName()); setResponseObject(response); } catch (final InvalidParameterValueException e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString()); } }
Source:
public void destroy(String name) throws CachePersistenceException { if(!started) internalStart(); PersistenceSpace space = knownPersistenceSpaces.remove(name); if (space == null) { destroy(name, new DefaultPersistenceSpaceIdentifier(getDirectoryFor(name)), true); } else { destroy(name, space.identifier, true); } }

Target:
public void destroy(String name) throws CachePersistenceException { boolean wasStarted = false; if (!started) { internalStart(); wasStarted = true; } try { PersistenceSpace space = knownPersistenceSpaces.remove(name); if (space == null) { destroy(name, new DefaultPersistenceSpaceIdentifier(getDirectoryFor(name)), true); } else { destroy(name, space.identifier, true); } } finally { if (wasStarted) { stop(); } } }
Source:
private List<VDS> getGlusterPeers(Guid upServerId) { List<VDS> glusterServers = new ArrayList<VDS>(); VDSReturnValue returnValue = Backend.getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.GlusterHostsList, new VdsIdVDSCommandParametersBase(upServerId)); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { glusterServers = (List<VDS>) returnValue.getReturnValue(); } else { getReturnValue().getFault().setError(returnValue.getVdsError().getCode()); getReturnValue().getFault().setMessage(returnValue.getVdsError().getMessage()); AuditLogDirector.log(new AuditLogableBase(upServerId), AuditLogType.GLUSTER_HOST_LIST_FAILED); } return glusterServers; }

Target:
private List<VDS> getGlusterPeers(Guid upServerId) { List<VDS> glusterServers = new ArrayList<VDS>(); VDSReturnValue returnValue = Backend.getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.GlusterHostsList, new VdsIdVDSCommandParametersBase(upServerId)); if (!returnValue.getSucceeded()) { getReturnValue().getFault().setError(returnValue.getVdsError().getCode()); getReturnValue().getFault().setMessage(returnValue.getVdsError().getMessage()); AuditLogDirector.log(new AuditLogableBase(upServerId), AuditLogType.GLUSTER_HOST_LIST_FAILED); } return (List<VDS>) returnValue.getReturnValue(); }
Source:
static public void assertNotEquals(String message, double unexpected, double actual, double delta) { if (!doubleIsDifferent(unexpected, actual, delta)) { failEquals(message, actual); } }

Target:
static public void assertNotEquals(String message, double unexpected, double actual, double delta) { if (!doubleIsDifferent(unexpected, actual, delta)) { failEquals(message, Double.valueOf(actual)); } }
Source:
public void shouldMakeTripletsUpToTen() { final Map<String, Integer> searchData = new HashMap<>(); searchData.put(PythagoreanTriplet.MAX_FACTOR, 10); final List<Long> actual = PythagoreanTriplet.createTripletsList(searchData) .stream() .map(t -> t.calculateProduct()) .sorted((p1, p2) -> Double.compare(p1, p2)) .collect(Collectors.toList()); final List<Long> expected = Arrays.asList(60l, 480l); assertEquals(expected, actual); }

Target:
public void shouldMakeTripletsUpToTen() { final List<Long> actual = PythagoreanTriplet .makeTripletsList() .withFactorsLessThanOrEqualTo(10) .build() .stream() .map(t -> t.calculateProduct()) .sorted() .collect(Collectors.toList()); final List<Long> expected = Arrays.asList(60l, 480l); assertEquals(expected, actual); }
Source:
public Linkifier(GitilesUrls urls, Config config) { this.urls = checkNotNull(urls, "urls"); List<CommentLinkInfo> list = new ArrayList<>(); list.add(new CommentLinkInfo(HTTP_URL_PATTERN, "$0")); Set<String> subsections = config.getSubsections(COMMENTLINK); List<String> patterns = new ArrayList<>(); patterns.add(HTTP_URL_PATTERN.pattern()); patterns.add(CHANGE_ID_PATTERN.pattern()); for (String subsection : subsections) { String match = config.getString("commentlink", subsection, "match"); String link = config.getString("commentlink", subsection, "link"); String html = config.getString("commentlink", subsection, "html"); if (html != null) log.warn( "Beware: html in commentlinks is unsupported in gitiles; " + "Did you copy it from a gerrit config?"); checkArgument(!Strings.isNullOrEmpty(match), "invalid commentlink.%s.match", subsection); Pattern compiledPattern = Pattern.compile(match); list.add(new CommentLinkInfo(compiledPattern, link)); patterns.add(match); } this.commentLinks = Collections.unmodifiableList(list); allPattern = Pattern.compile(Joiner.on('|').join(patterns)); }

Target:
public Linkifier(GitilesUrls urls, Config config) { this.urls = checkNotNull(urls, "urls"); List<CommentLinkInfo> list = new ArrayList<>(); list.add(new CommentLinkInfo(HTTP_URL_PATTERN, "$0")); Set<String> subsections = config.getSubsections(COMMENTLINK); List<String> patterns = new ArrayList<>(); patterns.add(HTTP_URL_PATTERN.pattern()); patterns.add(CHANGE_ID_PATTERN.pattern()); for (String subsection : subsections) { String match = config.getString("commentlink", subsection, "match"); String link = config.getString("commentlink", subsection, "link"); String html = config.getString("commentlink", subsection, "html"); if (html != null) log.warn("Beware: html in commentlinks is unsupported in gitiles; " + "Did you copy it from a gerrit config?"); if (Strings.isNullOrEmpty(match)) { log.warn("invalid commentlink.%s.match", subsection); } Pattern compiledPattern = Pattern.compile(match); list.add(new CommentLinkInfo(compiledPattern, link)); patterns.add(match); } this.commentLinks = Collections.unmodifiableList(list); allPattern = Pattern.compile(Joiner.on('|').join(patterns)); }
Source:
public void shouldCreateFutureFromCompletedJavaCompletableFuture() { CompletableFuture<Integer> jFuture = CompletableFuture.completedFuture(1); final Future<Integer> future = Future.fromCompletableFuture(jFuture); assertCompleted(future, 1); }

Target:
public void shouldCreateFutureFromCompletedJavaCompletableFuture() { final CompletableFuture<Integer> jFuture = CompletableFuture.completedFuture(1); final Future<Integer> future = Future.fromCompletableFuture(jFuture); assertCompleted(future, 1); }
Source:
private boolean consoleEditorHadFocusLast() { AceEditor editor = editorFocusTracker_.getLastFocusedEditor(); if (editor == null) return false; String id = editor.getWidget().getElement().getId(); return "rstudio_console_input".equals(id); }

Target:
private boolean consoleEditorHadFocusLast() { String id = MainWindowObject.get(MainWindowObject.LAST_FOCUSED_EDITOR); return "rstudio_console_input".equals(id); }
Source:
private static Repository[] getRepositories(boolean warn, @NonNull IStructuredSelection selection, Shell shell) { List<Repository> repositories = new ArrayList<>(); IPath[] locations = getSelectedLocations(selection); if (GitTraceLocation.SELECTION.isActive()) GitTraceLocation.getTrace().trace( GitTraceLocation.SELECTION.getLocation(), "selection=" + selection + ", locations=" + Arrays.toString(locations)); for (IPath location : locations) { RepositoryMapping mapping = RepositoryMapping.getMapping(location); Repository repo; if (mapping != null) { repo = mapping.getRepository(); } else { repo = org.eclipse.egit.core.Activator.getDefault() .getRepositoryCache().getRepository(location); } if (repo != null) { repositories.add(repo); } } if (repositories.size() == 0) { for (Object o : selection.toArray()) { Repository nextRepo = AdapterUtils.adapt(o, Repository.class); if (nextRepo != null) { repositories.add(nextRepo); } } } if (repositories.size() == 0) { if (warn) MessageDialog.openError(shell, UIText.RepositoryAction_errorFindingRepoTitle, UIText.RepositoryAction_errorFindingRepo); return null; } return repositories.toArray(new Repository[repositories.size()]); }

Target:
private static Repository[] getRepositories(boolean warn, @NonNull IStructuredSelection selection, Shell shell) { Set<Repository> repositories = new HashSet<>(); Set<Object> elements = getSelectionContents(selection); if (GitTraceLocation.SELECTION.isActive()) { GitTraceLocation.getTrace().trace( GitTraceLocation.SELECTION.getLocation(), "selection=" + selection + ", elements=" + elements.toString()); } for (Object location : elements) { Repository repo = null; if (location instanceof Repository) { repo = (Repository) location; } else if (location instanceof IResource) { repo = ResourceUtil.getRepository((IResource) location); } else if (location instanceof IPath) { repo = ResourceUtil.getRepository((IPath) location); } if (repo != null) { repositories.add(repo); } } if (repositories.size() == 0) { for (Object o : selection.toArray()) { Repository nextRepo = AdapterUtils.adapt(o, Repository.class); if (nextRepo != null) { repositories.add(nextRepo); } } } if (repositories.isEmpty()) { if (warn) { MessageDialog.openError(shell, UIText.RepositoryAction_errorFindingRepoTitle, UIText.RepositoryAction_errorFindingRepo); } return null; } return repositories.toArray(new Repository[repositories.size()]); }
Source:
private boolean executeRequest(HttpGet request) { request.setConfig(config); try { HttpResponse response = client.execute(request); return response.getStatusLine().getStatusCode() == STATUS_OK; } catch (Exception e) { return false; } }

Target:
private Verification executeRequest(HttpGet request) { request.setConfig(config); try { HttpResponse response = client.execute(request); int status = response.getStatusLine().getStatusCode(); if (status == STATUS_OK) { return new Verification(true); } else { return new Verification(false, Integer.toString(status)); } } catch (Exception e) { LOGGER.error("Error verifying connection", e); return new Verification(false, e.toString()); } }
Source:
private void slaveWithPlainMechanism() throws Exception { getDomainMasterClient().execute(changePresentedMechanisms("master", new HashSet<>(Arrays.asList("PLAIN")))); getDomainSlaveClient().execute(changeSaslMechanism("slave", "PLAIN")); reloadSlave(); testSupport.getDomainSlaveLifecycleUtil().awaitHostController(System.currentTimeMillis()); readHostControllerStatus(getDomainMasterClient()); getDomainMasterClient().execute(changePresentedMechanisms("master", new HashSet<>(Arrays.asList("DIGEST-MD5")))); getDomainSlaveClient().execute(changeSaslMechanism("slave", "DIGEST-MD5")); reloadSlave(); testSupport.getDomainSlaveLifecycleUtil().awaitHostController(System.currentTimeMillis()); assertTrue("Host \"slave\" did not reconnect to master with plain mechanism.", hostRunning(FAILED_RELOAD_TIMEOUT_MILLIS)); readHostControllerStatus(domainMasterClient); }

Target:
private void slaveWithPlainMechanism() throws Exception { getDomainMasterClient().execute(changePresentedMechanisms("master", new HashSet<>(Arrays.asList("PLAIN")))); getDomainSlaveClient().execute(changeSaslMechanism("slave", "PLAIN")); reloadSlave(); testSupport.getDomainSlaveLifecycleUtil().awaitHostController(System.currentTimeMillis()); readHostControllerStatus(getDomainMasterClient()); getDomainMasterClient().execute(changePresentedMechanisms("master", new HashSet<>(Arrays.asList("DIGEST-MD5")))); getDomainSlaveClient().execute(changeSaslMechanism("slave", "DIGEST-MD5")); reloadSlave(); testSupport.getDomainSlaveLifecycleUtil().awaitHostController(System.currentTimeMillis()); assertTrue("Host \"slave\" did not reconnect to master with plain mechanism.", hostRunning(FAILED_RELOAD_TIMEOUT_MILLIS)); }
Source:
private final void logAndRaiseIssue(List<PomIssue> issues, String message) { LoggerFactory.getLogger(getClass()).info(message); issues.add((new PomIssue(KEY, message))); }

Target:
private final void logAndRaiseIssue(List<PomIssue> issues, String message) { issues.add((new PomIssue(KEY, message))); }
Source:
public DistStageAck executeOnSlave() { if (!isServiceRunning()) { return errorResponse("Service is not runnning", null); } if (slaveState.getSlaveIndex() == 0) { DistStageAck result = null; Object prevResult = null; Statistics stats = new DefaultStatistics(new DataOperationStats()); stats.begin(); for (int i = 0; i < numExecutions; i++) { prevResult = streamTaskResult; result = executeStreamTask(stats); if (prevResult != null) { if (prevResult.equals(streamTaskResult)) { log.info(i + ": Got the same results for two Stream tasks runs"); } else { log.error(i + ": Did not get the same results for two Stream tasks runs"); break; } } if (result.isError() && exitOnFailure) { break; } } stats.end(); if (storeResultInCache) { try { if (streamTaskResult != null) { basicOperations.getCache(cacheName).put(STREAM_RESULT_KEY, streamTaskResult); } } catch (Exception e) { log.error("Failed to put result object into cache", e); } } log.info("Executed stream stage on slave"); return result; } else { return new StreamStageAck(slaveState); } }

Target:
public DistStageAck executeOnSlave() { if (!isServiceRunning()) { return errorResponse("Service is not runnning", null); } DistStageAck result = null; Object prevResult = null; Statistics stats = statisticsPrototype.copy(); stats.begin(); for (int i = 0; i < numExecutions; i++) { prevResult = streamTaskResult; result = executeStreamTask(stats); if (prevResult != null) { if (prevResult.equals(streamTaskResult)) { log.info(i + ": Got the same results for two Stream tasks runs"); } else { log.error(i + ": Did not get the same results for two Stream tasks runs"); break; } } if (result.isError() && exitOnFailure) { break; } } stats.end(); log.info("Executed stream stage on slave"); return result; }
Source:
public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { try { String symbol = null; if (params instanceof TradeHistoryParamCurrencyPair && ((TradeHistoryParamCurrencyPair) params).getCurrencyPair() != null) { symbol = BitfinexAdapters.adaptCurrencyPair( ((TradeHistoryParamCurrencyPair) params).getCurrencyPair()); } long startTime = 0; Long endTime = null; Long limit = 50L; if (params instanceof TradeHistoryParamsTimeSpan) { TradeHistoryParamsTimeSpan paramsTimeSpan = (TradeHistoryParamsTimeSpan) params; startTime = DateUtils.toMillisNullSafe(paramsTimeSpan.getStartTime()); endTime = DateUtils.toMillisNullSafe(paramsTimeSpan.getEndTime()); } if (params instanceof TradeHistoryParamPaging) { TradeHistoryParamPaging pagingParams = (TradeHistoryParamPaging) params; Integer pageLength = pagingParams.getPageLength(); Integer pageNum = pagingParams.getPageNumber(); limit = (pageLength != null && pageNum != null) ? pageLength * (pageNum + 1) : 50L; } if (params instanceof TradeHistoryParamLimit) { TradeHistoryParamLimit tradeHistoryParamLimit = (TradeHistoryParamLimit) params; limit = Long.valueOf(tradeHistoryParamLimit.getLimit()); } final List<Trade> trades = getBitfinexTradesV2(symbol, startTime, endTime, limit); return BitfinexAdapters.adaptTradeHistoryV2(trades); } catch (BitfinexException e) { throw BitfinexErrorAdapter.adapt(e); } }

Target:
public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { try { String symbol = null; if (params instanceof TradeHistoryParamCurrencyPair && ((TradeHistoryParamCurrencyPair) params).getCurrencyPair() != null) { symbol = BitfinexAdapters.adaptCurrencyPair( ((TradeHistoryParamCurrencyPair) params).getCurrencyPair()); } long startTime = 0; Long endTime = null; Long limit = 50L; Long sort = null; if (params instanceof TradeHistoryParamsTimeSpan) { TradeHistoryParamsTimeSpan paramsTimeSpan = (TradeHistoryParamsTimeSpan) params; startTime = DateUtils.toMillisNullSafe(paramsTimeSpan.getStartTime()); endTime = DateUtils.toMillisNullSafe(paramsTimeSpan.getEndTime()); } if (params instanceof TradeHistoryParamLimit) { TradeHistoryParamLimit tradeHistoryParamLimit = (TradeHistoryParamLimit) params; limit = Long.valueOf(tradeHistoryParamLimit.getLimit()); } if (params instanceof TradeHistoryParamsSorted) { TradeHistoryParamsSorted tradeHistoryParamsSorted = (TradeHistoryParamsSorted) params; sort = tradeHistoryParamsSorted.getOrder() == TradeHistoryParamsSorted.Order.asc ? 1L : -1L; } final List<Trade> trades = getBitfinexTradesV2(symbol, startTime, endTime, limit, sort); return BitfinexAdapters.adaptTradeHistoryV2(trades); } catch (BitfinexException e) { throw BitfinexErrorAdapter.adapt(e); } }
Source:
public TkWithAliasHeader(final Base base, final Take take) { this.base = base; this.take = take; this.header = String.format("%s: %s", "X-Netbout-Alias", "%s"); }

Target:
public TkWithAliasHeader(final Base base, final Take take) { this.base = base; this.take = take; }
Source:
ZKUpdater(Collection<Account> accounts) { this.accounts = accounts; Pair<String, Path> backupPrefixAndPath = null; if (accountService.backupDirPath != null) { try { backupPrefixAndPath = accountService.reserveBackupFile(); } catch (IOException e) { logger.error("Error reserving backup file", e); } } this.backupPrefixAndPath = backupPrefixAndPath; }

Target:
ZKUpdater(Collection<Account> accounts) { this.accounts = accounts; Pair<String, Path> backupPrefixAndPath = null; try { backupPrefixAndPath = backup.reserveBackupFile(); } catch (IOException e) { logger.error("Error reserving backup file", e); } this.backupPrefixAndPath = backupPrefixAndPath; }
Source:
public GrpcCallTracker(StreamObserver<?> streamObserver) { if (!(streamObserver instanceof ServerCallStreamObserver)) { throw new IllegalStateException("Call tacking is supported for server streams."); } mStreamObserver = (ServerCallStreamObserver) streamObserver; }

Target:
public GrpcCallTracker(StreamObserver<?> streamObserver) { if (!(streamObserver instanceof ServerCallStreamObserver)) { throw new IllegalStateException(String.format( "Call tracking is only supported for server streams. Passed stream type: %s", streamObserver.getClass().getSimpleName())); } mStreamObserver = (ServerCallStreamObserver) streamObserver; }
Source:
public void recognizePiiEntity() { String document = "My SSN is 555-55-5555"; textAnalyticsClient.recognizePiiEntities(document).forEach(piiEntity -> System.out.printf("Recognized Personally Identifiable Information entity: %s, category: %s, subCategory: %s, score: %f.%n", piiEntity.getText(), piiEntity.getCategory(), piiEntity.getSubcategory(), piiEntity.getConfidenceScore())); }

Target:
public void recognizePiiEntity() { String document = "My SSN is 859-98-0987"; textAnalyticsClient.recognizePiiEntities(document).forEach(entity -> System.out.printf( "Recognized Personally Identifiable Information entity: %s, entity category: %s, entity subcategory: %s," + " confidence score: %f.%n", entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())); }
Source:
protected static boolean tableExists(TableReference tableReference) { Iterator<TableReference> it = NodesDownTestSetup.db.getAllTableNames().iterator(); while (it.hasNext()) { if (it.next().equals(tableReference)) { return true; } } return false; }

Target:
protected static boolean tableExists(TableReference tableReference) { return NodesDownTestSetup.kvs.getAllTableNames().contains(tableReference); }
Source:
private void initProgressIndicator() { progressIndicator = new SimplePanel(); getContainer().insert(progressIndicator, 0); getDetailModel().getPropertyChangedEvent().addListener((ev, sender, args) -> progressIndicator.getElement().setInnerSafeHtml(getDetailModel().isNetworkOperationInProgress() ? templates.networkUpdatingSpinner(constants.networkUpdating()) : templates.noHtml() ) ); }

Target:
private void initProgressIndicator() { progressIndicator = new SimplePanel(); getContainer().insert(progressIndicator, 0); getDetailModel().getPropertyChangedEvent().addListener((ev, sender, args) -> progressIndicator.getElement().setInnerSafeHtml(getDetailModel().isNetworkOperationInProgress() ? templates.networkUpdatingSpinner(constants.networkUpdating()) : SafeHtmlUtils.fromTrustedString("") ) ); }