auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void warnAboutTypeAnnotationsTooEarly(Tree node, ModifiersTree modifiersTree) { if (node.getKind() == Tree.Kind.VARIABLE) { if (TreeUtils.elementFromDeclaration((VariableTree) node).getKind() == ElementKind.ENUM_CONSTANT) { return; } Tree parent = getCurrentPath().getParentPath().getLeaf(); if (parent.getKind() == Tree.Kind.TRY) { return; } } Set<Modifier> modifierSet = modifiersTree.getFlags(); List<? extends AnnotationTree> annotations = modifiersTree.getAnnotations(); if (annotations.isEmpty()) { return; } int lastDeclAnnoIndex = -1; for (int i = annotations.size() - 1; i > 0; i--) { if (!isTypeAnnotation(annotations.get(i))) { lastDeclAnnoIndex = i; break; } } if (lastDeclAnnoIndex != -1) { List<AnnotationTree> badTypeAnnos = new ArrayList<>(); for (int i = 0; i < lastDeclAnnoIndex; i++) { AnnotationTree anno = annotations.get(i); if (isTypeAnnotation(anno)) { badTypeAnnos.add(anno); } } if (!badTypeAnnos.isEmpty()) { checker.reportWarning( node, "type.anno.before.decl.anno", badTypeAnnos, annotations.get(lastDeclAnnoIndex)); } } AnnotationTree firstAnno = annotations.get(0); if (!modifierSet.isEmpty() && isTypeAnnotation(firstAnno)) { int precedingTextLength = 0; for (Modifier m : modifierSet) { precedingTextLength += m.toString().length() + 1; } int annoStartPos = ((JCTree) firstAnno).getStartPosition(); int varStartPos = ((JCTree) node).getStartPosition(); if (annoStartPos < varStartPos + precedingTextLength) { checker.reportWarning(node, "type.anno.before.modifier", firstAnno, modifierSet); } } }

Target:
private void warnAboutTypeAnnotationsTooEarly(Tree node, ModifiersTree modifiersTree) { if (node.getKind() == Tree.Kind.VARIABLE) { ElementKind varKind = TreeUtils.elementFromDeclaration((VariableTree) node).getKind(); switch (varKind) { case ENUM_CONSTANT: return; case RESOURCE_VARIABLE: return; default: } } Set<Modifier> modifierSet = modifiersTree.getFlags(); List<? extends AnnotationTree> annotations = modifiersTree.getAnnotations(); if (annotations.isEmpty()) { return; } int lastDeclAnnoIndex = -1; for (int i = annotations.size() - 1; i > 0; i--) { if (!isTypeAnnotation(annotations.get(i))) { lastDeclAnnoIndex = i; break; } } if (lastDeclAnnoIndex != -1) { List<AnnotationTree> badTypeAnnos = new ArrayList<>(); for (int i = 0; i < lastDeclAnnoIndex; i++) { AnnotationTree anno = annotations.get(i); if (isTypeAnnotation(anno)) { badTypeAnnos.add(anno); } } if (!badTypeAnnos.isEmpty()) { checker.reportWarning( node, "type.anno.before.decl.anno", badTypeAnnos, annotations.get(lastDeclAnnoIndex)); } } AnnotationTree firstAnno = annotations.get(0); if (!modifierSet.isEmpty() && isTypeAnnotation(firstAnno)) { int precedingTextLength = 0; for (Modifier m : modifierSet) { precedingTextLength += m.toString().length() + 1; } int annoStartPos = ((JCTree) firstAnno).getStartPosition(); int varStartPos = ((JCTree) node).getStartPosition(); if (annoStartPos < varStartPos + precedingTextLength) { checker.reportWarning(node, "type.anno.before.modifier", firstAnno, modifierSet); } } }
Source:
public ListResponse<DomainRouterResponse> searchForRouters(ListRoutersCmd cmd) { Pair<List<DomainRouterJoinVO>, Integer> result = searchForRoutersInternal(cmd, cmd.getId(), cmd.getRouterName(), cmd.getState(), cmd.getZoneId(), cmd.getPodId(), cmd.getClusterId(), cmd.getHostId(), cmd.getKeyword(), cmd.getNetworkId(), cmd.getVpcId(), cmd.getForVpc(), cmd.getRole(), cmd.getVersion()); ListResponse<DomainRouterResponse> response = new ListResponse<DomainRouterResponse>(); if (!VirtualNetworkApplianceManager.RouterHealthChecksEnabled.value()) { s_logger.debug("Skipping health checks data in router as router.health.checks.enabled is false for router"); return response; } List<DomainRouterResponse> routerResponses = ViewResponseHelper.createDomainRouterResponse(result.first().toArray(new DomainRouterJoinVO[result.first().size()])); for (DomainRouterResponse res : routerResponses) { DomainRouterVO resRouter = _routerDao.findByUuid(res.getId()); res.setHealthChecksFailed(routerHealthCheckResultDao.hasFailingChecks(resRouter.getId())); if (cmd.shouldFetchHealthCheckResults()) { res.setHealthCheckResults(responseGenerator.createHealthCheckResponse(resRouter, new ArrayList<>(routerHealthCheckResultDao.getHealthCheckResults(resRouter.getId())))); } } response.setResponses(routerResponses, result.second()); return response; }

Target:
public ListResponse<DomainRouterResponse> searchForRouters(ListRoutersCmd cmd) { Pair<List<DomainRouterJoinVO>, Integer> result = searchForRoutersInternal(cmd, cmd.getId(), cmd.getRouterName(), cmd.getState(), cmd.getZoneId(), cmd.getPodId(), cmd.getClusterId(), cmd.getHostId(), cmd.getKeyword(), cmd.getNetworkId(), cmd.getVpcId(), cmd.getForVpc(), cmd.getRole(), cmd.getVersion()); ListResponse<DomainRouterResponse> response = new ListResponse<DomainRouterResponse>(); List<DomainRouterResponse> routerResponses = ViewResponseHelper.createDomainRouterResponse(result.first().toArray(new DomainRouterJoinVO[result.first().size()])); if (VirtualNetworkApplianceManager.RouterHealthChecksEnabled.value()) { for (DomainRouterResponse res : routerResponses) { DomainRouterVO resRouter = _routerDao.findByUuid(res.getId()); res.setHealthChecksFailed(routerHealthCheckResultDao.hasFailingChecks(resRouter.getId())); if (cmd.shouldFetchHealthCheckResults()) { res.setHealthCheckResults(responseGenerator.createHealthCheckResponse(resRouter, new ArrayList<>(routerHealthCheckResultDao.getHealthCheckResults(resRouter.getId())))); } } } response.setResponses(routerResponses, result.second()); return response; }
Source:
public TriggerResult onProcessingTime(long time, W window, TriggerContext ctx) throws Exception { ReducingState<Long> fireTimestamp = ctx.getPartitionedState(stateDesc); if (fireTimestamp.get().equals(time)) { fireTimestamp.clear(); fireTimestamp.add(time + interval); ctx.registerProcessingTimeTimer(time + interval); return TriggerResult.FIRE; } if (window.maxTimestamp() == time) { return TriggerResult.FIRE_AND_PURGE; } return TriggerResult.CONTINUE; }

