auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
StoredWorkflowDefinition convert(WorkflowDefinition<? extends WorkflowState> definition) { StoredWorkflowDefinition resp = new StoredWorkflowDefinition(); resp.type = definition.getType(); resp.description = definition.getDescription(); resp.onError = definition.getErrorState().name(); Map<String, StoredWorkflowDefinition.State> states = new LinkedHashMap<>(); for (WorkflowState state : definition.getStates()) { states.put(state.name(), new StoredWorkflowDefinition.State(state.name(), state.getType().name(), state.getDescription())); } for (Entry<String, List<String>> entry : definition.getAllowedTransitions().entrySet()) { StoredWorkflowDefinition.State state = states.get(entry.getKey()); for (String targetState : entry.getValue()) { state.transitions.add(targetState); } sort(state.transitions); } for (Entry<String, WorkflowState> entry : definition.getFailureTransitions().entrySet()) { StoredWorkflowDefinition.State state = states.get(entry.getKey()); state.onFailure = entry.getValue().name(); } List<StoredWorkflowDefinition.State> sortedStates = new ArrayList<>(states.values()); sort(sortedStates, new Comparator<StoredWorkflowDefinition.State>() { @Override public int compare(State state, State otherState) { return state.type.compareTo(otherState.type); } }); resp.states = sortedStates; return resp; }

Target:
StoredWorkflowDefinition convert(WorkflowDefinition<? extends WorkflowState> definition) { StoredWorkflowDefinition resp = new StoredWorkflowDefinition(); resp.type = definition.getType(); resp.description = definition.getDescription(); resp.onError = definition.getErrorState().name(); Map<String, StoredWorkflowDefinition.State> states = new HashMap<>(); for (WorkflowState state : definition.getStates()) { states.put(state.name(), new StoredWorkflowDefinition.State(state.name(), state.getType().name(), state.getDescription())); } for (Entry<String, List<String>> entry : definition.getAllowedTransitions().entrySet()) { StoredWorkflowDefinition.State state = states.get(entry.getKey()); for (String targetState : entry.getValue()) { state.transitions.add(targetState); } sort(state.transitions); } for (Entry<String, WorkflowState> entry : definition.getFailureTransitions().entrySet()) { StoredWorkflowDefinition.State state = states.get(entry.getKey()); state.onFailure = entry.getValue().name(); } resp.states = new ArrayList<>(states.values()); sort(resp.states); return resp; }
Source:
private void updateViewVisibilityIfCollaboratorsFound() { TextView noCollaborators = (TextView) findViewById(R.id.no_collaborators_text); noCollaborators.setVisibility(GONE); LinearLayout layout = (LinearLayout) findViewById(R.id.invite_collaborator_initials_list); layout.setVisibility(VISIBLE); }

Target:
private void updateViewVisibilityIfCollaboratorsFound() { TextView noCollaborators = (TextView) findViewById(R.id.no_collaborators_text); noCollaborators.setVisibility(GONE); mInitialsListView.setVisibility(VISIBLE); }
Source:
public OsiamLdapUserDetailsImpl synchronizeLdapData(DirContextOperations ldapUserData, OsiamLdapUserDetailsImpl ldapUser) { String userName = ldapUserData.getStringAttribute(scimLdapAttributes.get("userName")); User user = userDetailsService.getUserByUsername(userName); boolean userExists = user != null; if (userExists && (!user.isExtensionPresent(LdapConfiguration.AUTH_EXTENSION) || !user.getExtension(LdapConfiguration.AUTH_EXTENSION).isFieldPresent("origin") || !user.getExtension(LdapConfiguration.AUTH_EXTENSION).getFieldAsString("origin") .equals(LdapConfiguration.LDAP_PROVIDER))) { throw new LdapAuthenticationProcessException("Can't create the '" + LdapConfiguration.LDAP_PROVIDER + "' user with the username '" + userName + "'. An internal user with the same username exists."); } if (!userExists) { user = osiamLdapUserContextMapper.mapUser(ldapUserData); user = userDetailsService.createUser(user); } else if (syncUserData && userExists) { UpdateUser updateUser = osiamLdapUserContextMapper.mapUpdateUser(user, ldapUserData); user = userDetailsService.updateUser(user.getId(), updateUser); } ldapUser.setId(user.getId()); return ldapUser; }

Target:
private OsiamLdapUserDetailsImpl synchronizeLdapData(DirContextOperations ldapUserData, OsiamLdapUserDetailsImpl ldapUser) { String userName = ldapUserData.getStringAttribute(scimLdapAttributes.get("userName")); User user = userDetailsService.getUserByUsername(userName); boolean userExists = user != null; if (userExists && !hasAuthServerExtension(user)) { throw new LdapAuthenticationProcessException("Can't create the '" + LdapConfiguration.LDAP_PROVIDER + "' user with the username '" + userName + "'. An internal user with the same username exists."); } if (!userExists) { user = osiamLdapUserContextMapper.mapUser(ldapUserData); user = userDetailsService.createUser(user); } else if (syncUserData && userExists) { UpdateUser updateUser = osiamLdapUserContextMapper.mapUpdateUser(user, ldapUserData); user = userDetailsService.updateUser(user.getId(), updateUser); } ldapUser.setId(user.getId()); return ldapUser; }
Source:
private Collection<Policy> toPolicy(String tenant, Set<String> subjects) { Collection<Policy> policies = new ArrayList<Policy>(); for (String subject : subjects) { LOGGER.debug("Getting policies for subject [" + subject + "]"); policies.addAll(dao.getPolicies(tenant, subject)); } return policies; }

Target:
private Collection<Policy> toPolicy(String tenant, Set<String> subjects) { Collection<Policy> policies = new ArrayList<Policy>(); for (String subject : subjects) { LOGGER.debug("Getting policies for subject [{}]", subject); policies.addAll(dao.getPolicies(tenant, subject)); } return policies; }
Source:
public void findIndexMatches(Index index, IProgressMonitor monitor, final IIndexRequestor requestor) { final IPath path = index.getPath(); final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); List<QueryResult> list = index.query( new String[] { IQ7IndexConstants.WS_LINK_REF }, new IKeyQuery() { public boolean accept(String key, String value) { if (linksFilterPaths == null) { return true; } IPath path = new Path(value); return linksFilterPaths.contains(path) ? true : false; } }, monitor); for (QueryResult queryResult : list) { Path fullPath = new Path(queryResult.path); IResource res = root.findMember(path.append(fullPath)); if (res.exists()) { IQ7Element q7Element = RcpttCore.create(res); requestor.acceptMatch(q7Element, queryResult.key, queryResult.value); } } }