Target:
public TriggerResult onProcessingTime(long time, W window, TriggerContext ctx) throws Exception { ReducingState<Long> fireTimestamp = ctx.getPartitionedState(stateDesc); if (fireTimestamp.get().equals(time)) { fireTimestamp.clear(); fireTimestamp.add(time + interval); ctx.registerProcessingTimeTimer(time + interval); return TriggerResult.FIRE; } if (window.maxTimestamp() == time) { return TriggerResult.FIRE; } return TriggerResult.CONTINUE; }
Source:
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { return Util.last(rels) .computeSelfCost(planner, mq) .multiplyBy( RelMdUtil.linear(querySpec.fieldNames.size(), 2, 100, 1d, 2d)) .multiplyBy(getQueryTypeCostMultiplier()) .multiplyBy(Util.last(rels) instanceof Bindables.BindableSort ? 0.1 : 0.2); }

Target:
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { return Util.last(rels) .computeSelfCost(planner, mq) .multiplyBy( RelMdUtil.linear(querySpec.fieldNames.size(), 2, 100, 1d, 2d)) .multiplyBy(getQueryTypeCostMultiplier()) .multiplyBy(Util.last(rels) instanceof Sort ? 0.1 : 1); }
Source:
public SshPairDto getPair(String service, String name) throws ServerException, NotFoundException { try { final String url = UriBuilder.fromUri(sshUrl + "/getPair") .build(service) .toString(); return requestFactory.fromUrl(url) .useGetMethod() .addQueryParam("name", name) .request() .asDto(SshPairDto.class); } catch (IOException | ForbiddenException | BadRequestException | ConflictException | UnauthorizedException e) { throw new ServerException(e); } }

Target:
public SshPairDto getPair(String service, String name) throws ServerException, NotFoundException { try { return requestFactory.fromUrl(sshUrl + "/" + service + "/find") .useGetMethod() .addQueryParam("name", name) .request() .asDto(SshPairDto.class); } catch (IOException | ForbiddenException | BadRequestException | ConflictException | UnauthorizedException e) { throw new ServerException(e); } }
Source:
public void describe(StreamApplicationDescriptor appDescriptor) { Table<KV<Integer, TestTableData.Profile>> table = appDescriptor.getTable( new RocksDbTableDescriptor<Integer, TestTableData.Profile>("profile-view-store", KVSerde.of(new IntegerSerde(), new TestTableData.ProfileJsonSerde()))); KafkaSystemDescriptor ksd = new KafkaSystemDescriptor("test"); KafkaInputDescriptor<TestTableData.Profile> profileISD = ksd.getInputDescriptor("Profile", new JsonSerdeV2<>()); appDescriptor.getInputStream(profileISD).map(m -> new KV(m.getMemberId(), m)).sendTo(table); KafkaInputDescriptor<TestTableData.PageView> pageViewISD = ksd.getInputDescriptor("PageView", new JsonSerdeV2<>()); KafkaOutputDescriptor<TestTableData.EnrichedPageView> enrichedPageViewOSD = ksd.getOutputDescriptor("EnrichedPageView", new NoOpSerde<>()); OutputStream<TestTableData.EnrichedPageView> outputStream = appDescriptor.getOutputStream(enrichedPageViewOSD); appDescriptor.getInputStream(pageViewISD) .partitionBy(TestTableData.PageView::getMemberId, pv -> pv, KVSerde.of(new IntegerSerde(), new JsonSerdeV2<>( TestTableData.PageView.class)), "p1") .join(table, new PageViewToProfileJoinFunction()) .sendTo(outputStream); }

Target:
public void describe(StreamApplicationDescriptor appDescriptor) { Table<KV<Integer, TestTableData.Profile>> table = appDescriptor.getTable( new RocksDbTableDescriptor<Integer, TestTableData.Profile>("profile-view-store", KVSerde.of(new IntegerSerde(), new TestTableData.ProfileJsonSerde()))); KafkaSystemDescriptor ksd = new KafkaSystemDescriptor("test"); KafkaInputDescriptor<KV<String, TestTableData.Profile>> profileISD = ksd.getInputDescriptor("Profile", KVSerde.of(new StringSerde(), new JsonSerdeV2<>())); appDescriptor .getInputStream(profileISD) .map(m -> new KV(m.getValue().getMemberId(), m.getValue())) .sendTo(table); KafkaInputDescriptor<KV<String, TestTableData.PageView>> pageViewISD = ksd.getInputDescriptor("PageView", KVSerde.of(new StringSerde(), new JsonSerdeV2<>())); KafkaOutputDescriptor<TestTableData.EnrichedPageView> enrichedPageViewOSD = ksd.getOutputDescriptor("EnrichedPageView", new JsonSerdeV2<>()); OutputStream<TestTableData.EnrichedPageView> outputStream = appDescriptor.getOutputStream(enrichedPageViewOSD); appDescriptor.getInputStream(pageViewISD) .partitionBy(pv -> pv.getValue().getMemberId() , pv -> pv.getValue(), KVSerde.of(new IntegerSerde(), new JsonSerdeV2<>(TestTableData.PageView.class)), "p1") .join(table, new PageViewToProfileJoinFunction()) .sendTo(outputStream); }
Source:
private List<LiveMigrateDisksParameters> getLiveMigrateDisksParametersList() { List<LiveMigrateDisksParameters> liveMigrateDisksParametersList = new ArrayList<LiveMigrateDisksParameters>(); for (Guid vmId : vmsLiveMigrateParametersMap.keySet()) { List<LiveMigrateDiskParameters> parametersList = vmsLiveMigrateParametersMap.get(vmId); LiveMigrateDisksParameters liveMigrateDisksParameters = new LiveMigrateDisksParameters(parametersList, vmId); liveMigrateDisksParameters.setParentCommand(VdcActionType.MoveDisks); liveMigrateDisksParameters.setSessionId(getParameters().getSessionId()); liveMigrateDisksParametersList.add(liveMigrateDisksParameters); } return liveMigrateDisksParametersList; }