Target:
public void findIndexMatches(Index index, IProgressMonitor monitor, final IIndexRequestor requestor) { final IPath path = index.getPath(); final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); List<QueryResult> list = index.query( new String[] { IQ7IndexConstants.WS_LINK_REF }, new IKeyQuery() { public boolean accept(String key, String value) { if (linksFilterPaths.isEmpty()) { return true; } IPath path = new Path(value); return linksFilterPaths.contains(path) ? true : false; } }, monitor); for (QueryResult queryResult : list) { Path fullPath = new Path(queryResult.path); IResource res = root.findMember(path.append(fullPath)); if (res.exists()) { IQ7Element q7Element = RcpttCore.create(res); requestor.acceptMatch(q7Element, queryResult.key, queryResult.value); } } }
Source:
public static void main(String[] args) { String connectionString = System.getenv("AZURE_SERVICEBUS_CONNECTION_STRING"); ServiceBusSenderAsyncClient senderAsyncClient = new ServiceBusClientBuilder() .connectionString(connectionString) .sender() .queueName("<< QUEUE NAME >>") .buildAsyncClient(); ServiceBusMessage message = new ServiceBusMessage("Hello World!!".getBytes(UTF_8)); senderAsyncClient.scheduleMessage(message, Instant.now().plusSeconds(1 * 60L)) .subscribe(aLong -> { System.out.println("!! After schedule message sequence : " + aLong); }); try { Thread.sleep(Duration.ofSeconds(20).toMillis()); } catch (InterruptedException ignored) { } }

Target:
public static void main(String[] args) { String connectionString = System.getenv("AZURE_SERVICEBUS_CONNECTION_STRING"); ServiceBusSenderAsyncClient senderAsyncClient = new ServiceBusClientBuilder() .connectionString(connectionString) .sender() .queueName("<< QUEUE NAME >>") .buildAsyncClient(); ServiceBusMessage message = new ServiceBusMessage("Hello World!!".getBytes(UTF_8)); senderAsyncClient.scheduleMessage(message, Instant.now().plusSeconds(60)) .subscribe(); try { Thread.sleep(Duration.ofSeconds(20).toMillis()); } catch (InterruptedException ignored) { } }
Source:
protected boolean isUnavailable(T size) { return size == null || size.longValue() == -1; }

Target:
protected boolean isUnavailable(T size) { return size == null || size.longValue() == StorageConstants.SIZE_IS_NOT_AVAILABLE; }
Source:
public ResponseEntity addOrUpdateRepository(@ApiParam(value = "The storageId", required = true) @PathVariable String storageId, @ApiParam(value = "The repositoryId", required = true) @PathVariable String repositoryId, @ApiParam(value = "The repository object", required = true) @RequestBody @Validated RepositoryForm repositoryForm, BindingResult bindingResult, @RequestHeader(HttpHeaders.ACCEPT) String accept) { if (bindingResult.hasErrors()) { throw new RequestBodyValidationException(FAILED_SAVE_REPOSITORY, bindingResult); } try { MutableRepository repository = conversionService.convert(repositoryForm, MutableRepository.class); logger.debug("Creating repository " + storageId + ":" + repositoryId + "..."); configurationManagementService.saveRepository(storageId, repository); if (repository != null && RepositoryTypeEnum.PROXY.getType().equals(repository.getType())) { proxyRepositoryConnectionPoolConfigurationService.setMaxPerRepository( repository.getRemoteRepository() .getUrl(), repository.getHttpConnectionPool().getAllocatedConnections()); } final RepositoryPath repositoryPath = repositoryPathResolver.resolve(new Repository(repository)); if (!Files.exists(repositoryPath)) { repositoryManagementService.createRepository(storageId, repository.getId()); } return getSuccessfulResponseEntity(SUCCESSFUL_REPOSITORY_SAVE, accept); } catch (IOException | ConfigurationException | RepositoryManagementStrategyException e) { logger.error(e.getMessage(), e); return getFailedResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR, FAILED_REPOSITORY_SAVE, accept); } }

Target:
public ResponseEntity addOrUpdateRepository(@ApiParam(value = "The storageId", required = true) @PathVariable String storageId, @ApiParam(value = "The repositoryId", required = true) @PathVariable String repositoryId, @ApiParam(value = "The repository object", required = true) @RequestBody @Validated RepositoryForm repositoryForm, BindingResult bindingResult, @RequestHeader(HttpHeaders.ACCEPT) String accept) { if (bindingResult.hasErrors()) { throw new RequestBodyValidationException(FAILED_SAVE_REPOSITORY, bindingResult); } try { MutableRepository repository = conversionService.convert(repositoryForm, MutableRepository.class); logger.debug("Creating repository " + storageId + ":" + repositoryId + "..."); configurationManagementService.saveRepository(storageId, repository); final RepositoryPath repositoryPath = repositoryPathResolver.resolve(new Repository(repository)); if (!Files.exists(repositoryPath)) { repositoryManagementService.createRepository(storageId, repository.getId()); } return getSuccessfulResponseEntity(SUCCESSFUL_REPOSITORY_SAVE, accept); } catch (IOException | ConfigurationException | RepositoryManagementStrategyException e) { logger.error(e.getMessage(), e); return getFailedResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR, FAILED_REPOSITORY_SAVE, accept); } }
Source:
public VdcActionParametersBase getParameters(VM incoming, org.ovirt.engine.core.common.businessentities.VM entity) { VmStatic updated = getMapper(modelType, VmStatic.class).map(incoming, entity.getStaticData()); VmManagementParametersBase params = new VmManagementParametersBase(updated); if (incoming.isSetVmPayloads()) { if (incoming.getVmPayloads().getVmPayload().get(0).isSetType()) { VmDeviceType deviceType = VmDeviceType.fromValue(incoming.getVmPayloads().getVmPayload().get(0).getType()); if (deviceType != null) { org.ovirt.engine.core.common.businessentities.VmPayload vmPayload = new org.ovirt.engine.core.common.businessentities.VmPayload(org.ovirt.engine.api.restapi.types.VmMapper.map(deviceType, null), incoming.getVmPayloads().getVmPayload().get(0).getFile().getName(), incoming.getVmPayloads() .getVmPayload() .get(0) .getFile() .getContent()); params.setVmPayload(vmPayload); } } } return params; }

Target:
public VdcActionParametersBase getParameters(VM incoming, org.ovirt.engine.core.common.businessentities.VM entity) { VmStatic updated = getMapper(modelType, VmStatic.class).map(incoming, entity.getStaticData()); VmManagementParametersBase params = new VmManagementParametersBase(updated); if (incoming.isSetVmPayloads()) { params.setVmPayload(getMapper(VmPayloads.class, org.ovirt.engine.core.common.businessentities.VmPayload.class).map(incoming.getVmPayloads(), new org.ovirt.engine.core.common.businessentities.VmPayload())); } return params; }
Source:
public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { int startingLeaderGen = coordinator.getLeaderGeneration(); CoordinatorStats stats = new CoordinatorStats(); DruidCluster cluster = params.getDruidCluster(); if (cluster.isEmpty()) { log.warn("Uh... I have no servers. Not assigning anything..."); return params; } for (String tier : cluster.getTierNames()) { replicatorThrottler.updateReplicationState(tier); replicatorThrottler.updateTerminationState(tier); } DruidCoordinatorRuntimeParams paramsWithReplicationManager = params.buildFromExisting() .withReplicationManager(replicatorThrottler) .build(); DateTime now = new DateTime(); DatabaseRuleManager databaseRuleManager = paramsWithReplicationManager.getDatabaseRuleManager(); for (DataSegment segment : paramsWithReplicationManager.getAvailableSegments()) { List<Rule> rules = databaseRuleManager.getRulesWithDefault(segment.getDataSource()); boolean foundMatchingRule = false; for (Rule rule : rules) { if (rule.appliesTo(segment, now)) { if (coordinator.getLeaderGeneration() == startingLeaderGen) { stats.accumulate(rule.run(coordinator, paramsWithReplicationManager, segment)); } foundMatchingRule = true; break; } } if (!foundMatchingRule) { log.makeAlert( "Unable to find a matching rule for dataSource[%s]", segment.getDataSource() ) .addData("segment", segment.getIdentifier()) .emit(); } } return paramsWithReplicationManager.buildFromExisting() .withCoordinatorStats(stats) .build(); }

Target:
public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { CoordinatorStats stats = new CoordinatorStats(); DruidCluster cluster = params.getDruidCluster(); if (cluster.isEmpty()) { log.warn("Uh... I have no servers. Not assigning anything..."); return params; } for (String tier : cluster.getTierNames()) { replicatorThrottler.updateReplicationState(tier); replicatorThrottler.updateTerminationState(tier); } DruidCoordinatorRuntimeParams paramsWithReplicationManager = params.buildFromExisting() .withReplicationManager(replicatorThrottler) .build(); DateTime now = new DateTime(); DatabaseRuleManager databaseRuleManager = paramsWithReplicationManager.getDatabaseRuleManager(); for (DataSegment segment : paramsWithReplicationManager.getAvailableSegments()) { List<Rule> rules = databaseRuleManager.getRulesWithDefault(segment.getDataSource()); if (!coordinator.isValidRun()) { throw new ISE("Leader change occurred during rule run. Bailing out."); } boolean foundMatchingRule = false; for (Rule rule : rules) { if (rule.appliesTo(segment, now)) { stats.accumulate(rule.run(coordinator, paramsWithReplicationManager, segment)); foundMatchingRule = true; break; } } if (!foundMatchingRule) { log.makeAlert( "Unable to find a matching rule for dataSource[%s]", segment.getDataSource() ) .addData("segment", segment.getIdentifier()) .emit(); } } return paramsWithReplicationManager.buildFromExisting() .withCoordinatorStats(stats) .build(); }
Source:
public String replaceIllegalCharacters(String name) { if (generationConfig.isAllowNonLatinNames()) { return name; } else { return name.replaceAll(ILLEGAL_CHARACTER_REGEX, "_"); } }

Target:
public String replaceIllegalCharacters(String name) { if (generationConfig.isAllowNonLatinNames()) { return validJavaIdentifierFrom(name); } else { return name.replaceAll(ILLEGAL_CHARACTER_REGEX, "_"); } }
Source:
public String getDocumentPartitioning() { if(fReconcilers.size() == 0) return null; String firstPartitioning = ((IReconcilerExtension)fReconcilers.get(0)).getDocumentPartitioning(); if(!(firstPartitioning == null || firstPartitioning.equals(IDocumentExtension3.DEFAULT_PARTITIONING))){ return firstPartitioning; } for (IReconciler iReconciler : fReconcilers) { if(iReconciler instanceof IReconcilerExtension) { String partitioning = ((IReconcilerExtension)iReconciler).getDocumentPartitioning(); if(partitioning != firstPartitioning) { return partitioning; } } } return firstPartitioning; }

Target:
public String getDocumentPartitioning() { if(fReconcilers.size() == 0) return null; String firstPartitioning = ((IReconcilerExtension)fReconcilers.get(0)).getDocumentPartitioning(); if(!(firstPartitioning == null || firstPartitioning.equals(IDocumentExtension3.DEFAULT_PARTITIONING))){ return firstPartitioning; } boolean allSame = true; for (IReconciler iReconciler : fReconcilers) { if(iReconciler instanceof IReconcilerExtension) { String partitioning = ((IReconcilerExtension)iReconciler).getDocumentPartitioning(); if(allSame && partitioning != firstPartitioning) { allSame = false; } if(!allSame && !(partitioning == null || partitioning.equals(IDocumentExtension3.DEFAULT_PARTITIONING))){ return partitioning; } } } return firstPartitioning; }
Source:
public void testAddNewRelationship_noIndex() throws Exception { final Node diagram = createNode(CaseManagementDiagram.class); final Node start = createNode(StartNoneEvent.class); final Node end = createNode(EndNoneEvent.class); final Node stage = createNode(AdHocSubprocess.class); final Node candidate = createNode(AdHocSubprocess.class); createChildEdge(diagram, start); createChildEdge(diagram, stage); createChildEdge(diagram, end); createSequenceFlow(start, stage); final Edge edge = createSequenceFlow(stage, end); final CaseManagementSetChildNodeGraphCommand command = new CaseManagementSetChildNodeGraphCommand(diagram, candidate, OptionalInt.empty(), Optional.of(diagram), originalIndex); command.addNewRelationship(context); assertTrue(command.in.isPresent()); assertEquals(stage, command.in.get()); assertTrue(command.out.isPresent()); assertEquals(end, command.out.get()); assertTrue(command.edge.isPresent()); assertEquals(edge, command.edge.get()); assertEquals(candidate, ((Edge) diagram.getOutEdges().get(2)).getTargetNode()); assertEquals(candidate, ((Edge) stage.getOutEdges().get(0)).getTargetNode()); assertEquals(1, end.getInEdges().stream().filter(sequencePredicate()).count()); assertEquals(candidate, ((List) end.getInEdges().stream().filter(sequencePredicate()) .map(e -> ((Edge) e).getSourceNode()).collect(Collectors.toList())).get(0)); }