Target:
private List<LiveMigrateDisksParameters> getLiveMigrateDisksParametersList() { List<LiveMigrateDisksParameters> liveMigrateDisksParametersList = new ArrayList<LiveMigrateDisksParameters>(); for (Map.Entry<Guid, List<LiveMigrateDiskParameters>> entry : vmsLiveMigrateParametersMap.entrySet()) { LiveMigrateDisksParameters liveMigrateDisksParameters = new LiveMigrateDisksParameters(entry.getValue(), entry.getKey()); liveMigrateDisksParameters.setParentCommand(VdcActionType.MoveDisks); liveMigrateDisksParameters.setSessionId(getParameters().getSessionId()); liveMigrateDisksParametersList.add(liveMigrateDisksParameters); } return liveMigrateDisksParametersList; }
Source:
public CommonProfile validateToken(final String token) { final TokenCredentials credentials = new TokenCredentials(token, "(validateToken)Method"); try { validate(credentials, null); } catch (final HttpAction | CredentialsException e) { throw new TechnicalException(e); } return credentials.getUserProfile(); }

Target:
public CommonProfile validateToken(final String token) { final TokenCredentials credentials = new TokenCredentials(token, "(validateToken)Method"); try { validate(credentials, null); } catch (final HttpAction e) { throw new TechnicalException(e); } catch (final CredentialsException e) { logger.info("Failed to retrieve or validate credentials: {}", e.getMessage()); logger.debug("Failed to retrieve or validate credentials", e); return null; } return credentials.getUserProfile(); }
Source:
public static <K, V, T extends Map<K, V>> T unmarshallMap(ObjectInput in, MapBuilder<K, V, T> builder) throws IOException, ClassNotFoundException { final int size = unmarshallInt(in); if (size == NULL_VALUE) { return null; } final T map = Objects.requireNonNull(builder, "MapBuilder must be non-null").build(); for (int i = 0; i < size; i++) map.put((K) in.readObject(), (V) in.readObject()); return map; }

Target:
public static <K, V, T extends Map<K, V>> T unmarshallMap(ObjectInput in, MapBuilder<K, V, T> builder) throws IOException, ClassNotFoundException { final int size = unmarshallInt(in); if (size == NULL_VALUE) { return null; } final T map = Objects.requireNonNull(builder, "MapBuilder must be non-null").build(size); for (int i = 0; i < size; i++) map.put((K) in.readObject(), (V) in.readObject()); return map; }
Source:
public static boolean isEcoreEqual(EObject object, EObject otherObject) { if (object == null) { if (otherObject == null) { return true; } return false; } if (object.eClass() != otherObject.eClass()) { return false; } for (EAttribute attribute : object.eClass().getEAllAttributes()) { if (!ObjectUtils.equals(object.eGet(attribute), otherObject.eGet(attribute))) { return false; } } for (EReference reference : object.eClass().getEAllReferences()) { if (!reference.isMany()) { boolean equal = isEcoreEqual((EObject) object.eGet(reference), (EObject) object.eGet(reference)); if (!equal) { return false; } } } return true; }

Target:
public static boolean isEcoreEqual(EObject object, EObject otherObject) { return isEcoreEqual(object, otherObject, new HashSet<EObject>(), new HashSet<EObject>()); }
Source:
public void isInternalImportExternalImportType() { final Imports imports = new Imports(); final Import importType = new Import("External1"); imports.addImport(importType); presenter.setContent(dmo, imports, false); assertFalse(presenter.isInternalImport(mock(Import.class))); }

Target:
public void isInternalImportExternalImportType() { final Imports imports = new Imports(); final Import importType = new Import("External1"); imports.addImport(importType); presenter.setContent(dmo, imports, false); assertFalse(presenter.isInternalImport(importType)); }
Source:
public io.reactivex.Observable<?> convert(Publisher<?> source) { return (io.reactivex.Observable<?>) REACTIVE_ADAPTER_REGISTRY.getAdapter(io.reactivex.Observable.class) .fromPublisher(source); }

Target:
public Flux<?> convert(Publisher<?> source) { return Flux.from(source); }
Source:
public void release(V bean) { K id = bean.getId(); Entry<V> entry = this.entries.get(id); if ((entry != null) && entry.done()) { if (this.timeout != null) { this.scheduler.schedule(id, this.timeout.isZero() ? Instant.now() : Instant.now().plus(this.timeout)); } } }

Target:
public void release(V bean) { K id = bean.getId(); Entry<V> entry = this.entries.get(id); if ((entry != null) && entry.done()) { if (this.timeout != null) { if (!this.timeout.isZero()) { this.scheduler.schedule(id, Instant.now().plus(this.timeout)); } else { remove(id); } } } }
Source:
public Iterable<SubstitutableLogger> getLoggers() { return loggers.values(); }

Target:
public List<SubstitutableLogger> getLoggers() { return new ArrayList<SubstitutableLogger>(loggers.values()); }
Source:
public void before() throws Exception { context = setupWithPoolingDataSource(JBPM_PERSISTENCE_UNIT_NAME); CorrelationKeyFactory factory = KieInternalServices.Factory.get().newCorrelationKeyFactory(); EntityManagerFactory emf = (EntityManagerFactory) context.get(EnvironmentName.ENTITY_MANAGER_FACTORY); UserTransaction ut = InitialContext.doLookup("java:comp/UserTransaction"); ut.begin(); EntityManager em = emf.createEntityManager(); try { em.persist(factory.newCorrelationKey("test123")); List<String> props = new ArrayList<String>(); props.add("test123"); props.add("123test"); em.persist(factory.newCorrelationKey(props)); } catch (Exception ex) { ex.printStackTrace(); ut.rollback(); } ut.commit(); }