Target:
public void testAddNewRelationship_noIndex() { final Node diagram = createNode(CaseManagementDiagram.class); final Node start = createNode(StartNoneEvent.class); final Node end = createNode(EndNoneEvent.class); final Node stage = createNode(AdHocSubprocess.class); final Node candidate = createNode(AdHocSubprocess.class); createChildEdge(diagram, start); createChildEdge(diagram, stage); createChildEdge(diagram, end); createSequenceFlow(start, stage); final Edge edge = createSequenceFlow(stage, end); final CaseManagementSetChildNodeGraphCommand command = new CaseManagementSetChildNodeGraphCommand(diagram, candidate, OptionalInt.empty(), Optional.of(diagram), originalIndex); command.addNewRelationship(context); assertTrue(command.in.isPresent()); assertEquals(stage, command.in.get()); assertTrue(command.out.isPresent()); assertEquals(end, command.out.get()); assertTrue(command.edge.isPresent()); assertEquals(edge, command.edge.get()); assertEquals(candidate, ((Edge) diagram.getOutEdges().get(2)).getTargetNode()); assertEquals(candidate, ((Edge) stage.getOutEdges().get(0)).getTargetNode()); assertEquals(1, end.getInEdges().stream().filter(sequencePredicate()).count()); assertEquals(candidate, ((List) end.getInEdges().stream().filter(sequencePredicate()) .map(e -> ((Edge) e).getSourceNode()).collect(Collectors.toList())).get(0)); }
Source:
public void deleteCacheStorageTest() { CacheStorageImpl cache = new CacheStorageImpl(); final Map<Identifier, OperatorState> queryState1= new HashMap<>(); queryState1.put(oid1, value1); cache.create(qid1, queryState1); Assert.assertEquals(value1, cache.read(qid1, oid1)); Assert.assertEquals(true, cache.delete(qid1)); Assert.assertSame(null, cache.read(qid1, oid1)); Assert.assertEquals(false, cache.delete(qid1)); Assert.assertEquals(false, cache.delete(qid2)); }

Target:
public void deleteCacheStorageTest() { final CacheStorage cache = new CacheStorageImpl(); final Map<Identifier, OperatorState> queryState1 = new HashMap<>(); queryState1.put(oid1, value1); cache.create(qid1, queryState1); Assert.assertEquals(value1, cache.read(qid1, oid1)); Assert.assertTrue(cache.delete(qid1)); Assert.assertSame(null, cache.read(qid1, oid1)); Assert.assertFalse(cache.delete(qid1)); Assert.assertFalse(cache.delete(qid2)); }
Source:
protected void checkPermission(ProjectControl ctl) throws AuthException { if (!ctl.controlForRef(REF_CONFIG).canSubmit()) { throw new AuthException("You are not allowed to perform this operation." + " To push into this reference you need 'Submit' rights."); } }

Target:
protected void checkPermission(ProjectControl ctl) throws AuthException { if (!ctl.controlForRef(REF_CONFIG).canSubmit()) { throw new AuthException("You are not allowed to perform this operation." + " To submit changes you need 'Submit' rights on " + REF_CONFIG + "."); } }
Source:
private static ValidationResult checkForStructuresWithoutMedia(Workpiece workpiece, Map<String, String> translations) { boolean error = false; boolean warning = false; Collection<String> messages = new HashSet<>(); Collection<String> structuresWithoutMedia = treeStream(workpiece.getRootElement()) .filter(IncludedStructuralElement.class::isInstance).map(IncludedStructuralElement.class::cast) .filter(structure -> structure.getViews().isEmpty()) .map(structure -> translations.get(MESSAGE_STRUCTURE_WITHOUT_MEDIA) + ' ' + structure) .collect(Collectors.toSet()); if (!structuresWithoutMedia.isEmpty()) { messages.addAll(structuresWithoutMedia); warning = true; } if (treeStream(workpiece.getRootElement()).filter(IncludedStructuralElement.class::isInstance) .map(IncludedStructuralElement.class::cast) .flatMap(structure -> structure.getViews().stream()).map(View::getMediaUnit) .filter(workpiece.getMediaUnits()::contains).findAny().isPresent()) { messages.add(translations.get(MESSAGE_MEDIA_MISSING)); error = true; } return new ValidationResult(error ? State.ERROR : warning ? State.WARNING : State.SUCCESS, messages); }

Target:
private static ValidationResult checkForStructuresWithoutMedia(Workpiece workpiece, Map<String, String> translations) { boolean error = false; boolean warning = false; Collection<String> messages = new HashSet<>(); Collection<String> structuresWithoutMedia = treeStream(workpiece.getRootElement()) .filter(IncludedStructuralElement.class::isInstance).map(IncludedStructuralElement.class::cast) .filter(structure -> structure.getViews().isEmpty()) .map(structure -> translations.get(MESSAGE_STRUCTURE_WITHOUT_MEDIA) + ' ' + structure) .collect(Collectors.toSet()); if (!structuresWithoutMedia.isEmpty()) { messages.addAll(structuresWithoutMedia); warning = true; } if (treeStream(workpiece.getRootElement()).filter(IncludedStructuralElement.class::isInstance) .map(IncludedStructuralElement.class::cast) .flatMap(structure -> structure.getViews().stream()).map(View::getMediaUnit) .anyMatch(workpiece.getMediaUnits()::contains)) { messages.add(translations.get(MESSAGE_MEDIA_MISSING)); error = true; } return new ValidationResult(error ? State.ERROR : warning ? State.WARNING : State.SUCCESS, messages); }
Source:
private void parseGraphPrintData(Entity entity, DetailField field, int fieldIndex) { try { Object evaluatedField = entity.getField(fieldIndex); String graphTitle = field.getHeader().evaluate(); if ("".equals(graphTitle) || graphTitle == null) { graphTitle = " "; } String fullGraphHtml = ((GraphData)evaluatedField).getGraphHTML(graphTitle); this.valueString = fullGraphHtml; } catch (GraphException e) { this.valueString = ""; } }