Target:
public void before() throws Exception { context = setupWithPoolingDataSource(JBPM_PERSISTENCE_UNIT_NAME); CorrelationKeyFactory factory = KieInternalServices.Factory.get().newCorrelationKeyFactory(); EntityManagerFactory emf = (EntityManagerFactory) context.get(EnvironmentName.ENTITY_MANAGER_FACTORY); UserTransaction ut = InitialContext.doLookup("java:comp/UserTransaction"); ut.begin(); try { EntityManager em = emf.createEntityManager(); em.persist(factory.newCorrelationKey("test123")); List<String> props = new ArrayList<String>(); props.add("test123"); props.add("123test"); em.persist(factory.newCorrelationKey(props)); ut.commit(); } catch (Exception ex) { ut.rollback(); Assert.fail("Exception thrown while trying to prepare correlation data."); } }
Source:
public void request(final Callback cb) { final ProgressDialog dialog = ProgressDialog.show(getActivity(), "", getActivity().getString(R.string.dialog_loading_siteinfo_wait), true); Retrofit retrofitClient = RetrofitFactory.newInstance(apiBaseUrl, new WikiSite(apiBaseUrl)); Service request = retrofitClient.create(Service.class); Call<MwQueryResponse<SiteInfo>> call = request.requestSiteinfo(); call.enqueue(new retrofit2.Callback<MwQueryResponse<SiteInfo>>() { @Override public void onResponse(Call<MwQueryResponse<SiteInfo>> call, Response<MwQueryResponse<SiteInfo>> response) { if (response.isSuccessful() && response.body().success()) { cb.onSuccess(response.body().query()); } else { showAlert(getActivity().getString(R.string.dialog_loading_siteinfo_failed, Integer.toString(response.code()))); } dialog.hide(); } @Override public void onFailure(Call<MwQueryResponse<SiteInfo>> call, Throwable t) { String message = t.getMessage(); if (t instanceof HttpStatusException && message == null) { message = Integer.toString(((HttpStatusException) t).code()); } showAlert(getActivity().getString(R.string.dialog_loading_siteinfo_failed, message), t); dialog.hide(); } }); }

Target:
public Call<MwQueryResponse<SiteInfo>> request(final Callback cb) { Retrofit retrofitClient = RetrofitFactory.newInstance(apiBaseUrl, new WikiSite(apiBaseUrl)); Service request = retrofitClient.create(Service.class); Call<MwQueryResponse<SiteInfo>> call = request.requestSiteinfo(); call.enqueue(new retrofit2.Callback<MwQueryResponse<SiteInfo>>() { @Override public void onResponse(Call<MwQueryResponse<SiteInfo>> call, Response<MwQueryResponse<SiteInfo>> response) { if (response.isSuccessful() && response.body().success()) { cb.onSuccess(response.body().query()); } else { cb.onFailure(new HttpStatusException(response.raw())); } } @Override public void onFailure(Call<MwQueryResponse<SiteInfo>> call, Throwable t) { cb.onFailure(t); } }); return call; }
Source:
public void concurrentlyPublishedEventsMustAllBeProcessed() throws Exception { EventConsumer consumer = new EventConsumer(); final CountDownLatch startLatch = new CountDownLatch( 1 ); final int threads = 10; final int iterations = 2_000; final AsyncEvents<Event> asyncEvents = new AsyncEvents<>( consumer, AsyncEvents.Monitor.NONE ); executor.submit( asyncEvents ); ExecutorService threadPool = Executors.newFixedThreadPool( threads ); Runnable runner = () -> { try { startLatch.await(); } catch ( InterruptedException e ) { throw new RuntimeException( e ); } for ( int i = 0; i < iterations; i++ ) { asyncEvents.send( new Event() ); } }; for ( int i = 0; i < threads; i++ ) { threadPool.submit( runner ); } startLatch.countDown(); Thread thisThread = Thread.currentThread(); int eventCount = threads * iterations; try { for ( int i = 0; i < eventCount; i++ ) { Event event = consumer.poll( 1, TimeUnit.SECONDS ); if ( event == null ) { eventCount--; } else { assertThat( event.processedBy, is( not( thisThread ) ) ); } } } finally { asyncEvents.shutdown(); } }

Target:
public void concurrentlyPublishedEventsMustAllBeProcessed() throws Exception { EventConsumer consumer = new EventConsumer(); final CountDownLatch startLatch = new CountDownLatch( 1 ); final int threads = 10; final int iterations = 2_000; final AsyncEvents<Event> asyncEvents = new AsyncEvents<>( consumer, AsyncEvents.Monitor.NONE ); executor.submit( asyncEvents ); ExecutorService threadPool = Executors.newFixedThreadPool( threads ); Runnable runner = () -> { try { startLatch.await(); } catch ( InterruptedException e ) { throw new RuntimeException( e ); } for ( int i = 0; i < iterations; i++ ) { asyncEvents.send( new Event() ); } }; for ( int i = 0; i < threads; i++ ) { threadPool.submit( runner ); } startLatch.countDown(); Thread thisThread = Thread.currentThread(); int eventCount = threads * iterations; try { for ( int i = 0; i < eventCount; i++ ) { Event event = consumer.poll( 1, TimeUnit.SECONDS ); if ( event == null ) { i--; } else { assertThat( event.processedBy, is( not( thisThread ) ) ); } } } finally { asyncEvents.shutdown(); } }
Source:
protected void setACP(Document doc, ACP newAcp, boolean overwrite, Map<String, Serializable> options) { DocumentModel docModel = readModel(doc); if (options == null) { options = new HashMap<>(); } ACP oldAcp = docModel.getACP(); options.put(CoreEventConstants.OLD_ACP, oldAcp == null ? null : oldAcp.clone()); options.put(CoreEventConstants.NEW_ACP, newAcp); notifyEvent(DocumentEventTypes.BEFORE_DOC_SECU_UPDATE, docModel, options, null, null, true, true); getSession().setACP(doc, newAcp, overwrite); docModel = readModel(doc); options.put(CoreEventConstants.NEW_ACP, newAcp.clone()); notifyEvent(DocumentEventTypes.DOCUMENT_SECURITY_UPDATED, docModel, options, null, null, true, false); }

Target:
protected void setACP(Document doc, ACP newAcp, boolean overwrite, Map<String, Serializable> options) { DocumentModel docModel = readModel(doc); if (options == null) { options = new HashMap<>(); } ACP oldAcp = docModel.getACP(); if (oldAcp != null) { options.put(CoreEventConstants.OLD_ACP, oldAcp.clone()); } options.put(CoreEventConstants.NEW_ACP, newAcp); notifyEvent(DocumentEventTypes.BEFORE_DOC_SECU_UPDATE, docModel, options, null, null, true, true); getSession().setACP(doc, newAcp, overwrite); docModel = readModel(doc); options.put(CoreEventConstants.NEW_ACP, newAcp.clone()); notifyEvent(DocumentEventTypes.DOCUMENT_SECURITY_UPDATED, docModel, options, null, null, true, false); }
Source:
private Map<String, Integer> fetchCapacityUsage(String partitionName, ResourceConfig resourceConfig, ClusterConfig clusterConfig) { Map<String, Map<String, Integer>> capacityMap; try { capacityMap = resourceConfig.getPartitionCapacityMap(); } catch (IOException ex) { throw new IllegalArgumentException( "Invalid partition capacity configuration of resource: " + resourceConfig .getResourceName(), ex); } Map<String, Integer> partitionCapacity = capacityMap.get(partitionName); if (partitionCapacity == null) { partitionCapacity = capacityMap.getOrDefault(ResourceConfig.DEFAULT_PARTITION_KEY, new HashMap<>()); } for (Map.Entry<String, Integer> capacityEntry : clusterConfig.getDefaultPartitionWeightMap() .entrySet()) { partitionCapacity.putIfAbsent(capacityEntry.getKey(), capacityEntry.getValue()); } List<String> requiredCapacityKeys = clusterConfig.getInstanceCapacityKeys(); partitionCapacity.keySet().retainAll(requiredCapacityKeys); if (!partitionCapacity.keySet().containsAll(requiredCapacityKeys)) { throw new HelixException(String.format( "The required capacity keys %s are not fully configured int the resource %s partition %s weight map %s.", requiredCapacityKeys.toString(), resourceConfig.getResourceName(), partitionName, partitionCapacity.toString())); } return partitionCapacity; }