Target:
private void parseGraphPrintData(Entity entity, DetailField field, int fieldIndex) { try { Object evaluatedField = entity.getField(fieldIndex); String graphTitle = field.getHeader().evaluate(); if ("".equals(graphTitle) || graphTitle == null) { graphTitle = " "; } String fullGraphHtml = ((GraphData)evaluatedField).getGraphHTML(graphTitle); this.valueString = fullGraphHtml; } catch (GraphException e) { this.valueString = String.format("<p>AN ERROR OCCURRED: %s</p>", e.getMessage()); } }
Source:
public Long getGenEndTimeAsLong() { return (genEndTime == null) ? null : genEndTime.atZone(ZoneId.systemDefault()).toEpochSecond(); }

Target:
public Long getGenEndTimeAsLong() { return (genEndTime == null) ? null : genEndTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); }
Source:
protected void setDefaultSwitchTypeIfNeeded() { Cluster cluster = getCluster(); if (cluster.isSetRequiredSwitchType()) { SwitchType defaultSwitchType = DefaultSwitchType.getDefaultSwitchType(cluster.getCompatibilityVersion()); cluster.setRequiredSwitchTypeForCluster(defaultSwitchType); } }

Target:
protected void setDefaultSwitchTypeIfNeeded() { Cluster cluster = getCluster(); if (!cluster.isSetRequiredSwitchType()) { SwitchType defaultSwitchType = DefaultSwitchType.getDefaultSwitchType(cluster.getCompatibilityVersion()); cluster.setRequiredSwitchTypeForCluster(defaultSwitchType); } }
Source:
public void onResponse(okhttp3.Call call, okhttp3.Response response) { HttpResponse azureResponse = new OkHttpResponse(response, request); sink.success(new OkHttpResponse(response, request)); sink.onDispose(azureResponse::close); }

Target:
public void onResponse(okhttp3.Call call, okhttp3.Response response) { HttpResponse azureResponse = new OkHttpResponse(response, request); OkHttpResponseCloser.trackResponse(azureResponse); sink.success(azureResponse); }
Source:
private <T extends Item> void mergeBroadcasts( Application application, T chosen, Iterable<T> notChosen, Set<Annotation> activeAnnotations ) { List<T> all = ImmutableList.<T>builder().add(chosen).addAll(notChosen).build(); List<T> notChosenOrdered = application.getConfiguration() .getReadPrecedenceOrdering() .onResultOf(Sourceds.toPublisher()) .sortedCopy(notChosen); List<T> first = application.getConfiguration() .getReadPrecedenceOrdering() .onResultOf(Sourceds.toPublisher()) .leastOf( all.stream() .filter(HAS_BROADCASTS::apply) .collect(Collectors.toList()), 1 ); if (activeAnnotations.contains(Annotation.ALL_BROADCASTS)) { chosen.setBroadcasts( all.stream() .map(T::getBroadcasts) .flatMap(Collection::stream) .collect(MoreCollectors.toImmutableSet()) ); return; } if (!first.isEmpty()) { Publisher sourceForBroadcasts = Iterables.getOnlyElement(first).getSource(); chosen.setBroadcasts( all.stream() .filter(item -> activeAnnotations.contains(Annotation.ALL_MERGED_BROADCASTS) || item.getSource().equals(sourceForBroadcasts) ) .map(T::getBroadcasts) .flatMap(Collection::stream) .collect(MoreCollectors.toImmutableSet()) ); } if (chosen.getBroadcasts() != null && !chosen.getBroadcasts().isEmpty()) { for (Broadcast chosenBroadcast : chosen.getBroadcasts()) { matchAndMerge(chosenBroadcast, notChosenOrdered); } } }

Target:
private <T extends Item> void mergeBroadcasts( Application application, T chosen, Iterable<T> notChosen, Set<Annotation> activeAnnotations ) { List<T> all = ImmutableList.<T>builder().add(chosen).addAll(notChosen).build(); if (activeAnnotations.contains(Annotation.ALL_BROADCASTS)) { chosen.setBroadcasts( all.stream() .map(T::getBroadcasts) .flatMap(Collection::stream) .collect(MoreCollectors.toImmutableSet()) ); return; } List<T> notChosenOrdered = application.getConfiguration() .getReadPrecedenceOrdering() .onResultOf(Sourceds.toPublisher()) .sortedCopy(notChosen); List<T> first = application.getConfiguration() .getReadPrecedenceOrdering() .onResultOf(Sourceds.toPublisher()) .leastOf( all.stream() .filter(HAS_BROADCASTS::apply) .collect(Collectors.toList()), 1 ); if (!first.isEmpty()) { Publisher sourceForBroadcasts = Iterables.getOnlyElement(first).getSource(); chosen.setBroadcasts( all.stream() .filter(item -> activeAnnotations.contains(Annotation.ALL_MERGED_BROADCASTS) || item.getSource().equals(sourceForBroadcasts) ) .map(T::getBroadcasts) .flatMap(Collection::stream) .collect(MoreCollectors.toImmutableSet()) ); } if (chosen.getBroadcasts() != null && !chosen.getBroadcasts().isEmpty()) { for (Broadcast chosenBroadcast : chosen.getBroadcasts()) { matchAndMerge(chosenBroadcast, notChosenOrdered); } } }
Source:
protected void reduceToMinimalMerge() throws MergeException { final Collection<CodeReviewCommit> heads; try { heads = new MergeSorter(rw, alreadyAccepted, CAN_MERGE).sort(toMerge); } catch (IOException e) { throw new MergeException("Branch head sorting failed", e); } toMerge.clear(); toMerge.addAll(heads); Collections.sort(toMerge, new Comparator<CodeReviewCommit>() { public int compare(final CodeReviewCommit a, final CodeReviewCommit b) { return a.originalOrder - b.originalOrder; } }); }