Target:
private Map<String, Integer> fetchCapacityUsage(String partitionName, ResourceConfig resourceConfig, ClusterConfig clusterConfig) { Map<String, Map<String, Integer>> capacityMap; try { capacityMap = resourceConfig.getPartitionCapacityMap(); } catch (IOException ex) { throw new IllegalArgumentException( "Invalid partition capacity configuration of resource: " + resourceConfig .getResourceName(), ex); } Map<String, Integer> partitionCapacity = new HashMap<>(clusterConfig.getDefaultPartitionWeightMap()); partitionCapacity.putAll(capacityMap.getOrDefault(partitionName, capacityMap.getOrDefault(ResourceConfig.DEFAULT_PARTITION_KEY, new HashMap<>()))); List<String> requiredCapacityKeys = clusterConfig.getInstanceCapacityKeys(); if (!partitionCapacity.keySet().containsAll(requiredCapacityKeys)) { throw new HelixException(String.format( "The required capacity keys: %s are not fully configured in the resource: %s, partition: %s, weight map: %s.", requiredCapacityKeys.toString(), resourceConfig.getResourceName(), partitionName, partitionCapacity.toString())); } partitionCapacity.keySet().retainAll(requiredCapacityKeys); return partitionCapacity; }
Source:
public void run() { while (!Thread.interrupted()) { try { Lease lease = leaseMaintainer.getCurrentLease(); if (!(lease instanceof NullLease)) { boolean validLease = lease.isValidAndContiguous(lease); if (!validLease) { try { connection.close(); } catch (IllegalStateException e) { } break; } } timeSource.sleep(200L); } catch (IOException e) { LOGGER.error("Closing connection, due to lease expiry, caused an error", e); } catch (InterruptedException e) { Thread.interrupted(); break; } } }

Target:
public void run() { while (!Thread.interrupted()) { try { Lease lease = leaseMaintainer.getCurrentLease(); if (!(lease instanceof NullLease)) { boolean validLease = lease.isValidAndContiguous(lease); if (!validLease) { try { connection.close(); } catch (IllegalStateException e) { } return; } } timeSource.sleep(200L); } catch (IOException e) { LOGGER.error("Closing connection, due to lease expiry, caused an error", e); } catch (InterruptedException e) { Thread.interrupted(); return; } } }
Source:
public static EList<Expression> getOrderedExpressions(List<Argument> arguments, Operation operation) { Expression[] result = new Expression[arguments.size()]; for (int index = 0; index < arguments.size(); index++) { Argument argument = arguments.get(index); if (argument.getParameter() == null) result[index] = argument.getValue(); else { for (Parameter param : operation.getParameters()) { if (param.getName().equals(argument.getParameter().getName())) { result[operation.getParameters().indexOf(param)] = argument.getValue(); break; } } } } EList<Expression> resultAsList = new BasicEList<Expression>(); for (int i = 0; i < result.length; i++) { Expression expression = result[i]; if (expression != null) resultAsList.add(expression); } return resultAsList; }

Target:
public static EList<Expression> getOrderedExpressions(List<Argument> arguments, Operation operation) { Expression[] result = new Expression[arguments.size()]; for (int index = 0; index < arguments.size(); index++) { Argument argument = arguments.get(index); if (argument.getParameter() == null) result[index] = argument.getValue(); else { for (Parameter param : operation.getParameters()) { if (param.getName().equals(argument.getParameter().getName())) { int parameterIndex = operation.getParameters().indexOf(param); if (parameterIndex < result.length) result[parameterIndex] = argument.getValue(); break; } } } } EList<Expression> resultAsList = new BasicEList<Expression>(); for (int i = 0; i < result.length; i++) { Expression expression = result[i]; if (expression != null) resultAsList.add(expression); } return resultAsList; }
Source:
public void search() { OrmUtils.withinSession( sessionFactory, session -> { FullTextSession ftSession = Search.getFullTextSession( session ); FullTextSearchTarget<Book> searchTarget = ftSession.search( Book.class ); FullTextQuery<Book_Author_Score> query = ftSession.search( Book.class ) .query() .asProjection( searchTarget.projection().composite( Book_Author_Score::new, searchTarget.projection().composite( Book_Author::new, searchTarget.projection().object().toProjection(), searchTarget.projection().field( "author", String.class ).toProjection() ).toProjection(), searchTarget.projection().score().toProjection() ).toProjection() ) .predicate( f -> f.matchAll().toPredicate() ) .build(); backendMock.expectSearchProjection( Arrays.asList( Book.INDEX ), b -> { }, StubSearchWorkBehavior.of( 3L, Arrays.asList( Arrays.asList( StubBackendUtils.reference( Book.INDEX, "1" ), AUTHOR_4_3_2_1 ), 1.0F ), Arrays.asList( Arrays.asList( StubBackendUtils.reference( Book.INDEX, "2" ), AUTHOR_CIDER_HOUSE ), 1.0F ), Arrays.asList( Arrays.asList( StubBackendUtils.reference( Book.INDEX, "3" ), AUTHOR_AVENUE_OF_MYSTERIES ), 1.0F ) ) ); Assertions.assertThat( query.list() ).containsExactlyInAnyOrder( new Book_Author_Score( new Book_Author( session.get( Book.class, 1 ), AUTHOR_4_3_2_1 ), 1.0F ), new Book_Author_Score( new Book_Author( session.get( Book.class, 2 ), AUTHOR_CIDER_HOUSE ), 1.0F ), new Book_Author_Score( new Book_Author( session.get( Book.class, 3 ), AUTHOR_AVENUE_OF_MYSTERIES ), 1.0F ) ); } ); }