Target:
protected final void reduceToMinimalMerge() throws MergeException { final Collection<CodeReviewCommit> heads; try { heads = new MergeSorter(rw, alreadyAccepted, CAN_MERGE).sort(toMerge); } catch (IOException e) { throw new MergeException("Branch head sorting failed", e); } toMerge.clear(); toMerge.addAll(heads); Collections.sort(toMerge, new Comparator<CodeReviewCommit>() { public int compare(final CodeReviewCommit a, final CodeReviewCommit b) { return a.originalOrder - b.originalOrder; } }); }
Source:
public Response listPhrasesForPage(@HeaderParam("Authorization") String authorization, @PathParam("package") String packageCode, @PathParam("pageName") String pageName) { logger.info(String.format("Listing phrases w/ authorization %s", authorization)); AuthorizationRecord.checkAdminAccess(authorizationService.getAuthorizationRecord(null, authorization), clock.currentDateTime()); logger.info(String.format("Listing phrases, admin validated. Listing phrases for %s-%s", packageCode, pageName)); Optional<GodToolsTranslation> translationOptional = draftTranslation.retrieve(BASE_LANGUAGE_CODE, packageCode, false); if(!translationOptional.isPresent()) { translationOptional = publishedTranslation.retrieve(BASE_LANGUAGE_CODE, packageCode, false); if(!translationOptional.isPresent()) { logger.warn("Something weird... no published English translation for: " + packageCode); return Response.status(Response.Status.BAD_REQUEST).build(); } } Optional<PageStructure> pageOptional = translationOptional.get().getPage(pageName); if(!pageOptional.isPresent()) { logger.warn(String.format("Listing phrases, Page %s not found English translation for %s", pageName, packageCode)); return Response.status(Response.Status.NOT_FOUND).build(); } List<TranslationElement> translationElements = translationElementService.selectByTranslationIdPageStructureId(translationOptional.get().getTranslation().getId(), pageOptional.get().getId()); return Response .ok(translationElements) .build(); }

Target:
public Response listPhrasesForPage(@HeaderParam("Authorization") String authorization, @PathParam("package") String packageCode, @PathParam("pageName") String pageName) { logger.info(String.format("Listing phrases w/ authorization %s", authorization)); AuthorizationRecord.checkAdminAccess(authorizationService.getAuthorizationRecord(null, authorization), clock.currentDateTime()); logger.info(String.format("Listing phrases, admin validated. Listing phrases for %s-%s", packageCode, pageName)); Optional<GodToolsTranslation> translationOptional = getGodToolsTranslationOptional(packageCode); Optional<PageStructure> pageOptional = translationOptional.get().getPage(pageName); if(!pageOptional.isPresent()) { logger.warn(String.format("Listing phrases, Page %s not found English translation for %s", pageName, packageCode)); return Response.status(Response.Status.NOT_FOUND).build(); } List<TranslationElement> translationElements = translationElementService.selectByTranslationIdPageStructureId(translationOptional.get().getTranslation().getId(), pageOptional.get().getId()); return Response .ok(translationElements) .build(); }
Source:
void initListBoxEditors() { vncKeyboardLayoutEditor = new ListModelListBoxEditor<String>(new AbstractRenderer<String>() { final String globalLayout = (String) AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.VncKeyboardLayout); @Override public String render(String object) { if (object == null) { return messages.globalVncKeyboardLayoutCaption(globalLayout); } else { return object; } }; }); }

Target:
void initListBoxEditors() { vncKeyboardLayoutEditor = new ListModelListBoxEditor<String>(new VncKeyMapRenderer(messages)); }
Source:
private Path getTestingModulemapVFSOverlayLocationFromSymlinkTreeRoot( Path headerSymlinkTreeRoot) { return headerSymlinkTreeRoot.resolve("testing.yaml"); }

Target:
private Path getTestingModulemapVFSOverlayLocationFromSymlinkTreeRoot( Path headerSymlinkTreeRoot) { return headerSymlinkTreeRoot.resolve("testing-overlay.yaml"); }
Source:
public void doTestFailAsEncodingNotSupportedBase64() throws Exception { exception.expect(PipeRunException.class); exception.expectMessage("Pipe [FilePipe under test] msgId [null] Error while executing file action(s): (UnsupportedEncodingException) /"); Parameter p = new Parameter(); p.setSessionKey("key"); p.setName("p1"); p.setValue("15"); p.setType("int"); p.configure(); session1.put("key", p); PipeForward fw = new PipeForward(); fw.setName("test"); pipe.registerForward(fw); pipe.addParameter(p); pipe.setCharset("/"); pipe.setDirectory(sourceFolderPath); pipe.setOutputType("base64"); pipe.setActions("read"); pipe.setFileName("1.txt"); pipe.setFileSource("filesystem"); pipe.setActions("create"); pipe.configure(); pipe.doPipe(var, session1); }

Target:
public void doTestFailAsEncodingNotSupportedBase64() throws Exception { exception.expect(PipeRunException.class); exception.expectMessage("Pipe [FilePipe under test] msgId [null] Error while executing file action(s): (UnsupportedEncodingException) /"); Parameter p = new Parameter(); p.setSessionKey("key"); p.setName("p1"); p.setValue("15"); p.setType("int"); p.configure(); session1.put("key", p); PipeForward fw = new PipeForward(); fw.setName("test"); pipe.registerForward(fw); pipe.addParameter(p); pipe.setCharset("/"); pipe.setDirectory(sourceFolderPath); pipe.setOutputType("base64"); pipe.setActions("read"); pipe.setFileName("1.txt"); pipe.setFileSource("filesystem"); pipe.setActions("create"); pipe.configure(); doPipe(pipe, var, session1); fail("this will fail"); }
Source:
public static void delete(File file) throws IOException { for (int n = 0; n < 10; n++) { try { Files.delete(file.toPath()); } catch (DirectoryNotEmptyException dnee) { Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); continue; } catch (AccessDeniedException ade) { Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); continue; } catch (NoSuchFileException nse) { return; } return; } throw new IOException("Could not delete: " + file.toPath()); }

Target:
public static void delete(File file) throws IOException { for (int n = 0; n < 10; n++) { try { Files.delete(file.toPath()); if (Files.exists(file.toPath())) { Uninterruptibles.sleepUninterruptibly(200, TimeUnit.MILLISECONDS); continue; } return; } catch (DirectoryNotEmptyException dnee) { Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); continue; } catch (AccessDeniedException ade) { Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); continue; } catch (NoSuchFileException nse) { return; } } throw new IOException("Could not delete: " + file.toPath()); }
Source:
public void resignLeadership() { if (isLeader.get()) { boolean status = leaseBlobManager.releaseLease(leaseId.get()); if (status) { isLeader.set(false); leaseId = null; renewLeaseSF.cancel(true); livenessSF.cancel(true); } } else { LOG.info("Can't release the lease because it is not the leader and does not hold an active lease."); } }

Target:
public void resignLeadership() { if (isLeader.get()) { leaseBlobManager.releaseLease(leaseId.get()); isLeader.set(false); LOG.info("Resigning leadership with lease ID {}", leaseId.get()); leaseId.getAndSet(null); } else { LOG.info("Can't release the lease because it is not the leader and does not hold an active lease."); } }
Source:
public String getOrCreateToken(String userId, String workspaceId) { lock.writeLock().lock(); try { final Map<String, String> wsRow = tokens.row(workspaceId); String token = wsRow.get(userId); if (token == null) { final PrivateKey privateKey = signatureKeyManager.getKeyPair().getPrivate(); final User user = userManager.getById(userId); final Map<String, Object> header = new HashMap<>(2); header.put("kind", MACHINE_TOKEN_KIND); final Map<String, Object> claims = new HashMap<>(2); claims.put(Claims.ID, UUID.randomUUID().toString()); claims.put(Constants.USER_ID_CLAIM, userId); claims.put(Constants.USER_NAME_CLAIM, user.getName()); claims.put(Constants.WORKSPACE_ID_CLAIM, workspaceId); token = Jwts.builder() .setClaims(claims) .setHeader(header) .signWith(RS512, privateKey) .compact(); tokens.put(workspaceId, userId, token); } return token; } catch (NotFoundException | ServerException ex) { throw new IllegalStateException( format( "Failed to generate machine token for user '%s' and workspace '%s' cause: '%s'", userId, workspaceId, ex.getMessage()), ex); } finally { lock.writeLock().unlock(); } }

Target:
public String getOrCreateToken(String userId, String workspaceId) { lock.writeLock().lock(); try { final Map<String, String> wsRow = tokens.row(workspaceId); String token = wsRow.get(userId); if (token == null) { token = createToken(userId, workspaceId); } return token; } catch (NotFoundException | ServerException ex) { throw new IllegalStateException( format( "Failed to generate machine token for user '%s' and workspace '%s'. Cause: '%s'", userId, workspaceId, ex.getMessage()), ex); } finally { lock.writeLock().unlock(); } }
Source:
public void roleNotSetTest() { loginPage.open(); loginPage.login("test-user@localhost", "password"); doAIA(); assertRedirectSuccess(); }

Target:
public void roleNotSetTest() { loginPage.open(); loginPage.login("test-user@localhost", "password"); doAIA(); errorPage.assertCurrent(); }
Source:
protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegistry, Resource rootResource, ManagementResourceRegistration rootRegistration, RuntimeCapabilityRegistry capabilityRegistry) { super.initializeExtraSubystemsAndModel(extensionRegistry, rootResource, rootRegistration, capabilityRegistry); Map<String, Class> capabilities = new HashMap<>(); capabilities.put(WELD_CAPABILITY_NAME, WeldCapability.class); capabilities.put("org.wildfly.microprofile.config", Void.class); registerServiceCapabilities(capabilityRegistry, capabilities); }

Target:
protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegistry, Resource rootResource, ManagementResourceRegistration rootRegistration, RuntimeCapabilityRegistry capabilityRegistry) { super.initializeExtraSubystemsAndModel(extensionRegistry, rootResource, rootRegistration, capabilityRegistry); Map<String, Class> capabilities = new HashMap<>(); capabilities.put(WELD_CAPABILITY_NAME, WeldCapability.class); registerServiceCapabilities(capabilityRegistry, capabilities); }
Source:
public DocumentModelList run(DocumentModelList documents) { DocumentModelList result = new DocumentModelListImpl(); for (DocumentModel documentModel : documents) { try { result.add(moveContent(documentModel, false)); } catch (Exception e) { log.error("Unable to move document: to cold storage", documentModel.getId(), e); } } if (save) { session.saveDocuments(result.toArray(new DocumentModel[0])); } return result; }

Target:
public DocumentModelList run(DocumentModelList documents) { DocumentModelList result = new DocumentModelListImpl(); for (DocumentModel documentModel : documents) { try { result.add(run(documentModel)); } catch (NuxeoException e) { log.error("Unable to move document: to cold storage", documentModel.getId(), e); } } return result; }
Source:
void dialogChanged() { IResource container = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(getProject())); if(getProject().length() == 0) { updateStatus(Messages.MavenPomWizardPage_error_folder); return; } if(container == null || (container.getType() & IResource.FOLDER | IResource.PROJECT) == 0) { updateStatus(Messages.MavenPomWizardPage_error_folder2); return; } if(!container.isAccessible()) { updateStatus(Messages.MavenPomWizardPage_error_folder_write); return; } String message = validateInput(pomComponent.getGroupId(), false); if(message != null) { updateStatus(message); return; } message = validateInput(pomComponent.getArtifactId(), true); if(message != null) { updateStatus(message); return; } if(pomComponent.getVersion().length() == 0) { updateStatus(Messages.MavenPomWizardPage_error_version); return; } if(pomComponent.getPackaging().length() == 0) { updateStatus(Messages.MavenPomWizardPage_error_pack); return; } if(container instanceof IProject && projectConversionEnabler != null) { IStatus status = projectConversionEnabler.canBeConverted((IProject) container); if(status.getSeverity() == IStatus.ERROR) { updateStatus(status.getMessage()); return; } } updateStatus(null); }

Target:
void dialogChanged() { IResource container = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(getProject())); if(getProject().length() == 0) { updateStatus(Messages.MavenPomWizardPage_error_folder); return; } if(container == null || (container.getType() & IResource.FOLDER | IResource.PROJECT) == 0) { updateStatus(Messages.MavenPomWizardPage_error_folder2); return; } if(!container.isAccessible()) { updateStatus(Messages.MavenPomWizardPage_error_folder_write); return; } String message = validateGroupIdInput(pomComponent.getGroupId()); if(message != null) { updateStatus(message); return; } message = validateArtifactIdInput(pomComponent.getArtifactId()); if(message != null) { updateStatus(message); return; } if(pomComponent.getVersion().length() == 0) { updateStatus(Messages.MavenPomWizardPage_error_version); return; } if(pomComponent.getPackaging().length() == 0) { updateStatus(Messages.MavenPomWizardPage_error_pack); return; } if(container instanceof IProject && projectConversionEnabler != null) { IStatus status = projectConversionEnabler.canBeConverted((IProject) container); if(status.getSeverity() == IStatus.ERROR) { updateStatus(status.getMessage()); return; } } updateStatus(null); }
Source:
public static void renameTempPartitionFile(File workDir, int partId) throws IgniteCheckedException { File defragmentedPartTmpFile = defragmentedPartTmpFile(workDir, partId); File defragmentedPartFile = defragmentedPartFile(workDir, partId); assert !defragmentedPartFile.exists() : defragmentedPartFile; try { Files.move(defragmentedPartTmpFile.toPath(), defragmentedPartFile.toPath(), ATOMIC_MOVE); } catch (IOException e) { handleIoException(e); } }