Target:
public void search() { OrmUtils.withinSession( sessionFactory, session -> { FullTextSession ftSession = Search.getFullTextSession( session ); FullTextSearchTarget<Book> searchTarget = ftSession.search( Book.class ); FullTextQuery<Book_Author_Score> query = ftSession.search( Book.class ) .query() .asProjection( searchTarget.projection().composite( Book_Author_Score::new, searchTarget.projection().composite( Book_Author::new, searchTarget.projection().object().toProjection(), searchTarget.projection().field( "author", String.class ).toProjection() ).toProjection(), searchTarget.projection().score().toProjection() ).toProjection() ) .predicate( f -> f.matchAll().toPredicate() ) .build(); backendMock.expectSearchProjection( Arrays.asList( Book.INDEX ), b -> { }, StubSearchWorkBehavior.of( 3L, Arrays.asList( Arrays.asList( StubBackendUtils.reference( Book.INDEX, "1" ), AUTHOR_4_3_2_1 ), 4.0F ), Arrays.asList( Arrays.asList( StubBackendUtils.reference( Book.INDEX, "2" ), AUTHOR_CIDER_HOUSE ), 5.0F ), Arrays.asList( Arrays.asList( StubBackendUtils.reference( Book.INDEX, "3" ), AUTHOR_AVENUE_OF_MYSTERIES ), 6.0F ) ) ); Assertions.assertThat( query.list() ).containsExactlyInAnyOrder( new Book_Author_Score( new Book_Author( session.get( Book.class, 1 ), AUTHOR_4_3_2_1 ), 4.0F ), new Book_Author_Score( new Book_Author( session.get( Book.class, 2 ), AUTHOR_CIDER_HOUSE ), 5.0F ), new Book_Author_Score( new Book_Author( session.get( Book.class, 3 ), AUTHOR_AVENUE_OF_MYSTERIES ), 6.0F ) ); } ); }
Source:
public static List<CellReference> candidateCells(LockDescriptor lockDescriptor) { Optional<TableRefAndRemainder> tableRefAndRemainder = tryParseTableRef(lockDescriptor); if (!tableRefAndRemainder.isPresent()) { return ImmutableList.of(); } TableReference tableRef = tableRefAndRemainder.get().tableRef(); ByteString remainingBytes = tableRefAndRemainder.get().remainder(); int lookupFrom = 0; int nextCandidate; List<Cell> cells = new ArrayList<>(); while ((nextCandidate = remainingBytes.indexOf(ZERO_ARRAY, lookupFrom)) != -1) { if (nextCandidate > 0 && nextCandidate < remainingBytes.size() - 2) { byte[] row = remainingBytes.substring(0, nextCandidate).toByteArray(); byte[] col = remainingBytes.substring(nextCandidate + 1, remainingBytes.size()).toByteArray(); cells.add(Cell.create(row, col)); } lookupFrom = nextCandidate + 1; } return cells.stream().map(cell -> CellReference.of(tableRef, cell)).collect(Collectors.toList()); }

Target:
public static List<CellReference> candidateCells(LockDescriptor lockDescriptor) { Optional<TableRefAndRemainder> tableRefAndRemainder = tryParseTableRef(lockDescriptor); if (!tableRefAndRemainder.isPresent()) { return ImmutableList.of(); } TableReference tableRef = tableRefAndRemainder.get().tableRef(); ByteString remainingBytes = tableRefAndRemainder.get().remainder(); return IntStream.range(1, remainingBytes.size() - 2) .filter(index -> isZeroDelimiterIndex(remainingBytes, index)) .mapToObj(index -> createCellFromByteString(remainingBytes, index)) .map(cell -> CellReference.of(tableRef, cell)) .collect(Collectors.toList()); }
Source:
public <T> void addToCache(TenantIdKey key, T entry) { PrivilegedCarbonContext.startTenantFlow(); try { PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); carbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID); carbonContext.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); clearCacheEntry(key); Cache<TenantIdKey, T> cache = getTenantCache(); if (cache != null) { cache.put(key, entry); log.debug(TENANT_CACHE + " which is under " + TENANT_CACHE_MANAGER + ", added the entry : " + entry + " for the key : " + key + " successfully"); } else { if (log.isDebugEnabled()) { log.debug("Error while getting the cache : " + TENANT_CACHE + " which is under " + TENANT_CACHE_MANAGER); } } } finally { PrivilegedCarbonContext.endTenantFlow(); } }

Target:
public <T> void addToCache(TenantIdKey key, T entry) { PrivilegedCarbonContext.startTenantFlow(); try { PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); carbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID); carbonContext.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); clearCacheEntry(key); Cache<TenantIdKey, T> cache = getTenantCache(); if (cache != null) { cache.put(key, entry); if (log.isDebugEnabled()) { log.debug(TENANT_CACHE + " which is under " + TENANT_CACHE_MANAGER + ", added the entry : " + entry + " for the key : " + key + " successfully"); } } else { if (log.isDebugEnabled()) { log.debug("Error while getting the cache : " + TENANT_CACHE + " which is under " + TENANT_CACHE_MANAGER); } } } finally { PrivilegedCarbonContext.endTenantFlow(); } }
Source:
public void testNoneStrategyWithStreams() { String fakedStream1 = "fakedstream1"; String fakedStream2 = "fakedstream2"; List<String> streams = new ArrayList<>(); streams.add(fakedStream1); streams.add(fakedStream2); Properties testConfig = TestUtils.getStandardProperties(); testConfig.setProperty(ConsumerConfigConstants.RECORD_PUBLISHER_TYPE, RecordPublisherType.EFO.toString()); testConfig.setProperty(ConsumerConfigConstants.EFO_REGISTRATION_TYPE, EFORegistrationType.NONE.toString()); streams.forEach( stream -> testConfig.setProperty(ConsumerConfigConstants.EFO_CONSUMER_ARN_PREFIX + "." + stream, stream) ); FanOutProperties fanOutProperties = new FanOutProperties(testConfig, streams); assertEquals(fanOutProperties.getStreamConsumerArns(), streams); }