Target:
public static void renameTempPartitionFile(File workDir, int partId) throws IgniteException { File defragmentedPartTmpFile = defragmentedPartTmpFile(workDir, partId); File defragmentedPartFile = defragmentedPartFile(workDir, partId); assert !defragmentedPartFile.exists() : defragmentedPartFile; try { Files.move(defragmentedPartTmpFile.toPath(), defragmentedPartFile.toPath(), ATOMIC_MOVE); } catch (IOException e) { throw new IgniteException(e); } }
Source:
public void streaming(InputStream stream)

Target:
public String streaming(InputStream stream) { try { byte[] bytes = ByteStreams.toByteArray(stream); return new String(bytes, StandardCharsets.UTF_8); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { parameterTypeCheck(args[0], ntp1); parameterTypeCheck(args[1], ntp2); if (nodeCompare(FunctionHelper.getLocalNodeId(args[0], tp), FunctionHelper.getLocalNodeId(args[1], tp))) { XDMConstants.setTrue(result); } else { XDMConstants.setFalse(result); } }

Target:
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { if (args[0].getTag() != ValueTag.NODE_TREE_TAG) { throw new SystemException(ErrorCode.FORG0006); } if (args[1].getTag() != ValueTag.NODE_TREE_TAG) { throw new SystemException(ErrorCode.FORG0006); } if (nodeCompare(FunctionHelper.getLocalNodeId(args[0], tp), FunctionHelper.getLocalNodeId(args[1], tp))) { XDMConstants.setTrue(result); } else { XDMConstants.setFalse(result); } }
Source:
public void validateRowGroupStatistics( OrcDataSourceId orcDataSourceId, long stripeOffset, int rowGroupIndex, List<ColumnStatistics> actual) throws OrcCorruptionException { List<RowGroupStatistics> rowGroups = rowGroupStatistics.get(stripeOffset); if (rowGroups == null) { throw new OrcCorruptionException(orcDataSourceId, "Unexpected stripe at offset %s", stripeOffset); } if (rowGroups.size() <= rowGroupIndex) { throw new OrcCorruptionException(orcDataSourceId, "Unexpected row group %s in stripe at offset %s", rowGroupIndex, stripeOffset); } RowGroupStatistics expectedRowGroup = rowGroups.get(rowGroupIndex); RowGroupStatistics actualRowGroup = new RowGroupStatistics(false, IntStream.range(1, actual.size()).boxed().collect(toImmutableMap(identity(), actual::get))); if (!expectedRowGroup.isLowMemoryMode()) { Map<Integer, ColumnStatistics> expectedByColumnIndex = expectedRowGroup.getColumnStatistics(); List<ColumnStatistics> expected = IntStream.range(1, actual.size()) .mapToObj(expectedByColumnIndex::get) .collect(toImmutableList()); actual = actual.subList(1, actual.size()); validateColumnStatisticsEquivalent(orcDataSourceId, "Row group " + rowGroupIndex + " in stripe at offset " + stripeOffset, actual, expected); } if (expectedRowGroup.getHash() != actualRowGroup.getHash()) { throw new OrcCorruptionException(orcDataSourceId, "Checksum mismatch for row group %s in stripe at offset %s", rowGroupIndex, stripeOffset); } }

Target:
public void validateRowGroupStatistics( OrcDataSourceId orcDataSourceId, long stripeOffset, int rowGroupIndex, List<ColumnStatistics> actual) throws OrcCorruptionException { List<RowGroupStatistics> rowGroups = rowGroupStatistics.get(stripeOffset); if (rowGroups == null) { throw new OrcCorruptionException(orcDataSourceId, "Unexpected stripe at offset %s", stripeOffset); } if (rowGroups.size() <= rowGroupIndex) { throw new OrcCorruptionException(orcDataSourceId, "Unexpected row group %s in stripe at offset %s", rowGroupIndex, stripeOffset); } RowGroupStatistics expectedRowGroup = rowGroups.get(rowGroupIndex); RowGroupStatistics actualRowGroup = new RowGroupStatistics(BOTH, IntStream.range(1, actual.size()).boxed().collect(toImmutableMap(identity(), actual::get))); if (expectedRowGroup.getValidationMode() != HASHED) { Map<Integer, ColumnStatistics> expectedByColumnIndex = expectedRowGroup.getColumnStatistics(); List<ColumnStatistics> expected = IntStream.range(1, actual.size()) .mapToObj(expectedByColumnIndex::get) .collect(toImmutableList()); actual = actual.subList(1, actual.size()); validateColumnStatisticsEquivalent(orcDataSourceId, "Row group " + rowGroupIndex + " in stripe at offset " + stripeOffset, actual, expected); } if (expectedRowGroup.getValidationMode() != DETAILED) { if (expectedRowGroup.getHash() != actualRowGroup.getHash()) { throw new OrcCorruptionException(orcDataSourceId, "Checksum mismatch for row group %s in stripe at offset %s", rowGroupIndex, stripeOffset); } } }
Source:
public String getAlign() { if (mAlign.startsWith(ATTR_ALIGN)) { return mAlign.substring(ATTR_ALIGN.length(), mAlign.length()); } return mAlign; }

Target:
public String getAlign() { if (!TextUtils.isEmpty(mAlign) && mAlign.startsWith(ATTR_ALIGN)) { return mAlign.substring(ATTR_ALIGN.length(), mAlign.length()); } return mAlign; }
Source:
public LocalDateTime getDate() { if (viewModel.getDate() == null) { LocalDateTime date = (LocalDateTime) getArguments().getSerializable(DateTimeWidgetUtils.DATE); viewModel.setDate(date); } return viewModel.getDate(); }

Target:
public LocalDateTime getDate() { return getDay() == 0 ? viewModel.getLocalDateTime() : getOriginalDate(); }