Target:
public void testNoneStrategyWithStreams() { List<String> streams = Arrays.asList("fakedstream1", "fakedstream2"); Properties testConfig = TestUtils.getStandardProperties(); testConfig.setProperty(ConsumerConfigConstants.RECORD_PUBLISHER_TYPE, RecordPublisherType.EFO.toString()); testConfig.setProperty(ConsumerConfigConstants.EFO_REGISTRATION_TYPE, EFORegistrationType.NONE.toString()); streams.forEach( stream -> testConfig.setProperty(ConsumerConfigConstants.EFO_CONSUMER_ARN_PREFIX + "." + stream, stream) ); FanOutProperties fanOutProperties = new FanOutProperties(testConfig, streams); Map<String, String> expectedStreamArns = new HashMap<>(); expectedStreamArns.put("fakedstream1", "fakedstream1"); expectedStreamArns.put("fakedstream2", "fakedstream2"); assertEquals(fanOutProperties.getStreamConsumerArn("fakedstream1"), Optional.of("fakedstream1")); assertEquals(fanOutProperties.getStreamConsumerArns(), Optional.of(expectedStreamArns)); }
Source:
public void shouldGenerateEntityProxy() throws SecurityException, NoSuchMethodException { Class<?> proxyClass = EmployeeProxy.class; ProxyFor proxyAnnotation = EmployeeProxy.class.getAnnotation(ProxyFor.class); proxyClass.getMethod("getDisplayName"); proxyClass.getMethod("getSupervisorKey"); proxyClass.getMethod("getId"); proxyClass.getMethod("getSupervisor"); proxyClass.getMethod("setSupervisorKey", Long.class); proxyClass.getMethod("setSupervisor", EmployeeProxy.class); proxyClass.getMethod("setVersion", Integer.class); proxyClass.getMethod("stableId"); boolean filteredFields = false; try { proxyClass.getMethod("setId", Long.class); proxyClass.getMethod("getVersion", Long.class); } catch (NoSuchMethodException e) { filteredFields = true; } assertTrue(EntityProxy.class.isAssignableFrom(EmployeeProxy.class)); assertTrue(filteredFields); assertEquals(proxyAnnotation.value(), Employee.class); assertEquals(proxyAnnotation.locator(), EmployeeLocator.class); }

Target:
public void shouldGenerateEntityProxy() throws SecurityException, NoSuchMethodException { Class<?> proxyClass = EmployeeProxy.class; ProxyFor proxyAnnotation = EmployeeProxy.class.getAnnotation(ProxyFor.class); proxyClass.getMethod("getDisplayName"); proxyClass.getMethod("getSupervisorKey"); proxyClass.getMethod("getId"); proxyClass.getMethod("getSupervisor"); proxyClass.getMethod("setSupervisorKey", Long.class); proxyClass.getMethod("setSupervisor", EmployeeProxy.class); proxyClass.getMethod("setVersion", Integer.class); proxyClass.getMethod("stableId"); boolean filteredFieldsWereNotGenerated = false; try { proxyClass.getMethod("setId", Long.class); proxyClass.getMethod("getVersion", Long.class); } catch (NoSuchMethodException e) { filteredFieldsWereNotGenerated = true; } assertTrue(filteredFieldsWereNotGenerated); assertTrue(EntityProxy.class.isAssignableFrom(EmployeeProxy.class)); assertEquals(proxyAnnotation.value(), Employee.class); assertEquals(proxyAnnotation.locator(), EmployeeLocator.class); }
Source:
public Value get( String fieldName ) { if( current == null ) { throw new ClientException( "The current record is null. " + "It is either because the result contains no more record, or the record has not been set. " + "You could call `next()` to test if there are more records in this result " + "and/or to iterate over result records." ); } Value value = current.get( fieldName ); if( value == null ) { throw new ValueNotFoundException( fieldName ); } else { return value; } }

Target:
public Value get( String fieldName ) { if( current == null ) { throw new ClientException( "In order to access fields of a record in a result, " + "you must first call next() to point the result to the next record in the result stream." ); } return current.get( fieldName ); }
Source:
public QuotaManager(FrontendConfig frontendConfig) { try { quota = new JSONObject(frontendConfig.restRequestQuota); } catch (JSONException ex) { throw new IllegalStateException("Invalid config value: " + frontendConfig.restRequestQuota, ex); } for (RestMethod restMethod : RestMethod.values()) { quotaMap.put(restMethod, new RejectThrottler(quota.getInt(restMethod.name()))); } }

Target:
public QuotaManager(FrontendConfig frontendConfig) { JSONObject quota = new JSONObject(frontendConfig.restRequestQuota); quotaMap = new HashMap<>(); for (RestMethod restMethod : RestMethod.values()) { quotaMap.put(restMethod, new RejectThrottler(quota.optInt(restMethod.name(), -1))); } }
Source:
private void rematchAllNetworksAndRequests() { final long now = SystemClock.elapsedRealtime(); final NetworkReassignment changes = computeNetworkReassignment(); if (VDBG || DDBG) log(changes.toString()); applyNetworkReassignment(changes, oldDefaultNetwork, now); }

Target:
private void rematchAllNetworksAndRequests() { final long now = SystemClock.elapsedRealtime(); final NetworkReassignment changes = computeNetworkReassignment(); if (VDBG || DDBG) log(changes.toString()); applyNetworkReassignment(changes, now); }
Source:
public ItemUseHandler getItemHandler() { return e -> { Optional<Block> block = e.getClickedBlock(); if (block.isPresent()) { if (!block.get().getType().isInteractable()) { e.cancel(); } } else { e.cancel(); } }; }

Target:
public ItemUseHandler getItemHandler() { return e -> { Optional<Block> block = e.getClickedBlock(); if (!block.isPresent() || !block.get().getType().isInteractable()) { e.cancel(); } }; }
Source:
public DynamicSourcesWorkingSetUpdater() { fUpdateJob= new Job(WorkingSetMessages.JavaSourcesWorkingSets_updating) { @Override protected IStatus run(IProgressMonitor monitor) { return updateElements(monitor); } }; fUpdateUIJob = new UpdateUIJob(); fUpdateJob.setSystem(true); fResourceChangeListener= new ResourceChangeListener(); ResourcesPlugin.getWorkspace().addResourceChangeListener(fResourceChangeListener, IResourceChangeEvent.POST_CHANGE); fJavaElementChangeListener= new JavaElementChangeListener(); JavaCore.addElementChangedListener(fJavaElementChangeListener, ElementChangedEvent.POST_CHANGE); }

Target:
public DynamicSourcesWorkingSetUpdater() { fResourceChangeListener= new ResourceChangeListener(); ResourcesPlugin.getWorkspace().addResourceChangeListener(fResourceChangeListener, IResourceChangeEvent.POST_CHANGE); fJavaElementChangeListener= new JavaElementChangeListener(); JavaCore.addElementChangedListener(fJavaElementChangeListener, ElementChangedEvent.POST_CHANGE); }
Source:
protected void run() throws Exception { if (createBranch) { final ObjectId head = db.resolve(Constants.HEAD); if (head == null) throw die(CLIText.get().onBranchToBeBorn); } CheckoutCommand command = new Git(db).checkout(); command.setCreateBranch(createBranch); command.setName(name); command.setForce(force); try { String oldBranch = db.getBranch(); Ref ref = command.call(); if (ref == null) return; if (Repository.shortenRefName(ref.getName()).equals(oldBranch)) { outw.println(MessageFormat.format( CLIText.get().alreadyOnBranch, name)); return; } if (createBranch) outw.println(MessageFormat.format( CLIText.get().switchedToNewBranch, Repository.shortenRefName(ref.getName()))); else outw.println(MessageFormat.format( CLIText.get().switchedToBranch, Repository.shortenRefName(ref.getName()))); } catch (RefNotFoundException e) { outw.println(MessageFormat.format( CLIText.get().pathspecDidNotMatch, name)); } catch (RefAlreadyExistsException e) { throw die(MessageFormat.format(CLIText.get().branchAlreadyExists, name)); } catch (CheckoutConflictException e) { outw.println(MessageFormat.format(CLIText.get().checkoutConflict, name)); } }

Target:
protected void run() throws Exception { if (createBranch) { final ObjectId head = db.resolve(Constants.HEAD); if (head == null) throw die(CLIText.get().onBranchToBeBorn); } CheckoutCommand command = new Git(db).checkout(); command.setCreateBranch(createBranch); command.setName(name); command.setForce(force); try { String oldBranch = db.getBranch(); Ref ref = command.call(); if (ref == null) return; if (Repository.shortenRefName(ref.getName()).equals(oldBranch)) { outw.println(MessageFormat.format( CLIText.get().alreadyOnBranch, name)); return; } if (createBranch) outw.println(MessageFormat.format( CLIText.get().switchedToNewBranch, Repository.shortenRefName(ref.getName()))); else outw.println(MessageFormat.format( CLIText.get().switchedToBranch, Repository.shortenRefName(ref.getName()))); } catch (RefNotFoundException e) { outw.println(MessageFormat.format( CLIText.get().pathspecDidNotMatch, name)); } catch (RefAlreadyExistsException e) { throw die(MessageFormat.format(CLIText.get().branchAlreadyExists, name)); } catch (CheckoutConflictException e) { outw.println(CLIText.get().checkoutConflict); for (String path : e.getConflictingPaths()) outw.println(MessageFormat.format( CLIText.get().checkoutConflictPathLine, path)); } }
Source:
public void testAssignExecutorInvalidExecutor() throws Exception { final ExecutableFlow flow = TestUtils.createExecutableFlow("exectest1", "exec1"); this.executionFlowDao.uploadExecutableFlow(flow); assertThatThrownBy( () -> this.assignExecutor.assignExecutor(flow.getExecutionId(), 1)) .isInstanceOf(ExecutorManagerException.class) .hasMessageContaining("non-existent executor"); }

Target:
public void testAssignExecutorInvalidExecutor() throws Exception { final ExecutableFlow flow = TestUtils.createExecutableFlow("exectest1", "exec1"); this.executionFlowDao.uploadExecutableFlow(flow); assertThatThrownBy( () -> this.assignExecutor.assignExecutor(1, flow.getExecutionId())) .isInstanceOf(ExecutorManagerException.class) .hasMessageContaining("non-existent executor"); }
Source:
public void test() throws Exception { URI uri = new URI("<LINK_0>"); UserTuneElement.Builder builder = UserTuneElement.getBuilder(); UserTuneElement userTuneElement1 = builder.setArtist("Yes") .setLength(686) .setRating(8) .setSource("Yessongs") .setTitle("Heart of the Sunrise") .setTrack(3) .setUri(uri) .build(); IntegrationTestRosterUtil.ensureBothAccountsAreSubscribedToEachOther(conOne, conTwo, timeout); final SimpleResultSyncPoint userTuneReceived = new SimpleResultSyncPoint(); final UserTuneListener userTuneListener = new UserTuneListener() { @Override public void onUserTuneUpdated(BareJid jid, Message message, UserTuneElement userTuneElement) { if (isEqual(userTuneElement,userTuneElement1)) { userTuneReceived.signal(); } } }; utm2.addUserTuneListener(userTuneListener); try { utm1.publishUserTune(userTuneElement1); userTuneReceived.waitForResult(timeout); } finally { utm2.removeUserTuneListener(userTuneListener); } }

Target:
public void test() throws Exception { URI uri = new URI("<LINK_0>"); UserTuneElement.Builder builder = UserTuneElement.getBuilder(); UserTuneElement userTuneElement1 = builder.setArtist("Yes") .setLength(686) .setRating(8) .setSource("Yessongs") .setTitle("Heart of the Sunrise") .setTrack("3") .setUri(uri) .build(); IntegrationTestRosterUtil.ensureBothAccountsAreSubscribedToEachOther(conOne, conTwo, timeout); final SimpleResultSyncPoint userTuneReceived = new SimpleResultSyncPoint(); final UserTuneListener userTuneListener = new UserTuneListener() { @Override public void onUserTuneUpdated(BareJid jid, Message message, UserTuneElement userTuneElement) { if (userTuneElement.equals(userTuneElement1)) { userTuneReceived.signal(); } } }; utm2.addUserTuneListener(userTuneListener); try { utm1.publishUserTune(userTuneElement1); userTuneReceived.waitForResult(timeout); } finally { utm2.removeUserTuneListener(userTuneListener); } }
Source:
public PDOMCPPMemberBlock(PDOMLinkage linkage) throws CoreException { Database db = linkage.getDB(); this.linkage = linkage; this.record = db.malloc(RECORD_SIZE); db.clearBytes(record, RECORD_SIZE); updateNextPosition(); }

Target:
public PDOMCPPMemberBlock(PDOMLinkage linkage) throws CoreException { Database db = linkage.getDB(); this.linkage = linkage; this.record = db.malloc(RECORD_SIZE); db.clearBytes(record, RECORD_SIZE); }
Source:
private Map<Account.Id, AccountGroupMember> getMembers( final AccountGroup.Id groupId) throws OrmException, NoSuchGroupException { final Map<Account.Id, AccountGroupMember> memberMap = Maps.newHashMap(); final List<AccountGroupMember> members = db.accountGroupMembers().byGroup(groupId).toList(); for (final AccountGroupMember m : members) { memberMap.put(m.getAccountId(), m); } return memberMap; }

Target:
private Map<Account.Id, AccountGroupMember> getMembers( final AccountGroup.Id groupId) throws OrmException, NoSuchGroupException { final Map<Account.Id, AccountGroupMember> members = Maps.newHashMap(); for (final AccountGroupMember m : db.accountGroupMembers().byGroup(groupId)) { members.put(m.getAccountId(), m); } return members; }
Source:
public TimeLockStatus getStatus() { if (healthCheckSupplier != null) { return healthCheckSupplier.get().getStatus(); } else { return TimeLockStatus.NO_QUORUM; } }

Target:
public TimeLockStatus getStatus() { return healthCheckSupplier.get().getStatus(); }